summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKerim Gokarslan <kgokarsl@cisco.com>2018-03-23 13:56:30 -0700
committerKerim Gokarslan <kgokarsl@cisco.com>2018-03-23 14:24:28 -0700
commit6bb39c2893b1fb163766e5cab562150cc4335b67 (patch)
tree6f7676b88d35fee9a1d55c74dcf2deadb14373b5
parent0146325c7329d45a87b76931977353c06465e45e (diff)
NFVBENCH-78 TRex requires at least 16 payload bytes
Change-Id: Iacdafc624857698c8c9ac481daa050a42c1995b6 Signed-off-by: Kerim Gokarslan <kgokarsl@cisco.com>
-rw-r--r--nfvbench/traffic_gen/trex.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/nfvbench/traffic_gen/trex.py b/nfvbench/traffic_gen/trex.py
index 68ab95a..207fd52 100644
--- a/nfvbench/traffic_gen/trex.py
+++ b/nfvbench/traffic_gen/trex.py
@@ -48,6 +48,8 @@ from trex_stl_lib.api import STLVmFlowVarRepetableRandom
from trex_stl_lib.api import STLVmWrFlowVar
from trex_stl_lib.api import UDP
from trex_stl_lib.services.trex_stl_service_arp import STLServiceARP
+
+
# pylint: enable=import-error
@@ -138,15 +140,15 @@ class TRex(AbstractTrafficGenerator):
def create_pkt(self, stream_cfg, l2frame_size):
pkt_base = Ether(src=stream_cfg['mac_src'], dst=stream_cfg['mac_dst'])
-
+ # TRex requires minimum payload size 16B
if stream_cfg['vlan_tag'] is not None:
# 50 = 14 (Ethernet II) + 4 (Vlan tag) + 4 (CRC Checksum) + 20 (IPv4) + 8 (UDP)
pkt_base /= Dot1Q(vlan=stream_cfg['vlan_tag'])
- payload = 'x' * (max(64, int(l2frame_size)) - 50)
+ l2payload_size = max(max(64, int(l2frame_size)) - 50, 16)
else:
# 46 = 14 (Ethernet II) + 4 (CRC Checksum) + 20 (IPv4) + 8 (UDP)
- payload = 'x' * (max(64, int(l2frame_size)) - 46)
-
+ l2payload_size = max(max(64, int(l2frame_size)) - 46, 16)
+ payload = 'x' * l2payload_size
udp_args = {}
if stream_cfg['udp_src_port']:
udp_args['sport'] = int(stream_cfg['udp_src_port'])