test suite reviews and discussions
 help / color / mirror / Atom feed
From: Wang Fei <feix.y.wang@intel.com>
To: dts@dpdk.org
Subject: [dts] [DTS][Patch v1 2/2] tests/uni_pkt: add nsh test case
Date: Thu,  5 Jul 2018 08:14:13 +0800	[thread overview]
Message-ID: <1530749653-147414-1-git-send-email-feix.y.wang@intel.com> (raw)

Signed-off-by: Wang Fei <feix.y.wang@intel.com>
---
 tests/TestSuite_uni_pkt.py | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py
index 2586ad9..f2d0f83 100644
--- a/tests/TestSuite_uni_pkt.py
+++ b/tests/TestSuite_uni_pkt.py
@@ -377,6 +377,50 @@ class TestUniPacket(TestCase):
         }
         self.run_test(pktType)
 
+    def test_nsh(self):
+        """
+        check if NSH packets can be norally detected by Fortpark and Fortville
+        """
+        self.verify(self.kdriver == 'i40e', "NSH packet detection only supported by i40e driver nic")
+
+        nsh_packets = {'ether+nsh': 'Ether(type=0x894f)/NSH(Len=0x6,NextProto=0x0,NSP=0x000002,NSI=0xff)', \
+                       'ether+nsh+ip': 'Ether(dst="00:00:00:00:01:00",type=0x894f)/NSH(Len=0x6,NextProto=0x1,NSP=0x000002,NSI=0xff)/IP()', \
+                       'ether+nsh+ip+icmp': 'Ether(type=0x894f)/NSH(Len=0x6,NextProto=0x1,NSP=0x000002,NSI=0xff)/IP()/ICMP()', \
+                       'ether+nsh+ip_frag': 'Ether(dst="00:00:00:00:01:00",type=0x894f)/NSH(Len=0x6,NextProto=0x1,NSP=0x000002,NSI=0xff)/IP(frag=1,flags="MF")', \
+                       'ether+nsh+ip+tcp': 'Ether(type=0x894f)/NSH(Len=0x6,NextProto=0x1,NSP=0x000002,NSI=0xff)/IP()/TCP()', \
+                       'ether+nsh+ip+udp': 'Ether(dst="00:00:00:00:01:00",type=0x894f)/NSH(Len=0x6,NextProto=0x1,NSP=0x000002,NSI=0xff)/IP()/UDP()', \
+                       'ether+nsh+ip+sctp': 'Ether(type=0x894f)/NSH(Len=0x6,NextProto=0x1,NSP=0x000002,NSI=0xff)/IP()/SCTP(tag=1)/SCTPChunkData(data=\'X\' * 16)', \
+                       'ether+nsh+ipv6': 'Ether(type=0x894f)/NSH(Len=0x6,NextProto=0x2,NSP=0x000002,NSI=0xff)/IPv6()', \
+                       'ether+nsh+ipv6+icmp': 'Ether(type=0x894f)/NSH(Len=0x6,NextProto=0x2,NSP=0x000002,NSI=0xff)/IPv6(src="2001::1",dst="2003::2",nh=0x3A)/ICMP()',
+                       'ether+nsh+ipv6_frag': 'Ether(dst="00:00:00:00:01:00",type=0x894f)/NSH(Len=0x6,NextProto=0x2,NSP=0x000002,NSI=0xff)/IPv6()/IPv6ExtHdrFragment()', \
+                       'ether+nsh+ipv6+tcp': 'Ether(type=0x894f)/NSH(Len=0x6,NextProto=0x2,NSP=0x000002,NSI=0xff)/IPv6()/TCP()', \
+                       'ether+nsh+ipv6+udp': 'Ether(dst="00:00:00:00:01:00",type=0x894f)/NSH(Len=0x6,NextProto=0x2,NSP=0x000002,NSI=0xff)/IPv6()/UDP()', \
+                       'ether+nsh+ipv6+sctp': 'Ether(type=0x894f)/NSH(Len=0x6,NextProto=0x2,NSP=0x000002,NSI=0xff)/IPv6(nh=0x84)/SCTP(tag=1)/SCTPChunkData("x" * 16)'
+                       }
+
+        nsh_detect_message = {"ether+nsh": "L2_ETHER_NSH", \
+                              "ether+nsh+ip": "L2_ETHER_NSH L3_IPV4_EXT_UNKNOWN L4_NONFRAG", \
+                              "ether+nsh+ip+icmp": "L2_ETHER_NSH L3_IPV4_EXT_UNKNOWN L4_ICMP", \
+                              "ether+nsh+ip_frag": "L2_ETHER_NSH L3_IPV4_EXT_UNKNOWN L4_FRAG", \
+                              "ether+nsh+ip+tcp": "L2_ETHER_NSH L3_IPV4_EXT_UNKNOWN L4_TCP", \
+                              "ether+nsh+ip+udp": "L2_ETHER_NSH L3_IPV4_EXT_UNKNOWN L4_UDP", \
+                              "ether+nsh+ip+sctp": "L2_ETHER_NSH L3_IPV4_EXT_UNKNOWN L4_SCTP", \
+                              "ether+nsh+ipv6": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_NONFRAG", \
+                              "ether+nsh+ipv6+icmp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_ICMP", \
+                              "ether+nsh+ipv6_frag": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_FRAG", \
+                              "ether+nsh+ipv6+tcp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_TCP", \
+                              "ether+nsh+ipv6+udp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_UDP", \
+                              "ether+nsh+ipv6+sctp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_SCTP"
+                             }
+
+        for packet in nsh_packets:
+            self.tester.scapy_foreground()
+            self.tester.scapy_append("sendp([%s],iface='%s')" % (nsh_packets[packet], self.tester_iface))
+            self.tester.scapy_execute()
+            out = self.dut.get_session_output(timeout=2)
+            self.verify(nsh_detect_message[packet] in out, "Packet Detection Error for : %s" % packet)
+            print utils.GREEN("Detected packet %s Successfully" % packet)
+
     def tear_down(self):
         """
         Run after each test case.
-- 
2.7.4

             reply	other threads:[~2018-07-05  6:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-05  0:14 Wang Fei [this message]
2018-07-06 10:12 ` 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=1530749653-147414-1-git-send-email-feix.y.wang@intel.com \
    --to=feix.y.wang@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).