X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Ftests%2Funit%2Fnetwork_services%2Fvnf_generic%2Fvnf%2Ftest_udp_replay.py;h=56c971da6f517720569f3e454bf1be46f51b533a;hb=f3cae5191bb3c944fd08780d8a8940d2aa60c4d0;hp=1c4ced3037fed00acca865d9f43f1b43fa8180e7;hpb=24c73d56563e2057c381af9c65ed005d1970f28a;p=yardstick.git diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py index 1c4ced303..56c971da6 100644 --- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py +++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py @@ -11,31 +11,21 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# import unittest import mock import os -from yardstick.tests import STL_MOCKS from yardstick.tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh from yardstick.benchmark.contexts import base as ctx_base +from yardstick.network_services.vnf_generic.vnf.udp_replay import UdpReplayApproxVnf +from yardstick.network_services.vnf_generic.vnf.sample_vnf import ScenarioHelper SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper' -STLClient = mock.MagicMock() -stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) -stl_patch.start() - -if stl_patch: - from yardstick.network_services.vnf_generic.vnf.udp_replay import UdpReplayApproxVnf - from yardstick.network_services.vnf_generic.vnf.sample_vnf import ScenarioHelper - - TEST_FILE_YAML = 'nsb_test_case.yaml' - NAME = "vnf__1" @@ -327,7 +317,8 @@ class TestUdpReplayApproxVnf(unittest.TestCase): } def test___init__(self, *args): - udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0) + udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0, + 'task_id') self.assertIsNone(udp_replay_approx_vnf._vnf_process) @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time") @@ -342,7 +333,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase): "Port\t\tRx Packet\t\tTx Packet\t\tRx Pkt Drop\t\tTx Pkt Drop \r\n"\ "0\t\t7374156\t\t7374136\t\t\t0\t\t\t0\r\n" \ "1\t\t7374316\t\t7374315\t\t\t0\t\t\t0\r\n\r\nReplay>\r\r\nReplay>" - udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, vnfd) + udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, vnfd, 'task_id') udp_replay_approx_vnf.scenario_helper.scenario_cfg = { 'nodes': {udp_replay_approx_vnf.name: "mock"} } @@ -364,7 +355,8 @@ class TestUdpReplayApproxVnf(unittest.TestCase): def test_get_stats(self, ssh, *args): mock_ssh(ssh) - udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0) + udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0, + 'task_id') udp_replay_approx_vnf.q_in = mock.MagicMock() udp_replay_approx_vnf.q_out = mock.MagicMock() udp_replay_approx_vnf.q_out.qsize = mock.Mock(return_value=0) @@ -390,7 +382,8 @@ class TestUdpReplayApproxVnf(unittest.TestCase): nfvi_context.attrs = {'nfvi_type': 'baremetal'} mock_get_ctx.return_value = nfvi_context - udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0) + udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0, + 'task_id') udp_replay_approx_vnf.queue_wrapper = mock.MagicMock() udp_replay_approx_vnf.nfvi_context = mock_get_ctx udp_replay_approx_vnf.nfvi_context.attrs = {'nfvi_type': 'baremetal'} @@ -415,7 +408,8 @@ class TestUdpReplayApproxVnf(unittest.TestCase): nfvi_context.attrs = {'nfvi_type': "baremetal"} mock_get_ctx.return_value = nfvi_context - udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0) + udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0, + 'task_id') udp_replay_approx_vnf.setup_helper.bound_pci = ['0000:00:0.1', '0000:00:0.3'] udp_replay_approx_vnf.all_ports = ["xe0", "xe1"] udp_replay_approx_vnf.ssh_helper.provision_tool = mock.MagicMock(return_value="tool_path") @@ -437,7 +431,8 @@ class TestUdpReplayApproxVnf(unittest.TestCase): def test_run_udp_replay(self, ssh, *args): mock_ssh(ssh) - udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0) + udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0, + 'task_id') udp_replay_approx_vnf._build_config = mock.MagicMock() udp_replay_approx_vnf.queue_wrapper = mock.MagicMock() udp_replay_approx_vnf.scenario_helper = mock.MagicMock() @@ -451,7 +446,8 @@ class TestUdpReplayApproxVnf(unittest.TestCase): def test_instantiate(self, ssh, *args): mock_ssh(ssh) - udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0) + udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0, + 'task_id') udp_replay_approx_vnf.q_out.put("Replay>") udp_replay_approx_vnf.WAIT_TIME = 0 udp_replay_approx_vnf.setup_helper.setup_vnf_environment = mock.Mock() @@ -469,7 +465,8 @@ class TestUdpReplayApproxVnf(unittest.TestCase): @mock.patch('yardstick.ssh.SSH') @mock.patch(SSH_HELPER) def test_instantiate_panic(self, *args): - udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0) + udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0, + 'task_id') udp_replay_approx_vnf.WAIT_TIME = 0 udp_replay_approx_vnf.q_out.put("some text PANIC some text") udp_replay_approx_vnf.setup_helper.setup_vnf_environment = mock.Mock()