aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py')
-rw-r--r--yardstick/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py111
1 files changed, 111 insertions, 0 deletions
diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
index 6d1d8c6..9a30fb9 100644
--- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
+++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
@@ -590,6 +590,27 @@ class TestProxSocketHelper(unittest.TestCase):
self.assertEqual(result, expected)
@mock.patch.object(prox_helpers.LOG, 'error')
+ def test_irq_core_stats(self, *args):
+ mock_socket = mock.MagicMock()
+ prox = prox_helpers.ProxSocketHelper(mock_socket)
+ prox.get_data = mock.MagicMock(return_value=('0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3'))
+
+ data_0 = {"cpu": 0, 'bucket_0': 1, 'bucket_1': 2, 'bucket_2': 3, 'bucket_3': 4,
+ 'bucket_4': 5, 'bucket_5': 0, 'bucket_6': 1, 'bucket_7': 2, 'bucket_8': 3,
+ 'bucket_9': 4, 'bucket_10': 5, 'bucket_11': 0, 'bucket_12': 1,
+ "max_irq": 0, "overflow": 10}
+
+ data_1 = {"cpu": 1, 'bucket_0': 1, 'bucket_1': 2, 'bucket_2': 3, 'bucket_3': 4,
+ 'bucket_4': 5, 'bucket_5': 0, 'bucket_6': 1, 'bucket_7': 2, 'bucket_8': 3,
+ 'bucket_9': 4, 'bucket_10': 5, 'bucket_11': 0, 'bucket_12': 1,
+ "max_irq": 0, "overflow": 10}
+
+ expected = {"core_0": data_0, "core_1": data_1}
+
+ result = prox.irq_core_stats([[0, 1], [1, 0]])
+ self.assertDictEqual(result, expected)
+
+ @mock.patch.object(prox_helpers.LOG, 'error')
def test_multi_port_stats(self, *args):
mock_socket = mock.MagicMock()
prox = prox_helpers.ProxSocketHelper(mock_socket)
@@ -1353,6 +1374,36 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
['missing_addtional_file', 'dofile("nosuch")'],
],
],
+ [
+ 'core 0',
+ [
+ ['name', 'p0']
+ ]
+ ],
+ [
+ 'core 1-4',
+ [
+ ['name', 'p1']
+ ]
+ ],
+ [
+ 'core 5,6',
+ [
+ ['name', 'p2']
+ ]
+ ],
+ [
+ 'core xx',
+ [
+ ['name', 'p3']
+ ]
+ ],
+ [
+ 'core $x',
+ [
+ ['name', 'p4']
+ ]
+ ]
]
expected = [
@@ -1382,6 +1433,54 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
['missing_addtional_file', 'dofile("nosuch")'],
],
],
+ [
+ 'core 0',
+ [
+ ['name', 'p0']
+ ]
+ ],
+ [
+ 'core 1',
+ [
+ ['name', 'p1']
+ ]
+ ],
+ [
+ 'core 2',
+ [
+ ['name', 'p1']
+ ]
+ ],
+ [
+ 'core 3',
+ [
+ ['name', 'p1']
+ ]
+ ],
+ [
+ 'core 4',
+ [
+ ['name', 'p1']
+ ]
+ ],
+ [
+ 'core 5',
+ [
+ ['name', 'p2']
+ ]
+ ],
+ [
+ 'core 6',
+ [
+ ['name', 'p2']
+ ]
+ ],
+ [
+ 'core $x',
+ [
+ ['name', 'p4']
+ ]
+ ]
]
result = helper.generate_prox_config_file('/c/d/e')
self.assertEqual(result, expected, str(result))
@@ -2708,3 +2807,15 @@ class TestProxlwAFTRProfileHelper(unittest.TestCase):
# negative pkt_size is the only way to make ratio > 1
helper.run_test(pkt_size=-1000, duration=5, value=6.5, tolerated_loss=0.0,
line_speed=constants.NIC_GBPS_DEFAULT * constants.ONE_GIGABIT_IN_BITS)
+
+
+class TestProxIrqProfileHelper(unittest.TestCase):
+
+ def test_run_test(self, *args):
+ resource_helper = mock.MagicMock()
+ helper = prox_helpers.ProxIrqProfileHelper(resource_helper)
+ self.assertIsNone(helper._cores_tuple)
+ self.assertIsNone(helper._ports_tuple)
+ self.assertIsNone(helper._latency_cores)
+ self.assertIsNone(helper._test_cores)
+ self.assertIsNone(helper._cpu_topology)