1 from trex_stl_lib.api import *
5 def create_stream (self):
6 base_pkt = Ether()/IP(src="2.2.0.1")/UDP(sport=12)
10 pad_len = 64 - len(base_pkt)
11 pad.load = '\x00' * pad_len
15 vm.tuple_var(name="tuple", ip_min="173.16.1.3", ip_max="173.16.40.18", port_min=1025, port_max=1124, limit_flows = 1000000)
17 vm.write(fv_name="tuple.ip", pkt_offset="IP.dst")
20 vm.write(fv_name="tuple.port", pkt_offset="UDP.dport")
22 pkt = STLPktBuilder(pkt=base_pkt/pad, vm=vm)
24 return STLStream(packet=pkt, mode=STLTXCont())
26 def get_streams (self, direction = 0, **kwargs):
27 return [self.create_stream()]
30 # dynamic load - used for trex console or simulator