From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 80A1B3978 for ; Mon, 15 Aug 2016 05:23:21 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP; 14 Aug 2016 20:23:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,523,1464678000"; d="scan'208";a="865455073" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 14 Aug 2016 20:23:19 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id u7F3NIqQ030641; Mon, 15 Aug 2016 11:23:18 +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 u7F3NFXw003600; Mon, 15 Aug 2016 11:23:17 +0800 Received: (from yufengmx@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id u7F3NFvO003596; Mon, 15 Aug 2016 11:23:15 +0800 From: Yufen Mo To: dts@dpdk.org Cc: yufengmx Date: Mon, 15 Aug 2016 11:23:11 +0800 Message-Id: <1471231392-3545-2-git-send-email-yufengx.mo@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1471231392-3545-1-git-send-email-yufengx.mo@intel.com> References: <1471231392-3545-1-git-send-email-yufengx.mo@intel.com> Subject: [dts] [PATCH V3 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: Mon, 15 Aug 2016 03:23:21 -0000 From: yufengmx Signed-off-by: yufengmx --- framework/packet.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/framework/packet.py b/framework/packet.py index 6c892e5..93d6879 100755 --- a/framework/packet.py +++ b/framework/packet.py @@ -276,12 +276,24 @@ class scapy(object): if chksum is not None: pkt_layer.chksum = chksum + def sctp(self, pkt_layer, src=53, dst=53, len=None, chksum=None): + pkt_layer.sport = src + pkt_layer.dport = dst + if len is not None: + pkt_layer.len = len + if chksum is not None: + pkt_layer.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, pkt_layer, proto=None): + if proto is not None: + pkt_layer.proto = proto + def vxlan(self, pkt_layer, vni=0): pkt_layer.vni = vni @@ -472,9 +484,11 @@ class Packet(object): 'VLAN': 'vlan', 'ETAG': 'etag', 'IP': 'ipv4', + 'IPv4-TUNNEL':'inner_ipv4', 'IPihl': 'ipv4ihl', 'IPFRAG': 'ipv4_ext', 'IPv6': 'ipv6', + 'IPv6-TUNNEL':'inner_ipv6', 'IPv6FRAG': 'ipv6_frag', 'IPv6EXT': 'ipv6_ext', 'IPv6EXT2': 'ipv6_ext2', @@ -593,6 +607,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(pkt_layer, **config) + + def _config_layer_gre(self, pkt_layer, config): + return self.pktgen.gre(pkt_layer, **config) + def _config_layer_raw(self, pkt_layer, config): return self.pktgen.raw(pkt_layer, **config) -- 1.9.3