From 7baa5bda9175ed515ba9507236303589cd731a56 Mon Sep 17 00:00:00 2001 From: imarom Date: Wed, 13 Jan 2016 06:21:29 -0500 Subject: -a is not mandatory anymore for every port's commands the default is all ports --- .../trex_control_plane/client/trex_stateless_client.py | 1 + .../trex_control_plane/client_utils/parsing_opts.py | 13 +++++++++---- .../automation/trex_control_plane/console/trex_console.py | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'scripts') 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 c7a9e533..dc39bee6 100755 --- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py +++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py @@ -1038,6 +1038,7 @@ class CTRexStatelessClient(object): if opts is None: return RC_ERR("bad command line parameters") + return self.cmd_clear(opts.ports) diff --git a/scripts/automation/trex_control_plane/client_utils/parsing_opts.py b/scripts/automation/trex_control_plane/client_utils/parsing_opts.py index 230ff822..3735a45b 100755 --- a/scripts/automation/trex_control_plane/client_utils/parsing_opts.py +++ b/scripts/automation/trex_control_plane/client_utils/parsing_opts.py @@ -186,7 +186,9 @@ OPTIONS_DB = {MULTIPLIER: ArgumentPack(['-m', '--multiplier'], ALL_PORTS: ArgumentPack(['-a'], {"action": "store_true", "dest": "all_ports", - 'help': "Set this flag to apply the command on all available ports"}), + 'help': "Set this flag to apply the command on all available ports", + 'default': False},), + DURATION: ArgumentPack(['-d'], {'action': "store", 'metavar': 'TIME', @@ -256,7 +258,8 @@ OPTIONS_DB = {MULTIPLIER: ArgumentPack(['-m', '--multiplier'], # advanced options PORT_LIST_WITH_ALL: ArgumentGroup(MUTEX, [PORT_LIST, ALL_PORTS], - {'required': True}), + {'required': False}), + STREAM_FROM_PATH_OR_FILE: ArgumentGroup(MUTEX, [FILE_PATH, FILE_FROM_DB], {'required': True}), @@ -279,10 +282,12 @@ class CCmdArgParser(argparse.ArgumentParser): if opts is None: return None - if getattr(opts, "all_ports", None): + # if all ports are marked or + if (getattr(opts, "all_ports", None) == True) or (getattr(opts, "ports", None) == []): opts.ports = self.stateless_client.get_port_ids() - if getattr(opts, "ports", None): + # so maybe we have ports configured + elif (getattr(opts, "ports", None) == []): for port in opts.ports: if not self.stateless_client.validate_port_list([port]): self.error("port id '{0}' is not a valid port id\n".format(port)) diff --git a/scripts/automation/trex_control_plane/console/trex_console.py b/scripts/automation/trex_control_plane/console/trex_console.py index 37e33cb7..8c823e8c 100755 --- a/scripts/automation/trex_control_plane/console/trex_console.py +++ b/scripts/automation/trex_control_plane/console/trex_console.py @@ -444,6 +444,7 @@ class TRexConsole(TRexGeneralCmd): '''Clear cached local statistics\n''' self.stateless_client.cmd_clear_line(line) + def help_clear(self): self.do_clear("-h") -- cgit 1.2.3-korg