Beispiel #1
0
 def test_instantiate_panic(self, mock_process):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = mock.Mock(return_value=(1, "", ""))
         ssh.from_node.return_value = ssh_mock
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         acl_approx_vnf = AclApproxVnf(name, vnfd)
         self.scenario_cfg['vnf_options'] = {
             'acl': {
                 'cfg': "",
                 'rules': ""
             }
         }
         acl_approx_vnf._run_acl = mock.Mock(return_value=0)
         acl_approx_vnf.WAIT_TIME = 0
         acl_approx_vnf.resource_helper = mock.MagicMock()
         acl_approx_vnf._build_config = mock.MagicMock()
         acl_approx_vnf._vnf_process = mock.MagicMock()
         acl_approx_vnf._vnf_process.start = mock.Mock()
         acl_approx_vnf._vnf_process.is_alive = mock.Mock(return_value=True)
         self.assertRaises(ValueError, acl_approx_vnf.instantiate,
                           self.scenario_cfg, self.context_cfg)
         acl_approx_vnf.q_out.put("PANIC")
         acl_approx_vnf.WAIT_TIME = 0
         self.assertRaises(ValueError, acl_approx_vnf.instantiate,
                           self.scenario_cfg, self.context_cfg)
Beispiel #2
0
    def test_instantiate(self, ssh, *args):
        mock_ssh(ssh)

        vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
        acl_approx_vnf = AclApproxVnf(name, vnfd)
        acl_approx_vnf.deploy_helper = mock.MagicMock()
        acl_approx_vnf.resource_helper = mock.MagicMock()
        acl_approx_vnf._build_config = mock.MagicMock()
        self.scenario_cfg['vnf_options'] = {'acl': {'cfg': "", 'rules': ""}}
        acl_approx_vnf.q_out.put("pipeline>")
        acl_approx_vnf.WAIT_TIME = 0
        self.scenario_cfg.update({"nodes": {"vnf__1": ""}})
        self.assertIsNone(
            acl_approx_vnf.instantiate(self.scenario_cfg, self.context_cfg))
Beispiel #3
0
 def test_instantiate(self, mock_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]
         acl_approx_vnf = AclApproxVnf(name, vnfd)
         acl_approx_vnf.ssh_helper = ssh
         acl_approx_vnf.deploy_helper = mock.MagicMock()
         acl_approx_vnf.resource_helper = mock.MagicMock()
         acl_approx_vnf._build_config = mock.MagicMock()
         self.scenario_cfg['vnf_options'] = {'acl': {'cfg': "",
                                                     'rules': ""}}
         acl_approx_vnf.q_out.put("pipeline>")
         acl_approx_vnf.WAIT_TIME = 0
         self.scenario_cfg.update({"nodes": {"vnf__1": ""}})
         self.assertIsNone(acl_approx_vnf.instantiate(self.scenario_cfg,
                                                      self.context_cfg))