test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Zhu, WenhuiX" <wenhuix.zhu@intel.com>
To: "Yao, BingX Y" <bingx.y.yao@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Cc: "Yao, BingX Y" <bingx.y.yao@intel.com>
Subject: Re: [dts] [PATCH V2] tests/uni_pkt:fix wrong pkt type
Date: Tue, 29 Jan 2019 03:19:54 +0000	[thread overview]
Message-ID: <E08767FB2CE10642B6780736EAC070F604907613@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1548400927-36417-1-git-send-email-bingx.y.yao@intel.com>


Tested-by: Zhu, WenhuiX <wenhuix.zhu@intel.com>

-----Original Message-----
From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of yaobing
Sent: Friday, January 25, 2019 3:22 PM
To: dts@dpdk.org
Cc: Yao, BingX Y <bingx.y.yao@intel.com>
Subject: [dts] [PATCH V2] tests/uni_pkt:fix wrong pkt type

1. fix typos: SCT to SCTP

2. fix wrong nic name: i350 to powerville

3. IPv6_in_IPv4_tunnel support more nics

4. pkt_type in GRE and IPv6_in_IPv4_tunnel: unified packet type flag not match,update flags

5. add run_nvgre_cope to generate IPV6 NVGRE SCTP and ICMP packets

Signed-off-by: yaobing <bingx.y.yao@intel.com>
---
 tests/TestSuite_uni_pkt.py | 79 +++++++++++++++++++++++++-------------
 1 file changed, 52 insertions(+), 27 deletions(-)

diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py index 17de58f..172c24d 100644
--- a/tests/TestSuite_uni_pkt.py
+++ b/tests/TestSuite_uni_pkt.py
@@ -118,14 +118,14 @@ class TestUniPacket(TestCase):
         if "fortville" in self.nic or "fortpark_TLV" in self.nic:
             outerL4Type = "L4_NONFRAG"
             ipv4_default_packet_type = ["L2_ETHER", "L3_IPV4_EXT_UNKNOWN"]
