Add more trunk scenarios
This commit adds three new scenarios for neutron trunk port testing. Also involves some minor refactor of existing NeutronTrunks.create_and_list_trunks scenario. Change-Id: I632837576b353a3bc014577ac102ef0dbcdb019c
This commit is contained in:
parent
cfcaccc7cd
commit
ed524c07c1
11
.zuul.d/rally-task-neutron-trunk.yaml
Normal file
11
.zuul.d/rally-task-neutron-trunk.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
- job:
|
||||
name: rally-task-neutron-trunk
|
||||
parent: rally-task-at-devstack
|
||||
vars:
|
||||
rally_task: rally-jobs/neutron-trunk.yaml
|
||||
devstack_plugins:
|
||||
rally-openstack: https://git.openstack.org/openstack/rally-openstack
|
||||
neutron: https://git.openstack.org/openstack/neutron
|
||||
devstack_services:
|
||||
neutron-trunk: true
|
||||
|
@ -3,8 +3,4 @@
|
||||
parent: rally-task-at-devstack
|
||||
vars:
|
||||
rally_task: rally-jobs/neutron.yaml
|
||||
devstack_plugins:
|
||||
rally-openstack: https://git.openstack.org/openstack/rally-openstack
|
||||
neutron: https://git.openstack.org/openstack/neutron
|
||||
devstack_services:
|
||||
neutron-trunk: true
|
||||
|
||||
|
@ -54,6 +54,11 @@
|
||||
#- rally-task-monasca
|
||||
- rally-task-murano
|
||||
- rally-task-neutron
|
||||
- rally-task-neutron-trunk:
|
||||
files:
|
||||
- rally-jobs/neutron-trunk.yaml
|
||||
- rally_openstack/scenarios/neutron/trunk.py
|
||||
- rally_openstack/scenarios/neutron/network.py
|
||||
- rally-task-neutron-with-extensions:
|
||||
voting: false
|
||||
- rally-task-nova:
|
||||
|
@ -50,6 +50,10 @@ Added
|
||||
* Added property 'floating_ip_enabled' in magnum cluster_templates context.
|
||||
* Enhanced neutron trunk port scenario to create multiple trunks
|
||||
* Enhanced NeutronSecurityGroup.create_and_list_security_group_rules
|
||||
* Added three new trunk port related scenarios
|
||||
* [scenario plugin] NeutronTrunks.boot_server_with_subports
|
||||
* [scenario plugin] NeutronTrunks.boot_server_and_add_subports
|
||||
* [scenario plugin] NeutronTrunks.boot_server_and_batch_add_subports
|
||||
|
||||
Changed
|
||||
~~~~~~~
|
||||
|
125
rally-jobs/neutron-trunk.yaml
Normal file
125
rally-jobs/neutron-trunk.yaml
Normal file
@ -0,0 +1,125 @@
|
||||
{% set image_name = "^(cirros.*-disk|TestVM)$" %}
|
||||
{% set flavor_name = "m1.tiny" %}
|
||||
---
|
||||
|
||||
NeutronTrunks.create_and_list_trunks:
|
||||
-
|
||||
args:
|
||||
network_create_args: {}
|
||||
subport_count: 10
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 100
|
||||
concurrency: 10
|
||||
context:
|
||||
users:
|
||||
tenants: 3
|
||||
users_per_tenant: 3
|
||||
quotas:
|
||||
neutron:
|
||||
network: -1
|
||||
port: -1
|
||||
trunk: -1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 10
|
||||
|
||||
NeutronTrunks.boot_server_with_subports:
|
||||
-
|
||||
args:
|
||||
network_create_args: {}
|
||||
subport_count: 10
|
||||
flavor:
|
||||
name: "{{flavor_name}}"
|
||||
image:
|
||||
name: "{{image_name}}"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 2
|
||||
concurrency: 1
|
||||
context:
|
||||
users:
|
||||
tenants: 3
|
||||
users_per_tenant: 3
|
||||
roles:
|
||||
- admin
|
||||
quotas:
|
||||
neutron:
|
||||
network: -1
|
||||
subnet: -1
|
||||
port: -1
|
||||
trunk: -1
|
||||
nova:
|
||||
instances: -1
|
||||
cores: -1
|
||||
ram: -1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 10
|
||||
|
||||
NeutronTrunks.boot_server_and_add_subports:
|
||||
-
|
||||
args:
|
||||
network_create_args: {}
|
||||
subport_count: 10
|
||||
flavor:
|
||||
name: "{{flavor_name}}"
|
||||
image:
|
||||
name: "{{image_name}}"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 2
|
||||
concurrency: 1
|
||||
context:
|
||||
users:
|
||||
tenants: 3
|
||||
users_per_tenant: 3
|
||||
roles:
|
||||
- admin
|
||||
quotas:
|
||||
neutron:
|
||||
network: -1
|
||||
subnet: -1
|
||||
port: -1
|
||||
trunk: -1
|
||||
nova:
|
||||
instances: -1
|
||||
cores: -1
|
||||
ram: -1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 10
|
||||
|
||||
NeutronTrunks.boot_server_and_batch_add_subports:
|
||||
-
|
||||
args:
|
||||
network_create_args: {}
|
||||
subports_per_batch: 10
|
||||
batches: 5
|
||||
flavor:
|
||||
name: "{{flavor_name}}"
|
||||
image:
|
||||
name: "{{image_name}}"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 2
|
||||
concurrency: 1
|
||||
context:
|
||||
users:
|
||||
tenants: 3
|
||||
users_per_tenant: 3
|
||||
roles:
|
||||
- admin
|
||||
quotas:
|
||||
neutron:
|
||||
network: -1
|
||||
subnet: -1
|
||||
port: -1
|
||||
trunk: -1
|
||||
nova:
|
||||
instances: -1
|
||||
cores: -1
|
||||
ram: -1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 10
|
@ -619,29 +619,6 @@
|
||||
failure_rate:
|
||||
max: 20
|
||||
|
||||
NeutronTrunks.create_and_list_trunks:
|
||||
-
|
||||
args:
|
||||
network_create_args: {}
|
||||
trunk_count: 1
|
||||
subport_count: 10
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 100
|
||||
concurrency: 10
|
||||
context:
|
||||
users:
|
||||
tenants: 3
|
||||
users_per_tenant: 3
|
||||
quotas:
|
||||
neutron:
|
||||
network: -1
|
||||
port: -1
|
||||
trunk: -1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 10
|
||||
|
||||
NeutronSubnets.delete_subnets:
|
||||
-
|
||||
runner:
|
||||
|
@ -386,6 +386,13 @@ class NeutronFloatingIP(NeutronMixin):
|
||||
return super(NeutronFloatingIP, self).list()
|
||||
|
||||
|
||||
@base.resource("neutron", "trunk", order=next(_neutron_order),
|
||||
tenant_resource=True)
|
||||
class NeutronTrunk(NeutronMixin):
|
||||
# Trunks must be deleted before the parent/subports are deleted
|
||||
pass
|
||||
|
||||
|
||||
@base.resource("neutron", "port", order=next(_neutron_order),
|
||||
tenant_resource=True)
|
||||
class NeutronPort(NeutronMixin):
|
||||
@ -444,7 +451,6 @@ class NeutronPort(NeutronMixin):
|
||||
self.raw_resource["device_id"], {"port_id": self.id()})
|
||||
else:
|
||||
from neutronclient.common import exceptions as neutron_exceptions
|
||||
|
||||
try:
|
||||
self._manager().delete_port(self.id())
|
||||
except neutron_exceptions.PortNotFoundClient:
|
||||
|
@ -604,44 +604,3 @@ class DeleteSubnets(utils.NeutronScenario):
|
||||
# delete one of subnets based on the user sequential number
|
||||
subnet_id = network["subnets"][number]
|
||||
self._delete_subnet({"subnet": {"id": subnet_id}})
|
||||
|
||||
|
||||
@validation.add("number", param_name="subport_count", minval=1,
|
||||
integer_only=True)
|
||||
@validation.add("number", param_name="trunk_count", minval=1,
|
||||
integer_only=True)
|
||||
@validation.add("required_services", services=[consts.Service.NEUTRON])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup@openstack": ["neutron"]},
|
||||
name="NeutronTrunks.create_and_list_trunks")
|
||||
class CreateAndListTrunks(utils.NeutronScenario):
|
||||
|
||||
def run(self, network_create_args=None, trunk_count=1, subport_count=10):
|
||||
"""Create given number of trunks with subports and list all trunks.
|
||||
|
||||
:param network_create_args: dict, POST /v2.0/networks request
|
||||
options. Deprecated.
|
||||
:param trunk_count: int, number of trunk ports
|
||||
:param subport_count: int, number of subports per trunk
|
||||
"""
|
||||
net = self._create_network(network_create_args or {})
|
||||
ports = [self._create_port(net, {}) for _ in range(
|
||||
(trunk_count + trunk_count * subport_count))]
|
||||
parents, subports = ports[0:trunk_count], ports[trunk_count:]
|
||||
subport_payload = [{"port_id": p["port"]["id"],
|
||||
"segmentation_type": "vlan",
|
||||
"segmentation_id": seg_id}
|
||||
for seg_id, p in enumerate(subports, start=1)]
|
||||
subport_index = 0
|
||||
for p in parents:
|
||||
trunk_payload = {
|
||||
"port_id": p["port"]["id"],
|
||||
"sub_ports": subport_payload[slice(
|
||||
subport_index, subport_index + subport_count)]
|
||||
}
|
||||
trunk = self._create_trunk(trunk_payload)
|
||||
self._update_port(p, {"device_id": "sometrunk"})
|
||||
self._list_subports_by_trunk(trunk["trunk"]["id"])
|
||||
subport_index += subport_count
|
||||
self._list_trunks()
|
||||
self._list_ports_by_device_id("sometrunk")
|
||||
|
197
rally_openstack/scenarios/neutron/trunk.py
Normal file
197
rally_openstack/scenarios/neutron/trunk.py
Normal file
@ -0,0 +1,197 @@
|
||||
# Copyright 2014: Intel Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from rally.common import cfg
|
||||
from rally.task import types
|
||||
from rally.task import validation
|
||||
|
||||
from rally_openstack import consts
|
||||
from rally_openstack import scenario
|
||||
from rally_openstack.scenarios.neutron import utils as neutron_utils
|
||||
from rally_openstack.scenarios.nova import utils as nova_utils
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
"""Scenarios for Neutron Trunk."""
|
||||
|
||||
|
||||
@validation.add("number", param_name="subport_count", minval=1,
|
||||
integer_only=True)
|
||||
@validation.add("required_services", services=[consts.Service.NEUTRON])
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup@openstack": ["neutron"]},
|
||||
name="NeutronTrunks.create_and_list_trunks")
|
||||
class CreateAndListTrunks(neutron_utils.NeutronScenario):
|
||||
|
||||
def run(self, network_create_args=None, subport_count=10):
|
||||
"""Create and a given number of trunks with subports and list all trunks
|
||||
|
||||
:param network_create_args: dict, POST /v2.0/networks request
|
||||
options. Deprecated.
|
||||
:param trunk_count: int, number of trunk ports
|
||||
:param subport_count: int, number of subports per trunk
|
||||
"""
|
||||
net = self._create_network(network_create_args or {})
|
||||
ports = [self._create_port(net, {}) for _ in range(subport_count + 1)]
|
||||
parent, subports = ports[0], ports[1:]
|
||||
subport_payload = [{"port_id": p["port"]["id"],
|
||||
"segmentation_type": "vlan",
|
||||
"segmentation_id": seg_id}
|
||||
for seg_id, p in enumerate(subports, start=1)]
|
||||
trunk_payload = {"port_id": parent["port"]["id"],
|
||||
"sub_ports": subport_payload}
|
||||
trunk = self._create_trunk(trunk_payload)
|
||||
self._update_port(parent, {"device_id": "sometrunk"})
|
||||
self._list_trunks()
|
||||
self._list_subports_by_trunk(trunk["trunk"]["id"])
|
||||
self._list_ports_by_device_id("sometrunk")
|
||||
|
||||
|
||||
@types.convert(image={"type": "glance_image"},
|
||||
flavor={"type": "nova_flavor"})
|
||||
@validation.add("image_valid_on_flavor", flavor_param="flavor",
|
||||
image_param="image")
|
||||
@validation.add("required_services", services=(consts.Service.NOVA,
|
||||
consts.Service.NEUTRON))
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup@openstack": ["neutron", "nova"]},
|
||||
name="NeutronTrunks.boot_server_with_subports",
|
||||
platform="openstack")
|
||||
class BootServerWithSubports(nova_utils.NovaScenario,
|
||||
neutron_utils.NeutronScenario):
|
||||
|
||||
def run(self, image, flavor, network_create_args=None, subport_count=10):
|
||||
"""Boot a server with subports.
|
||||
|
||||
Returns when the server is actually booted and in "ACTIVE" state.
|
||||
:param image: image ID or instance for server creation
|
||||
:param flavor: int, flavor ID or instance for server creation
|
||||
:param network_create_args: arguments for creating network
|
||||
:param subport_count: number of subports for the trunk port
|
||||
"""
|
||||
kwargs = {}
|
||||
ports = []
|
||||
network_create_args = network_create_args or {}
|
||||
for _ in range(subport_count + 1):
|
||||
net, subnet = self._create_network_and_subnets(
|
||||
network_create_args=network_create_args)
|
||||
ports.append(self._create_port(
|
||||
net, {"fixed_ips": [{
|
||||
"subnet_id": subnet[0]["subnet"]["id"]}]}))
|
||||
parent, subports = ports[0], ports[1:]
|
||||
subport_payload = [{"port_id": p["port"]["id"],
|
||||
"segmentation_type": "vlan",
|
||||
"segmentation_id": seg_id}
|
||||
for seg_id, p in enumerate(subports, start=1)]
|
||||
trunk_payload = {"port_id": parent["port"]["id"],
|
||||
"sub_ports": subport_payload}
|
||||
self._create_trunk(trunk_payload)
|
||||
kwargs["nics"] = [{"port-id": parent["port"]["id"]}]
|
||||
self._boot_server(image, flavor, **kwargs)
|
||||
|
||||
|
||||
@types.convert(image={"type": "glance_image"},
|
||||
flavor={"type": "nova_flavor"})
|
||||
@validation.add("image_valid_on_flavor", flavor_param="flavor",
|
||||
image_param="image")
|
||||
@validation.add("required_services", services=(consts.Service.NOVA,
|
||||
consts.Service.NEUTRON))
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup@openstack": ["neutron", "nova"]},
|
||||
name="NeutronTrunks.boot_server_and_add_subports",
|
||||
platform="openstack")
|
||||
class BootServerAndAddSubports(nova_utils.NovaScenario,
|
||||
neutron_utils.NeutronScenario):
|
||||
|
||||
def run(self, image, flavor, network_create_args=None, subport_count=10):
|
||||
"""Boot a server and add subports.
|
||||
|
||||
Returns when the server is actually booted and in "ACTIVE" state.
|
||||
:param image: image ID or instance for server creation
|
||||
:param flavor: int, flavor ID or instance for server creation
|
||||
:param network_create_args: arguments for creating network
|
||||
:param subport_count: number of subports for the trunk port
|
||||
"""
|
||||
kwargs = {}
|
||||
ports = []
|
||||
network_create_args = network_create_args or {}
|
||||
for _ in range(subport_count + 1):
|
||||
net, subnet = self._create_network_and_subnets(
|
||||
network_create_args=network_create_args)
|
||||
ports.append(self._create_port(
|
||||
net, {"fixed_ips": [{
|
||||
"subnet_id": subnet[0]["subnet"]["id"]}]}))
|
||||
parent, subports = ports[0], ports[1:]
|
||||
trunk_payload = {"port_id": parent["port"]["id"]}
|
||||
trunk = self._create_trunk(trunk_payload)
|
||||
kwargs["nics"] = [{"port-id": parent["port"]["id"]}]
|
||||
self._boot_server(image, flavor, **kwargs)
|
||||
for seg_id, p in enumerate(subports, start=1):
|
||||
subport_payload = [{"port_id": p["port"]["id"],
|
||||
"segmentation_type": "vlan",
|
||||
"segmentation_id": seg_id}]
|
||||
self._add_subports_to_trunk(trunk["trunk"]["id"], subport_payload)
|
||||
|
||||
|
||||
@types.convert(image={"type": "glance_image"},
|
||||
flavor={"type": "nova_flavor"})
|
||||
@validation.add("image_valid_on_flavor", flavor_param="flavor",
|
||||
image_param="image")
|
||||
@validation.add("required_services", services=(consts.Service.NOVA,
|
||||
consts.Service.NEUTRON))
|
||||
@validation.add("required_platform", platform="openstack", users=True)
|
||||
@scenario.configure(context={"cleanup@openstack": ["neutron", "nova"]},
|
||||
name="NeutronTrunks.boot_server_and_batch_add_subports",
|
||||
platform="openstack")
|
||||
class BootServerAndBatchAddSubports(nova_utils.NovaScenario,
|
||||
neutron_utils.NeutronScenario):
|
||||
|
||||
def run(self, image, flavor, network_create_args=None,
|
||||
subports_per_batch=10, batches=5):
|
||||
"""Boot a server and add subports in batches.
|
||||
|
||||
Returns when the server is actually booted and in "ACTIVE" state.
|
||||
:param image: image ID or instance for server creation
|
||||
:param flavor: int, flavor ID or instance for server creation
|
||||
:param network_create_args: arguments for creating network
|
||||
:param subports_per_batch: number of subports per batches
|
||||
:param batches: number of batches to create subports in
|
||||
"""
|
||||
kwargs = {}
|
||||
ports = []
|
||||
network_create_args = network_create_args or {}
|
||||
for _ in range(subports_per_batch * batches + 1):
|
||||
net, subnet = self._create_network_and_subnets(
|
||||
network_create_args=network_create_args)
|
||||
ports.append(self._create_port(
|
||||
net, {"fixed_ips": [{
|
||||
"subnet_id": subnet[0]["subnet"]["id"]}]}))
|
||||
parent, subports = ports[0], ports[1:]
|
||||
trunk_payload = {"port_id": parent["port"]["id"]}
|
||||
trunk = self._create_trunk(trunk_payload)
|
||||
kwargs["nics"] = [{"port-id": parent["port"]["id"]}]
|
||||
self._boot_server(image, flavor, **kwargs)
|
||||
begin = 0
|
||||
for _ in range(0, batches):
|
||||
end = begin + subports_per_batch
|
||||
subport_payload = [{"port_id": p["port"]["id"],
|
||||
"segmentation_type": "vlan",
|
||||
"segmentation_id": seg_id}
|
||||
for seg_id, p in enumerate(
|
||||
subports[slice(begin, end)],
|
||||
start=begin + 1)]
|
||||
begin = begin + subports_per_batch
|
||||
self._add_subports_to_trunk(trunk["trunk"]["id"], subport_payload)
|
@ -887,6 +887,7 @@ class NeutronScenario(scenario.OpenStackScenario):
|
||||
|
||||
@atomic.action_timer("neutron.create_trunk")
|
||||
def _create_trunk(self, trunk_payload):
|
||||
trunk_payload["name"] = self.generate_random_name()
|
||||
return self.clients("neutron").create_trunk({"trunk": trunk_payload})
|
||||
|
||||
@atomic.action_timer("neutron.list_trunks")
|
||||
|
@ -0,0 +1,46 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
{
|
||||
"NeutronTrunks.boot_server_and_add_subports": [
|
||||
{
|
||||
"args": {
|
||||
"flavor": {
|
||||
"name": "{{flavor_name}}"
|
||||
},
|
||||
"image": {
|
||||
"name": "^cirros.*-disk$"
|
||||
},
|
||||
"network_create_args": {},
|
||||
"subport_count": 10
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 100,
|
||||
"concurrency": 10
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 3,
|
||||
"users_per_tenant": 3
|
||||
},
|
||||
"quotas": {
|
||||
"neutron": {
|
||||
"network": -1,
|
||||
"subnet": -1,
|
||||
"port": -1,
|
||||
"trunk": -1
|
||||
},
|
||||
"nova": {
|
||||
"instances": -1,
|
||||
"cores": -1,
|
||||
"ram": -1
|
||||
}
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
---
|
||||
NeutronTrunks.boot_server_and_add_subports:
|
||||
-
|
||||
args:
|
||||
flavor:
|
||||
name: "{{flavor_name}}"
|
||||
image:
|
||||
name: "^cirros.*-disk$"
|
||||
network_create_args: {}
|
||||
subport_count: 10
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 100
|
||||
concurrency: 10
|
||||
context:
|
||||
users:
|
||||
tenants: 3
|
||||
users_per_tenant: 3
|
||||
quotas:
|
||||
neutron:
|
||||
network: -1
|
||||
subnet: -1
|
||||
port: -1
|
||||
trunk: -1
|
||||
nova:
|
||||
instances: -1
|
||||
cores: -1
|
||||
ram: -1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -0,0 +1,47 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
{
|
||||
"NeutronTrunks.boot_server_and_batch_add_subports": [
|
||||
{
|
||||
"args": {
|
||||
"flavor": {
|
||||
"name": "{{flavor_name}}"
|
||||
},
|
||||
"image": {
|
||||
"name": "^cirros.*-disk$"
|
||||
},
|
||||
"network_create_args": {},
|
||||
"subports_per_batch": 10,
|
||||
"batches": 5
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 100,
|
||||
"concurrency": 10
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 3,
|
||||
"users_per_tenant": 3
|
||||
},
|
||||
"quotas": {
|
||||
"neutron": {
|
||||
"network": -1,
|
||||
"subnet": -1,
|
||||
"port": -1,
|
||||
"trunk": -1
|
||||
},
|
||||
"nova": {
|
||||
"instances": -1,
|
||||
"cores": -1,
|
||||
"ram": -1
|
||||
}
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
---
|
||||
NeutronTrunks.boot_server_and_batch_add_subports:
|
||||
-
|
||||
args:
|
||||
flavor:
|
||||
name: "{{flavor_name}}"
|
||||
image:
|
||||
name: "^cirros.*-disk$"
|
||||
network_create_args: {}
|
||||
subports_per_batch: 10
|
||||
batches: 5
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 100
|
||||
concurrency: 10
|
||||
context:
|
||||
users:
|
||||
tenants: 3
|
||||
users_per_tenant: 3
|
||||
quotas:
|
||||
neutron:
|
||||
network: -1
|
||||
subnet: -1
|
||||
port: -1
|
||||
trunk: -1
|
||||
nova:
|
||||
instances: -1
|
||||
cores: -1
|
||||
ram: -1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -0,0 +1,46 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
{
|
||||
"NeutronTrunks.boot_server_with_subports": [
|
||||
{
|
||||
"args": {
|
||||
"flavor": {
|
||||
"name": "{{flavor_name}}"
|
||||
},
|
||||
"image": {
|
||||
"name": "^cirros.*-disk$"
|
||||
},
|
||||
"network_create_args": {},
|
||||
"subport_count": 10
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 100,
|
||||
"concurrency": 10
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 3,
|
||||
"users_per_tenant": 3
|
||||
},
|
||||
"quotas": {
|
||||
"neutron": {
|
||||
"network": -1,
|
||||
"subnet": -1,
|
||||
"port": -1,
|
||||
"trunk": -1
|
||||
},
|
||||
"nova": {
|
||||
"instances": -1,
|
||||
"cores": -1,
|
||||
"ram": -1
|
||||
}
|
||||
}
|
||||
},
|
||||
"sla": {
|
||||
"failure_rate": {
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
---
|
||||
NeutronTrunks.boot_server_with_subports:
|
||||
-
|
||||
args:
|
||||
flavor:
|
||||
name: "{{flavor_name}}"
|
||||
image:
|
||||
name: "^cirros.*-disk$"
|
||||
network_create_args: {}
|
||||
subport_count: 10
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 100
|
||||
concurrency: 10
|
||||
context:
|
||||
users:
|
||||
tenants: 3
|
||||
users_per_tenant: 3
|
||||
quotas:
|
||||
neutron:
|
||||
network: -1
|
||||
subnet: -1
|
||||
port: -1
|
||||
trunk: -1
|
||||
nova:
|
||||
instances: -1
|
||||
cores: -1
|
||||
ram: -1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -3,7 +3,6 @@
|
||||
{
|
||||
"args": {
|
||||
"network_create_args": {},
|
||||
"trunk_count": 1,
|
||||
"subport_count": 10
|
||||
},
|
||||
"runner": {
|
||||
|
@ -4,7 +4,6 @@
|
||||
-
|
||||
args:
|
||||
network_create_args: {}
|
||||
trunk_count: 1
|
||||
subport_count: 10
|
||||
runner:
|
||||
type: "constant"
|
||||
|
@ -265,7 +265,6 @@
|
||||
-
|
||||
args:
|
||||
network_create_args: {}
|
||||
trunk_count: 1
|
||||
subport_count: 10
|
||||
context:
|
||||
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
|
||||
@ -279,3 +278,76 @@
|
||||
{{ constant_runner(concurrency=2*controllers_amount, times=8*controllers_amount, is_smoke=smoke) }}
|
||||
sla:
|
||||
{{ no_failures_sla() }}
|
||||
|
||||
NeutronTrunks.boot_server_with_subports:
|
||||
-
|
||||
args:
|
||||
{{ vm_params(image_name, flavor_name) }}
|
||||
network_create_args: {}
|
||||
subport_count: 10
|
||||
context:
|
||||
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
|
||||
quotas:
|
||||
neutron:
|
||||
network: -1
|
||||
subnet: -1
|
||||
port: -1
|
||||
trunk: -1
|
||||
nova:
|
||||
instances: -1
|
||||
cores: -1
|
||||
ram: -1
|
||||
{% endcall %}
|
||||
runner:
|
||||
{{ constant_runner(concurrency=2*controllers_amount, times=8*controllers_amount, is_smoke=smoke) }}
|
||||
sla:
|
||||
{{ no_failures_sla() }}
|
||||
|
||||
NeutronTrunks.boot_server_and_add_subports:
|
||||
-
|
||||
args:
|
||||
{{ vm_params(image_name, flavor_name) }}
|
||||
network_create_args: {}
|
||||
subport_count: 10
|
||||
context:
|
||||
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
|
||||
quotas:
|
||||
neutron:
|
||||
network: -1
|
||||
subnet: -1
|
||||
port: -1
|
||||
trunk: -1
|
||||
nova:
|
||||
instances: -1
|
||||
cores: -1
|
||||
ram: -1
|
||||
{% endcall %}
|
||||
runner:
|
||||
{{ constant_runner(concurrency=2*controllers_amount, times=8*controllers_amount, is_smoke=smoke) }}
|
||||
sla:
|
||||
{{ no_failures_sla() }}
|
||||
|
||||
NeutronTrunks.boot_server_and_batch_add_subports:
|
||||
-
|
||||
args:
|
||||
{{ vm_params(image_name, flavor_name) }}
|
||||
network_create_args: {}
|
||||
subports_per_batch: 10
|
||||
batches: 5
|
||||
context:
|
||||
{% call user_context(tenants_amount, users_amount, use_existing_users) %}
|
||||
quotas:
|
||||
neutron:
|
||||
network: -1
|
||||
subnet: -1
|
||||
port: -1
|
||||
trunk: -1
|
||||
nova:
|
||||
instances: -1
|
||||
cores: -1
|
||||
ram: -1
|
||||
{% endcall %}
|
||||
runner:
|
||||
{{ constant_runner(concurrency=2*controllers_amount, times=8*controllers_amount, is_smoke=smoke) }}
|
||||
sla:
|
||||
{{ no_failures_sla() }}
|
||||
|
@ -596,25 +596,3 @@ class NeutronNetworksTestCase(test.ScenarioTestCase):
|
||||
mock.call({"subnet": {"id": "subnet-5"}})
|
||||
],
|
||||
mock__delete_subnet.call_args_list)
|
||||
|
||||
def test_create_and_list_trunks(self):
|
||||
trunk_count = 1
|
||||
subport_count = 10
|
||||
network_create_args = {}
|
||||
net = mock.MagicMock()
|
||||
scenario = network.CreateAndListTrunks(self.context)
|
||||
scenario._create_network = mock.Mock(return_value=net)
|
||||
scenario._create_port = mock.MagicMock()
|
||||
scenario._create_trunk = mock.MagicMock()
|
||||
scenario._update_port = mock.Mock()
|
||||
scenario._list_ports_by_device_id = mock.Mock()
|
||||
scenario.run(network_create_args=network_create_args,
|
||||
subport_count=subport_count)
|
||||
scenario._create_network.assert_called_once_with(
|
||||
network_create_args)
|
||||
scenario._create_port.assert_has_calls(
|
||||
[mock.call(net, {})
|
||||
for _ in range(trunk_count + (trunk_count * subport_count))])
|
||||
self.assertEqual(1, scenario._create_trunk.call_count)
|
||||
self.assertEqual(1, scenario._update_port.call_count)
|
||||
self.assertEqual(1, scenario._list_ports_by_device_id.call_count)
|
||||
|
131
tests/unit/scenarios/neutron/test_trunk.py
Normal file
131
tests/unit/scenarios/neutron/test_trunk.py
Normal file
@ -0,0 +1,131 @@
|
||||
# Copyright 2014: Intel Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
|
||||
from rally_openstack.scenarios.neutron import trunk
|
||||
from tests.unit import test
|
||||
|
||||
|
||||
class NeutronTrunkTestCase(test.ScenarioTestCase):
|
||||
|
||||
def test_create_and_list_trunks(self):
|
||||
subport_count = 10
|
||||
network_create_args = {}
|
||||
net = mock.MagicMock()
|
||||
scenario = trunk.CreateAndListTrunks(self.context)
|
||||
scenario._create_network = mock.Mock(return_value=net)
|
||||
scenario._create_port = mock.MagicMock()
|
||||
scenario._create_trunk = mock.MagicMock()
|
||||
scenario._list_subports_by_trunk = mock.MagicMock()
|
||||
scenario._update_port = mock.Mock()
|
||||
scenario._list_ports_by_device_id = mock.Mock()
|
||||
scenario.run(network_create_args=network_create_args,
|
||||
subport_count=subport_count)
|
||||
scenario._create_network.assert_called_once_with(
|
||||
network_create_args)
|
||||
scenario._create_port.assert_has_calls(
|
||||
[mock.call(net, {})
|
||||
for _ in range(subport_count + 1)])
|
||||
self.assertEqual(1, scenario._create_trunk.call_count)
|
||||
self.assertEqual(1, scenario._update_port.call_count)
|
||||
self.assertEqual(1, scenario._list_subports_by_trunk.call_count)
|
||||
self.assertEqual(1, scenario._list_ports_by_device_id.call_count)
|
||||
|
||||
def test_boot_server_with_subports(self):
|
||||
img_name = "img"
|
||||
flavor_uuid = 0
|
||||
subport_count = 10
|
||||
network_create_args = {}
|
||||
net = mock.MagicMock()
|
||||
port = {"port": {"id": "port-id"}}
|
||||
kwargs = {"nics": [{"port-id": "port-id"}]}
|
||||
subnet = {"subnet": {"id": "subnet-id"}}
|
||||
scenario = trunk.BootServerWithSubports(self.context)
|
||||
scenario._boot_server = mock.MagicMock()
|
||||
scenario._create_port = mock.MagicMock(return_value=port)
|
||||
scenario._create_trunk = mock.MagicMock()
|
||||
scenario._create_network_and_subnets = mock.MagicMock()
|
||||
scenario._create_network_and_subnets.return_value = net, [subnet]
|
||||
scenario.run(img_name, flavor_uuid,
|
||||
network_create_args=network_create_args,
|
||||
subport_count=subport_count)
|
||||
scenario._create_port.assert_has_calls(
|
||||
[mock.call(net, {"fixed_ips": [{"subnet_id":
|
||||
subnet["subnet"]["id"]}]})
|
||||
for _ in range(subport_count + 1)])
|
||||
self.assertEqual(1, scenario._create_trunk.call_count)
|
||||
self.assertEqual(11, scenario._create_network_and_subnets.call_count)
|
||||
scenario._boot_server.assert_called_once_with(img_name, flavor_uuid,
|
||||
**kwargs)
|
||||
|
||||
def test_boot_server_and_add_subports(self):
|
||||
img_name = "img"
|
||||
flavor_uuid = 0
|
||||
subport_count = 10
|
||||
network_create_args = {}
|
||||
net = mock.MagicMock()
|
||||
port = {"port": {"id": "port-id"}}
|
||||
kwargs = {"nics": [{"port-id": "port-id"}]}
|
||||
subnet = {"subnet": {"id": "subnet-id"}}
|
||||
scenario = trunk.BootServerAndAddSubports(self.context)
|
||||
scenario._boot_server = mock.MagicMock()
|
||||
scenario._create_port = mock.MagicMock(return_value=port)
|
||||
scenario._create_trunk = mock.MagicMock()
|
||||
scenario._add_subports_to_trunk = mock.MagicMock()
|
||||
scenario._create_network_and_subnets = mock.MagicMock()
|
||||
scenario._create_network_and_subnets.return_value = net, [subnet]
|
||||
scenario.run(img_name, flavor_uuid,
|
||||
network_create_args=network_create_args,
|
||||
subport_count=subport_count)
|
||||
scenario._create_port.assert_has_calls(
|
||||
[mock.call(net, {"fixed_ips": [{"subnet_id":
|
||||
subnet["subnet"]["id"]}]})
|
||||
for _ in range(subport_count + 1)])
|
||||
self.assertEqual(1, scenario._create_trunk.call_count)
|
||||
scenario._boot_server.assert_called_once_with(img_name, flavor_uuid,
|
||||
**kwargs)
|
||||
self.assertEqual(10, scenario._add_subports_to_trunk.call_count)
|
||||
self.assertEqual(11, scenario._create_network_and_subnets.call_count)
|
||||
|
||||
def test_boot_server_and_batch_add_subports(self):
|
||||
img_name = "img"
|
||||
flavor_uuid = 0
|
||||
subports_per_batch = 10
|
||||
batches = 5
|
||||
network_create_args = {}
|
||||
net = mock.MagicMock()
|
||||
port = {"port": {"id": "port-id"}}
|
||||
kwargs = {"nics": [{"port-id": "port-id"}]}
|
||||
subnet = {"subnet": {"id": "subnet-id"}}
|
||||
scenario = trunk.BootServerAndBatchAddSubports(self.context)
|
||||
scenario._boot_server = mock.MagicMock()
|
||||
scenario._create_port = mock.MagicMock(return_value=port)
|
||||
scenario._create_trunk = mock.MagicMock()
|
||||
scenario._add_subports_to_trunk = mock.MagicMock()
|
||||
scenario._create_network_and_subnets = mock.MagicMock()
|
||||
scenario._create_network_and_subnets.return_value = net, [subnet]
|
||||
scenario.run(img_name, flavor_uuid,
|
||||
network_create_args=network_create_args,
|
||||
subports_per_batch=10, batches=5)
|
||||
scenario._create_port.assert_has_calls(
|
||||
[mock.call(net, {"fixed_ips": [{"subnet_id":
|
||||
subnet["subnet"]["id"]}]})
|
||||
for _ in range(subports_per_batch * batches + 1)])
|
||||
self.assertEqual(1, scenario._create_trunk.call_count)
|
||||
scenario._boot_server.assert_called_once_with(img_name, flavor_uuid,
|
||||
**kwargs)
|
||||
self.assertEqual(5, scenario._add_subports_to_trunk.call_count)
|
||||
self.assertEqual(51, scenario._create_network_and_subnets.call_count)
|
Loading…
Reference in New Issue
Block a user