def bad_test_instantiate(self, ssh, mock_find, mock_cpu_sys_cores,
                             mock_time):
        mock_ssh(ssh)

        mock_cpu_sys_cores.get_core_socket.return_value = {'0': '01234'}

        mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
        mock_traffic_profile.get_traffic_definition.return_value = "64"
        mock_traffic_profile.params = self.TRAFFIC_PROFILE

        vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
        prox_traffic_gen = ProxTrafficGen(NAME, vnfd)
        ssh_helper = mock.MagicMock(**{
            "execute.return_value": (0, "", ""),
            "bin_path": ""
        })
        prox_traffic_gen.ssh_helper = ssh_helper
        prox_traffic_gen.setup_helper.dpdk_bind_helper.ssh_helper = ssh_helper
        prox_traffic_gen.setup_helper._setup_resources = mock.MagicMock()
        prox_traffic_gen.setup_hugepages = mock.MagicMock()
        prox_traffic_gen.generate_prox_config_file = mock.MagicMock()
        prox_traffic_gen.upload_prox_config = mock.MagicMock()
        prox_traffic_gen.setup_helper._find_used_drivers = mock.MagicMock()
        prox_traffic_gen.setup_helper.used_drivers = {}
        prox_traffic_gen.setup_helper.bound_pci = []
        prox_traffic_gen._start_server = mock.Mock(return_value=0)
        prox_traffic_gen._tg_process = mock.MagicMock()
        prox_traffic_gen._tg_process.start = mock.Mock()
        prox_traffic_gen._tg_process.exitcode = 0
        prox_traffic_gen._tg_process._is_alive = mock.Mock(return_value=1)
        prox_traffic_gen.ssh_helper = mock.MagicMock()
        prox_traffic_gen.resource_helper.ssh_helper = mock.MagicMock()
        scenario_cfg = {
            'task_path': '',
            'options': {
                'tg__1': {
                    'prox_args': {
                        '-e': '',
                        '-t': ''
                    },
                    'prox_config': 'configs/l3-gen-2.cfg',
                    'prox_path': '/root/dppd-PROX-v035/build/prox'
                },
                'vnf__1': {
                    'prox_args': {
                        '-t': ''
                    },
                    'prox_config': 'configs/l3-swap-2.cfg',
                    'prox_path': '/root/dppd-PROX-v035/build/prox'
                }
            }
        }
        prox_traffic_gen.instantiate(scenario_cfg, {})
예제 #2
0
 def test_terminate(self, ssh, mock_socket, mock_time):
     mock_ssh(ssh)
     vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
     prox_traffic_gen = ProxTrafficGen(NAME, vnfd)
     prox_traffic_gen._terminated = mock.MagicMock()
     prox_traffic_gen._traffic_process = mock.MagicMock()
     prox_traffic_gen._traffic_process.terminate = mock.Mock()
     prox_traffic_gen.ssh_helper = mock.MagicMock()
     prox_traffic_gen.setup_helper = mock.MagicMock()
     prox_traffic_gen.resource_helper = mock.MagicMock()
     self.assertEqual(None, prox_traffic_gen.terminate())
예제 #3
0
 def test_terminate(self, ssh, *args):
     mock_ssh(ssh)
     vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
     prox_traffic_gen = ProxTrafficGen(NAME, vnfd)
     prox_traffic_gen._terminated = mock.MagicMock()
     prox_traffic_gen._traffic_process = mock.MagicMock()
     prox_traffic_gen._traffic_process.terminate = mock.Mock()
     prox_traffic_gen.ssh_helper = mock.MagicMock()
     prox_traffic_gen.setup_helper = mock.MagicMock()
     prox_traffic_gen.resource_helper = mock.MagicMock()
     prox_traffic_gen._vnf_wrapper.setup_helper = mock.MagicMock()
     prox_traffic_gen._vnf_wrapper._vnf_process = mock.MagicMock()
     prox_traffic_gen._vnf_wrapper.resource_helper = mock.MagicMock()
     self.assertIsNone(prox_traffic_gen.terminate())
예제 #4
0
    def test__traffic_runner(self, ssh, *args):
        mock_ssh(ssh)

        mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
        mock_traffic_profile.get_traffic_definition.return_value = "64"
        mock_traffic_profile.execute_traffic.return_value = "64"
        mock_traffic_profile.params = self.TRAFFIC_PROFILE

        vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
        sut = ProxTrafficGen(NAME, vnfd)
        sut._get_socket = mock.MagicMock()
        sut.ssh_helper = mock.Mock()
        sut.ssh_helper.run = mock.Mock()
        sut.setup_helper.prox_config_dict = {}
        sut._connect_client = mock.Mock(autospec=STLClient)
        sut._connect_client.get_stats = mock.Mock(return_value="0")
        sut._traffic_runner(mock_traffic_profile)