-        elif "niantic" in self.nic.lower() or "i350" in self.nic.lower() or "cavium" in self.nic.lower():
+        elif "niantic" in self.nic.lower() or "powerville" in self.nic.lower() or "cavium" in self.nic.lower():
             outerL4Type = ""
             ipv4_default_packet_type = ["L2_ETHER", "L3_IPV4"]
         pktType = {
             "MAC_IP_PKT":                ipv4_default_packet_type + [outerL4Type],
             "MAC_IP_UDP_PKT":            ipv4_default_packet_type + ["L4_UDP"],
             "MAC_IP_TCP_PKT":            ipv4_default_packet_type + ["L4_TCP"],
-            "MAC_IP_SCTP_PKT":           ipv4_default_packet_type + ["L4_SCT"],
+            "MAC_IP_SCTP_PKT":           ipv4_default_packet_type + ["L4_SCTP"],
             "MAC_IP_ICMP_PKT":           ipv4_default_packet_type + ["L4_ICMP"],
             "MAC_IPFRAG_TCP_PKT":        ipv4_default_packet_type + ["L4_FRAG"],
             "MAC_IPihl_PKT":             ["L2_ETHER", "L3_IPV4_EXT"],
@@ -136,7 +136,7 @@ class TestUniPacket(TestCase):
         if "fortville" in self.nic or "fortpark_TLV" in self.nic:
             pktType.pop("MAC_IPihl_PKT")
             pktType.pop("MAC_IPihl_SCTP_PKT")
-        elif "niantic" in self.nic.lower() or "i350" in self.nic.lower() or "cavium" in self.nic.lower():
+        elif "niantic" in self.nic.lower() or "powerville" in self.nic.lower() or "cavium" in self.nic.lower():
             pktType.pop("MAC_IP_ICMP_PKT")
             pktType.pop("MAC_IPFRAG_TCP_PKT")
 
@@ -149,7 +149,7 @@ class TestUniPacket(TestCase):
         if "fortville" in self.nic or "fortpark_TLV" in self.nic:
             outerL4Type = "L4_NONFRAG"
             ipv6_default_packet_type = ["L2_ETHER", "L3_IPV6_EXT_UNKNOWN"]
-        elif "niantic" in self.nic.lower() or "i350" in self.nic.lower() or "cavium" in self.nic.lower():
+        elif "niantic" in self.nic.lower() or "powerville" in self.nic.lower() or "cavium" in self.nic.lower():
             outerL4Type = ""
             ipv6_default_packet_type = ["L2_ETHER", "L3_IPV6"]
 
@@ -164,7 +164,7 @@ class TestUniPacket(TestCase):
         # delete the unsupported packet based on nic type
         if "fortville" in self.nic or "fortpark_TLV" in self.nic:
             pktType.pop("MAC_IPv6FRAG_PKT_N")
-        elif "niantic" in self.nic.lower() or "i350" in self.nic.lower() or "cavium" in self.nic.lower():
+        elif "niantic" in self.nic.lower() or "powerville" in self.nic.lower() or "cavium" in self.nic.lower():
             pktType.pop("MAC_IPv6FRAG_PKT_F")
 
         self.run_test(pktType)
@@ -199,18 +199,19 @@ class TestUniPacket(TestCase):
     def test_IPv6_in_IPv4_tunnel(self):
         """
         checked that whether IPv4 in IPv6 tunnel packet can be normally
-        detected by Niantic and i350.
+        detected.
         """
-        if "niantic" not in self.nic.lower() and "i350" not in self.nic.lower():
-            return
+        self.verify(self.nic in ["niantic", "fortville_eagle", "fortville_spirit",
+                           "powerville", "fortpark_TLV", "fortville_25g", 
+                           "fortville_spirit_single"], "not support %s" 
+ % self.nic)
 
         pktType = {
-            "MAC_IP_IPv6_PKT":            ["L2_ETHER", "L3_IPV4", "TUNNEL_IP",  "INNER"],
-            "MAC_IP_IPv6EXT2_PKT":        ["L2_ETHER", "L3_IPV4", "TUNNEL_IP",  "INNER"],
-            "MAC_IP_IPv6_UDP_PKT":        ["L2_ETHER", "L3_IPV4", "TUNNEL_IP",  "INNER"],
-            "MAC_IP_IPv6_TCP_PKT":        ["L2_ETHER", "L3_IPV4", "TUNNEL_IP",  "INNER"],
-            "MAC_IP_IPv6EXT2_UDP_PKT":    ["L2_ETHER", "L3_IPV4", "TUNNEL_IP",  "INNER"],
-            "MAC_IP_IPv6EXT2_TCP_PKT":    ["L2_ETHER", "L3_IPV4", "TUNNEL_IP",  "INNER"]
+            "MAC_IP_IPv6_PKT":            ["L2_ETHER", "L3_IPV4", "TUNNEL_IP",  "INNER_L3_IPV6"],
+            "MAC_IP_IPv6EXT2_PKT":        ["L2_ETHER", "L3_IPV4", "TUNNEL_IP",  "INNER_L3_IPV6_EXT"],
+            "MAC_IP_IPv6_UDP_PKT":        ["L2_ETHER", "L3_IPV4", "TUNNEL_IP",  "INNER_L3_IPV6", "INNER_L4_UDP"],
+            "MAC_IP_IPv6_TCP_PKT":        ["L2_ETHER", "L3_IPV4", "TUNNEL_IP",  "INNER_L3_IPV6", "INNER_L4_TCP"],
+            "MAC_IP_IPv6EXT2_UDP_PKT":    ["L2_ETHER", "L3_IPV4", "TUNNEL_IP",  "INNER_L3_IPV6_EXT", "INNER_L4_UDP"],
+            "MAC_IP_IPv6EXT2_TCP_PKT":    ["L2_ETHER", "L3_IPV4", "TUNNEL_IP",  "INNER_L3_IPV6_EXT", "INNER_L4_TCP"]
         }
         self.run_test(pktType)
 
@@ -306,8 +307,6 @@ class TestUniPacket(TestCase):
             "MAC_IPv6_NVGRE_MAC_IPv6_PKT":          nvgre_ipv6_default_packet_type + ["INNER_L4_NONFRAG"],
             "MAC_IPv6_NVGRE_MAC_IPv6_UDP_PKT":      nvgre_ipv6_default_packet_type + ["INNER_L4_UDP"],
             "MAC_IPv6_NVGRE_MAC_IPv6_TCP_PKT":      nvgre_ipv6_default_packet_type + ["INNER_L4_TCP"], 
-            "MAC_IPv6_NVGRE_MAC_IPv6_SCTP_PKT":     nvgre_ipv6_default_packet_type + ["INNER_L4_NONFRAG"],
-            "MAC_IPv6_NVGRE_MAC_IPv6_ICMP_PKT":     nvgre_ipv6_default_packet_type + ["INNER_L4_NONFRAG"],
             "MAC_IPv6_NVGRE_MAC_VLAN_IPFRAG_PKT":   nvgre_ipv4_vlan_packet_type + ["INNER_L4_FRAG"],
             "MAC_IPv6_NVGRE_MAC_VLAN_IP_PKT":       nvgre_ipv4_vlan_packet_type + ["INNER_L4_NONFRAG"],
             "MAC_IPv6_NVGRE_MAC_VLAN_IP_UDP_PKT":   nvgre_ipv4_vlan_packet_type + ["INNER_L4_UDP"],
@@ -318,28 +317,54 @@ class TestUniPacket(TestCase):
             "MAC_IPv6_NVGRE_MAC_VLAN_IPv6_PKT":     nvgre_ipv6_vlan_packet_type + ["INNER_L4_NONFRAG"],
             "MAC_IPv6_NVGRE_MAC_VLAN_IPv6_UDP_PKT": nvgre_ipv6_vlan_packet_type + ["INNER_L4_UDP"],
             "MAC_IPv6_NVGRE_MAC_VLAN_IPv6_TCP_PKT": nvgre_ipv6_vlan_packet_type + ["INNER_L4_TCP"],
-            "MAC_IPv6_NVGRE_MAC_VLAN_IPv6_SCTP_PKT":nvgre_ipv6_vlan_packet_type + ["INNER_L4_NONFRAG"],
-            "MAC_IPv6_NVGRE_MAC_VLAN_IPv6_ICMP_PKT":nvgre_ipv6_vlan_packet_type + ["INNER_L4_NONFRAG"]
         }
 
         self.run_test(pkt_types)
 
