From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 5B861235 for ; Fri, 25 Jan 2019 08:18:29 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2019 23:18:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,520,1539673200"; d="scan'208";a="141209520" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.240.176.135]) by fmsmga001.fm.intel.com with ESMTP; 24 Jan 2019 23:18:27 -0800 From: yaobing To: dts@dpdk.org Cc: yaobing Date: Fri, 25 Jan 2019 15:22:07 +0800 Message-Id: <1548400927-36417-1-git-send-email-bingx.y.yao@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH V2] tests/uni_pkt:fix wrong pkt type X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2019 07:18:30 -0000 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 --- 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