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_sleep = mock.patch.object(time, 'sleep').start()
541 def test___init__(self):
542 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
543 self.assertIsNone(vpe_approx_vnf._vnf_process)
545 @mock.patch(SSH_HELPER)
546 def test_collect_kpi_sa_not_running(self, ssh):
549 resource = mock.Mock(autospec=ResourceProfile)
550 resource.check_if_system_agent_running.return_value = 1, ''
551 resource.amqp_collect_nfvi_kpi.return_value = {'foo': 234}
552 resource.check_if_system_agent_running.return_value = (1, None)
554 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
555 vpe_approx_vnf.q_in = mock.MagicMock()
556 vpe_approx_vnf.q_out = mock.MagicMock()
557 vpe_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
558 vpe_approx_vnf.resource_helper.resource = resource
561 'pkt_in_down_stream': 0,
562 'pkt_in_up_stream': 0,
563 'pkt_drop_down_stream': 0,
564 'pkt_drop_up_stream': 0,
565 'collect_stats': {'core': {}},
567 self.assertEqual(vpe_approx_vnf.collect_kpi(), expected)
569 @mock.patch(SSH_HELPER)
570 def test_collect_kpi_sa_running(self, ssh):
573 resource = mock.Mock(autospec=ResourceProfile)
574 resource.check_if_system_agent_running.return_value = 0, '1234'
575 resource.amqp_collect_nfvi_kpi.return_value = {'foo': 234}
577 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
578 vpe_approx_vnf.q_in = mock.MagicMock()
579 vpe_approx_vnf.q_out = mock.MagicMock()
580 vpe_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
581 vpe_approx_vnf.resource_helper.resource = resource
584 'pkt_in_down_stream': 0,
585 'pkt_in_up_stream': 0,
586 'pkt_drop_down_stream': 0,
587 'pkt_drop_up_stream': 0,
588 'collect_stats': {'core': {'foo': 234}},
590 self.assertEqual(vpe_approx_vnf.collect_kpi(), expected)
592 @mock.patch(SSH_HELPER)
593 def test_vnf_execute(self, ssh):
595 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
596 vpe_approx_vnf.q_in = mock.MagicMock()
597 vpe_approx_vnf.q_out = mock.MagicMock()
598 vpe_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
599 self.assertEqual(vpe_approx_vnf.vnf_execute("quit", 0), '')
601 @mock.patch(SSH_HELPER)
602 def test_run_vpe(self, ssh):
605 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
606 vpe_approx_vnf.tc_file_name = get_file_abspath(TEST_FILE_YAML)
607 vpe_approx_vnf.vnf_cfg = {
610 'worker_config': '1C/1T',
613 vpe_approx_vnf.scenario_helper.scenario_cfg = {
617 'topology': 'nsb_test_case.yaml',
618 'vnf_config': 'vpe_config',
622 vpe_approx_vnf.topology = "nsb_test_case.yaml"
623 vpe_approx_vnf.nfvi_type = "baremetal"
624 vpe_approx_vnf._provide_config_file = mock.Mock()
625 vpe_approx_vnf._build_config = mock.MagicMock()
627 self.assertIsInstance(vpe_approx_vnf.ssh_helper, mock.Mock)
628 self.assertIsInstance(vpe_approx_vnf.ssh_helper, mock.Mock)
629 self.assertIsNone(vpe_approx_vnf._run())
631 @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.MultiPortConfig")
632 @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Context")
633 @mock.patch("yardstick.network_services.vnf_generic.vnf.vpe_vnf.ConfigCreate")
634 @mock.patch("six.moves.builtins.open")
635 @mock.patch(SSH_HELPER)
636 def test_build_config(self, ssh, *args):
638 vpe_approx_vnf = VpeApproxSetupEnvHelper(mock.MagicMock(),
639 mock.MagicMock(), mock.MagicMock())
640 vpe_approx_vnf.tc_file_name = get_file_abspath(TEST_FILE_YAML)
641 vpe_approx_vnf.generate_port_pairs = mock.Mock()
642 vpe_approx_vnf.vnf_cfg = {
645 'worker_config': '1C/1T',
648 vpe_approx_vnf.scenario_helper.scenario_cfg = {
652 'topology': 'nsb_test_case.yaml',
653 'vnf_config': 'vpe_config',
657 vpe_approx_vnf.topology = "nsb_test_case.yaml"
658 vpe_approx_vnf.nfvi_type = "baremetal"
659 vpe_approx_vnf._provide_config_file = mock.Mock()
661 vpe_approx_vnf.ssh_helper = mock.MagicMock()
662 vpe_approx_vnf.scenario_helper = mock.MagicMock()
663 vpe_approx_vnf.ssh_helper.bin_path = mock.Mock()
664 vpe_approx_vnf.ssh_helper.upload_config_file = mock.MagicMock()
665 self.assertIsNone(vpe_approx_vnf._build_vnf_ports())
667 vpe_approx_vnf.ssh_helper.provision_tool = mock.Mock(return_value='tool_path')
668 vpe_approx_vnf.ssh_helper.all_ports = mock.Mock()
669 vpe_approx_vnf.vnfd_helper.port_nums = mock.Mock(return_value=[0, 1])
670 vpe_approx_vnf.scenario_helper.vnf_cfg = {'lb_config': 'HW'}
672 expected = 'sudo tool_path -p 0x3 -f /tmp/vpe_config -s /tmp/vpe_script --hwlb 3'
673 self.assertEqual(vpe_approx_vnf.build_config(), expected)
675 @mock.patch(SSH_HELPER)
676 def test_wait_for_instantiate(self, ssh):
679 mock_process = mock.Mock(autospec=Process)
680 mock_process.is_alive.return_value = True
681 mock_process.exitcode = 432
683 mock_q_out = mock.Mock(autospec=Queue)
684 mock_q_out.get.side_effect = iter(["pipeline>"])
685 mock_q_out.qsize.side_effect = range(1, -1, -1)
687 mock_resource = mock.MagicMock()
689 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
690 vpe_approx_vnf._vnf_process = mock_process
691 vpe_approx_vnf.q_out = mock_q_out
692 vpe_approx_vnf.queue_wrapper = mock.Mock(autospec=QueueFileWrapper)
693 vpe_approx_vnf.resource_helper.resource = mock_resource
695 vpe_approx_vnf.q_out.put("pipeline>")
696 self.assertEqual(vpe_approx_vnf.wait_for_instantiate(), 432)
698 @mock.patch(SSH_HELPER)
699 def test_wait_for_instantiate_fragmented(self, ssh):
702 mock_process = mock.Mock(autospec=Process)
703 mock_process.is_alive.return_value = True
704 mock_process.exitcode = 432
706 # test that fragmented pipeline prompt is recognized
707 mock_q_out = mock.Mock(autospec=Queue)
708 mock_q_out.get.side_effect = iter(["wow pipel", "ine>"])
709 mock_q_out.qsize.side_effect = range(2, -1, -1)
711 mock_resource = mock.MagicMock()
713 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
714 vpe_approx_vnf._vnf_process = mock_process
715 vpe_approx_vnf.q_out = mock_q_out
716 vpe_approx_vnf.queue_wrapper = mock.Mock(autospec=QueueFileWrapper)
717 vpe_approx_vnf.resource_helper.resource = mock_resource
719 self.assertEqual(vpe_approx_vnf.wait_for_instantiate(), 432)
721 @mock.patch(SSH_HELPER)
722 def test_wait_for_instantiate_crash(self, ssh):
723 mock_ssh(ssh, exec_result=(1, "", ""))
725 mock_process = mock.Mock(autospec=Process)
726 mock_process.is_alive.return_value = False
727 mock_process.exitcode = 432
729 mock_resource = mock.MagicMock()
731 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
732 vpe_approx_vnf._vnf_process = mock_process
733 vpe_approx_vnf.resource_helper.resource = mock_resource
735 with self.assertRaises(RuntimeError) as raised:
736 vpe_approx_vnf.wait_for_instantiate()
738 self.assertIn('VNF process died', str(raised.exception))
740 @mock.patch(SSH_HELPER)
741 def test_wait_for_instantiate_panic(self, ssh):
742 mock_ssh(ssh, exec_result=(1, "", ""))
744 mock_process = mock.Mock(autospec=Process)
745 mock_process.is_alive.return_value = True
746 mock_process.exitcode = 432
748 mock_resource = mock.MagicMock()
750 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
751 vpe_approx_vnf._vnf_process = mock_process
752 vpe_approx_vnf.resource_helper.resource = mock_resource
754 vpe_approx_vnf.q_out.put("PANIC")
755 with self.assertRaises(RuntimeError) as raised:
756 vpe_approx_vnf.wait_for_instantiate()
758 self.assertIn('Error starting', str(raised.exception))
760 @mock.patch(SSH_HELPER)
761 def test_wait_for_instantiate_panic_fragmented(self, ssh):
762 mock_ssh(ssh, exec_result=(1, "", ""))
764 mock_process = mock.Mock(autospec=Process)
765 mock_process.is_alive.return_value = True
766 mock_process.exitcode = 432
768 # test that fragmented PANIC is recognized
769 mock_q_out = mock.Mock(autospec=Queue)
770 mock_q_out.get.side_effect = iter(["omg PA", "NIC this is bad"])
771 mock_q_out.qsize.side_effect = range(2, -1, -1)
773 mock_resource = mock.MagicMock()
775 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
776 vpe_approx_vnf._vnf_process = mock_process
777 vpe_approx_vnf.q_out = mock_q_out
778 vpe_approx_vnf.resource_helper.resource = mock_resource
780 with self.assertRaises(RuntimeError) as raised:
781 vpe_approx_vnf.wait_for_instantiate()
783 self.assertIn('Error starting', str(raised.exception))
785 @mock.patch(SSH_HELPER)
786 def test_terminate(self, ssh):
789 vpe_approx_vnf = VpeApproxVnf(NAME, self.VNFD_0)
790 vpe_approx_vnf._vnf_process = mock.MagicMock()
791 vpe_approx_vnf._resource_collect_stop = mock.Mock()
792 vpe_approx_vnf.resource_helper = mock.MagicMock()
794 self.assertIsNone(vpe_approx_vnf.terminate())