X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Funit%2Fnetwork_services%2Fvnf_generic%2Fvnf%2Ftest_vfw_vnf.py;h=f2eca196f6b7043518ef0b6631702a1459dfef7e;hb=9a71438273cefd57c652b6049c697bdf137088c8;hp=958099a037fd2722fabd37050ecab7895ce57b0b;hpb=62c775f7261dca0081283fadcaa18e53cf2f181c;p=yardstick.git 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 958099a03..f2eca196f 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 @@ -15,8 +15,6 @@ # limitations under the License. # -from __future__ import absolute_import - import unittest import mock import os @@ -24,6 +22,9 @@ import os from tests.unit import STL_MOCKS from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh +from yardstick.common import utils + + STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) stl_patch.start() @@ -32,10 +33,10 @@ if stl_patch: from yardstick.network_services.vnf_generic.vnf.vfw_vnf import FWApproxVnf from yardstick.network_services.nfvi.resource import ResourceProfile + TEST_FILE_YAML = 'nsb_test_case.yaml' SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper' - name = 'vnf__1' @@ -239,7 +240,7 @@ class TestFWApproxVnf(unittest.TestCase): 'password': 'r00t', 'VNF model': 'vfw_vnf.yaml'}}} - def test___init__(self, mock_process): + def test___init__(self, *args): vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] vfw_approx_vnf = FWApproxVnf(name, vnfd) self.assertIsNone(vfw_approx_vnf._vnf_process) @@ -260,7 +261,7 @@ pipeline> @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time") @mock.patch(SSH_HELPER) - def test_collect_kpi(self, ssh, mock_time, mock_process): + def test_collect_kpi(self, ssh, *args): mock_ssh(ssh) vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] @@ -282,7 +283,7 @@ pipeline> @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time") @mock.patch(SSH_HELPER) - def test_vnf_execute_command(self, ssh, mock_time, mock_process): + def test_vnf_execute_command(self, ssh, *args): mock_ssh(ssh) vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] @@ -294,7 +295,7 @@ pipeline> self.assertEqual(vfw_approx_vnf.vnf_execute(cmd), "") @mock.patch(SSH_HELPER) - def test_get_stats(self, ssh, mock_process): + def test_get_stats(self, ssh, *args): mock_ssh(ssh) vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] @@ -314,7 +315,7 @@ pipeline> @mock.patch("yardstick.network_services.vnf_generic.vnf.vfw_vnf.eval") @mock.patch("yardstick.network_services.vnf_generic.vnf.vfw_vnf.open") @mock.patch(SSH_HELPER) - def test_run_vfw(self, ssh, mock_open, mock_eval, mock_hex, mock_process): + def test_run_vfw(self, ssh, *args): mock_ssh(ssh) vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] @@ -333,11 +334,11 @@ pipeline> vfw_approx_vnf._run() vfw_approx_vnf.ssh_helper.run.assert_called_once() - @mock.patch("yardstick.network_services.vnf_generic.vnf.vfw_vnf.find_relative_file") + @mock.patch.object(utils, 'find_relative_file') @mock.patch("yardstick.network_services.vnf_generic.vnf.vfw_vnf.YangModel") @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Context") @mock.patch(SSH_HELPER) - def test_instantiate(self, ssh, mock_context, mock_yang, mock_find, mock_process): + def test_instantiate(self, ssh, *args): mock_ssh(ssh) vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] @@ -350,28 +351,3 @@ pipeline> 'rules': ""}} self.scenario_cfg.update({"nodes": {"vnf__1": ""}}) self.assertIsNone(vfw_approx_vnf.instantiate(self.scenario_cfg, self.context_cfg)) - - def test_scale(self, mock_process): - vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] - vfw_approx_vnf = FWApproxVnf(name, vnfd) - flavor = "" - with self.assertRaises(NotImplementedError): - vfw_approx_vnf.scale(flavor) - - @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time") - @mock.patch(SSH_HELPER) - def test_terminate(self, ssh, mock_time, mock_process): - mock_ssh(ssh) - - vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] - vfw_approx_vnf = FWApproxVnf(name, vnfd) - vfw_approx_vnf._vnf_process = mock.MagicMock() - vfw_approx_vnf.used_drivers = {"01:01.0": "i40e", - "01:01.1": "i40e"} - vfw_approx_vnf.vnf_execute = mock.Mock() - vfw_approx_vnf.dpdk_nic_bind = "dpdk_nic_bind.py" - vfw_approx_vnf._resource_collect_stop = mock.Mock() - self.assertIsNone(vfw_approx_vnf.terminate()) - -if __name__ == '__main__': - unittest.main()