NSX-v3: Fix add router interface for VLAN downlinks

In NSX, a service router is required when attaching a VLAN interface
to a router.
This change ensures the service router is set before attaching the
interface. This allow for the interface to be attached even before
setting a gateway for the router.

Change-Id: Ia070aed9c97f3c87615b9c7e0b084f2edb26e0a9
This commit is contained in:
Salvatore Orlando 2021-07-19 06:37:24 -07:00 committed by Salvatore Orlando
parent c0cdd2523e
commit debc8b2b64
1 changed files with 7 additions and 0 deletions

View File

@ -2745,6 +2745,13 @@ class NsxV3Plugin(nsx_plugin_common.NsxPluginV3Base,
resource_type = (None if overlay_net else
nsxlib_consts.LROUTERPORT_CENTRALIZED)
# Centralized router port require a service router
if resource_type == nsxlib_consts.LROUTERPORT_CENTRALIZED:
if not self.verify_sr_at_backend(
context, router_id):
self.create_service_router(
context, router_id, router=router_db)
# Validate the TZ of the new subnet match the one of the router
tier0_uuid = self._get_tier0_uuid_by_router(context.elevated(),
router_db)