From 884100d1016507e22226e44b2f55abd8ed7501c8 Mon Sep 17 00:00:00 2001 From: Joe Talerico Date: Thu, 19 May 2016 14:37:27 -0400 Subject: [PATCH] New Plugin for Rally Plugin to allow the user to create a router and attach N networks to that router. Change-Id: Id081f8d319f1d79c11811472596c03a229d2f869 --- browbeat-complete.yaml | 5 +++ browbeat-config.yaml | 5 +++ .../subnet-router-create.py | 31 +++++++++++++++++++ .../subnet-router-create.yml | 28 +++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 rally/rally-plugins/subnet-router-create/subnet-router-create.py create mode 100644 rally/rally-plugins/subnet-router-create/subnet-router-create.yml diff --git a/browbeat-complete.yaml b/browbeat-complete.yaml index 2e1dd92ff..3e9028cec 100644 --- a/browbeat-complete.yaml +++ b/browbeat-complete.yaml @@ -59,6 +59,7 @@ rally: plugins: - netcreate-boot: rally/rally-plugins/netcreate-boot - netcreate-boot-ping: rally/rally-plugins/netcreate-boot-ping + - subnet-router-create: rally/rally-plugins/subnet-router-create benchmarks: - name: authenticate enabled: true @@ -208,6 +209,10 @@ rally: sla_max_avg_duration: 12 sla_max_seconds: 30 sla_max_failure: 0 + - name: subnet-router-create + enabled: true + num_networks: 50 + file: rally/rally-plugins/subnet-router-create/subnet-router-create.yml #shaker scenarios require atleast 2 compute nodes shaker: enabled: true diff --git a/browbeat-config.yaml b/browbeat-config.yaml index 603a471f3..2fc954a7b 100644 --- a/browbeat-config.yaml +++ b/browbeat-config.yaml @@ -90,6 +90,7 @@ rally: venv: /home/stack/rally-venv/bin/activate plugins: - netcreate-boot: rally/rally-plugins/netcreate-boot + - subnet-router-create: rally/rally-plugins/subnet-router-create benchmarks: - name: authenticate enabled: true @@ -196,3 +197,7 @@ rally: image_name: cirros flavor_name: m1.tiny file: rally/rally-plugins/netcreate-boot/netcreate_boot.yml + - name: subnet-router-create + enabled: true + num_networks: 10 + file: rally/rally-plugins/subnet-router-create/subnet-router-create.yml diff --git a/rally/rally-plugins/subnet-router-create/subnet-router-create.py b/rally/rally-plugins/subnet-router-create/subnet-router-create.py new file mode 100644 index 000000000..84398d9ae --- /dev/null +++ b/rally/rally-plugins/subnet-router-create/subnet-router-create.py @@ -0,0 +1,31 @@ +from rally.task import atomic +from rally.task import scenario +from rally.plugins.openstack.scenarios.nova import utils as nova_utils +from rally.plugins.openstack.scenarios.neutron import utils as neutron_utils +from rally.task import types +from rally.task import utils as task_utils +from rally.task import validation + +class NeutronPlugin(neutron_utils.NeutronScenario, + scenario.Scenario): + @types.set(image=types.ImageResourceType, + flavor=types.FlavorResourceType) + @validation.required_openstack(users=True) + @scenario.configure(context={"cleanup": ["neutron"]}) + def create_router_and_net(self,num_networks=1,network_create_args=None, + subnet_create_args=None,**kwargs): + router = self._create_router({}) + subnets = [] + if num_networks == 1 : + network = self._create_network(network_create_args or {}) + subnet = self._create_subnet(network, subnet_create_args or {}) + subnets.append(subnet) + self._add_interface_router(subnet['subnet'],router['router']) + else : + for net in range(1,num_networks): + network = self._create_network(network_create_args or {}) + subnet = self._create_subnet(network, subnet_create_args or {}) + subnets.append(subnet) + self._add_interface_router(subnet['subnet'],router['router']) + for subnet in subnets : + self._remove_interface_router(subnet['subnet'],router['router']) diff --git a/rally/rally-plugins/subnet-router-create/subnet-router-create.yml b/rally/rally-plugins/subnet-router-create/subnet-router-create.yml new file mode 100644 index 000000000..ef2c45074 --- /dev/null +++ b/rally/rally-plugins/subnet-router-create/subnet-router-create.yml @@ -0,0 +1,28 @@ +{% set sla_max_avg_duration = sla_max_avg_duration or 60 %} +{% set sla_max_failure = sla_max_failure or 0 %} +{% set sla_max_seconds = sla_max_seconds or 60 %} +--- +NeutronPlugin.create_router_and_net: + - + args: + network_create_args: {} + num_networks: {{num_networks}} + runner: + concurrency: {{concurrency}} + times: {{times}} + type: "constant" + context: + users: + tenants: 1 + users_per_tenant: 8 + quotas: + neutron: + network: -1 + port: -1 + router: -1 + subnet: -1 + sla: + max_avg_duration: {{sla_max_avg_duration}} + max_seconds_per_iteration: {{sla_max_seconds}} + failure_rate: + max: {{sla_max_failure}}