From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3366D2BD7 for ; Thu, 18 Aug 2016 08:26:22 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 17 Aug 2016 23:26:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,537,1464678000"; d="scan'208";a="1016450092" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 17 Aug 2016 23:26:20 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id u7I6QJ9J014061; Thu, 18 Aug 2016 14:26:19 +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 u7I6QGAJ025096; Thu, 18 Aug 2016 14:26:18 +0800 Received: (from yufengmx@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id u7I6QG6O025092; Thu, 18 Aug 2016 14:26:16 +0800 From: Yufen Mo To: dts@dpdk.org Cc: yufengmx Date: Thu, 18 Aug 2016 14:25:13 +0800 Message-Id: <1471501514-25051-2-git-send-email-yufengx.mo@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1471501514-25051-1-git-send-email-yufengx.mo@intel.com> References: <1471501514-25051-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: Thu, 18 Aug 2016 06:26:22 -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