Browse Source

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
changes/17/557917/2
Gary Kotton 3 years ago
parent
commit
7c3f1e63df
  1. 10
      vmware_nsx/plugins/nsx_v3/plugin.py
  2. 2
      vmware_nsx/tests/unit/nsx_v3/test_plugin.py

10
vmware_nsx/plugins/nsx_v3/plugin.py

@ -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:

2
vmware_nsx/tests/unit/nsx_v3/test_plugin.py

@ -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,

Loading…
Cancel
Save