summaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/benchmark/contexts/node.py4
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_general.py3
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker_conf.yaml2
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_general.py6
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor_conf.yaml6
-rw-r--r--yardstick/benchmark/scenarios/availability/operation/operation_general.py4
-rw-r--r--yardstick/benchmark/scenarios/availability/operation_conf.yaml6
-rw-r--r--yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py3
-rw-r--r--yardstick/benchmark/scenarios/compute/computecapacity.py2
-rw-r--r--yardstick/benchmark/scenarios/networking/sfc_openstack.py2
-rw-r--r--yardstick/cmd/commands/plugin.py6
-rw-r--r--yardstick/cmd/commands/task.py96
-rw-r--r--yardstick/resources/script/install/storperf.bash27
-rw-r--r--yardstick/resources/script/remove/storperf.bash20
-rw-r--r--yardstick/resources/scripts/install/sample.bash (renamed from yardstick/resources/script/install/sample.bash)0
-rw-r--r--yardstick/resources/scripts/remove/sample.bash (renamed from yardstick/resources/script/remove/sample.bash)0
16 files changed, 135 insertions, 52 deletions
diff --git a/yardstick/benchmark/contexts/node.py b/yardstick/benchmark/contexts/node.py
index 54ee076f4..c3d652119 100644
--- a/yardstick/benchmark/contexts/node.py
+++ b/yardstick/benchmark/contexts/node.py
@@ -82,6 +82,8 @@ class NodeContext(Context):
LOG.error("Nodes: %r" % nodes)
sys.exit(-1)
- node = nodes[0]
+ # A clone is created in order to avoid affecting the
+ # original one.
+ node = dict(nodes[0])
node["name"] = attr_name
return node
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
index 018362a15..816e7e37d 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
@@ -31,6 +31,7 @@ class GeneralAttacker(BaseAttacker):
LOG.debug("ssh host success!")
self.key = self._config['key']
+ self.attack_key = self._config['attack_key']
if "action_parameter" in self._config:
actionParameter = self._config['action_parameter']
@@ -50,7 +51,7 @@ class GeneralAttacker(BaseAttacker):
l = list(item for item in rollbackParameter.values())
self.rollback_param = str.format(*l)
- self.fault_cfg = BaseAttacker.attacker_cfgs.get(self.key)
+ self.fault_cfg = BaseAttacker.attacker_cfgs.get(self.attack_key)
self.inject_script = self.get_script_fullpath(
self.fault_cfg['inject_script'])
self.recovery_script = self.get_script_fullpath(
diff --git a/yardstick/benchmark/scenarios/availability/attacker_conf.yaml b/yardstick/benchmark/scenarios/availability/attacker_conf.yaml
index 16b3d735c..e5d1b9f0b 100644
--- a/yardstick/benchmark/scenarios/availability/attacker_conf.yaml
+++ b/yardstick/benchmark/scenarios/availability/attacker_conf.yaml
@@ -12,6 +12,6 @@ bare-metal-down:
check_script: ha_tools/check_host_ping.bash
recovery_script: ha_tools/ipmi_power.bash
-stop_service:
+stop-service:
inject_script: ha_tools/stop_service.bash
recovery_script: ha_tools/start_service.bash
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
index 515514c29..61efc0520 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
@@ -27,6 +27,7 @@ class GeneralMonitor(basemonitor.BaseMonitor):
user = host.get("user", "root")
key_filename = host.get("key_filename", "~/.ssh/id_rsa")
self.key = self._config["key"]
+ self.monitor_key = self._config["monitor_key"]
self.monitor_type = self._config["monitor_type"]
if "parameter" in self._config:
@@ -35,7 +36,8 @@ class GeneralMonitor(basemonitor.BaseMonitor):
l = list(item for item in parameter.values())
self.cmd_param = str.format(*l)
- self.monitor_cfg = basemonitor.BaseMonitor.monitor_cfgs.get(self.key)
+ self.monitor_cfg = basemonitor.BaseMonitor.monitor_cfgs.get(
+ self.monitor_key)
self.monitor_script = self.get_script_fullpath(
self.monitor_cfg['monitor_script'])
self.connection = ssh.SSH(user, ip, key_filename=key_filename)
@@ -59,7 +61,7 @@ class GeneralMonitor(basemonitor.BaseMonitor):
def verify_SLA(self):
LOG.debug("the _result:%s" % self._result)
outage_time = self._result.get('outage_time', None)
- max_outage_time = self._config["sla"]["max_recover_time"]
+ max_outage_time = self._config["sla"]["max_outage_time"]
if outage_time is None:
LOG.error("There is no outage_time in monitor result.")
return False
diff --git a/yardstick/benchmark/scenarios/availability/monitor_conf.yaml b/yardstick/benchmark/scenarios/availability/monitor_conf.yaml
index 9efceed88..d7bbdfe60 100644
--- a/yardstick/benchmark/scenarios/availability/monitor_conf.yaml
+++ b/yardstick/benchmark/scenarios/availability/monitor_conf.yaml
@@ -3,9 +3,9 @@
#
schema: "yardstick:task:0.1"
-process_status:
+process-status:
monitor_script: ha_tools/check_process_python.bash
-nova_image_list:
+nova-image-list:
monitor_script: ha_tools/nova_image_list.bash
-service_status:
+service-status:
monitor_script: ha_tools/check_service.bash
diff --git a/yardstick/benchmark/scenarios/availability/operation/operation_general.py b/yardstick/benchmark/scenarios/availability/operation/operation_general.py
index d41371629..e43f6e1d5 100644
--- a/yardstick/benchmark/scenarios/availability/operation/operation_general.py
+++ b/yardstick/benchmark/scenarios/availability/operation/operation_general.py
@@ -30,6 +30,7 @@ class GeneralOperaion(BaseOperation):
LOG.debug("ssh host success!")
self.key = self._config['key']
+ self.operation_key = self._config['operation_key']
if "action_parameter" in self._config:
actionParameter = self._config['action_parameter']
@@ -43,7 +44,8 @@ class GeneralOperaion(BaseOperation):
l = list(item for item in rollbackParameter.values())
self.rollback_param = str.format(*l)
- self.operation_cfgs = BaseOperation.operation_cfgs.get(self.key)
+ self.operation_cfgs = BaseOperation.operation_cfgs.get(
+ self.operation_key)
self.action_script = self.get_script_fullpath(
self.operation_cfgs['action_script'])
self.rollback_script = self.get_script_fullpath(
diff --git a/yardstick/benchmark/scenarios/availability/operation_conf.yaml b/yardstick/benchmark/scenarios/availability/operation_conf.yaml
index 78c996d05..1e6746302 100644
--- a/yardstick/benchmark/scenarios/availability/operation_conf.yaml
+++ b/yardstick/benchmark/scenarios/availability/operation_conf.yaml
@@ -7,10 +7,10 @@ nova-create-instance:
action_script: ha_tools/nova/create_instance_from_image.bash
rollback_script: ha_tools/nova/delete_instance.bash
-swift_upload_file:
+swift-upload-file:
action_script: ha_tools/swift/upload.bash
rollback_script: ha_tools/swift/delete.bash
-swift_download_file:
+swift-download-file:
action_script: ha_tools/swift/download.bash
- rollback_script: ha_tools/file/remove_file.bash \ No newline at end of file
+ rollback_script: ha_tools/file/remove_file.bash
diff --git a/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py b/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py
index 70bf9aea6..681fbf63f 100644
--- a/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py
+++ b/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py
@@ -32,6 +32,7 @@ class GeneralResultChecker(BaseResultChecker):
LOG.debug("ssh host success!")
self.key = self._config['key']
+ self.resultchecker_key = self._config['checker_key']
self.type = self._config['checker_type']
self.condition = self._config['condition']
self.expectedResult = self._config['expectedValue']
@@ -45,7 +46,7 @@ class GeneralResultChecker(BaseResultChecker):
self.shell_cmd = str.format(*l)
self.resultchecker_cfgs = BaseResultChecker.resultchecker_cfgs.get(
- self.key)
+ self.resultchecker_key)
self.verify_script = self.get_script_fullpath(
self.resultchecker_cfgs['verify_script'])
diff --git a/yardstick/benchmark/scenarios/compute/computecapacity.py b/yardstick/benchmark/scenarios/compute/computecapacity.py
index 366b470e8..0d7d76143 100644
--- a/yardstick/benchmark/scenarios/compute/computecapacity.py
+++ b/yardstick/benchmark/scenarios/compute/computecapacity.py
@@ -38,7 +38,7 @@ class ComputeCapacity(base.Scenario):
ComputeCapacity.TARGET_SCRIPT)
nodes = self.context_cfg['nodes']
- node = nodes.get('host1', None)
+ node = nodes.get('host', None)
host_user = node.get('user', 'ubuntu')
host_ip = node.get('ip', None)
host_pwd = node.get('password', 'root')
diff --git a/yardstick/benchmark/scenarios/networking/sfc_openstack.py b/yardstick/benchmark/scenarios/networking/sfc_openstack.py
index 2a5fbde1c..d1d45d8e4 100644
--- a/yardstick/benchmark/scenarios/networking/sfc_openstack.py
+++ b/yardstick/benchmark/scenarios/networking/sfc_openstack.py
@@ -1,5 +1,5 @@
import os
-from novaclient.v2 import client as novaclient
+from novaclient import client as novaclient
from neutronclient.v2_0 import client as neutronclient
diff --git a/yardstick/cmd/commands/plugin.py b/yardstick/cmd/commands/plugin.py
index e65c818fa..8e3ddb5a5 100644
--- a/yardstick/cmd/commands/plugin.py
+++ b/yardstick/cmd/commands/plugin.py
@@ -50,6 +50,8 @@ class PluginCommands(object):
print("Done, exiting")
+ @cliargs("input_file", type=str, help="path to plugin configuration file",
+ nargs=1)
def do_remove(self, args):
'''Remove a plugin.'''
@@ -74,7 +76,7 @@ class PluginCommands(object):
'''Deployment environment setup'''
target_script = plugin_name + ".bash"
self.script = pkg_resources.resource_filename(
- 'yardstick.resources', 'script/install/' + target_script)
+ 'yardstick.resources', 'scripts/install/' + target_script)
deployment_user = deployment.get("user")
deployment_ip = deployment.get("ip")
@@ -93,7 +95,7 @@ class PluginCommands(object):
'''Deployment environment setup'''
target_script = plugin_name + ".bash"
self.script = pkg_resources.resource_filename(
- 'yardstick.resources', 'script/remove/' + target_script)
+ 'yardstick.resources', 'scripts/remove/' + target_script)
deployment_user = deployment.get("user")
deployment_ip = deployment.get("ip")
diff --git a/yardstick/cmd/commands/task.py b/yardstick/cmd/commands/task.py
index 587f62412..18b72e726 100644
--- a/yardstick/cmd/commands/task.py
+++ b/yardstick/cmd/commands/task.py
@@ -59,33 +59,29 @@ class TaskCommands(object):
total_start_time = time.time()
parser = TaskParser(args.inputfile[0])
- suite_params = {}
if args.suite:
- suite_params = parser.parse_suite()
- test_cases_dir = suite_params["test_cases_dir"]
- if test_cases_dir[-1] != os.sep:
- test_cases_dir += os.sep
- task_files = [test_cases_dir + task
- for task in suite_params["task_fnames"]]
+ # 1.parse suite, return suite_params info
+ task_files, task_args, task_args_fnames = \
+ parser.parse_suite()
else:
task_files = [parser.path]
+ task_args = [args.task_args]
+ task_args_fnames = [args.task_args_file]
- task_args = suite_params.get("task_args", [args.task_args])
- task_args_fnames = suite_params.get("task_args_fnames",
- [args.task_args_file])
+ LOG.info("\ntask_files:%s, \ntask_args:%s, \ntask_args_fnames:%s",
+ task_files, task_args, task_args_fnames)
if args.parse_only:
sys.exit(0)
if os.path.isfile(args.output_file):
os.remove(args.output_file)
-
+ # parse task_files
for i in range(0, len(task_files)):
one_task_start_time = time.time()
parser.path = task_files[i]
- task_name = os.path.splitext(os.path.basename(task_files[i]))[0]
scenarios, run_in_parallel, meet_precondition = parser.parse_task(
- task_name, task_args[i], task_args_fnames[i])
+ task_args[i], task_args_fnames[i])
if not meet_precondition:
LOG.info("meet_precondition is %s, please check envrionment",
@@ -167,10 +163,34 @@ class TaskParser(object):
def __init__(self, path):
self.path = path
+ def _meet_constraint(self, task, cur_pod, cur_installer):
+ if "constraint" in task:
+ constraint = task.get('constraint', None)
+ if constraint is not None:
+ tc_fit_pod = constraint.get('pod', None)
+ tc_fit_installer = constraint.get('installer', None)
+ LOG.info("cur_pod:%s, cur_installer:%s,tc_constraints:%s",
+ cur_pod, cur_installer, constraint)
+ if cur_pod and tc_fit_pod and cur_pod not in tc_fit_pod:
+ return False
+ if cur_installer and tc_fit_installer and \
+ cur_installer not in tc_fit_installer:
+ return False
+ return True
+
+ def _get_task_para(self, task, cur_pod):
+ task_args = task.get('task_args', None)
+ if task_args is not None:
+ task_args = task_args.get(cur_pod, None)
+ task_args_fnames = task.get('task_args_fnames', None)
+ if task_args_fnames is not None:
+ task_args_fnames = task_args_fnames.get(cur_pod, None)
+ return task_args, task_args_fnames
+
def parse_suite(self):
'''parse the suite file and return a list of task config file paths
and lists of optional parameters if present'''
- print "Parsing suite file:", self.path
+ LOG.info("\nParsing suite file:%s", self.path)
try:
with open(self.path) as stream:
@@ -179,35 +199,40 @@ class TaskParser(object):
sys.exit(ioerror)
self._check_schema(cfg["schema"], "suite")
- print "Starting suite:", cfg["name"]
+ LOG.info("\nStarting scenario:%s", cfg["name"])
test_cases_dir = cfg.get("test_cases_dir", test_cases_dir_default)
- task_fnames = []
- task_args = []
- task_args_fnames = []
+ if test_cases_dir[-1] != os.sep:
+ test_cases_dir += os.sep
+
+ cur_pod = os.environ.get('NODE_NAME', None)
+ cur_installer = os.environ.get('INSTALL_TYPE', None)
+
+ valid_task_files = []
+ valid_task_args = []
+ valid_task_args_fnames = []
for task in cfg["test_cases"]:
- task_fnames.append(task["file_name"])
- if "task_args" in task:
- task_args.append(task["task_args"])
+ # 1.check file_name
+ if "file_name" in task:
+ task_fname = task.get('file_name', None)
+ if task_fname is None:
+ continue
else:
- task_args.append(None)
-
- if "task_args_file" in task:
- task_args_fnames.append(task["task_args_file"])
+ continue
+ # 2.check constraint
+ if self._meet_constraint(task, cur_pod, cur_installer):
+ valid_task_files.append(test_cases_dir + task_fname)
else:
- task_args_fnames.append(None)
-
- suite_params = {
- "test_cases_dir": test_cases_dir,
- "task_fnames": task_fnames,
- "task_args": task_args,
- "task_args_fnames": task_args_fnames
- }
+ continue
+ # 3.fetch task parameters
+ task_args, task_args_fnames = self._get_task_para(task, cur_pod)
+ valid_task_args.append(task_args)
+ valid_task_args_fnames.append(task_args_fnames)
- return suite_params
+ return valid_task_files, valid_task_args, valid_task_args_fnames
- def parse_task(self, task_name, task_args=None, task_args_file=None):
+ def parse_task(self, task_args=None, task_args_file=None):
'''parses the task file and return an context and scenario instances'''
print "Parsing task config:", self.path
@@ -262,6 +287,7 @@ class TaskParser(object):
# add tc and task id for influxdb extended tags
task_id = str(uuid.uuid4())
for scenario in cfg["scenarios"]:
+ task_name = os.path.splitext(os.path.basename(self.path))[0]
scenario["tc"] = task_name
scenario["task_id"] = task_id
diff --git a/yardstick/resources/script/install/storperf.bash b/yardstick/resources/script/install/storperf.bash
new file mode 100644
index 000000000..9bbec7206
--- /dev/null
+++ b/yardstick/resources/script/install/storperf.bash
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2016 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
+##############################################################################
+
+# StorPerf plugin installation script
+# After installation, it will run StorPerf container on Jump Host
+# Requirements:
+# 1. docker has been installed on the Jump Host
+# 2. Openstack environment file for storperf, '~/storperf_admin-rc', is ready.
+
+set -e
+
+mkdir -p /tmp/storperf-yardstick
+
+docker pull opnfv/storperf
+docker run -t \
+--env-file ~/storperf_admin-rc \
+-p 5000:5000 -p 8000:8000 \
+-v /tmp/storperf-yardstick/carbon:/opt/graphite/storage/whisper \
+--name storperf-yardstick opnfv/storperf &
diff --git a/yardstick/resources/script/remove/storperf.bash b/yardstick/resources/script/remove/storperf.bash
new file mode 100644
index 000000000..a8eb51c89
--- /dev/null
+++ b/yardstick/resources/script/remove/storperf.bash
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2016 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
+##############################################################################
+
+# StorPerf plugin un-installation script
+
+set -e
+
+docker stop storperf-yardstick
+docker rm -f storperf-yardstick
+docker rmi opnfv/storperf
+
+rm -rf /tmp/storperf-yardstick
diff --git a/yardstick/resources/script/install/sample.bash b/yardstick/resources/scripts/install/sample.bash
index 21eb14680..21eb14680 100644
--- a/yardstick/resources/script/install/sample.bash
+++ b/yardstick/resources/scripts/install/sample.bash
diff --git a/yardstick/resources/script/remove/sample.bash b/yardstick/resources/scripts/remove/sample.bash
index 15618df2d..15618df2d 100644
--- a/yardstick/resources/script/remove/sample.bash
+++ b/yardstick/resources/scripts/remove/sample.bash