From 7d0f9e5efeae033151b5442b00c8055376de9c6b Mon Sep 17 00:00:00 2001
From: imarom <imarom@cisco.com>
Date: Wed, 16 Mar 2016 14:23:53 +0200
Subject: tunables for console

---
 .../stl/trex_stl_lib/utils/parsing_opts.py         | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

(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 0390ac9c..c4f2b358 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
@@ -30,6 +30,7 @@ COUNT = 18
 PROMISCUOUS = 19
 NO_PROMISCUOUS = 20
 PROMISCUOUS_SWITCH = 21
+TUNABLES = 22
 
 GLOBAL_STATS = 50
 PORT_STATS = 51
@@ -190,6 +191,19 @@ 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('#')]
+
+    except (SyntaxError, NameError):
+        raise argparse.ArgumentTypeError("bad syntax for tunables: {0}".format(tunable_str))
+
+    return tunables
+
+
 OPTIONS_DB = {MULTIPLIER: ArgumentPack(['-m', '--multiplier'],
                                  {'help': match_multiplier_help,
                                   'dest': "mult",
@@ -233,6 +247,14 @@ OPTIONS_DB = {MULTIPLIER: ArgumentPack(['-m', '--multiplier'],
                                          'default': None,
                                          'action': "store_true"}),
 
+
+              TUNABLES: ArgumentPack(['-t'],
+                                     {'help': "sets tunable for a profile",
+                                      'dest': "tunables",
+                                      'default': None,
+                                      'type': decode_tunables}),
+
+
               NO_PROMISCUOUS: ArgumentPack(['--no_prom'],
                                            {'help': "sets port promiscuous off",
                                             'dest': "prom",
-- 
cgit