Merge "Return 404 when executing net-list-on-dhcp-agent with invalid agent_id"

This commit is contained in:
Jenkins 2015-03-12 13:35:58 +00:00 committed by Gerrit Code Review
commit e6265f0108
2 changed files with 8 additions and 1 deletions

View File

@ -370,6 +370,8 @@ class DhcpAgentSchedulerDbMixin(dhcpagentscheduler
return {'networks':
self.get_networks(context, filters={'id': net_ids})}
else:
# Exception will be thrown if the requested agent does not exist.
self._get_agent(context, id)
return {'networks': []}
def list_active_networks_on_active_dhcp_agent(self, context, host):

View File

@ -1175,10 +1175,15 @@ class OvsAgentSchedulerTestCase(OvsAgentSchedulerTestCaseBase):
admin_context=False)
def test_list_routers_hosted_by_l3_agent_with_invalid_agent(self):
invalid_agentid = 'non_existent_agent'
invalid_agentid = 'non_existing_agent'
self._list_routers_hosted_by_l3_agent(invalid_agentid,
exc.HTTPNotFound.code)
def test_list_networks_hosted_by_dhcp_agent_with_invalid_agent(self):
invalid_agentid = 'non_existing_agent'
self._list_networks_hosted_by_dhcp_agent(invalid_agentid,
exc.HTTPNotFound.code)
class OvsDhcpAgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin,
test_agent_ext_plugin.AgentDBTestMixIn,