Find tier0's tranzport_zone via advanced_config
When finding the overlay transport zone of a tier0 router, if its advanced_config already has transport_zone_id defined, then return it directly. Otherwise search through the edge nodes in the corresponding edge_cluster. Change-Id: Idf1efd9d0cd2c2ef5af895d22fc156630d855488
This commit is contained in:
parent
38677f3bc1
commit
43d0482cc6
@ -579,6 +579,7 @@ FAKE_TIERO_ROUTER = {
|
||||
"target_id": "c3d80576-e340-403d-a2d0-f4a72a1db6e3"
|
||||
}],
|
||||
"advanced_config": {
|
||||
"transport_zone_id": FAKE_TZ_UUID,
|
||||
"external_transit_networks": ["100.64.0.0/16"],
|
||||
"internal_transit_network": "169.254.0.0/28"
|
||||
},
|
||||
|
@ -161,6 +161,13 @@ class TestRouter(nsxlib_testcase.NsxClientTestCase):
|
||||
tz = self.nsxlib.router.get_tier0_router_overlay_tz(tier0_uuid)
|
||||
self.assertEqual(tz, test_constants.FAKE_TZ_UUID)
|
||||
|
||||
def test_get_tier0_router_overlay_tz_via_advanced_config(self):
|
||||
tier0_uuid = uuidutils.generate_uuid()
|
||||
with mock.patch.object(self.nsxlib.router._router_client, 'get',
|
||||
return_value=test_constants.FAKE_TIERO_ROUTER):
|
||||
tz = self.nsxlib.router.get_tier0_router_overlay_tz(tier0_uuid)
|
||||
self.assertEqual(tz, test_constants.FAKE_TZ_UUID)
|
||||
|
||||
def test_get_connected_t0_transit_net(self):
|
||||
t1_uuid = uuidutils.generate_uuid()
|
||||
transit_net = '1.1.1.0'
|
||||
|
@ -293,6 +293,10 @@ class RouterLib(object):
|
||||
return tier0_tzs
|
||||
|
||||
def get_tier0_router_overlay_tz(self, tier0_uuid):
|
||||
lrouter = self._router_client.get(tier0_uuid)
|
||||
tz_uuid = lrouter.get('advanced_config', {}).get('transport_zone_id')
|
||||
if tz_uuid:
|
||||
return tz_uuid
|
||||
tz_uuids = self.get_tier0_router_tz(tier0_uuid)
|
||||
for tz_uuid in tz_uuids:
|
||||
# look for the overlay tz
|
||||
|
Loading…
Reference in New Issue
Block a user