diff options
author | Matus Fabian <matfabia@cisco.com> | 2017-09-27 04:44:08 -0700 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2017-12-18 17:18:22 +0000 |
commit | e4d12836515765a6f7c6a2f67dbacbdef2975024 (patch) | |
tree | a8f5bcbd3c0b2df388f6a42103f87ccca2654fc1 /src/plugins/nat/extras/nat_100ks.py | |
parent | ff9f040e630510b5254eafa0df35d7e6fb16ffc3 (diff) |
NAT: Add performance testing TRex scripts and config (VPP-832)
Change-Id: I149a20f183b836db4c32fb4e4a8438b3a14c1c26
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/extras/nat_100ks.py')
-rw-r--r-- | src/plugins/nat/extras/nat_100ks.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/plugins/nat/extras/nat_100ks.py b/src/plugins/nat/extras/nat_100ks.py new file mode 100644 index 00000000000..f54a6e8342d --- /dev/null +++ b/src/plugins/nat/extras/nat_100ks.py @@ -0,0 +1,35 @@ +from trex_stl_lib.api import * + +class STLS1(object): + + def create_stream (self): + base_pkt = Ether()/IP(dst="2.2.0.1")/UDP(dport=12) + + pad = Padding() + if len(base_pkt) < 64: + pad_len = 64 - len(base_pkt) + pad.load = '\x00' * pad_len + + vm = STLVM() + + vm.tuple_var(name="tuple", ip_min="10.0.0.3", ip_max="10.0.3.234", port_min=1025, port_max=1124, limit_flows = 100000) + + vm.write(fv_name="tuple.ip", pkt_offset="IP.src") + vm.fix_chksum() + + vm.write(fv_name="tuple.port", pkt_offset="UDP.sport") + + pkt = STLPktBuilder(pkt=base_pkt/pad, vm=vm) + + return STLStream(packet=pkt, mode=STLTXCont()) + + def get_streams (self, direction = 0, **kwargs): + return [self.create_stream()] + + +# dynamic load - used for trex console or simulator +def register(): + return STLS1() + + + |