Return 404 when executing net-list-on-dhcp-agent with invalid agent_id
Neutron server returns HTTP code 200 when users execute net-list-on-dhcp-agent with invalid agent_id. Users expect HTTP code 404 to be returned. Change-Id: I41652a9bf4a81835abb6646ea870781472757623 Closes-bug: 1425138
This commit is contained in:
parent
d479b47938
commit
dc4268b854
|
@ -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):
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue