From 6bb39c2893b1fb163766e5cab562150cc4335b67 Mon Sep 17 00:00:00 2001 From: Kerim Gokarslan Date: Fri, 23 Mar 2018 13:56:30 -0700 Subject: NFVBENCH-78 TRex requires at least 16 payload bytes Change-Id: Iacdafc624857698c8c9ac481daa050a42c1995b6 Signed-off-by: Kerim Gokarslan --- nfvbench/traffic_gen/trex.py | 10 ++++++---- 1 file 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']) -- cgit 1.2.3-korg