summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/automation/trex_control_plane/client/trex_stateless_client.py5
-rwxr-xr-xscripts/automation/trex_control_plane/console/parsing_opts.py12
2 files changed, 15 insertions, 2 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 af166b7f..30550ca3 100755
--- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py
+++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py
@@ -880,6 +880,7 @@ class CTRexStatelessClient(object):
"start",
self.cmd_start_line.__doc__,
parsing_opts.PORT_LIST_WITH_ALL,
+ parsing_opts.TOTAL,
parsing_opts.FORCE,
parsing_opts.STREAM_FROM_PATH_OR_FILE,
parsing_opts.DURATION,
@@ -906,6 +907,10 @@ class CTRexStatelessClient(object):
return RC_ERR("Failed to load stream pack")
+ if opts.total:
+ # if total was set - divide it between the ports
+ opts.mult['max'] = opts.mult['max'] / len(opts.ports)
+
return self.cmd_start(opts.ports, stream_list, opts.mult, opts.force, opts.duration)
def cmd_stop_line (self, line):
diff --git a/scripts/automation/trex_control_plane/console/parsing_opts.py b/scripts/automation/trex_control_plane/console/parsing_opts.py
index 14e8c563..d2484a83 100755
--- a/scripts/automation/trex_control_plane/console/parsing_opts.py
+++ b/scripts/automation/trex_control_plane/console/parsing_opts.py
@@ -19,6 +19,7 @@ SERVER_IP = 7
STREAM_FROM_PATH_OR_FILE = 8
DURATION = 9
FORCE = 10
+TOTAL = 11
# list of ArgumentGroup types
MUTEX = 1
@@ -56,7 +57,7 @@ match_multiplier_help = """Multiplier should be passed in the following format:
def match_multiplier(val):
'''match some val against multiplier shortcut inputs '''
- match = re.match("^(\d+(\.\d+)?)(bps|kbps|mbps|gbps|pps|kpps|mbps|%?)$", val)
+ match = re.match("^(\d+(\.\d+)?)(bps|kbps|mbps|gbps|pps|kpps|mpps|%?)$", val)
result = {}
@@ -68,7 +69,7 @@ def match_multiplier(val):
# raw type (factor)
if not unit:
result['type'] = 'raw'
- result['factor'] = value
+ result['max'] = value
elif unit == 'bps':
result['type'] = 'max_bps'
@@ -123,6 +124,13 @@ OPTIONS_DB = {MULTIPLIER: ArgumentPack(['-m', '--multiplier'],
'default': 1.0,
'type': match_multiplier}),
+
+ TOTAL: ArgumentPack(['-t', '--total'],
+ {'help': "traffic will be divided between all ports specified",
+ 'dest': "total",
+ 'default': False,
+ 'action': "store_true"}),
+
PORT_LIST: ArgumentPack(['--port'],
{"nargs": '+',
'dest':'ports',