test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yufen Mo <yufengx.mo@intel.com>
To: dts@dpdk.org
Cc: yufengmx <yufengx.mo@intel.com>
Subject: [dts] [PATCH V1 1/2] add sctp/gre format support in framework/packet module
Date: Tue, 26 Jul 2016 13:24:34 +0800	[thread overview]
Message-ID: <1469510675-29891-2-git-send-email-yufengx.mo@intel.com> (raw)
In-Reply-To: <1469510675-29891-1-git-send-email-yufengx.mo@intel.com>

From: yufengmx <yufengx.mo@intel.com>

Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
 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

  reply	other threads:[~2016-07-26  5:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-26  5:24 [dts] [PATCH V1 0/2] Ipgre automation testing script Yufen Mo
2016-07-26  5:24 ` Yufen Mo [this message]
2016-07-26  5:24 ` [dts] [PATCH V1 2/2] Ipgre: upload " Yufen Mo
2016-07-26  5:32   ` Liu, Yong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469510675-29891-2-git-send-email-yufengx.mo@intel.com \
    --to=yufengx.mo@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).