summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlec Hothan <ahothan@cisco.com>2020-04-27 14:11:30 +0000
committerGerrit Code Review <gerrit@opnfv.org>2020-04-27 14:11:30 +0000
commiteb329de833ede827149d2ea440863a9a58aa75d5 (patch)
treee330f6f2918bf5d0219cc89f13778f79aa3badb1
parentba7c812d8a4409c9840f65f7a776542dbdb2e711 (diff)
parentf5dad1934237c978e802ea1fd941f5dc195c3011 (diff)
Merge "[NFVBENCH-165] Use STLVmFixIpv4 to fix inner IP/UDP payload"
-rw-r--r--nfvbench/traffic_gen/trex_gen.py12
-rw-r--r--test/mock_trex.py1
2 files changed, 9 insertions, 4 deletions
diff --git a/nfvbench/traffic_gen/trex_gen.py b/nfvbench/traffic_gen/trex_gen.py
index 0ecad1e..de9500a 100644
--- a/nfvbench/traffic_gen/trex_gen.py
+++ b/nfvbench/traffic_gen/trex_gen.py
@@ -47,6 +47,7 @@ from trex.stl.api import STLScVmRaw
from trex.stl.api import STLStream
from trex.stl.api import STLTXCont
from trex.stl.api import STLVmFixChecksumHw
+from trex.stl.api import STLVmFixIpv4
from trex.stl.api import STLVmFlowVar
from trex.stl.api import STLVmFlowVarRepeatableRandom
from trex.stl.api import STLVmWrFlowVar
@@ -471,10 +472,13 @@ class TRex(AbstractTrafficGenerator):
dst_fv_port,
STLVmWrFlowVar(fv_name="p_dst", pkt_offset="UDP:{}.dport".format(encap_level)),
]
- for encap in range(int(encap_level), -1, -1):
- vm_param.append(STLVmFixChecksumHw(l3_offset="IP:{}".format(encap),
- l4_offset="UDP:{}".format(encap),
- l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP))
+ # Use HW Offload to calculate the outter IP/UDP packet
+ vm_param.append(STLVmFixChecksumHw(l3_offset="IP:0",
+ l4_offset="UDP:0",
+ l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP))
+ # Use software to fix the inner IP/UDP payload for VxLAN packets
+ if int(encap_level):
+ vm_param.append(STLVmFixIpv4(offset="IP:1"))
pad = max(0, frame_size - len(pkt_base)) * 'x'
return STLPktBuilder(pkt=pkt_base / pad,
diff --git a/test/mock_trex.py b/test/mock_trex.py
index 4f0271a..49fe5a9 100644
--- a/test/mock_trex.py
+++ b/test/mock_trex.py
@@ -52,6 +52,7 @@ except ImportError:
api_mod.STLStream = STLDummy
api_mod.STLTXCont = STLDummy
api_mod.STLVmFixChecksumHw = STLDummy
+ api_mod.STLVmFixIpv4 = STLDummy
api_mod.STLVmFlowVar = STLDummy
api_mod.STLVmFlowVarRepeatableRandom = STLDummy
api_mod.STLVmWrFlowVar = STLDummy