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_utils/parsing_opts.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'scripts/automation/trex_control_plane/client_utils') 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)) -- cgit 1.2.3-korg