+        pkt_nvgre = [
+                       ["MAC_IPv6_NVGRE_MAC_IPv6_SCTP_PKT",nvgre_ipv6_default_packet_type + ["INNER_L4_SCTP"],
+                       ['ether', 'ipv6', 'nvgre', 'inner_mac', 'inner_ipv6', 'inner_sctp', 'raw']],
+                       ["MAC_IPv6_NVGRE_MAC_IPv6_ICMP_PKT",nvgre_ipv6_default_packet_type + ["INNER_L4_ICMP"],
+                       ['ether', 'ipv6', 'nvgre', 'inner_mac', 'inner_ipv6', 'inner_icmp', 'raw']],
+                       ["MAC_IPv6_NVGRE_MAC_VLAN_IPv6_SCTP_PKT",nvgre_ipv6_vlan_packet_type + ["INNER_L4_SCTP"],
+                       ['ether', 'ipv6', 'nvgre', 'inner_mac', 'inner_vlan', 'inner_ipv6', 'inner_sctp', 'raw']],
+                       ["MAC_IPv6_NVGRE_MAC_VLAN_IPv6_ICMP_PKT",nvgre_ipv6_vlan_packet_type + ["INNER_L4_ICMP"],
+                       ['ether', 'ipv6', 'nvgre', 'inner_mac', 'inner_vlan', 'inner_ipv6', 'inner_icmp', 'raw']]
+                      ]
+        self.run_nvgre_cope(pkt_nvgre)
+
+    def run_nvgre_cope(self, pkt_nvgre):
+        time.sleep(1)
+        for pkts in pkt_nvgre:
+            pkt = Packet()
+            pkt.assign_layers(pkts[2])
+            if 'inner_icmp' in pkts[2]:
+                pkt.config_layers([('ipv6',{'nh':47}), ('inner_ipv6', {'nh': 58})])
+            else:
+                pkt.config_layers([('ipv6',{'nh':47}),('inner_ipv6', {'nh': 132})])
+            pkt.send_pkt(tx_port=self.tester_iface)
+            out = self.dut.get_session_output(timeout=2)
+            for pkt_layer_name in pkts[1]:
+                if pkt_layer_name not in out:
+                    print utils.RED("Fail to detect %s" % pkt_layer_name)
+                    raise VerifyFailure("Failed to detect %s" % pkt_layer_name)
+            print utils.GREEN("Detected %s successfully" % pkts[0])
+
     def test_GRE_tunnel(self):
         """
         checked that whether GRE tunnel packet can be normally detected by Fortville.
         """
         self.verify(("fortville" in self.nic or "fortpark_TLV" in self.nic),
                     "GRE tunnel packet type detect only support by Fortville")
