Allow getting transport zone ID from T1 DR

This will be used in a single-tier topology,
where only one T1 is configured (like the T0
in a two-tier topology).

Change-Id: I9028837ff204554b27d92d4dceececc2f5144b3d
This commit is contained in:
Shih-Hao Li 2018-12-04 13:48:40 -08:00
parent 33b45b925c
commit bb69e4dedd
3 changed files with 11 additions and 3 deletions

View File

@ -987,12 +987,12 @@ class LogicalRouterTestCase(BaseTestResource):
res = router.get_transportzone_id(router_id)
self.assertIsNone(res)
def test_get_transportzone_id(self):
def _test_get_transportzone_id(self, router_type):
router = self.get_mocked_resource()
router_id = test_constants.FAKE_ROUTER_UUID
faked_responds = {
'componentInfo': [{
'componentType': nsx_constants.ROUTER_TYPE_TIER0_DR,
'componentType': router_type,
'transportZoneId': ['faked_id']
}]
}
@ -1001,6 +1001,12 @@ class LogicalRouterTestCase(BaseTestResource):
res = router.get_transportzone_id(router_id)
self.assertEqual('faked_id', res)
def test_get_transportzone_id_from_t0(self):
self._test_get_transportzone_id(nsx_constants.ROUTER_TYPE_TIER0_DR)
def test_get_transportzone_id_from_t1(self):
self._test_get_transportzone_id(nsx_constants.ROUTER_TYPE_TIER1_DR)
class LogicalRouterPortTestCase(BaseTestResource):

View File

@ -687,7 +687,8 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase):
def get_transportzone_id(self, logical_router_id):
res = self.get_debug_info(logical_router_id)
for item in res['componentInfo']:
if item['componentType'] == nsx_constants.ROUTER_TYPE_TIER0_DR:
if item['componentType'] in (nsx_constants.ROUTER_TYPE_TIER0_DR,
nsx_constants.ROUTER_TYPE_TIER1_DR):
if item['transportZoneId']:
return item['transportZoneId'][0]
LOG.warning('OverlayTransportZone is not yet available on'

View File

@ -40,6 +40,7 @@ BRIDGE_ENDPOINT = "BRIDGEENDPOINT"
ROUTER_TYPE_TIER0 = "TIER0"
ROUTER_TYPE_TIER1 = "TIER1"
ROUTER_TYPE_TIER0_DR = "DISTRIBUTED_ROUTER_TIER0"
ROUTER_TYPE_TIER1_DR = "DISTRIBUTED_ROUTER_TIER1"
LROUTERPORT_UPLINK = "LogicalRouterUpLinkPort"
LROUTERPORT_DOWNLINK = "LogicalRouterDownLinkPort"