summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-02-16 10:47:40 +0200
committerHanoh Haim <hhaim@cisco.com>2016-02-16 10:47:40 +0200
commit16270f0ee64b0981c6c6dcd2bbff230172f67ee3 (patch)
tree87723e72b52376637c7e59fd0bfab043d9ace9ca
parent87db742206d5322c9f6de9b0a58413470e03ee12 (diff)
fix stl profiles to support new mac-addr override
-rw-r--r--scripts/stl/udp_1pkt_1mac_override.py13
-rw-r--r--scripts/stl/udp_1pkt_range_clients.py5
-rw-r--r--scripts/stl/udp_1pkt_range_clients_split.py9
3 files changed, 7 insertions, 20 deletions
diff --git a/scripts/stl/udp_1pkt_1mac_override.py b/scripts/stl/udp_1pkt_1mac_override.py
index f1591b80..c00d906d 100644
--- a/scripts/stl/udp_1pkt_1mac_override.py
+++ b/scripts/stl/udp_1pkt_1mac_override.py
@@ -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)
]
)
diff --git a/scripts/stl/udp_1pkt_range_clients.py b/scripts/stl/udp_1pkt_range_clients.py
index 6b898ed2..92b98e72 100644
--- a/scripts/stl/udp_1pkt_range_clients.py
+++ b/scripts/stl/udp_1pkt_range_clients.py
@@ -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")
diff --git a/scripts/stl/udp_1pkt_range_clients_split.py b/scripts/stl/udp_1pkt_range_clients_split.py
index 7aee009d..7df6d0d9 100644
--- a/scripts/stl/udp_1pkt_range_clients_split.py
+++ b/scripts/stl/udp_1pkt_range_clients_split.py
@@ -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
)