예제 #1
0
    def test_run_udp_replay(self, mock_open, eval, hex, mock_process):
        with mock.patch("yardstick.ssh.SSH") as ssh:
            ssh_mock = mock.Mock(autospec=ssh.SSH)
            ssh_mock.execute = \
                mock.Mock(return_value=(0, "", ""))
            ssh_mock.run = \
                mock.Mock(return_value=(0, "", ""))
            ssh.from_node.return_value = ssh_mock
            vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
            udp_approx_vnf = UdpReplayApproxVnf(NAME, vnfd)
            udp_approx_vnf._build_config = mock.MagicMock()
            udp_approx_vnf.queue_wrapper = mock.MagicMock()
            udp_approx_vnf.ssh_helper = mock.MagicMock()
            udp_approx_vnf.ssh_helper.run = mock.MagicMock()
            udp_approx_vnf.vnf_cfg = {
                'lb_config': 'SW',
                'lb_count': 1,
                'worker_config': '1C/1T',
                'worker_threads': 1
            }
            udp_approx_vnf.options = {
                'traffic_type': '4',
                'topology': 'nsb_test_case.yaml'
            }

            udp_approx_vnf._run()
            udp_approx_vnf.ssh_helper.run.assert_called_once()
    def test_run_udp_replay(self, ssh, _):
        mock_ssh(ssh)

        udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, self.VNFD_0)
        udp_replay_approx_vnf._build_config = mock.MagicMock()
        udp_replay_approx_vnf.queue_wrapper = mock.MagicMock()

        udp_replay_approx_vnf._run()

        udp_replay_approx_vnf.ssh_helper.run.assert_called_once()