X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Funit%2Fnetwork_services%2Fvnf_generic%2Fvnf%2Ftest_prox_vnf.py;h=e29e8ddcd849a350a60e277a6edc68464afb7c0d;hb=31b02e5b95d8b4076ef60667d051a8a1a6b072ba;hp=4b115f2d6851bc13062f0559d9f14cbf0b7e23a5;hpb=740cd01e5fb0eb764eeea5b0e55466734a41b596;p=yardstick.git 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 4b115f2d6..e29e8ddcd 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 @@ -85,9 +85,10 @@ class TestProxApproxVnf(unittest.TestCase): 'vpci': '0000:05:00.0', 'local_ip': '152.16.100.19', 'type': 'PCI-PASSTHROUGH', - 'vld_id': '', + 'vld_id': 'downlink_0', + 'ifname': 'xe1', 'netmask': '255.255.255.0', - 'dpdk_port_num': '0', + 'dpdk_port_num': 0, 'bandwidth': '10 Gbps', 'driver': "i40e", 'dst_ip': '152.16.100.20', @@ -103,10 +104,11 @@ class TestProxApproxVnf(unittest.TestCase): 'vpci': '0000:05:00.1', 'local_ip': '152.16.40.19', 'type': 'PCI-PASSTHROUGH', - 'vld_id': '', + 'vld_id': 'uplink_0', + 'ifname': 'xe1', 'driver': "i40e", 'netmask': '255.255.255.0', - 'dpdk_port_num': '1', + 'dpdk_port_num': 1, 'bandwidth': '10 Gbps', 'dst_ip': '152.16.40.20', 'local_iface_name': 'xe1', @@ -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,15 +342,15 @@ 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 expected = { - 'packets_in': 7, + 'packets_in': 6, 'packets_dropped': 1, - 'packets_fwd': 6, + 'packets_fwd': 7, 'collect_stats': {'core': {'result': 234}}, } result = prox_approx_vnf.collect_kpi() @@ -363,6 +365,7 @@ class TestProxApproxVnf(unittest.TestCase): prox_approx_vnf = ProxApproxVnf(NAME, deepcopy(self.VNFD0)) prox_approx_vnf.resource_helper = resource_helper prox_approx_vnf.vnfd_helper['vdu'][0]['external-interface'] = [] + prox_approx_vnf.vnfd_helper.port_pairs.interfaces = [] with self.assertRaises(RuntimeError): prox_approx_vnf.collect_kpi() @@ -372,8 +375,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.helpers.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 +387,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 +400,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):