From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0F9E8A0588; Thu, 16 Apr 2020 11:28:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D2D921DB9D; Thu, 16 Apr 2020 11:28:32 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id A43F11DB0E for ; Thu, 16 Apr 2020 11:28:30 +0200 (CEST) IronPort-SDR: qS+a57ZRyOF+lbk5P6+LRcif4h25rL/Lmg18vq52H2zkE7vG9GovUrlJHRhzhLHzLocZU+V5ky iQxOcH0nZqLg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2020 02:28:28 -0700 IronPort-SDR: kk3KynWAVU4BYyfYZnWXoJaO6un3/7oCcObVuH3A6GQxFnHkdLEmnFkDGQU75v/QF0LwVSbwmf BY/PhjwW32gQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,390,1580803200"; d="scan'208";a="245937323" Received: from dpdk-lijuan-purley3.sh.intel.com ([10.67.118.248]) by fmsmga008.fm.intel.com with ESMTP; 16 Apr 2020 02:28:17 -0700 From: hanyingya To: dts@dpdk.org Cc: hanyingya Date: Thu, 16 Apr 2020 17:26:20 +0800 Message-Id: <20200416092620.31365-1-yingyax.han@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dts] [PATCH V1]framework: compatible with different versions of scapy X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" some scapy version may have "L" suffix, and the other may not have. Signed-off-by: hanyingya --- framework/pktgen.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/framework/pktgen.py b/framework/pktgen.py index 889e94a..d00cf3b 100644 --- a/framework/pktgen.py +++ b/framework/pktgen.py @@ -167,7 +167,10 @@ class PacketGeneratorHelper(object): action = config.get('action') or 'default' range = config.get('range') or 64 # ignore 'L' suffix - start_vlan = int(pcap_fields.get(layer_name)[:-1]) + if 'L' in pcap_fields.get(layer_name): + start_vlan = int(pcap_fields.get(layer_name)[:-1]) + else: + start_vlan = int(pcap_fields.get(layer_name)) end_vlan = start_vlan + range - 1 fields_config[layer_name][name] = {} fields_config[layer_name][name]['start'] = start_vlan @@ -212,4 +215,4 @@ def getPacketGenerator(tester, pktgen_type=PKTGEN_IXIA): return CLS(tester) else: msg = "not support <{0}> packet generator".format(pktgen_type) - raise Exception(msg) \ No newline at end of file + raise Exception(msg) -- 2.17.1