コード例 #1
0
    def test__get_cgnapt_config(self):
        vnfd_helper = mock.MagicMock()
        vnfd_helper.port_pairs.uplink_ports = [{"name": 'a'}, {"name": "b"}, {"name": "c"}]

        helper = cgnapt_vnf.CgnaptApproxSetupEnvHelper(
            vnfd_helper, mock.Mock(), mock.Mock())
        result = helper._get_cgnapt_config()
        self.assertIsNotNone(result)
コード例 #2
0
    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.options = {}
        scenario_helper.all_options = {}

        cgnat_approx_setup_helper = cgnapt_vnf.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)
コード例 #3
0
 def test_scale(self):
     helper = cgnapt_vnf.CgnaptApproxSetupEnvHelper(
         mock.Mock(), mock.Mock(), mock.Mock())
     with self.assertRaises(NotImplementedError):
         helper.scale()