Exemple #1
0
 def test_run_vfw(self, mock_open, eval, hex, mock_process):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(0, "", ""))
         ssh_mock.run = \
             mock.Mock(return_value=(0, "", ""))
         ssh.from_node.return_value = ssh_mock
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         vfw_approx_vnf = FWApproxVnf(name, vnfd)
         vfw_approx_vnf._build_config = mock.MagicMock()
         vfw_approx_vnf.queue_wrapper = mock.MagicMock()
         vfw_approx_vnf.ssh_helper = mock.MagicMock()
         vfw_approx_vnf.ssh_helper.run = mock.MagicMock()
         vfw_approx_vnf.scenario_helper.scenario_cfg = self.scenario_cfg
         vfw_approx_vnf.vnf_cfg = {
             'lb_config': 'SW',
             'lb_count': 1,
             'worker_config': '1C/1T',
             'worker_threads': 1
         }
         vfw_approx_vnf.all_options = {
             'traffic_type': '4',
             'topology': 'nsb_test_case.yaml'
         }
         vfw_approx_vnf._run()
         vfw_approx_vnf.ssh_helper.run.assert_called_once()
Exemple #2
0
    def test_instantiate(self, ssh, *args):
        mock_ssh(ssh)

        vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
        vfw_approx_vnf = FWApproxVnf(name, vnfd)
        vfw_approx_vnf.ssh_helper = ssh
        vfw_approx_vnf.deploy_helper = mock.MagicMock()
        vfw_approx_vnf.resource_helper = mock.MagicMock()
        vfw_approx_vnf._build_config = mock.MagicMock()
        self.scenario_cfg['vnf_options'] = {'acl': {'cfg': "", 'rules': ""}}
        self.scenario_cfg.update({"nodes": {"vnf__1": ""}})
        self.assertIsNone(
            vfw_approx_vnf.instantiate(self.scenario_cfg, self.context_cfg))
Exemple #3
0
 def test_instantiate(self, Context, mock_yang, mock_find, mock_process):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = mock.Mock(return_value=(0, "", ""))
         ssh.from_node.return_value = ssh_mock
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         vfw_approx_vnf = FWApproxVnf(name, vnfd)
         vfw_approx_vnf.ssh_helper = ssh
         vfw_approx_vnf.deploy_helper = mock.MagicMock()
         vfw_approx_vnf.resource_helper = mock.MagicMock()
         vfw_approx_vnf._build_config = mock.MagicMock()
         self.scenario_cfg['vnf_options'] = {'acl': {'cfg': "",
                                                     'rules': ""}}
         self.scenario_cfg.update({"nodes": {"vnf__1": ""}})
         self.assertIsNone(vfw_approx_vnf.instantiate(self.scenario_cfg,
                                                      self.context_cfg))
Exemple #4
0
    def test_run_vfw(self, ssh, *args):
        mock_ssh(ssh)

        vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
        vfw_approx_vnf = FWApproxVnf(name, vnfd)
        vfw_approx_vnf._build_config = mock.MagicMock()
        vfw_approx_vnf.queue_wrapper = mock.MagicMock()
        vfw_approx_vnf.ssh_helper = mock.MagicMock()
        vfw_approx_vnf.ssh_helper.run = mock.MagicMock()
        vfw_approx_vnf.scenario_helper.scenario_cfg = self.scenario_cfg
        vfw_approx_vnf.vnf_cfg = {'lb_config': 'SW',
                                  'lb_count': 1,
                                  'worker_config': '1C/1T',
                                  'worker_threads': 1}
        vfw_approx_vnf.all_options = {'traffic_type': '4',
                                      'topology': 'nsb_test_case.yaml'}
        vfw_approx_vnf._run()
        vfw_approx_vnf.ssh_helper.run.assert_called_once()