From patchwork Fri Jul 15 18:25:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Jiale, SongX" X-Patchwork-Id: 113981 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CCE07A0032; Fri, 15 Jul 2022 12:04:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B6A8140696; Fri, 15 Jul 2022 12:04:18 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 6D9B240042 for ; Fri, 15 Jul 2022 12:04:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657879456; x=1689415456; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=CwkwRLXkGMVmXUPczmlbs3bFMHj61WbjwOKEVsRw8M0=; b=kisT24lmaQfZv9DX71g4P/4bvUNNcKnRCnkMQs3r4rxhFTcN4aT9p87r hpZxWRKKZeiOExaZjUsecGckQHNtljjcN1HqmapVh6aT38FtnXzZaZ1gf z2Sl+2Tx/hqa5Q1x22IKrokBGENKh+pOI2x+WizhbvqkDM5s/EADf47el rxolhUKxJ2zhp0gHlt/hWTVO5KA4Vf3ZPV/uu4VQqdagDerf50ebP+hx6 avCZH5pT6KzG8julaASSvq9r+zX3RA+I3YKhAKrDtnEkaRZMJ0snsD5ym w+PufuRQ+4KdDmwZwUH0dFIMvkVCKEHnYFUL2PicmEiorl2JLTYIQuHl5 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10408"; a="265542603" X-IronPort-AV: E=Sophos;i="5.92,273,1650956400"; d="scan'208";a="265542603" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2022 03:04:15 -0700 X-IronPort-AV: E=Sophos;i="5.92,273,1650956400"; d="scan'208";a="654274845" Received: from unknown (HELO localhost.localdomain) ([10.239.252.94]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2022 03:04:14 -0700 From: Jiale Song To: dts@dpdk.org Cc: Jiale Song Subject: [dts] [PATCH V1] test_plans/ip_pipeline: modify test plan and case Date: Fri, 15 Jul 2022 18:25:51 +0000 Message-Id: <20220715182551.8909-1-songx.jiale@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org 1. redesign testplan and synchronously modify test case. 2. delete unused import. Signed-off-by: Jiale Song Acked-by: Peng, Yuan Signed-off-by: Jiale Song --- test_plans/ip_pipeline_test_plan.rst | 15 ++- tests/TestSuite_ip_pipeline.py | 156 +++++++++++++-------------- 2 files changed, 84 insertions(+), 87 deletions(-) diff --git a/test_plans/ip_pipeline_test_plan.rst b/test_plans/ip_pipeline_test_plan.rst index c504efa4..395b1bc5 100644 --- a/test_plans/ip_pipeline_test_plan.rst +++ b/test_plans/ip_pipeline_test_plan.rst @@ -171,17 +171,14 @@ Test Case: RSS pipeline .//examples/dpdk-ip_pipeline -c 0x1f -n 4 –- -s examples/rss.cli -3. Send following packets with one test port:: +3. Send 20 IP packets randomly for one test port - packet_1:Ether(dst="00:11:22:33:44:55")/IP(src="100.0.10.1",dst="100.0.20.2")/Raw(load="X"*6) - packet_2:Ether(dst="00:11:22:33:44:55")/IP(src="100.0.0.0",dst="100.0.0.1")/Raw(load="X"*6) - packet_3:Ether(dst="00:11:22:33:44:55")/IP(src="100.0.10.1",dst="100.0.0.2")/Raw(load="X"*6) - packet_4:Ether(dst="00:11:22:33:44:55")/IP(src="100.0.0.1",dst="100.0.10.2")/Raw(load="X"*6) +4. Check the test port can be received and assigned to other ports through RSS + Verify that the sum of packets received by all ports is 20. + Verify all tester_port can received packets. - Verify packet_1 was received by tester_port_0. - Verify packet_2 was received by tester_port_1. - Verify packet_3 was received by tester_port_2. - Verify packet_4 was received by tester_port_3. +5. Repeat steps 3-4 to ensure that the RSS functions of all test ports are normal. + Verify that packets of the same IP can be assigned to the same port through different test ports. Test Case: vf l2fwd pipeline(pf bound to dpdk driver) ====================================================== diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py index be9c05b9..8b2826e2 100644 --- a/tests/TestSuite_ip_pipeline.py +++ b/tests/TestSuite_ip_pipeline.py @@ -2,34 +2,18 @@ # Copyright(c) 2010-2018 Intel Corporation # -import os -import random import re import time from time import sleep -import scapy.layers.inet -from scapy.arch import get_if_hwaddr from scapy.layers.inet import ICMP, IP, TCP, UDP, Ether -from scapy.layers.l2 import ARP, GRE, Dot1Q -from scapy.layers.sctp import SCTP, SCTPChunkData from scapy.packet import Raw, bind_layers from scapy.route import * -from scapy.sendrecv import sendp, sniff - -# from scapy.all import conf from scapy.utils import hexstr, rdpcap, wrpcap -import framework.utils as utils -from framework.crb import Crb -from framework.dut import Dut from framework.exception import VerifyFailure from framework.packet import Packet -from framework.pmd_output import PmdOutput -from framework.project_dpdk import DPDKdut -from framework.settings import DRIVERS, HEADER_SIZE from framework.test_case import TestCase -from framework.virt_dut import VirtDut class TestIPPipeline(TestCase): @@ -970,76 +954,92 @@ class TestIPPipeline(TestCase): ) self.dut.send_expect(cmd, "PIPELINE3 enable", 60) - # rule 0 test - pcap_file = "/tmp/rss_0.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.10.1", dst="100.0.20.2") - / Raw(load="X" * 6) - ] - self.write_pcap_file(pcap_file, pkt) - filters = "dst host 100.0.20.2" - sniff_pkts = self.send_and_sniff_pkts(0, 0, pcap_file, filters) - dst_ip_list = [] - for packet in sniff_pkts: - dst_ip_list.append(packet.getlayer(1).dst) - self.verify("100.0.20.2" in dst_ip_list, "rule 0 test fail") - - # rule 1 test - pcap_file = "/tmp/rss_1.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.0", dst="100.0.0.1") - / Raw(load="X" * 6) - ] - self.write_pcap_file(pcap_file, pkt) - filters = "dst host 100.0.0.1" - sniff_pkts = self.send_and_sniff_pkts(0, 1, pcap_file, filters) - dst_ip_list = [] - for packet in sniff_pkts: - dst_ip_list.append(packet.getlayer(1).dst) - self.verify("100.0.0.1" in dst_ip_list, "rule 1 test fail") - - # rule 2 test - pcap_file = "/tmp/rss_2.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.10.1", dst="100.0.0.2") - / Raw(load="X" * 6) - ] - self.write_pcap_file(pcap_file, pkt) - filters = "dst host 100.0.0.2" - sniff_pkts = self.send_and_sniff_pkts(0, 2, pcap_file, filters) - dst_ip_list = [] - for packet in sniff_pkts: - dst_ip_list.append(packet.getlayer(1).dst) - self.verify("100.0.0.2" in dst_ip_list, "rule 2 test fail") - - # rule 3 test - pcap_file = "/tmp/rss_3.pcap" - pkt = [ - Ether(dst=self.dut_p0_mac) - / IP(src="100.0.0.1", dst="100.0.10.2") - / Raw(load="X" * 6) - ] - self.write_pcap_file(pcap_file, pkt) - filters = "dst host 100.0.10.2" - sniff_pkts = self.send_and_sniff_pkts(0, 3, pcap_file, filters) - dst_ip_list = [] - for packet in sniff_pkts: - dst_ip_list.append(packet.getlayer(1).dst) - self.verify("100.0.10.2" in dst_ip_list, "rule 3 test fail") + pkt = Packet() + tx_pkt_num = 20 + pkt.generate_random_pkts( + dstmac="00:11:22:33:44:55", + pktnum=tx_pkt_num, + random_type=["IP_RAW"], + options={"ip": {"dst": "100.0.20.2"}, "layers_config": []}, + ) - sleep(1) - cmd = "^C" - self.dut.send_expect(cmd, "# ", 20) + all_rx_num = [] + all_rx_packet = [] + for num in range(len(self.dut_ports)): + inst_list = [] + for port in self.dut_ports: + rx_interface = self.tester.get_interface(port) + filters = [ + {"layer": "ether", "config": {"dst": "not ff:ff:ff:ff:ff:ff"}} + ] + inst = self.tester.tcpdump_sniff_packets( + intf=rx_interface, filters=filters + ) + inst_list.append(inst) + rx_port = self.tester.get_local_port(self.dut_ports[num]) + tport_iface = self.tester.get_interface(rx_port) + self.tester.is_interface_up(tport_iface) + pkt.send_pkt(crb=self.tester, tx_port=tport_iface, count=1) + t_rx_ports = [] + t_rx_num = [] + t_rx_packets = [] + t_no_rx_ports = [] + rx_pkt_num = 0 + for port in self.dut_ports: + p = self.tester.load_tcpdump_sniff_packets(inst_list[port]) + if len(p): + t_rx_ports.append(port) + t_rx_num.append(len(p)) + t_rx_packets.append(p) + rx_pkt_num += len(p) + else: + t_no_rx_ports.append(port) + # Verify that the sum of packets received by all ports is 20 + self.verify( + rx_pkt_num == tx_pkt_num, + "send packet %s, but receive packet %s" % (tx_pkt_num, rx_pkt_num), + ) + # Verify all tester_port can received packets + self.verify( + len(t_rx_ports) == len(self.dut_ports), + "port %s not received packets" % t_no_rx_ports, + ) + all_rx_num.append(tuple(t_rx_num)) + all_rx_packet.append(t_rx_packets) + # Verify that packets of the same IP can be assigned to the same port through different test ports. + self.verify( + len(set(all_rx_num)), + "pipeline rss failed, all receiced packet num: %s" % all_rx_num, + ) + for d_port in self.dut_ports: + if d_port > 0: + for t_port in range(len(all_rx_packet[d_port])): + for i in range(len(all_rx_packet[d_port][t_port])): + try: + self.verify( + all_rx_packet[d_port][t_port][i] + in all_rx_packet[0][t_port], + "test port %s rss different with test port 0" % d_port, + ) + except VerifyFailure as ex: + self.logger.error( + "\n%s\n\n%s" + % ( + all_rx_packet[0][t_port][0].command(), + all_rx_packet[d_port][t_port][0].command(), + ) + ) + raise ex def tear_down(self): """ Run after each test case. """ + # kill all tcpdump + self.tcpdump_stop_sniff() # close app self.dut.send_expect("^C", "# ") + self.dut.kill_all() def tear_down_all(self): """