diff options
Diffstat (limited to 'yardstick/benchmark')
-rw-r--r-- | yardstick/benchmark/core/task.py | 24 | ||||
-rwxr-xr-x | yardstick/benchmark/runners/base.py | 4 | ||||
-rw-r--r-- | yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash | 25 | ||||
-rw-r--r-- | yardstick/benchmark/scenarios/networking/ping.py | 35 | ||||
-rw-r--r-- | yardstick/benchmark/scenarios/networking/vnf_generic.py | 6 |
5 files changed, 73 insertions, 21 deletions
diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py index 53298d8d3..9b1b3f851 100644 --- a/yardstick/benchmark/core/task.py +++ b/yardstick/benchmark/core/task.py @@ -28,6 +28,7 @@ from jinja2 import Environment from yardstick.benchmark.contexts.base import Context from yardstick.benchmark.runners import base as base_runner +from yardstick.common.constants import CONF_FILE from yardstick.common.yaml_loader import yaml_load from yardstick.dispatcher.base import Base as DispatcherBase from yardstick.common.task_template import TaskTemplate @@ -36,10 +37,8 @@ from yardstick.common import constants from yardstick.common.html_template import report_template output_file_default = "/tmp/yardstick.out" -config_file = '/etc/yardstick/yardstick.conf' test_cases_dir_default = "tests/opnfv/test_cases/" LOG = logging.getLogger(__name__) -JOIN_TIMEOUT = 60 class Task(object): # pragma: no cover @@ -69,7 +68,7 @@ class Task(object): # pragma: no cover self._set_log() try: - output_config = utils.parse_ini_file(config_file) + output_config = utils.parse_ini_file(CONF_FILE) except Exception: # all error will be ignore, the default value is {} output_config = {} @@ -260,7 +259,7 @@ class Task(object): # pragma: no cover # Wait for runners to finish for runner in runners: - status = runner_join(runner, self.outputs, result) + status = runner_join(runner, background_runners, self.outputs, result) if status != 0: raise RuntimeError( "{0} runner status {1}".format(runner.__execution_type__, status)) @@ -270,7 +269,7 @@ class Task(object): # pragma: no cover for scenario in scenarios: if not _is_background_scenario(scenario): runner = self.run_one_scenario(scenario, output_file) - status = runner_join(runner, self.outputs, result) + status = runner_join(runner, background_runners, self.outputs, result) if status != 0: LOG.error('Scenario NO.%s: "%s" ERROR!', scenarios.index(scenario) + 1, @@ -285,11 +284,11 @@ class Task(object): # pragma: no cover # Wait for background runners to finish for runner in background_runners: - status = runner.join(self.outputs, result, JOIN_TIMEOUT) + status = runner.join(self.outputs, result) if status is None: # Nuke if it did not stop nicely base_runner.Runner.terminate(runner) - runner.join(self.outputs, result, JOIN_TIMEOUT) + runner.join(self.outputs, result) base_runner.Runner.release(runner) print("Background task ended") @@ -641,13 +640,22 @@ def get_networks_from_nodes(nodes): return networks -def runner_join(runner, outputs, result): +def runner_join(runner, background_runners, outputs, result): """join (wait for) a runner, exit process at runner failure + :param background_runners: + :type background_runners: :param outputs: :type outputs: dict :param result: :type result: list """ + while runner.poll() is None: + outputs.update(runner.get_output()) + result.extend(runner.get_result()) + # drain all the background runner queues + for background in background_runners: + outputs.update(background.get_output()) + result.extend(background.get_result()) status = runner.join(outputs, result) base_runner.Runner.release(runner) return status diff --git a/yardstick/benchmark/runners/base.py b/yardstick/benchmark/runners/base.py index 13718d793..a887fa5b3 100755 --- a/yardstick/benchmark/runners/base.py +++ b/yardstick/benchmark/runners/base.py @@ -210,6 +210,10 @@ class Runner(object): QUEUE_JOIN_INTERVAL = 5 + def poll(self, timeout=QUEUE_JOIN_INTERVAL): + self.process.join(timeout) + return self.process.exitcode + def join(self, outputs, result, interval=QUEUE_JOIN_INTERVAL): while self.process.exitcode is None: # drain the queue while we are running otherwise we won't terminate diff --git a/yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash b/yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash index d9a440c89..757553e8b 100644 --- a/yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash +++ b/yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash @@ -21,15 +21,24 @@ max_down_time=$6 OUTPUT_FILE=/tmp/output-qemu.log +echo "To check the parameters:" +echo "SRC: $src" +echo "DST: $dst" +echo "DST_IP: $dst_ip" +echo "MIGRATE_PORT: $migrate_to_port" +echo "DOWN_TIME: $max_down_time" + do_migrate() { + echo "Execution of Live Migration" + echo "info status" | nc -U $src # with no speed limit - echo "migrate_set_speed 0" |nc -U $src + echo "migrate_set_speed 0" | nc -U $src # set the expected max downtime - echo "migrate_set_downtime ${max_down_time}" |nc -U $src + echo "migrate_set_downtime ${max_down_time}" | nc -U $src # start live migration - echo "migrate -d tcp:${dst_ip}:$migrate_to_port" |nc -U $src + echo "migrate -d tcp:${dst_ip}:${migrate_to_port}" | nc -U $src # wait until live migration completed status="" while [ "${status}" == "" ] @@ -38,14 +47,17 @@ do_migrate() echo ${status} sleep 1; done -} >/dev/null + + echo "End of Live Migration" +} output_qemu() { + echo "Checking status of Migration" # print detail information echo "info migrate" | nc -U $src echo "quit" | nc -U $src - echo "quit" | nc -u $dst + echo "quit" | nc -U $dst sleep 5 echo "Migration executed successfully" @@ -65,8 +77,11 @@ echo -e "{ \ # main entry main() { + echo "Perform LiveMigration" do_migrate + echo "LiveMigration Status" output_qemu + echo "LiveMigration JSON output " output_json } main diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py index 3bade73e2..e7d9beea8 100644 --- a/yardstick/benchmark/scenarios/networking/ping.py +++ b/yardstick/benchmark/scenarios/networking/ping.py @@ -24,6 +24,8 @@ LOG = logging.getLogger(__name__) class Ping(base.Scenario): """Execute ping between two hosts + If ping error, RTT will be set to 999999 + Parameters packetsize - number of data bytes to send type: int @@ -33,6 +35,8 @@ class Ping(base.Scenario): __scenario_type__ = "Ping" + PING_ERROR_RTT = 999999 + TARGET_SCRIPT = 'ping_benchmark.bash' def __init__(self, scenario_cfg, context_cfg): @@ -60,6 +64,7 @@ class Ping(base.Scenario): rtt_result = {} ping_result = {"rtt": rtt_result} + sla_max_rtt = self.scenario_cfg.get("sla", {}).get("max_rtt") for pos, dest in enumerate(dest_list): if 'targets' in self.scenario_cfg: @@ -76,20 +81,34 @@ class Ping(base.Scenario): if exit_status != 0: raise RuntimeError(stderr) + if isinstance(target_vm, dict): + target_vm_name = target_vm.get("name") + else: + target_vm_name = target_vm.split('.')[0] if stdout: - if isinstance(target_vm, dict): - target_vm_name = target_vm.get("name") - else: - target_vm_name = target_vm.split('.')[0] - rtt_result[target_vm_name] = float(stdout) - if "sla" in self.scenario_cfg: - sla_max_rtt = int(self.scenario_cfg["sla"]["max_rtt"]) + rtt_result[target_vm_name] = float(stdout.strip()) + # store result before potential AssertionError + result.update(utils.flatten_dict_key(ping_result)) + if sla_max_rtt is not None: + sla_max_rtt = float(sla_max_rtt) assert rtt_result[target_vm_name] <= sla_max_rtt,\ "rtt %f > sla: max_rtt(%f); " % \ (rtt_result[target_vm_name], sla_max_rtt) else: LOG.error("ping '%s' '%s' timeout", options, target_vm) - result.update(utils.flatten_dict_key(ping_result)) + # we need to specify a result to satisfy influxdb schema + # choose a very large number to inidcate timeout + # in this case choose an order of magnitude greater than the SLA + rtt_result[target_vm_name] = float(self.PING_ERROR_RTT) + # store result before potential AssertionError + result.update(utils.flatten_dict_key(ping_result)) + if sla_max_rtt is not None: + raise AssertionError("packet dropped rtt {:f} > sla: max_rtt({:f})".format( + rtt_result[target_vm_name], sla_max_rtt)) + + else: + raise AssertionError( + "packet dropped rtt {:f}".format(rtt_result[target_vm_name])) def _test(): # pragma: no cover diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py index 0fab45480..b94bfc9ab 100644 --- a/yardstick/benchmark/scenarios/networking/vnf_generic.py +++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py @@ -190,6 +190,12 @@ class NetworkServiceTestCase(base.Scenario): for index, publicip in enumerate(fflow.get("public_ip", [])): flow["public_ip_{}".format(index)] = publicip + for index, src_port in enumerate(fflow.get("src_port", [])): + flow["src_port_{}".format(index)] = src_port + + for index, dst_port in enumerate(fflow.get("dst_port", [])): + flow["dst_port_{}".format(index)] = dst_port + flow["count"] = fflow["count"] except KeyError: flow = {} |