-        IPv4_packet_type = [" L2_ETHER", " L3_IPV4_EXT_UNKNOWN", "L4_NONFRAG"]
-
+        base_packet_type = [" L2_ETHER", " L3_IPV4_EXT_UNKNOWN", 
+ "TUNNEL_GRENAT"]
         pktType = {
-            "MAC_IP_GRE_IPFRAG_PKT":          IPv4_packet_type,
-            "MAC_IP_GRE_IP_PKT":              IPv4_packet_type,
-            "MAC_IP_GRE_IP_UDP_PKT":          IPv4_packet_type,
-            "MAC_IP_GRE_IP_TCP_PKT":          IPv4_packet_type,
-            "MAC_IP_GRE_IP_SCTP_PKT":         IPv4_packet_type,
-            "MAC_IP_GRE_IP_ICMP_PKT":         IPv4_packet_type,
-            "MAC_IP_GRE_PKT":                 IPv4_packet_type
+            "MAC_IP_GRE_IPFRAG_PKT":          base_packet_type + ["INNER_L3_IPV4_EXT_UNKNOWN", "INNER_L4_FRAG"],
+            "MAC_IP_GRE_IP_PKT":              base_packet_type + ["INNER_L3_IPV4_EXT_UNKNOWN", "INNER_L4_NONFRAG"],
+            "MAC_IP_GRE_IP_UDP_PKT":          base_packet_type + ["INNER_L3_IPV4_EXT_UNKNOWN", "INNER_L4_UDP"],
+            "MAC_IP_GRE_IP_TCP_PKT":          base_packet_type + ["INNER_L3_IPV4_EXT_UNKNOWN", "INNER_L4_TCP"],
+            "MAC_IP_GRE_IP_SCTP_PKT":         base_packet_type + ["INNER_L3_IPV4_EXT_UNKNOWN", "INNER_L4_SCTP"],
+            "MAC_IP_GRE_IP_ICMP_PKT":         base_packet_type + ["INNER_L3_IPV4_EXT_UNKNOWN", "INNER_L4_ICMP"],
+            "MAC_IP_GRE_PKT":                 base_packet_type
         }
         self.run_test(pktType)
 
--
2.17.2

  reply	other threads:[~2019-01-29  3:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25  7:22 yaobing
2019-01-29  3:19 ` Zhu, WenhuiX [this message]
2019-01-30  6:18 ` Tu, Lijuan

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=E08767FB2CE10642B6780736EAC070F604907613@shsmsx102.ccr.corp.intel.com \
    --to=wenhuix.zhu@intel.com \
    --cc=bingx.y.yao@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).