diff options
author | 2016-03-23 16:11:53 +0200 | |
---|---|---|
committer | 2016-03-23 16:11:53 +0200 | |
commit | 709eda3b4ea0385da009932df3eba457e955e887 (patch) | |
tree | 6dc28821bdd3089be9cf837400fc12ff10f66992 /scripts/automation/trex_control_plane/stl/trex_stl_lib | |
parent | e9ab260a5fa47604406e1e9432d0036dc8fd9928 (diff) |
moving us to python 3 by default (console)
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib')
3 files changed, 11 insertions, 6 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py index 0f3cd65c..25e35423 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py @@ -826,9 +826,10 @@ class STLClient(object): # stats def _get_formatted_stats(self, port_id_list, stats_mask = trex_stl_stats.COMPACT): - stats_opts = trex_stl_stats.ALL_STATS_OPTS.intersection(stats_mask) - stats_obj = {} + stats_opts = common.list_intersect(trex_stl_stats.ALL_STATS_OPTS, stats_mask) + + stats_obj = OrderedDict() for stats_type in stats_opts: stats_obj.update(self.stats_generator.generate_single_statistic(port_id_list, stats_type)) @@ -2148,7 +2149,7 @@ class STLClient(object): # set to show all stats if no filter was given mask = trex_stl_stats.ALL_STATS_OPTS - stats_opts = trex_stl_stats.ALL_STATS_OPTS.intersection(mask) + stats_opts = common.list_intersect(trex_stl_stats.ALL_STATS_OPTS, mask) stats = self._get_formatted_stats(opts.ports, mask) diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py index 64e8688f..18c49d4e 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_stats.py @@ -20,9 +20,9 @@ PORT_STATS = 'p' PORT_STATUS = 'ps' STREAMS_STATS = 's' -ALL_STATS_OPTS = {GLOBAL_STATS, PORT_STATS, PORT_STATUS, STREAMS_STATS} -COMPACT = {GLOBAL_STATS, PORT_STATS} -SS_COMPAT = {GLOBAL_STATS, STREAMS_STATS} +ALL_STATS_OPTS = [GLOBAL_STATS, PORT_STATS, PORT_STATUS, STREAMS_STATS] +COMPACT = [GLOBAL_STATS, PORT_STATS] +SS_COMPAT = [GLOBAL_STATS, STREAMS_STATS] ExportableStats = namedtuple('ExportableStats', ['raw_data', 'text_table']) diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py index 9490c1b0..ae74e932 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/common.py @@ -54,3 +54,7 @@ def get_number(input): return int(input) except: return None + +def list_intersect(l1, l2): + return list(filter(lambda x: x in l2, l1)) + |