Merge "Add a new method get_router_info to L3 agent extension API"
This commit is contained in:
commit
4821ae1408
@ -36,3 +36,4 @@ router information to L3 agent extensions::
|
||||
#. get_routers_in_project
|
||||
#. get_router_hosting_port
|
||||
#. is_router_in_namespace
|
||||
#. get_router_info
|
||||
|
@ -64,3 +64,7 @@ class L3AgentExtensionAPI(object):
|
||||
local_namespaces = self._local_namespaces()
|
||||
ri = self._router_info.get(router_id)
|
||||
return ri and ri.ns_name in local_namespaces
|
||||
|
||||
def get_router_info(self, router_id):
|
||||
"""Return RouterInfo for the given router id."""
|
||||
return self._router_info.get(router_id)
|
||||
|
@ -94,3 +94,14 @@ class TestL3AgentExtensionApi(base.BaseTestCase):
|
||||
api_object = l3_agent_api.L3AgentExtensionAPI(router_info)
|
||||
router_in_ns = api_object.is_router_in_namespace(ri.router_id)
|
||||
self.assertFalse(router_in_ns)
|
||||
|
||||
def test_get_router_info(self):
|
||||
router_info, ri = self._prepare_router_data()
|
||||
api_object = l3_agent_api.L3AgentExtensionAPI(router_info)
|
||||
self.assertEqual(ri, api_object.get_router_info(self.router_id))
|
||||
|
||||
def test_get_router_info_nonexistent(self):
|
||||
router_info, ri = self._prepare_router_data()
|
||||
api_object = l3_agent_api.L3AgentExtensionAPI(router_info)
|
||||
self.assertIsNone(
|
||||
api_object.get_router_info(uuidutils.generate_uuid()))
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- A new method ``get_router_info`` has been added to
|
||||
``L3AgentExtensionAPI``.
|
Loading…
x
Reference in New Issue
Block a user