add tuple_generator command
authorHanoh Haim <[email protected]>
Wed, 16 Dec 2015 19:38:29 +0000 (21:38 +0200)
committerHanoh Haim <[email protected]>
Wed, 16 Dec 2015 19:38:29 +0000 (21:38 +0200)
trex_rpc_server_spec.asciidoc
visio_drawings/streams.vsd [new file with mode: 0644]

index 93b9e48..5ffb8a1 100755 (executable)
@@ -7,6 +7,8 @@ The TRex RPC Server
 :numbered:
 :web_server_url: http://trex-tgn.cisco.com/trex
 :local_web_server_url: csi-wiki-01:8181/trex
+:toclevels: 4
+
 
 == Change log
 
@@ -23,6 +25,9 @@ The TRex RPC Server
 |
 - Fixed some consistency issues
 - added RPC interaction examples appendix
+| 1.2    | Hanoch Haim (hhaim)
+|
+- add tuple generator command 
 
 |=================
 
@@ -654,6 +659,52 @@ Any element in the array can be one of the following object types:
 | is_big_endian | boolean     | should write as big endian or little 
 |=================
 
+
+.Object type 'vm - tuple_flow_var'
+[options="header",cols="1,1,3"]
+|=================
+| Field       | Type                        | Description
+| type        | string                      | ''tuple_flow_var'''
+| name        | string                      | tuple generator name - this should be a unique identifier name.ip and name.port will be added 
+| ip_min      | uint32_t as string          | ipv4 min ip as uint32_t  e.g.  10.0.0.1
+| ip_max      | uint32_t as string          | ipv4 max ip as uint32_t  e.g.  10.0.1.255
+| port_min    | uint16_t as string          | ipv4 min port as uint16_t e.g. 1025
+| port_max    | uint16_t as string          | ipv4 max port as uint16_t e.g.  65000
+| limit_flows | uint32_t as string          | the number of flows. 0 means we will use all the ip/port min-max range
+| flags       | uint16_t as string          | 1 - unlimited  number of flows. in case the first bit is enabled port_min and port_max is ignored and the maximum number of flows will be generated on those ips
+|=================
+
+an example of tuple_flow_var variable
+
+[source,bash]
+----
+ ip_min      = 10.0.0.1
+ ip_max      = 10.0.0.5
+ port_min    = 1025
+ port_max    = 1028
+ limit_flows = 10
+----
+
+.Results 
+[options="header",cols="1,1,3"]
+|=================
+| IP          | PORT        | FLOW
+| 10.0.0.1    | 1025        | 1
+| 10.0.0.2    | 1025        | 2
+| 10.0.0.3    | 1025        | 3
+| 10.0.0.4    | 1025        | 4
+| 10.0.0.5    | 1025        | 5
+| 10.0.0.1    | 1026        | 6  << the port is inc here 
+| 10.0.0.2    | 1026        | 7
+| 10.0.0.3    | 1026        | 8
+| 10.0.0.4    | 1026        | 9
+| 10.0.0.5    | 1026        | 10
+| 10.0.0.1    | 1025        | 1  << back to the first flow 
+|=================
+
+The variable name.port and name.ip could be written to any offset in the packet (usualy to src_ip and src_port as client) 
+
+
 TIP: For more information and examples on VM objects please refer to:
 link:vm_doc.html[VM examples]
 
@@ -1523,4 +1574,74 @@ Ontop, this stream is the last stream of the sequence, so `next_stream_id` of `s
    }
 ]
 
-----
\ No newline at end of file
+----
+
+
+Another Example of tuple generator 
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+
+[source, bash]
+----
+ - name: udp_64B
+  stream:
+    self_start: True
+    packet:
+      binary: stl/udp_64B_no_crc.pcap  # pcap should not include CRC
+    mode:
+      type: continuous
+      pps: 100
+    rx_stats: []
+
+    # program that define 1M flows with IP range 16.0.0.1-16.0.0.254
+    # we will create a script that do that for you 
+    # this is the low level instructions 
+    vm: [
+               {
+                 "type" : "tuple_flow_var",   # name of the command 
+
+                 "name" : "tuple_gen",    # tuple_gen.ip tuple_gen.port can be used 
+
+                 "ip_min"   : 0x10000001,  # min ip 16.0.0.1
+                 "ip_max"   : 0x100000fe,  # max ip 16.0.0.254
+                  
+                 "port_min" : 1025,        # min port 1025     
+                 "port_max" : 65500,       # max port 65500
+                  
+                 "limit_flows" : 1000000,  # number of flows 
+                 "flags"       : 0,        # 1 - for unlimited  
+               },
+
+               {
+                  "type" : "write_flow_var", # command name 
+
+                  "name" : "tuple_gen.ip",  # varible to write     
+                  
+                  "add_value" : 0,          # no need to add value     
+                  
+                  "is_big_endian" : true,   # write as big edian 
+                  
+                  "pkt_offset" : 26,        # write tuple_gen.ip into ipv4.src_ip   
+               },
+               
+               {
+                  "type" : "fix_checksum_ipv4", # fix ipv4 header checksum 
+
+                  "pkt_offset" : 14,          # offset of ipv4 header 
+                  
+               },
+
+               {
+                  "type" : "write_flow_var", # command name 
+
+                  "name" : "tuple_gen.port",  # varible to write     
+                  
+                  "add_value" : 0,          # no need to add value     
+                  
+                  "is_big_endian" : true,   # write as big edian 
+                  
+                  "pkt_offset" : 34,        # write tuple_gen.port into udp.src_port
+               }
+
+        ]
+----
diff --git a/visio_drawings/streams.vsd b/visio_drawings/streams.vsd
new file mode 100644 (file)
index 0000000..dd925c1
Binary files /dev/null and b/visio_drawings/streams.vsd differ