Create a SampleVNF MQ consumer class
[yardstick.git] / yardstick / tests / unit / network_services / vnf_generic / vnf / test_udp_replay.py
index 1c4ced3..56c971d 100644 (file)
 # 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()