aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/actions/env.py85
-rw-r--r--api/actions/result.py61
-rw-r--r--api/actions/test.py22
-rwxr-xr-xapi/api-prepare.sh37
-rw-r--r--api/conf.py8
-rw-r--r--api/server.py11
-rw-r--r--api/urls.py12
-rw-r--r--api/utils/common.py34
-rw-r--r--api/utils/daemonthread.py8
-rw-r--r--api/utils/influx.py20
-rw-r--r--api/views.py50
-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
-rwxr-xr-xinstall.sh3
-rw-r--r--requirements.txt1
-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-xtests/ci/clean_images.sh2
-rwxr-xr-xtests/ci/load_images.sh20
-rwxr-xr-xtests/ci/prepare_env.sh10
-rw-r--r--tests/ci/requirements.txt79
-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/unit/api/actions/test_test.py21
-rw-r--r--tests/unit/api/test_views.py24
-rw-r--r--tests/unit/api/utils/test_common.py8
-rw-r--r--tests/unit/api/utils/test_daemonthread.py29
-rw-r--r--tests/unit/api/utils/test_influx.py22
-rw-r--r--tests/unit/cmd/commands/test_env.py29
-rw-r--r--tests/unit/common/test_httpClient.py33
-rwxr-xr-xtools/yardstick-img-lxd-modify7
-rwxr-xr-xtools/yardstick-img-modify7
-rw-r--r--yardstick/__init__.py38
-rw-r--r--yardstick/benchmark/contexts/node.py6
-rwxr-xr-xyardstick/benchmark/runners/arithmetic.py6
-rwxr-xr-xyardstick/benchmark/runners/base.py18
-rw-r--r--yardstick/benchmark/runners/duration.py6
-rw-r--r--yardstick/benchmark/runners/iteration.py6
-rw-r--r--yardstick/benchmark/runners/sequence.py6
-rw-r--r--yardstick/benchmark/scenarios/availability/actionrollbackers.py8
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py16
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_general.py6
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_process.py6
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/baseattacker.py2
-rw-r--r--yardstick/benchmark/scenarios/availability/director.py6
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/basemonitor.py6
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_command.py10
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_general.py4
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_process.py6
-rw-r--r--yardstick/benchmark/scenarios/availability/operation/baseoperation.py2
-rw-r--r--yardstick/benchmark/scenarios/availability/operation/operation_general.py6
-rw-r--r--yardstick/benchmark/scenarios/availability/result_checker/baseresultchecker.py2
-rw-r--r--yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py8
-rw-r--r--yardstick/benchmark/scenarios/availability/scenario_general.py2
-rwxr-xr-xyardstick/benchmark/scenarios/availability/serviceha.py4
-rw-r--r--yardstick/benchmark/scenarios/compute/cachestat.py2
-rw-r--r--yardstick/benchmark/scenarios/compute/cpuload.py2
-rw-r--r--yardstick/benchmark/scenarios/compute/cyclictest.py14
-rw-r--r--yardstick/benchmark/scenarios/compute/memload.py2
-rwxr-xr-xyardstick/benchmark/scenarios/networking/netperf_benchmark.bash45
-rwxr-xr-xyardstick/benchmark/scenarios/networking/netperf_install.bash8
-rwxr-xr-xyardstick/benchmark/scenarios/networking/netperf_node.py27
-rw-r--r--yardstick/benchmark/scenarios/networking/netutilization.py2
-rw-r--r--yardstick/benchmark/scenarios/storage/storperf.py14
-rw-r--r--yardstick/cmd/cli.py31
-rw-r--r--yardstick/cmd/commands/env.py17
-rw-r--r--yardstick/common/constants.py7
-rw-r--r--yardstick/common/httpClient.py27
-rw-r--r--yardstick/common/utils.py9
-rw-r--r--yardstick/dispatcher/file.py1
-rw-r--r--yardstick/dispatcher/http.py4
-rw-r--r--yardstick/dispatcher/influxdb.py8
-rw-r--r--yardstick/ssh.py27
103 files changed, 859 insertions, 387 deletions
diff --git a/api/actions/env.py b/api/actions/env.py
new file mode 100644
index 000000000..321649940
--- /dev/null
+++ b/api/actions/env.py
@@ -0,0 +1,85 @@
+##############################################################################
+# 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
+import threading
+import time
+
+from docker import Client
+
+from yardstick.common import constants as config
+from yardstick.common import utils as yardstick_utils
+from api import conf as api_conf
+from api.utils import common as common_utils
+from api.utils import influx
+
+logger = logging.getLogger(__name__)
+
+
+def createInfluxDBContainer(args):
+ try:
+ container = _create_influxdb_container()
+ _config_output_file()
+ thread = threading.Thread(target=_config_influxdb)
+ thread.start()
+ return common_utils.result_handler('success', container)
+ except Exception as e:
+ message = 'Failed to create influxdb container: %s' % e
+ return common_utils.error_handler(message)
+
+
+def _create_influxdb_container():
+ client = Client(base_url=config.DOCKER_URL)
+
+ ports = [8083, 8086]
+ port_bindings = {k: k for k in ports}
+ host_config = client.create_host_config(port_bindings=port_bindings)
+
+ container = client.create_container(image='tutum/influxdb',
+ ports=ports,
+ detach=True,
+ tty=True,
+ host_config=host_config)
+ client.start(container)
+ return container
+
+
+def _config_influxdb():
+ time.sleep(20)
+ try:
+ client = influx.get_data_db_client()
+ client.create_user(config.USER, config.PASSWORD, config.DATABASE)
+ client.create_database(config.DATABASE)
+ logger.info('Success to config influxDB')
+ except Exception as e:
+ logger.debug('Failed to config influxDB: %s', e)
+
+
+def _config_output_file():
+ yardstick_utils.makedirs('/etc/yardstick')
+ with open('/etc/yardstick/yardstick.conf', 'w') as f:
+ f.write("""\
+[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://%s:8086
+db_name = yardstick
+username = root
+password = root
+"""
+ % api_conf.GATEWAY_IP)
diff --git a/api/actions/result.py b/api/actions/result.py
new file mode 100644
index 000000000..10112ac68
--- /dev/null
+++ b/api/actions/result.py
@@ -0,0 +1,61 @@
+##############################################################################
+# 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
+import uuid
+import re
+
+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']
+
+ if re.search("[^a-zA-Z0-9_-]", measurement):
+ raise ValueError('invalid measurement parameter')
+
+ uuid.UUID(task_id)
+ except KeyError:
+ message = 'measurement and task_id must be provided'
+ return common_utils.error_handler(message)
+
+ measurement = conf.TEST_CASE_PRE + measurement
+
+ query_template = "select * from %s where task_id='%s'"
+ query_sql = query_template % ('tasklist', task_id)
+ data = common_utils.translate_to_str(influx_utils.query(query_sql))
+
+ def _unfinished():
+ return common_utils.result_handler(0, [])
+
+ def _finished():
+ query_sql = query_template % (measurement, task_id)
+ data = common_utils.translate_to_str(influx_utils.query(query_sql))
+
+ 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
index 0de70bb71..fda0ffd32 100644
--- a/api/actions/test.py
+++ b/api/actions/test.py
@@ -1,5 +1,12 @@
+##############################################################################
+# 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
@@ -14,12 +21,7 @@ def runTestCase(args):
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)
+ return common_utils.error_handler('Lack of testcase argument')
testcase = os.path.join(conf.TEST_CASE_PATH,
conf.TEST_CASE_PRE + testcase + '.yaml')
@@ -33,8 +35,4 @@ def runTestCase(args):
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)
+ return common_utils.result_handler('success', task_id)
diff --git a/api/api-prepare.sh b/api/api-prepare.sh
new file mode 100755
index 000000000..c05dbb5ff
--- /dev/null
+++ b/api/api-prepare.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# 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
index b5553f452..e1da4aba0 100644
--- a/api/conf.py
+++ b/api/conf.py
@@ -1,3 +1,11 @@
+##############################################################################
+# 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
diff --git a/api/server.py b/api/server.py
index d0e4d30a2..3f104c61a 100644
--- a/api/server.py
+++ b/api/server.py
@@ -1,9 +1,18 @@
+##############################################################################
+# 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
+from yardstick import _init_logging
logger = logging.getLogger(__name__)
@@ -15,5 +24,7 @@ reduce(lambda a, b: a.add_resource(b.resource, b.url,
endpoint=b.endpoint) or a, urlpatterns, api)
if __name__ == '__main__':
+ _init_logging()
+ logger.setLevel(logging.DEBUG)
logger.info('Starting server')
app.run(host='0.0.0.0')
diff --git a/api/urls.py b/api/urls.py
index 9fa0bc935..323e5cb9f 100644
--- a/api/urls.py
+++ b/api/urls.py
@@ -1,7 +1,17 @@
+##############################################################################
+# 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/testcases/release/action', views.Release, 'release'),
+ Url('/yardstick/results', views.Results, 'results'),
+ Url('/yardstick/env/action', views.Env, 'env')
]
diff --git a/api/utils/common.py b/api/utils/common.py
index 9d7998abd..e3e64a72b 100644
--- a/api/utils/common.py
+++ b/api/utils/common.py
@@ -1,8 +1,21 @@
+##############################################################################
+# 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
+
+from flask import jsonify
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):
@@ -20,9 +33,9 @@ def get_command_list(command_list, opts, args):
command_list.extend(('--{}'.format(k) for k in opts if 'task-args' != k))
- task_args = opts.get('task_args', '')
+ task_args = opts.get('task-args', '')
if task_args:
- command_list.extend(['--task-args', task_args])
+ command_list.extend(['--task-args', str(task_args)])
return command_list
@@ -32,6 +45,23 @@ def exec_command_task(command_list, task_id): # pragma: no cover
daemonthread.start()
+def error_handler(message):
+ logger.debug(message)
+ result = {
+ 'status': 'error',
+ 'message': message
+ }
+ return jsonify(result)
+
+
+def result_handler(status, data):
+ result = {
+ 'status': status,
+ 'result': data
+ }
+ return jsonify(result)
+
+
class Url(object):
def __init__(self, url, resource, endpoint):
diff --git a/api/utils/daemonthread.py b/api/utils/daemonthread.py
index 77a0f6ab7..47c0b9108 100644
--- a/api/utils/daemonthread.py
+++ b/api/utils/daemonthread.py
@@ -1,3 +1,11 @@
+##############################################################################
+# 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
diff --git a/api/utils/influx.py b/api/utils/influx.py
index 52a90b61c..9366ed3e9 100644
--- a/api/utils/influx.py
+++ b/api/utils/influx.py
@@ -1,3 +1,11 @@
+##############################################################################
+# 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
@@ -29,7 +37,7 @@ def get_data_db_client():
def _get_ip(url):
- return urlsplit(url).netloc.split(':')[0]
+ return urlsplit(url).hostname
def _write_data(measurement, field, timestamp, tags):
@@ -53,3 +61,13 @@ 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
index 883091222..065de673b 100644
--- a/api/views.py
+++ b/api/views.py
@@ -1,4 +1,11 @@
-import json
+##############################################################################
+# 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
@@ -6,24 +13,43 @@ from flask_restful import Resource
from api.utils import common as common_utils
from api.actions import test as test_action
-from api import conf
+from api.actions import result as result_action
+from api.actions import env as env_action
logger = logging.getLogger(__name__)
-class Test(Resource):
+class Release(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)
- if action not in conf.TEST_ACTION:
- logger.error('Wrong action')
- result = {
- 'status': 'error',
- 'message': 'wrong action'
- }
- return json.dumps(result)
+ try:
+ return getattr(test_action, action)(args)
+ except AttributeError:
+ return common_utils.error_handler('Wrong action')
- method = getattr(test_action, action)
- return method(args)
+
+class Results(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')
+
+
+class Env(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(env_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..01025c2ef
--- /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/opnfv/repos/yardstick/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 fba6e2067..fb8625e50 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -11,6 +11,8 @@ FROM ubuntu:14.04
LABEL image=opnfv/yardstick
+ARG BRANCH=master
+
# GIT repo directory
ENV REPOS_DIR /home/opnfv/repos
@@ -43,6 +45,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
@@ -60,6 +65,10 @@ RUN cd ${YARDSTICK_REPO_DIR} && easy_install -U pip
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/install.sh b/install.sh
index 80fc1e523..afb735195 100755
--- a/install.sh
+++ b/install.sh
@@ -13,6 +13,9 @@ apt-get update && apt-get install -y \
python-dev \
libxml2-dev \
libxslt1-dev \
+ nginx \
+ uwsgi \
+ uwsgi-plugin-python \
python-setuptools && \
easy_install -U setuptools
diff --git a/requirements.txt b/requirements.txt
index ab20c7541..b47951e0a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -81,3 +81,4 @@ flask==0.11.1
flask-restful==0.3.5
influxdb==3.0.0
pyroute2==0.4.10
+docker-py==1.10.6
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/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..405d72076 100755
--- a/tests/ci/load_images.sh
+++ b/tests/ci/load_images.sh
@@ -12,6 +12,18 @@
set -e
+YARD_IMG_ARCH=amd64
+export YARD_IMG_ARCH
+
+if ! grep -q "Defaults env_keep += \"YARD_IMG_ARCH\"" "/etc/sudoers"; then
+ sudo echo "Defaults env_keep += \"YARD_IMG_ARCH YARDSTICK_REPO_DIR\"" >> /etc/sudoers
+fi
+
+ARCH_SCRIPT="test -f /etc/fuel_openstack_arch && grep -q arm64 /etc/fuel_openstack_arch"
+if [ "$INSTALLER_TYPE" == "fuel" ]; then
+ sshpass -p r00tme ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root $INSTALLER_IP "${ARCH_SCRIPT}" && YARD_IMG_ARCH=arm64
+fi
+
UCA_HOST="cloud-images.ubuntu.com"
if [ $YARD_IMG_ARCH = "arm64" ]; then
export VIVID_IMG_URL="http://${UCA_HOST}/vivid/current/vivid-server-cloudimg-arm64.tar.gz"
@@ -90,14 +102,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 +215,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/prepare_env.sh b/tests/ci/prepare_env.sh
index 130969fa1..be59b7f37 100755
--- a/tests/ci/prepare_env.sh
+++ b/tests/ci/prepare_env.sh
@@ -74,13 +74,6 @@ verify_connectivity() {
error "Can not talk to $ip."
}
-YARD_IMG_ARCH=amd64
-export YARD_IMG_ARCH
-
-if ! grep -q "Defaults env_keep += \"YARD_IMG_ARCH\"" "/etc/sudoers"; then
- sudo echo "Defaults env_keep += \"YARD_IMG_ARCH YARDSTICK_REPO_DIR\"" >> /etc/sudoers
-fi
-
ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
if [ "$INSTALLER_TYPE" == "fuel" ]; then
@@ -90,9 +83,6 @@ if [ "$INSTALLER_TYPE" == "fuel" ]; then
sshpass -p r00tme scp 2>/dev/null $ssh_options \
root@${INSTALLER_IP}:~/.ssh/id_rsa /root/.ssh/id_rsa &> /dev/null
- ARCH_SCRIPT="test -f /etc/fuel_openstack_arch && grep -q arm64 /etc/fuel_openstack_arch"
- sshpass -p r00tme ssh $ssh_options -l root $INSTALLER_IP "${ARCH_SCRIPT}" && YARD_IMG_ARCH=arm64
-
sshpass -p r00tme ssh 2>/dev/null $ssh_options \
root@${INSTALLER_IP} fuel node>fuel_node
diff --git a/tests/ci/requirements.txt b/tests/ci/requirements.txt
deleted file mode 100644
index 4d1a16993..000000000
--- a/tests/ci/requirements.txt
+++ /dev/null
@@ -1,79 +0,0 @@
-##############################################################################
-# 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
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/unit/api/actions/test_test.py b/tests/unit/api/actions/test_test.py
deleted file mode 100644
index 158062ff4..000000000
--- a/tests/unit/api/actions/test_test.py
+++ /dev/null
@@ -1,21 +0,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
deleted file mode 100644
index 650ed569c..000000000
--- a/tests/unit/api/test_views.py
+++ /dev/null
@@ -1,24 +0,0 @@
-import unittest
-import mock
-import json
-
-from api.views import Test
-
-
-class TestTestCase(unittest.TestCase):
-
- @mock.patch('api.views.request')
- def test_post(self, mock_request):
- mock_request.json.get.side_effect = ['runTestSuite', {}]
-
- result = json.loads(Test().post())
-
- 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
index 5d858a32c..5d177409e 100644
--- a/tests/unit/api/utils/test_common.py
+++ b/tests/unit/api/utils/test_common.py
@@ -1,3 +1,11 @@
+##############################################################################
+# 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
from api.utils import common
diff --git a/tests/unit/api/utils/test_daemonthread.py b/tests/unit/api/utils/test_daemonthread.py
deleted file mode 100644
index 918f1f506..000000000
--- a/tests/unit/api/utils/test_daemonthread.py
+++ /dev/null
@@ -1,29 +0,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
index 5f1e2c36f..0852da2dd 100644
--- a/tests/unit/api/utils/test_influx.py
+++ b/tests/unit/api/utils/test_influx.py
@@ -1,3 +1,11 @@
+##############################################################################
+# 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
@@ -13,7 +21,7 @@ class GetDataDbClientTestCase(unittest.TestCase):
mock_parser.ConfigParser().get.return_value = 'file'
try:
influx.get_data_db_client()
- except Exception, e:
+ except Exception as e:
self.assertIsInstance(e, RuntimeError)
@@ -54,6 +62,18 @@ class WriteDataTasklistTestCase(unittest.TestCase):
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()
diff --git a/tests/unit/cmd/commands/test_env.py b/tests/unit/cmd/commands/test_env.py
new file mode 100644
index 000000000..af1ab8030
--- /dev/null
+++ b/tests/unit/cmd/commands/test_env.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 mock
+
+from yardstick.cmd.commands.env import EnvCommand
+
+
+class EnvCommandTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.cmd.commands.env.HttpClient')
+ def test_do_influxdb(self, mock_http_client):
+ env = EnvCommand()
+ env.do_influxdb({})
+ self.assertTrue(mock_http_client().post.called)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/common/test_httpClient.py b/tests/unit/common/test_httpClient.py
new file mode 100644
index 000000000..b39dc2332
--- /dev/null
+++ b/tests/unit/common/test_httpClient.py
@@ -0,0 +1,33 @@
+##############################################################################
+# 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 yardstick.common import httpClient
+
+
+class HttpClientTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.httpClient.requests')
+ def test_post(self, mock_requests):
+ url = 'http://localhost:5000/hello'
+ data = {'hello': 'world'}
+ headers = {'Content-Type': 'application/json'}
+ httpClient.HttpClient().post(url, data)
+ mock_requests.post.assert_called_with(url, data=json.dumps(data),
+ headers=headers)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ 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/__init__.py b/yardstick/__init__.py
index c31948d43..5c279c800 100644
--- a/yardstick/__init__.py
+++ b/yardstick/__init__.py
@@ -8,18 +8,40 @@
##############################################################################
import logging
-import logging.config
-import sys
import os
+import sys
+
import yardstick.vTC.apexlake as apexlake
# Hack to be able to run apexlake unit tests
# without having to install apexlake.
sys.path.append(os.path.dirname(apexlake.__file__))
-logging.basicConfig(
- level=logging.WARNING,
- format='[%(asctime)s] %(name)-20s %(filename)s:%(lineno)d '
- '%(levelname)s %(message)s', # noqa
- datefmt='%m/%d/%y %H:%M:%S')
-logging.getLogger(__name__).setLevel(logging.INFO)
+LOG_FILE = '/tmp/yardstick.log'
+LOG_FORMATTER = ('%(asctime)s '
+ '%(name)s %(filename)s:%(lineno)d '
+ '%(levelname)s %(message)s')
+
+_LOG_FORMATTER = logging.Formatter(LOG_FORMATTER)
+_LOG_STREAM_HDLR = logging.StreamHandler()
+_LOG_FILE_HDLR = logging.FileHandler(LOG_FILE)
+
+LOG = logging.getLogger(__name__)
+
+
+def _init_logging():
+
+ _LOG_STREAM_HDLR.setFormatter(_LOG_FORMATTER)
+
+ # don't append to log file, clobber
+ _LOG_FILE_HDLR.setFormatter(_LOG_FORMATTER)
+
+ del logging.root.handlers[:]
+ logging.root.addHandler(_LOG_STREAM_HDLR)
+ logging.root.addHandler(_LOG_FILE_HDLR)
+ logging.debug("logging.root.handlers = %s", logging.root.handlers)
+
+ if os.environ.get('CI_DEBUG', '').lower() in {'1', 1, 'y', "yes", "true"}:
+ LOG.setLevel(logging.DEBUG)
+ else:
+ LOG.setLevel(logging.INFO)
diff --git a/yardstick/benchmark/contexts/node.py b/yardstick/benchmark/contexts/node.py
index c4e603a46..78bce8259 100644
--- a/yardstick/benchmark/contexts/node.py
+++ b/yardstick/benchmark/contexts/node.py
@@ -35,9 +35,9 @@ class NodeContext(Context):
def init(self, attrs):
'''initializes itself from the supplied arguments'''
self.name = attrs["name"]
- self.file_path = attrs.get("file", "")
+ self.file_path = attrs.get("file", "pod.yaml")
if not os.path.exists(self.file_path):
- self.file_path = YARDSTICK_ROOT_PATH + self.file_path
+ self.file_path = os.path.join(YARDSTICK_ROOT_PATH, self.file_path)
LOG.info("Parsing pod file: %s", self.file_path)
@@ -83,7 +83,7 @@ class NodeContext(Context):
return None
elif len(nodes) > 1:
LOG.error("Duplicate nodes!!!")
- LOG.error("Nodes: %r" % nodes)
+ LOG.error("Nodes: %r", nodes)
sys.exit(-1)
# A clone is created in order to avoid affecting the
diff --git a/yardstick/benchmark/runners/arithmetic.py b/yardstick/benchmark/runners/arithmetic.py
index 74a236f44..69ea915a1 100755
--- a/yardstick/benchmark/runners/arithmetic.py
+++ b/yardstick/benchmark/runners/arithmetic.py
@@ -93,7 +93,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
if aborted.is_set():
break
- LOG.debug("runner=%(runner)s seq=%(sequence)s START" %
+ LOG.debug("runner=%(runner)s seq=%(sequence)s START",
{"runner": runner_cfg["runner_id"], "sequence": sequence})
for i, value in enumerate(comb_values):
@@ -109,7 +109,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
if sla_action == "assert":
raise
elif sla_action == "monitor":
- LOG.warning("SLA validation failed: %s" % assertion.args)
+ LOG.warning("SLA validation failed: %s", assertion.args)
errors = assertion.args
except Exception as e:
errors = traceback.format_exc()
@@ -129,7 +129,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
queue.put(record)
- LOG.debug("runner=%(runner)s seq=%(sequence)s END" %
+ LOG.debug("runner=%(runner)s seq=%(sequence)s END",
{"runner": runner_cfg["runner_id"], "sequence": sequence})
sequence += 1
diff --git a/yardstick/benchmark/runners/base.py b/yardstick/benchmark/runners/base.py
index 23749924f..8f3f75fa1 100755
--- a/yardstick/benchmark/runners/base.py
+++ b/yardstick/benchmark/runners/base.py
@@ -63,7 +63,7 @@ def _execute_shell_command(command):
except Exception:
exitcode = -1
output = traceback.format_exc()
- log.error("exec command '%s' error:\n " % command)
+ log.error("exec command '%s' error:\n ", command)
log.error(traceback.format_exc())
return exitcode, output
@@ -76,10 +76,10 @@ def _single_action(seconds, command, queue):
log.debug("single action: executing command: '%s'", command)
ret_code, data = _execute_shell_command(command)
if ret_code < 0:
- log.error("single action error! command:%s" % command)
+ log.error("single action error! command:%s", command)
queue.put({'single-action-data': data})
return
- log.debug("single action data: \n%s" % data)
+ log.debug("single action data: \n%s", data)
queue.put({'single-action-data': data})
@@ -96,7 +96,7 @@ def _periodic_action(interval, command, queue):
log.error("periodic action error! command:%s", command)
queue.put({'periodic-action-data': data})
break
- log.debug("periodic action data: \n%s" % data)
+ log.debug("periodic action data: \n%s", data)
queue.put({'periodic-action-data': data})
@@ -127,7 +127,7 @@ class Runner(object):
"""
# if there is no runner, start the output serializer subprocess
if len(Runner.runners) == 0:
- log.debug("Starting dump process file '%s'" %
+ log.debug("Starting dump process file '%s'",
config["output_filename"])
Runner.queue = multiprocessing.Queue()
Runner.dump_process = multiprocessing.Process(
@@ -196,13 +196,13 @@ class Runner(object):
'''run a potentially configured post-stop action'''
if "post-stop-action" in self.config:
command = self.config["post-stop-action"]["command"]
- log.debug("post stop action: command: '%s'" % command)
+ log.debug("post stop action: command: '%s'", command)
ret_code, data = _execute_shell_command(command)
if ret_code < 0:
log.error("post action error! command:%s", command)
self.result_queue.put({'post-stop-action-data': data})
return
- log.debug("post-stop data: \n%s" % data)
+ log.debug("post-stop data: \n%s", data)
self.result_queue.put({'post-stop-action-data': data})
def run(self, scenario_cfg, context_cfg):
@@ -219,13 +219,13 @@ class Runner(object):
# run a potentially configured pre-start action
if "pre-start-action" in self.config:
command = self.config["pre-start-action"]["command"]
- log.debug("pre start action: command: '%s'" % command)
+ log.debug("pre start action: command: '%s'", command)
ret_code, data = _execute_shell_command(command)
if ret_code < 0:
log.error("pre-start action error! command:%s", command)
self.result_queue.put({'pre-start-action-data': data})
return
- log.debug("pre-start data: \n%s" % data)
+ log.debug("pre-start data: \n%s", data)
self.result_queue.put({'pre-start-action-data': data})
if "single-shot-action" in self.config:
diff --git a/yardstick/benchmark/runners/duration.py b/yardstick/benchmark/runners/duration.py
index 1f51f513f..1412c0caa 100644
--- a/yardstick/benchmark/runners/duration.py
+++ b/yardstick/benchmark/runners/duration.py
@@ -58,7 +58,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
start = time.time()
while True:
- LOG.debug("runner=%(runner)s seq=%(sequence)s START" %
+ LOG.debug("runner=%(runner)s seq=%(sequence)s START",
{"runner": runner_cfg["runner_id"], "sequence": sequence})
data = {}
@@ -71,7 +71,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
if sla_action == "assert":
raise
elif sla_action == "monitor":
- LOG.warning("SLA validation failed: %s" % assertion.args)
+ LOG.warning("SLA validation failed: %s", assertion.args)
errors = assertion.args
except Exception as e:
errors = traceback.format_exc()
@@ -91,7 +91,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
queue.put(record)
- LOG.debug("runner=%(runner)s seq=%(sequence)s END" %
+ LOG.debug("runner=%(runner)s seq=%(sequence)s END",
{"runner": runner_cfg["runner_id"], "sequence": sequence})
sequence += 1
diff --git a/yardstick/benchmark/runners/iteration.py b/yardstick/benchmark/runners/iteration.py
index b23b32b08..3a839b65f 100644
--- a/yardstick/benchmark/runners/iteration.py
+++ b/yardstick/benchmark/runners/iteration.py
@@ -60,7 +60,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
if "run" in run_step:
while True:
- LOG.debug("runner=%(runner)s seq=%(sequence)s START" %
+ LOG.debug("runner=%(runner)s seq=%(sequence)s START",
{"runner": runner_cfg["runner_id"],
"sequence": sequence})
@@ -74,7 +74,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
if sla_action == "assert":
raise
elif sla_action == "monitor":
- LOG.warning("SLA validation failed: %s" % assertion.args)
+ LOG.warning("SLA validation failed: %s", assertion.args)
errors = assertion.args
except Exception as e:
errors = traceback.format_exc()
@@ -94,7 +94,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
queue.put(record)
- LOG.debug("runner=%(runner)s seq=%(sequence)s END" %
+ LOG.debug("runner=%(runner)s seq=%(sequence)s END",
{"runner": runner_cfg["runner_id"],
"sequence": sequence})
diff --git a/yardstick/benchmark/runners/sequence.py b/yardstick/benchmark/runners/sequence.py
index fe53412ca..3b06e2a36 100644
--- a/yardstick/benchmark/runners/sequence.py
+++ b/yardstick/benchmark/runners/sequence.py
@@ -67,7 +67,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
for value in sequence_values:
options[arg_name] = value
- LOG.debug("runner=%(runner)s seq=%(sequence)s START" %
+ LOG.debug("runner=%(runner)s seq=%(sequence)s START",
{"runner": runner_cfg["runner_id"], "sequence": sequence})
data = {}
@@ -80,7 +80,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
if sla_action == "assert":
raise
elif sla_action == "monitor":
- LOG.warning("SLA validation failed: %s" % assertion.args)
+ LOG.warning("SLA validation failed: %s", assertion.args)
errors = assertion.args
except Exception as e:
errors = traceback.format_exc()
@@ -100,7 +100,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
queue.put(record)
- LOG.debug("runner=%(runner)s seq=%(sequence)s END" %
+ LOG.debug("runner=%(runner)s seq=%(sequence)s END",
{"runner": runner_cfg["runner_id"], "sequence": sequence})
sequence += 1
diff --git a/yardstick/benchmark/scenarios/availability/actionrollbackers.py b/yardstick/benchmark/scenarios/availability/actionrollbackers.py
index 4b732a10c..38f57d476 100644
--- a/yardstick/benchmark/scenarios/availability/actionrollbackers.py
+++ b/yardstick/benchmark/scenarios/availability/actionrollbackers.py
@@ -28,8 +28,8 @@ class AttackerRollbacker(ActionRollbacker):
def rollback(self):
LOG.debug(
- "\033[93m recovering attacker %s \033[0m"
- % (self.underlyingAttacker.key))
+ "\033[93m recovering attacker %s \033[0m",
+ self.underlyingAttacker.key)
self.underlyingAttacker.recover()
@@ -40,6 +40,6 @@ class OperationRollbacker(ActionRollbacker):
def rollback(self):
LOG.debug(
- "\033[93m rollback operation %s \033[0m"
- % (self.underlyingOperation.key))
+ "\033[93m rollback operation %s \033[0m",
+ self.underlyingOperation.key)
self.underlyingOperation.rollback()
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py
index 6561f6b65..3b1f8ef76 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py
@@ -24,7 +24,7 @@ def _execute_shell_command(command, stdin=None):
except Exception:
exitcode = -1
output = traceback.format_exc()
- LOG.error("exec command '%s' error:\n " % command)
+ LOG.error("exec command '%s' error:\n ", command)
LOG.error(traceback.format_exc())
return exitcode, output
@@ -34,7 +34,7 @@ class BaremetalAttacker(BaseAttacker):
__attacker_type__ = 'bare-metal-down'
def setup(self):
- LOG.debug("config:%s context:%s" % (self._config, self._context))
+ LOG.debug("config:%s context:%s", self._config, self._context)
host = self._context.get(self._config['host'], None)
ip = host.get("ip", None)
user = host.get("user", "root")
@@ -65,10 +65,10 @@ class BaremetalAttacker(BaseAttacker):
"/bin/sh -s {0} -W 10".format(self.host_ip),
stdin=open(self.check_script, "r"))
- LOG.debug("check ret: %s out:%s err:%s" %
- (exit_status, stdout, stderr))
+ LOG.debug("check ret: %s out:%s err:%s",
+ exit_status, stdout, stderr)
if not stdout or "running" not in stdout:
- LOG.info("the host (ipmi_ip:%s) is not running!" % self.ipmi_ip)
+ LOG.info("the host (ipmi_ip:%s) is not running!", self.ipmi_ip)
return False
return True
@@ -76,8 +76,8 @@ class BaremetalAttacker(BaseAttacker):
def inject_fault(self):
exit_status, stdout, stderr = self.connection.execute(
"shutdown -h now")
- LOG.debug("inject fault ret: %s out:%s err:%s" %
- (exit_status, stdout, stderr))
+ LOG.debug("inject fault ret: %s out:%s err:%s",
+ exit_status, stdout, stderr)
if not exit_status:
LOG.info("inject fault success")
@@ -91,7 +91,7 @@ class BaremetalAttacker(BaseAttacker):
ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
pwd = host.get("pwd", None)
- LOG.debug("jump_host ip:%s user:%s" % (ip, user))
+ LOG.debug("jump_host ip:%s user:%s", ip, user)
self.jump_connection = ssh.SSH(user, ip, password=pwd,
port=ssh_port)
self.jump_connection.wait(timeout=600)
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
index 5e7716e49..a452c37ac 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
@@ -20,7 +20,7 @@ class GeneralAttacker(BaseAttacker):
__attacker_type__ = 'general-attacker'
def setup(self):
- LOG.debug("config:%s context:%s" % (self._config, self._context))
+ LOG.debug("config:%s context:%s", self._config, self._context)
host = self._context.get(self._config['host'], None)
ip = host.get("ip", None)
user = host.get("user", "root")
@@ -79,8 +79,8 @@ class GeneralAttacker(BaseAttacker):
.format(stdout))
else:
LOG.error(
- "the inject_fault's error, stdout:%s, stderr:%s" %
- (stdout, stderr))
+ "the inject_fault's error, stdout:%s, stderr:%s",
+ stdout, stderr)
def recover(self):
if "rollback_parameter" in self._config:
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py
index 0a844f56c..2ccc231da 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py
@@ -19,7 +19,7 @@ class ProcessAttacker(BaseAttacker):
__attacker_type__ = 'kill-process'
def setup(self):
- LOG.debug("config:%s context:%s" % (self._config, self._context))
+ LOG.debug("config:%s context:%s", self._config, self._context)
host = self._context.get(self._config['host'], None)
ip = host.get("ip", None)
user = host.get("user", "root")
@@ -54,8 +54,8 @@ class ProcessAttacker(BaseAttacker):
return True
else:
LOG.error(
- "the host envrioment is error, stdout:%s, stderr:%s" %
- (stdout, stderr))
+ "the host envrioment is error, stdout:%s, stderr:%s",
+ stdout, stderr)
return False
def inject_fault(self):
diff --git a/yardstick/benchmark/scenarios/availability/attacker/baseattacker.py b/yardstick/benchmark/scenarios/availability/attacker/baseattacker.py
index 78276efa2..f96e57728 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/baseattacker.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/baseattacker.py
@@ -26,7 +26,7 @@ class AttackerMgr(object):
self._attacker_list = []
def init_attackers(self, attacker_cfgs, context):
- LOG.debug("attackerMgr confg: %s" % attacker_cfgs)
+ LOG.debug("attackerMgr confg: %s", attacker_cfgs)
for cfg in attacker_cfgs:
attacker_cls = BaseAttacker.get_attacker_cls(cfg)
diff --git a/yardstick/benchmark/scenarios/availability/director.py b/yardstick/benchmark/scenarios/availability/director.py
index 267933dd0..104c68380 100644
--- a/yardstick/benchmark/scenarios/availability/director.py
+++ b/yardstick/benchmark/scenarios/availability/director.py
@@ -63,7 +63,7 @@ class Director(object):
def createActionPlayer(self, type, key):
LOG.debug(
- "the type of current action is %s, the key is %s" % (type, key))
+ "the type of current action is %s, the key is %s", type, key)
if type == ActionType.ATTACKER:
return actionplayers.AttackerPlayer(self.attackerMgr[key])
if type == ActionType.MONITOR:
@@ -77,13 +77,13 @@ class Director(object):
def createActionRollbacker(self, type, key):
LOG.debug(
- "the type of current action is %s, the key is %s" % (type, key))
+ "the type of current action is %s, the key is %s", type, key)
if type == ActionType.ATTACKER:
return actionrollbackers.AttackerRollbacker(self.attackerMgr[key])
if type == ActionType.OPERATION:
return actionrollbackers.OperationRollbacker(
self.operationMgr[key])
- LOG.debug("no rollbacker created for %s" % (key))
+ LOG.debug("no rollbacker created for %s", key)
def verify(self):
result = True
diff --git a/yardstick/benchmark/scenarios/availability/monitor/basemonitor.py b/yardstick/benchmark/scenarios/availability/monitor/basemonitor.py
index d26c99c75..38d1c4e5c 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/basemonitor.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/basemonitor.py
@@ -27,7 +27,7 @@ class MonitorMgr(object):
self._monitor_list = []
def init_monitors(self, monitor_cfgs, context):
- LOG.debug("monitorMgr config: %s" % monitor_cfgs)
+ LOG.debug("monitorMgr config: %s", monitor_cfgs)
for monitor_cfg in monitor_cfgs:
monitor_type = monitor_cfg["monitor_type"]
@@ -87,7 +87,7 @@ class BaseMonitor(multiprocessing.Process):
return os.path.join(base_path, path)
def run(self):
- LOG.debug("config:%s context:%s" % (self._config, self._context))
+ LOG.debug("config:%s context:%s", self._config, self._context)
self.setup()
monitor_time = self._config.get("monitor_time", 0)
@@ -140,7 +140,7 @@ class BaseMonitor(multiprocessing.Process):
def wait_monitor(self):
self.join()
self._result = self._queue.get()
- LOG.debug("the monitor result:%s" % self._result)
+ LOG.debug("the monitor result:%s", self._result)
def setup(self): # pragma: no cover
pass
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py
index b55cc3134..366d16e73 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py
@@ -24,7 +24,7 @@ def _execute_shell_command(command):
except Exception:
exitcode = -1
output = traceback.format_exc()
- LOG.error("exec command '%s' error:\n " % command)
+ LOG.error("exec command '%s' error:\n ", command)
LOG.error(traceback.format_exc())
return exitcode, output
@@ -62,8 +62,8 @@ class MonitorOpenstackCmd(basemonitor.BaseMonitor):
"/bin/bash -s '{0}'".format(self.cmd),
stdin=open(self.check_script, "r"))
- LOG.debug("the ret stats: %s stdout: %s stderr: %s" %
- (exit_status, stdout, stderr))
+ LOG.debug("the ret stats: %s stdout: %s stderr: %s",
+ exit_status, stdout, stderr)
else:
exit_status, stdout = _execute_shell_command(self.cmd)
if exit_status:
@@ -72,10 +72,10 @@ class MonitorOpenstackCmd(basemonitor.BaseMonitor):
def verify_SLA(self):
outage_time = self._result.get('outage_time', None)
- LOG.debug("the _result:%s" % self._result)
+ LOG.debug("the _result:%s", self._result)
max_outage_time = self._config["sla"]["max_outage_time"]
if outage_time > max_outage_time:
- LOG.info("SLA failure: %f > %f" % (outage_time, max_outage_time))
+ LOG.info("SLA failure: %f > %f", outage_time, max_outage_time)
return False
else:
LOG.info("the sla is passed")
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
index f9ddb2505..359cde671 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
@@ -61,14 +61,14 @@ class GeneralMonitor(basemonitor.BaseMonitor):
return True
def verify_SLA(self):
- LOG.debug("the _result:%s" % self._result)
+ LOG.debug("the _result:%s", self._result)
outage_time = self._result.get('outage_time', None)
max_outage_time = self._config["sla"]["max_outage_time"]
if outage_time is None:
LOG.error("There is no outage_time in monitor result.")
return False
if outage_time > max_outage_time:
- LOG.error("SLA failure: %f > %f" % (outage_time, max_outage_time))
+ LOG.error("SLA failure: %f > %f", outage_time, max_outage_time)
return False
else:
return True
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py
index 403ec4d37..a88b8d42e 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py
@@ -39,17 +39,17 @@ class MonitorProcess(basemonitor.BaseMonitor):
"/bin/sh -s {0}".format(self.process_name),
stdin=open(self.check_script, "r"))
if not stdout or int(stdout) <= 0:
- LOG.info("the process (%s) is not running!" % self.process_name)
+ LOG.info("the process (%s) is not running!", self.process_name)
return False
return True
def verify_SLA(self):
- LOG.debug("the _result:%s" % self._result)
+ LOG.debug("the _result:%s", self._result)
outage_time = self._result.get('outage_time', None)
max_outage_time = self._config["sla"]["max_recover_time"]
if outage_time > max_outage_time:
- LOG.error("SLA failure: %f > %f" % (outage_time, max_outage_time))
+ LOG.error("SLA failure: %f > %f", outage_time, max_outage_time)
return False
else:
return True
diff --git a/yardstick/benchmark/scenarios/availability/operation/baseoperation.py b/yardstick/benchmark/scenarios/availability/operation/baseoperation.py
index e776e87ae..80efd1b02 100644
--- a/yardstick/benchmark/scenarios/availability/operation/baseoperation.py
+++ b/yardstick/benchmark/scenarios/availability/operation/baseoperation.py
@@ -26,7 +26,7 @@ class OperationMgr(object):
self._operation_list = []
def init_operations(self, operation_cfgs, context):
- LOG.debug("operationMgr confg: %s" % operation_cfgs)
+ LOG.debug("operationMgr confg: %s", operation_cfgs)
for cfg in operation_cfgs:
operation_type = cfg['operation_type']
operation_cls = BaseOperation.get_operation_cls(operation_type)
diff --git a/yardstick/benchmark/scenarios/availability/operation/operation_general.py b/yardstick/benchmark/scenarios/availability/operation/operation_general.py
index aa28472f7..b3a20c344 100644
--- a/yardstick/benchmark/scenarios/availability/operation/operation_general.py
+++ b/yardstick/benchmark/scenarios/availability/operation/operation_general.py
@@ -19,7 +19,7 @@ class GeneralOperaion(BaseOperation):
__operation__type__ = "general-operation"
def setup(self):
- LOG.debug("config:%s context:%s" % (self._config, self._context))
+ LOG.debug("config:%s context:%s", self._config, self._context)
host = self._context.get(self._config['host'], None)
ip = host.get("ip", None)
user = host.get("user", "root")
@@ -67,8 +67,8 @@ class GeneralOperaion(BaseOperation):
LOG.debug("success,the operation's output is: {0}".format(stdout))
else:
LOG.error(
- "the operation's error, stdout:%s, stderr:%s" %
- (stdout, stderr))
+ "the operation's error, stdout:%s, stderr:%s",
+ stdout, stderr)
def rollback(self):
if "rollback_parameter" in self._config:
diff --git a/yardstick/benchmark/scenarios/availability/result_checker/baseresultchecker.py b/yardstick/benchmark/scenarios/availability/result_checker/baseresultchecker.py
index 1bdb9f2c2..a24f26e81 100644
--- a/yardstick/benchmark/scenarios/availability/result_checker/baseresultchecker.py
+++ b/yardstick/benchmark/scenarios/availability/result_checker/baseresultchecker.py
@@ -26,7 +26,7 @@ class ResultCheckerMgr(object):
self._result_checker_list = []
def init_ResultChecker(self, resultchecker_cfgs, context):
- LOG.debug("resultcheckerMgr confg: %s" % resultchecker_cfgs)
+ LOG.debug("resultcheckerMgr confg: %s", resultchecker_cfgs)
for cfg in resultchecker_cfgs:
resultchecker_type = cfg['checker_type']
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 ae896c2b2..8c9d16026 100644
--- a/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py
+++ b/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py
@@ -20,7 +20,7 @@ class GeneralResultChecker(BaseResultChecker):
__result_checker__type__ = "general-result-checker"
def setup(self):
- LOG.debug("config:%s context:%s" % (self._config, self._context))
+ LOG.debug("config:%s context:%s", self._config, self._context)
host = self._context.get(self._config['host'], None)
ip = host.get("ip", None)
user = host.get("user", "root")
@@ -67,7 +67,7 @@ class GeneralResultChecker(BaseResultChecker):
LOG.debug("action script of the operation is: {0}"
.format(self.verify_script))
- LOG.debug("exit_status ,stdout : {0} ,{1}".format(exit_status, stdout))
+ LOG.debug("exit_status ,stdout : %s ,%s", exit_status, stdout)
if exit_status == 0 and stdout:
self.actualResult = stdout
LOG.debug("verifying resultchecker: {0}".format(self.key))
@@ -104,6 +104,6 @@ class GeneralResultChecker(BaseResultChecker):
LOG.error(stderr)
LOG.debug(
- "verifying resultchecker: {0},the result is : {1}"
- .format(self.key, self.success))
+ "verifying resultchecker: %s,the result is : %s", self.key,
+ self.success)
return self.success
diff --git a/yardstick/benchmark/scenarios/availability/scenario_general.py b/yardstick/benchmark/scenarios/availability/scenario_general.py
index 0a128aa09..b064c6724 100644
--- a/yardstick/benchmark/scenarios/availability/scenario_general.py
+++ b/yardstick/benchmark/scenarios/availability/scenario_general.py
@@ -22,7 +22,7 @@ class ScenarioGeneral(base.Scenario):
def __init__(self, scenario_cfg, context_cfg):
LOG.debug(
- "scenario_cfg:%s context_cfg:%s" % (scenario_cfg, context_cfg))
+ "scenario_cfg:%s context_cfg:%s", scenario_cfg, context_cfg)
self.scenario_cfg = scenario_cfg
self.context_cfg = context_cfg
diff --git a/yardstick/benchmark/scenarios/availability/serviceha.py b/yardstick/benchmark/scenarios/availability/serviceha.py
index 10f2c4f45..46a197c3b 100755
--- a/yardstick/benchmark/scenarios/availability/serviceha.py
+++ b/yardstick/benchmark/scenarios/availability/serviceha.py
@@ -21,8 +21,8 @@ class ServiceHA(base.Scenario):
def __init__(self, scenario_cfg, context_cfg):
LOG.debug(
- "scenario_cfg:%s context_cfg:%s" %
- (scenario_cfg, context_cfg))
+ "scenario_cfg:%s context_cfg:%s",
+ scenario_cfg, context_cfg)
self.scenario_cfg = scenario_cfg
self.context_cfg = context_cfg
self.setup_done = False
diff --git a/yardstick/benchmark/scenarios/compute/cachestat.py b/yardstick/benchmark/scenarios/compute/cachestat.py
index 117702098..25300dd46 100644
--- a/yardstick/benchmark/scenarios/compute/cachestat.py
+++ b/yardstick/benchmark/scenarios/compute/cachestat.py
@@ -92,7 +92,7 @@ class CACHEstat(base.Scenario):
def _execute_command(self, cmd):
"""Execute a command on server."""
- LOG.info("Executing: %s" % cmd)
+ LOG.info("Executing: %s", cmd)
status, stdout, stderr = self.client.execute(cmd)
if status:
raise RuntimeError("Failed executing command: ",
diff --git a/yardstick/benchmark/scenarios/compute/cpuload.py b/yardstick/benchmark/scenarios/compute/cpuload.py
index a7fae44ec..9d71038ef 100644
--- a/yardstick/benchmark/scenarios/compute/cpuload.py
+++ b/yardstick/benchmark/scenarios/compute/cpuload.py
@@ -96,7 +96,7 @@ class CPULoad(base.Scenario):
def _execute_command(self, cmd):
"""Execute a command on server."""
- LOG.info("Executing: %s" % cmd)
+ LOG.info("Executing: %s", cmd)
status, stdout, stderr = self.client.execute(cmd)
if status != 0:
raise RuntimeError("Failed executing command: ",
diff --git a/yardstick/benchmark/scenarios/compute/cyclictest.py b/yardstick/benchmark/scenarios/compute/cyclictest.py
index 6a1afe223..a6c4d95cf 100644
--- a/yardstick/benchmark/scenarios/compute/cyclictest.py
+++ b/yardstick/benchmark/scenarios/compute/cyclictest.py
@@ -69,14 +69,14 @@ class Cyclictest(base.Scenario):
rpm_dir = setup_options["rpm_dir"]
script_dir = setup_options["script_dir"]
image_dir = setup_options["image_dir"]
- LOG.debug("Send RPMs from %s to workspace %s" %
- (rpm_dir, self.WORKSPACE))
+ LOG.debug("Send RPMs from %s to workspace %s",
+ rpm_dir, self.WORKSPACE)
client.put(rpm_dir, self.WORKSPACE, recursive=True)
- LOG.debug("Send scripts from %s to workspace %s" %
- (script_dir, self.WORKSPACE))
+ LOG.debug("Send scripts from %s to workspace %s",
+ script_dir, self.WORKSPACE)
client.put(script_dir, self.WORKSPACE, recursive=True)
- LOG.debug("Send guest image from %s to workspace %s" %
- (image_dir, self.WORKSPACE))
+ LOG.debug("Send guest image from %s to workspace %s",
+ image_dir, self.WORKSPACE)
client.put(image_dir, self.WORKSPACE, recursive=True)
def _connect_host(self):
@@ -102,7 +102,7 @@ class Cyclictest(base.Scenario):
self.guest.wait(timeout=600)
def _run_setup_cmd(self, client, cmd):
- LOG.debug("Run cmd: %s" % cmd)
+ LOG.debug("Run cmd: %s", cmd)
status, stdout, stderr = client.execute(cmd)
if status:
if re.search(self.REBOOT_CMD_PATTERN, cmd):
diff --git a/yardstick/benchmark/scenarios/compute/memload.py b/yardstick/benchmark/scenarios/compute/memload.py
index 48088f87c..e1ba93d02 100644
--- a/yardstick/benchmark/scenarios/compute/memload.py
+++ b/yardstick/benchmark/scenarios/compute/memload.py
@@ -61,7 +61,7 @@ class MEMLoad(base.Scenario):
def _execute_command(self, cmd):
"""Execute a command on server."""
- LOG.info("Executing: %s" % cmd)
+ LOG.info("Executing: %s", cmd)
status, stdout, stderr = self.client.execute(cmd)
if status:
raise RuntimeError("Failed executing command: ",
diff --git a/yardstick/benchmark/scenarios/networking/netperf_benchmark.bash b/yardstick/benchmark/scenarios/networking/netperf_benchmark.bash
index a425c5df0..f6245c9cd 100755
--- a/yardstick/benchmark/scenarios/networking/netperf_benchmark.bash
+++ b/yardstick/benchmark/scenarios/networking/netperf_benchmark.bash
@@ -12,6 +12,7 @@
set -e
# Commandline arguments
+OPTIONS_SIZE="$#"
OPTIONS="$@"
OUTPUT_FILE=/tmp/netperf-out.log
@@ -24,14 +25,40 @@ run_netperf()
# write the result to stdout in json format
output_json()
{
- mean=$(awk '/\/s/{print $3}' $OUTPUT_FILE)
- troughput=$(awk '/\/s/{print $1}' $OUTPUT_FILE)
- unit=$(awk '/\/s/{print $2}' $OUTPUT_FILE)
- echo -e "{ \
- \"mean_latency\":\"$mean\", \
- \"troughput\":\"$troughput\", \
- \"troughput_unit\":\"$unit\" \
- }"
+ #ARR=($OPTIONS)
+ #declare -p ARR
+ read -r -a ARR <<< "$OPTIONS"
+ opt_size=0
+ while [ $opt_size -lt "$OPTIONS_SIZE" ]
+ do
+ if [ "${ARR[$opt_size]}" = "-O" ]
+ then
+ break
+ fi
+ opt_size=$((opt_size+1))
+ done
+ opt_size=$((opt_size+1))
+ out_opt="${ARR[$opt_size]}"
+ IFS=, read -r -a PARTS <<< "$out_opt"
+ #declare -p PARTS
+ part_num=${#PARTS[*]}
+ tran_num=0
+ for f in "${PARTS[@]}"
+ do
+ array_name[$tran_num]=$(echo "$f" | tr '[A-Z]' '[a-z]')
+ tran_num=$((tran_num+1))
+ done
+ read -r -a DATA_PARTS <<< "$(sed -n '$p' $OUTPUT_FILE)"
+ out_str="{"
+ for((i=0;i<part_num-1;i++))
+ do
+ modify_str=\"${array_name[i]}\":\"${DATA_PARTS[i]}\",
+ out_str=$out_str$modify_str
+ done
+ modify_str=\"${array_name[part_num-1]}\":\"${DATA_PARTS[part_num-1]}\"
+ out_str=$out_str$modify_str"}"
+
+ echo -e "$out_str"
}
# main entry
@@ -44,4 +71,4 @@ main()
output_json
}
-main \ No newline at end of file
+main
diff --git a/yardstick/benchmark/scenarios/networking/netperf_install.bash b/yardstick/benchmark/scenarios/networking/netperf_install.bash
index eaa9f530a..0e3808f9c 100755
--- a/yardstick/benchmark/scenarios/networking/netperf_install.bash
+++ b/yardstick/benchmark/scenarios/networking/netperf_install.bash
@@ -11,6 +11,13 @@
set -e
+svc="netserver"
+if pgrep $svc >/dev/null
+then
+ echo "$svc have existed, exit!"
+ exit 0
+fi
+
echo "===Install netperf before test begin!!!==="
cp /etc/apt/sources.list /etc/apt/sources.list_bkp
cp /etc/resolv.conf /etc/resolv.conf_bkp
@@ -30,3 +37,4 @@ sudo apt-get install -y netperf
service netperf start
echo "===Install netperf before test end!!!==="
+
diff --git a/yardstick/benchmark/scenarios/networking/netperf_node.py b/yardstick/benchmark/scenarios/networking/netperf_node.py
index 1578da7d8..a76982b6f 100755
--- a/yardstick/benchmark/scenarios/networking/netperf_node.py
+++ b/yardstick/benchmark/scenarios/networking/netperf_node.py
@@ -86,9 +86,8 @@ class NetperfNode(base.Scenario):
self.client.wait(timeout=600)
# copy script to host
- self.client.run("cat > ~/netperf.sh",
- stdin=open(self.target_script, "rb"))
-
+ with open(self.target_script, "rb") as file_run:
+ self.client.run("cat > ~/netperf.sh", stdin=file_run)
# copy script to host and client
self.install_script = pkg_resources.resource_filename(
'yardstick.benchmark.scenarios.networking',
@@ -97,14 +96,14 @@ class NetperfNode(base.Scenario):
'yardstick.benchmark.scenarios.networking',
NetperfNode.REMOVE_SCRIPT)
- self.server.run("cat > ~/netperf_install.sh",
- stdin=open(self.install_script, "rb"))
- self.client.run("cat > ~/netperf_install.sh",
- stdin=open(self.install_script, "rb"))
- self.server.run("cat > ~/netperf_remove.sh",
- stdin=open(self.remove_script, "rb"))
- self.client.run("cat > ~/netperf_remove.sh",
- stdin=open(self.remove_script, "rb"))
+ with open(self.install_script, "rb") as file_install:
+ self.server.run("cat > ~/netperf_install.sh", stdin=file_install)
+ with open(self.install_script, "rb") as file_install:
+ self.client.run("cat > ~/netperf_install.sh", stdin=file_install)
+ with open(self.remove_script, "rb") as file_remove:
+ self.server.run("cat > ~/netperf_remove.sh", stdin=file_remove)
+ with open(self.remove_script, "rb") as file_remove:
+ self.client.run("cat > ~/netperf_remove.sh", stdin=file_remove)
self.server.execute("sudo bash netperf_install.sh")
self.client.execute("sudo bash netperf_install.sh")
@@ -131,10 +130,12 @@ class NetperfNode(base.Scenario):
else:
testlen = 20
- cmd_args = "-H %s -l %s -t %s" % (ipaddr, testlen, testname)
+ cmd_args = "-H %s -l %s -t %s -c -C" % (ipaddr, testlen, testname)
# get test specific options
- default_args = "-O 'THROUGHPUT,THROUGHPUT_UNITS,MEAN_LATENCY'"
+ output_opt = options.get(
+ "output_opt", "THROUGHPUT,THROUGHPUT_UNITS,MEAN_LATENCY")
+ default_args = "-O %s" % output_opt
cmd_args += " -- %s" % default_args
option_pair_list = [("send_msg_size", "-m"),
("recv_msg_size", "-M"),
diff --git a/yardstick/benchmark/scenarios/networking/netutilization.py b/yardstick/benchmark/scenarios/networking/netutilization.py
index ecde7568e..1ea92cca3 100644
--- a/yardstick/benchmark/scenarios/networking/netutilization.py
+++ b/yardstick/benchmark/scenarios/networking/netutilization.py
@@ -83,7 +83,7 @@ class NetUtilization(base.Scenario):
def _execute_command(self, cmd):
"""Execute a command on target."""
- LOG.info("Executing: %s" % cmd)
+ LOG.info("Executing: %s", cmd)
status, stdout, stderr = self.client.execute(cmd)
if status:
raise RuntimeError("Failed executing command: ",
diff --git a/yardstick/benchmark/scenarios/storage/storperf.py b/yardstick/benchmark/scenarios/storage/storperf.py
index d39c23aa2..06c329d4d 100644
--- a/yardstick/benchmark/scenarios/storage/storperf.py
+++ b/yardstick/benchmark/scenarios/storage/storperf.py
@@ -75,8 +75,8 @@ class StorPerf(base.Scenario):
setup_query_content = json.loads(setup_query.content)
if setup_query_content["stack_created"]:
self.setup_done = True
- LOG.debug("stack_created: %s"
- % setup_query_content["stack_created"])
+ LOG.debug("stack_created: %s",
+ setup_query_content["stack_created"])
def setup(self):
"""Set the configuration."""
@@ -88,8 +88,8 @@ class StorPerf(base.Scenario):
if env_argument in self.options:
env_args[env_argument] = self.options[env_argument]
- LOG.info("Creating a stack on node %s with parameters %s" %
- (self.target, env_args))
+ LOG.info("Creating a stack on node %s with parameters %s",
+ self.target, env_args)
setup_res = requests.post('http://%s:5000/api/v1.0/configurations'
% self.target, json=env_args)
@@ -99,7 +99,7 @@ class StorPerf(base.Scenario):
raise RuntimeError("Failed to create a stack, error message:",
setup_res_content["message"])
elif setup_res.status_code == 200:
- LOG.info("stack_id: %s" % setup_res_content["stack_id"])
+ LOG.info("stack_id: %s", setup_res_content["stack_id"])
while not self.setup_done:
self._query_setup_state()
@@ -148,7 +148,7 @@ class StorPerf(base.Scenario):
if job_argument in self.options:
job_args[job_argument] = self.options[job_argument]
- LOG.info("Starting a job with parameters %s" % job_args)
+ LOG.info("Starting a job with parameters %s", job_args)
job_res = requests.post('http://%s:5000/api/v1.0/jobs' % self.target,
json=job_args)
@@ -159,7 +159,7 @@ class StorPerf(base.Scenario):
job_res_content["message"])
elif job_res.status_code == 200:
job_id = job_res_content["job_id"]
- LOG.info("Started job id: %s..." % job_id)
+ LOG.info("Started job id: %s...", job_id)
time.sleep(self.timeout)
terminate_res = requests.delete('http://%s:5000/api/v1.0/jobs' %
diff --git a/yardstick/cmd/cli.py b/yardstick/cmd/cli.py
index 3896ce47c..cac3dc5bf 100644
--- a/yardstick/cmd/cli.py
+++ b/yardstick/cmd/cli.py
@@ -19,11 +19,13 @@ from pkg_resources import get_distribution
from argparse import RawDescriptionHelpFormatter
from oslo_config import cfg
+from yardstick import _init_logging, LOG
from yardstick.cmd.commands import task
from yardstick.cmd.commands import runner
from yardstick.cmd.commands import scenario
from yardstick.cmd.commands import testcase
from yardstick.cmd.commands import plugin
+from yardstick.cmd.commands import env
CONF = cfg.CONF
cli_opts = [
@@ -62,10 +64,12 @@ class YardstickCLI():
'runner': runner.RunnerCommands,
'scenario': scenario.ScenarioCommands,
'testcase': testcase.TestcaseCommands,
- 'plugin': plugin.PluginCommands
+ 'plugin': plugin.PluginCommands,
+ 'env': env.EnvCommand
}
def __init__(self):
+ self.opts = []
self._version = 'yardstick version %s ' % \
get_distribution('yardstick').version
@@ -111,7 +115,12 @@ 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):
@@ -121,15 +130,12 @@ class YardstickCLI():
def _handle_global_opts(self):
- # handle global opts
- logger = logging.getLogger('yardstick')
- logger.setLevel(logging.WARNING)
-
+ _init_logging()
if CONF.verbose:
- logger.setLevel(logging.INFO)
+ LOG.setLevel(logging.INFO)
if CONF.debug:
- logger.setLevel(logging.DEBUG)
+ LOG.setLevel(logging.DEBUG)
def _dispath_func_notask(self):
@@ -143,6 +149,11 @@ class YardstickCLI():
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()
@@ -153,6 +164,8 @@ class YardstickCLI():
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()
@@ -162,3 +175,5 @@ class YardstickCLI():
self._handle_global_opts()
self._dispath_func_task(task_id)
+
+ self._clear_config_opts()
diff --git a/yardstick/cmd/commands/env.py b/yardstick/cmd/commands/env.py
new file mode 100644
index 000000000..d9c0c0a3f
--- /dev/null
+++ b/yardstick/cmd/commands/env.py
@@ -0,0 +1,17 @@
+##############################################################################
+# 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 yardstick.common.httpClient import HttpClient
+
+
+class EnvCommand(object):
+
+ def do_influxdb(self, args):
+ url = 'http://localhost:5000/yardstick/env/action'
+ data = {'action': 'createInfluxDBContainer'}
+ HttpClient().post(url, data)
diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py
index 40b29a717..8fbc82f0e 100644
--- a/yardstick/common/constants.py
+++ b/yardstick/common/constants.py
@@ -1,3 +1,10 @@
CONFIG_SAMPLE = '/etc/yardstick/config.yaml'
RELENG_DIR = 'releng.dir'
+
+DOCKER_URL = 'unix://var/run/docker.sock'
+
+# database config
+USER = 'root'
+PASSWORD = 'root'
+DATABASE = 'yardstick'
diff --git a/yardstick/common/httpClient.py b/yardstick/common/httpClient.py
new file mode 100644
index 000000000..b6959b400
--- /dev/null
+++ b/yardstick/common/httpClient.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 json
+import logging
+
+import requests
+
+logger = logging.getLogger(__name__)
+
+
+class HttpClient(object):
+
+ def post(self, url, data):
+ data = json.dumps(data)
+ headers = {'Content-Type': 'application/json'}
+ try:
+ response = requests.post(url, data=data, headers=headers)
+ result = response.json()
+ logger.debug('The result is: %s', result)
+ except Exception as e:
+ logger.debug('Failed: %s', e)
diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py
index d639fb66a..afbe4e8ec 100644
--- a/yardstick/common/utils.py
+++ b/yardstick/common/utils.py
@@ -18,6 +18,7 @@
import os
import sys
import yaml
+import errno
from oslo_utils import importutils
import yardstick
@@ -91,3 +92,11 @@ def get_para_from_yaml(file_path, args):
else:
print 'file not exist'
return None
+
+
+def makedirs(d):
+ try:
+ os.makedirs(d)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
diff --git a/yardstick/dispatcher/file.py b/yardstick/dispatcher/file.py
index ab67796e9..c2cc265ba 100644
--- a/yardstick/dispatcher/file.py
+++ b/yardstick/dispatcher/file.py
@@ -17,6 +17,7 @@
# ceilometer/ceilometer/dispatcher/file.py
import logging
+import logging.handlers
import json
from oslo_config import cfg
diff --git a/yardstick/dispatcher/http.py b/yardstick/dispatcher/http.py
index 2298d00cc..98e772dd8 100644
--- a/yardstick/dispatcher/http.py
+++ b/yardstick/dispatcher/http.py
@@ -81,14 +81,14 @@ class HttpDispatcher(DispatchBase):
case_name = v["scenario_cfg"]["tc"]
break
if case_name == "":
- LOG.error('Test result : %s' % json.dumps(self.result))
+ LOG.error('Test result : %s', json.dumps(self.result))
LOG.error('The case_name cannot be found, no data will be posted.')
return
self.result["case_name"] = case_name
try:
- LOG.debug('Test result : %s' % json.dumps(self.result))
+ LOG.debug('Test result : %s', json.dumps(self.result))
res = requests.post(self.target,
data=json.dumps(self.result),
headers=self.headers,
diff --git a/yardstick/dispatcher/influxdb.py b/yardstick/dispatcher/influxdb.py
index 8673253b4..fc9f3e932 100644
--- a/yardstick/dispatcher/influxdb.py
+++ b/yardstick/dispatcher/influxdb.py
@@ -127,7 +127,7 @@ class InfluxdbDispatcher(DispatchBase):
return make_lines(msg).encode('utf-8')
def record_result_data(self, data):
- LOG.debug('Test result : %s' % json.dumps(data))
+ LOG.debug('Test result : %s', json.dumps(data))
self.raw_result.append(data)
if self.target == '':
# if the target was not set, do not do anything
@@ -148,13 +148,13 @@ class InfluxdbDispatcher(DispatchBase):
return 0
if self.tc == "":
- LOG.error('Test result : %s' % json.dumps(data))
+ LOG.error('Test result : %s', json.dumps(data))
LOG.error('The case_name cannot be found, no data will be posted.')
return -1
try:
line = self._data_to_line_protocol(data)
- LOG.debug('Test result line format : %s' % line)
+ LOG.debug('Test result line format : %s', line)
res = requests.post(self.influxdb_url,
data=line,
auth=(self.username, self.password),
@@ -171,5 +171,5 @@ class InfluxdbDispatcher(DispatchBase):
return 0
def flush_result_data(self):
- LOG.debug('Test result all : %s' % json.dumps(self.raw_result))
+ LOG.debug('Test result all : %s', json.dumps(self.raw_result))
return 0
diff --git a/yardstick/ssh.py b/yardstick/ssh.py
index e0e2f83ee..8485dccd0 100644
--- a/yardstick/ssh.py
+++ b/yardstick/ssh.py
@@ -57,17 +57,16 @@ Eventlet:
sshclient = eventlet.import_patched("opentstack.common.sshclient")
"""
-
+import os
import select
import socket
import time
+import logging
import paramiko
from scp import SCPClient
import six
-import logging
-LOG = logging.getLogger(__name__)
DEFAULT_PORT = 22
@@ -84,7 +83,7 @@ class SSH(object):
"""Represent ssh connection."""
def __init__(self, user, host, port=DEFAULT_PORT, pkey=None,
- key_filename=None, password=None):
+ key_filename=None, password=None, name=None):
"""Initialize SSH client.
:param user: ssh username
@@ -94,6 +93,11 @@ class SSH(object):
:param key_filename: private key filename
:param password: password
"""
+ self.name = name
+ if name:
+ self.log = logging.getLogger(__name__ + '.' + self.name)
+ else:
+ self.log = logging.getLogger(__name__)
self.user = user
self.host = host
@@ -103,6 +107,13 @@ class SSH(object):
self.password = password
self.key_filename = key_filename
self._client = False
+ # paramiko loglevel debug will output ssh protocl debug
+ # we don't ever really want that unless we are debugging paramiko
+ # ssh issues
+ if os.environ.get("PARAMIKO_DEBUG", "").lower() == "true":
+ logging.getLogger("paramiko").setLevel(logging.DEBUG)
+ else:
+ logging.getLogger("paramiko").setLevel(logging.WARN)
def _get_pkey(self, key):
if isinstance(key, six.string_types):
@@ -192,14 +203,14 @@ class SSH(object):
if session.recv_ready():
data = session.recv(4096)
- LOG.debug("stdout: %r" % data)
+ self.log.debug("stdout: %r", data)
if stdout is not None:
stdout.write(data)
continue
if session.recv_stderr_ready():
stderr_data = session.recv_stderr(4096)
- LOG.debug("stderr: %r" % stderr_data)
+ self.log.debug("stderr: %r", stderr_data)
if stderr is not None:
stderr.write(stderr_data)
continue
@@ -264,10 +275,10 @@ class SSH(object):
try:
return self.execute("uname")
except (socket.error, SSHError) as e:
- LOG.debug("Ssh is still unavailable: %r" % e)
+ self.log.debug("Ssh is still unavailable: %r", e)
time.sleep(interval)
if time.time() > (start_time + timeout):
- raise SSHTimeout("Timeout waiting for '%s'" % self.host)
+ raise SSHTimeout("Timeout waiting for '%s'", self.host)
def put(self, files, remote_path=b'.', recursive=False):
client = self._get_client()