Merge "Introduced timeout to post method of HttpClient"
[yardstick.git] / tests / unit / network_services / vnf_generic / vnf / test_prox_vnf.py
index 2e83caf..c88b152 100644 (file)
@@ -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):