aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/network_services/vnf_generic/vnf
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/network_services/vnf_generic/vnf')
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py8
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py10
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py116
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py20
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py20
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py26
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py4
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py8
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py12
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py8
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py22
11 files changed, 120 insertions, 134 deletions
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py
index f47da3729..e9444b493 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py
@@ -144,7 +144,7 @@ class TestAclApproxVnf(unittest.TestCase):
'ip': '1.2.1.1',
'interfaces':
{'xe0': {'local_iface_name': 'ens513f0',
- 'vld_id': 'public',
+ 'vld_id': AclApproxVnf.DOWNLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.40.20',
'dst_mac': '00:00:00:00:00:01',
@@ -172,7 +172,7 @@ class TestAclApproxVnf(unittest.TestCase):
'ip': '1.2.1.1',
'interfaces':
{'xe0': {'local_iface_name': 'ens785f0',
- 'vld_id': 'private',
+ 'vld_id': AclApproxVnf.UPLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.100.20',
'dst_mac': '00:00:00:00:00:02',
@@ -197,7 +197,7 @@ class TestAclApproxVnf(unittest.TestCase):
'ip': '1.2.1.1',
'interfaces':
{'xe0': {'local_iface_name': 'ens786f0',
- 'vld_id': 'private',
+ 'vld_id': AclApproxVnf.UPLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.100.19',
'dst_mac': '00:00:00:00:00:04',
@@ -207,7 +207,7 @@ class TestAclApproxVnf(unittest.TestCase):
'vpci': '0000:05:00.0',
'dpdk_port_num': 0},
'xe1': {'local_iface_name': 'ens786f1',
- 'vld_id': 'public',
+ 'vld_id': AclApproxVnf.DOWNLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.40.19',
'dst_mac': '00:00:00:00:00:03',
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 c21beabfc..76f2d5b5d 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
@@ -73,7 +73,7 @@ link 1 up
def test__get_cgnapt_config(self):
vnfd_helper = mock.Mock()
- vnfd_helper.port_pairs.priv_ports = [{"name": 'a'}, {"name": "b"}, {"name": "c"}]
+ vnfd_helper.port_pairs.uplink_ports = [{"name": 'a'}, {"name": "b"}, {"name": "c"}]
helper = CgnaptApproxSetupEnvHelper(vnfd_helper, mock.Mock(), mock.Mock())
helper._get_ports_gateway = mock.Mock(side_effect=[3, 5, 2])
@@ -206,7 +206,7 @@ class TestCgnaptApproxVnf(unittest.TestCase):
'ip': '1.2.1.1',
'interfaces':
{'xe0': {'local_iface_name': 'ens513f0',
- 'vld_id': 'public',
+ 'vld_id': CgnaptApproxVnf.DOWNLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.40.20',
'dst_mac': '00:00:00:00:00:01',
@@ -234,7 +234,7 @@ class TestCgnaptApproxVnf(unittest.TestCase):
'ip': '1.2.1.1',
'interfaces':
{'xe0': {'local_iface_name': 'ens785f0',
- 'vld_id': 'private',
+ 'vld_id': CgnaptApproxVnf.UPLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.100.20',
'dst_mac': '00:00:00:00:00:02',
@@ -259,7 +259,7 @@ class TestCgnaptApproxVnf(unittest.TestCase):
'ip': '1.2.1.1',
'interfaces':
{'xe0': {'local_iface_name': 'ens786f0',
- 'vld_id': 'private',
+ 'vld_id': CgnaptApproxVnf.UPLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.100.19',
'dst_mac': '00:00:00:00:00:04',
@@ -269,7 +269,7 @@ class TestCgnaptApproxVnf(unittest.TestCase):
'vpci': '0000:05:00.0',
'dpdk_port_num': 0},
'xe1': {'local_iface_name': 'ens786f1',
- 'vld_id': 'public',
+ 'vld_id': CgnaptApproxVnf.DOWNLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.40.19',
'dst_mac': '00:00:00:00:00:03',
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 821c10f64..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
@@ -679,7 +679,7 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
'vpci': '0000:05:00.0',
'local_ip': '152.16.100.19',
'type': 'PCI-PASSTHROUGH',
- 'vld_id': 'private_0',
+ 'vld_id': 'uplink_0',
'netmask': '255.255.255.0',
'dpdk_port_num': 0,
'bandwidth': '10 Gbps',
@@ -698,7 +698,7 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
'vpci': '0000:05:00.1',
'local_ip': '152.16.40.19',
'type': 'PCI-PASSTHROUGH',
- 'vld_id': 'public_0',
+ 'vld_id': 'downlink_0',
'driver': "i40e",
'netmask': '255.255.255.0',
'dpdk_port_num': 1,
@@ -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')
@@ -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')
@@ -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()
@@ -1281,7 +1282,7 @@ class TestProxResourceHelper(unittest.TestCase):
'vpci': '0000:05:00.0',
'local_ip': '152.16.100.19',
'type': 'PCI-PASSTHROUGH',
- 'vld_id': 'private_0',
+ 'vld_id': 'uplink_0',
'netmask': '255.255.255.0',
'dpdk_port_num': 0,
'bandwidth': '10 Gbps',
@@ -1300,7 +1301,7 @@ class TestProxResourceHelper(unittest.TestCase):
'vpci': '0000:05:00.1',
'local_ip': '152.16.40.19',
'type': 'PCI-PASSTHROUGH',
- 'vld_id': 'public_0',
+ 'vld_id': 'downlink_0',
'driver': "i40e",
'netmask': '255.255.255.0',
'dpdk_port_num': 1,
@@ -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
@@ -1755,7 +1751,7 @@ class TestProxResourceHelper(unittest.TestCase):
'vpci': '0000:06:00.0',
'local_ip': '152.16.100.20',
'type': 'PCI-PASSTHROUGH',
- 'vld_id': 'private_1',
+ 'vld_id': 'uplink_1',
'netmask': '255.255.255.0',
'dpdk_port_num': 0,
'bandwidth': '10 Gbps',
@@ -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 2e83cafc1..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
@@ -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,
@@ -187,7 +189,7 @@ class TestProxApproxVnf(unittest.TestCase):
'interfaces': {
'xe0': {
'local_iface_name': 'ens513f0',
- 'vld_id': 'public',
+ 'vld_id': ProxApproxVnf.DOWNLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.40.20',
'dst_mac': '00:00:00:00:00:01',
@@ -221,7 +223,7 @@ class TestProxApproxVnf(unittest.TestCase):
'interfaces': {
'xe0': {
'local_iface_name': 'ens785f0',
- 'vld_id': 'private',
+ 'vld_id': ProxApproxVnf.UPLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.100.20',
'dst_mac': '00:00:00:00:00:02',
@@ -252,7 +254,7 @@ class TestProxApproxVnf(unittest.TestCase):
'interfaces': {
'xe0': {
'local_iface_name': 'ens786f0',
- 'vld_id': 'private',
+ 'vld_id': ProxApproxVnf.UPLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.100.19',
'dst_mac': '00:00:00:00:00:04',
@@ -264,7 +266,7 @@ class TestProxApproxVnf(unittest.TestCase):
},
'xe1': {
'local_iface_name': 'ens786f1',
- 'vld_id': 'public',
+ 'vld_id': ProxApproxVnf.DOWNLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.40.19',
'dst_mac': '00:00:00:00:00:03',
@@ -340,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
@@ -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_sample_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
index fa733489c..4b9f4172e 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
@@ -102,7 +102,7 @@ class TestVnfSshHelper(unittest.TestCase):
'bandwidth': '10 Gbps',
'dst_ip': '152.16.100.20',
'local_mac': '00:00:00:00:00:01',
- 'vld_id': 'private_0',
+ 'vld_id': 'uplink_0',
'ifname': 'xe0',
},
'vnfd-connection-point-ref': 'xe0',
@@ -119,7 +119,7 @@ class TestVnfSshHelper(unittest.TestCase):
'bandwidth': '10 Gbps',
'dst_ip': '152.16.40.20',
'local_mac': '00:00:00:00:00:02',
- 'vld_id': 'public_0',
+ 'vld_id': 'downlink_0',
'ifname': 'xe1',
},
'vnfd-connection-point-ref': 'xe1',
@@ -300,7 +300,7 @@ class TestSetupEnvHelper(unittest.TestCase):
'bandwidth': '10 Gbps',
'dst_ip': '152.16.100.20',
'local_mac': '00:00:00:00:00:01',
- 'vld_id': 'private_0',
+ 'vld_id': 'uplink_0',
'ifname': 'xe0',
},
'vnfd-connection-point-ref': 'xe0',
@@ -317,7 +317,7 @@ class TestSetupEnvHelper(unittest.TestCase):
'bandwidth': '10 Gbps',
'dst_ip': '152.16.40.20',
'local_mac': '00:00:00:00:00:02',
- 'vld_id': 'public_0',
+ 'vld_id': 'downlink_0',
'ifname': 'xe1',
},
'vnfd-connection-point-ref': 'xe1',
@@ -430,7 +430,7 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
'bandwidth': '10 Gbps',
'dst_ip': '152.16.100.20',
'local_mac': '00:00:00:00:00:01',
- 'vld_id': 'private_0',
+ 'vld_id': 'uplink_0',
'ifname': 'xe0',
},
'vnfd-connection-point-ref': 'xe0',
@@ -448,7 +448,7 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
'bandwidth': '10 Gbps',
'dst_ip': '152.16.40.20',
'local_mac': '00:00:00:00:00:02',
- 'vld_id': 'public_0',
+ 'vld_id': 'downlink_0',
'ifname': 'xe1',
},
'vnfd-connection-point-ref': 'xe1',
@@ -1029,7 +1029,7 @@ class TestClientResourceHelper(unittest.TestCase):
'bandwidth': '10 Gbps',
'dst_ip': '152.16.100.20',
'local_mac': '00:00:00:00:00:01',
- 'vld_id': 'private_0',
+ 'vld_id': 'uplink_0',
'ifname': 'xe0',
},
'vnfd-connection-point-ref': 'xe0',
@@ -1047,7 +1047,7 @@ class TestClientResourceHelper(unittest.TestCase):
'bandwidth': '10 Gbps',
'dst_ip': '152.16.40.20',
'local_mac': '00:00:00:00:00:02',
- 'vld_id': 'public_0',
+ 'vld_id': 'downlink_0',
'ifname': 'xe1',
},
'vnfd-connection-point-ref': 'xe1',
@@ -1912,8 +1912,8 @@ class TestSampleVnf(unittest.TestCase):
self.assertIsNone(sample_vnf._build_ports())
self.assertIsNotNone(sample_vnf.networks)
- self.assertIsNotNone(sample_vnf.priv_ports)
- self.assertIsNotNone(sample_vnf.pub_ports)
+ self.assertIsNotNone(sample_vnf.uplink_ports)
+ self.assertIsNotNone(sample_vnf.downlink_ports)
self.assertIsNotNone(sample_vnf.my_ports)
@mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.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 d1f24700a..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'
@@ -180,7 +179,7 @@ class TestProxTrafficGen(unittest.TestCase):
'interfaces': {
'xe0': {
'local_iface_name': 'ens513f0',
- 'vld_id': 'public',
+ 'vld_id': ProxTrafficGen.DOWNLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.40.20',
'dst_mac': '00:00:00:00:00:01',
@@ -214,7 +213,7 @@ class TestProxTrafficGen(unittest.TestCase):
'interfaces': {
'xe0': {
'local_iface_name': 'ens785f0',
- 'vld_id': 'private',
+ 'vld_id': ProxTrafficGen.UPLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.100.20',
'dst_mac': '00:00:00:00:00:02',
@@ -245,7 +244,7 @@ class TestProxTrafficGen(unittest.TestCase):
'interfaces': {
'xe0': {
'local_iface_name': 'ens786f0',
- 'vld_id': 'private',
+ 'vld_id': ProxTrafficGen.UPLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.100.19',
'dst_mac': '00:00:00:00:00:04',
@@ -257,7 +256,7 @@ class TestProxTrafficGen(unittest.TestCase):
},
'xe1': {
'local_iface_name': 'ens786f1',
- 'vld_id': 'public',
+ 'vld_id': ProxTrafficGen.DOWNLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.40.19',
'dst_mac': '00:00:00:00:00:03',
@@ -331,7 +330,8 @@ 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())
@@ -371,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, {})
@@ -391,10 +391,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/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 0fe0c3d45..637706fb4 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
@@ -100,7 +100,7 @@ class TestTrexTrafficGenRFC(unittest.TestCase):
'local_ip': '152.16.100.19',
'type': 'PCI-PASSTHROUGH',
'netmask': '255.255.255.0',
- 'vld_id': 'private_0',
+ 'vld_id': 'uplink_0',
'dpdk_port_num': 0,
'bandwidth': '10 Gbps',
'driver': "i40e",
@@ -120,7 +120,7 @@ class TestTrexTrafficGenRFC(unittest.TestCase):
'type': 'PCI-PASSTHROUGH',
'driver': "i40e",
'netmask': '255.255.255.0',
- 'vld_id': 'public_0',
+ 'vld_id': 'downlink_0',
'dpdk_port_num': 1,
'bandwidth': '10 Gbps',
'dst_ip': '152.16.40.20',
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 4fd4c4c43..eb9f0525b 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
@@ -165,7 +165,7 @@ class TestTrexTrafficGen(unittest.TestCase):
"interfaces": {
"xe0": {
"local_iface_name": "ens786f0",
- "vld_id": "private",
+ "vld_id": TrafficProfile.UPLINK,
"netmask": "255.255.255.0",
"vpci": "0000:05:00.0",
"local_ip": "152.16.100.19",
@@ -177,7 +177,7 @@ class TestTrexTrafficGen(unittest.TestCase):
},
"xe1": {
"local_iface_name": "ens786f1",
- "vld_id": "public",
+ "vld_id": TrafficProfile.DOWNLINK,
"netmask": "255.255.255.0",
"vpci": "0000:05:00.1",
"local_ip": "152.16.40.19",
@@ -233,7 +233,7 @@ class TestTrexTrafficGen(unittest.TestCase):
"interfaces": {
"xe0": {
"local_iface_name": "ens513f0",
- "vld_id": "public",
+ "vld_id": TrafficProfile.DOWNLINK,
"netmask": "255.255.255.0",
"vpci": "0000:02:00.0",
"local_ip": "152.16.40.20",
@@ -267,7 +267,7 @@ class TestTrexTrafficGen(unittest.TestCase):
"interfaces": {
"xe0": {
"local_iface_name": "ens785f0",
- "vld_id": "private",
+ "vld_id": TrafficProfile.UPLINK,
"netmask": "255.255.255.0",
"vpci": "0000:05:00.0",
"local_ip": "152.16.100.20",
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
index 95bc08b17..b75ed6764 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
@@ -78,7 +78,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase):
'netmask': '255.255.255.0',
'dst_ip': '152.16.100.20',
'type': 'PCI-PASSTHROUGH',
- 'vld_id': 'private_0',
+ 'vld_id': 'uplink_0',
'ifname': 'xe0',
},
'vnfd-connection-point-ref': 'xe0',
@@ -97,7 +97,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase):
'netmask': '255.255.255.0',
'dst_ip': '152.16.40.20',
'type': 'PCI-PASSTHROUGH',
- 'vld_id': 'public_0',
+ 'vld_id': 'downlink_0',
'ifname': 'xe1',
},
'vnfd-connection-point-ref': 'xe1',
@@ -200,7 +200,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase):
"interfaces": {
"xe0": {
"local_iface_name": "ens786f0",
- "vld_id": "private",
+ "vld_id": UdpReplayApproxVnf.UPLINK,
"netmask": "255.255.255.0",
"vpci": "0000:05:00.0",
"local_ip": "152.16.100.19",
@@ -212,7 +212,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase):
},
"xe1": {
"local_iface_name": "ens786f1",
- "vld_id": "public",
+ "vld_id": UdpReplayApproxVnf.DOWNLINK,
"netmask": "255.255.255.0",
"vpci": "0000:05:00.1",
"local_ip": "152.16.40.19",
@@ -268,7 +268,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase):
"interfaces": {
"xe0": {
"local_iface_name": "ens513f0",
- "vld_id": "public",
+ "vld_id": UdpReplayApproxVnf.DOWNLINK,
"netmask": "255.255.255.0",
"vpci": "0000:02:00.0",
"local_ip": "152.16.40.20",
@@ -302,7 +302,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase):
"interfaces": {
"xe0": {
"local_iface_name": "ens785f0",
- "vld_id": "private",
+ "vld_id": UdpReplayApproxVnf.UPLINK,
"netmask": "255.255.255.0",
"vpci": "0000:05:00.0",
"local_ip": "152.16.100.20",
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py
index 38cc1774a..958099a03 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py
@@ -142,7 +142,7 @@ class TestFWApproxVnf(unittest.TestCase):
'ip': '1.2.1.1',
'interfaces':
{'xe0': {'local_iface_name': 'ens513f0',
- 'vld_id': 'public',
+ 'vld_id': FWApproxVnf.DOWNLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.40.20',
'dst_mac': '00:00:00:00:00:01',
@@ -170,7 +170,7 @@ class TestFWApproxVnf(unittest.TestCase):
'ip': '1.2.1.1',
'interfaces':
{'xe0': {'local_iface_name': 'ens785f0',
- 'vld_id': 'private',
+ 'vld_id': FWApproxVnf.UPLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.100.20',
'dst_mac': '00:00:00:00:00:02',
@@ -195,7 +195,7 @@ class TestFWApproxVnf(unittest.TestCase):
'ip': '1.2.1.1',
'interfaces':
{'xe0': {'local_iface_name': 'ens786f0',
- 'vld_id': 'private',
+ 'vld_id': FWApproxVnf.UPLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.100.19',
'dst_mac': '00:00:00:00:00:04',
@@ -205,7 +205,7 @@ class TestFWApproxVnf(unittest.TestCase):
'vpci': '0000:05:00.0',
'dpdk_port_num': 0},
'xe1': {'local_iface_name': 'ens786f1',
- 'vld_id': 'public',
+ 'vld_id': FWApproxVnf.DOWNLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.40.19',
'dst_mac': '00:00:00:00:00:03',
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 62389870b..757109d11 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
@@ -57,8 +57,8 @@ class TestConfigCreate(unittest.TestCase):
def test___init__(self):
config_create = ConfigCreate([0], [1], 2)
- self.assertEqual(config_create.priv_ports, [0])
- self.assertEqual(config_create.pub_ports, [1])
+ self.assertEqual(config_create.uplink_ports, [0])
+ self.assertEqual(config_create.downlink_ports, [1])
self.assertEqual(config_create.socket, 2)
def test_vpe_initialize(self):
@@ -110,7 +110,7 @@ class TestConfigCreate(unittest.TestCase):
self.assertNotEqual(result, '')
def test_create_vpe_config(self):
- priv_ports = [
+ uplink_ports = [
{
'index': 0,
'dpdk_port_num': 1,
@@ -121,7 +121,7 @@ class TestConfigCreate(unittest.TestCase):
},
]
- pub_ports = [
+ downlink_ports = [
{
'index': 2,
'dpdk_port_num': 3,
@@ -132,7 +132,7 @@ class TestConfigCreate(unittest.TestCase):
},
]
- config_create = ConfigCreate(priv_ports, pub_ports, 23)
+ config_create = ConfigCreate(uplink_ports, downlink_ports, 23)
curr_path = os.path.dirname(os.path.abspath(__file__))
vpe_cfg = "samples/vnf_samples/nsut/vpe/vpe_config"
vnf_cfg = os.path.join(curr_path, "../../../../..", vpe_cfg)
@@ -192,7 +192,7 @@ class TestVpeApproxVnf(unittest.TestCase):
'dst_ip': '152.16.100.20',
'local_iface_name': 'xe0',
'local_mac': '00:00:00:00:00:02',
- 'vld_id': 'private_0',
+ 'vld_id': 'uplink_0',
'ifname': 'xe0',
},
'vnfd-connection-point-ref': 'xe0',
@@ -211,7 +211,7 @@ class TestVpeApproxVnf(unittest.TestCase):
'dst_ip': '152.16.40.20',
'local_iface_name': 'xe1',
'local_mac': '00:00:00:00:00:01',
- 'vld_id': 'public_0',
+ 'vld_id': 'downlink_0',
'ifname': 'xe1',
},
'vnfd-connection-point-ref': 'xe1',
@@ -310,7 +310,7 @@ class TestVpeApproxVnf(unittest.TestCase):
'interfaces': {
'xe0': {
'local_iface_name': 'ens513f0',
- 'vld_id': 'public',
+ 'vld_id': VpeApproxVnf.DOWNLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.40.20',
'dst_mac': '00:00:00:00:00:01',
@@ -344,7 +344,7 @@ class TestVpeApproxVnf(unittest.TestCase):
'interfaces': {
'xe0': {
'local_iface_name': 'ens785f0',
- 'vld_id': 'private',
+ 'vld_id': VpeApproxVnf.UPLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.100.20',
'dst_mac': '00:00:00:00:00:02',
@@ -375,7 +375,7 @@ class TestVpeApproxVnf(unittest.TestCase):
'interfaces': {
'xe0': {
'local_iface_name': 'ens786f0',
- 'vld_id': 'private',
+ 'vld_id': VpeApproxVnf.UPLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.100.19',
'dst_mac': '00:00:00:00:00:04',
@@ -387,7 +387,7 @@ class TestVpeApproxVnf(unittest.TestCase):
},
'xe1': {
'local_iface_name': 'ens786f1',
- 'vld_id': 'public',
+ 'vld_id': VpeApproxVnf.DOWNLINK,
'netmask': '255.255.255.0',
'local_ip': '152.16.40.19',
'dst_mac': '00:00:00:00:00:03',