From 2cf444195c3d8a0215216e5f1899fded15bd7627 Mon Sep 17 00:00:00 2001 From: imarom Date: Wed, 21 Sep 2016 18:12:46 +0300 Subject: Splitter - padding for non circular VMs --- .../stl/trex_stl_lib/utils/parsing_opts.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/utils') 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", -- cgit 1.2.3-korg