diff --git a/vmware_nsx/plugins/nsx_p/plugin.py b/vmware_nsx/plugins/nsx_p/plugin.py index 65d8da849c..64e0916783 100644 --- a/vmware_nsx/plugins/nsx_p/plugin.py +++ b/vmware_nsx/plugins/nsx_p/plugin.py @@ -1386,17 +1386,16 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base): def _validate_subnet_gw_ip(self, context, subnet, orig_subnet=None): # Make sure the gw ip is legal and belongs to the subnet - raw_gw_ip = subnet.get('gateway_ip') + raw_gw_ip = subnet.get('gateway_ip', const.ATTR_NOT_SPECIFIED) if orig_subnet and raw_gw_ip == const.ATTR_NOT_SPECIFIED: # No change in GW ip raw_gw_ip = orig_subnet.get('gateway_ip') - raw_cidr = subnet.get('cidr') + raw_cidr = subnet.get('cidr', const.ATTR_NOT_SPECIFIED) if (orig_subnet and (not raw_cidr or raw_cidr == const.ATTR_NOT_SPECIFIED)): raw_cidr = orig_subnet.get('cidr') if (not raw_gw_ip or raw_gw_ip == const.ATTR_NOT_SPECIFIED or not raw_cidr or raw_cidr == const.ATTR_NOT_SPECIFIED): - if orig_subnet and raw_gw_ip is None: # in update case, if the subnet is attached to a router the gw # cannot be removes @@ -1408,6 +1407,7 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base): if orig_subnet['id'] == interface_sub: msg = _('Subnet for router interface must have a ' 'gateway IP') + LOG.error(msg) raise n_exc.BadRequest(resource='router', msg=msg) # Nothing else to check here return