add packet builder doc
authorHanoh Haim <[email protected]>
Mon, 14 Mar 2016 12:08:29 +0000 (14:08 +0200)
committerHanoh Haim <[email protected]>
Mon, 14 Mar 2016 12:08:29 +0000 (14:08 +0200)
scripts/automation/trex_control_plane/doc_stl/api/field_engine.rst
scripts/automation/trex_control_plane/doc_stl/api/index.rst
scripts/automation/trex_control_plane/doc_stl/api/scapy_builder.rst [new file with mode: 0644]

index 271ff05..8b19249 100644 (file)
@@ -27,7 +27,7 @@ for example this snippet will create SYN Attack::
 
 
         # vm
-        vm = CTRexScRaw( [ STLVmFlowVar(name="ip_src", 
+        vm = STLScVmRaw( [ STLVmFlowVar(name="ip_src", 
                                               min_value="16.0.0.0", 
                                               max_value="18.0.0.254", 
                                               size=4, op="random"),
@@ -57,12 +57,12 @@ for example this snippet will create SYN Attack::
 
 
 
-CTRexScRaw class
+STLScVmRaw class
 ----------------
 
 Aggregate a raw instructions objects 
 
-.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.CTRexScRaw
+.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.STLScVmRaw
     :members: 
     :member-order: bysource
 
@@ -70,27 +70,21 @@ Aggregate a raw instructions objects
 STLVmFlowVar 
 ------------
 
-It is alias for CTRexVmDescFlowVar
-
-.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.CTRexVmDescFlowVar
+.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.STLVmFlowVar
     :members: 
     :member-order: bysource
 
 STLVmWrMaskFlowVar
 ------------------
 
-It is alias for CTRexVmDescWrMaskFlowVar
-
-.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.CTRexVmDescWrMaskFlowVar
+.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.STLVmWrMaskFlowVar
     :members: 
     :member-order: bysource
 
 STLVmFixIpv4
 ------------------
 
-It is alias for CTRexVmDescFixIpv4
-
-.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.CTRexVmDescFixIpv4
+.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.STLVmFixIpv4
     :members: 
     :member-order: bysource
  
@@ -98,27 +92,14 @@ It is alias for CTRexVmDescFixIpv4
 STLVmTrimPktSize
 ------------------
 
-It is alias for CTRexVmDescTrimPktSize
-
-.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.CTRexVmDescTrimPktSize
+.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.STLVmTrimPktSize
     :members: 
     :member-order: bysource
 
 STLVmTupleGen
 ------------------
 
-It is alias for CTRexVmDescTupleGen
-
-.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.CTRexVmDescTupleGen
-    :members: 
-    :member-order: bysource
-
-STLVmTupleGen
-------------------
-
-It is alias for STLVmTupleGen
-
-.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.CTRexVmDescTupleGen
+.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.STLVmTupleGen
     :members: 
     :member-order: bysource
 
@@ -134,12 +115,14 @@ Example1::
 
         pad = max(0, size - len(base_pkt)) * 'x'
                              
-        vm = CTRexScRaw( [   STLVmTupleGen ( ip_min="16.0.0.1", ip_max="16.0.0.2", 
-                                                   port_min=1025, port_max=65535,
-                                                    name="tuple"), # define tuple gen 
+        vm = STLScVmRaw( [   STLVmTupleGen ( ip_min="16.0.0.1", ip_max="16.0.0.2", 
+                                             port_min=1025, port_max=65535,
+                                             name="tuple"), # define tuple gen 
 
-                             STLVmWrFlowVar (fv_name="tuple.ip", pkt_offset= "IP.src" ), # write ip to packet IP.src
-                             STLVmFixIpv4(offset = "IP"),                                # fix checksum
+                             # write ip to packet IP.src
+                             STLVmWrFlowVar (fv_name="tuple.ip", pkt_offset= "IP.src" ), 
+                             
+                             STLVmFixIpv4(offset = "IP"),  # fix checksum
                              STLVmWrFlowVar (fv_name="tuple.port", pkt_offset= "UDP.sport" )  #write udp.port
                                   ]
                               );
@@ -156,9 +139,15 @@ Example2::
         base_pkt =  Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)
         pad = max(0, size - len(base_pkt)) * 'x'
 
-        vm = CTRexScRaw( [ STLVmFlowVar(name="mac_src", min_value=1, max_value=30, size=2, op="dec",step=1), 
-                           STLVmWrMaskFlowVar(fv_name="mac_src", pkt_offset= 11,pkt_cast_size=1, mask=0xff) 
-                          ]
-                       )
+        vm = STLScVmRaw( [ STLVmFlowVar(name="mac_src", 
+                                        min_value=1, 
+                                        max_value=30, 
+                                        size=2, op="dec",step=1), 
+                           STLVmWrMaskFlowVar(fv_name="mac_src", 
+                                              pkt_offset= 11, 
+                                              pkt_cast_size=1, 
+                                              mask=0xff) 
+                         ]
+                        )
 
 
index 733a896..6e18911 100644 (file)
@@ -9,7 +9,7 @@ TRex Stateless API Reference
     
     client_code
 
-**TRex Traffic profile: STLProfile,STLStream **
+**TRex Traffic profile STLProfile,STLStream**
 
 .. toctree::
     :maxdepth: 4
@@ -17,7 +17,15 @@ TRex Stateless API Reference
     profile_code
 
 
-**TRex Field Engine: **
+**Packet builder**
+
+.. toctree::
+    :maxdepth: 4
+    
+    scapy_builder
+
+
+**TRex Field Engine**
 
 .. toctree::
     :maxdepth: 4
diff --git a/scripts/automation/trex_control_plane/doc_stl/api/scapy_builder.rst b/scripts/automation/trex_control_plane/doc_stl/api/scapy_builder.rst
new file mode 100644 (file)
index 0000000..5544df6
--- /dev/null
@@ -0,0 +1,44 @@
+
+Packet builder modules 
+=======================
+
+The packet builder module objective is to build a template packet for a stream and to create a Field engine program to change fields in the packet.
+
+**Some examples for what can be done:**
+
+* Build a IP/UDP/DNS packet and create a range of src_ip = 10.0.0.1-10.0.0.255
+* Build a IP/UDP packets in IMIX sizes 
+
+
+for example this snippet will create SYN Attack::
+
+    # create attack from random src_ip from 16.0.0.0-18.0.0.254 and random src_port 1025-65000    
+    # attack 48.0.0.1 server 
+        
+    def create_stream (self):
+
+        
+        # TCP SYN
+        base_pkt  = Ether()/IP(dst="48.0.0.1")/TCP(dport=80,flags="S")
+
+        pkt = STLPktBuilder(pkt = base_pkt)
+
+        return STLStream(packet = pkt,    #<<<<< set packet builder inside the stream 
+                         mode = STLTXCont())
+
+
+
+
+STLPktBuilder  class
+--------------------
+
+Aggregate a raw instructions objects 
+
+.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.STLPktBuilder
+    :members: 
+    :member-order: bysource
+
+
+  
+
+