add pyATS help
authorHanoh Haim <[email protected]>
Thu, 17 Mar 2016 15:01:04 +0000 (17:01 +0200)
committerHanoh Haim <[email protected]>
Thu, 17 Mar 2016 15:01:04 +0000 (17:01 +0200)
VERSION
scripts/automation/trex_control_plane/doc_stl/index.rst
scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py

diff --git a/VERSION b/VERSION
index 5df8d3e..ea5b4f5 100755 (executable)
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
-v1.95
+v1.96
 
 
 
index f8097b5..2a43061 100644 (file)
@@ -18,6 +18,31 @@ How to Install
 
 * **TODO**  Yaroslav Client zip as self-contain
 
+How to pyATS/v2.0
+==================
+
+.. sectionauthor:: David Shen 
+
+pyATS Compatibility 
+
+Trex only supports python2 for now, so it only works for **Python2** pyats.
+     
+* Install python2 pyats
+       /auto/pyats/bin/pyats-install --python2
+
+* setenv TREX_PATH to the trex stateless lib path 
+       setenv TREX_PATH <your path>/automation/trex_control_plane/stl
+
+* In the script or job file, add the TREX_PATH to sys.path::
+       import sys, os; sys.path.append(os.environ['TREX_PATH'])
+
+* Source trex stateless libs in scripts::
+
+          from trex_stl_lib.api import *
+          from scapy.contrib.mpls import *
+          from trex_stl_lib.trex_stl_hltapi import *
+
 
 API Reference
 ==============
index 46218bd..661bf52 100644 (file)
@@ -177,6 +177,43 @@ class STLScVmRaw(CTRexScriptsBase):
     raw instructions
     """
     def __init__(self,list_of_commands=None,split_by_field=None):
+        """
+        include a list of a basic instructions objects 
+
+        :parameters:
+             list_of_commands : list
+                list of instructions 
+
+             split_by_field : string 
+                by which field to split to threads
+
+
+        The following example will split the generated traffic by "ip_src" variable
+
+        .. code-block:: python
+            :caption: Split by 
+
+
+            # TCP SYN
+            base_pkt  = Ether()/IP(dst="48.0.0.1")/TCP(dport=80,flags="S")     
+    
+    
+            # vm
+            vm = STLScVmRaw( [ STLVmFlowVar(name="ip_src", 
+                                                  min_value="16.0.0.0", 
+                                                  max_value="16.0.0.254", 
+                                                  size=4, op="inc"),                     
+    
+    
+                               STLVmWrFlowVar(fv_name="ip_src", pkt_offset= "IP.src" ),  
+    
+                               STLVmFixIpv4(offset = "IP"), # fix checksum              
+                              ]
+                             ,split_by_field = "ip_src"                                
+                           )
+
+        """
+
         super(STLScVmRaw, self).__init__()
         self.split_by_field = split_by_field
         if list_of_commands==None: