test suite reviews and discussions
 help / color / mirror / Atom feed
From: Marvin Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH 2/3] framework packet: support ip layer elements strip
Date: Wed, 26 Oct 2016 15:00:40 +0800	[thread overview]
Message-ID: <1477465241-17826-3-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1477465241-17826-1-git-send-email-yong.liu@intel.com>

Signed-off-by: Marvin Liu <yong.liu@intel.com>

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

  parent reply	other threads:[~2016-10-26  7:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26  7:00 [dts] [PATCH 0/3] enable random packet check function Marvin Liu
2016-10-26  7:00 ` [dts] [PATCH 1/3] framework utils: add function to convert ipaddress Marvin Liu
2016-10-26  7:00 ` Marvin Liu [this message]
2016-10-26  7:00 ` [dts] [PATCH 3/3] framework tester: workaround random packet check issue Marvin Liu

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=1477465241-17826-3-git-send-email-yong.liu@intel.com \
    --to=yong.liu@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).