From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 7EF2ABB0A for ; Wed, 26 Oct 2016 09:00:52 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP; 26 Oct 2016 00:00:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,549,1473145200"; d="scan'208";a="1059267453" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 26 Oct 2016 00:00:51 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id u9Q70ntI015605; Wed, 26 Oct 2016 15:00:49 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u9Q70l4B017876; Wed, 26 Oct 2016 15:00:49 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id u9Q70lxN017872; Wed, 26 Oct 2016 15:00:47 +0800 From: Marvin Liu To: dts@dpdk.org Date: Wed, 26 Oct 2016 15:00:40 +0800 Message-Id: <1477465241-17826-3-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1477465241-17826-1-git-send-email-yong.liu@intel.com> References: <1477465241-17826-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH 2/3] framework packet: support ip layer elements strip 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: , X-List-Received-Date: Wed, 26 Oct 2016 07:00:52 -0000 Signed-off-by: Marvin Liu diff --git a/framework/packet.py b/framework/packet.py index 93d6879..05a3d1f 100755 --- a/framework/packet.py +++ b/framework/packet.py @@ -209,6 +209,21 @@ class scapy(object): value = layer.src elif element == 'dst': value = layer.dst + elif element == 'type': + value = layer.type + + return value + + def strip_layer3(self, element): + value = None + layer = self.pkt.getlayer(1) + if layer is None: + return None + + if element == 'src': + value = layer.src + elif element == 'dst': + value = layer.dst return value @@ -631,6 +646,9 @@ class Packet(object): def strip_element_layer2(self, element): return self.pktgen.strip_layer2(element) + def strip_element_layer3(self, element): + return self.pktgen.strip_layer3(element) + def strip_element_vlan(self, element): return self.pktgen.strip_vlan(element) -- 1.9.3