NSX|V3: fix ENS VLAN attach to router

When the default TZ is a ENS VLAN TZ then we identify this this
is not a regular overlay network. It is a VLAN network. There was
a missing check for regular networks that were not provider
networks.

Change-Id: I9e4241fd2e1047ba14442babc4677efa4dcab3a5
This commit is contained in:
Gary Kotton 2018-03-22 07:06:35 +02:00
parent 456ac69e49
commit 7c3f1e63df
2 changed files with 12 additions and 0 deletions

View File

@ -1037,6 +1037,16 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
bindings = nsx_db.get_network_bindings(context.session, network_id)
# With NSX plugin, "normal" overlay networks will have no binding
if not bindings:
# check the backend network
# TODO(asarfaty): Keep TZ type in DB to avoid going to the backend
az = self.get_network_az_by_net_id(context, network_id)
ls = self.nsxlib.logical_switch.get(az._default_overlay_tz_uuid)
tz = ls.get('transport_zone_id')
if tz:
backend_type = self.nsxlib.transport_zone.get_transport_type(
tz)
return (backend_type ==
self.nsxlib.transport_zone.TRANSPORT_TYPE_OVERLAY)
return True
binding = bindings[0]
if binding.binding_type == utils.NsxV3NetworkTypes.GENEVE:

View File

@ -169,6 +169,8 @@ def _mock_nsx_backend_calls():
mock.patch(
"vmware_nsxlib.v3.load_balancer.Service.get_router_lb_service",
return_value=None).start()
mock.patch('vmware_nsxlib.v3.core_resources.NsxLibTransportZone.'
'get_transport_type', return_value='OVERLAY').start()
class NsxV3PluginTestCaseMixin(test_plugin.NeutronDbPluginV2TestCase,