summaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_vnf_generic.py6
-rw-r--r--tests/unit/network_services/libs/ixia_libs/test_IxNet.py24
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py8
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py9
4 files changed, 26 insertions, 21 deletions
diff --git a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
index df5047a0d..fe7b6a57f 100644
--- a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
+++ b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
@@ -362,7 +362,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
def test__get_ip_flow_range(self):
self.scenario_cfg["traffic_options"]["flow"] = \
self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml")
- result = '152.16.100.1-152.16.100.254'
+ result = '152.16.100.2-152.16.100.254'
self.assertEqual(result, self.s._get_ip_flow_range({"tg__1": 'xe0'}))
def test___get_traffic_flow(self):
@@ -384,8 +384,8 @@ class TestNetworkServiceTestCase(unittest.TestCase):
'public_ip': ['1.1.1.1'],
},
}
- result = {'flow': {'dst_ip0': '152.16.40.1-152.16.40.254',
- 'src_ip0': '152.16.100.1-152.16.100.254'}}
+ result = {'flow': {'dst_ip0': '152.16.40.2-152.16.40.254',
+ 'src_ip0': '152.16.100.2-152.16.100.254'}}
self.assertEqual(result, self.s._get_traffic_flow())
diff --git a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py b/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
index ae4c58de1..7fe83406a 100644
--- a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
+++ b/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
@@ -268,7 +268,7 @@ class TestIxNextgen(unittest.TestCase):
def test_add_ip_header_v4(self):
static_traffic_params = {
- "private": {
+ "private_1": {
"id": 1,
"bidir": "False",
"duration": 60,
@@ -308,7 +308,7 @@ class TestIxNextgen(unittest.TestCase):
},
"traffic_type": "continuous"
},
- "public": {
+ "public_1": {
"id": 2,
"bidir": "False",
"duration": 60,
@@ -366,7 +366,7 @@ class TestIxNextgen(unittest.TestCase):
def test_add_ip_header_v4_nothing_to_do(self):
static_traffic_params = {
- "private": {
+ "private_1": {
"id": 1,
"bidir": "False",
"duration": 60,
@@ -406,7 +406,7 @@ class TestIxNextgen(unittest.TestCase):
},
"traffic_type": "continuous"
},
- "public": {
+ "public_1": {
"id": 2,
"bidir": "False",
"duration": 60,
@@ -464,7 +464,7 @@ class TestIxNextgen(unittest.TestCase):
def test_add_ip_header_v6(self):
static_traffic_profile = {
- "private": {
+ "private_1": {
"id": 1,
"bidir": "False",
"duration": 60,
@@ -497,7 +497,7 @@ class TestIxNextgen(unittest.TestCase):
},
"traffic_type": "continuous"
},
- "public": {
+ "public_1": {
"id": 2,
"bidir": "False",
"duration": 60,
@@ -547,7 +547,7 @@ class TestIxNextgen(unittest.TestCase):
def test_add_ip_header_v6_nothing_to_do(self):
static_traffic_params = {
- "private": {
+ "private_1": {
"id": 1,
"bidir": "False",
"duration": 60,
@@ -579,7 +579,7 @@ class TestIxNextgen(unittest.TestCase):
},
"traffic_type": "continuous"
},
- "public": {
+ "public_1": {
"id": 2,
"bidir": "False",
"duration": 60,
@@ -684,7 +684,7 @@ class TestIxNextgen(unittest.TestCase):
def test_ix_update_ether(self):
static_traffic_params = {
- "private": {
+ "private_1": {
"id": 1,
"bidir": "False",
"duration": 60,
@@ -723,7 +723,7 @@ class TestIxNextgen(unittest.TestCase):
},
"traffic_type": "continuous"
},
- "public": {
+ "public_1": {
"id": 2,
"bidir": "False",
"duration": 60,
@@ -787,7 +787,7 @@ class TestIxNextgen(unittest.TestCase):
def test_ix_update_ether_nothing_to_do(self):
static_traffic_params = {
- "private": {
+ "private_1": {
"id": 1,
"bidir": "False",
"duration": 60,
@@ -820,7 +820,7 @@ class TestIxNextgen(unittest.TestCase):
},
"traffic_type": "continuous"
},
- "public": {
+ "public_1": {
"id": 2,
"bidir": "False",
"duration": 60,
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py
index 5c81aa886..db128a15c 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py
@@ -161,7 +161,8 @@ class TestIxLoadTrafficGen(unittest.TestCase):
vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
ixload_traffic_gen = IxLoadTrafficGen(NAME, vnfd)
scenario_cfg = {'tc': "nsb_test_case",
- 'ixia_profile': "ixload.cfg"}
+ 'ixia_profile': "ixload.cfg",
+ 'task_path': "/path/to/task"}
ixload_traffic_gen.RESULTS_MOUNT = "/tmp/result"
shutil.copy = mock.Mock()
scenario_cfg.update({'options': {'packetsize': 64, 'traffic_type': 4,
@@ -173,8 +174,9 @@ class TestIxLoadTrafficGen(unittest.TestCase):
'1C/1T',
'worker_threads': 1}}
}})
- self.assertRaises(IOError,
- ixload_traffic_gen.instantiate(scenario_cfg, {}))
+ with mock.patch('yardstick.benchmark.scenarios.networking.vnf_generic.open', create=True) as mock_open:
+ mock_open.return_value = mock.MagicMock()
+ ixload_traffic_gen.instantiate(scenario_cfg, {})
@mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.call")
@mock.patch("yardstick.network_services.vnf_generic.vnf.tg_ixload.shutil")
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 ca8150cb2..661e885ca 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
@@ -343,8 +343,11 @@ class TestIXIATrafficGen(unittest.TestCase):
},
},
},
- 'ixia_profile': {}
+ 'ixia_profile': '/path/to/profile',
+ 'task_path': '/path/to/task'
}
- result = sut._traffic_runner(mock_traffic_profile)
- self.assertIsNone(result)
+ with mock.patch('yardstick.benchmark.scenarios.networking.vnf_generic.open', create=True) as mock_open:
+ mock_open.return_value = mock.MagicMock()
+ result = sut._traffic_runner(mock_traffic_profile)
+ self.assertIsNone(result)