Merge "NSX|V3+P: Fix MDProxy TZ validation"

This commit is contained in:
Zuul 2019-10-22 06:35:53 +00:00 committed by Gerrit Code Review
commit 27a93cb2e6
3 changed files with 14 additions and 6 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

@ -148,7 +148,9 @@ class NsxPPluginTestCaseMixin(
mock.patch("vmware_nsxlib.v3.core_resources.NsxLibTransportNode."
"get_transport_zones",
return_value=[NSX_OVERLAY_TZ_NAME,
NSX_VLAN_TZ_NAME]).start()
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

@ -182,6 +182,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):
@ -2797,7 +2804,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)
@ -3161,7 +3168,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()