Merge "NSX|V3+P: Fix MDProxy TZ validation" into stable/stein

This commit is contained in:
Zuul 2019-10-22 08:02:28 +00:00 committed by Gerrit Code Review
commit ad50291f67
3 changed files with 17 additions and 5 deletions

View File

@ -1000,7 +1000,6 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
physical_net = network_data.get(pnet.PHYSICAL_NETWORK)
if not validators.is_attr_set(physical_net):
physical_net = None
vlan_id = network_data.get(pnet.SEGMENTATION_ID)
if not validators.is_attr_set(vlan_id):
vlan_id = None
@ -1154,8 +1153,8 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
for tn_uuid in ec_nodes:
ec_tzs.extend(self.nsxlib.transport_node.get_transport_zones(
tn_uuid))
if tz_uuid not in ec_tzs:
return False
if tz_uuid not in ec_tzs:
return False
return True
def _network_is_nsx_net(self, context, network_id):

View File

@ -137,6 +137,12 @@ class NsxPPluginTestCaseMixin(
return_value=nsx_constants.NSX_VERSION_2_5_0).start()
mock.patch("vmware_nsxlib.v3.core_resources.NsxLibLogicalRouter."
"update").start()
mock.patch("vmware_nsxlib.v3.core_resources.NsxLibTransportNode."
"get_transport_zones",
return_value=[NSX_OVERLAY_TZ_NAME,
NSX_VLAN_TZ_NAME, mock.ANY]).start()
mock.patch("vmware_nsxlib.v3.core_resources.NsxLibEdgeCluster."
"get_transport_nodes", return_value=["dummy"]).start()
def _mock_nsxlib_backend_calls(self):
"""Mock nsxlib backend calls used as passthrough

View File

@ -180,6 +180,13 @@ def _mock_nsx_backend_calls():
mock.patch('vmware_nsxlib.v3.core_resources.NsxLibTransportZone.'
'get_transport_type', return_value='OVERLAY').start()
mock.patch("vmware_nsxlib.v3.core_resources.NsxLibEdgeCluster."
"get_transport_nodes", return_value=['dummy']).start()
mock.patch("vmware_nsxlib.v3.core_resources.NsxLibTransportNode."
"get_transport_zones",
return_value=[NSX_TZ_NAME, mock.ANY]).start()
class NsxV3PluginTestCaseMixin(test_plugin.NeutronDbPluginV2TestCase,
nsxlib_testcase.NsxClientTestCase):
@ -2790,7 +2797,7 @@ class TestL3NatTestCase(L3NatTest,
router_id, ext_subnet['network_id'])
# Checking that router update is being called with
# edge_cluster_uuid, for creating a service router
change_sr.assert_called_once_with(
change_sr.assert_any_call(
mock.ANY, edge_cluster_id=NSX_EDGE_CLUSTER_UUID,
enable_standby_relocation=True)
@ -3154,7 +3161,7 @@ class TestL3NatTestCase(L3NatTest,
router_id = r['router']['id']
self._add_external_gateway_to_router(
router_id, ext_subnet['network_id'])
change_sr.assert_called_once_with(
change_sr.assert_any_call(
mock.ANY, edge_cluster_id=edge_cluster,
enable_standby_relocation=True)
self.mock_get_edge_cluster.start()