diff options
author | Hanoh Haim <hhaim@cisco.com> | 2016-05-18 16:00:51 +0300 |
---|---|---|
committer | Ido Barnea <ibarnea@cisco.com> | 2016-05-18 19:23:51 +0300 |
commit | 91120a37444f8a2f5e1d676f9a091f54346a3cfd (patch) | |
tree | 2270488f3d1bd4b8b937c820e0e5f8ee4ca7b67b | |
parent | 52bc62a3ee546deceb4ace152d2a38434ee3ef84 (diff) |
fix profile to work with 4 ports
-rw-r--r-- | scripts/stl/udp_1pkt_src_ip_split_latency.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/scripts/stl/udp_1pkt_src_ip_split_latency.py b/scripts/stl/udp_1pkt_src_ip_split_latency.py index c874b38d..d9b777fb 100644 --- a/scripts/stl/udp_1pkt_src_ip_split_latency.py +++ b/scripts/stl/udp_1pkt_src_ip_split_latency.py @@ -8,11 +8,20 @@ class STLS1(object): def __init__ (self): self.fsize =64; - def create_stream (self, dir): + def create_stream (self, dir,port_id): # 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) + if dir==0: + src_ip="16.0.0.1" + dst_ip="48.0.0.1" + else: + src_ip="48.0.0.1" + dst_ip="16.0.0.1" + + src="16.0.0.1"; + + base_pkt = Ether()/IP(src=src_ip,dst=dst_ip)/UDP(dport=12,sport=1025) pad = max(0, size - len(base_pkt)) * 'x' @@ -28,18 +37,21 @@ class STLS1(object): pkt = STLPktBuilder(pkt = base_pkt/pad, vm = vm) stream = [STLStream(packet = pkt, - mode = STLTXCont(percentage=80)), - STLStream(packet = STLPktBuilder(pkt = "yaml/udp_64B_no_crc.pcap", path_relative_to_profile = True), # path relative to pwd + mode = STLTXCont(pps=1)), + + + # latency stream + STLStream(packet = STLPktBuilder(pkt = "yaml/udp_64B_no_crc.pcap", + path_relative_to_profile = True), mode = STLTXCont(pps=1000), - flow_stats = STLFlowLatencyStats(pg_id = 12+dir)) + flow_stats = STLFlowLatencyStats(pg_id = 12+port_id)) ] - #print(stream.to_code()) return stream def get_streams (self, direction = 0, **kwargs): - return self.create_stream(dir=direction) + return self.create_stream(direction,kwargs['port_id']) # dynamic load - used for trex console or simulator |