diff options
-rwxr-xr-x | scripts/automation/trex_control_plane/client/trex_stateless_client.py | 22 | ||||
-rwxr-xr-x | scripts/automation/trex_control_plane/common/trex_stats.py | 6 |
2 files changed, 19 insertions, 9 deletions
diff --git a/scripts/automation/trex_control_plane/client/trex_stateless_client.py b/scripts/automation/trex_control_plane/client/trex_stateless_client.py index 6139884d..42d5031e 100755 --- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py +++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py @@ -1065,8 +1065,8 @@ class CTRexStatelessClient(object): "streams", self.cmd_streams_line.__doc__, parsing_opts.PORT_LIST_WITH_ALL, - parsing_opts.STREAMS_MASK, - parsing_opts.FULL_OUTPUT) + parsing_opts.STREAMS_MASK)#, + #parsing_opts.FULL_OUTPUT) opts = parser.parse_args(line.split()) @@ -1074,14 +1074,18 @@ class CTRexStatelessClient(object): return RC_ERR("bad command line parameters") streams = self.cmd_streams(opts.ports, set(opts.streams)) + if not streams: + # we got no streams running - # print stats to screen - for stream_hdr, port_streams_data in streams.iteritems(): - text_tables.print_table_with_header(port_streams_data.text_table, - header= stream_hdr.split(":")[0] + ":", - untouched_header= stream_hdr.split(":")[1]) - - return RC_OK() + print format_text("No streams found with desired filter.\n", "bold", "magenta") + return RC_ERR("No streams found with desired filter.") + else: + # print stats to screen + for stream_hdr, port_streams_data in streams.iteritems(): + text_tables.print_table_with_header(port_streams_data.text_table, + header= stream_hdr.split(":")[0] + ":", + untouched_header= stream_hdr.split(":")[1]) + return RC_OK() diff --git a/scripts/automation/trex_control_plane/common/trex_stats.py b/scripts/automation/trex_control_plane/common/trex_stats.py index f792ab9b..aecf44b4 100755 --- a/scripts/automation/trex_control_plane/common/trex_stats.py +++ b/scripts/automation/trex_control_plane/common/trex_stats.py @@ -83,6 +83,8 @@ class CTRexInfoGenerator(object): return_data = {} for port_obj in relevant_ports: streams_data = self._generate_single_port_streams_info(port_obj, stream_id_list) + if not streams_data: + continue hdr_key = "Port {port}: {yaml_file}".format(port= port_obj.port_id, yaml_file= streams_data.raw_data.get('referring_file', '')) @@ -186,6 +188,10 @@ class CTRexInfoGenerator(object): return_streams_data = port_obj.generate_loaded_streams_sum(stream_id_list) + if not return_streams_data.get("streams"): + # we got no streams available + return None + # FORMAT VALUES ON DEMAND for stream_id, stream_id_sum in return_streams_data['streams'].iteritems(): stream_id_sum['rate_pps'] = CTRexStats.format_num(stream_id_sum['rate_pps'], suffix='pps') |