aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/network_services/vnf_generic
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/network_services/vnf_generic')
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py6
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py2
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py2
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py15
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py11
5 files changed, 21 insertions, 15 deletions
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py
index 76f2d5b5d..0a4c12446 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py
@@ -311,8 +311,9 @@ class TestCgnaptApproxVnf(unittest.TestCase):
cgnapt_approx_vnf = CgnaptApproxVnf(name, vnfd)
self.assertIsNone(cgnapt_approx_vnf._vnf_process)
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time')
@mock.patch(SSH_HELPER)
- def test_collect_kpi(self, ssh, mock_process):
+ def test_collect_kpi(self, ssh, mock_time, mock_process):
mock_ssh(ssh)
vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
@@ -324,8 +325,9 @@ class TestCgnaptApproxVnf(unittest.TestCase):
result = {'packets_dropped': 0, 'packets_fwd': 0, 'packets_in': 0}
self.assertEqual(result, cgnapt_approx_vnf.collect_kpi())
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time')
@mock.patch(SSH_HELPER)
- def test_vnf_execute_command(self, ssh, mock_process):
+ def test_vnf_execute_command(self, ssh, mock_time, mock_process):
mock_ssh(ssh)
vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
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 2202c11a5..995b4a2cc 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
@@ -934,7 +934,7 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
],
}
- mock_find_path.side_effect = ['1', '2']
+ mock_find_path.side_effect = ['1', '2'] + [str(i) for i in range(len(vnf1['prox_files']))]
vnfd_helper = mock.MagicMock()
ssh_helper = mock.MagicMock()
scenario_helper = ScenarioHelper('vnf1')
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 f8b592d8c..c88b1528c 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
@@ -342,7 +342,7 @@ class TestProxApproxVnf(unittest.TestCase):
resource_helper = mock.MagicMock()
resource_helper.execute.return_value = list(range(12))
- resource_helper.collect_kpi.return_value = {'core': {'result': 234}}
+ resource_helper.collect_collectd_kpi.return_value = {'core': {'result': 234}}
prox_approx_vnf = ProxApproxVnf(NAME, self.VNFD0)
prox_approx_vnf.resource_helper = resource_helper
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 4e82c0d5e..eb569cfe6 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
@@ -20,7 +20,6 @@ import mock
from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
from tests.unit import STL_MOCKS
-from yardstick.network_services.nfvi.resource import ResourceProfile
SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper'
NAME = 'vnf__1'
@@ -334,7 +333,7 @@ class TestProxTrafficGen(unittest.TestCase):
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({"core": {}}, prox_traffic_gen.collect_kpi())
+ self.assertEqual({}, 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')
@@ -372,12 +371,12 @@ class TestProxTrafficGen(unittest.TestCase):
'task_path': '',
'options': {'tg__1': {'prox_args': {'-e': '',
'-t': ''},
- 'prox_config': 'configs/l3-gen-2.cfg',
- 'prox_path': '/root/dppd-PROX-v035/build/prox'},
- 'vnf__1': {'prox_args': {'-t': ''},
- 'prox_config': 'configs/l3-swap-2.cfg',
- 'prox_path': '/root/dppd-PROX-v035/build/prox'}
- }
+ 'prox_config': 'configs/l3-gen-2.cfg',
+ 'prox_path': '/root/dppd-PROX-v035/build/prox'},
+ 'vnf__1': {'prox_args': {'-t': ''},
+ 'prox_config': 'configs/l3-swap-2.cfg',
+ 'prox_path': '/root/dppd-PROX-v035/build/prox'}
+ }
}
prox_traffic_gen.instantiate(scenario_cfg, {})
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
index 0e303dc3b..f62a0fb3b 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
@@ -252,6 +252,7 @@ class TestIXIATrafficGen(unittest.TestCase):
mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
mock_traffic_profile.get_traffic_definition.return_value = "64"
mock_traffic_profile.params = self.TRAFFIC_PROFILE
+ # traffic_profile.ports is standardized on port_num
mock_traffic_profile.ports = [0, 1]
mock_ssh_instance = mock.Mock(autospec=mock_ssh.SSH)
@@ -346,8 +347,12 @@ class TestIXIATrafficGen(unittest.TestCase):
'task_path': '/path/to/task'
}
- with mock.patch('yardstick.benchmark.scenarios.networking.vnf_generic.open',
- create=True) as mock_open:
- mock_open.return_value = mock.MagicMock()
+ @mock.patch('yardstick.benchmark.scenarios.networking.vnf_generic.open', create=True)
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.tg_rfc2544_ixia.open',
+ mock.mock_open(), create=True)
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.tg_rfc2544_ixia.LOG.exception')
+ def _traffic_runner(*args):
result = sut._traffic_runner(mock_traffic_profile)
self.assertIsNone(result)
+
+ _traffic_runner()