Add rally case for create and delete network

Add the create and delete network case, and the task file.
You can run the case by running:
rally --plugin-paths rally-jobs/plugins/ task start
rally-jobs/tasks/scenarios/create_and_delete_networks.json

implements blueprint: fullstack-testing

Change-Id: I48d3f2dbc75b8d7ec407dd18826b58f480ebaa02
This commit is contained in:
Baohua Yang 2016-03-01 20:09:54 +08:00
parent be0f75f5a7
commit 0d4a5aa586
4 changed files with 78 additions and 0 deletions

View File

@ -15,3 +15,20 @@
sla:
failure_rate:
max: 0
Kuryr.create_and_delete_networks:
-
runner:
type: "constant"
times: 10
concurrency: 4
context:
users:
tenants: 2
users_per_tenant: 2
quotas:
neutron:
network: -1
sla:
failure_rate:
max: 0

View File

@ -38,3 +38,15 @@ class Kuryr(utils.KuryrScenario):
:param network_list_args: dict: names, ids
"""
self._list_networks(network_list_args or {})
@scenario.configure(context={"cleanup": ["kuryr"]})
def create_and_delete_networks(self, network_create_args=None):
"""Create and delete a network.
Measure the "docker network create" and "docker network rm" command
performance.
:param network_create_args: dict as options to create the network
"""
network = self._create_network(network_create_args or {})
self._delete_network(network)

View File

@ -39,3 +39,24 @@ class KuryrScenario(scenario.OpenStackScenario):
names = network_list_args.get('names')
ids = network_list_args.get('ids')
return self.docker_client.networks(names, ids)
@atomic.action_timer("kuryr.create_network")
def _create_network(self, network_create_args):
"""Create Kuryr network.
:param network_create_args: dict: name, driver and others
:returns: dict of the created network reference object
"""
name = self.generate_random_name()
return self.docker_client.create_network(name=name,
driver='kuryr',
options=network_create_args
)
@atomic.action_timer("kuryr.delete_network")
def _delete_network(self, network):
"""Delete Kuryr network.
:param network: Network object
"""
self.docker_client.remove_network(network['Id'])

View File

@ -0,0 +1,28 @@
{
"Kuryr.create_and_delete_networks": [
{
"runner": {
"type": "constant",
"concurrency": 2,
"times": 4
},
"args": {
"network_create_args": {}
},
"context": {
"users": {
"project_domain": "default",
"users_per_tenant": 3,
"tenants": 3,
"resource_management_workers": 10,
"user_domain": "default"
},
"quotas": {
"neutron": {
"network": -1
}
}
}
}
]
}