NSX|P: Fix GW validation for updated subnet
Change-Id: I734e356f905171f2a26fa604cf273dbfdbf4f224
This commit is contained in:
parent
012f9f6740
commit
1f02664997
@ -1362,10 +1362,12 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
|
|||||||
def _validate_subnet_gw_ip(self, subnet, orig_subnet=None):
|
def _validate_subnet_gw_ip(self, subnet, orig_subnet=None):
|
||||||
# Make sure the gw ip is legal and belongs to the subnet
|
# 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')
|
||||||
if orig_subnet and raw_gw_ip == const.ATTR_NOT_SPECIFIED:
|
if (orig_subnet and
|
||||||
|
(not raw_gw_ip or raw_gw_ip == const.ATTR_NOT_SPECIFIED)):
|
||||||
raw_gw_ip = orig_subnet.get('gateway_ip')
|
raw_gw_ip = orig_subnet.get('gateway_ip')
|
||||||
raw_cidr = subnet.get('cidr')
|
raw_cidr = subnet.get('cidr')
|
||||||
if orig_subnet and raw_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')
|
raw_cidr = orig_subnet.get('cidr')
|
||||||
if (not raw_gw_ip or raw_gw_ip == const.ATTR_NOT_SPECIFIED or
|
if (not raw_gw_ip or raw_gw_ip == const.ATTR_NOT_SPECIFIED or
|
||||||
not raw_cidr or raw_cidr == const.ATTR_NOT_SPECIFIED):
|
not raw_cidr or raw_cidr == const.ATTR_NOT_SPECIFIED):
|
||||||
|
@ -1149,6 +1149,9 @@ class NsxPTestSubnets(common_v3.NsxV3TestSubnets,
|
|||||||
def test_create_subnet_gw_outside_cidr_returns_201(self):
|
def test_create_subnet_gw_outside_cidr_returns_201(self):
|
||||||
self.skipTest("NSX subnet GW validation")
|
self.skipTest("NSX subnet GW validation")
|
||||||
|
|
||||||
|
def test_update_subnet_gw_outside_cidr_returns_200(self):
|
||||||
|
self.skipTest("NSX subnet GW validation")
|
||||||
|
|
||||||
def test_create_subnet_ipv6_gw_validation(self):
|
def test_create_subnet_ipv6_gw_validation(self):
|
||||||
# Illegal GW as first ip in range
|
# Illegal GW as first ip in range
|
||||||
gateway_ip = 'fe80::0'
|
gateway_ip = 'fe80::0'
|
||||||
|
Loading…
Reference in New Issue
Block a user