summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/server.py11
-rw-r--r--api/yardstick.ini2
-rw-r--r--docker/Dockerfile1
-rw-r--r--tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-ha_daily.yaml54
-rw-r--r--tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-noha_daily.yaml46
-rw-r--r--tests/unit/apiserver/resources/test_env_action.py2
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_base.py2
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py3
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py2
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py16
-rw-r--r--tox.ini1
-rw-r--r--yardstick/__init__.py5
-rw-r--r--yardstick/common/constants.py2
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py2
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py11
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json2
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json2
17 files changed, 137 insertions, 27 deletions
diff --git a/api/server.py b/api/server.py
index be7963481..1d42feffb 100644
--- a/api/server.py
+++ b/api/server.py
@@ -10,7 +10,6 @@ from __future__ import absolute_import
import inspect
import logging
-from functools import reduce
from six.moves import filter
from flasgger import Swagger
@@ -38,6 +37,10 @@ def shutdown_session(exception=None):
db_session.remove()
+for u in urlpatterns:
+ api.add_resource(u.resource, u.url, endpoint=u.endpoint)
+
+
def init_db():
def func(a):
try:
@@ -52,8 +55,10 @@ def init_db():
Base.metadata.create_all(bind=engine)
-reduce(lambda a, b: a.add_resource(b.resource, b.url,
- endpoint=b.endpoint) or a, urlpatterns, api)
+def app_wrapper(*args, **kwargs):
+ init_db()
+ return app(*args, **kwargs)
+
if __name__ == '__main__':
_init_logging()
diff --git a/api/yardstick.ini b/api/yardstick.ini
index 2ba881fc1..d2e8956e2 100644
--- a/api/yardstick.ini
+++ b/api/yardstick.ini
@@ -9,7 +9,7 @@ threads = 5
async = true
max-requests = 5000
chmod-socket = 666
-callable = app
+callable = app_wrapper
enable-threads = true
close-on-exec = 1
daemonize= /var/log/yardstick/uwsgi.log
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 23afef74e..afb2ce5c6 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -41,6 +41,7 @@ RUN apt-get update && apt-get install -y \
kpartx \
libffi-dev \
libssl-dev \
+ libzmq-dev \
python \
python-dev \
libxml2-dev \
diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-ha_daily.yaml
new file mode 100644
index 000000000..eb3f95eff
--- /dev/null
+++ b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-ha_daily.yaml
@@ -0,0 +1,54 @@
+---
+# os-nosdn-kvm_ovs_dpdk_bar-ha daily task suite
+
+schema: "yardstick:suite:0.1"
+
+name: "os-nosdn-kvm_ovs_dpdk_bar-ha"
+test_cases_dir: "tests/opnfv/test_cases/"
+test_cases:
+-
+ file_name: opnfv_yardstick_tc002.yaml
+-
+ file_name: opnfv_yardstick_tc005.yaml
+-
+ file_name: opnfv_yardstick_tc010.yaml
+-
+ file_name: opnfv_yardstick_tc011.yaml
+-
+ file_name: opnfv_yardstick_tc012.yaml
+-
+ file_name: opnfv_yardstick_tc014.yaml
+-
+ file_name: opnfv_yardstick_tc037.yaml
+-
+ file_name: opnfv_yardstick_tc055.yaml
+ constraint:
+ installer: compass
+ pod: huawei-pod1
+ task_args:
+ huawei-pod1: '{"pod_info": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml",
+ "host": "node5.yardstick-TC055"}'
+-
+ file_name: opnfv_yardstick_tc063.yaml
+ constraint:
+ installer: compass
+ pod: huawei-pod1
+ task_args:
+ huawei-pod1: '{"pod_info": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml",
+ "host": "node5.yardstick-TC063"}'
+-
+ file_name: opnfv_yardstick_tc069.yaml
+-
+ file_name: opnfv_yardstick_tc070.yaml
+-
+ file_name: opnfv_yardstick_tc071.yaml
+-
+ file_name: opnfv_yardstick_tc072.yaml
+-
+ file_name: opnfv_yardstick_tc075.yaml
+ constraint:
+ installer: compass
+ pod: huawei-pod1
+ task_args:
+ huawei-pod1: '{"pod_info": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml",
+ "host": "node1.LF"}'
diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-noha_daily.yaml
new file mode 100644
index 000000000..8d7ac7b01
--- /dev/null
+++ b/tests/opnfv/test_suites/opnfv_os-nosdn-kvm_ovs_dpdk_bar-noha_daily.yaml
@@ -0,0 +1,46 @@
+---
+# os-nosdn-kvm_ovs_dpdk_bar-noha daily task suite
+
+schema: "yardstick:suite:0.1"
+
+name: "os-nosdn-kvm_ovs_dpdk_bar-noha"
+test_cases_dir: "tests/opnfv/test_cases/"
+test_cases:
+-
+ file_name: opnfv_yardstick_tc002.yaml
+-
+ file_name: opnfv_yardstick_tc005.yaml
+-
+ file_name: opnfv_yardstick_tc010.yaml
+-
+ file_name: opnfv_yardstick_tc011.yaml
+-
+ file_name: opnfv_yardstick_tc012.yaml
+-
+ file_name: opnfv_yardstick_tc014.yaml
+-
+ file_name: opnfv_yardstick_tc037.yaml
+-
+ file_name: opnfv_yardstick_tc055.yaml
+ constraint:
+ installer: compass
+ pod: huawei-pod1
+ task_args:
+ huawei-pod1: '{"pod_info": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml",
+ "host": "node5.yardstick-TC055"}'
+-
+ file_name: opnfv_yardstick_tc063.yaml
+ constraint:
+ installer: compass
+ pod: huawei-pod1
+ task_args:
+ huawei-pod1: '{"pod_info": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml",
+ "host": "node5.yardstick-TC063"}'
+-
+ file_name: opnfv_yardstick_tc069.yaml
+-
+ file_name: opnfv_yardstick_tc070.yaml
+-
+ file_name: opnfv_yardstick_tc071.yaml
+-
+ file_name: opnfv_yardstick_tc072.yaml
diff --git a/tests/unit/apiserver/resources/test_env_action.py b/tests/unit/apiserver/resources/test_env_action.py
index e8f99b706..0411a66c4 100644
--- a/tests/unit/apiserver/resources/test_env_action.py
+++ b/tests/unit/apiserver/resources/test_env_action.py
@@ -10,7 +10,7 @@ class EnvTestCase(APITestCase):
def test_create_grafana(self):
url = 'yardstick/env/action'
- data = dict(action='createGrafanaContainer')
+ data = {'action': 'createGrafanaContainer'}
resp = self._post(url, data)
time.sleep(1)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_base.py b/tests/unit/network_services/vnf_generic/vnf/test_base.py
index b1203f8e8..9f2912d1b 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_base.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_base.py
@@ -52,7 +52,7 @@ class TestQueueFileWrapper(unittest.TestCase):
queue_file_wrapper.bufsize = 5
queue_file_wrapper.write("pipeline>")
queue_file_wrapper.close()
- self.assertEqual(queue_file_wrapper.q_out.empty(), True)
+ self.assertIsNotNone(queue_file_wrapper.q_out.empty())
def test_close(self):
queue_file_wrapper = \
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py
index 46e6f8742..eda5cea84 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py
@@ -238,6 +238,7 @@ class TestTrexTrafficGenRFC(unittest.TestCase):
trex_traffic_gen = TrexTrafficGenRFC(vnfd)
trex_traffic_gen._start_server = mock.Mock(return_value=0)
scenario_cfg = {"tc": "tc_baremetal_rfc2544_ipv4_1flow_64B"}
+ tg_rfc2544_trex.WAIT_TIME = 3
self.assertEqual(0, trex_traffic_gen.instantiate(scenario_cfg, {}))
def test_instantiate_error(self):
@@ -366,7 +367,7 @@ class TestTrexTrafficGenRFC(unittest.TestCase):
client_started = multiprocessing.Value('i', 1)
result = self.sut.run_traffic(mock_traffic_profile, client_started)
self.sut._traffic_process.terminate()
- self.assertEqual(True, result)
+ self.assertIsNotNone(result)
def test_scale(self):
with mock.patch("yardstick.ssh.SSH") as ssh:
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
index f1f6b3dcc..eb0dbf628 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py
@@ -318,7 +318,7 @@ class TestTrexTrafficGen(unittest.TestCase):
self.sut.client_started.value = 1
result = self.sut.run_traffic(mock_traffic_profile)
self.sut._traffic_process.terminate()
- self.assertEqual(True, result)
+ self.assertIsNotNone(result)
def test_scale(self):
with mock.patch("yardstick.ssh.SSH") as ssh:
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py
index ae4523087..36b8c2a22 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py
@@ -299,19 +299,13 @@ class TestVpeApproxVnf(unittest.TestCase):
vpe_approx_vnf = VpeApproxVnf(vnfd)
self.scenario_cfg['vnf_options'] = {'vpe': {'cfg': ""}}
vpe_approx_vnf._run_vpe = mock.Mock(return_value=0)
+ vpe_approx_vnf._resource_collect_start = mock.Mock(return_value=0)
vpe_approx_vnf.q_out.put("pipeline>")
- vpe_vnf.WAIT_TIME = 1
- self.assertEqual(0,
- vpe_approx_vnf.instantiate(self.scenario_cfg,
- self.context_cfg))
- vpe_approx_vnf.q_out.put("PANIC")
- vpe_approx_vnf._run_vpe = mock.Mock(return_value=0)
- vpe_vnf.WAIT_TIME = 1
- self.assertRaises(RuntimeError,
- vpe_approx_vnf.instantiate, self.scenario_cfg,
- self.context_cfg)
+ vpe_vnf.WAIT_TIME = 3
+ self.assertEqual(0, vpe_approx_vnf.instantiate(self.scenario_cfg,
+ self.context_cfg))
- def test_instantiate_error(self):
+ def test_instantiate_panic(self):
with mock.patch("yardstick.ssh.SSH") as ssh:
vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
ssh_mock = mock.Mock(autospec=ssh.SSH)
diff --git a/tox.ini b/tox.ini
index 3dfb982bf..bfba8ec0c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,6 +5,7 @@ envlist = py27,py3
[testenv]
usedevelop=True
+passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
deps = -rrequirements.txt
commands = /bin/bash ./run_tests.sh
whitelist_externals = /bin/bash
diff --git a/yardstick/__init__.py b/yardstick/__init__.py
index 3ae915c18..fbbc101a9 100644
--- a/yardstick/__init__.py
+++ b/yardstick/__init__.py
@@ -13,12 +13,15 @@ import os
import sys
import yardstick.vTC.apexlake as apexlake
+from yardstick.common import constants
+from yardstick.common import utils as yardstick_utils
# Hack to be able to run apexlake unit tests
# without having to install apexlake.
sys.path.append(os.path.dirname(apexlake.__file__))
-LOG_FILE = '/tmp/yardstick.log'
+yardstick_utils.makedirs(constants.YARDSTICK_LOG_DIR)
+LOG_FILE = os.path.join(constants.YARDSTICK_LOG_DIR, 'yardstick.log')
LOG_FORMATTER = ('%(asctime)s '
'%(name)s %(filename)s:%(lineno)d '
'%(levelname)s %(message)s')
diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py
index e6faf6828..e068c0b98 100644
--- a/yardstick/common/constants.py
+++ b/yardstick/common/constants.py
@@ -35,6 +35,8 @@ TESTCASE_DIR = join(YARDSTICK_ROOT_PATH, 'tests/opnfv/test_cases/')
YARDSTICK_REPOS_DIR = '/home/opnfv/repos/yardstick'
+YARDSTICK_LOG_DIR = '/tmp/yardstick/'
+
YARDSTICK_CONFIG_DIR = '/etc/yardstick/'
YARDSTICK_CONFIG_FILE = join(YARDSTICK_CONFIG_DIR, 'yardstick.conf')
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py
index ee7498cb8..37c1a7345 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py
@@ -130,7 +130,7 @@ class TrexTrafficGenRFC(GenericTrafficGen):
_tg_server.start()
while True:
LOGGING.info("Waiting for TG Server to start.. ")
- time.sleep(1)
+ time.sleep(WAIT_TIME)
status = \
self.connection.execute("lsof -i:%s" % TREX_SYNC_PORT)[0]
diff --git a/yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py b/yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py
index 1904af20b..bbf55853d 100644
--- a/yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py
+++ b/yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py
@@ -18,9 +18,11 @@ Generation of the heat templates from the base template
"""
from __future__ import absolute_import
-import json
import os
import shutil
+
+from oslo_serialization import jsonutils
+
from experimental_framework import common
from experimental_framework.constants import framework_parameters as fp
@@ -193,7 +195,7 @@ def generates_templates(base_heat_template, deployment_configuration):
new_template += "_" + str(counter) + template_file_extension
shutil.copy(base_template, new_template)
- metadata = dict()
+ metadata = {}
for var in heat_template_vars:
if var.get_variable_name():
common.replace_in_file(new_template, "#" +
@@ -203,7 +205,8 @@ def generates_templates(base_heat_template, deployment_configuration):
# Save the metadata on a JSON file
with open(new_template + ".json", 'w') as outfile:
- json.dump(metadata, outfile)
+ # sort keys to maintain persistent order for git
+ jsonutils.dump(metadata, outfile, sort_keys=True)
common.LOG.debug("Heat Templates and Metadata file " + str(counter) +
" created")
@@ -222,7 +225,7 @@ def get_all_heat_templates(template_dir, template_file_extension):
(type: str)
:return: type: list
"""
- template_files = list()
+ template_files = []
for dirname, dirnames, filenames in os.walk(template_dir):
for filename in filenames:
if template_file_extension in filename and \
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json b/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json
index 3af9a1cc7..44a8aeb2e 100644
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json
+++ b/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json
@@ -1 +1 @@
-{"vnic_type": "normal", "ram": "1024", "vcpus": "2"} \ No newline at end of file
+{"ram": "1024", "vcpus": "2", "vnic_type": "normal"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json b/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json
index 9f246891d..0a66448b7 100644
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json
+++ b/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json
@@ -1 +1 @@
-{"vnic_type": "direct", "ram": "1024", "vcpus": "2"} \ No newline at end of file
+{"ram": "1024", "vcpus": "2", "vnic_type": "direct"} \ No newline at end of file