fix stl profiles to support new mac-addr override
authorHanoh Haim <[email protected]>
Tue, 16 Feb 2016 08:47:40 +0000 (10:47 +0200)
committerHanoh Haim <[email protected]>
Tue, 16 Feb 2016 08:47:40 +0000 (10:47 +0200)
scripts/stl/udp_1pkt_1mac_override.py
scripts/stl/udp_1pkt_range_clients.py
scripts/stl/udp_1pkt_range_clients_split.py

index f1591b8..c00d906 100644 (file)
@@ -1,7 +1,7 @@
 from trex_stl_lib.api import *
 
 # 1 clients MAC override the LSB of destination
-# overide the destination mac  00:bb::12:34:56:01 -00:bb::12:34:56:0a
+# overide the src mac  00:bb:12:34:56:01 - 00:bb:12:34:56:0a
 class STLS1(object):
 
 
@@ -12,17 +12,12 @@ class STLS1(object):
 
         # 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)
+
+        # Ether(src="00:bb:12:34:56:01") this will tell TRex to take the src-mac from packet and not from config file
+        base_pkt =  Ether(src="00:bb:12:34:56:01")/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="dyn_mac_src", min_value=1, max_value=10, size=1, op="inc"), # 1 byte varible, range 1-1 ( workaround)
-
-                           STLVmFlowVar(name="static_mac_src_lsb", min_value=0x12345600, max_value=0x12345600, size=4, op="inc"), # workaround to override the mac 4 LSB byte
-                           STLVmFlowVar(name="static_mac_src_msb", min_value=0x00bb, max_value=0x00bb, size=2, op="inc"),         # workaround to override the mac 2 MSB byte
-
-                           STLVmWrFlowVar(fv_name="static_mac_src_msb", pkt_offset= 6),                           
-                           STLVmWrFlowVar(fv_name="static_mac_src_lsb", pkt_offset= 8),                           
-
                            STLVmWrFlowVar(fv_name="dyn_mac_src", pkt_offset= 11)                           
                           ]
                        )
index 6b898ed..92b98e7 100644 (file)
@@ -18,13 +18,10 @@ class STLS1(object):
 
         # create a base packet and pad it to size
         size = self.fsize - 4; # no FCS
-        base_pkt =  Ether()/IP(src="55.55.1.1",dst="58.0.0.1")/UDP(dport=12,sport=1025)
+        base_pkt =  Ether(src="00:00:dd:dd:00:01")/IP(src="55.55.1.1",dst="58.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=self.num_clients, size=2, op="inc"), # 1 byte varible, range 1-10
-                           STLVmFlowVar(name="mac_src_wa", min_value=0x0000dddd, max_value=0x0000dddd, size=4, op="inc"), # workaround hardcoded the src MAC MSB, will be solved as an option in the stream
-
-                           STLVmWrFlowVar(fv_name="mac_src_wa", pkt_offset= 6),                        # write constrant 0000.ddddd
                            STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 10),                          # write it to LSB of ethernet.src 
                            STLVmWrFlowVar(fv_name="mac_src" ,pkt_offset="IP.src",offset_fixup=2),       # it is 2 byte so there is a need to fixup in 2 bytes
                            STLVmFixIpv4(offset = "IP")
index 7aee009..7df6d0d 100644 (file)
@@ -18,18 +18,13 @@ class STLS1(object):
 
         # create a base packet and pad it to size
         size = self.fsize - 4; # no FCS
-        base_pkt =  Ether()/IP(src="55.55.1.1",dst="58.0.0.1")/UDP(dport=12,sport=1025)
+        base_pkt =  Ether(src="00:00:dd:dd:00:01")/IP(src="55.55.1.1",dst="58.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=self.num_clients, size=2, op="inc"), # 1 byte varible, range 1-10
-                           STLVmFlowVar(name="mac_src_wa", min_value=0x0000dddd, max_value=0x0000dddd, size=4, op="inc"), # workaround hardcoded the src MAC MSB, will be solved as an option in the stream
-
-                           STLVmWrFlowVar(fv_name="mac_src_wa", pkt_offset= 6),                        # write constrant 0000.ddddd
                            STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 10),                          # write it to LSB of ethernet.src 
                            STLVmWrFlowVar(fv_name="mac_src" ,pkt_offset="IP.src",offset_fixup=2),       # it is 2 byte so there is a need to fixup in 2 bytes
-                           STLVmFixIpv4(offset = "IP"),
-
-
+                           STLVmFixIpv4(offset = "IP")
                           ]
                          ,split_by_field = "mac_src"  # split 
                        )