コード例 #1
0
    def test_instantiate_error(self, ssh):
        mock_ssh(ssh, exec_result=(1, "", ""))

        vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
        trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
        trex_traffic_gen._start_server = mock.Mock(return_value=0)
        trex_traffic_gen._tg_process = mock.MagicMock()
        trex_traffic_gen._tg_process.start = mock.Mock()
        trex_traffic_gen._tg_process._is_alive = mock.Mock(return_value=0)
        trex_traffic_gen.ssh_helper = mock.MagicMock()
        trex_traffic_gen.resource_helper.ssh_helper = mock.MagicMock()
        self.assertIsNone(trex_traffic_gen.instantiate({}, {}))
コード例 #2
0
    def test_instantiate(self, ssh):
        mock_ssh(ssh)

        vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
        trex_traffic_gen = TrexTrafficGen(NAME, vnfd)
        trex_traffic_gen._start_server = mock.Mock(return_value=0)
        trex_traffic_gen._tg_process = mock.MagicMock()
        trex_traffic_gen._tg_process.start = mock.Mock()
        trex_traffic_gen._tg_process.exitcode = 0
        trex_traffic_gen._tg_process._is_alive = mock.Mock(return_value=1)
        trex_traffic_gen.ssh_helper = mock.MagicMock()
        trex_traffic_gen.resource_helper.ssh_helper = mock.MagicMock()
        trex_traffic_gen.setup_helper.setup_vnf_environment = mock.MagicMock()

        self.assertIsNone(trex_traffic_gen.instantiate(self.SCENARIO_CFG, self.CONTEXT_CFG))