Ensure both GatewayIP and NoGateway cannot be set in subnets
diff --git a/openstack/networking/v2/subnets/requests.go b/openstack/networking/v2/subnets/requests.go
index 1c7ef7b..8fa1e6d 100644
--- a/openstack/networking/v2/subnets/requests.go
+++ b/openstack/networking/v2/subnets/requests.go
@@ -129,6 +129,11 @@
return nil, errInvalidIPType
}
+ // Both GatewayIP and NoGateway should not be set
+ if opts.GatewayIP != "" && opts.NoGateway {
+ return nil, errInvalidGatewayConfig
+ }
+
s["network_id"] = opts.NetworkID
s["cidr"] = opts.CIDR
@@ -197,6 +202,11 @@
func (opts UpdateOpts) ToSubnetUpdateMap() (map[string]interface{}, error) {
s := make(map[string]interface{})
+ // Both GatewayIP and NoGateway should not be set
+ if opts.GatewayIP != "" && opts.NoGateway {
+ return nil, errInvalidGatewayConfig
+ }
+
if opts.EnableDHCP != nil {
s["enable_dhcp"] = &opts.EnableDHCP
}