Merge "Return 404 when executing router-list-on-l3-agent with invalid agent_id"

This commit is contained in:
Jenkins 2015-02-24 17:20:55 +00:00 committed by Gerrit Code Review
commit 51edb26950
2 changed files with 7 additions and 0 deletions

View File

@ -266,6 +266,8 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
context, [router_id], new_agent.host)
def list_routers_on_l3_agent(self, context, agent_id):
# Exception thrown if the requested agent does not exist.
self._get_agent(context, agent_id)
query = context.session.query(RouterL3AgentBinding.router_id)
query = query.filter(RouterL3AgentBinding.l3_agent_id == agent_id)

View File

@ -1174,6 +1174,11 @@ class OvsAgentSchedulerTestCase(OvsAgentSchedulerTestCaseBase):
expected_code=exc.HTTPForbidden.code,
admin_context=False)
def test_list_routers_hosted_by_l3_agent_with_invalid_agent(self):
invalid_agentid = 'non_existent_agent'
self._list_routers_hosted_by_l3_agent(invalid_agentid,
exc.HTTPNotFound.code)
class OvsDhcpAgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin,
test_agent_ext_plugin.AgentDBTestMixIn,