summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-03-16 18:32:45 +0200
committerimarom <imarom@cisco.com>2016-03-16 19:17:55 +0200
commitaa334e0ef9258ffc70f0741627861b832d79a69b (patch)
tree2ea277e05acd3c45fafa308fcdfe695bdcfc32e5 /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
parent9518c16c5f10bef7a87b2237b635ea47ef5c183a (diff)
tunables show on the console
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
index 42c37e63..00fa6a93 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
@@ -122,7 +122,8 @@ class STLSim(object):
mult = "1",
duration = -1,
mode = 'none',
- silent = False):
+ silent = False,
+ tunables = None):
if not mode in ['none', 'gdb', 'valgrind', 'json', 'yaml','pkt','native']:
raise STLArgumentError('mode', mode)
@@ -139,9 +140,18 @@ class STLSim(object):
stream_list = [x for x in input_list if isinstance(x, STLStream)]
# handle YAMLs
+ if tunables == None:
+ tunables = {}
+ else:
+ tunables = tunables[0]
+
for input_file in input_files:
try:
- profile = STLProfile.load(input_file, direction = (self.port_id % 2), port = self.port_id)
+ if not 'direction' in tunables:
+ tunables['direction'] = self.port_id % 2
+
+ profile = STLProfile.load(input_file, **tunables)
+
except STLError as e:
s = format_text("\nError while loading profile '{0}'\n".format(input_file), 'bold')
s += "\n" + e.brief()
@@ -395,6 +405,13 @@ def setParserOptions():
default = -1,
type = float)
+
+ parser.add_argument('-t',
+ help = 'sets tunable for a profile',
+ dest = 'tunables',
+ default = None,
+ type = parsing_opts.decode_tunables)
+
parser.add_argument('-p', '--path',
help = "BP sim path",
dest = 'bp_sim_path',
@@ -483,7 +500,8 @@ def main (args = None):
mult = options.mult,
duration = options.duration,
mode = mode,
- silent = options.silent)
+ silent = options.silent,
+ tunables = options.tunables)
except KeyboardInterrupt as e:
print "\n\n*** Caught Ctrl + C... Exiting...\n\n"