[dts] [PATCH V1] tests/TestSuite_uni_pkt.py

Zhu, WenhuiX wenhuix.zhu at intel.com
Tue Jan 22 05:17:23 CET 2019


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

-----Original Message-----
From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of yaobing
Sent: Monday, January 21, 2019 3:53 PM
To: dts at dpdk.org
Cc: Yao, BingX Y <bingx.y.yao at intel.com>
Subject: [dts] [PATCH V1] tests/TestSuite_uni_pkt.py

some packets are not match with packet type

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

diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py index 17de58f..d01e06f 100644
--- a/tests/TestSuite_uni_pkt.py
+++ b/tests/TestSuite_uni_pkt.py
@@ -305,9 +305,7 @@ class TestUniPacket(TestCase):
             "MAC_IPv6_NVGRE_MAC_IPv6FRAG_PKT":      nvgre_ipv6_default_packet_type + ["INNER_L4_FRAG"],
             "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_IPv6_TCP_PKT":      nvgre_ipv6_default_packet_type + ["INNER_L4_TCP"],    
             "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"],
@@ -317,12 +315,38 @@ class TestUniPacket(TestCase):
             "MAC_IPv6_NVGRE_MAC_VLAN_IPv6FRAG_PKT": nvgre_ipv6_vlan_packet_type + ["INNER_L4_FRAG"], 
             "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"]
+            "MAC_IPv6_NVGRE_MAC_VLAN_IPv6_TCP_PKT": 
+ nvgre_ipv6_vlan_packet_type + ["INNER_L4_TCP"]
         }
 
         self.run_test(pkt_types)
+        pkt_special = [
+                       ["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_special_cope(pkt_special)
+
+    def run_special_cope(self, pkt_special):
+        time.sleep(1)
+        for pkts in pkt_special:
+            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):
         """
@@ -330,16 +354,16 @@ class TestUniPacket(TestCase):
         """
         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



More information about the dts mailing list