summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py10
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py11
2 files changed, 16 insertions, 5 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py
index 60bf7be8..8488a80a 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py
@@ -1 +1,11 @@
+import sys
+
+if sys.version_info < (2, 7):
+ print("\n**** TRex STL pacakge requires Python version >= 2.7 ***\n")
+ exit(-1)
+
+if sys.version_info >= (3, 0):
+ print("\n**** TRex STL pacakge does not support Python 3 (yet) ***\n")
+ exit(-1)
+
import trex_stl_ext
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 abfdd9bc..395c5864 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
@@ -428,9 +428,9 @@ def validate_args (parser, options):
parser.error("limit cannot be lower than number of DP cores")
-def main ():
+def main (args = None):
parser = setParserOptions()
- options = parser.parse_args()
+ options = parser.parse_args(args = args)
validate_args(parser, options)
@@ -466,13 +466,14 @@ def main ():
except KeyboardInterrupt as e:
print "\n\n*** Caught Ctrl + C... Exiting...\n\n"
- exit(1)
+ return (-1)
except STLError as e:
print e
- exit(1)
+ return (-1)
+
+ return (0)
- exit(0)
if __name__ == '__main__':
main()