summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xansible/roles/install_dependencies/tasks/Debian.yml1
-rw-r--r--ansible/roles/install_image_dependencies/tasks/main.yml2
-rw-r--r--tests/opnfv/test_suites/opnfv_os-nosdn-bar-ha_daily.yaml161
-rw-r--r--tests/opnfv/test_suites/opnfv_os-nosdn-bar-noha_daily.yaml62
-rw-r--r--tests/opnfv/test_suites/opnfv_os-odl-fdio-dvr-ha_daily.yaml38
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_binsearch.py4
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_mpls.py4
-rw-r--r--tests/unit/network_services/traffic_profile/test_prox_profile.py6
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py104
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py10
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py7
-rw-r--r--yardstick/network_services/traffic_profile/prox_profile.py2
-rw-r--r--yardstick/network_services/vnf_generic/vnf/prox_helpers.py35
-rw-r--r--yardstick/network_services/vnf_generic/vnf/prox_vnf.py7
-rw-r--r--yardstick/network_services/vnf_generic/vnf/udp_replay.py2
15 files changed, 350 insertions, 95 deletions
diff --git a/ansible/roles/install_dependencies/tasks/Debian.yml b/ansible/roles/install_dependencies/tasks/Debian.yml
index 7a9911ebf..bba6fb13c 100755
--- a/ansible/roles/install_dependencies/tasks/Debian.yml
+++ b/ansible/roles/install_dependencies/tasks/Debian.yml
@@ -47,3 +47,4 @@
- uwsgi-plugin-python
- supervisor
- python-setuptools
+ - lsof
diff --git a/ansible/roles/install_image_dependencies/tasks/main.yml b/ansible/roles/install_image_dependencies/tasks/main.yml
index f3a3151c5..ffd30f33e 100644
--- a/ansible/roles/install_image_dependencies/tasks/main.yml
+++ b/ansible/roles/install_image_dependencies/tasks/main.yml
@@ -16,7 +16,7 @@
include: "{{ ansible_os_family }}.yml"
- name: Install core packages
- action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest"
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes"
register: pkg_mgr_results
retries: "{{ pkg_mgr_retries }}"
until: pkg_mgr_results|success
diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-bar-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-bar-ha_daily.yaml
new file mode 100644
index 000000000..35bc0ebd8
--- /dev/null
+++ b/tests/opnfv/test_suites/opnfv_os-nosdn-bar-ha_daily.yaml
@@ -0,0 +1,161 @@
+##############################################################################
+# Copyright (c) 2017 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
+##############################################################################
+---
+# os-nosdn-bar-ha daily task suite
+
+schema: "yardstick:suite:0.1"
+
+name: "os-nosdn-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_tc043.yaml
+ constraint:
+ installer: compass
+ pod: huawei-pod1
+ task_args:
+ huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml",
+ "host": "node4.LF","target": "node5.LF"}'
+-
+ file_name: opnfv_yardstick_tc019.yaml
+ constraint:
+ installer: compass,fuel
+ pod: huawei-pod2,ericsson-pod1
+ task_args:
+ huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}'
+ ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
+-
+ file_name: opnfv_yardstick_tc045.yaml
+ constraint:
+ installer: compass,fuel
+ pod: huawei-pod2,ericsson-pod1
+ task_args:
+ huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}'
+ ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
+-
+ file_name: opnfv_yardstick_tc046.yaml
+ constraint:
+ installer: fuel
+ task_args:
+ default: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
+-
+ file_name: opnfv_yardstick_tc047.yaml
+ constraint:
+ installer: compass,fuel
+ pod: huawei-pod2,ericsson-pod1
+ task_args:
+ huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}'
+ ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
+-
+ file_name: opnfv_yardstick_tc048.yaml
+ constraint:
+ installer: compass,fuel
+ pod: huawei-pod2,ericsson-pod1
+ task_args:
+ huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}'
+ ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
+-
+ file_name: opnfv_yardstick_tc049.yaml
+ constraint:
+ installer: fuel
+ task_args:
+ default: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
+-
+ file_name: opnfv_yardstick_tc050.yaml
+ constraint:
+ installer: fuel
+ task_args:
+ default: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
+-
+ file_name: opnfv_yardstick_tc051.yaml
+ constraint:
+ installer: compass,fuel
+ pod: huawei-pod2,ericsson-pod1
+ task_args:
+ huawei-pod2: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}'
+ ericsson-pod1: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
+-
+ file_name: opnfv_yardstick_tc052.yaml
+ constraint:
+ installer: fuel
+ task_args:
+ default: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
+-
+ file_name: opnfv_yardstick_tc053.yaml
+ constraint:
+ installer: fuel
+ task_args:
+ default: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml"}'
+-
+ file_name: opnfv_yardstick_tc055.yaml
+ constraint:
+ installer: compass
+ pod: huawei-pod1
+ task_args:
+ huawei-pod1: '{"file": "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: '{"file": "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_tc074.yaml
+ constraint:
+ installer: compass
+ pod: huawei-pod1, huawei-pod2
+ task_args:
+ huawei-pod1: '{"public_network": "ext-net",
+ "StorPerf_ip": "192.168.10.6"}'
+ huawei-pod2: '{"public_network": "ext-net",
+ "StorPerf_ip": "192.168.11.2"}'
+-
+ file_name: opnfv_yardstick_tc075.yaml
+ constraint:
+ installer: compass
+ pod: huawei-pod1
+ task_args:
+ huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml",
+ "host": "node1.LF"}'
+-
+ file_name: opnfv_yardstick_tc027.yaml
+ constraint:
+ installer: compass,fuel
+ pod: huawei-pod1,lf-pod2,ericsson-pod3,ericsson-pod4
+ task_args:
+ huawei-pod1: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml"}'
+ lf-pod2: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml", "openrc":"/root/openrc", "external_network":"admin_floating_net"}'
+ ericsson-pod3: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml", "openrc":"/root/openrc", "external_network":"admin_floating_net"}'
+ ericsson-pod4: '{"file": "etc/yardstick/nodes/fuel_baremetal/pod.yaml", "openrc":"/root/openrc", "external_network":"admin_floating_net"}'
+
diff --git a/tests/opnfv/test_suites/opnfv_os-nosdn-bar-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-nosdn-bar-noha_daily.yaml
new file mode 100644
index 000000000..26e92e704
--- /dev/null
+++ b/tests/opnfv/test_suites/opnfv_os-nosdn-bar-noha_daily.yaml
@@ -0,0 +1,62 @@
+##############################################################################
+# Copyright (c) 2017 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
+##############################################################################
+---
+# os-nosdn-bar-noha daily task suite
+
+schema: "yardstick:suite:0.1"
+
+name: "os-nosdn-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: '{"file": "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: '{"file": "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: '{"file": "etc/yardstick/nodes/compass_sclab_physical/pod.yaml",
+ "host": "node1.LF"}'
diff --git a/tests/opnfv/test_suites/opnfv_os-odl-fdio-dvr-ha_daily.yaml b/tests/opnfv/test_suites/opnfv_os-odl-fdio-dvr-ha_daily.yaml
new file mode 100644
index 000000000..825fea7c1
--- /dev/null
+++ b/tests/opnfv/test_suites/opnfv_os-odl-fdio-dvr-ha_daily.yaml
@@ -0,0 +1,38 @@
+##############################################################################
+# Copyright (c) 2017 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
+##############################################################################
+---
+# os-odl-fdio-dvr-ha daily task suite
+
+schema: "yardstick:suite:0.1"
+
+name: "os-odl-fdio-dvr-ha"
+test_cases_dir: "tests/opnfv/test_cases/"
+test_cases:
+-
+ file_name: opnfv_yardstick_tc002.yaml
+-
+ file_name: opnfv_yardstick_tc005.yaml
+-
+ file_name: opnfv_yardstick_tc010.yaml
+-
+ file_name: opnfv_yardstick_tc011.yaml
+-
+ file_name: opnfv_yardstick_tc012.yaml
+-
+ file_name: opnfv_yardstick_tc014.yaml
+-
+ file_name: opnfv_yardstick_tc037.yaml
+-
+ file_name: opnfv_yardstick_tc069.yaml
+-
+ file_name: opnfv_yardstick_tc070.yaml
+-
+ file_name: opnfv_yardstick_tc071.yaml
+-
+ file_name: opnfv_yardstick_tc072.yaml
diff --git a/tests/unit/network_services/traffic_profile/test_prox_binsearch.py b/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
index 0edce7a14..f56a7fba9 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_binsearch.py
@@ -56,7 +56,7 @@ class TestProxBinSearchProfile(unittest.TestCase):
profile = ProxBinSearchProfile(tp_config)
profile.init(mock.MagicMock())
- profile.execute(traffic_generator)
+ profile.execute_traffic(traffic_generator)
self.assertEqual(round(profile.current_lower, 2), 74.69)
self.assertEqual(round(profile.current_upper, 2), 75.39)
self.assertEqual(len(runs), 8)
@@ -87,7 +87,7 @@ class TestProxBinSearchProfile(unittest.TestCase):
profile = ProxBinSearchProfile(tp_config)
profile.init(mock.MagicMock())
- profile.execute(traffic_generator)
+ profile.execute_traffic(traffic_generator)
self.assertEqual(round(profile.current_lower, 2), 24.06)
self.assertEqual(round(profile.current_upper, 2), 25.47)
self.assertEqual(len(runs), 7)
diff --git a/tests/unit/network_services/traffic_profile/test_prox_mpls.py b/tests/unit/network_services/traffic_profile/test_prox_mpls.py
index 77bca9cc0..642fecc35 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_mpls.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_mpls.py
@@ -56,7 +56,7 @@ class TestProxMplsTagUntagProfile(unittest.TestCase):
profile = ProxMplsTagUntagProfile(tp_config)
profile.init(mock.MagicMock())
- profile.execute(traffic_generator)
+ profile.execute_traffic(traffic_generator)
self.assertEqual(round(profile.current_lower, 2), 74.69)
self.assertEqual(round(profile.current_upper, 2), 75.39)
self.assertEqual(len(runs), 8)
@@ -87,7 +87,7 @@ class TestProxMplsTagUntagProfile(unittest.TestCase):
profile = ProxMplsTagUntagProfile(tp_config)
profile.init(mock.MagicMock())
- profile.execute(traffic_generator)
+ profile.execute_traffic(traffic_generator)
self.assertEqual(round(profile.current_lower, 2), 24.06)
self.assertEqual(round(profile.current_upper, 2), 25.47)
self.assertEqual(len(runs), 7)
diff --git a/tests/unit/network_services/traffic_profile/test_prox_profile.py b/tests/unit/network_services/traffic_profile/test_prox_profile.py
index 14223da0f..9899d9909 100644
--- a/tests/unit/network_services/traffic_profile/test_prox_profile.py
+++ b/tests/unit/network_services/traffic_profile/test_prox_profile.py
@@ -65,7 +65,7 @@ class TestProxProfile(unittest.TestCase):
profile.init(234)
self.assertEqual(profile.queue, 234)
- def test_execute(self):
+ def test_execute_traffic(self):
packet_sizes = [
10,
100,
@@ -83,9 +83,9 @@ class TestProxProfile(unittest.TestCase):
self.assertFalse(profile.done)
for _ in packet_sizes:
with self.assertRaises(NotImplementedError):
- profile.execute(traffic_generator)
+ profile.execute_traffic(traffic_generator)
- self.assertIsNone(profile.execute(traffic_generator))
+ self.assertIsNone(profile.execute_traffic(traffic_generator))
def test_bounds_iterator(self):
tp_config = {
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py b/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
index 8d21fbb28..2202c11a5 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
@@ -884,11 +884,11 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
helper.upload_prox_config = mock.MagicMock(return_value='5')
self.assertEqual(helper.additional_files, {})
- self.assertNotEqual(helper.prox_config_dict, '4')
+ self.assertNotEqual(helper._prox_config_data, '4')
self.assertNotEqual(helper.remote_path, '5')
helper.build_config_file()
self.assertEqual(helper.additional_files, {})
- self.assertEqual(helper.prox_config_dict, '4')
+ self.assertEqual(helper._prox_config_data, '4')
self.assertEqual(helper.remote_path, '5')
@mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.find_relative_file')
@@ -951,12 +951,12 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
helper.upload_prox_config = mock.MagicMock(return_value='55')
self.assertEqual(helper.additional_files, {})
- self.assertNotEqual(helper.prox_config_dict, '44')
+ self.assertNotEqual(helper._prox_config_data, '44')
self.assertNotEqual(helper.remote_path, '55')
expected = {'h.i': '33', 'l': '34', 'm_n': '35'}
helper.build_config_file()
self.assertDictEqual(helper.additional_files, expected)
- self.assertEqual(helper.prox_config_dict, '44')
+ self.assertEqual(helper._prox_config_data, '44')
self.assertEqual(helper.remote_path, '55')
@mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.find_relative_file')
@@ -986,9 +986,10 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
helper = ProxDpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
helper.remote_path = "/tmp/prox.cfg"
- prox_cmd = helper.build_config()
expected = "sudo bash -c 'cd /opt/nsb_bin; /opt/nsb_bin/prox -o cli -f -f /tmp/prox.cfg '"
- self.assertEqual(prox_cmd, expected)
+ with mock.patch.object(helper, "build_config_file") as mock_build_config:
+ prox_cmd = helper.build_config()
+ self.assertEqual(prox_cmd, expected)
def test__insert_additional_file(self):
vnfd_helper = mock.MagicMock()
@@ -1392,7 +1393,7 @@ class TestProxResourceHelper(unittest.TestCase):
def test_test_cores(self):
setup_helper = mock.MagicMock()
- setup_helper.prox_config_dict = {}
+ setup_helper.prox_config_data = []
helper = ProxResourceHelper(setup_helper)
helper._cpu_topology = []
@@ -1401,7 +1402,7 @@ class TestProxResourceHelper(unittest.TestCase):
result = helper.test_cores
self.assertEqual(result, expected)
- setup_helper.prox_config_dict = [
+ setup_helper.prox_config_data = [
('section1', []),
('section2', [
('a', 'b'),
@@ -1449,10 +1450,9 @@ class TestProxResourceHelper(unittest.TestCase):
def test_get_test_type(self):
setup_helper = mock.MagicMock()
- setup_helper.prox_config_dict = {}
-
helper = ProxResourceHelper(setup_helper)
- setup_helper.prox_config_dict = [
+
+ setup_helper.prox_config_data = [
('global', [
('name', helper.PROX_CORE_MPLS_TEST)
]),
@@ -1479,27 +1479,7 @@ class TestProxResourceHelper(unittest.TestCase):
def test_get_cores(self):
setup_helper = mock.MagicMock()
- setup_helper.prox_config_dict = {}
-
- helper = ProxResourceHelper(setup_helper)
- helper._cpu_topology = {
- 0: {
- 1: {
- 5: (5, 1, 0)
- },
- 2: {
- 6: (6, 2, 0)
- },
- 3: {
- 7: (7, 3, 0)
- },
- 4: {
- 8: (8, 3, 0)
- },
- }
- }
-
- setup_helper.prox_config_dict = [
+ setup_helper.prox_config_data = [
('section1', []),
('section2', [
('a', 'b'),
@@ -1520,14 +1500,6 @@ class TestProxResourceHelper(unittest.TestCase):
]),
]
- expected = [7, 8]
- result = helper.get_cores(helper.PROX_CORE_GEN_MODE)
- self.assertEqual(result, expected)
-
- def test_get_cores_mpls(self):
- setup_helper = mock.MagicMock()
- setup_helper.prox_config_dict = {}
-
helper = ProxResourceHelper(setup_helper)
helper._cpu_topology = {
0: {
@@ -1546,7 +1518,13 @@ class TestProxResourceHelper(unittest.TestCase):
}
}
- setup_helper.prox_config_dict = [
+ expected = [7, 8]
+ result = helper.get_cores(helper.PROX_CORE_GEN_MODE)
+ self.assertEqual(result, expected)
+
+ def test_get_cores_mpls(self):
+ setup_helper = mock.MagicMock()
+ setup_helper.prox_config_data = [
('section1', []),
('section2', [
('a', 'b'),
@@ -1569,6 +1547,24 @@ class TestProxResourceHelper(unittest.TestCase):
]),
]
+ helper = ProxResourceHelper(setup_helper)
+ helper._cpu_topology = {
+ 0: {
+ 1: {
+ 5: (5, 1, 0)
+ },
+ 2: {
+ 6: (6, 2, 0)
+ },
+ 3: {
+ 7: (7, 3, 0)
+ },
+ 4: {
+ 8: (8, 3, 0)
+ },
+ }
+ }
+
expected_tagged = [7]
expected_plain = [8]
result_tagged, result_plain = helper.get_cores_mpls(helper.PROX_CORE_GEN_MODE)
@@ -1577,7 +1573,7 @@ class TestProxResourceHelper(unittest.TestCase):
def test_latency_cores(self):
setup_helper = mock.MagicMock()
- setup_helper.prox_config_dict = {}
+ setup_helper.prox_config_data= []
helper = ProxResourceHelper(setup_helper)
helper._cpu_topology = []
@@ -1586,7 +1582,7 @@ class TestProxResourceHelper(unittest.TestCase):
result = helper.latency_cores
self.assertEqual(result, expected)
- setup_helper.prox_config_dict = [
+ setup_helper.prox_config_data = [
('section1', []),
('section2', [
('a', 'b'),
@@ -1649,7 +1645,9 @@ class TestProxResourceHelper(unittest.TestCase):
def test_start_collect(self):
setup_helper = mock.MagicMock()
helper = ProxResourceHelper(setup_helper)
+ helper.resource = resource = mock.MagicMock()
self.assertIsNone(helper.start_collect())
+ resource.start.assert_called_once()
def test_terminate(self):
setup_helper = mock.MagicMock()
@@ -1681,7 +1679,7 @@ class TestProxResourceHelper(unittest.TestCase):
@mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.time')
def test_traffic_context(self, mock_time):
setup_helper = mock.MagicMock()
- setup_helper.prox_config_dict = {}
+ setup_helper.vnfd_helper.interfaces = []
helper = ProxResourceHelper(setup_helper)
helper._cpu_topology = {
@@ -1701,7 +1699,7 @@ class TestProxResourceHelper(unittest.TestCase):
}
}
- setup_helper.prox_config_dict = [
+ setup_helper.prox_config_data = [
('global', [
('name', helper.PROX_CORE_MPLS_TEST)
]),
@@ -1727,8 +1725,6 @@ class TestProxResourceHelper(unittest.TestCase):
]),
]
- setup_helper = mock.MagicMock()
- setup_helper.vnfd_helper.interfaces = []
client = mock.MagicMock()
client.hz.return_value = 2
@@ -1823,20 +1819,6 @@ class TestProxResourceHelper(unittest.TestCase):
result = helper.get_latency()
self.assertIs(result, expected)
- def test__get_logical_if_name(self):
- setup_helper = mock.MagicMock()
- setup_helper.vnfd_helper.interfaces = []
-
- helper = ProxResourceHelper(setup_helper)
- helper._vpci_to_if_name_map = {
- 'key1': 234,
- 'key2': 432,
- }
-
- expected = 234
- result = helper._get_logical_if_name('key1')
- self.assertEqual(result, expected)
-
@mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.time')
@mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.ProxSocketHelper')
def test__connect(self, mock_socket_helper_type, mock_time):
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py
index d1f7f05d8..f8b592d8c 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py
@@ -86,6 +86,7 @@ class TestProxApproxVnf(unittest.TestCase):
'local_ip': '152.16.100.19',
'type': 'PCI-PASSTHROUGH',
'vld_id': '',
+ 'ifname': 'xe1',
'netmask': '255.255.255.0',
'dpdk_port_num': 0,
'bandwidth': '10 Gbps',
@@ -104,6 +105,7 @@ class TestProxApproxVnf(unittest.TestCase):
'local_ip': '152.16.40.19',
'type': 'PCI-PASSTHROUGH',
'vld_id': '',
+ 'ifname': 'xe3',
'driver': "i40e",
'netmask': '255.255.255.0',
'dpdk_port_num': 1,
@@ -372,8 +374,10 @@ class TestProxApproxVnf(unittest.TestCase):
file_path = os.path.join(curr_path, filename)
return file_path
+ @mock.patch('yardstick.benchmark.scenarios.networking.vnf_generic.open', create=True)
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.iniparser.open', create=True)
@mock.patch(SSH_HELPER)
- def test_run_prox(self, ssh, mock_time):
+ def test_run_prox(self, ssh, *_):
mock_ssh(ssh)
prox_approx_vnf = ProxApproxVnf(NAME, self.VNFD0)
@@ -382,7 +386,7 @@ class TestProxApproxVnf(unittest.TestCase):
prox_approx_vnf.setup_helper.remote_path = 'configs/file56.cfg'
expected = "sudo bash -c 'cd /tool_path12; " \
- "/tool_path12/tool_file34 -o cli -t -f configs/file56.cfg '"
+ "/tool_path12/tool_file34 -o cli -t -f /tmp/l3-swap-2.cfg '"
prox_approx_vnf._run()
result = prox_approx_vnf.ssh_helper.run.call_args[0][0]
@@ -395,7 +399,7 @@ class TestProxApproxVnf(unittest.TestCase):
prox_approx_vnf.setup_helper = mock.MagicMock()
# we can't mock super
prox_approx_vnf.instantiate(self.SCENARIO_CFG, self.CONTEXT_CFG)
- prox_approx_vnf.setup_helper.build_config.assert_called_once
+ prox_approx_vnf.setup_helper.build_config.assert_called_once()
@mock.patch(SSH_HELPER)
def test_wait_for_instantiate_panic(self, ssh, mock_time):
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py
index 73e1c723f..4e82c0d5e 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py
@@ -331,9 +331,10 @@ class TestProxTrafficGen(unittest.TestCase):
mock_ssh(ssh)
prox_traffic_gen = ProxTrafficGen(NAME, self.VNFD0)
- prox_traffic_gen._vnf_wrapper.resource = mock.Mock(autospec=ResourceProfile)
+ prox_traffic_gen._vnf_wrapper.resource_helper.resource = mock.MagicMock(
+ **{"check_if_sa_running.return_value": [False]})
prox_traffic_gen._vnf_wrapper.vnf_execute = mock.Mock(return_value="")
- self.assertEqual({}, prox_traffic_gen.collect_kpi())
+ self.assertEqual({"core": {}}, prox_traffic_gen.collect_kpi())
@mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.CpuSysCores')
@mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.find_relative_file')
@@ -391,10 +392,10 @@ class TestProxTrafficGen(unittest.TestCase):
vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
sut = ProxTrafficGen(NAME, vnfd)
- sut.prox_config_dict = {}
sut._get_socket = mock.MagicMock()
sut.ssh_helper = mock.Mock()
sut.ssh_helper.run = mock.Mock()
+ sut.setup_helper.prox_config_dict = {}
sut._vpci_ascending = ["0000:05:00.0", "0000:05:00.1"]
sut._connect_client = mock.Mock(autospec=STLClient)
sut._connect_client.get_stats = mock.Mock(return_value="0")
diff --git a/yardstick/network_services/traffic_profile/prox_profile.py b/yardstick/network_services/traffic_profile/prox_profile.py
index daeaf42ed..0a9de9bb6 100644
--- a/yardstick/network_services/traffic_profile/prox_profile.py
+++ b/yardstick/network_services/traffic_profile/prox_profile.py
@@ -88,7 +88,7 @@ class ProxProfile(TrafficProfile):
def run_test_with_pkt_size(self, traffic_generator, pkt_size, duration):
raise NotImplementedError
- def execute(self, traffic_generator):
+ def execute_traffic(self, traffic_generator):
try:
pkt_size = next(self.pkt_size_iterator)
except StopIteration:
diff --git a/yardstick/network_services/vnf_generic/vnf/prox_helpers.py b/yardstick/network_services/vnf_generic/vnf/prox_helpers.py
index 00ab6c24c..30524a192 100644
--- a/yardstick/network_services/vnf_generic/vnf/prox_helpers.py
+++ b/yardstick/network_services/vnf_generic/vnf/prox_helpers.py
@@ -28,6 +28,7 @@ from contextlib import contextmanager
from itertools import repeat, chain
import six
+from multiprocessing import Queue
from six.moves import zip, StringIO
from six.moves import cStringIO
@@ -597,8 +598,9 @@ class ProxDpdkVnfSetupEnvHelper(DpdkVnfSetupEnvHelper):
self.remote_path = None
super(ProxDpdkVnfSetupEnvHelper, self).__init__(vnfd_helper, ssh_helper, scenario_helper)
self.remote_prox_file_name = None
- self.prox_config_dict = None
+ self._prox_config_data = None
self.additional_files = {}
+ self.config_queue = Queue()
def _build_pipeline_kwargs(self):
tool_path = self.ssh_helper.provision_tool(tool_file=self.APP_NAME)
@@ -758,6 +760,15 @@ class ProxDpdkVnfSetupEnvHelper(DpdkVnfSetupEnvHelper):
return remote_path
+ CONFIG_QUEUE_TIMEOUT = 120
+
+ @property
+ def prox_config_data(self):
+ if self._prox_config_data is None:
+ # this will block, but it needs too
+ self._prox_config_data = self.config_queue.get(True, self.CONFIG_QUEUE_TIMEOUT)
+ return self._prox_config_data
+
def build_config_file(self):
task_path = self.scenario_helper.task_path
options = self.scenario_helper.options
@@ -774,10 +785,13 @@ class ProxDpdkVnfSetupEnvHelper(DpdkVnfSetupEnvHelper):
remote_prox_file = self.copy_to_target(key_prox_file, base_prox_file)
self.additional_files[base_prox_file] = remote_prox_file
- self.prox_config_dict = self.generate_prox_config_file(config_path)
- self.remote_path = self.upload_prox_config(config_file, self.prox_config_dict)
+ self._prox_config_data = self.generate_prox_config_file(config_path)
+ # copy config to queue so we can read it from traffic_runner process
+ self.config_queue.put(self._prox_config_data)
+ self.remote_path = self.upload_prox_config(config_file, self._prox_config_data)
def build_config(self):
+ self.build_config_file()
options = self.scenario_helper.options
@@ -793,6 +807,7 @@ class ProxDpdkVnfSetupEnvHelper(DpdkVnfSetupEnvHelper):
return prox_cmd
+# this might be bad, sometimes we want regular ResourceHelper methods, like collect_kpi
class ProxResourceHelper(ClientResourceHelper):
RESOURCE_WORD = 'prox'
@@ -891,8 +906,9 @@ class ProxResourceHelper(ClientResourceHelper):
LOG.debug("tg_prox done")
self._terminated.value = 1
- def start_collect(self):
- pass
+ # use ResourceHelper method to collect KPIs directly.
+ def collect_kpi(self):
+ return self._collect_resource_kpi()
def terminate(self):
# should not be called, use VNF terminate
@@ -966,7 +982,7 @@ class ProxResourceHelper(ClientResourceHelper):
def get_test_type(self):
test_type = None
- for section_name, section in self.setup_helper.prox_config_dict:
+ for section_name, section in self.setup_helper.prox_config_data:
if section_name != "global":
continue
@@ -979,7 +995,7 @@ class ProxResourceHelper(ClientResourceHelper):
def get_cores(self, mode):
cores = []
- for section_name, section in self.setup_helper.prox_config_dict:
+ for section_name, section in self.setup_helper.prox_config_data:
if not section_name.startswith("core"):
continue
@@ -994,7 +1010,7 @@ class ProxResourceHelper(ClientResourceHelper):
def get_cores_mpls(self, mode=PROX_CORE_GEN_MODE):
cores_tagged = []
cores_plain = []
- for section_name, section in self.setup_helper.prox_config_dict:
+ for section_name, section in self.setup_helper.prox_config_data:
if not section_name.startswith("core"):
continue
@@ -1023,9 +1039,6 @@ class ProxResourceHelper(ClientResourceHelper):
return self.sut.lat_stats(self._latency_cores)
return []
- def _get_logical_if_name(self, vpci):
- return self._vpci_to_if_name_map[vpci]
-
def _connect(self, client=None):
"""Run and connect to prox on the remote system """
# De-allocating a large amount of hugepages takes some time. If a new
diff --git a/yardstick/network_services/vnf_generic/vnf/prox_vnf.py b/yardstick/network_services/vnf_generic/vnf/prox_vnf.py
index bef7c5a33..e87d452b4 100644
--- a/yardstick/network_services/vnf_generic/vnf/prox_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/prox_vnf.py
@@ -102,10 +102,3 @@ class ProxApproxVnf(SampleVNF):
self.setup_helper.kill_vnf()
self._tear_down()
self.resource_helper.stop_collect()
-
- def instantiate(self, scenario_cfg, context_cfg):
- # build config in parent process so we can access
- # config from TG subprocesses
- self.scenario_helper.scenario_cfg = scenario_cfg
- self.setup_helper.build_config_file()
- super(ProxApproxVnf, self).instantiate(scenario_cfg, context_cfg)
diff --git a/yardstick/network_services/vnf_generic/vnf/udp_replay.py b/yardstick/network_services/vnf_generic/vnf/udp_replay.py
index 88773387e..6b7779782 100644
--- a/yardstick/network_services/vnf_generic/vnf/udp_replay.py
+++ b/yardstick/network_services/vnf_generic/vnf/udp_replay.py
@@ -117,7 +117,7 @@ class UdpReplayApproxVnf(SampleVNF):
"packets_in": get_sum(1),
"packets_fwd": get_sum(2),
"packets_dropped": get_sum(3) + get_sum(4),
- "collect_stats": {},
+ 'collect_stats': self.resource_helper.collect_kpi(),
}
LOG.debug("UDP Replay collect KPIs %s", result)