1 # Copyright (c) 2017-2019 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.
19 from yardstick.tests import STL_MOCKS
20 from yardstick.common import exceptions as y_exceptions
21 from yardstick.network_services.vnf_generic.vnf.prox_irq import ProxIrqGen
22 from yardstick.network_services.vnf_generic.vnf.prox_irq import ProxIrqVNF
23 from yardstick.benchmark.contexts import base as ctx_base
25 SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper'
27 STLClient = mock.MagicMock()
28 stl_patch = mock.patch.dict("sys.modules", STL_MOCKS)
32 from yardstick.network_services.vnf_generic.vnf import prox_vnf
33 from yardstick.tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh
37 class TestProxIrqVNF(unittest.TestCase):
42 'tg__1': 'trafficgen_1.yardstick',
43 'vnf__1': 'vnf.yardstick'},
45 'duration': 600, 'type': 'Duration'},
46 'topology': 'prox-tg-topology-2.yaml',
47 'traffic_profile': '../../traffic_profiles/prox_binsearch.yaml',
50 'tg__1': {'prox_args': {'-e': '',
52 'prox_config': 'configs/l3-gen-2.cfg',
54 '/root/dppd-PROX-v035/build/prox'},
56 'prox_args': {'-t': ''},
57 'prox_config': 'configs/l3-swap-2.cfg',
58 'prox_path': '/root/dppd-PROX-v035/build/prox'}}}
61 'short-name': 'VpeVnf',
66 'network': '152.16.100.20',
67 'netmask': '255.255.255.0',
68 'gateway': '152.16.100.20',
72 'network': '152.16.40.20',
73 'netmask': '255.255.255.0',
74 'gateway': '152.16.40.20',
78 'description': 'VPE approximation using DPDK',
79 'name': 'vpevnf-baremetal',
82 'network': '0064:ff9b:0:0:0:0:9810:6414',
84 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
88 'network': '0064:ff9b:0:0:0:0:9810:2814',
90 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
94 'id': 'vpevnf-baremetal',
95 'external-interface': [
97 'virtual-interface': {
98 'dst_mac': '00:00:00:00:00:03',
99 'vpci': '0000:05:00.0',
100 'local_ip': '152.16.100.19',
101 'type': 'PCI-PASSTHROUGH',
102 'netmask': '255.255.255.0',
104 'bandwidth': '10 Gbps',
105 'dst_ip': '152.16.100.20',
106 'local_mac': '00:00:00:00:00:01'
108 'vnfd-connection-point-ref': 'xe0',
112 'virtual-interface': {
113 'dst_mac': '00:00:00:00:00:04',
114 'vpci': '0000:05:00.1',
115 'local_ip': '152.16.40.19',
116 'type': 'PCI-PASSTHROUGH',
117 'netmask': '255.255.255.0',
119 'bandwidth': '10 Gbps',
120 'dst_ip': '152.16.40.20',
121 'local_mac': '00:00:00:00:00:02'
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'
158 'vnfd:vnfd-catalog': {
166 "schema": "isb:traffic_profile:0.1",
168 "description": "Fixed traffic profile to run UDP traffic",
170 "traffic_type": "FixedTraffic",
171 "frame_rate": 100, # pps
180 'member-vnf-index': '3',
181 'role': 'TrafficGen',
182 'name': 'trafficgen_2.yardstick',
183 'vnfd-id-ref': 'tg__2',
187 'local_iface_name': 'ens513f0',
188 'vld_id': prox_vnf.ProxApproxVnf.DOWNLINK,
189 'netmask': '255.255.255.0',
190 'local_ip': '152.16.40.20',
191 'dst_mac': '00:00:00:00:00:01',
192 'local_mac': '00:00:00:00:00:03',
193 'dst_ip': '152.16.40.19',
195 'vpci': '0000:02:00.0',
199 'local_iface_name': 'ens513f1',
200 'netmask': '255.255.255.0',
201 'network': '202.16.100.0',
202 'local_ip': '202.16.100.20',
203 'local_mac': '00:1e:67:d0:60:5d',
205 'vpci': '0000:02:00.1',
210 'VNF model': 'l3fwd_vnf.yaml',
214 'member-vnf-index': '1',
215 'role': 'TrafficGen',
216 'name': 'trafficgen_1.yardstick',
217 'vnfd-id-ref': 'tg__1',
221 'local_iface_name': 'ens785f0',
222 'vld_id': prox_vnf.ProxApproxVnf.UPLINK,
223 'netmask': '255.255.255.0',
224 'local_ip': '152.16.100.20',
225 'dst_mac': '00:00:00:00:00:02',
226 'local_mac': '00:00:00:00:00:04',
227 'dst_ip': '152.16.100.19',
229 'vpci': '0000:05:00.0',
233 'local_iface_name': 'ens785f1',
234 'netmask': '255.255.255.0',
235 'local_ip': '152.16.100.21',
236 'local_mac': '00:00:00:00:00:01',
238 'vpci': '0000:05:00.1',
243 'VNF model': 'tg_rfc2544_tpl.yaml',
247 'name': 'vnf.yardstick',
248 'vnfd-id-ref': 'vnf__1',
252 'local_iface_name': 'ens786f0',
253 'vld_id': prox_vnf.ProxApproxVnf.UPLINK,
254 'netmask': '255.255.255.0',
255 'local_ip': '152.16.100.19',
256 'dst_mac': '00:00:00:00:00:04',
257 'local_mac': '00:00:00:00:00:02',
258 'dst_ip': '152.16.100.20',
260 'vpci': '0000:05:00.0',
264 'local_iface_name': 'ens786f1',
265 'vld_id': prox_vnf.ProxApproxVnf.DOWNLINK,
266 'netmask': '255.255.255.0',
267 'local_ip': '152.16.40.19',
268 'dst_mac': '00:00:00:00:00:03',
269 'local_mac': '00:00:00:00:00:01',
270 'dst_ip': '152.16.40.20',
272 'vpci': '0000:05:00.1',
278 'netmask': '255.255.255.0',
279 'gateway': '152.16.100.20',
280 'network': '152.16.100.20',
284 'netmask': '255.255.255.0',
285 'gateway': '152.16.40.20',
286 'network': '152.16.40.20',
290 'member-vnf-index': '2',
297 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
298 'network': '0064:ff9b:0:0:0:0:9810:6414',
303 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
304 'network': '0064:ff9b:0:0:0:0:9810:2814',
309 'VNF model': 'prox_vnf.yaml',
314 def test___init__(self):
315 prox_irq_vnf = ProxIrqVNF('vnf1', self.VNFD_0)
317 self.assertEqual(prox_irq_vnf.name, 'vnf1')
318 self.assertDictEqual(prox_irq_vnf.vnfd_helper, self.VNFD_0)
320 @mock.patch.object(ctx_base.Context, 'get_physical_node_from_server', return_value='mock_node')
321 @mock.patch(SSH_HELPER)
322 def test_collect_kpi(self, ssh, *args):
325 vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
326 resource_helper = mock.MagicMock()
328 resource_helper = mock.MagicMock()
330 core_1 = {'bucket_1': 1, 'bucket_2': 2, 'bucket_3': 3, 'bucket_4': 4, 'bucket_5': 5,
331 'bucket_6': 6, 'bucket_7': 7, 'bucket_8': 8, 'bucket_9': 9, 'bucket_10': 10,
332 'bucket_11': 11, 'bucket_12': 12, 'bucket_0': 100, 'cpu': 1, 'max_irq': 12,
334 core_2 = {'bucket_1': 1, 'bucket_2': 2, 'bucket_3': 3, 'bucket_4': 4, 'bucket_5': 5,
335 'bucket_6': 0, 'bucket_7': 0, 'bucket_8': 0, 'bucket_9': 0, 'bucket_10': 0,
336 'bucket_11': 0, 'bucket_12': 0, 'bucket_0': 100, 'cpu': 2, 'max_irq': 12,
339 irq_data = {'core_1': core_1, 'core_2': core_2}
340 resource_helper.execute.return_value = (irq_data)
342 build_config_file = mock.MagicMock()
343 build_config_file.return_value = None
345 prox_irq_vnf = ProxIrqVNF(VNF_NAME, vnfd)
347 startup = ["global", [["eal", "-4"]]]
348 master_0 = ["core 0", [["mode", "master"]]]
349 core_1 = ["core 1", [["mode", "irq"]]]
350 core_2 = ["core 2", [["mode", "irq"], ["task", "2"]]]
352 prox_irq_vnf.setup_helper._prox_config_data = \
353 [startup, master_0, core_1, core_2]
355 prox_irq_vnf.scenario_helper.scenario_cfg = self.SCENARIO_CFG
356 prox_irq_vnf.resource_helper = resource_helper
357 prox_irq_vnf.setup_helper.build_config_file = build_config_file
359 result = prox_irq_vnf.collect_kpi()
360 self.assertDictEqual(result["collect_stats"], {})
362 result = prox_irq_vnf.collect_kpi()
363 self.assertFalse('bucket_10' in result["collect_stats"]['core_2'])
364 self.assertFalse('bucket_11' in result["collect_stats"]['core_2'])
365 self.assertFalse('bucket_12' in result["collect_stats"]['core_2'])
366 self.assertEqual(result["collect_stats"]['core_2']['max_irq'], 12)
369 @mock.patch(SSH_HELPER)
370 def test_vnf_execute_oserror(self, ssh, *args):
373 vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
374 prox_irq_vnf = ProxIrqVNF(VNF_NAME, vnfd)
375 prox_irq_vnf.resource_helper = resource_helper = mock.Mock()
377 resource_helper.execute.side_effect = OSError(errno.EPIPE, "")
378 prox_irq_vnf.vnf_execute("", _ignore_errors=True)
380 resource_helper.execute.side_effect = OSError(errno.ESHUTDOWN, "")
381 prox_irq_vnf.vnf_execute("", _ignore_errors=True)
383 resource_helper.execute.side_effect = OSError(errno.EADDRINUSE, "")
384 with self.assertRaises(OSError):
385 prox_irq_vnf.vnf_execute("", _ignore_errors=True)
387 @mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.socket')
388 @mock.patch(SSH_HELPER)
389 def test_terminate(self, ssh, *args):
391 vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
393 mock_ssh(ssh, exec_result=(1, "", ""))
394 prox_irq_vnf = ProxIrqVNF(VNF_NAME, vnfd)
396 prox_irq_vnf._terminated = mock.MagicMock()
397 prox_irq_vnf._traffic_process = mock.MagicMock()
398 prox_irq_vnf._traffic_process.terminate = mock.Mock()
399 prox_irq_vnf.ssh_helper = mock.MagicMock()
400 prox_irq_vnf.setup_helper = mock.MagicMock()
401 prox_irq_vnf.resource_helper = mock.MagicMock()
402 prox_irq_vnf._vnf_wrapper.setup_helper = mock.MagicMock()
403 prox_irq_vnf._vnf_wrapper._vnf_process = mock.MagicMock(**{"is_alive.return_value": False})
404 prox_irq_vnf._vnf_wrapper.resource_helper = mock.MagicMock()
406 prox_irq_vnf._run_prox = mock.Mock(return_value=0)
407 prox_irq_vnf.q_in = mock.Mock()
408 prox_irq_vnf.q_out = mock.Mock()
410 self.assertIsNone(prox_irq_vnf.terminate())
412 @mock.patch(SSH_HELPER)
413 def test_wait_for_instantiate_panic(self, ssh, *args):
414 vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
416 mock_ssh(ssh, exec_result=(1, "", ""))
417 prox_irq_vnf = ProxIrqVNF(VNF_NAME, vnfd)
419 prox_irq_vnf._terminated = mock.MagicMock()
420 prox_irq_vnf._traffic_process = mock.MagicMock()
421 prox_irq_vnf._traffic_process.terminate = mock.Mock()
422 prox_irq_vnf.ssh_helper = mock.MagicMock()
423 prox_irq_vnf.setup_helper = mock.MagicMock()
424 prox_irq_vnf.resource_helper = mock.MagicMock()
425 prox_irq_vnf._vnf_wrapper.setup_helper = mock.MagicMock()
426 prox_irq_vnf._vnf_wrapper._vnf_process = mock.MagicMock(**{"is_alive.return_value": False})
427 prox_irq_vnf._vnf_wrapper.resource_helper = mock.MagicMock()
429 prox_irq_vnf._run_prox = mock.Mock(return_value=0)
430 prox_irq_vnf.q_in = mock.Mock()
431 prox_irq_vnf.q_out = mock.Mock()
432 prox_irq_vnf.WAIT_TIME = 0
433 with self.assertRaises(RuntimeError):
434 prox_irq_vnf.wait_for_instantiate()
436 class TestProxIrqGen(unittest.TestCase):
441 'tg__1': 'trafficgen_1.yardstick',
442 'vnf__1': 'vnf.yardstick'},
444 'duration': 600, 'type': 'Duration'},
445 'topology': 'prox-tg-topology-2.yaml',
446 'traffic_profile': '../../traffic_profiles/prox_binsearch.yaml',
449 'tg__1': {'prox_args': {'-e': '',
451 'prox_config': 'configs/l3-gen-2.cfg',
453 '/root/dppd-PROX-v035/build/prox'},
455 'prox_args': {'-t': ''},
456 'prox_config': 'configs/l3-swap-2.cfg',
457 'prox_path': '/root/dppd-PROX-v035/build/prox'}}}
460 'short-name': 'VpeVnf',
465 'network': '152.16.100.20',
466 'netmask': '255.255.255.0',
467 'gateway': '152.16.100.20',
471 'network': '152.16.40.20',
472 'netmask': '255.255.255.0',
473 'gateway': '152.16.40.20',
477 'description': 'VPE approximation using DPDK',
478 'name': 'vpevnf-baremetal',
481 'network': '0064:ff9b:0:0:0:0:9810:6414',
483 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
487 'network': '0064:ff9b:0:0:0:0:9810:2814',
489 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
493 'id': 'vpevnf-baremetal',
494 'external-interface': [
496 'virtual-interface': {
497 'dst_mac': '00:00:00:00:00:03',
498 'vpci': '0000:05:00.0',
500 'local_ip': '152.16.100.19',
501 'type': 'PCI-PASSTHROUGH',
502 'netmask': '255.255.255.0',
504 'bandwidth': '10 Gbps',
505 'dst_ip': '152.16.100.20',
506 'local_mac': '00:00:00:00:00:01'
508 'vnfd-connection-point-ref': 'xe0',
512 'virtual-interface': {
513 'dst_mac': '00:00:00:00:00:04',
514 'vpci': '0000:05:00.1',
516 'local_ip': '152.16.40.19',
517 'type': 'PCI-PASSTHROUGH',
518 'netmask': '255.255.255.0',
520 'bandwidth': '10 Gbps',
521 'dst_ip': '152.16.40.20',
522 'local_mac': '00:00:00:00:00:02'
524 'vnfd-connection-point-ref': 'xe1',
530 'description': 'Vpe approximation using DPDK',
532 'vdu-id': 'vpevnf-baremetal',
545 'connection-point': [
555 'id': 'VpeApproxVnf', 'name': 'VPEVnfSsh'
559 'vnfd:vnfd-catalog': {
567 "schema": "isb:traffic_profile:0.1",
569 "description": "Fixed traffic profile to run UDP traffic",
571 "traffic_type": "FixedTraffic",
572 "frame_rate": 100, # pps
581 'member-vnf-index': '3',
582 'role': 'TrafficGen',
583 'name': 'trafficgen_2.yardstick',
584 'vnfd-id-ref': 'tg__2',
588 'local_iface_name': 'ens513f0',
589 'vld_id': prox_vnf.ProxApproxVnf.DOWNLINK,
590 'netmask': '255.255.255.0',
591 'local_ip': '152.16.40.20',
592 'dst_mac': '00:00:00:00:00:01',
593 'local_mac': '00:00:00:00:00:03',
594 'dst_ip': '152.16.40.19',
596 'vpci': '0000:02:00.0',
600 'local_iface_name': 'ens513f1',
601 'netmask': '255.255.255.0',
602 'network': '202.16.100.0',
603 'local_ip': '202.16.100.20',
604 'local_mac': '00:1e:67:d0:60:5d',
606 'vpci': '0000:02:00.1',
611 'VNF model': 'l3fwd_vnf.yaml',
615 'member-vnf-index': '1',
616 'role': 'TrafficGen',
617 'name': 'trafficgen_1.yardstick',
618 'vnfd-id-ref': 'tg__1',
622 'local_iface_name': 'ens785f0',
623 'vld_id': prox_vnf.ProxApproxVnf.UPLINK,
624 'netmask': '255.255.255.0',
625 'local_ip': '152.16.100.20',
626 'dst_mac': '00:00:00:00:00:02',
627 'local_mac': '00:00:00:00:00:04',
628 'dst_ip': '152.16.100.19',
630 'vpci': '0000:05:00.0',
634 'local_iface_name': 'ens785f1',
635 'netmask': '255.255.255.0',
636 'local_ip': '152.16.100.21',
637 'local_mac': '00:00:00:00:00:01',
639 'vpci': '0000:05:00.1',
644 'VNF model': 'tg_rfc2544_tpl.yaml',
648 'name': 'vnf.yardstick',
649 'vnfd-id-ref': 'vnf__1',
653 'local_iface_name': 'ens786f0',
654 'vld_id': prox_vnf.ProxApproxVnf.UPLINK,
655 'netmask': '255.255.255.0',
656 'local_ip': '152.16.100.19',
657 'dst_mac': '00:00:00:00:00:04',
658 'local_mac': '00:00:00:00:00:02',
659 'dst_ip': '152.16.100.20',
661 'vpci': '0000:05:00.0',
665 'local_iface_name': 'ens786f1',
666 'vld_id': prox_vnf.ProxApproxVnf.DOWNLINK,
667 'netmask': '255.255.255.0',
668 'local_ip': '152.16.40.19',
669 'dst_mac': '00:00:00:00:00:03',
670 'local_mac': '00:00:00:00:00:01',
671 'dst_ip': '152.16.40.20',
673 'vpci': '0000:05:00.1',
679 'netmask': '255.255.255.0',
680 'gateway': '152.16.100.20',
681 'network': '152.16.100.20',
685 'netmask': '255.255.255.0',
686 'gateway': '152.16.40.20',
687 'network': '152.16.40.20',
691 'member-vnf-index': '2',
698 'gateway': '0064:ff9b:0:0:0:0:9810:6414',
699 'network': '0064:ff9b:0:0:0:0:9810:6414',
704 'gateway': '0064:ff9b:0:0:0:0:9810:2814',
705 'network': '0064:ff9b:0:0:0:0:9810:2814',
710 'VNF model': 'prox_vnf.yaml',
716 def test__check_status(self):
717 prox_irq_gen = ProxIrqGen('tg1', self.VNFD_0)
719 with self.assertRaises(NotImplementedError):
720 prox_irq_gen._check_status()
722 def test_listen_traffic(self):
723 prox_irq_gen = ProxIrqGen('tg1', self.VNFD_0)
725 prox_irq_gen.listen_traffic(mock.Mock())
727 def test_verify_traffic(self):
728 prox_irq_gen = ProxIrqGen('tg1', self.VNFD_0)
730 prox_irq_gen.verify_traffic(mock.Mock())
732 mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.socket')
733 @mock.patch(SSH_HELPER)
734 def test_terminate(self, ssh, *args):
736 vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
737 prox_traffic_gen = ProxIrqGen(VNF_NAME, vnfd)
738 prox_traffic_gen._terminated = mock.MagicMock()
739 prox_traffic_gen._traffic_process = mock.MagicMock()
740 prox_traffic_gen._traffic_process.terminate = mock.Mock()
741 prox_traffic_gen.ssh_helper = mock.MagicMock()
742 prox_traffic_gen.setup_helper = mock.MagicMock()
743 prox_traffic_gen.resource_helper = mock.MagicMock()
744 prox_traffic_gen._vnf_wrapper.setup_helper = mock.MagicMock()
745 prox_traffic_gen._vnf_wrapper._vnf_process = mock.MagicMock()
746 prox_traffic_gen._vnf_wrapper.resource_helper = mock.MagicMock()
747 self.assertIsNone(prox_traffic_gen.terminate())
749 def test__wait_for_process(self):
750 prox_irq_gen = ProxIrqGen('tg1', self.VNFD_0)
751 with mock.patch.object(prox_irq_gen, '_check_status',
752 return_value=0) as mock_status, \
753 mock.patch.object(prox_irq_gen, '_tg_process') as mock_proc:
754 mock_proc.is_alive.return_value = True
755 mock_proc.exitcode = 234
756 self.assertEqual(prox_irq_gen._wait_for_process(), 234)
757 mock_proc.is_alive.assert_called_once()
758 mock_status.assert_called_once()
760 def test__wait_for_process_not_alive(self):
761 prox_irq_gen = ProxIrqGen('tg1', self.VNFD_0)
762 with mock.patch.object(prox_irq_gen, '_tg_process') as mock_proc:
763 mock_proc.is_alive.return_value = False
764 self.assertRaises(RuntimeError, prox_irq_gen._wait_for_process)
765 mock_proc.is_alive.assert_called_once()
767 def test__wait_for_process_delayed(self):
768 prox_irq_gen = ProxIrqGen('tg1', self.VNFD_0)
769 with mock.patch.object(prox_irq_gen, '_check_status',
770 side_effect=[1, 0]) as mock_status, \
771 mock.patch.object(prox_irq_gen,
772 '_tg_process') as mock_proc:
773 mock_proc.is_alive.return_value = True
774 mock_proc.exitcode = 234
775 self.assertEqual(prox_irq_gen._wait_for_process(), 234)
776 mock_proc.is_alive.assert_has_calls([mock.call(), mock.call()])
777 mock_status.assert_has_calls([mock.call(), mock.call()])
779 def test_scale(self):
780 prox_irq_gen = ProxIrqGen('tg1', self.VNFD_0)
781 self.assertRaises(y_exceptions.FunctionNotImplemented,
784 @mock.patch.object(ctx_base.Context, 'get_physical_node_from_server', return_value='mock_node')
785 @mock.patch(SSH_HELPER)
786 def test_collect_kpi(self, ssh, *args):
789 vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
790 resource_helper = mock.MagicMock()
792 core_1 = {'bucket_1': 1, 'bucket_2': 2, 'bucket_3': 3, 'bucket_4': 4, 'bucket_5': 5,
793 'bucket_6': 6, 'bucket_7': 7, 'bucket_8': 8, 'bucket_9': 9, 'bucket_10': 10,
794 'bucket_11': 11, 'bucket_12': 12, 'bucket_0': 100, 'cpu': 1, 'max_irq': 12,
796 core_2 = {'bucket_1': 1, 'bucket_2': 2, 'bucket_3': 3, 'bucket_4': 4, 'bucket_5': 5,
797 'bucket_6': 0, 'bucket_7': 0, 'bucket_8': 0, 'bucket_9': 0, 'bucket_10': 0,
798 'bucket_11': 0, 'bucket_12': 0, 'bucket_0': 100, 'cpu': 2, 'max_irq': 12,
801 irq_data = {'core_1': core_1, 'core_2': core_2}
802 resource_helper.sut.irq_core_stats.return_value = (irq_data)
804 build_config_file = mock.MagicMock()
805 build_config_file.return_value = None
807 prox_irq_gen = ProxIrqGen(VNF_NAME, vnfd)
809 startup = ["global", [["eal", "-4"]]]
810 master_0 = ["core 0", [["mode", "master"]]]
811 core_1 = ["core 1", [["mode", "irq"]]]
812 core_2 = ["core 2", [["mode", "irq"], ["task", "2"]]]
814 prox_irq_gen.setup_helper._prox_config_data = \
815 [startup, master_0, core_1, core_2]
817 prox_irq_gen.scenario_helper.scenario_cfg = self.SCENARIO_CFG
818 prox_irq_gen.resource_helper = resource_helper
819 prox_irq_gen.setup_helper.build_config_file = build_config_file
821 result = prox_irq_gen.collect_kpi()
822 self.assertDictEqual(result["collect_stats"], {})
824 result = prox_irq_gen.collect_kpi()
825 self.assertFalse('bucket_10' in result["collect_stats"]['core_2'])
826 self.assertFalse('bucket_11' in result["collect_stats"]['core_2'])
827 self.assertFalse('bucket_12' in result["collect_stats"]['core_2'])
828 self.assertEqual(result["collect_stats"]['core_2']['max_irq'], 12)