Add api to get all MP tier0 uplink ports
Change-Id: I11b96d2be8fd8e0f240fceb42dc01e4769d51a36
This commit is contained in:
parent
3ba085fec3
commit
d4c1f06339
@ -1499,6 +1499,13 @@ class LogicalRouterPortTestCase(BaseTestResource):
|
||||
result = lrport.get_tier1_link_port(router_id)
|
||||
self.assertEqual(test_constants.FAKE_ROUTER_LINKT1_PORT, result)
|
||||
|
||||
def test_get_tier0_uplink_ports(self):
|
||||
router_id = test_constants.FAKE_ROUTER_PORT['logical_router_id']
|
||||
lrport = self.get_mocked_resource(response={'results': [
|
||||
test_constants.FAKE_ROUTER_PORT]})
|
||||
result = lrport.get_tier0_uplink_ports(router_id)
|
||||
self.assertEqual([test_constants.FAKE_ROUTER_PORT], result)
|
||||
|
||||
def test_get_tier0_uplink_port(self):
|
||||
"""Test getting a Tier0 router uplink port by router id."""
|
||||
router_id = test_constants.FAKE_ROUTER_PORT['logical_router_id']
|
||||
|
@ -370,11 +370,18 @@ class LogicalRouterPort(utils.NsxLibApiBase):
|
||||
manager=self.client.nsx_api_managers,
|
||||
operation="get router link port")
|
||||
|
||||
def get_tier0_uplink_port(self, logical_router_id):
|
||||
def get_tier0_uplink_ports(self, logical_router_id):
|
||||
logical_router_ports = self.get_by_router_id(logical_router_id)
|
||||
ports = []
|
||||
for port in logical_router_ports:
|
||||
if port['resource_type'] == nsx_constants.LROUTERPORT_UPLINK:
|
||||
return port
|
||||
ports.append(port)
|
||||
return ports
|
||||
|
||||
def get_tier0_uplink_port(self, logical_router_id):
|
||||
ports = self.get_tier0_uplink_ports(logical_router_id)
|
||||
if ports:
|
||||
return ports[0]
|
||||
|
||||
def get_tier0_uplink_subnets(self, logical_router_id):
|
||||
port = self.get_tier0_uplink_port(logical_router_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user