diff options
author | 2016-02-11 15:17:12 +0200 | |
---|---|---|
committer | 2016-02-11 15:17:12 +0200 | |
commit | f11bbb2d9c4f0e8fb5bf2a7b8d9ade597fc1be05 (patch) | |
tree | fe2a78e2d2c3297bff275808b5d6f4f53fff3536 /scripts/stl | |
parent | 1a780eaa3669a296b683201ef6431a7490fdc7d6 (diff) |
test add udp_1pkt_simple
Diffstat (limited to 'scripts/stl')
-rw-r--r-- | scripts/stl/udp_1pkt_range_clients.py | 7 | ||||
-rw-r--r-- | scripts/stl/udp_1pkt_simple.py | 19 |
2 files changed, 24 insertions, 2 deletions
diff --git a/scripts/stl/udp_1pkt_range_clients.py b/scripts/stl/udp_1pkt_range_clients.py index 2078b748..6b898ed2 100644 --- a/scripts/stl/udp_1pkt_range_clients.py +++ b/scripts/stl/udp_1pkt_range_clients.py @@ -3,7 +3,7 @@ from trex_stl_lib.api import * # x clients override the LSB of destination #Base src ip : 55.55.1.1, dst ip: Fixed -#Increment host port portion starting at 55.55.1.1 for 'n' number of clients (55.55.1.1, 55.55.1.2) +#Increment src ipt portion starting at 55.55.1.1 for 'n' number of clients (55.55.1.1, 55.55.1.2) #Src MAC: start with 0000.dddd.0001, increment mac in steps of 1 #Dst MAC: Fixed (will be taken from trex_conf.yaml @@ -25,7 +25,10 @@ class STLS1(object): 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= 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_simple.py b/scripts/stl/udp_1pkt_simple.py new file mode 100644 index 00000000..31492291 --- /dev/null +++ b/scripts/stl/udp_1pkt_simple.py @@ -0,0 +1,19 @@ +from trex_stl_lib.api import * + +class STLS1(object): + + def create_stream (self): + return STLStream( packet = STLPktBuilder(pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/(10*'x')), + mode = STLTXCont() ) + + 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() + + + |