summaryrefslogtreecommitdiffstats
path: root/scripts/stl/udp_1pkt_1mac_override.py
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 /scripts/stl/udp_1pkt_1mac_override.py
parent87db742206d5322c9f6de9b0a58413470e03ee12 (diff)
fix stl profiles to support new mac-addr override
Diffstat (limited to 'scripts/stl/udp_1pkt_1mac_override.py')
-rw-r--r--scripts/stl/udp_1pkt_1mac_override.py13
1 files changed, 4 insertions, 9 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)
]
)