diff options
author | Abhijit Sinha <abhijit.sinha@intel.com> | 2018-11-07 11:25:44 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-11-07 11:25:44 +0000 |
commit | d4f4370bfe04dbf86024c69c1e7a0395ee62bff8 (patch) | |
tree | f7885dfcc708af323c211774392a35b93fce243a | |
parent | 9756d02c8d72a178e7136b9fc8031f671d2b8d5e (diff) | |
parent | 283a5313d7f93ba967fe336ef6d883a1c1f4a52b (diff) |
Merge "Add API for PPPoE clients statistic retrieval"
-rw-r--r-- | yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py | 41 | ||||
-rw-r--r-- | yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py | 20 |
2 files changed, 52 insertions, 9 deletions
diff --git a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py index 556682b29..631abec38 100644 --- a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py +++ b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py @@ -69,6 +69,7 @@ class IxNextgen(object): # pragma: no cover PORT_STATS_NAME_MAP = { "stat_name": 'Stat Name', + "port_name": 'Port Name', "Frames_Tx": 'Frames Tx.', "Valid_Frames_Rx": 'Valid Frames Rx.', "Frames_Tx_Rate": 'Frames Tx. Rate', @@ -85,6 +86,18 @@ class IxNextgen(object): # pragma: no cover "Store-Forward_Max_latency_ns": 'Store-Forward Max Latency (ns)', } + PPPOX_CLIENT_PER_PORT_NAME_MAP = { + 'subs_port': 'Port', + 'Sessions_Up': 'Sessions Up', + 'Sessions_Down': 'Sessions Down', + 'Sessions_Not_Started': 'Sessions Not Started', + 'Sessions_Total': 'Sessions Total' + } + + PORT_STATISTICS = '::ixNet::OBJ-/statistics/view:"Port Statistics"' + FLOW_STATISTICS = '::ixNet::OBJ-/statistics/view:"Flow Statistics"' + PPPOX_CLIENT_PER_PORT = '::ixNet::OBJ-/statistics/view:"PPPoX Client Per Port"' + @staticmethod def get_config(tg_cfg): card = [] @@ -681,12 +694,30 @@ class IxNextgen(object): # pragma: no cover :return: dictionary with the statistics; the keys of this dictionary are PORT_STATS_NAME_MAP and LATENCY_NAME_MAP keys. """ - port_statistics = '::ixNet::OBJ-/statistics/view:"Port Statistics"' - flow_statistics = '::ixNet::OBJ-/statistics/view:"Flow Statistics"' - stats = self._build_stats_map(port_statistics, + stats = self._build_stats_map(self.PORT_STATISTICS, + self.PORT_STATS_NAME_MAP) + stats.update(self._build_stats_map(self.FLOW_STATISTICS, + self.LATENCY_NAME_MAP)) + return stats + + def get_pppoe_scenario_statistics(self): + """Retrieve port, flow and PPPoE subscribers statistics + + "Port Statistics" parameters are stored in self.PORT_STATS_NAME_MAP. + "Flow Statistics" parameters are stored in self.LATENCY_NAME_MAP. + "PPPoX Client Per Port" parameters are stored in + self.PPPOE_CLIENT_PER_PORT_NAME_MAP + + :return: dictionary with the statistics; the keys of this dictionary + are PORT_STATS_NAME_MAP, LATENCY_NAME_MAP and + PPPOE_CLIENT_PER_PORT_NAME_MAP keys. + """ + stats = self._build_stats_map(self.PORT_STATISTICS, self.PORT_STATS_NAME_MAP) - stats.update(self._build_stats_map(flow_statistics, - self.LATENCY_NAME_MAP)) + stats.update(self._build_stats_map(self.FLOW_STATISTICS, + self.LATENCY_NAME_MAP)) + stats.update(self._build_stats_map(self.PPPOX_CLIENT_PER_PORT, + self.PPPOX_CLIENT_PER_PORT_NAME_MAP)) return stats def start_protocols(self): diff --git a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py index c80cbbe77..bea0cf1e5 100644 --- a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py +++ b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py @@ -582,15 +582,15 @@ class TestIxNextgen(unittest.TestCase): self.ixnet_gen.update_frame(TRAFFIC_PARAMETERS, 40) def test_get_statistics(self): - port_statistics = '::ixNet::OBJ-/statistics/view:"Port Statistics"' - flow_statistics = '::ixNet::OBJ-/statistics/view:"Flow Statistics"' with mock.patch.object(self.ixnet_gen, '_build_stats_map') as \ mock_build_stats: self.ixnet_gen.get_statistics() mock_build_stats.assert_has_calls([ - mock.call(port_statistics, self.ixnet_gen.PORT_STATS_NAME_MAP), - mock.call(flow_statistics, self.ixnet_gen.LATENCY_NAME_MAP)]) + mock.call(self.ixnet_gen.PORT_STATISTICS, + self.ixnet_gen.PORT_STATS_NAME_MAP), + mock.call(self.ixnet_gen.FLOW_STATISTICS, + self.ixnet_gen.LATENCY_NAME_MAP)]) def test__set_flow_tracking(self): self.ixnet_gen._ixnet.getList.return_value = ['traffic_item'] @@ -612,6 +612,18 @@ class TestIxNextgen(unittest.TestCase): 'encapsulation', '-offset', 'IPv4 TOS Precedence') self.assertEqual(self.ixnet.commit.call_count, 2) + def test_get_pppoe_scenario_statistics(self): + with mock.patch.object(self.ixnet_gen, '_build_stats_map') as \ + mock_build_stats: + self.ixnet_gen.get_pppoe_scenario_statistics() + + mock_build_stats.assert_any_call(self.ixnet_gen.PORT_STATISTICS, + self.ixnet_gen.PORT_STATS_NAME_MAP) + mock_build_stats.assert_any_call(self.ixnet_gen.FLOW_STATISTICS, + self.ixnet_gen.LATENCY_NAME_MAP) + mock_build_stats.assert_any_call(self.ixnet_gen.PPPOX_CLIENT_PER_PORT, + self.ixnet_gen.PPPOX_CLIENT_PER_PORT_NAME_MAP) + def test__update_ipv4_address(self): with mock.patch.object(self.ixnet_gen, '_get_field_in_stack_item', return_value='field_desc'): |