summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/client_utils
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-01-13 06:21:29 -0500
committerimarom <imarom@cisco.com>2016-01-13 07:57:41 -0500
commit7baa5bda9175ed515ba9507236303589cd731a56 (patch)
tree9da36cff67a31c2ad42a79234023d946aaeaa605 /scripts/automation/trex_control_plane/client_utils
parent87d1a0f40580e141cc3d9755cefe3c6a070e112b (diff)
-a is not mandatory anymore for every port's commands
the default is all ports
Diffstat (limited to 'scripts/automation/trex_control_plane/client_utils')
-rwxr-xr-xscripts/automation/trex_control_plane/client_utils/parsing_opts.py13
1 files changed, 9 insertions, 4 deletions
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))