Merge "Add NeutronNetworks.list_agents"

This commit is contained in:
Jenkins 2016-11-14 17:36:40 +00:00 committed by Gerrit Code Review
commit c356122653
7 changed files with 103 additions and 1 deletions

View File

@ -194,6 +194,22 @@
failure_rate:
max: 20
NeutronNetworks.list_agents:
-
args:
agent_args: {}
runner:
type: "constant"
times: {{smoke or 10}}
concurrency: {{smoke or 3}}
context:
users:
tenants: {{smoke or 3}}
users_per_tenant: {{smoke or 2}}
sla:
failure_rate:
max: 0
NeutronNetworks.create_and_update_networks:
-
args:

View File

@ -368,3 +368,20 @@ class CreateAndDeleteFloatingIps(utils.NeutronScenario):
floating_ip = self._create_floatingip(floating_network,
**floating_ip_args)
self._delete_floating_ip(floating_ip["floatingip"])
@validation.required_services(consts.Service.NEUTRON)
@validation.required_openstack(users=True)
@scenario.configure(name="NeutronNetworks.list_agents")
class ListAgents(utils.NeutronScenario):
def run(self, agent_args=None):
"""List all neutron agents.
This simple scenario tests the "neutron agent-list" command by
listing all the neutron agents.
:param agent_args: dict, POST /v2.0/agents request options
"""
agent_args = agent_args or {}
self._list_agents(**agent_args)

View File

@ -74,6 +74,15 @@ class NeutronScenario(scenario.OpenStackScenario):
"""
return self.clients("neutron").list_networks(**kwargs)["networks"]
@atomic.action_timer("neutron.list_agents")
def _list_agents(self, **kwargs):
"""Fetches agents.
:param kwargs: neutron agent list options
:returns: user agents list
"""
return self.clients("neutron").list_agents(**kwargs)["agents"]
@atomic.action_timer("neutron.update_network")
def _update_network(self, network, network_update_args):
"""Update the network.

View File

@ -0,0 +1,25 @@
{
"NeutronNetworks.list_agents": [
{
"args": {
"agent_args": {}
},
"runner": {
"type": "constant",
"times": 10,
"concurrency": 2
},
"context": {
"users": {
"tenants": 2,
"users_per_tenant": 3
}
},
"sla": {
"failure_rate": {
"max": 0
}
}
}
]
}

View File

@ -0,0 +1,16 @@
---
NeutronNetworks.list_agents:
-
args:
agent_args: {}
runner:
type: "constant"
times: 10
concurrency: 2
context:
users:
tenants: 2
users_per_tenant: 3
sla:
failure_rate:
max: 0

View File

@ -208,6 +208,17 @@ class NeutronNetworksTestCase(test.ScenarioTestCase):
subnets_per_network, router_create_args)
scenario._list_routers.assert_called_once_with()
def test_list_agents(self):
agent_args = {
"F": "id",
"sort-dir": "asc"
}
scenario = network.ListAgents(self.context)
scenario._list_agents = mock.Mock()
scenario.run(agent_args=agent_args)
scenario._list_agents.assert_called_once_with(**agent_args)
def test_create_and_update_routers(self):
router_update_args = {"admin_state_up": False}
network_create_args = {"router:external": True}

View File

@ -270,6 +270,14 @@ class NeutronScenarioTestCase(test.ScenarioTestCase):
self._test_atomic_action_timer(self.scenario.atomic_actions(),
"neutron.list_routers")
def test_list_agents(self):
agents = [mock.Mock()]
self.clients("neutron").list_agents.return_value = {
"agents": agents}
self.assertEqual(agents, self.scenario._list_agents())
self._test_atomic_action_timer(self.scenario.atomic_actions(),
"neutron.list_agents")
def test_update_router(self):
expected_router = {
"router": {