add --native argument to simulator
authorYaroslav Brustinov <[email protected]>
Sat, 5 Mar 2016 22:24:54 +0000 (00:24 +0200)
committerYaroslav Brustinov <[email protected]>
Sat, 5 Mar 2016 22:24:54 +0000 (00:24 +0200)
scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py

index 9db3473..abfdd9b 100644 (file)
@@ -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: