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=d128db0b4818acdbadc2a239dfb5c45335d312bd;hb=7f8f31cf68dbecaf521348fccf540cbe0e7c72bd;hp=c3d53ff03dc9c2b120e461a900047483d5ec46a7;hpb=0a24ca320c46c10a50d38b8eab6336eb0e32f8c9;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 c3d53ff03..d128db0b4 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 @@ -32,10 +30,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' @@ -73,7 +71,7 @@ class TestFWApproxVnf(unittest.TestCase): 'local_ip': '152.16.100.19', 'type': 'PCI-PASSTHROUGH', 'netmask': '255.255.255.0', - 'dpdk_port_num': '0', + 'dpdk_port_num': 0, 'bandwidth': '10 Gbps', 'driver': "i40e", 'dst_ip': '152.16.100.20', @@ -88,7 +86,7 @@ class TestFWApproxVnf(unittest.TestCase): 'type': 'PCI-PASSTHROUGH', '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', @@ -142,7 +140,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 +168,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 +193,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 +203,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', @@ -239,7 +237,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 +258,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 +280,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 +292,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 +312,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] @@ -337,7 +335,7 @@ pipeline> @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] @@ -351,16 +349,9 @@ pipeline> 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): + def test_terminate(self, ssh, *args): mock_ssh(ssh) vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] @@ -372,6 +363,3 @@ pipeline> 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()