1 # Copyright (c) 2016-2017 Intel Corporation
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 from multiprocessing import Process, Queue
21 from six.moves import configparser
24 from yardstick.tests import STL_MOCKS
25 from yardstick.tests.unit.network_services.vnf_generic.vnf.test_base import FileAbsPath
26 from yardstick.tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
27 from yardstick.network_services.vnf_generic.vnf.base import QueueFileWrapper
28 from yardstick.network_services.vnf_generic.vnf.base import VnfdHelper
31 SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper'
33 STLClient = mock.MagicMock()
34 stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
38 from yardstick.network_services.vnf_generic.vnf.vpe_vnf import ConfigCreate
39 from yardstick.network_services.nfvi.resource import ResourceProfile
40 from yardstick.network_services.vnf_generic.vnf.vpe_vnf import \
41 VpeApproxVnf, VpeApproxSetupEnvHelper
44 TEST_FILE_YAML = 'nsb_test_case.yaml'
48 PING_OUTPUT_1 = "Pkts in: 101\r\n\tPkts dropped by AH: 100\r\n\tPkts dropped by other: 100"
50 MODULE_PATH = FileAbsPath(__file__)
51 get_file_abspath = MODULE_PATH.get_path
54 class TestConfigCreate(unittest.TestCase):
57 'short-name': 'VpeVnf',
62 'network': '152.16.100.20',
63 'netmask': '255.255.255.0',
64 'gateway': '152.16.100.20',
68 'network': '152.16.40.20',
69 'netmask': '255.255.255.0',
70 'gateway': '152.16.40.20',
74 'description': 'VPE approximation using DPDK',
75 'name': 'vpevnf-baremetal',
78 'network': '0064:ff9b:0:0:0:0:9810:6414',
80 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
84 'network': '0064:ff9b:0:0:0:0:9810:2814',
86 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
90 'id': 'vpevnf-baremetal',
91 'external-interface': [
93 'virtual-interface': {
94 'dst_mac': '00:00:00:00:00:03',
95 'vpci': '0000:05:00.0',
96 'local_ip': '152.16.100.19',
97 'type': 'PCI-PASSTHROUGH',
98 'netmask': '255.255.255.0',
100 'bandwidth': '10 Gbps',
101 'dst_ip': '152.16.100.20',
102 'local_mac': '00:00:00:00:00:01',
103 'vld_id': 'uplink_0',
106 'vnfd-connection-point-ref': 'xe0',
110 'virtual-interface': {
111 'dst_mac': '00:00:00:00:00:04',
112 'vpci': '0000:05:00.1',
113 'local_ip': '152.16.40.19',
114 'type': 'PCI-PASSTHROUGH',
115 'netmask': '255.255.255.0',
117 'bandwidth': '10 Gbps',
118 'dst_ip': '152.16.40.20',
119 'local_mac': '00:00:00:00:00:02',
120 'vld_id': 'downlink_0',
123 'vnfd-connection-point-ref': 'xe1',
129 'description': 'Vpe approximation using DPDK',
131 'vdu-id': 'vpevnf-baremetal',
144 'connection-point': [
154 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'
157 def test___init__(self):
158 vnfd_helper = VnfdHelper(self.VNFD_0)
159 config_create = ConfigCreate(vnfd_helper, 2)
160 self.assertEqual(config_create.uplink_ports, ['xe0'])
161 self.assertEqual(config_create.downlink_ports, ['xe1'])
162 self.assertEqual(config_create.socket, 2)
164 def test_dpdk_port_to_link_id(self):
165 vnfd_helper = VnfdHelper(self.VNFD_0)
166 config_create = ConfigCreate(vnfd_helper, 2)
167 self.assertEqual(config_create.dpdk_port_to_link_id_map, {'xe0': 0, 'xe1': 1})
169 def test_vpe_initialize(self):
170 vnfd_helper = VnfdHelper(self.VNFD_0)
171 config_create = ConfigCreate(vnfd_helper, 2)
172 config = configparser.ConfigParser()
173 config_create.vpe_initialize(config)
174 self.assertEqual(config.get('EAL', 'log_level'), '0')
175 self.assertEqual(config.get('PIPELINE0', 'type'), 'MASTER')
176 self.assertEqual(config.get('PIPELINE0', 'core'), 's2C0')
177 self.assertEqual(config.get('MEMPOOL0', 'pool_size'), '256K')
178 self.assertEqual(config.get('MEMPOOL1', 'pool_size'), '2M')
180 def test_vpe_rxq(self):
181 vnfd_helper = VnfdHelper(self.VNFD_0)
182 config_create = ConfigCreate(vnfd_helper, 2)
183 config = configparser.ConfigParser()
184 config_create.downlink_ports = ['xe0']
185 config_create.vpe_rxq(config)
186 self.assertEqual(config.get('RXQ0.0', 'mempool'), 'MEMPOOL1')
188 def test_get_sink_swq(self):
189 vnfd_helper = VnfdHelper(self.VNFD_0)
190 config_create = ConfigCreate(vnfd_helper, 2)
191 config = configparser.ConfigParser()
192 config.add_section('PIPELINE0')
193 config.set('PIPELINE0', 'key1', 'value1')
194 config.set('PIPELINE0', 'key2', 'value2 SINK')
195 config.set('PIPELINE0', 'key3', 'TM value3')
196 config.set('PIPELINE0', 'key4', 'value4')
197 config.set('PIPELINE0', 'key5', 'the SINK value5')
199 self.assertEqual(config_create.get_sink_swq(config, 'PIPELINE0', 'key1', 5), 'SWQ-1')
200 self.assertEqual(config_create.get_sink_swq(config, 'PIPELINE0', 'key2', 5), 'SWQ-1 SINK0')
201 self.assertEqual(config_create.get_sink_swq(config, 'PIPELINE0', 'key3', 5), 'SWQ-1 TM5')
202 config_create.sw_q += 1
203 self.assertEqual(config_create.get_sink_swq(config, 'PIPELINE0', 'key4', 5), 'SWQ0')
204 self.assertEqual(config_create.get_sink_swq(config, 'PIPELINE0', 'key5', 5), 'SWQ0 SINK1')
206 def test_generate_vpe_script(self):
207 vnfd_helper = VnfdHelper(self.VNFD_0)
208 vpe_config_vnf = ConfigCreate(vnfd_helper, 2)
212 "virtual-interface": {
214 "dst_mac": "00:00:00:00:00:00:02",
219 "virtual-interface": {
221 "dst_mac": "00:00:00:00:00:00:02",
225 vpe_config_vnf.downlink_ports = ['xe1']
226 vpe_config_vnf.uplink_ports = ['xe2']
227 result = vpe_config_vnf.generate_vpe_script(intf)
228 self.assertIsInstance(result, str)
229 self.assertNotEqual(result, '')
231 def test_create_vpe_config(self):
232 vnfd_helper = VnfdHelper(self.VNFD_0)
233 config_create = ConfigCreate(vnfd_helper, 23)
234 config_create.downlink_ports = ['xe1']
235 config_create.uplink_ports = ['xe1']
236 curr_path = os.path.dirname(os.path.abspath(__file__))
237 vpe_cfg = "samples/vnf_samples/nsut/vpe/vpe_config"
238 vnf_cfg = os.path.join(curr_path, "../../../../..", vpe_cfg)
239 config_create.create_vpe_config(vnf_cfg)
240 os.system("git checkout -- %s" % vnf_cfg)
243 class TestVpeApproxVnf(unittest.TestCase):
246 'short-name': 'VpeVnf',
251 'network': '152.16.100.20',
252 'netmask': '255.255.255.0',
253 'gateway': '152.16.100.20',
257 'network': '152.16.40.20',
258 'netmask': '255.255.255.0',
259 'gateway': '152.16.40.20',
263 'description': 'VPE approximation using DPDK',
264 'name': 'vpevnf-baremetal',
267 'network': '0064:ff9b:0:0:0:0:9810:6414',
269 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
273 'network': '0064:ff9b:0:0:0:0:9810:2814',
275 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
279 'id': 'vpevnf-baremetal',
280 'external-interface': [
282 'virtual-interface': {
283 'dst_mac': '00:00:00:00:00:04',
284 'vpci': '0000:05:00.0',
285 'local_ip': '152.16.100.19',
286 'type': 'PCI-PASSTHROUGH',
287 'netmask': '255.255.255.0',
289 'bandwidth': '10 Gbps',
291 'dst_ip': '152.16.100.20',
292 'local_iface_name': 'xe0',
293 'local_mac': '00:00:00:00:00:02',
294 'vld_id': 'uplink_0',
297 'vnfd-connection-point-ref': 'xe0',
301 'virtual-interface': {
302 'dst_mac': '00:00:00:00:00:03',
303 'vpci': '0000:05:00.1',
304 'local_ip': '152.16.40.19',
305 'type': 'PCI-PASSTHROUGH',
307 'netmask': '255.255.255.0',
309 'bandwidth': '10 Gbps',
310 'dst_ip': '152.16.40.20',
311 'local_iface_name': 'xe1',
312 'local_mac': '00:00:00:00:00:01',
313 'vld_id': 'downlink_0',
316 'vnfd-connection-point-ref': 'xe1',
322 'description': 'Vpe approximation using DPDK',
324 'vdu-id': 'vpevnf-baremetal',
337 'connection-point': [
347 'id': 'VpeApproxVnf',
352 'vnfd:vnfd-catalog': {
364 'allowed_drop_rate': '0.8 - 1',
367 'cfg': 'acl_1rule.yaml',
377 'task_id': 'a70bdf4a-8e67-47a3-9dc1-273c14506eb7',
378 'tc': 'tc_ipv4_1Mflow_64B_packetsize',
380 'object': 'NetworkServiceTestCase',
382 'output_filename': '/tmp/yardstick.out',
387 'traffic_profile': 'ipv4_throughput_vpe.yaml',
389 'flow': 'ipv4_Packets_vpe.yaml',
390 'imix': 'imix_voice.yaml',
394 'tg__2': 'trafficgen_2.yardstick',
395 'tg__1': 'trafficgen_1.yardstick',
396 'vnf__1': 'vnf.yardstick',
398 'topology': 'vpe-tg-topology-baremetal.yaml',
404 'member-vnf-index': '3',
405 'role': 'TrafficGen',
406 'name': 'trafficgen_2.yardstick',
407 'vnfd-id-ref': 'tg__2',
411 'local_iface_name': 'ens513f0',
412 'vld_id': VpeApproxVnf.DOWNLINK,
413 'netmask': '255.255.255.0',
414 'local_ip': '152.16.40.20',
415 'dst_mac': '00:00:00:00:00:01',
416 'local_mac': '00:00:00:00:00:03',
417 'dst_ip': '152.16.40.19',
419 'vpci': '0000:02:00.0',
423 'local_iface_name': 'ens513f1',
424 'netmask': '255.255.255.0',
425 'network': '202.16.100.0',
426 'local_ip': '202.16.100.20',
427 'local_mac': '00:1e:67:d0:60:5d',
429 'vpci': '0000:02:00.1',
434 'VNF model': 'l3fwd_vnf.yaml',
438 'member-vnf-index': '1',
439 'role': 'TrafficGen',
440 'name': 'trafficgen_1.yardstick',
441 'vnfd-id-ref': 'tg__1',
445 'local_iface_name': 'ens785f0',
446 'vld_id': VpeApproxVnf.UPLINK,
447 'netmask': '255.255.255.0',
448 'local_ip': '152.16.100.20',
449 'dst_mac': '00:00:00:00:00:02',
450 'local_mac': '00:00:00:00:00:04',
451 'dst_ip': '152.16.100.19',
453 'vpci': '0000:05:00.0',
457 'local_iface_name': 'ens785f1',
458 'netmask': '255.255.255.0',
459 'local_ip': '152.16.100.21',
460 'local_mac': '00:00:00:00:00:01',
462 'vpci': '0000:05:00.1',
467 'VNF model': 'tg_rfc2544_tpl.yaml',
471 'name': 'vnf.yardstick',
472 'vnfd-id-ref': 'vnf__1',
476 'local_iface_name': 'ens786f0',
477 'vld_id': VpeApproxVnf.UPLINK,
478 'netmask': '255.255.255.0',
479 'local_ip': '152.16.100.19',
480 'dst_mac': '00:00:00:00:00:04',
481 'local_mac': '00:00:00:00:00:02',
482 'dst_ip': '152.16.100.20',
484 'vpci': '0000:05:00.0',
488 'local_iface_name': 'ens786f1',
489 'vld_id': VpeApproxVnf.DOWNLINK,
490 'netmask': '255.255.255.0',
491 'local_ip': '152.16.40.19',
492 'dst_mac': '00:00:00:00:00:03',
493 'local_mac': '00:00:00:00:00:01',
494 'dst_ip': '152.16.40.20',
496 'vpci': '0000:05:00.1',
502 'netmask': '255.255.255.0',
503 'gateway': '152.16.100.20',
504 'network': '152.16.100.20',
508 'netmask': '255.255.255.0',
509 'gateway': '152.16.40.20',
510 'network': '152.16.40.20',
514 'member-vnf-index': '2',
521 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
522 'network': '0064:ff9b:0:0:0:0:9810:6414',
527 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
528 'network': '0064:ff9b:0:0:0:0:9810:2814',
533 'VNF model': 'vpe_vnf.yaml',
539 self._mock_time_sleep = mock.patch.object(time, 'sleep')
540 self.mock_time_sleep = self._mock_time_sleep.start()
541 self.addCleanup(self._stop_mocks)
543 def _stop_mocks(self):
544 self._mock_time_sleep.stop()
546 def test___init__(self):
547 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
548 self.assertIsNone(vpe_approx_vnf._vnf_process)
550 @mock.patch(SSH_HELPER)
551 def test_collect_kpi_sa_not_running(self, ssh):
554 resource = mock.Mock(autospec=ResourceProfile)
555 resource.check_if_system_agent_running.return_value = 1, ''
556 resource.amqp_collect_nfvi_kpi.return_value = {'foo': 234}
557 resource.check_if_system_agent_running.return_value = (1, None)
559 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
560 vpe_approx_vnf.q_in = mock.MagicMock()
561 vpe_approx_vnf.q_out = mock.MagicMock()
562 vpe_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
563 vpe_approx_vnf.resource_helper.resource = resource
566 'pkt_in_down_stream': 0,
567 'pkt_in_up_stream': 0,
568 'pkt_drop_down_stream': 0,
569 'pkt_drop_up_stream': 0,
570 'collect_stats': {'core': {}},
572 self.assertEqual(vpe_approx_vnf.collect_kpi(), expected)
574 @mock.patch(SSH_HELPER)
575 def test_collect_kpi_sa_running(self, ssh):
578 resource = mock.Mock(autospec=ResourceProfile)
579 resource.check_if_system_agent_running.return_value = 0, '1234'
580 resource.amqp_collect_nfvi_kpi.return_value = {'foo': 234}
582 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
583 vpe_approx_vnf.q_in = mock.MagicMock()
584 vpe_approx_vnf.q_out = mock.MagicMock()
585 vpe_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
586 vpe_approx_vnf.resource_helper.resource = resource
589 'pkt_in_down_stream': 0,
590 'pkt_in_up_stream': 0,
591 'pkt_drop_down_stream': 0,
592 'pkt_drop_up_stream': 0,
593 'collect_stats': {'core': {'foo': 234}},
595 self.assertEqual(vpe_approx_vnf.collect_kpi(), expected)
597 @mock.patch(SSH_HELPER)
598 def test_vnf_execute(self, ssh):
600 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
601 vpe_approx_vnf.q_in = mock.MagicMock()
602 vpe_approx_vnf.q_out = mock.MagicMock()
603 vpe_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
604 self.assertEqual(vpe_approx_vnf.vnf_execute("quit", 0), '')
606 @mock.patch(SSH_HELPER)
607 def test_run_vpe(self, ssh):
610 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
611 vpe_approx_vnf.tc_file_name = get_file_abspath(TEST_FILE_YAML)
612 vpe_approx_vnf.vnf_cfg = {
615 'worker_config': '1C/1T',
618 vpe_approx_vnf.scenario_helper.scenario_cfg = {
622 'topology': 'nsb_test_case.yaml',
623 'vnf_config': 'vpe_config',
627 vpe_approx_vnf.topology = "nsb_test_case.yaml"
628 vpe_approx_vnf.nfvi_type = "baremetal"
629 vpe_approx_vnf._provide_config_file = mock.Mock()
630 vpe_approx_vnf._build_config = mock.MagicMock()
632 self.assertIsInstance(vpe_approx_vnf.ssh_helper, mock.Mock)
633 self.assertIsInstance(vpe_approx_vnf.ssh_helper, mock.Mock)
634 self.assertIsNone(vpe_approx_vnf._run())
636 @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.MultiPortConfig")
637 @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Context")
638 @mock.patch("yardstick.network_services.vnf_generic.vnf.vpe_vnf.ConfigCreate")
639 @mock.patch("six.moves.builtins.open")
640 @mock.patch(SSH_HELPER)
641 def test_build_config(self, ssh, *args):
643 vpe_approx_vnf = VpeApproxSetupEnvHelper(mock.MagicMock(),
644 mock.MagicMock(), mock.MagicMock())
645 vpe_approx_vnf.tc_file_name = get_file_abspath(TEST_FILE_YAML)
646 vpe_approx_vnf.generate_port_pairs = mock.Mock()
647 vpe_approx_vnf.vnf_cfg = {
650 'worker_config': '1C/1T',
653 vpe_approx_vnf.scenario_helper.scenario_cfg = {
657 'topology': 'nsb_test_case.yaml',
658 'vnf_config': 'vpe_config',
662 vpe_approx_vnf.topology = "nsb_test_case.yaml"
663 vpe_approx_vnf.nfvi_type = "baremetal"
664 vpe_approx_vnf._provide_config_file = mock.Mock()
666 vpe_approx_vnf.ssh_helper = mock.MagicMock()
667 vpe_approx_vnf.scenario_helper = mock.MagicMock()
668 vpe_approx_vnf.ssh_helper.bin_path = mock.Mock()
669 vpe_approx_vnf.ssh_helper.upload_config_file = mock.MagicMock()
670 self.assertIsNone(vpe_approx_vnf._build_vnf_ports())
672 vpe_approx_vnf.ssh_helper.provision_tool = mock.Mock(return_value='tool_path')
673 vpe_approx_vnf.ssh_helper.all_ports = mock.Mock()
674 vpe_approx_vnf.vnfd_helper.port_nums = mock.Mock(return_value=[0, 1])
675 vpe_approx_vnf.scenario_helper.vnf_cfg = {'lb_config': 'HW'}
677 expected = 'sudo tool_path -p 0x3 -f /tmp/vpe_config -s /tmp/vpe_script --hwlb 3'
678 self.assertEqual(vpe_approx_vnf.build_config(), expected)
680 @mock.patch(SSH_HELPER)
681 def test_wait_for_instantiate(self, ssh):
684 mock_process = mock.Mock(autospec=Process)
685 mock_process.is_alive.return_value = True
686 mock_process.exitcode = 432
688 mock_q_out = mock.Mock(autospec=Queue)
689 mock_q_out.get.side_effect = iter(["pipeline>"])
690 mock_q_out.qsize.side_effect = range(1, -1, -1)
692 mock_resource = mock.MagicMock()
694 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
695 vpe_approx_vnf._vnf_process = mock_process
696 vpe_approx_vnf.q_out = mock_q_out
697 vpe_approx_vnf.queue_wrapper = mock.Mock(autospec=QueueFileWrapper)
698 vpe_approx_vnf.resource_helper.resource = mock_resource
700 vpe_approx_vnf.q_out.put("pipeline>")
701 self.assertEqual(vpe_approx_vnf.wait_for_instantiate(), 432)
703 @mock.patch(SSH_HELPER)
704 def test_wait_for_instantiate_fragmented(self, ssh):
707 mock_process = mock.Mock(autospec=Process)
708 mock_process.is_alive.return_value = True
709 mock_process.exitcode = 432
711 # test that fragmented pipeline prompt is recognized
712 mock_q_out = mock.Mock(autospec=Queue)
713 mock_q_out.get.side_effect = iter(["wow pipel", "ine>"])
714 mock_q_out.qsize.side_effect = range(2, -1, -1)
716 mock_resource = mock.MagicMock()
718 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
719 vpe_approx_vnf._vnf_process = mock_process
720 vpe_approx_vnf.q_out = mock_q_out
721 vpe_approx_vnf.queue_wrapper = mock.Mock(autospec=QueueFileWrapper)
722 vpe_approx_vnf.resource_helper.resource = mock_resource
724 self.assertEqual(vpe_approx_vnf.wait_for_instantiate(), 432)
726 @mock.patch(SSH_HELPER)
727 def test_wait_for_instantiate_crash(self, ssh):
728 mock_ssh(ssh, exec_result=(1, "", ""))
730 mock_process = mock.Mock(autospec=Process)
731 mock_process.is_alive.return_value = False
732 mock_process.exitcode = 432
734 mock_resource = mock.MagicMock()
736 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
737 vpe_approx_vnf._vnf_process = mock_process
738 vpe_approx_vnf.resource_helper.resource = mock_resource
740 with self.assertRaises(RuntimeError) as raised:
741 vpe_approx_vnf.wait_for_instantiate()
743 self.assertIn('VNF process died', str(raised.exception))
745 @mock.patch(SSH_HELPER)
746 def test_wait_for_instantiate_panic(self, ssh):
747 mock_ssh(ssh, exec_result=(1, "", ""))
749 mock_process = mock.Mock(autospec=Process)
750 mock_process.is_alive.return_value = True
751 mock_process.exitcode = 432
753 mock_resource = mock.MagicMock()
755 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
756 vpe_approx_vnf._vnf_process = mock_process
757 vpe_approx_vnf.resource_helper.resource = mock_resource
759 vpe_approx_vnf.q_out.put("PANIC")
760 with self.assertRaises(RuntimeError) as raised:
761 vpe_approx_vnf.wait_for_instantiate()
763 self.assertIn('Error starting', str(raised.exception))
765 @mock.patch(SSH_HELPER)
766 def test_wait_for_instantiate_panic_fragmented(self, ssh):
767 mock_ssh(ssh, exec_result=(1, "", ""))
769 mock_process = mock.Mock(autospec=Process)
770 mock_process.is_alive.return_value = True
771 mock_process.exitcode = 432
773 # test that fragmented PANIC is recognized
774 mock_q_out = mock.Mock(autospec=Queue)
775 mock_q_out.get.side_effect = iter(["omg PA", "NIC this is bad"])
776 mock_q_out.qsize.side_effect = range(2, -1, -1)
778 mock_resource = mock.MagicMock()
780 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
781 vpe_approx_vnf._vnf_process = mock_process
782 vpe_approx_vnf.q_out = mock_q_out
783 vpe_approx_vnf.resource_helper.resource = mock_resource
785 with self.assertRaises(RuntimeError) as raised:
786 vpe_approx_vnf.wait_for_instantiate()
788 self.assertIn('Error starting', str(raised.exception))
790 @mock.patch(SSH_HELPER)
791 def test_terminate(self, ssh):
794 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
795 vpe_approx_vnf._vnf_process = mock.MagicMock()
796 vpe_approx_vnf._resource_collect_stop = mock.Mock()
797 vpe_approx_vnf.resource_helper = mock.MagicMock()
799 self.assertIsNone(vpe_approx_vnf.terminate())