From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 3997A568E for ; Tue, 26 Jul 2016 07:24:56 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP; 25 Jul 2016 22:24:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,423,1464678000"; d="scan'208";a="145453894" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga004.fm.intel.com with ESMTP; 25 Jul 2016 22:24:44 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id u6Q5Ogea005336; Tue, 26 Jul 2016 13:24:42 +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 u6Q5Oehk029933; Tue, 26 Jul 2016 13:24:42 +0800 Received: (from yufengmx@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id u6Q5OdJe029929; Tue, 26 Jul 2016 13:24:39 +0800 From: Yufen Mo To: dts@dpdk.org Cc: yufengmx Date: Tue, 26 Jul 2016 13:24:34 +0800 Message-Id: <1469510675-29891-2-git-send-email-yufengx.mo@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1469510675-29891-1-git-send-email-yufengx.mo@intel.com> References: <1469510675-29891-1-git-send-email-yufengx.mo@intel.com> Subject: [dts] [PATCH V1 1/2] add sctp/gre format support in framework/packet module 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: Tue, 26 Jul 2016 05:24:56 -0000 From: yufengmx Signed-off-by: yufengmx --- framework/packet.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/framework/packet.py b/framework/packet.py index a46fd47..30f3b4a 100755 --- a/framework/packet.py +++ b/framework/packet.py @@ -255,12 +255,24 @@ class scapy(object): if chksum is not None: pkt_layer.chksum = chksum + def sctp(self, src=53, dst=53, len=None, chksum=None): + self.pkt[SCTP].sport = src + self.pkt[SCTP].dport = dst + if len is not None: + self.pkt[SCTP].len = len + if chksum is not None: + self.pkt[SCTP].chksum = chksum + def raw(self, pkt_layer, payload=None): if payload is not None: pkt_layer.load = '' for hex1, hex2 in payload: pkt_layer.load += struct.pack("=B", int('%s%s' %(hex1, hex2), 16)) + def gre(self, proto=None): + if proto is not None: + self.pkt[GRE].proto = proto + def vxlan(self, pkt_layer, vni=0): pkt_layer.vni = vni @@ -450,6 +462,7 @@ class Packet(object): 'IPihl': 'ipv4ihl', 'IPFRAG': 'ipv4_ext', 'IPv6': 'ipv6', + 'IPv6-TUNNEL':'inner_ipv6', 'IPv6FRAG': 'ipv6_frag', 'IPv6EXT': 'ipv6_ext', 'IPv6EXT2': 'ipv6_ext2', @@ -565,6 +578,12 @@ class Packet(object): def _config_layer_tcp(self, pkt_layer, config): return self.pktgen.tcp(pkt_layer, **config) + def _config_layer_sctp(self, pkt_layer, config): + return self.pktgen.sctp(**config) + + def _config_layer_gre(self, pkt_layer, config): + return self.pktgen.gre(**config) + def _config_layer_raw(self, pkt_layer, config): return self.pktgen.raw(pkt_layer, **config) -- 1.9.3