summaryrefslogtreecommitdiffstats
path: root/scripts/stl
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-02-18 15:35:43 +0200
committerHanoh Haim <hhaim@cisco.com>2016-02-18 15:35:43 +0200
commit5f20d891379ab711f03f2c3dd547c8e41e5d9352 (patch)
tree5794df81bb9292084156dd670f647d92ca7dd7e4 /scripts/stl
parent100cdc5edaebde24fc9508266b807c072049aca1 (diff)
add write_mask vm instruction
Diffstat (limited to 'scripts/stl')
-rw-r--r--scripts/stl/udp_1pkt_1mac_step.py35
-rw-r--r--scripts/stl/yaml/imix_1pkt_vm_minus.yaml33
2 files changed, 68 insertions, 0 deletions
diff --git a/scripts/stl/udp_1pkt_1mac_step.py b/scripts/stl/udp_1pkt_1mac_step.py
new file mode 100644
index 00000000..bab46fb7
--- /dev/null
+++ b/scripts/stl/udp_1pkt_1mac_step.py
@@ -0,0 +1,35 @@
+from trex_stl_lib.api import *
+
+
+# step is not 1.
+class STLS1(object):
+
+ def __init__ (self):
+ self.fsize =64; # the size of the packet
+
+ def create_stream (self):
+
+ # create a base packet and pad it to size
+ size = self.fsize - 4; # no FCS
+ 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=1, op="dec",step=7),
+ STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 11) # write it to LSB of SRC offset it 11
+ ]
+ )
+
+ return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm),
+ mode = STLTXCont( pps=10 ))
+
+ def get_streams (self, direction = 0):
+ # create 1 stream
+ return [ self.create_stream() ]
+
+
+# dynamic load - used for trex console or simulator
+def register():
+ return STLS1()
+
+
+
diff --git a/scripts/stl/yaml/imix_1pkt_vm_minus.yaml b/scripts/stl/yaml/imix_1pkt_vm_minus.yaml
new file mode 100644
index 00000000..bf67c83c
--- /dev/null
+++ b/scripts/stl/yaml/imix_1pkt_vm_minus.yaml
@@ -0,0 +1,33 @@
+### Single stream UDP packet, 64B ###
+#####################################
+- name: udp_64B
+ stream:
+ self_start: True
+ packet:
+ pcap: udp_64B_no_crc.pcap # pcap should not include CRC
+ mode:
+ type: continuous
+ pps: 100
+ rx_stats: []
+
+ vm:
+ instructions: [
+ {
+ "init_value" : 500,
+ "max_value" : 75000,
+ "min_value" : 1000,
+ "name" : "l3_src",
+ "op" : "inc",
+ "size" : 2,
+ "type" : "flow_var"
+ },
+ {
+ "add_value" : 1,
+ "is_big_endian" : false,
+ "name" : "l3_src",
+ "pkt_offset" : 34,
+ "type" : "write_flow_var"
+ }
+ ]
+ split_by_var: "l3_src"
+