X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Funit%2Fnetwork_services%2Fvnf_generic%2Fvnf%2Ftest_base.py;h=478ce186b99cae9645f2f533625bf0d4dedd6339;hb=b00112e33caffee6b6b01402537e68007fdc8cb2;hp=8a5d836e0739dd3c9a2caf497193c3ca222af8c4;hpb=b39fe5457e846e734e980666bc209fb7c07a6bdc;p=yardstick.git diff --git a/tests/unit/network_services/vnf_generic/vnf/test_base.py b/tests/unit/network_services/vnf_generic/vnf/test_base.py index 8a5d836e0..478ce186b 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_base.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_base.py @@ -25,6 +25,7 @@ from multiprocessing import Queue from yardstick.network_services.vnf_generic.vnf.base import \ QueueFileWrapper, GenericVNF, GenericTrafficGen +from yardstick.ssh import SSH IP_PIPELINE_CFG_FILE_TPL = """ arp_route_tbl = ({port0_local_ip_hex},{port0_netmask_hex},1,""" @@ -48,9 +49,9 @@ class FileAbsPath(object): return file_path -def mock_ssh(ssh, spec=None, exec_result=_LOCAL_OBJECT, run_result=_LOCAL_OBJECT): +def mock_ssh(mock_ssh_type, spec=None, exec_result=_LOCAL_OBJECT, run_result=_LOCAL_OBJECT): if spec is None: - spec = ssh.SSH + spec = SSH if exec_result is _LOCAL_OBJECT: exec_result = 0, "", "" @@ -58,11 +59,12 @@ def mock_ssh(ssh, spec=None, exec_result=_LOCAL_OBJECT, run_result=_LOCAL_OBJECT if run_result is _LOCAL_OBJECT: run_result = 0, "", "" - ssh_mock = mock.Mock(autospec=spec) - ssh_mock._get_client.return_value = mock.Mock() - ssh_mock.execute.return_value = exec_result - ssh_mock.run.return_value = run_result - ssh.from_node.return_value = ssh_mock + mock_ssh_instance = mock.Mock(autospec=spec) + mock_ssh_instance._get_client.return_value = mock.Mock() + mock_ssh_instance.execute.return_value = exec_result + mock_ssh_instance.run.return_value = run_result + mock_ssh_type.from_node.return_value = mock_ssh_instance + return mock_ssh_instance class TestQueueFileWrapper(unittest.TestCase): @@ -148,7 +150,7 @@ class TestGenericVNF(unittest.TestCase): 'local_ip': '152.16.100.19', 'type': 'PCI-PASSTHROUGH', 'netmask': '255.255.255.0', - 'dpdk_port_num': '0', + 'dpdk_port_num': 0, 'bandwidth': '10 Gbps', 'dst_ip': '152.16.100.20', 'local_mac': '00:00:00:00:00:01' @@ -163,7 +165,7 @@ class TestGenericVNF(unittest.TestCase): 'local_ip': '152.16.40.19', 'type': 'PCI-PASSTHROUGH', 'netmask': '255.255.255.0', - 'dpdk_port_num': '1', + 'dpdk_port_num': 1, 'bandwidth': '10 Gbps', 'dst_ip': '152.16.40.20', 'local_mac': '00:00:00:00:00:02'