summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/__init__.py0
-rw-r--r--api/actions/__init__.py0
-rw-r--r--api/actions/result.py55
-rw-r--r--api/actions/test.py48
-rwxr-xr-xapi/api-prepare.sh59
-rw-r--r--api/conf.py25
-rw-r--r--api/server.py27
-rw-r--r--api/urls.py16
-rw-r--r--api/utils/__init__.py0
-rw-r--r--api/utils/common.py70
-rw-r--r--api/utils/daemonthread.py44
-rw-r--r--api/utils/influx.py73
-rw-r--r--api/views.py42
-rw-r--r--api/yardstick.ini16
-rw-r--r--api/yardstick.sock0
-rw-r--r--docker/Dockerfile9
-rw-r--r--docs/release/release-notes.rst44
-rw-r--r--docs/userguide/07-installation.rst36
-rw-r--r--docs/userguide/10-grafana.rst69
-rwxr-xr-xinstall.sh43
-rw-r--r--requirements.txt83
-rw-r--r--samples/background-task.yaml2
-rw-r--r--samples/cachestat.yaml2
-rw-r--r--samples/cyclictest.yaml2
-rw-r--r--samples/fio-template.yaml2
-rw-r--r--samples/fio.yaml2
-rw-r--r--samples/iperf3-jitter.yaml2
-rw-r--r--samples/iperf3.yaml2
-rw-r--r--samples/lmbench.yaml2
-rw-r--r--samples/lmbench_cache.yaml2
-rw-r--r--samples/memload.yaml2
-rwxr-xr-xsamples/netperf.yaml2
-rw-r--r--samples/netperf_bottlenecks.yaml43
-rw-r--r--samples/netutilization.yaml2
-rw-r--r--samples/perf.yaml2
-rw-r--r--samples/pktgen.yaml2
-rw-r--r--samples/ramspeed.yaml2
-rw-r--r--samples/unixbench.yaml2
-rwxr-xr-xsetup.py31
-rwxr-xr-xtests/ci/clean_images.sh2
-rwxr-xr-xtests/ci/load_images.sh8
-rwxr-xr-xtests/ci/yardstick-verify2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc001.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc005.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc009.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc010.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc011.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc012.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc014.yaml4
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc038.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc069.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc070.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc071.yaml2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc072.yaml2
-rw-r--r--tests/opnfv/test_suites/opnfv_os-odl_l2-fdio-ha_daily.yaml30
-rw-r--r--tests/unit/api/actions/test_result.py29
-rw-r--r--tests/unit/api/actions/test_test.py29
-rw-r--r--tests/unit/api/test_views.py45
-rw-r--r--tests/unit/api/utils/test_common.py95
-rw-r--r--tests/unit/api/utils/test_daemonthread.py37
-rw-r--r--tests/unit/api/utils/test_influx.py82
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_networkcapacity.py112
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_ping6.py17
-rw-r--r--tests/unit/common/config_sample.yaml2
-rw-r--r--tests/unit/common/test_utils.py27
-rwxr-xr-xtools/yardstick-img-lxd-modify7
-rwxr-xr-xtools/yardstick-img-modify7
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py9
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_general.py4
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_process.py4
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_command.py4
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_general.py4
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_process.py4
-rw-r--r--yardstick/benchmark/scenarios/availability/operation/operation_general.py4
-rw-r--r--yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py5
-rw-r--r--yardstick/benchmark/scenarios/compute/cachestat.py4
-rw-r--r--yardstick/benchmark/scenarios/compute/computecapacity.py4
-rw-r--r--yardstick/benchmark/scenarios/compute/cpuload.py4
-rw-r--r--yardstick/benchmark/scenarios/compute/cyclictest.py4
-rw-r--r--yardstick/benchmark/scenarios/compute/lmbench.py4
-rw-r--r--yardstick/benchmark/scenarios/compute/memload.py4
-rw-r--r--yardstick/benchmark/scenarios/compute/perf.py4
-rw-r--r--yardstick/benchmark/scenarios/compute/plugintest.py4
-rw-r--r--yardstick/benchmark/scenarios/compute/ramspeed.py4
-rw-r--r--yardstick/benchmark/scenarios/compute/unixbench.py5
-rw-r--r--yardstick/benchmark/scenarios/networking/iperf3.py7
-rwxr-xr-xyardstick/benchmark/scenarios/networking/netperf.py9
-rwxr-xr-xyardstick/benchmark/scenarios/networking/netperf_node.py6
-rw-r--r--yardstick/benchmark/scenarios/networking/netutilization.py4
-rw-r--r--yardstick/benchmark/scenarios/networking/networkcapacity.py140
-rw-r--r--yardstick/benchmark/scenarios/networking/ping.py7
-rw-r--r--yardstick/benchmark/scenarios/networking/ping6.py24
-rw-r--r--yardstick/benchmark/scenarios/networking/ping6_setup.bash7
-rw-r--r--yardstick/benchmark/scenarios/networking/pktgen.py9
-rw-r--r--yardstick/benchmark/scenarios/networking/pktgen_dpdk.py8
-rw-r--r--yardstick/benchmark/scenarios/networking/sfc.py16
-rw-r--r--yardstick/benchmark/scenarios/networking/vsperf.py3
-rw-r--r--yardstick/benchmark/scenarios/storage/fio.py4
-rw-r--r--yardstick/benchmark/scenarios/storage/storagecapacity.py4
-rw-r--r--yardstick/cmd/cli.py52
-rw-r--r--yardstick/cmd/commands/plugin.py15
-rw-r--r--yardstick/cmd/commands/task.py9
-rw-r--r--yardstick/common/constants.py3
-rw-r--r--yardstick/common/utils.py23
-rw-r--r--yardstick/ssh.py7
107 files changed, 1542 insertions, 320 deletions
diff --git a/api/__init__.py b/api/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/api/__init__.py
diff --git a/api/actions/__init__.py b/api/actions/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/api/actions/__init__.py
diff --git a/api/actions/result.py b/api/actions/result.py
new file mode 100644
index 000000000..9f606d2cb
--- /dev/null
+++ b/api/actions/result.py
@@ -0,0 +1,55 @@
+##############################################################################
+# 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
+##############################################################################
+import logging
+
+from api.utils import influx as influx_utils
+from api.utils import common as common_utils
+from api import conf
+
+logger = logging.getLogger(__name__)
+
+
+def getResult(args):
+ try:
+ measurement = args['measurement']
+ task_id = args['task_id']
+ except KeyError:
+ message = 'measurement and task_id must be needed'
+ return common_utils.error_handler(message)
+
+ measurement = conf.TEST_CASE_PRE + measurement
+
+ query_sql = "select * from $table where task_id='$task_id'"
+ param = {'table': 'tasklist', 'task_id': task_id}
+ data = common_utils.translate_to_str(influx_utils.query(query_sql, param))
+
+ def _unfinished():
+ return common_utils.result_handler(0, [])
+
+ def _finished():
+ param = {'table': measurement, 'task_id': task_id}
+ data = common_utils.translate_to_str(influx_utils.query(query_sql,
+ param))
+
+ return common_utils.result_handler(1, data)
+
+ def _error():
+ return common_utils.result_handler(2, data[0]['error'])
+
+ try:
+ status = data[0]['status']
+
+ switcher = {
+ 0: _unfinished,
+ 1: _finished,
+ 2: _error
+ }
+ return switcher.get(status, lambda: 'nothing')()
+ except IndexError:
+ return common_utils.error_handler('no such task')
diff --git a/api/actions/test.py b/api/actions/test.py
new file mode 100644
index 000000000..b1dc212c2
--- /dev/null
+++ b/api/actions/test.py
@@ -0,0 +1,48 @@
+##############################################################################
+# 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
+##############################################################################
+import uuid
+import json
+import os
+import logging
+
+from api import conf
+from api.utils import common as common_utils
+
+logger = logging.getLogger(__name__)
+
+
+def runTestCase(args):
+ try:
+ opts = args.get('opts', {})
+ testcase = args['testcase']
+ except KeyError:
+ logger.error('Lack of testcase argument')
+ result = {
+ 'status': 'error',
+ 'message': 'need testcase name'
+ }
+ return json.dumps(result)
+
+ testcase = os.path.join(conf.TEST_CASE_PATH,
+ conf.TEST_CASE_PRE + testcase + '.yaml')
+
+ task_id = str(uuid.uuid4())
+
+ command_list = ['task', 'start']
+ command_list = common_utils.get_command_list(command_list, opts, testcase)
+ logger.debug('The command_list is: %s', command_list)
+
+ logger.debug('Start to execute command list')
+ common_utils.exec_command_task(command_list, task_id)
+
+ result = {
+ 'status': 'success',
+ 'task_id': task_id
+ }
+ return json.dumps(result)
diff --git a/api/api-prepare.sh b/api/api-prepare.sh
new file mode 100755
index 000000000..075d7875c
--- /dev/null
+++ b/api/api-prepare.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+# yardstick output config
+output_config='/etc/yardstick/yardstick.conf'
+
+if [[ ! -e "${output_config}" ]];then
+ gateway_ip=$(ip route | grep default | awk '{print $3}')
+ echo "${gateway_ip}"
+
+ install -d /etc/yardstick -m 0755 -o root
+
+ cat << EOF > "${output_config}"
+[DEFAULT]
+debug = True
+dispatcher = influxdb
+
+[dispatcher_file]
+file_path = /tmp/yardstick.out
+
+[dispatcher_http]
+timeout = 5
+# target = http://127.0.0.1:8000/results
+
+[dispatcher_influxdb]
+timeout = 5
+target = http://${gateway_ip}:8086
+db_name = yardstick
+username = root
+password = root
+EOF
+fi
+
+# nginx config
+nginx_config='/etc/nginx/conf.d/yardstick.conf'
+
+if [[ ! -e "${nginx_config}" ]];then
+
+ cat << EOF >> "${nginx_config}"
+server {
+ listen 5000;
+ server_name localhost;
+ index index.htm index.html;
+ location / {
+ include uwsgi_params;
+ uwsgi_pass unix:///home/opnfv/repos/yardstick/api/yardstick.sock;
+ }
+}
+EOF
+fi
+
+# nginx service start when boot
+cat << EOF >> /root/.bashrc
+
+nginx_status=\$(service nginx status | grep not)
+if [ -n "\${nginx_status}" ];then
+ service nginx restart
+ uwsgi -i /home/opnfv/repos/yardstick/api/yardstick.ini
+fi
+EOF
diff --git a/api/conf.py b/api/conf.py
new file mode 100644
index 000000000..e1da4aba0
--- /dev/null
+++ b/api/conf.py
@@ -0,0 +1,25 @@
+##############################################################################
+# 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
+##############################################################################
+from pyroute2 import IPDB
+
+
+# configuration for influxdb
+with IPDB() as ip:
+ GATEWAY_IP = ip.routes['default'].gateway
+PORT = 8086
+
+TEST_ACTION = ['runTestCase']
+
+TEST_CASE_PATH = '../tests/opnfv/test_cases/'
+
+TEST_CASE_PRE = 'opnfv_yardstick_'
+
+TEST_SUITE_PATH = '../tests/opnfv/test_suites/'
+
+OUTPUT_CONFIG_FILE_PATH = '/etc/yardstick/yardstick.conf'
diff --git a/api/server.py b/api/server.py
new file mode 100644
index 000000000..1cbe1725d
--- /dev/null
+++ b/api/server.py
@@ -0,0 +1,27 @@
+##############################################################################
+# 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
+##############################################################################
+import logging
+
+from flask import Flask
+from flask_restful import Api
+
+from api.urls import urlpatterns
+
+logger = logging.getLogger(__name__)
+
+app = Flask(__name__)
+
+api = Api(app)
+
+reduce(lambda a, b: a.add_resource(b.resource, b.url,
+ endpoint=b.endpoint) or a, urlpatterns, api)
+
+if __name__ == '__main__':
+ logger.info('Starting server')
+ app.run(host='0.0.0.0')
diff --git a/api/urls.py b/api/urls.py
new file mode 100644
index 000000000..2a9e72a76
--- /dev/null
+++ b/api/urls.py
@@ -0,0 +1,16 @@
+##############################################################################
+# 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
+##############################################################################
+from api import views
+from api.utils.common import Url
+
+
+urlpatterns = [
+ Url('/yardstick/test/action', views.Test, 'test'),
+ Url('/yardstick/result/action', views.Result, 'result')
+]
diff --git a/api/utils/__init__.py b/api/utils/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/api/utils/__init__.py
diff --git a/api/utils/common.py b/api/utils/common.py
new file mode 100644
index 000000000..04a6fe0d6
--- /dev/null
+++ b/api/utils/common.py
@@ -0,0 +1,70 @@
+##############################################################################
+# 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
+##############################################################################
+import collections
+import logging
+import json
+
+from api.utils.daemonthread import DaemonThread
+from yardstick.cmd.cli import YardstickCLI
+
+logger = logging.getLogger(__name__)
+
+
+def translate_to_str(object):
+ if isinstance(object, collections.Mapping):
+ return {str(k): translate_to_str(v) for k, v in object.items()}
+ elif isinstance(object, list):
+ return [translate_to_str(ele) for ele in object]
+ elif isinstance(object, unicode):
+ return str(object)
+ return object
+
+
+def get_command_list(command_list, opts, args):
+
+ command_list.append(args)
+
+ command_list.extend(('--{}'.format(k) for k in opts if 'task-args' != k))
+
+ task_args = opts.get('task-args', '')
+ if task_args:
+ command_list.extend(['--task-args', task_args])
+
+ return command_list
+
+
+def exec_command_task(command_list, task_id): # pragma: no cover
+ daemonthread = DaemonThread(YardstickCLI().api, (command_list, task_id))
+ daemonthread.start()
+
+
+def error_handler(message):
+ logger.debug(message)
+ result = {
+ 'status': 'error',
+ 'message': message
+ }
+ return json.dumps(result)
+
+
+def result_handler(status, data):
+ result = {
+ 'status': status,
+ 'result': data
+ }
+ return json.dumps(result)
+
+
+class Url(object):
+
+ def __init__(self, url, resource, endpoint):
+ super(Url, self).__init__()
+ self.url = url
+ self.resource = resource
+ self.endpoint = endpoint
diff --git a/api/utils/daemonthread.py b/api/utils/daemonthread.py
new file mode 100644
index 000000000..47c0b9108
--- /dev/null
+++ b/api/utils/daemonthread.py
@@ -0,0 +1,44 @@
+##############################################################################
+# 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
+##############################################################################
+import threading
+import os
+import datetime
+import errno
+
+from api import conf
+from api.utils.influx import write_data_tasklist
+
+
+class DaemonThread(threading.Thread):
+
+ def __init__(self, method, args):
+ super(DaemonThread, self).__init__(target=method, args=args)
+ self.method = method
+ self.command_list = args[0]
+ self.task_id = args[1]
+
+ def run(self):
+ timestamp = datetime.datetime.now()
+
+ try:
+ write_data_tasklist(self.task_id, timestamp, 0)
+ self.method(self.command_list, self.task_id)
+ write_data_tasklist(self.task_id, timestamp, 1)
+ except Exception as e:
+ write_data_tasklist(self.task_id, timestamp, 2, error=str(e))
+ finally:
+ _handle_testsuite_file(self.task_id)
+
+
+def _handle_testsuite_file(task_id):
+ try:
+ os.remove(os.path.join(conf.TEST_SUITE_PATH, task_id + '.yaml'))
+ except OSError as e:
+ if e.errno != errno.ENOENT:
+ raise
diff --git a/api/utils/influx.py b/api/utils/influx.py
new file mode 100644
index 000000000..9366ed3e9
--- /dev/null
+++ b/api/utils/influx.py
@@ -0,0 +1,73 @@
+##############################################################################
+# 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
+##############################################################################
+import logging
+from urlparse import urlsplit
+
+from influxdb import InfluxDBClient
+import ConfigParser
+
+from api import conf
+
+logger = logging.getLogger(__name__)
+
+
+def get_data_db_client():
+ parser = ConfigParser.ConfigParser()
+ try:
+ parser.read(conf.OUTPUT_CONFIG_FILE_PATH)
+ dispatcher = parser.get('DEFAULT', 'dispatcher')
+
+ if 'influxdb' != dispatcher:
+ raise RuntimeError
+
+ ip = _get_ip(parser.get('dispatcher_influxdb', 'target'))
+ username = parser.get('dispatcher_influxdb', 'username')
+ password = parser.get('dispatcher_influxdb', 'password')
+ db_name = parser.get('dispatcher_influxdb', 'db_name')
+ return InfluxDBClient(ip, conf.PORT, username, password, db_name)
+ except ConfigParser.NoOptionError:
+ logger.error('can not find the key')
+ raise
+
+
+def _get_ip(url):
+ return urlsplit(url).hostname
+
+
+def _write_data(measurement, field, timestamp, tags):
+ point = {
+ 'measurement': measurement,
+ 'fields': field,
+ 'time': timestamp,
+ 'tags': tags
+ }
+
+ try:
+ client = get_data_db_client()
+
+ logger.debug('Start to write data: %s', point)
+ client.write_points([point])
+ except RuntimeError:
+ logger.debug('dispatcher is not influxdb')
+
+
+def write_data_tasklist(task_id, timestamp, status, error=''):
+ field = {'status': status, 'error': error}
+ tags = {'task_id': task_id}
+ _write_data('tasklist', field, timestamp, tags)
+
+
+def query(query_sql):
+ try:
+ client = get_data_db_client()
+ logger.debug('Start to query: %s', query_sql)
+ return list(client.query(query_sql).get_points())
+ except RuntimeError:
+ logger.error('dispatcher is not influxdb')
+ raise
diff --git a/api/views.py b/api/views.py
new file mode 100644
index 000000000..e78389f5a
--- /dev/null
+++ b/api/views.py
@@ -0,0 +1,42 @@
+##############################################################################
+# 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
+##############################################################################
+import logging
+
+from flask import request
+from flask_restful import Resource
+
+from api.utils import common as common_utils
+from api.actions import test as test_action
+from api.actions import result as result_action
+
+logger = logging.getLogger(__name__)
+
+
+class Test(Resource):
+ def post(self):
+ action = common_utils.translate_to_str(request.json.get('action', ''))
+ args = common_utils.translate_to_str(request.json.get('args', {}))
+ logger.debug('Input args is: action: %s, args: %s', action, args)
+
+ try:
+ return getattr(test_action, action)(args)
+ except AttributeError:
+ return common_utils.error_handler('Wrong action')
+
+
+class Result(Resource):
+ def get(self):
+ args = common_utils.translate_to_str(request.args)
+ action = args.get('action', '')
+ logger.debug('Input args is: action: %s, args: %s', action, args)
+
+ try:
+ return getattr(result_action, action)(args)
+ except AttributeError:
+ return common_utils.error_handler('Wrong action')
diff --git a/api/yardstick.ini b/api/yardstick.ini
new file mode 100644
index 000000000..535022960
--- /dev/null
+++ b/api/yardstick.ini
@@ -0,0 +1,16 @@
+[uwsgi]
+master = true
+debug = true
+chdir = /home/opnfv/repos/yardstick/api
+module = server
+plugins = python
+processes = 10
+threads = 5
+async = true
+max-requests = 5000
+chmod-socket = 666
+callable = app
+enable-threads = true
+close-on-exec = 1
+daemonize=/home/kklt/kklt/api/uwsgi.log
+socket = /home/opnfv/repos/yardstick/api/yardstick.sock
diff --git a/api/yardstick.sock b/api/yardstick.sock
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/api/yardstick.sock
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 5387babff..36db2bb13 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -43,6 +43,9 @@ RUN apt-get update && apt-get install -y \
python-dev \
libxml2-dev \
libxslt1-dev \
+ nginx \
+ uwsgi \
+ uwsgi-plugin-python \
python-setuptools && \
easy_install -U setuptools
@@ -57,9 +60,13 @@ RUN git clone https://gerrit.opnfv.org/gerrit/releng ${RELENG_REPO_DIR}
# install yardstick + dependencies
RUN cd ${YARDSTICK_REPO_DIR} && easy_install -U pip
-RUN cd ${YARDSTICK_REPO_DIR} && pip install -r tests/ci/requirements.txt
+RUN cd ${YARDSTICK_REPO_DIR} && pip install -r requirements.txt
RUN cd ${YARDSTICK_REPO_DIR} && pip install .
+RUN ${YARDSTICK_REPO_DIR}/api/api-prepare.sh
+
+EXPOSE 5000
+
ADD http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img /home/opnfv/images/
ADD http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img /home/opnfv/images/
diff --git a/docs/release/release-notes.rst b/docs/release/release-notes.rst
index 72f263c2d..8df0776df 100644
--- a/docs/release/release-notes.rst
+++ b/docs/release/release-notes.rst
@@ -38,7 +38,10 @@ Version History
| *Date* | *Version* | *Comment* |
| | | |
+----------------+--------------------+---------------------------------+
-| Oct 27nd, 2016 | 2.0 | Yardstick for Colorado release |
+| Dec 5th, 2016 | 3.0 | Yardstick for Colorado release |
+| | | |
++----------------+--------------------+---------------------------------+
+| Oct 27th, 2016 | 2.0 | Yardstick for Colorado release |
| | | |
+----------------+--------------------+---------------------------------+
| Aug 22nd, 2016 | 1.0 | Yardstick for Colorado release |
@@ -132,19 +135,19 @@ Release Data
| **Project** | Yardstick |
| | |
+--------------------------------------+--------------------------------------+
-| **Repo/tag** | yardstick/colorado.2.0 |
+| **Repo/tag** | yardstick/colorado.3.0 |
| | |
+--------------------------------------+--------------------------------------+
-| **Yardstick Docker image tag** | colorado.2.0 |
+| **Yardstick Docker image tag** | colorado.3.0 |
| | |
+--------------------------------------+--------------------------------------+
| **Release designation** | Colorado |
| | |
+--------------------------------------+--------------------------------------+
-| **Release date** | October 27 2016 |
+| **Release date** | December 5th, 2016 |
| | |
+--------------------------------------+--------------------------------------+
-| **Purpose of the delivery** | OPNFV Colorado release 2.0 |
+| **Purpose of the delivery** | OPNFV Colorado release 3.0 |
| | |
+--------------------------------------+--------------------------------------+
@@ -163,22 +166,22 @@ Documents
Software Deliverables
---------------------
-**Yardstick framework source code <colorado.2.0>**
+**Yardstick framework source code <colorado.3.0>**
+--------------------------------------+--------------------------------------+
| **Project** | Yardstick |
| | |
+--------------------------------------+--------------------------------------+
-| **Repo/tag** | yardstick/colorado.2.0 |
+| **Repo/tag** | yardstick/colorado.3.0 |
| | |
+--------------------------------------+--------------------------------------+
-| **Yardstick Docker image tag** | colorado.2.0 |
+| **Yardstick Docker image tag** | colorado.3.0 |
| | |
+--------------------------------------+--------------------------------------+
| **Release designation** | Colorado |
| | |
+--------------------------------------+--------------------------------------+
-| **Release date** | October 27th, 2016 |
+| **Release date** | December 5th, 2016 |
| | |
+--------------------------------------+--------------------------------------+
| **Purpose of the delivery** | OPNFV Colorado release |
@@ -502,7 +505,7 @@ Feature additions
Scenario Matrix
===============
-For Colorado 2.0, Yardstick was tested on the following scenarios:
+For Colorado 3.0, Yardstick was tested on the following scenarios:
+-------------------------+---------+---------+---------+---------+
| Scenario | Apex | Compass | Fuel | Joid |
@@ -585,6 +588,21 @@ Known Issues/Faults
Corrected Faults
----------------
+Colorado.3.0:
+
++----------------------------+------------------------------------------------+
+| **JIRA REFERENCE** | **SLOGAN** |
+| | |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-239 | Define process for working with Yardstick |
+| | Grafana dashboard. |
+| | |
++----------------------------+------------------------------------------------+
+| JIRA: YARDSTICK-373 | Add os-odl_l2-fdio-ha scenario support. |
+| | |
++----------------------------+------------------------------------------------+
+
+
Colorado.2.0:
+----------------------------+------------------------------------------------+
@@ -621,7 +639,7 @@ Colorado.2.0:
+----------------------------+------------------------------------------------+
-Colorado 2.0 known restrictions/issues
+Colorado 3.0 known restrictions/issues
==================================
+-----------+-----------+----------------------------------------------+
| Installer | Scenario | Issue |
@@ -656,6 +674,8 @@ Useful links
- Yardstick IRC chanel: #opnfv-yardstick
+.. _`YARDSTICK-239` : https://jira.opnfv.org/browse/YARDSTICK-239
+
.. _`YARDSTICK-325` : https://jira.opnfv.org/browse/YARDSTICK-325
.. _`YARDSTICK-358` : https://jira.opnfv.org/browse/YARDSTICK-358
@@ -669,3 +689,5 @@ Useful links
.. _`YARDSTICK-371` : https://jira.opnfv.org/browse/YARDSTICK-371
.. _`YARDSTICK-372` : https://jira.opnfv.org/browse/YARDSTICK-372
+
+.. _`YARDSTICK-373` : https://jira.opnfv.org/browse/YARDSTICK-373
diff --git a/docs/userguide/07-installation.rst b/docs/userguide/07-installation.rst
index fc68d3931..09d36bf25 100644
--- a/docs/userguide/07-installation.rst
+++ b/docs/userguide/07-installation.rst
@@ -75,47 +75,13 @@ If you choose to use the Ubuntu 14.04 Docker image, You can pull the Ubuntu
Installing Yardstick framework
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Install dependencies:
-
-::
-
- sudo apt-get update && sudo apt-get install -y \
- wget \
- git \
- sshpass \
- qemu-utils \
- kpartx \
- libffi-dev \
- libssl-dev \
- python \
- python-dev \
- python-virtualenv \
- libxml2-dev \
- libxslt1-dev \
- python-setuptools
-
-Create a python virtual environment, source it and update setuptools:
-
-::
-
- virtualenv ~/yardstick_venv
- source ~/yardstick_venv/bin/activate
- easy_install -U setuptools
-
Download source code and install python dependencies:
::
git clone https://gerrit.opnfv.org/gerrit/yardstick
cd yardstick
- python setup.py install
-
-A Youtube video tutorial on this installation mode is available
-at: http://www.youtube.com/watch?v=4S4izNolmR0
-
-.. image:: http://img.youtube.com/vi/4S4izNolmR0/0.jpg
- :alt: http://www.youtube.com/watch?v=4S4izNolmR0
- :target: http://www.youtube.com/watch?v=4S4izNolmR0
+ ./install.sh
Installing Yardstick using Docker
diff --git a/docs/userguide/10-grafana.rst b/docs/userguide/10-grafana.rst
index e871a18da..416857b71 100644
--- a/docs/userguide/10-grafana.rst
+++ b/docs/userguide/10-grafana.rst
@@ -7,6 +7,7 @@
Grafana dashboard
=================
+
Abstract
========
@@ -18,12 +19,14 @@ dashboard can be found here: http://testresults.opnfv.org/grafana/
:width: 800px
:alt: Yardstick grafana dashboard
+
Public access
=============
Yardstick provids a public account for accessing to the dashboard. The username
and password are both set to ‘opnfv’.
+
Testcase dashboard
==================
@@ -39,15 +42,35 @@ For each test case dashboard. On the top left, we have a dashboard selection,
you can switch to different test cases using this pull-down menu.
Underneath, we have a pod and scenario selection.
-All the pods and scenarios that have ever published test data to the Influx DB
+All the pods and scenarios that have ever published test data to the InfluxDB
will be shown here.
You can check multiple pods or scenarios.
-For each test case, we have a short description and a link to detailed test case information in Yardstick user guide.
+For each test case, we have a short description and a link to detailed test
+case information in Yardstick user guide.
Underneath, it is the result presentation section.
-You can use the time period selection on the top right corner to zoom in or zoom out the chart.
+You can use the time period selection on the top right corner to zoom in or
+zoom out the chart.
+
+
+Administration access
+=====================
+
+For a user with administration rights it is easy to update and save any
+dashboard configuration. Saved updates immediately take effect and become live.
+This may cause issues like:
+
+- Changes and updates made to the live configuration in Grafana can compromise
+ existing Grafana content in an unwanted, unpredicted or incompatible way.
+ Grafana as such is not version controlled, there exists one single Grafana
+ configuration per dashboard.
+- There is a risk several people can disturb each other when doing updates to
+ the same Grafana dashboard at the same time.
+
+Any change made by administrator should be careful.
+
Add a dashboard into yardstick grafana
======================================
@@ -64,23 +87,33 @@ There are 6 steps to go.
:alt: Add a dashboard into yardstick grafana
-First, You need to build a local influxdb and grafana, so you can do the work
-locally. You can refer to How to deploy InfluxDB and Grafana locally wiki page
-about how to do this.
+1. You need to build a local influxdb and grafana, so you can do the work
+ locally. You can refer to How to deploy InfluxDB and Grafana locally wiki
+ page about how to do this.
+
+2. Once step one is done, you can fetch the existing grafana dashboard
+ configuration file from the yardstick repository and import it to your local
+ grafana. After import is done, you grafana dashboard will be ready to use
+ just like the community’s dashboard.
-Once step one is done, you can fetch the existing grafana dashboard
-configuration file from the yardstick repository and import it to your local
-grafana. After import is done, you grafana dashboard will be ready to use just
-like the community’s dashboard.
+3. The third step is running some test cases to generate test results and
+ publishing it to your local influxdb.
-The third step is running some test cases to generate test results and
-publishing it to your local influxdb.
+4. Now you have some data to visualize in your dashboard. In the fourth step,
+ it is time to create your own dashboard. You can either modify an existing
+ dashboard or try to create a new one from scratch. If you choose to modify
+ an existing dashboard then in the curtain menu of the existing dashboard do
+ a "Save As..." into a new dashboard copy instance, and then continue doing
+ all updates and saves within the dashboard copy.
-Now you have some data to visualize in your dashboard. In the fourth step, it
-is time to create your own dashboard. You can either modify an existing
-dashboard or try to create a new one from scratch.
+5. When finished with all Grafana configuration changes in this temporary
+ dashboard then chose "export" of the updated dashboard copy into a JSON file
+ and put it up for review in Gerrit, in file /yardstick/dashboard/Yardstick-TCxxx-yyyyyyyyyyyyy.
+ For instance a typical default name of the file would be "Yardstick-TC001 Copy-1234567891234".
-Either way, once you finish the dashboard, the next step is exporting the
-configuration file and propose a patch into Yardstick. Yardstick team will
-review and merge it into Yardstick repository.
+6. Once you finish your dashboard, the next step is exporting the configuration
+ file and propose a patch into Yardstick. Yardstick team will review and
+ merge it into Yardstick repository. After approved review Yardstick team
+ will do an "import" of the JSON file and also a "save dashboard" as soon as
+ possible to replace the old live dashboard configuration.
diff --git a/install.sh b/install.sh
new file mode 100755
index 000000000..8fdd07569
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,43 @@
+# install tools
+apt-get update && apt-get install -y \
+ wget \
+ expect \
+ curl \
+ git \
+ sshpass \
+ qemu-utils \
+ kpartx \
+ libffi-dev \
+ libssl-dev \
+ python \
+ python-dev \
+ libxml2-dev \
+ libxslt1-dev \
+ nginx \
+ uswgi \
+ uwsgi-plugin-python \
+ python-setuptools && \
+ easy_install -U setuptools
+
+apt-get -y autoremove && apt-get clean
+
+
+# fit for arm64
+source_file=/etc/apt/sources.list
+sed -i -e 's/^deb \([^/[]\)/deb [arch=amd64] \1/g' "${source_file}"
+sed -i -e 's/^deb-src /# deb-src /g' "${source_file}"
+
+sub_source_file=/etc/apt/sources.list.d/yardstick.list
+touch "${sub_source_file}"
+echo -e "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ trusty main universe multiverse restricted
+deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main universe multiverse restricted
+deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ trusty-security main universe multiverse restricted
+deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ trusty-proposed main universe multiverse restricted" > "${sub_source_file}"
+echo "vm.mmap_min_addr = 0" > /etc/sysctl.d/mmap_min_addr.conf
+dpkg --add-architecture arm64
+apt-get install -y qemu-user-static libc6:arm64
+
+# install yardstick + dependencies
+easy_install -U pip
+pip install -r requirements.txt
+pip install .
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 000000000..ab20c7541
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,83 @@
+##############################################################################
+# Copyright (c) 2015 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
+##############################################################################
+
+appdirs==1.4.0
+Babel==2.2.0
+backport-ipaddress==0.1
+cliff==2.0.0
+cmd2==0.6.8
+coverage==4.1b2
+debtcollector==1.3.0
+ecdsa==0.13
+extras==0.0.3
+fixtures==1.4.0
+flake8==2.5.4
+funcsigs==0.4
+functools32==3.2.3.post2
+futures==3.0.5
+iso8601==0.1.11
+Jinja2==2.8
+jsonpatch==1.13
+jsonpointer==1.10
+jsonschema==2.5.1
+keystoneauth1==2.3.0
+linecache2==1.0.0
+lxml==3.5.0
+MarkupSafe==0.23
+mccabe==0.4.0
+mock==1.3.0
+monotonic==1.0
+msgpack-python==0.4.7
+netaddr==0.7.18
+netifaces==0.10.4
+nose==1.3.7
+openstacksdk==0.8.1
+os-client-config==1.16.0
+oslo.config==3.9.0
+oslo.i18n==3.4.0
+oslo.serialization==2.4.0
+oslo.utils==3.7.0
+paramiko==1.16.0
+pbr==1.8.1
+pep8==1.7.0
+positional==1.0.1
+prettytable==0.7.2
+pycrypto==2.6.1
+pyflakes==1.0.0
+pyparsing==2.1.0
+pyrsistent==0.11.12
+python-cinderclient==1.6.0
+python-glanceclient==2.0.0
+python-heatclient==1.0.0
+python-keystoneclient==2.3.1
+python-mimeparse==1.5.1
+python-neutronclient==4.1.1
+python-novaclient==3.3.0
+python-openstackclient==2.2.0
+python-subunit==1.2.0
+python-swiftclient==3.0.0
+pytz==2015.7
+PyYAML==3.11
+requests==2.9.1
+requestsexceptions==1.1.3
+scp==0.10.2
+simplejson==3.8.2
+six==1.10.0
+stevedore==1.12.0
+testrepository==0.0.20
+testtools==2.0.0
+traceback2==1.4.0
+unicodecsv==0.14.1
+unittest2==1.1.0
+warlock==1.2.0
+wrapt==1.10.6
+flask==0.11.1
+flask-restful==0.3.5
+influxdb==3.0.0
+pyroute2==0.4.10
diff --git a/samples/background-task.yaml b/samples/background-task.yaml
index a844c2d7f..11cfdd567 100644
--- a/samples/background-task.yaml
+++ b/samples/background-task.yaml
@@ -39,7 +39,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/samples/cachestat.yaml b/samples/cachestat.yaml
index 5786efa38..d736793e3 100644
--- a/samples/cachestat.yaml
+++ b/samples/cachestat.yaml
@@ -18,7 +18,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/samples/cyclictest.yaml b/samples/cyclictest.yaml
index cb85decb1..eaf74893e 100644
--- a/samples/cyclictest.yaml
+++ b/samples/cyclictest.yaml
@@ -33,7 +33,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
servers:
diff --git a/samples/fio-template.yaml b/samples/fio-template.yaml
index ba710d95f..00c35ce23 100644
--- a/samples/fio-template.yaml
+++ b/samples/fio-template.yaml
@@ -28,7 +28,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
servers:
diff --git a/samples/fio.yaml b/samples/fio.yaml
index e1f5e6d2d..5ccbc1954 100644
--- a/samples/fio.yaml
+++ b/samples/fio.yaml
@@ -37,7 +37,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
servers:
diff --git a/samples/iperf3-jitter.yaml b/samples/iperf3-jitter.yaml
index c211571d0..366a57152 100644
--- a/samples/iperf3-jitter.yaml
+++ b/samples/iperf3-jitter.yaml
@@ -23,7 +23,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/samples/iperf3.yaml b/samples/iperf3.yaml
index 72f260942..6741c767e 100644
--- a/samples/iperf3.yaml
+++ b/samples/iperf3.yaml
@@ -21,7 +21,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/samples/lmbench.yaml b/samples/lmbench.yaml
index 311770c42..595a393b7 100644
--- a/samples/lmbench.yaml
+++ b/samples/lmbench.yaml
@@ -48,7 +48,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/samples/lmbench_cache.yaml b/samples/lmbench_cache.yaml
index 7a22cf15f..bf5086b3c 100644
--- a/samples/lmbench_cache.yaml
+++ b/samples/lmbench_cache.yaml
@@ -26,7 +26,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/samples/memload.yaml b/samples/memload.yaml
index 87d727707..5e988986a 100644
--- a/samples/memload.yaml
+++ b/samples/memload.yaml
@@ -20,7 +20,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/samples/netperf.yaml b/samples/netperf.yaml
index 4d7f7a798..0dd56348b 100755
--- a/samples/netperf.yaml
+++ b/samples/netperf.yaml
@@ -46,7 +46,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/samples/netperf_bottlenecks.yaml b/samples/netperf_bottlenecks.yaml
new file mode 100644
index 000000000..4b6348109
--- /dev/null
+++ b/samples/netperf_bottlenecks.yaml
@@ -0,0 +1,43 @@
+---
+# measure network latency and throughput using netperf
+# This test case is suite for bottlenecks project.
+# This test case is from TC073
+# we have did some parameters support
+
+schema: "yardstick:task:0.1"
+
+{% set host = host or "node1.LF" %}
+{% set target = target or "node2.LF" %}
+{% set pod_info = pod_info or "etc/yardstick/nodes/compass_sclab_virtual/pod.yaml" %}
+{% set tx_msg_size = tx_msg_size or "65536" %}
+{% set rx_msg_size = rx_msg_size or "87380" %}
+{% set test_time = test_time or "20" %}
+{% set out_opt = out_opt or "THROUGHPUT,THROUGHPUT_UNITS,MEAN_LATENCY,LOCAL_CPU_UTIL,REMOTE_CPU_UTIL,LOCAL_TRANSPORT_RETRANS" %}
+
+scenarios:
+-
+ type: NetperfNode
+ options:
+ testname: 'TCP_STREAM'
+ send_msg_size: {{tx_msg_size}}
+ recv_msg_size: {{rx_msg_size}}
+ duration: {{test_time}}
+ output_opt: {{out_opt}}
+
+ host: {{host}}
+ target: {{target}}
+
+ runner:
+ type: Iteration
+ iterations: 1
+ interval: 1
+ run_step: 'setup,run'
+
+ sla:
+ mean_latency: 100
+ action: monitor
+
+context:
+ type: Node
+ name: LF
+ file: {{pod_info}}
diff --git a/samples/netutilization.yaml b/samples/netutilization.yaml
index 598a5af15..794342d29 100644
--- a/samples/netutilization.yaml
+++ b/samples/netutilization.yaml
@@ -19,7 +19,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/samples/perf.yaml b/samples/perf.yaml
index 541f846e7..b8979b511 100644
--- a/samples/perf.yaml
+++ b/samples/perf.yaml
@@ -30,7 +30,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/samples/pktgen.yaml b/samples/pktgen.yaml
index ddafb27bd..6acb8ab92 100644
--- a/samples/pktgen.yaml
+++ b/samples/pktgen.yaml
@@ -38,7 +38,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/samples/ramspeed.yaml b/samples/ramspeed.yaml
index 7e1b1aa8c..e754fc9fa 100644
--- a/samples/ramspeed.yaml
+++ b/samples/ramspeed.yaml
@@ -25,7 +25,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/samples/unixbench.yaml b/samples/unixbench.yaml
index 825fd767f..b7ab88190 100644
--- a/samples/unixbench.yaml
+++ b/samples/unixbench.yaml
@@ -21,7 +21,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/setup.py b/setup.py
index 4fe2596c8..6a89d6368 100755
--- a/setup.py
+++ b/setup.py
@@ -32,28 +32,6 @@ setup(
]
},
url="https://www.opnfv.org",
- install_requires=["backport_ipaddress", # remove with python3
- "coverage>=3.6",
- "flake8",
- "Jinja2>=2.6",
- "lxml",
- "PyYAML>=3.10",
- "pbr<2.0,>=1.3",
- "python-openstackclient>=2.1.0",
- "python-glanceclient>=0.12.0",
- "python-heatclient>=0.2.12",
- "python-keystoneclient>=0.11.1",
- "python-neutronclient>=2.3.9",
- "python-novaclient>=2.24.1",
- "mock>=1.0.1", # remove with python3
- "paramiko",
- "netifaces",
- "scp",
- "six",
- "testrepository>=0.0.18",
- "testtools>=1.4.0",
- "nose"
- ],
extras_require={
'plot': ["matplotlib>=1.4.2"]
},
@@ -63,8 +41,9 @@ setup(
'yardstick-plot=yardstick.plot.plotter:main [plot]'
],
},
- scripts=['tools/yardstick-img-modify',
- 'tools/yardstick-img-lxd-modify',
- 'tools/yardstick-img-dpdk-modify'
- ]
+ scripts=[
+ 'tools/yardstick-img-modify',
+ 'tools/yardstick-img-lxd-modify',
+ 'tools/yardstick-img-dpdk-modify'
+ ]
)
diff --git a/tests/ci/clean_images.sh b/tests/ci/clean_images.sh
index 05f68a7ed..b1942160b 100755
--- a/tests/ci/clean_images.sh
+++ b/tests/ci/clean_images.sh
@@ -19,7 +19,7 @@ cleanup()
return
fi
- for image in $(glance image-list | grep -e cirros-0.3.3 -e yardstick-trusty-server -e Ubuntu-14.04 \
+ for image in $(glance image-list | grep -e cirros-0.3.3 -e yardstick-image -e Ubuntu-14.04 \
-e yardstick-vivid-kernel | awk '{print $2}'); do
echo "Deleting image $image..."
glance image-delete $image || true
diff --git a/tests/ci/load_images.sh b/tests/ci/load_images.sh
index 49b972777..54a145fd3 100755
--- a/tests/ci/load_images.sh
+++ b/tests/ci/load_images.sh
@@ -90,14 +90,14 @@ load_yardstick_image()
if [[ "$DEPLOY_SCENARIO" == *"-lxd-"* ]]; then
output=$(eval glance --os-image-api-version 1 image-create \
- --name yardstick-trusty-server \
+ --name yardstick-image \
--is-public true --disk-format root-tar \
--container-format bare \
$EXTRA_PARAMS \
--file $RAW_IMAGE)
else
output=$(eval glance --os-image-api-version 1 image-create \
- --name yardstick-trusty-server \
+ --name yardstick-image \
--is-public true --disk-format qcow2 \
--container-format bare \
$EXTRA_PARAMS \
@@ -203,8 +203,8 @@ create_nova_flavor()
main()
{
- QCOW_IMAGE="/tmp/workspace/yardstick/yardstick-trusty-server.img"
- RAW_IMAGE="/tmp/workspace/yardstick/yardstick-trusty-server.tar.gz"
+ QCOW_IMAGE="/tmp/workspace/yardstick/yardstick-image.img"
+ RAW_IMAGE="/tmp/workspace/yardstick/yardstick-image.tar.gz"
build_yardstick_image
load_yardstick_image
diff --git a/tests/ci/yardstick-verify b/tests/ci/yardstick-verify
index 2b7ec9d34..1a6682f85 100755
--- a/tests/ci/yardstick-verify
+++ b/tests/ci/yardstick-verify
@@ -160,7 +160,7 @@ run_test()
mkdir -p /etc/yardstick
- cat << EOF >> /etc/yardstick/yardstick.conf
+ cat << EOF > /etc/yardstick/yardstick.conf
[DEFAULT]
debug = True
dispatcher = ${DISPATCHER_TYPE}
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc001.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc001.yaml
index 899ee963c..aa2980f69 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc001.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc001.yaml
@@ -31,7 +31,7 @@ scenarios:
context:
name: yardstick
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc005.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc005.yaml
index 6e50157fc..732d73af7 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc005.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc005.yaml
@@ -35,7 +35,7 @@ scenarios:
context:
name: yardstick-TC005
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: m1.small
user: ubuntu
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml
index 1cec80ff6..a2f5f3adc 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml
@@ -37,7 +37,7 @@ scenarios:
context:
name: yardstick-TC008
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc009.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc009.yaml
index 82a55d751..f9fa1b778 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc009.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc009.yaml
@@ -32,7 +32,7 @@ scenarios:
context:
name: yardstick-TC009
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc010.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc010.yaml
index aeb18543e..f64968cb1 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc010.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc010.yaml
@@ -25,7 +25,7 @@ scenarios:
context:
name: yardstick-TC010
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: m1.small
user: ubuntu
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc011.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc011.yaml
index 5d21e2814..4cd3119bb 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc011.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc011.yaml
@@ -23,7 +23,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc012.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc012.yaml
index 3bdb8cb9a..a86943a51 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc012.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc012.yaml
@@ -26,7 +26,7 @@ scenarios:
context:
name: demo
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: m1.small
user: ubuntu
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc014.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc014.yaml
index 648657f22..1ac0f2961 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc014.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc014.yaml
@@ -19,7 +19,7 @@ scenarios:
context:
name: yardstick-TC014
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
@@ -29,4 +29,4 @@ context:
networks:
test:
- cidr: '10.0.1.0/24' \ No newline at end of file
+ cidr: '10.0.1.0/24'
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml
index 5e2177a6e..cd42098d2 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc037.yaml
@@ -64,7 +64,7 @@ scenarios:
context:
name: yardstick-TC037
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc038.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc038.yaml
index 128f94045..c2e5b4028 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc038.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc038.yaml
@@ -64,7 +64,7 @@ scenarios:
context:
name: yardstick-TC038
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc069.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc069.yaml
index 637e160c6..dcc34d80d 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc069.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc069.yaml
@@ -25,7 +25,7 @@ scenarios:
context:
name: yardstick-TC069
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc070.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc070.yaml
index 28b28b9ab..931587b5b 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc070.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc070.yaml
@@ -66,7 +66,7 @@ scenarios:
context:
name: yardstick-TC070
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc071.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc071.yaml
index 644010916..6f006eeaf 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc071.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc071.yaml
@@ -64,7 +64,7 @@ scenarios:
context:
name: yardstick-TC071
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc072.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc072.yaml
index f3e6d4c40..e1fa33173 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc072.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc072.yaml
@@ -66,7 +66,7 @@ scenarios:
context:
name: yardstick-TC072
- image: yardstick-trusty-server
+ image: yardstick-image
flavor: yardstick-flavor
user: ubuntu
diff --git a/tests/opnfv/test_suites/opnfv_os-odl_l2-fdio-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl_l2-fdio-ha_daily.yaml
new file mode 100644
index 000000000..2d7397a96
--- /dev/null
+++ b/tests/opnfv/test_suites/opnfv_os-odl_l2-fdio-ha_daily.yaml
@@ -0,0 +1,30 @@
+---
+# os-odl_l2-fdio-ha daily task suite
+
+schema: "yardstick:suite:0.1"
+
+name: "os-odl_l2-fdio-ha"
+test_cases_dir: "tests/opnfv/test_cases/"
+test_cases:
+-
+ file_name: opnfv_yardstick_tc002.yaml
+-
+ file_name: opnfv_yardstick_tc005.yaml
+-
+ file_name: opnfv_yardstick_tc010.yaml
+-
+ file_name: opnfv_yardstick_tc011.yaml
+-
+ file_name: opnfv_yardstick_tc012.yaml
+-
+ file_name: opnfv_yardstick_tc014.yaml
+-
+ file_name: opnfv_yardstick_tc037.yaml
+-
+ file_name: opnfv_yardstick_tc069.yaml
+-
+ file_name: opnfv_yardstick_tc070.yaml
+-
+ file_name: opnfv_yardstick_tc071.yaml
+-
+ file_name: opnfv_yardstick_tc072.yaml
diff --git a/tests/unit/api/actions/test_result.py b/tests/unit/api/actions/test_result.py
new file mode 100644
index 000000000..168631905
--- /dev/null
+++ b/tests/unit/api/actions/test_result.py
@@ -0,0 +1,29 @@
+##############################################################################
+# 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
+##############################################################################
+import unittest
+import json
+
+from api.actions import result
+
+
+class GetResultTestCase(unittest.TestCase):
+
+ def test_getResult_with_no_taskid_arg(self):
+ args = {}
+ output = json.loads(result.getResult(args))
+
+ self.assertEqual('error', output['status'])
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/api/actions/test_test.py b/tests/unit/api/actions/test_test.py
new file mode 100644
index 000000000..7ebe9fc24
--- /dev/null
+++ b/tests/unit/api/actions/test_test.py
@@ -0,0 +1,29 @@
+##############################################################################
+# 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
+##############################################################################
+import unittest
+import json
+
+from api.actions import test
+
+
+class RunTestCase(unittest.TestCase):
+
+ def test_runTestCase_with_no_testcase_arg(self):
+ args = {}
+ output = json.loads(test.runTestCase(args))
+
+ self.assertEqual('error', output['status'])
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/api/test_views.py b/tests/unit/api/test_views.py
new file mode 100644
index 000000000..e57ec08a4
--- /dev/null
+++ b/tests/unit/api/test_views.py
@@ -0,0 +1,45 @@
+##############################################################################
+# 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
+##############################################################################
+import unittest
+import mock
+import json
+
+from api.views import Test
+from api.views import Result
+
+
+class TestTestCase(unittest.TestCase):
+
+ @mock.patch('api.views.request')
+ def test_post(self, mock_request):
+ mock_request.json.get.side_effect = ['hello', {}]
+
+ result = json.loads(Test().post())
+
+ self.assertEqual('error', result['status'])
+
+
+class ResultTestCase(unittest.TestCase):
+
+ @mock.patch('api.views.request')
+ def test_get(self, mock_request):
+ mock_request.args.get.return_value = 'hello'
+
+ print Result().get()
+ result = json.loads(Result().get())
+
+ self.assertEqual('error', result['status'])
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/api/utils/test_common.py b/tests/unit/api/utils/test_common.py
new file mode 100644
index 000000000..9e050c714
--- /dev/null
+++ b/tests/unit/api/utils/test_common.py
@@ -0,0 +1,95 @@
+##############################################################################
+# 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
+##############################################################################
+import unittest
+import json
+
+from api.utils import common
+
+
+class TranslateToStrTestCase(unittest.TestCase):
+
+ def test_translate_to_str_unicode(self):
+ input_str = u'hello'
+ output_str = common.translate_to_str(input_str)
+
+ result = 'hello'
+ self.assertEqual(result, output_str)
+
+ def test_translate_to_str_dict_list_unicode(self):
+ input_str = {
+ u'hello': {u'hello': [u'world']}
+ }
+ output_str = common.translate_to_str(input_str)
+
+ result = {
+ 'hello': {'hello': ['world']}
+ }
+ self.assertEqual(result, output_str)
+
+
+class GetCommandListTestCase(unittest.TestCase):
+
+ def test_get_command_list_no_opts(self):
+ command_list = ['a']
+ opts = {}
+ args = 'b'
+ output_list = common.get_command_list(command_list, opts, args)
+
+ result_list = ['a', 'b']
+ self.assertEqual(result_list, output_list)
+
+ def test_get_command_list_with_opts_args(self):
+ command_list = ['a']
+ opts = {
+ 'b': 'c',
+ 'task-args': 'd'
+ }
+ args = 'e'
+
+ output_list = common.get_command_list(command_list, opts, args)
+
+ result_list = ['a', 'e', '--b', '--task-args', 'd']
+ self.assertEqual(result_list, output_list)
+
+
+class ErrorHandlerTestCase(unittest.TestCase):
+
+ def test_error_handler(self):
+ message = 'hello world'
+ output_dict = json.loads(common.error_handler(message))
+
+ result = {
+ 'status': 'error',
+ 'message': message
+ }
+
+ self.assertEqual(result, output_dict)
+
+
+class ResultHandlerTestCase(unittest.TestCase):
+
+ def test_result_handler(self):
+ status = 1
+ data = ['hello world']
+ output_dict = json.loads(common.result_handler(status, data))
+
+ result = {
+ 'status': status,
+ 'result': data
+ }
+
+ self.assertEqual(result, output_dict)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/api/utils/test_daemonthread.py b/tests/unit/api/utils/test_daemonthread.py
new file mode 100644
index 000000000..f07f0fede
--- /dev/null
+++ b/tests/unit/api/utils/test_daemonthread.py
@@ -0,0 +1,37 @@
+##############################################################################
+# 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
+##############################################################################
+import unittest
+import mock
+
+from api.utils.daemonthread import DaemonThread
+
+
+class DaemonThreadTestCase(unittest.TestCase):
+
+ @mock.patch('api.utils.daemonthread.os')
+ def test_run(self, mock_os):
+ def func(common_list, task_id):
+ return task_id
+
+ common_list = []
+ task_id = '1234'
+ thread = DaemonThread(func, (common_list, task_id))
+ thread.run()
+
+ mock_os.path.exist.return_value = True
+ pre_path = '../tests/opnfv/test_suites/'
+ mock_os.remove.assert_called_with(pre_path + '1234.yaml')
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/api/utils/test_influx.py b/tests/unit/api/utils/test_influx.py
new file mode 100644
index 000000000..0852da2dd
--- /dev/null
+++ b/tests/unit/api/utils/test_influx.py
@@ -0,0 +1,82 @@
+##############################################################################
+# 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
+##############################################################################
+import unittest
+import mock
+import uuid
+import datetime
+
+from api.utils import influx
+
+
+class GetDataDbClientTestCase(unittest.TestCase):
+
+ @mock.patch('api.utils.influx.ConfigParser')
+ def test_get_data_db_client_dispatcher_not_influxdb(self, mock_parser):
+ mock_parser.ConfigParser().get.return_value = 'file'
+ try:
+ influx.get_data_db_client()
+ except Exception as e:
+ self.assertIsInstance(e, RuntimeError)
+
+
+class GetIpTestCase(unittest.TestCase):
+
+ def test_get_url(self):
+ url = 'http://localhost:8086/hello'
+ output = influx._get_ip(url)
+
+ result = 'localhost'
+ self.assertEqual(result, output)
+
+
+class WriteDataTestCase(unittest.TestCase):
+
+ @mock.patch('api.utils.influx.get_data_db_client')
+ def test_write_data(self, mock_get_client):
+ measurement = 'tasklist'
+ field = {'status': 1}
+ timestamp = datetime.datetime.now()
+ tags = {'task_id': str(uuid.uuid4())}
+
+ influx._write_data(measurement, field, timestamp, tags)
+ mock_get_client.assert_called_with()
+
+
+class WriteDataTasklistTestCase(unittest.TestCase):
+
+ @mock.patch('api.utils.influx._write_data')
+ def test_write_data_tasklist(self, mock_write_data):
+ task_id = str(uuid.uuid4())
+ timestamp = datetime.datetime.now()
+ status = 1
+ influx.write_data_tasklist(task_id, timestamp, status)
+
+ field = {'status': status, 'error': ''}
+ tags = {'task_id': task_id}
+ mock_write_data.assert_called_with('tasklist', field, timestamp, tags)
+
+
+class QueryTestCase(unittest.TestCase):
+
+ @mock.patch('api.utils.influx.ConfigParser')
+ def test_query_dispatcher_not_influxdb(self, mock_parser):
+ mock_parser.ConfigParser().get.return_value = 'file'
+ try:
+ sql = 'select * form tasklist'
+ influx.query(sql)
+ except Exception as e:
+ self.assertIsInstance(e, RuntimeError)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/networking/test_networkcapacity.py b/tests/unit/benchmark/scenarios/networking/test_networkcapacity.py
index e3a096446..e42832f1b 100644
--- a/tests/unit/benchmark/scenarios/networking/test_networkcapacity.py
+++ b/tests/unit/benchmark/scenarios/networking/test_networkcapacity.py
@@ -1,56 +1,56 @@
-#!/usr/bin/env python
-
-##############################################################################
-# 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
-##############################################################################
-
-# Unittest for yardstick.benchmark.scenarios.networking.networkcapacity.NetworkCapacity
-
-import mock
-import unittest
-import os
-import json
-
-from yardstick.benchmark.scenarios.networking import networkcapacity
-
-SAMPLE_OUTPUT = '{"Number of connections":"308","Number of frames received": "166503"}'
-
-@mock.patch('yardstick.benchmark.scenarios.networking.networkcapacity.ssh')
-class NetworkCapacityTestCase(unittest.TestCase):
-
- def setUp(self):
- self.ctx = {
- 'host': {
- 'ip': '172.16.0.137',
- 'user': 'cirros',
- 'password': "root"
- },
- }
-
- self.result = {}
-
- def test_capacity_successful_setup(self, mock_ssh):
- c = networkcapacity.NetworkCapacity({}, self.ctx)
- mock_ssh.SSH().execute.return_value = (0, '', '')
- c.setup()
- self.assertIsNotNone(c.client)
- self.assertTrue(c.setup_done)
-
- def test_capacity_successful(self, mock_ssh):
- c = networkcapacity.NetworkCapacity({}, self.ctx)
-
- mock_ssh.SSH().execute.return_value = (0, SAMPLE_OUTPUT, '')
- c.run(self.result)
- expected_result = json.loads(SAMPLE_OUTPUT)
- self.assertEqual(self.result, expected_result)
-
- def test_capacity_unsuccessful_script_error(self, mock_ssh):
- c = networkcapacity.NetworkCapacity({}, self.ctx)
-
- mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
- self.assertRaises(RuntimeError, c.run, self.result)
+#!/usr/bin/env python
+
+##############################################################################
+# 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
+##############################################################################
+
+# Unittest for yardstick.benchmark.scenarios.networking.networkcapacity.NetworkCapacity
+
+import mock
+import unittest
+import os
+import json
+
+from yardstick.benchmark.scenarios.networking import networkcapacity
+
+SAMPLE_OUTPUT = '{"Number of connections":"308","Number of frames received": "166503"}'
+
+@mock.patch('yardstick.benchmark.scenarios.networking.networkcapacity.ssh')
+class NetworkCapacityTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.ctx = {
+ 'host': {
+ 'ip': '172.16.0.137',
+ 'user': 'cirros',
+ 'password': "root"
+ },
+ }
+
+ self.result = {}
+
+ def test_capacity_successful_setup(self, mock_ssh):
+ c = networkcapacity.NetworkCapacity({}, self.ctx)
+ mock_ssh.SSH().execute.return_value = (0, '', '')
+ c.setup()
+ self.assertIsNotNone(c.client)
+ self.assertTrue(c.setup_done)
+
+ def test_capacity_successful(self, mock_ssh):
+ c = networkcapacity.NetworkCapacity({}, self.ctx)
+
+ mock_ssh.SSH().execute.return_value = (0, SAMPLE_OUTPUT, '')
+ c.run(self.result)
+ expected_result = json.loads(SAMPLE_OUTPUT)
+ self.assertEqual(self.result, expected_result)
+
+ def test_capacity_unsuccessful_script_error(self, mock_ssh):
+ c = networkcapacity.NetworkCapacity({}, self.ctx)
+
+ mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
+ self.assertRaises(RuntimeError, c.run, self.result)
diff --git a/tests/unit/benchmark/scenarios/networking/test_ping6.py b/tests/unit/benchmark/scenarios/networking/test_ping6.py
index 995113e28..0b8fba268 100644
--- a/tests/unit/benchmark/scenarios/networking/test_ping6.py
+++ b/tests/unit/benchmark/scenarios/networking/test_ping6.py
@@ -25,12 +25,29 @@ class PingTestCase(unittest.TestCase):
'host1': {
'ip': '172.16.0.137',
'user': 'cirros',
+ 'role': "Controller",
'key_filename': "mykey.key",
'password': "root"
},
+ 'host2': {
+ "ip": "172.16.0.138",
+ "key_filename": "/root/.ssh/id_rsa",
+ "role": "Compute",
+ "name": "node3.IPV6",
+ "user": "root"
+ },
}
}
+ def test_get_controller_node(self):
+ args = {
+ 'options': {'host': 'host1','packetsize': 200, 'ping_count': 5},
+ 'sla': {'max_rtt': 50}
+ }
+ p = ping6.Ping6(args, self.ctx)
+ controller_node = p._get_controller_node(['host1','host2'])
+ self.assertEqual(controller_node, 'host1')
+
@mock.patch('yardstick.benchmark.scenarios.networking.ping6.ssh')
def test_ping_successful_setup(self, mock_ssh):
args = {
diff --git a/tests/unit/common/config_sample.yaml b/tests/unit/common/config_sample.yaml
new file mode 100644
index 000000000..8caa19ec6
--- /dev/null
+++ b/tests/unit/common/config_sample.yaml
@@ -0,0 +1,2 @@
+releng:
+ dir: /home/opnfv/repos/releng
diff --git a/tests/unit/common/test_utils.py b/tests/unit/common/test_utils.py
index 002d0494c..a64c1f1ab 100644
--- a/tests/unit/common/test_utils.py
+++ b/tests/unit/common/test_utils.py
@@ -83,6 +83,33 @@ class ImportModulesFromPackageTestCase(unittest.TestCase):
mock_importutils.import_module.assert_called_with('bar.baz')
+class GetParaFromYaml(unittest.TestCase):
+
+ def test_get_para_from_yaml_file_not_exist(self):
+ file_path = '/etc/yardstick/hello.yaml'
+ args = 'hello.world'
+ para = utils.get_para_from_yaml(file_path, args)
+ self.assertIsNone(para)
+
+ def test_get_para_from_yaml_para_not_found(self):
+ file_path = 'config_sample.yaml'
+ file_path = self._get_file_abspath(file_path)
+ args = 'releng.file'
+ self.assertIsNone(utils.get_para_from_yaml(file_path, args))
+
+ def test_get_para_from_yaml_para_exists(self):
+ file_path = 'config_sample.yaml'
+ file_path = self._get_file_abspath(file_path)
+ args = 'releng.dir'
+ para = '/home/opnfv/repos/releng'
+ self.assertEqual(para, utils.get_para_from_yaml(file_path, args))
+
+ def _get_file_abspath(self, filename):
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ file_path = os.path.join(curr_path, filename)
+ return file_path
+
+
def main():
unittest.main()
diff --git a/tools/yardstick-img-lxd-modify b/tools/yardstick-img-lxd-modify
index 31194554c..4ca4eb489 100755
--- a/tools/yardstick-img-lxd-modify
+++ b/tools/yardstick-img-lxd-modify
@@ -32,21 +32,22 @@ die() {
exit 1
}
-test $# -eq 1 || die "no image specific script as argument"
+test $# -eq 1 -o $# -eq 2 || die "no image specific script as argument"
test $(id -u) -eq 0 || die "should invoke using sudo"
cmd=$1
+RELEASE=$2
test -x $cmd
mountdir="/mnt/yardstick"
workspace=${WORKSPACE:-"/tmp/workspace/yardstick"}
host=${HOST:-"cloud-images.ubuntu.com"}
-release=${RELEASE:-"trusty"}
+release=${RELEASE:-"xenial"}
image_path="${release}/current/${release}-server-cloudimg-amd64-root.tar.gz"
image_url=${IMAGE_URL:-"https://${host}/${image_path}"}
md5sums_path="${release}/current/MD5SUMS"
md5sums_url=${MD5SUMS_URL:-"https://${host}/${md5sums_path}"}
-imgfile="${workspace}/yardstick-${release}-server.tar.gz"
+imgfile="${workspace}/yardstick-image.tar.gz"
filename=$(basename $image_url)
# download and checksum base image, conditionally if local copy is outdated
diff --git a/tools/yardstick-img-modify b/tools/yardstick-img-modify
index 07f10b3ce..c28e2ad59 100755
--- a/tools/yardstick-img-modify
+++ b/tools/yardstick-img-modify
@@ -32,21 +32,22 @@ die() {
exit 1
}
-test $# -eq 1 || die "no image specific script as argument"
+test $# -eq 1 -o $# -eq 2 || die "no image specific script as argument"
test $(id -u) -eq 0 || die "should invoke using sudo"
cmd=$1
+RELEASE=$2
test -x $cmd
mountdir="/mnt/yardstick"
workspace=${WORKSPACE:-"/tmp/workspace/yardstick"}
host=${HOST:-"cloud-images.ubuntu.com"}
-release=${RELEASE:-"trusty"}
+release=${RELEASE:-"xenial"}
image_path="${release}/current/${release}-server-cloudimg-${YARD_IMG_ARCH}-disk1.img"
image_url=${IMAGE_URL:-"https://${host}/${image_path}"}
md5sums_path="${release}/current/MD5SUMS"
md5sums_url=${MD5SUMS_URL:-"https://${host}/${md5sums_path}"}
-imgfile="${workspace}/yardstick-${release}-server.img"
+imgfile="${workspace}/yardstick-image.img"
raw_imgfile="${workspace}/yardstick-${release}-server.raw"
filename=$(basename $image_url)
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py
index b35869d07..6561f6b65 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py
@@ -31,7 +31,6 @@ def _execute_shell_command(command, stdin=None):
class BaremetalAttacker(BaseAttacker):
-
__attacker_type__ = 'bare-metal-down'
def setup(self):
@@ -39,9 +38,11 @@ class BaremetalAttacker(BaseAttacker):
host = self._context.get(self._config['host'], None)
ip = host.get("ip", None)
user = host.get("user", "root")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
key_filename = host.get("key_filename", "~/.ssh/id_rsa")
- self.connection = ssh.SSH(user, ip, key_filename=key_filename)
+ self.connection = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.connection.wait(timeout=600)
LOG.debug("ssh host success!")
self.host_ip = ip
@@ -87,10 +88,12 @@ class BaremetalAttacker(BaseAttacker):
host = self._context.get(jump_host_name, None)
ip = host.get("ip", None)
user = host.get("user", "root")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
pwd = host.get("pwd", None)
LOG.debug("jump_host ip:%s user:%s" % (ip, user))
- self.jump_connection = ssh.SSH(user, ip, password=pwd)
+ self.jump_connection = ssh.SSH(user, ip, password=pwd,
+ port=ssh_port)
self.jump_connection.wait(timeout=600)
LOG.debug("ssh jump host success!")
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
index 816e7e37d..5e7716e49 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
@@ -24,9 +24,11 @@ class GeneralAttacker(BaseAttacker):
host = self._context.get(self._config['host'], None)
ip = host.get("ip", None)
user = host.get("user", "root")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
key_filename = host.get("key_filename", "~/.ssh/id_rsa")
- self.connection = ssh.SSH(user, ip, key_filename=key_filename)
+ self.connection = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.connection.wait(timeout=600)
LOG.debug("ssh host success!")
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py
index 5118ad628..0a844f56c 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py
@@ -23,9 +23,11 @@ class ProcessAttacker(BaseAttacker):
host = self._context.get(self._config['host'], None)
ip = host.get("ip", None)
user = host.get("user", "root")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
key_filename = host.get("key_filename", "~/.ssh/id_rsa")
- self.connection = ssh.SSH(user, ip, key_filename=key_filename)
+ self.connection = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.connection.wait(timeout=600)
LOG.debug("ssh host success!")
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py
index c285024e1..b55cc3134 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py
@@ -42,9 +42,11 @@ class MonitorOpenstackCmd(basemonitor.BaseMonitor):
host = self._context[node_name]
ip = host.get("ip", None)
user = host.get("user", "root")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
key_filename = host.get("key_filename", "~/.ssh/id_rsa")
- self.connection = ssh.SSH(user, ip, key_filename=key_filename)
+ self.connection = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.connection.wait(timeout=600)
LOG.debug("ssh host success!")
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
index 61efc0520..f9ddb2505 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
@@ -25,6 +25,7 @@ class GeneralMonitor(basemonitor.BaseMonitor):
host = self._context[self._config["host"]]
ip = host.get("ip", None)
user = host.get("user", "root")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
key_filename = host.get("key_filename", "~/.ssh/id_rsa")
self.key = self._config["key"]
self.monitor_key = self._config["monitor_key"]
@@ -40,7 +41,8 @@ class GeneralMonitor(basemonitor.BaseMonitor):
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)
+ self.connection = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.connection.wait(timeout=600)
LOG.debug("ssh host success!")
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py
index 53a6d8e4d..403ec4d37 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py
@@ -23,9 +23,11 @@ class MonitorProcess(basemonitor.BaseMonitor):
host = self._context[self._config["host"]]
ip = host.get("ip", None)
user = host.get("user", "root")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
key_filename = host.get("key_filename", "~/.ssh/id_rsa")
- self.connection = ssh.SSH(user, ip, key_filename=key_filename)
+ self.connection = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.connection.wait(timeout=600)
LOG.debug("ssh host success!")
self.check_script = self.get_script_fullpath(
diff --git a/yardstick/benchmark/scenarios/availability/operation/operation_general.py b/yardstick/benchmark/scenarios/availability/operation/operation_general.py
index e43f6e1d5..aa28472f7 100644
--- a/yardstick/benchmark/scenarios/availability/operation/operation_general.py
+++ b/yardstick/benchmark/scenarios/availability/operation/operation_general.py
@@ -23,9 +23,11 @@ class GeneralOperaion(BaseOperation):
host = self._context.get(self._config['host'], None)
ip = host.get("ip", None)
user = host.get("user", "root")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
key_filename = host.get("key_filename", "~/.ssh/id_rsa")
- self.connection = ssh.SSH(user, ip, key_filename=key_filename)
+ self.connection = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.connection.wait(timeout=600)
LOG.debug("ssh host success!")
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 681fbf63f..ae896c2b2 100644
--- a/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py
+++ b/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py
@@ -17,7 +17,6 @@ LOG = logging.getLogger(__name__)
class GeneralResultChecker(BaseResultChecker):
-
__result_checker__type__ = "general-result-checker"
def setup(self):
@@ -25,9 +24,11 @@ class GeneralResultChecker(BaseResultChecker):
host = self._context.get(self._config['host'], None)
ip = host.get("ip", None)
user = host.get("user", "root")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
key_filename = host.get("key_filename", "~/.ssh/id_rsa")
- self.connection = ssh.SSH(user, ip, key_filename=key_filename)
+ self.connection = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.connection.wait(timeout=600)
LOG.debug("ssh host success!")
diff --git a/yardstick/benchmark/scenarios/compute/cachestat.py b/yardstick/benchmark/scenarios/compute/cachestat.py
index da4aa754f..117702098 100644
--- a/yardstick/benchmark/scenarios/compute/cachestat.py
+++ b/yardstick/benchmark/scenarios/compute/cachestat.py
@@ -75,11 +75,13 @@ class CACHEstat(base.Scenario):
host = self.context_cfg['host']
user = host.get('user', 'ubuntu')
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
ip = host.get('ip', None)
key_filename = host.get('key_filename', '~/.ssh/id_rsa')
LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename)
+ self.client = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.client.wait(timeout=600)
# copy scripts to host
diff --git a/yardstick/benchmark/scenarios/compute/computecapacity.py b/yardstick/benchmark/scenarios/compute/computecapacity.py
index 0d7d76143..9d7a923b1 100644
--- a/yardstick/benchmark/scenarios/compute/computecapacity.py
+++ b/yardstick/benchmark/scenarios/compute/computecapacity.py
@@ -40,10 +40,12 @@ class ComputeCapacity(base.Scenario):
nodes = self.context_cfg['nodes']
node = nodes.get('host', None)
host_user = node.get('user', 'ubuntu')
+ ssh_port = node.get('ssh_port', ssh.DEFAULT_PORT)
host_ip = node.get('ip', None)
host_pwd = node.get('password', 'root')
LOG.debug("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip, password=host_pwd)
+ self.client = ssh.SSH(host_user, host_ip, password=host_pwd,
+ port=ssh_port)
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/compute/cpuload.py b/yardstick/benchmark/scenarios/compute/cpuload.py
index f45313e91..a7fae44ec 100644
--- a/yardstick/benchmark/scenarios/compute/cpuload.py
+++ b/yardstick/benchmark/scenarios/compute/cpuload.py
@@ -67,10 +67,12 @@ class CPULoad(base.Scenario):
host = self.context_cfg['host']
user = host.get('user', 'ubuntu')
ip = host.get('ip', None)
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
key_filename = host.get('key_filename', '~/.ssh/id_rsa')
LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename)
+ self.client = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.client.wait(timeout=600)
# Check if mpstat prog is installed
diff --git a/yardstick/benchmark/scenarios/compute/cyclictest.py b/yardstick/benchmark/scenarios/compute/cyclictest.py
index 478b0a1a2..6a1afe223 100644
--- a/yardstick/benchmark/scenarios/compute/cyclictest.py
+++ b/yardstick/benchmark/scenarios/compute/cyclictest.py
@@ -93,10 +93,12 @@ class Cyclictest(base.Scenario):
host = self.context_cfg["host"]
user = host.get("user", "root")
ip = host.get("ip", None)
+ ssh_port = host.get("ssh_port", 5555)
key_filename = host.get("key_filename", "~/.ssh/id_rsa")
LOG.debug("user:%s, host:%s", user, ip)
- self.guest = ssh.SSH(user, ip, port=5555, key_filename=key_filename)
+ self.guest = ssh.SSH(user, ip, port=ssh_port,
+ key_filename=key_filename)
self.guest.wait(timeout=600)
def _run_setup_cmd(self, client, cmd):
diff --git a/yardstick/benchmark/scenarios/compute/lmbench.py b/yardstick/benchmark/scenarios/compute/lmbench.py
index d3e802f3b..9ceb2484c 100644
--- a/yardstick/benchmark/scenarios/compute/lmbench.py
+++ b/yardstick/benchmark/scenarios/compute/lmbench.py
@@ -77,11 +77,13 @@ class Lmbench(base.Scenario):
Lmbench.LATENCY_CACHE_SCRIPT)
host = self.context_cfg["host"]
user = host.get("user", "ubuntu")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
ip = host.get("ip", None)
key_filename = host.get('key_filename', "~/.ssh/id_rsa")
LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename)
+ self.client = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.client.wait(timeout=600)
# copy scripts to host
diff --git a/yardstick/benchmark/scenarios/compute/memload.py b/yardstick/benchmark/scenarios/compute/memload.py
index bafd89617..48088f87c 100644
--- a/yardstick/benchmark/scenarios/compute/memload.py
+++ b/yardstick/benchmark/scenarios/compute/memload.py
@@ -48,11 +48,13 @@ class MEMLoad(base.Scenario):
"""Scenario setup."""
host = self.context_cfg['host']
user = host.get('user', 'ubuntu')
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
ip = host.get('ip', None)
key_filename = host.get('key_filename', '~/.ssh/id_rsa')
LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename)
+ self.client = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.client.wait(timeout=600)
self.setup_done = True
diff --git a/yardstick/benchmark/scenarios/compute/perf.py b/yardstick/benchmark/scenarios/compute/perf.py
index f408e9cb4..6c827efc2 100644
--- a/yardstick/benchmark/scenarios/compute/perf.py
+++ b/yardstick/benchmark/scenarios/compute/perf.py
@@ -47,11 +47,13 @@ class Perf(base.Scenario):
'yardstick.benchmark.scenarios.compute', Perf.TARGET_SCRIPT)
host = self.context_cfg['host']
user = host.get('user', 'ubuntu')
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
ip = host.get('ip', None)
key_filename = host.get('key_filename', '~/.ssh/id_rsa')
LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename)
+ self.client = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/compute/plugintest.py b/yardstick/benchmark/scenarios/compute/plugintest.py
index e41fb8399..e7ec91c5c 100644
--- a/yardstick/benchmark/scenarios/compute/plugintest.py
+++ b/yardstick/benchmark/scenarios/compute/plugintest.py
@@ -30,10 +30,12 @@ class PluginTest(base.Scenario):
nodes = self.context_cfg['nodes']
node = nodes.get('host1', None)
host_user = node.get('user', 'ubuntu')
+ host_ssh_port = node.get('ssh_port', ssh.DEFAULT_PORT)
host_ip = node.get('ip', None)
host_pwd = node.get('password', 'root')
LOG.debug("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip, password=host_pwd)
+ self.client = ssh.SSH(host_user, host_ip, password=host_pwd,
+ port=host_ssh_port)
self.client.wait(timeout=600)
self.setup_done = True
diff --git a/yardstick/benchmark/scenarios/compute/ramspeed.py b/yardstick/benchmark/scenarios/compute/ramspeed.py
index 819ef769b..bc33f8af2 100644
--- a/yardstick/benchmark/scenarios/compute/ramspeed.py
+++ b/yardstick/benchmark/scenarios/compute/ramspeed.py
@@ -87,11 +87,13 @@ class Ramspeed(base.Scenario):
host = self.context_cfg["host"]
user = host.get("user", "ubuntu")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
ip = host.get("ip", None)
key_filename = host.get('key_filename', "~/.ssh/id_rsa")
LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename)
+ self.client = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.client.wait(timeout=600)
# copy scripts to host
diff --git a/yardstick/benchmark/scenarios/compute/unixbench.py b/yardstick/benchmark/scenarios/compute/unixbench.py
index e6318b92e..e6299346f 100644
--- a/yardstick/benchmark/scenarios/compute/unixbench.py
+++ b/yardstick/benchmark/scenarios/compute/unixbench.py
@@ -67,11 +67,13 @@ class Unixbench(base.Scenario):
host = self.context_cfg["host"]
user = host.get("user", "ubuntu")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
ip = host.get("ip", None)
key_filename = host.get('key_filename', "~/.ssh/id_rsa")
LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename)
+ self.client = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.client.wait(timeout=600)
# copy scripts to host
@@ -152,5 +154,6 @@ def _test(): # pragma: no cover
p.run(result)
print result
+
if __name__ == '__main__':
_test()
diff --git a/yardstick/benchmark/scenarios/networking/iperf3.py b/yardstick/benchmark/scenarios/networking/iperf3.py
index bb41c3df1..13fa0155b 100644
--- a/yardstick/benchmark/scenarios/networking/iperf3.py
+++ b/yardstick/benchmark/scenarios/networking/iperf3.py
@@ -56,21 +56,24 @@ For more info see http://software.es.net/iperf
def setup(self):
host = self.context_cfg['host']
host_user = host.get('user', 'ubuntu')
+ host_ssh_port = host.get('ssh_port', ssh.DEFAULT_PORT)
host_ip = host.get('ip', None)
host_key_filename = host.get('key_filename', '~/.ssh/id_rsa')
target = self.context_cfg['target']
target_user = target.get('user', 'ubuntu')
+ target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
target_ip = target.get('ip', None)
target_key_filename = target.get('key_filename', '~/.ssh/id_rsa')
LOG.info("user:%s, target:%s", target_user, target_ip)
self.target = ssh.SSH(target_user, target_ip,
- key_filename=target_key_filename)
+ key_filename=target_key_filename,
+ port=target_ssh_port)
self.target.wait(timeout=600)
LOG.info("user:%s, host:%s", host_user, host_ip)
self.host = ssh.SSH(host_user, host_ip,
- key_filename=host_key_filename)
+ key_filename=host_key_filename, port=host_ssh_port)
self.host.wait(timeout=600)
cmd = "iperf3 -s -D"
diff --git a/yardstick/benchmark/scenarios/networking/netperf.py b/yardstick/benchmark/scenarios/networking/netperf.py
index dcd4ef7b6..08901e12b 100755
--- a/yardstick/benchmark/scenarios/networking/netperf.py
+++ b/yardstick/benchmark/scenarios/networking/netperf.py
@@ -62,22 +62,26 @@ class Netperf(base.Scenario):
Netperf.TARGET_SCRIPT)
host = self.context_cfg['host']
host_user = host.get('user', 'ubuntu')
+ host_ssh_port = host.get('ssh_port', ssh.DEFAULT_PORT)
host_ip = host.get('ip', None)
host_key_filename = host.get('key_filename', '~/.ssh/id_rsa')
target = self.context_cfg['target']
target_user = target.get('user', 'ubuntu')
+ target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
target_ip = target.get('ip', None)
target_key_filename = target.get('key_filename', '~/.ssh/id_rsa')
# netserver start automatically during the vm boot
LOG.info("user:%s, target:%s", target_user, target_ip)
self.server = ssh.SSH(target_user, target_ip,
- key_filename=target_key_filename)
+ key_filename=target_key_filename,
+ port=target_ssh_port)
self.server.wait(timeout=600)
LOG.info("user:%s, host:%s", host_user, host_ip)
self.client = ssh.SSH(host_user, host_ip,
- key_filename=host_key_filename)
+ key_filename=host_key_filename,
+ port=host_ssh_port)
self.client.wait(timeout=600)
# copy script to host
@@ -174,5 +178,6 @@ def _test():
netperf.run(result)
print result
+
if __name__ == '__main__':
_test()
diff --git a/yardstick/benchmark/scenarios/networking/netperf_node.py b/yardstick/benchmark/scenarios/networking/netperf_node.py
index 87aa8d78d..1578da7d8 100755
--- a/yardstick/benchmark/scenarios/networking/netperf_node.py
+++ b/yardstick/benchmark/scenarios/networking/netperf_node.py
@@ -63,9 +63,11 @@ class NetperfNode(base.Scenario):
NetperfNode.TARGET_SCRIPT)
host = self.context_cfg['host']
host_user = host.get('user', 'ubuntu')
+ host_ssh_port = host.get('ssh_port', ssh.DEFAULT_PORT)
host_ip = host.get('ip', None)
target = self.context_cfg['target']
target_user = target.get('user', 'ubuntu')
+ target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
target_ip = target.get('ip', None)
self.target_ip = target.get('ip', None)
host_password = host.get('password', None)
@@ -75,12 +77,12 @@ class NetperfNode(base.Scenario):
# netserver start automatically during the vm boot
LOG.info("user:%s, target:%s", target_user, target_ip)
self.server = ssh.SSH(target_user, target_ip,
- password=target_password)
+ password=target_password, port=target_ssh_port)
self.server.wait(timeout=600)
LOG.info("user:%s, host:%s", host_user, host_ip)
self.client = ssh.SSH(host_user, host_ip,
- password=host_password)
+ password=host_password, port=host_ssh_port)
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/networking/netutilization.py b/yardstick/benchmark/scenarios/networking/netutilization.py
index ea43e6077..ecde7568e 100644
--- a/yardstick/benchmark/scenarios/networking/netutilization.py
+++ b/yardstick/benchmark/scenarios/networking/netutilization.py
@@ -70,11 +70,13 @@ class NetUtilization(base.Scenario):
"""Scenario setup."""
host = self.context_cfg['host']
user = host.get('user', 'ubuntu')
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
ip = host.get('ip', None)
key_filename = host.get('key_filename', '~/.ssh/id_rsa')
LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename)
+ self.client = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.client.wait(timeout=600)
self.setup_done = True
diff --git a/yardstick/benchmark/scenarios/networking/networkcapacity.py b/yardstick/benchmark/scenarios/networking/networkcapacity.py
index 57d3b5072..438452e40 100644
--- a/yardstick/benchmark/scenarios/networking/networkcapacity.py
+++ b/yardstick/benchmark/scenarios/networking/networkcapacity.py
@@ -1,69 +1,71 @@
-##############################################################################
-# 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
-##############################################################################
-import pkg_resources
-import logging
-import json
-
-import yardstick.ssh as ssh
-from yardstick.benchmark.scenarios import base
-
-LOG = logging.getLogger(__name__)
-
-
-class NetworkCapacity(base.Scenario):
- """Measure Network capacity and scale.
-
- This scenario reads network status including number of connections,
- number of frames sent/received.
- """
- __scenario_type__ = "NetworkCapacity"
- TARGET_SCRIPT = "networkcapacity.bash"
-
- def __init__(self, scenario_cfg, context_cfg):
- self.scenario_cfg = scenario_cfg
- self.context_cfg = context_cfg
- self.setup_done = False
-
- def setup(self):
- """scenario setup"""
- self.target_script = pkg_resources.resource_filename(
- "yardstick.benchmark.scenarios.networking",
- NetworkCapacity.TARGET_SCRIPT)
-
- host = self.context_cfg['host']
- if host is None:
- raise RuntimeError('No right node.please check the configuration')
- host_user = host.get('user', 'ubuntu')
- host_ip = host.get('ip', None)
- host_pwd = host.get('password', None)
-
- LOG.debug("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip, password=host_pwd)
- self.client.wait(timeout=600)
-
- # copy script to host
- self.client.run("cat > ~/networkcapacity.sh",
- stdin=open(self.target_script, 'rb'))
-
- self.setup_done = True
-
- def run(self, result):
- """execute the benchmark"""
-
- if not self.setup_done:
- self.setup()
-
- cmd = "sudo bash networkcapacity.sh"
-
- LOG.debug("Executing command: %s", cmd)
- status, stdout, stderr = self.client.execute(cmd)
- if status:
- raise RuntimeError(stderr)
-
- result.update(json.loads(stdout))
+##############################################################################
+# 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
+##############################################################################
+import pkg_resources
+import logging
+import json
+
+import yardstick.ssh as ssh
+from yardstick.benchmark.scenarios import base
+
+LOG = logging.getLogger(__name__)
+
+
+class NetworkCapacity(base.Scenario):
+ """Measure Network capacity and scale.
+
+ This scenario reads network status including number of connections,
+ number of frames sent/received.
+ """
+ __scenario_type__ = "NetworkCapacity"
+ TARGET_SCRIPT = "networkcapacity.bash"
+
+ def __init__(self, scenario_cfg, context_cfg):
+ self.scenario_cfg = scenario_cfg
+ self.context_cfg = context_cfg
+ self.setup_done = False
+
+ def setup(self):
+ """scenario setup"""
+ self.target_script = pkg_resources.resource_filename(
+ "yardstick.benchmark.scenarios.networking",
+ NetworkCapacity.TARGET_SCRIPT)
+
+ host = self.context_cfg['host']
+ if host is None:
+ raise RuntimeError('No right node.please check the configuration')
+ host_user = host.get('user', 'ubuntu')
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
+ host_ip = host.get('ip', None)
+ host_pwd = host.get('password', None)
+
+ LOG.debug("user:%s, host:%s", host_user, host_ip)
+ self.client = ssh.SSH(host_user, host_ip, password=host_pwd,
+ port=ssh_port)
+ self.client.wait(timeout=600)
+
+ # copy script to host
+ self.client.run("cat > ~/networkcapacity.sh",
+ stdin=open(self.target_script, 'rb'))
+
+ self.setup_done = True
+
+ def run(self, result):
+ """execute the benchmark"""
+
+ if not self.setup_done:
+ self.setup()
+
+ cmd = "sudo bash networkcapacity.sh"
+
+ LOG.debug("Executing command: %s", cmd)
+ status, stdout, stderr = self.client.execute(cmd)
+ if status:
+ raise RuntimeError(stderr)
+
+ result.update(json.loads(stdout))
diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py
index 54c192294..2becdaf36 100644
--- a/yardstick/benchmark/scenarios/networking/ping.py
+++ b/yardstick/benchmark/scenarios/networking/ping.py
@@ -39,6 +39,7 @@ class Ping(base.Scenario):
'yardstick.benchmark.scenarios.networking', Ping.TARGET_SCRIPT)
host = self.context_cfg['host']
user = host.get('user', 'ubuntu')
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
ip = host.get('ip', None)
key_filename = host.get('key_filename', '/root/.ssh/id_rsa')
password = host.get('password', None)
@@ -46,11 +47,13 @@ class Ping(base.Scenario):
if password is not None:
LOG.info("Log in via pw, user:%s, host:%s, pw:%s",
user, ip, password)
- self.connection = ssh.SSH(user, ip, password=password)
+ self.connection = ssh.SSH(user, ip, password=password,
+ port=ssh_port)
else:
LOG.info("Log in via key, user:%s, host:%s, key_filename:%s",
user, ip, key_filename)
- self.connection = ssh.SSH(user, ip, key_filename=key_filename)
+ self.connection = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.connection.wait()
diff --git a/yardstick/benchmark/scenarios/networking/ping6.py b/yardstick/benchmark/scenarios/networking/ping6.py
index 91183be25..9aa94c40c 100644
--- a/yardstick/benchmark/scenarios/networking/ping6.py
+++ b/yardstick/benchmark/scenarios/networking/ping6.py
@@ -51,18 +51,19 @@ class Ping6(base.Scenario): # pragma: no cover
# ssh host
node = self.nodes.get(node_name, None)
user = node.get('user', 'ubuntu')
+ ssh_port = node.get("ssh_port", ssh.DEFAULT_PORT)
ip = node.get('ip', None)
pwd = node.get('password', None)
key_fname = node.get('key_filename', '/root/.ssh/id_rsa')
-
if pwd is not None:
LOG.debug("Log in via pw, user:%s, host:%s, password:%s",
user, ip, pwd)
- self.client = ssh.SSH(user, ip, password=pwd)
+ self.client = ssh.SSH(user, ip, password=pwd, port=ssh_port)
else:
LOG.debug("Log in via key, user:%s, host:%s, key_filename:%s",
user, ip, key_fname)
- self.client = ssh.SSH(user, ip, key_filename=key_fname)
+ self.client = ssh.SSH(user, ip, key_filename=key_fname,
+ port=ssh_port)
self.client.wait(timeout=60)
def _pre_setup(self):
@@ -73,6 +74,14 @@ class Ping6(base.Scenario): # pragma: no cover
status, stdout, stderr = self.client.execute(
"sudo bash pre_setup.sh")
+ def _get_controller_node(self, host_list):
+ for host_name in host_list:
+ node = self.nodes.get(host_name, None)
+ node_role = node.get('role', None)
+ if node_role == 'Controller':
+ return host_name
+ return None
+
def setup(self):
'''scenario setup'''
self.setup_script = pkg_resources.resource_filename(
@@ -102,9 +111,12 @@ class Ping6(base.Scenario): # pragma: no cover
if pre_setup:
self._pre_setup()
- # ssh host1
- self._ssh_host(self.host_list[0])
-
+ # log in a contronller node to setup
+ controller_node_name = self._get_controller_node(self.host_list)
+ LOG.debug("The Controller Node is: %s", controller_node_name)
+ if controller_node_name is None:
+ LOG.exception("Can't find controller node in the context!!!")
+ self._ssh_host(controller_node_name)
self.client.run("cat > ~/metadata.txt",
stdin=open(self.ping6_metadata_script, "rb"))
diff --git a/yardstick/benchmark/scenarios/networking/ping6_setup.bash b/yardstick/benchmark/scenarios/networking/ping6_setup.bash
index fb6da4fdb..592ced3df 100644
--- a/yardstick/benchmark/scenarios/networking/ping6_setup.bash
+++ b/yardstick/benchmark/scenarios/networking/ping6_setup.bash
@@ -15,8 +15,13 @@ openrc=$1
external_network=$2
echo "openrc=$openrc"
echo "external_network=$external_network"
+echo "nameserver 8.8.4.4" >> /etc/resolv.conf
source $openrc
-wget https://download.fedoraproject.org/pub/fedora/linux/releases/22/Cloud/x86_64/Images/Fedora-Cloud-Base-22-20150521.x86_64.qcow2 >/dev/null 2>&1
+
+fedora_img="Fedora-Cloud-Base-22-20150521.x86_64.qcow2"
+if [ ! -f "$fedora_img" ]; then
+ wget https://download.fedoraproject.org/pub/fedora/linux/releases/22/Cloud/x86_64/Images/${fedora_img} >/dev/null 2>&1
+fi
glance image-create --name 'Fedora22' --disk-format qcow2 \
--container-format bare --file ./Fedora-Cloud-Base-22-20150521.x86_64.qcow2
diff --git a/yardstick/benchmark/scenarios/networking/pktgen.py b/yardstick/benchmark/scenarios/networking/pktgen.py
index 9dac4c90c..3e105767a 100644
--- a/yardstick/benchmark/scenarios/networking/pktgen.py
+++ b/yardstick/benchmark/scenarios/networking/pktgen.py
@@ -49,21 +49,25 @@ class Pktgen(base.Scenario):
Pktgen.TARGET_SCRIPT)
host = self.context_cfg['host']
host_user = host.get('user', 'ubuntu')
+ host_ssh_port = host.get('ssh_port', ssh.DEFAULT_PORT)
host_ip = host.get('ip', None)
host_key_filename = host.get('key_filename', '~/.ssh/id_rsa')
target = self.context_cfg['target']
target_user = target.get('user', 'ubuntu')
+ target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
target_ip = target.get('ip', None)
target_key_filename = target.get('key_filename', '~/.ssh/id_rsa')
LOG.info("user:%s, target:%s", target_user, target_ip)
self.server = ssh.SSH(target_user, target_ip,
- key_filename=target_key_filename)
+ key_filename=target_key_filename,
+ port=target_ssh_port)
self.server.wait(timeout=600)
LOG.info("user:%s, host:%s", host_user, host_ip)
self.client = ssh.SSH(host_user, host_ip,
- key_filename=host_key_filename)
+ key_filename=host_key_filename,
+ port=host_ssh_port)
self.client.wait(timeout=600)
# copy script to host
@@ -169,5 +173,6 @@ def _test():
p.run(result)
print result
+
if __name__ == '__main__':
_test()
diff --git a/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py b/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
index 86585eca3..189cc7895 100644
--- a/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
+++ b/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
@@ -45,15 +45,18 @@ class PktgenDPDKLatency(base.Scenario):
PktgenDPDKLatency.TESTPMD_SCRIPT)
host = self.context_cfg['host']
host_user = host.get('user', 'ubuntu')
+ host_ssh_port = host.get('ssh_port', ssh.DEFAULT_PORT)
host_ip = host.get('ip', None)
host_key_filename = host.get('key_filename', '~/.ssh/id_rsa')
target = self.context_cfg['target']
target_user = target.get('user', 'ubuntu')
+ target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
target_ip = target.get('ip', None)
target_key_filename = target.get('key_filename', '~/.ssh/id_rsa')
LOG.info("user:%s, target:%s", target_user, target_ip)
self.server = ssh.SSH(target_user, target_ip,
- key_filename=target_key_filename)
+ key_filename=target_key_filename,
+ port=target_ssh_port)
self.server.wait(timeout=600)
# copy script to host
@@ -62,7 +65,8 @@ class PktgenDPDKLatency(base.Scenario):
LOG.info("user:%s, host:%s", host_user, host_ip)
self.client = ssh.SSH(host_user, host_ip,
- key_filename=host_key_filename)
+ key_filename=host_key_filename,
+ port=host_ssh_port)
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/networking/sfc.py b/yardstick/benchmark/scenarios/networking/sfc.py
index a126bb52a..9494e70d2 100644
--- a/yardstick/benchmark/scenarios/networking/sfc.py
+++ b/yardstick/benchmark/scenarios/networking/sfc.py
@@ -41,12 +41,14 @@ class Sfc(base.Scenario): # pragma: no cover
target = self.context_cfg['target']
target_user = target.get('user', 'root')
+ target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
target_pwd = target.get('password', 'opnfv')
target_ip = target.get('ip', None)
''' webserver start automatically during the vm boot '''
LOG.info("user:%s, target:%s", target_user, target_ip)
- self.server = ssh.SSH(target_user, target_ip, password=target_pwd)
+ self.server = ssh.SSH(target_user, target_ip, password=target_pwd,
+ port=target_ssh_port)
self.server.wait(timeout=600)
self.server.run("cat > ~/server.sh",
stdin=open(self.server_script, "rb"))
@@ -59,11 +61,13 @@ class Sfc(base.Scenario): # pragma: no cover
target = self.context_cfg['target']
SF1_user = target.get('user', 'root')
+ SF1_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
SF1_pwd = target.get('password', 'opnfv')
SF1_ip = ips[0]
LOG.info("user:%s, host:%s", SF1_user, SF1_ip)
- self.server = ssh.SSH(SF1_user, SF1_ip, password=SF1_pwd)
+ self.server = ssh.SSH(SF1_user, SF1_ip, password=SF1_pwd,
+ port=SF1_ssh_port)
self.server.wait(timeout=600)
cmd_SF1 = ("nohup python vxlan_tool.py -i eth0 "
"-d forward -v off -b 80 &")
@@ -74,11 +78,13 @@ class Sfc(base.Scenario): # pragma: no cover
LOG.debug("HTTP firewall started")
SF2_user = target.get('user', 'root')
+ SF2_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
SF2_pwd = target.get('password', 'opnfv')
SF2_ip = ips[1]
LOG.info("user:%s, host:%s", SF2_user, SF2_ip)
- self.server = ssh.SSH(SF2_user, SF2_ip, password=SF2_pwd)
+ self.server = ssh.SSH(SF2_user, SF2_ip, password=SF2_pwd,
+ port=SF2_ssh_port)
self.server.wait(timeout=600)
cmd_SF2 = ("nohup python vxlan_tool.py -i eth0 "
"-d forward -v off -b 22 &")
@@ -95,11 +101,13 @@ class Sfc(base.Scenario): # pragma: no cover
''' Creating client and server VMs to perform the test'''
host = self.context_cfg['host']
host_user = host.get('user', 'root')
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
host_pwd = host.get('password', 'opnfv')
host_ip = host.get('ip', None)
LOG.info("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip, password=host_pwd)
+ self.client = ssh.SSH(host_user, host_ip, password=host_pwd,
+ port=ssh_port)
self.client.wait(timeout=600)
if not self.setup_done: # pragma: no cover
diff --git a/yardstick/benchmark/scenarios/networking/vsperf.py b/yardstick/benchmark/scenarios/networking/vsperf.py
index d3123083a..82db1e254 100644
--- a/yardstick/benchmark/scenarios/networking/vsperf.py
+++ b/yardstick/benchmark/scenarios/networking/vsperf.py
@@ -104,6 +104,7 @@ class Vsperf(base.Scenario):
'''scenario setup'''
vsperf = self.context_cfg['host']
vsperf_user = vsperf.get('user', 'ubuntu')
+ vsperf_ssh_port = vsperf.get('ssh_port', ssh.DEFAULT_PORT)
vsperf_password = vsperf.get('password', 'ubuntu')
vsperf_ip = vsperf.get('ip', None)
@@ -118,7 +119,7 @@ class Vsperf(base.Scenario):
# copy vsperf conf to VM
LOG.info("user:%s, host:%s", vsperf_user, vsperf_ip)
self.client = ssh.SSH(vsperf_user, vsperf_ip,
- password=vsperf_password)
+ password=vsperf_password, port=vsperf_ssh_port)
# traffic generation could last long
self.client.wait(timeout=1800)
diff --git a/yardstick/benchmark/scenarios/storage/fio.py b/yardstick/benchmark/scenarios/storage/fio.py
index a8d27faba..0e4153643 100644
--- a/yardstick/benchmark/scenarios/storage/fio.py
+++ b/yardstick/benchmark/scenarios/storage/fio.py
@@ -60,11 +60,13 @@ class Fio(base.Scenario):
Fio.TARGET_SCRIPT)
host = self.context_cfg["host"]
user = host.get("user", "root")
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
ip = host.get("ip", None)
key_filename = host.get("key_filename", "~/.ssh/id_rsa")
LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename)
+ self.client = ssh.SSH(user, ip, key_filename=key_filename,
+ port=ssh_port)
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/storage/storagecapacity.py b/yardstick/benchmark/scenarios/storage/storagecapacity.py
index 49e3a0339..bed45fa6d 100644
--- a/yardstick/benchmark/scenarios/storage/storagecapacity.py
+++ b/yardstick/benchmark/scenarios/storage/storagecapacity.py
@@ -54,11 +54,13 @@ class StorageCapacity(base.Scenario):
if host is None:
raise RuntimeError('No right node.Please check the configuration')
host_user = host.get('user', 'ubuntu')
+ ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
host_ip = host.get('ip', None)
host_pwd = host.get('password', 'root')
LOG.debug("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip, password=host_pwd)
+ self.client = ssh.SSH(host_user, host_ip, password=host_pwd,
+ port=ssh_port)
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/cmd/cli.py b/yardstick/cmd/cli.py
index dd74836cb..ee8d1c529 100644
--- a/yardstick/cmd/cli.py
+++ b/yardstick/cmd/cli.py
@@ -66,6 +66,7 @@ class YardstickCLI():
}
def __init__(self):
+ self.opts = []
self._version = 'yardstick version %s ' % \
get_distribution('yardstick').version
@@ -101,8 +102,7 @@ class YardstickCLI():
cmd_subparsers = subparser.add_subparsers(title='subcommands')
self._find_actions(cmd_subparsers, command_object)
- def main(self, argv):
- '''run the command line interface'''
+ def _register_cli_opt(self):
# register subcommands to parse additional command line arguments
def parser(subparsers):
@@ -112,12 +112,21 @@ class YardstickCLI():
title="Command categories",
help="Available categories",
handler=parser)
- CONF.register_cli_opt(category_opt)
+ self._register_opt(category_opt)
+
+ def _register_opt(self, opt):
+
+ CONF.register_cli_opt(opt)
+ self.opts.append(opt)
+
+ def _load_cli_config(self, argv):
# load CLI args and config files
CONF(argv, project="yardstick", version=self._version,
default_config_files=find_config_files(CONFIG_SEARCH_PATHS))
+ def _handle_global_opts(self):
+
# handle global opts
logger = logging.getLogger('yardstick')
logger.setLevel(logging.WARNING)
@@ -128,6 +137,43 @@ class YardstickCLI():
if CONF.debug:
logger.setLevel(logging.DEBUG)
+ def _dispath_func_notask(self):
+
# dispatch to category parser
func = CONF.category.func
func(CONF.category)
+
+ def _dispath_func_task(self, task_id):
+
+ # dispatch to category parser
+ func = CONF.category.func
+ func(CONF.category, task_id=task_id)
+
+ def _clear_config_opts(self):
+
+ CONF.clear()
+ CONF.unregister_opts(self.opts)
+
+ def main(self, argv): # pragma: no cover
+ '''run the command line interface'''
+ self._register_cli_opt()
+
+ self._load_cli_config(argv)
+
+ self._handle_global_opts()
+
+ self._dispath_func_notask()
+
+ self._clear_config_opts()
+
+ def api(self, argv, task_id): # pragma: no cover
+ '''run the api interface'''
+ self._register_cli_opt()
+
+ self._load_cli_config(argv)
+
+ self._handle_global_opts()
+
+ self._dispath_func_task(task_id)
+
+ self._clear_config_opts()
diff --git a/yardstick/cmd/commands/plugin.py b/yardstick/cmd/commands/plugin.py
index 9936942d8..10e5cdfbe 100644
--- a/yardstick/cmd/commands/plugin.py
+++ b/yardstick/cmd/commands/plugin.py
@@ -84,6 +84,7 @@ class PluginCommands(object):
'yardstick.resources', 'scripts/install/' + target_script)
deployment_user = deployment.get("user")
+ deployment_ssh_port = deployment.get("ssh_port", ssh.DEFAULT_PORT)
deployment_ip = deployment.get("ip")
deployment_password = deployment.get("password")
@@ -92,12 +93,14 @@ class PluginCommands(object):
LOG.info("user:%s, host:%s", deployment_user, installer_ip)
self.client = ssh.SSH(deployment_user, installer_ip,
- password=deployment_password)
+ password=deployment_password,
+ port=deployment_ssh_port)
self.client.wait(timeout=600)
else:
LOG.info("user:%s, host:%s", deployment_user, deployment_ip)
self.client = ssh.SSH(deployment_user, deployment_ip,
- password=deployment_password)
+ password=deployment_password,
+ port=deployment_ssh_port)
self.client.wait(timeout=600)
# copy script to host
@@ -113,6 +116,7 @@ class PluginCommands(object):
'yardstick.resources', 'scripts/remove/' + target_script)
deployment_user = deployment.get("user")
+ deployment_ssh_port = deployment.get("ssh_port", ssh.DEFAULT_PORT)
deployment_ip = deployment.get("ip")
deployment_password = deployment.get("password")
@@ -121,12 +125,14 @@ class PluginCommands(object):
LOG.info("user:%s, host:%s", deployment_user, installer_ip)
self.client = ssh.SSH(deployment_user, installer_ip,
- password=deployment_password)
+ password=deployment_password,
+ port=deployment_ssh_port)
self.client.wait(timeout=600)
else:
LOG.info("user:%s, host:%s", deployment_user, deployment_ip)
self.client = ssh.SSH(deployment_user, deployment_ip,
- password=deployment_password)
+ password=deployment_password,
+ port=deployment_ssh_port)
self.client.wait(timeout=600)
# copy script to host
@@ -145,6 +151,7 @@ class PluginCommands(object):
class PluginParser(object):
'''Parser for plugin configration files in yaml format'''
+
def __init__(self, path):
self.path = path
diff --git a/yardstick/cmd/commands/task.py b/yardstick/cmd/commands/task.py
index b38e084ac..47fb2ee60 100644
--- a/yardstick/cmd/commands/task.py
+++ b/yardstick/cmd/commands/task.py
@@ -51,11 +51,13 @@ class TaskCommands(object):
output_file_default, default=output_file_default)
@cliargs("--suite", help="process test suite file instead of a task file",
action="store_true")
- def do_start(self, args):
+ def do_start(self, args, **kwargs):
'''Start a benchmark scenario.'''
atexit.register(atexit_handler)
+ self.task_id = kwargs.get('task_id', str(uuid.uuid4()))
+
total_start_time = time.time()
parser = TaskParser(args.inputfile[0])
@@ -81,7 +83,7 @@ class TaskCommands(object):
one_task_start_time = time.time()
parser.path = task_files[i]
scenarios, run_in_parallel, meet_precondition = parser.parse_task(
- task_args[i], task_args_fnames[i])
+ self.task_id, task_args[i], task_args_fnames[i])
if not meet_precondition:
LOG.info("meet_precondition is %s, please check envrionment",
@@ -232,7 +234,7 @@ class TaskParser(object):
return valid_task_files, valid_task_args, valid_task_args_fnames
- def parse_task(self, task_args=None, task_args_file=None):
+ def parse_task(self, task_id, task_args=None, task_args_file=None):
'''parses the task file and return an context and scenario instances'''
print "Parsing task config:", self.path
@@ -291,7 +293,6 @@ class TaskParser(object):
run_in_parallel = cfg.get("run_in_parallel", False)
# 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
diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py
new file mode 100644
index 000000000..40b29a717
--- /dev/null
+++ b/yardstick/common/constants.py
@@ -0,0 +1,3 @@
+CONFIG_SAMPLE = '/etc/yardstick/config.yaml'
+
+RELENG_DIR = 'releng.dir'
diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py
index c482b4da4..d639fb66a 100644
--- a/yardstick/common/utils.py
+++ b/yardstick/common/utils.py
@@ -17,6 +17,7 @@
import os
import sys
+import yaml
from oslo_utils import importutils
import yardstick
@@ -68,3 +69,25 @@ def import_modules_from_package(package):
new_package = ".".join(root.split(os.sep)).split("....")[1]
module_name = "%s.%s" % (new_package, filename[:-3])
try_append_module(module_name, sys.modules)
+
+
+def get_para_from_yaml(file_path, args):
+
+ def func(a, b):
+ if a is None:
+ return None
+ return a.get(b)
+
+ if os.path.exists(file_path):
+ with open(file_path) as f:
+ value = yaml.safe_load(f)
+ value = reduce(func, args.split('.'), value)
+
+ if value is None:
+ print 'parameter not found'
+ return None
+
+ return value
+ else:
+ print 'file not exist'
+ return None
diff --git a/yardstick/ssh.py b/yardstick/ssh.py
index cf890df6f..8b71fe606 100644
--- a/yardstick/ssh.py
+++ b/yardstick/ssh.py
@@ -69,6 +69,8 @@ import logging
LOG = logging.getLogger(__name__)
+DEFAULT_PORT = 22
+
class SSHError(Exception):
pass
@@ -81,7 +83,7 @@ class SSHTimeout(SSHError):
class SSH(object):
"""Represent ssh connection."""
- def __init__(self, user, host, port=22, pkey=None,
+ def __init__(self, user, host, port=DEFAULT_PORT, pkey=None,
key_filename=None, password=None):
"""Initialize SSH client.
@@ -95,7 +97,8 @@ class SSH(object):
self.user = user
self.host = host
- self.port = port
+ # we may get text port from YAML, convert to int
+ self.port = int(port)
self.pkey = self._get_pkey(pkey) if pkey else None
self.password = password
self.key_filename = key_filename