aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorOleksandr Naumets <oleksandrx.naumets@intel.com>2018-10-22 07:59:52 +0100
committerOleksandr Naumets <oleksandrx.naumets@intel.com>2018-11-05 12:16:25 +0000
commit283a5313d7f93ba967fe336ef6d883a1c1f4a52b (patch)
treef47d1fef49c3f2a099e8df8ea1643e32056f163c /yardstick
parente13f82dc70084480611bab5aa04ac126c0b1ff0e (diff)
Add API for PPPoE clients statistic retrieval
Add IxNextgen API for PPPoE clients per port statistics retrieval. JIRA: YARDSTICK-1480 Change-Id: Ic22cf4a085ad957891575e9728584aee939a6630 Signed-off-by: Oleksandr Naumets <oleksandrx.naumets@intel.com>
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py41
-rw-r--r--yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py20
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'):