def test__build_pipeline_kwargs(self, ssh, mock_get_ctx, *args): mock_ssh(ssh) nfvi_context = mock.Mock() 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.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") udp_replay_approx_vnf.scenario_helper = ScenarioHelper(name='vnf__1') udp_replay_approx_vnf.scenario_helper.scenario_cfg = self.SCENARIO_CFG udp_replay_approx_vnf._build_pipeline_kwargs() self.assertEqual( udp_replay_approx_vnf.pipeline_kwargs, { 'config': '(0,0,1),(1,0,2)', 'cpu_mask_hex': '0x7', 'hw_csum': '', 'port_mask_hex': '0x3', 'tool_path': 'tool_path', 'whitelist': '0000:00:0.1 -w 0000:00:0.3' })
def test__build_pipeline_kwargs(self, mock_open, mock_process): with mock.patch("yardstick.ssh.SSH") as ssh: ssh_mock = mock.Mock(autospec=ssh.SSH) 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.nfvi_type = "baremetal" udp_approx_vnf.bound_pci = [] udp_approx_vnf.all_ports = [0, 1] udp_approx_vnf.ssh_helper = mock.MagicMock( **{"provision_tool.return_value": "tool_path"}) 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._build_pipeline_kwargs() self.assertEqual( udp_approx_vnf.pipeline_kwargs, { 'config': '(0, 0, 1)(1, 0, 2)', 'cpu_mask_hex': '0x6', 'hw_csum': '', 'ports_len_hex': '0x3', 'tool_path': 'tool_path', 'whitelist': '' })