diff options
Diffstat (limited to 'yardstick/benchmark')
19 files changed, 205 insertions, 30 deletions
diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py index 4c7f05236..479548b34 100644 --- a/yardstick/benchmark/contexts/heat.py +++ b/yardstick/benchmark/contexts/heat.py @@ -21,7 +21,7 @@ import pkg_resources from yardstick.benchmark.contexts.base import Context from yardstick.benchmark.contexts.model import Network -from yardstick.benchmark.contexts.model import PlacementGroup +from yardstick.benchmark.contexts.model import PlacementGroup, ServerGroup from yardstick.benchmark.contexts.model import Server from yardstick.benchmark.contexts.model import update_scheduler_hints from yardstick.orchestrator.heat import HeatTemplate, get_short_key_uuid @@ -41,6 +41,7 @@ class HeatContext(Context): self.networks = [] self.servers = [] self.placement_groups = [] + self.server_groups = [] self.keypair_name = None self.secgroup_name = None self._server_map = {} @@ -57,31 +58,31 @@ class HeatContext(Context): get_short_key_uuid(self.key_uuid)]) super(HeatContext, self).__init__() - def init(self, attrs): + def init(self, attrs): # pragma: no cover """initializes itself from the supplied arguments""" self.name = attrs["name"] - if "user" in attrs: - self._user = attrs["user"] + self._user = attrs.get("user") - if "heat_template" in attrs: - self.template_file = attrs["heat_template"] - self.heat_parameters = attrs.get("heat_parameters", None) + self.template_file = attrs.get("heat_template") + if self.template_file: + self.heat_parameters = attrs.get("heat_parameters") return self.keypair_name = self.name + "-key" self.secgroup_name = self.name + "-secgroup" - if "image" in attrs: - self._image = attrs["image"] + self._image = attrs.get("image") - if "flavor" in attrs: - self._flavor = attrs["flavor"] + self._flavor = attrs.get("flavor") - if "placement_groups" in attrs: - for name, pgattrs in attrs["placement_groups"].items(): - pg = PlacementGroup(name, self, pgattrs["policy"]) - self.placement_groups.append(pg) + self.placement_groups = [PlacementGroup(name, self, pgattrs["policy"]) + for name, pgattrs in attrs.get( + "placement_groups", {}).items()] + + self.server_groups = [ServerGroup(name, self, sgattrs["policy"]) + for name, sgattrs in attrs.get( + "server_groups", {}).items()] for name, netattrs in attrs["networks"].items(): network = Network(name, self, netattrs) @@ -158,24 +159,22 @@ class HeatContext(Context): # workround for openstack nova bug, check JIRA: YARDSTICK-200 # for details if len(availability_servers) == 2: - if len(scheduler_hints["different_host"]) == 0: + if not scheduler_hints["different_host"]: scheduler_hints.pop("different_host", None) server.add_to_template(template, self.networks, scheduler_hints) - added_servers.append(server.stack_name) else: scheduler_hints["different_host"] = \ scheduler_hints["different_host"][0] server.add_to_template(template, self.networks, scheduler_hints) - added_servers.append(server.stack_name) else: server.add_to_template(template, self.networks, scheduler_hints) - added_servers.append(server.stack_name) + added_servers.append(server.stack_name) # create list of servers with affinity policy affinity_servers = [] @@ -195,10 +194,21 @@ class HeatContext(Context): server.add_to_template(template, self.networks, scheduler_hints) added_servers.append(server.stack_name) + # add server group + for sg in self.server_groups: + template.add_server_group(sg.name, sg.policy) + # add remaining servers with no placement group configured for server in list_of_servers: - if len(server.placement_groups) == 0: - server.add_to_template(template, self.networks, {}) + # TODO placement_group and server_group should combine + if not server.placement_groups: + scheduler_hints = {} + # affinity/anti-aff server group + sg = server.server_group + if sg: + scheduler_hints["group"] = {'get_resource': sg.name} + server.add_to_template(template, + self.networks, scheduler_hints) def deploy(self): """deploys template into a stack using cloud""" diff --git a/yardstick/benchmark/contexts/model.py b/yardstick/benchmark/contexts/model.py index c83a209cf..8cf3b621c 100644 --- a/yardstick/benchmark/contexts/model.py +++ b/yardstick/benchmark/contexts/model.py @@ -56,10 +56,32 @@ class PlacementGroup(Object): @staticmethod def get(name): - if name in PlacementGroup.map: - return PlacementGroup.map[name] - else: - return None + return PlacementGroup.map.get(name) + + +class ServerGroup(Object): # pragma: no cover + """Class that represents a server group in the logical model + Policy should be one of "anti-affinity" or "affinity" + """ + map = {} + + def __init__(self, name, context, policy): + super(ServerGroup, self).__init__(name, context) + if policy not in {"affinity", "anti-affinity"}: + raise ValueError("server group '%s', policy '%s' is not valid" % + (name, policy)) + self.name = name + self.members = set() + self.stack_name = context.name + "-" + name + self.policy = policy + ServerGroup.map[name] = self + + def add_member(self, name): + self.members.add(name) + + @staticmethod + def get(name): + return ServerGroup.map.get(name) class Router(Object): @@ -113,7 +135,7 @@ class Network(Object): return None -class Server(Object): +class Server(Object): # pragma: no cover """Class that represents a server in the logical model""" list = [] @@ -141,6 +163,17 @@ class Server(Object): self.placement_groups.append(pg) pg.add_member(self.stack_name) + # support servergroup attr + self.server_group = None + sg = attrs.get("server_group") + if (sg): + server_group = ServerGroup.get(sg) + if not server_group: + raise ValueError("server '%s', server_group '%s' is invalid" % + (name, sg)) + self.server_group = server_group + server_group.add_member(self.stack_name) + self.instances = 1 if "instances" in attrs: self.instances = attrs["instances"] diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py index 522ad4d23..aecf5bf4a 100644 --- a/yardstick/benchmark/core/task.py +++ b/yardstick/benchmark/core/task.py @@ -267,7 +267,11 @@ class TaskParser(object): # pragma: no cover name_suffix = '-{}'.format(task_id[:8]) for cfg_attrs in context_cfgs: - cfg_attrs['name'] = '{}{}'.format(cfg_attrs['name'], name_suffix) + try: + cfg_attrs['name'] = '{}{}'.format(cfg_attrs['name'], + name_suffix) + except KeyError: + pass context_type = cfg_attrs.get("type", "Heat") if "Heat" == context_type and "networks" in cfg_attrs: # bugfix: if there are more than one network, diff --git a/yardstick/benchmark/runners/base.py b/yardstick/benchmark/runners/base.py index bf1a71cab..5b9081523 100755 --- a/yardstick/benchmark/runners/base.py +++ b/yardstick/benchmark/runners/base.py @@ -127,7 +127,7 @@ class Runner(object): """Returns instance of a scenario runner for execution type. """ # if there is no runner, start the output serializer subprocess - if len(Runner.runners) == 0: + if not Runner.runners: log.debug("Starting dump process file '%s'", config["output_filename"]) Runner.queue = multiprocessing.Queue() @@ -155,7 +155,7 @@ class Runner(object): Runner.runners.remove(runner) # if this was the last runner, stop the output serializer subprocess - if len(Runner.runners) == 0: + if not Runner.runners: Runner.release_dump_process() @staticmethod @@ -170,7 +170,7 @@ class Runner(object): log.debug("Terminating all runners") # release dumper process as some errors before any runner is created - if len(Runner.runners) == 0: + if not Runner.runners: Runner.release_dump_process() return diff --git a/yardstick/benchmark/scenarios/availability/attacker_conf.yaml b/yardstick/benchmark/scenarios/availability/attacker_conf.yaml index d37d66964..b8c34ad44 100644 --- a/yardstick/benchmark/scenarios/availability/attacker_conf.yaml +++ b/yardstick/benchmark/scenarios/availability/attacker_conf.yaml @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## --- # sample config file for ha test # diff --git a/yardstick/benchmark/scenarios/availability/monitor_conf.yaml b/yardstick/benchmark/scenarios/availability/monitor_conf.yaml index c94e4fdfe..511449221 100644 --- a/yardstick/benchmark/scenarios/availability/monitor_conf.yaml +++ b/yardstick/benchmark/scenarios/availability/monitor_conf.yaml @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 lihuansse@tongji.edu.cn and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## --- # sample config file for ha test # diff --git a/yardstick/benchmark/scenarios/availability/operation_conf.yaml b/yardstick/benchmark/scenarios/availability/operation_conf.yaml index 309a03de8..1c39385a9 100644 --- a/yardstick/benchmark/scenarios/availability/operation_conf.yaml +++ b/yardstick/benchmark/scenarios/availability/operation_conf.yaml @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 lihuansse@tongji.edu.cn and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## --- # sample config file for ha test # diff --git a/yardstick/benchmark/scenarios/availability/result_checker_conf.yaml b/yardstick/benchmark/scenarios/availability/result_checker_conf.yaml index faa4eb57d..0494a71a7 100644 --- a/yardstick/benchmark/scenarios/availability/result_checker_conf.yaml +++ b/yardstick/benchmark/scenarios/availability/result_checker_conf.yaml @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 lihuansse@tongji.edu.cn and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## --- # sample config file for ha test # diff --git a/yardstick/benchmark/scenarios/networking/pktgen_dpdk_latency_benchmark.bash b/yardstick/benchmark/scenarios/networking/pktgen_dpdk_latency_benchmark.bash index f6f361e80..b872aa3df 100644 --- a/yardstick/benchmark/scenarios/networking/pktgen_dpdk_latency_benchmark.bash +++ b/yardstick/benchmark/scenarios/networking/pktgen_dpdk_latency_benchmark.bash @@ -1,3 +1,12 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2017 ZTE corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## !/bin/sh set -e diff --git a/yardstick/benchmark/scenarios/networking/sfc.py b/yardstick/benchmark/scenarios/networking/sfc.py index c558e3512..bf4ed5f7c 100644 --- a/yardstick/benchmark/scenarios/networking/sfc.py +++ b/yardstick/benchmark/scenarios/networking/sfc.py @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## from __future__ import absolute_import import logging diff --git a/yardstick/benchmark/scenarios/networking/sfc_change_classi.bash b/yardstick/benchmark/scenarios/networking/sfc_change_classi.bash index 70375ab3b..85aeeba01 100755 --- a/yardstick/benchmark/scenarios/networking/sfc_change_classi.bash +++ b/yardstick/benchmark/scenarios/networking/sfc_change_classi.bash @@ -1,3 +1,12 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2017 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## tacker sfc-classifier-delete red_http tacker sfc-classifier-delete red_ssh diff --git a/yardstick/benchmark/scenarios/networking/sfc_compute.bash b/yardstick/benchmark/scenarios/networking/sfc_compute.bash index eeda3f274..09c2f22c4 100755 --- a/yardstick/benchmark/scenarios/networking/sfc_compute.bash +++ b/yardstick/benchmark/scenarios/networking/sfc_compute.bash @@ -1,4 +1,13 @@ #!/bin/bash +############################################################################## +# Copyright (c) 2017 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + set -e sudo ifconfig br-int up diff --git a/yardstick/benchmark/scenarios/networking/sfc_openstack.py b/yardstick/benchmark/scenarios/networking/sfc_openstack.py index be24add32..d5feabbbe 100644 --- a/yardstick/benchmark/scenarios/networking/sfc_openstack.py +++ b/yardstick/benchmark/scenarios/networking/sfc_openstack.py @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## from __future__ import print_function from __future__ import absolute_import import os diff --git a/yardstick/benchmark/scenarios/networking/sfc_pre_setup.bash b/yardstick/benchmark/scenarios/networking/sfc_pre_setup.bash index 36ad16d24..ce7527f86 100755 --- a/yardstick/benchmark/scenarios/networking/sfc_pre_setup.bash +++ b/yardstick/benchmark/scenarios/networking/sfc_pre_setup.bash @@ -1,4 +1,13 @@ #!/bin/bash +############################################################################## +# Copyright (c) 2017 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + set -e # download and create image diff --git a/yardstick/benchmark/scenarios/networking/sfc_server.bash b/yardstick/benchmark/scenarios/networking/sfc_server.bash index 41ad92188..57e1ca0c6 100755 --- a/yardstick/benchmark/scenarios/networking/sfc_server.bash +++ b/yardstick/benchmark/scenarios/networking/sfc_server.bash @@ -1,4 +1,13 @@ #!/bin/bash +############################################################################## +# Copyright (c) 2017 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + set -e #service iptables stop diff --git a/yardstick/benchmark/scenarios/networking/sfc_tacker.bash b/yardstick/benchmark/scenarios/networking/sfc_tacker.bash index 8b53eeb7c..7d25e7af6 100755 --- a/yardstick/benchmark/scenarios/networking/sfc_tacker.bash +++ b/yardstick/benchmark/scenarios/networking/sfc_tacker.bash @@ -1,4 +1,13 @@ #!/bin/bash +############################################################################## +# Copyright (c) 2017 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + BASEDIR=`pwd` #import VNF descriptor diff --git a/yardstick/benchmark/scenarios/networking/sfc_teardown.bash b/yardstick/benchmark/scenarios/networking/sfc_teardown.bash index d38be09ce..218fec5e1 100755 --- a/yardstick/benchmark/scenarios/networking/sfc_teardown.bash +++ b/yardstick/benchmark/scenarios/networking/sfc_teardown.bash @@ -1,4 +1,13 @@ #!/bin/bash +############################################################################## +# Copyright (c) 2017 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + #set -e #delete classifier diff --git a/yardstick/benchmark/scenarios/networking/test-vnfd.yaml b/yardstick/benchmark/scenarios/networking/test-vnfd.yaml index 178c671d4..6d02f2f31 100644 --- a/yardstick/benchmark/scenarios/networking/test-vnfd.yaml +++ b/yardstick/benchmark/scenarios/networking/test-vnfd.yaml @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## template_name: test-vnfd description: firewall-example diff --git a/yardstick/benchmark/scenarios/networking/testpmd_fwd.bash b/yardstick/benchmark/scenarios/networking/testpmd_fwd.bash index ac18db491..247a8a833 100644 --- a/yardstick/benchmark/scenarios/networking/testpmd_fwd.bash +++ b/yardstick/benchmark/scenarios/networking/testpmd_fwd.bash @@ -1,3 +1,12 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2017 ZTE corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## #!/bin/sh set -e |