Merge "Add ODL HA testcase"
[yardstick.git] / tests / unit / network_services / vnf_generic / vnf / test_prox_vnf.py
index ee6c67e..159b1f7 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/env python
-
 # Copyright (c) 2016-2017 Intel Corporation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -131,6 +129,8 @@ class TestProxApproxVnf(unittest.TestCase):
                 'packets_in',
                 'packets_fwd',
                 'packets_dropped',
+                'curr_packets_fwd',
+                'curr_packets_in'
             ],
         },
         'connection-point': [
@@ -329,7 +329,7 @@ class TestProxApproxVnf(unittest.TestCase):
             'packets_in': 0,
             'packets_dropped': 0,
             'packets_fwd': 0,
-            'collect_stats': {'core': {}},
+            'collect_stats': {'core': {}}
         }
         result = prox_approx_vnf.collect_kpi()
         self.assertEqual(result, expected)
@@ -352,7 +352,11 @@ class TestProxApproxVnf(unittest.TestCase):
             'collect_stats': {'core': {'result': 234}},
         }
         result = prox_approx_vnf.collect_kpi()
-        self.assertEqual(result, expected)
+        self.assertEqual(result['packets_in'], expected['packets_in'])
+        self.assertEqual(result['packets_dropped'], expected['packets_dropped'])
+        self.assertEqual(result['packets_fwd'], expected['packets_fwd'])
+        self.assertNotEqual(result['packets_fwd'], 0)
+        self.assertNotEqual(result['packets_fwd'], 0)
 
     @mock.patch(SSH_HELPER)
     def test_collect_kpi_error(self, ssh, *args):
@@ -373,15 +377,16 @@ class TestProxApproxVnf(unittest.TestCase):
         file_path = os.path.join(curr_path, filename)
         return file_path
 
+    @mock.patch('yardstick.common.utils.open', create=True)
     @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, *args):
+    def test_run_prox(self, ssh, *_):
         mock_ssh(ssh)
 
         prox_approx_vnf = ProxApproxVnf(NAME, self.VNFD0)
         prox_approx_vnf.scenario_helper.scenario_cfg = self.SCENARIO_CFG
-        prox_approx_vnf.ssh_helper.provision_tool.return_value = '/tool_path12/tool_file34'
+        prox_approx_vnf.ssh_helper.join_bin_path.return_value = '/tool_path12/tool_file34'
         prox_approx_vnf.setup_helper.remote_path = 'configs/file56.cfg'
 
         expected = "sudo bash -c 'cd /tool_path12; " \