Esempio n. 1
0
 def test_instantiate_panic(self):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         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]
         vpe_approx_vnf = VpeApproxVnf(vnfd)
         self.scenario_cfg['vnf_options'] = {'vpe': {'cfg': ""}}
         vpe_approx_vnf._run_vpe = mock.Mock(return_value=0)
         vpe_vnf.WAIT_TIME = 1
         self.assertRaises(RuntimeError, vpe_approx_vnf.instantiate,
                           self.scenario_cfg, self.context_cfg)
Esempio n. 2
0
 def test_run_vpe(self):
     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]
         vpe_approx_vnf = VpeApproxVnf(vnfd)
         curr_path = os.path.dirname(os.path.abspath(__file__))
         vpe_vnf = os.path.join(curr_path, "vpe_config")
         queue_wrapper = \
             QueueFileWrapper(vpe_approx_vnf.q_in,
                              vpe_approx_vnf.q_out, "pipeline>")
         self.assertEqual(None,
                          vpe_approx_vnf._run_vpe(queue_wrapper, vpe_vnf))
Esempio n. 3
0
 def test_instantiate(self):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         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]
         vpe_approx_vnf = VpeApproxVnf(vnfd)
         self.scenario_cfg['vnf_options'] = {'vpe': {'cfg': ""}}
         vpe_approx_vnf._run_vpe = mock.Mock(return_value=0)
         vpe_approx_vnf._resource_collect_start = mock.Mock(return_value=0)
         vpe_approx_vnf.q_out.put("pipeline>")
         vpe_vnf.WAIT_TIME = 3
         self.assertEqual(
             0,
             vpe_approx_vnf.instantiate(self.scenario_cfg,
                                        self.context_cfg))