diff options
author | 2018-06-22 07:23:19 +0000 | |
---|---|---|
committer | 2018-06-22 07:23:19 +0000 | |
commit | ab9af285f2fce475c2389f15696e2800a0010f0c (patch) | |
tree | 358a9d7a23505fc06a2bad8696af85cbfd275ca5 /tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py | |
parent | 358a935273268d83fc059dbcfae1ca678dde35d7 (diff) | |
parent | 2b3e7b36557744460ccee0d77b6498f02b9e3a21 (diff) |
Merge "Add --hwlb options as a command line argument for SampleVNF" into stable/fraser
Diffstat (limited to 'tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py')
-rw-r--r-- | tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py index edaa0ad7e..b7731b649 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py @@ -20,7 +20,7 @@ import mock from tests.unit import STL_MOCKS from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh - +from yardstick.common import utils STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) @@ -79,6 +79,27 @@ link 1 up with self.assertRaises(NotImplementedError): helper.scale() + @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.open') + @mock.patch.object(utils, 'find_relative_file') + @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.MultiPortConfig') + @mock.patch.object(utils, 'open_relative_file') + def test_build_config(self, *args): + vnfd_helper = mock.Mock() + ssh_helper = mock.Mock() + scenario_helper = mock.Mock() + scenario_helper.vnf_cfg = {'lb_config': 'HW'} + scenario_helper.all_options = {} + + cgnat_approx_setup_helper = CgnaptApproxSetupEnvHelper(vnfd_helper, + ssh_helper, + scenario_helper) + + cgnat_approx_setup_helper.ssh_helper.provision_tool = mock.Mock(return_value='tool_path') + cgnat_approx_setup_helper.ssh_helper.all_ports = mock.Mock() + cgnat_approx_setup_helper.vnfd_helper.port_nums = mock.Mock(return_value=[0, 1]) + expected = 'sudo tool_path -p 0x3 -f /tmp/cgnapt_config -s /tmp/cgnapt_script --hwlb 3' + self.assertEqual(cgnat_approx_setup_helper.build_config(), expected) + @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Process") class TestCgnaptApproxVnf(unittest.TestCase): |