aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorahothan <ahothan@cisco.com>2019-05-24 12:03:26 -0700
committerahothan <ahothan@cisco.com>2019-05-24 12:12:18 -0700
commit7e9ef3835fdc7dc95c42e32fc4d0f804e90efac5 (patch)
treedba4b9a787cdcc935e82e4c7021e5c744d4dfb3c
parent7439c895c0ad2960712910ab6b72042884ce2a41 (diff)
NFVBENCH-135 Enhance VxLAN UDP src port entropy
Change-Id: Idaaf1952548ec2531a574b9a583304821beed00f Signed-off-by: ahothan <ahothan@cisco.com>
-rw-r--r--nfvbench/traffic_gen/trex_gen.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/nfvbench/traffic_gen/trex_gen.py b/nfvbench/traffic_gen/trex_gen.py
index daf5fb1..eb6066c 100644
--- a/nfvbench/traffic_gen/trex_gen.py
+++ b/nfvbench/traffic_gen/trex_gen.py
@@ -280,7 +280,7 @@ class TRex(AbstractTrafficGenerator):
"""
# Trex will add the FCS field, so we need to remove 4 bytes from the l2 frame size
frame_size = int(l2frame_size) - 4
-
+ vm_param = []
if stream_cfg['vxlan'] is True:
self._bind_vxlan()
encap_level = '1'
@@ -291,6 +291,15 @@ class TRex(AbstractTrafficGenerator):
pkt_base /= UDP(sport=random.randint(1337, 32767), dport=4789)
pkt_base /= VXLAN(vni=stream_cfg['net_vni'])
pkt_base /= Ether(src=stream_cfg['mac_src'], dst=stream_cfg['mac_dst'])
+ # need to randomize the outer header UDP src port based on flow
+ vxlan_udp_src_fv = STLVmFlowVar(
+ name="vxlan_udp_src",
+ min_value=1337,
+ max_value=32767,
+ size=2,
+ op="random")
+ vm_param = [vxlan_udp_src_fv,
+ STLVmWrFlowVar(fv_name="vxlan_udp_src", pkt_offset="UDP.sport")]
else:
encap_level = '0'
pkt_base = Ether(src=stream_cfg['mac_src'], dst=stream_cfg['mac_dst'])
@@ -336,7 +345,7 @@ class TRex(AbstractTrafficGenerator):
op="inc",
step=stream_cfg['ip_addrs_step'])
- vm_param = [
+ vm_param.extend([
src_fv,
STLVmWrFlowVar(fv_name="ip_src", pkt_offset="IP:{}.src".format(encap_level)),
dst_fv,
@@ -344,7 +353,7 @@ class TRex(AbstractTrafficGenerator):
STLVmFixChecksumHw(l3_offset="IP:{}".format(encap_level),
l4_offset="UDP:{}".format(encap_level),
l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP)
- ]
+ ])
pad = max(0, frame_size - len(pkt_base)) * 'x'
return STLPktBuilder(pkt=pkt_base / pad, vm=STLScVmRaw(vm_param))