summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/utils')
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py
index e1de6b55..65333e0f 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py
@@ -213,19 +213,25 @@ def is_valid_file(filename):
return filename
-def decode_tunables_to_dict (**kwargs):
- return kwargs
def decode_tunables (tunable_str):
- try:
- tunables = [eval('decode_tunables_to_dict({0})'.format(t)) for t in tunable_str.split('#')]
+ tunables = {}
- except (SyntaxError, NameError):
- raise argparse.ArgumentTypeError("bad syntax for tunables: {0}".format(tunable_str))
+ # split by diaz to tokens
+ tokens = tunable_str.split('#')
+
+ # each token is of form X=Y
+ for token in tokens:
+ print(token)
+ m = re.search('(.*)=(.*)', token)
+ if not m:
+ raise argparse.ArgumentTypeError("bad syntax for tunables: {0}".format(token))
+ tunables[m.group(1)] = m.group(2)
return tunables
+
OPTIONS_DB = {MULTIPLIER: ArgumentPack(['-m', '--multiplier'],
{'help': match_multiplier_help,
'dest': "mult",