From 0f1b82cfc8078e0b363b96e7e649dbe49eb24e2a Mon Sep 17 00:00:00 2001
From: Yaroslav Brustinov <ybrustin@cisco.com>
Date: Sun, 6 Mar 2016 00:24:54 +0200
Subject: add --native argument to simulator

---
 .../trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py      | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

(limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib')

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 9db34737..abfdd9bc 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
@@ -123,7 +123,7 @@ class STLSim(object):
              duration = -1,
              mode = 'none'):
 
-        if not mode in ['none', 'gdb', 'valgrind', 'json', 'yaml','pkt']:
+        if not mode in ['none', 'gdb', 'valgrind', 'json', 'yaml','pkt','native']:
             raise STLArgumentError('mode', mode)
 
         # listify
@@ -211,6 +211,9 @@ class STLSim(object):
         elif mode == 'pkt':
             print STLProfile(stream_list).dump_as_pkt();
             return
+        elif mode == 'native':
+            print STLProfile(stream_list).dump_to_code()
+            return
 
 
         # start simulation
@@ -406,6 +409,11 @@ def setParserOptions():
                        action = "store_true",
                        default = False)
 
+    group.add_argument("--native",
+                       help = "generate Python code with stateless profile from input file [default is False]",
+                       action = "store_true",
+                       default = False)
+
     return parser
 
 
@@ -436,6 +444,8 @@ def main ():
         mode = 'json'
     elif options.yaml:
         mode = 'yaml'
+    elif options.native:
+        mode = 'native'
     elif options.pkt:
         mode = 'pkt'
     else:
-- 
cgit