test suite reviews and discussions
 help / color / mirror / Atom feed
From: Song Jiale <songx.jiale@intel.com>
To: dts@dpdk.org
Cc: Song Jiale <songx.jiale@intel.com>
Subject: [dts] [PATCH V2 1/5] tests/ice_dcf_dual_vlan: split the ice_qinq suite
Date: Wed, 11 Jan 2023 10:38:54 +0000	[thread overview]
Message-ID: <20230111103858.970228-2-songx.jiale@intel.com> (raw)
In-Reply-To: <20230111103858.970228-1-songx.jiale@intel.com>

split dcf cases in ice_qinq to ice_dcf_dual_vlan and delete ice_qinq suite.

Signed-off-by: Song Jiale <songx.jiale@intel.com>
---
 ...qinq.py => TestSuite_ice_dcf_dual_vlan.py} | 653 ++++--------------
 1 file changed, 144 insertions(+), 509 deletions(-)
 rename tests/{TestSuite_ice_qinq.py => TestSuite_ice_dcf_dual_vlan.py} (67%)

diff --git a/tests/TestSuite_ice_qinq.py b/tests/TestSuite_ice_dcf_dual_vlan.py
similarity index 67%
rename from tests/TestSuite_ice_qinq.py
rename to tests/TestSuite_ice_dcf_dual_vlan.py
index 5f01dfef..fc633364 100644
--- a/tests/TestSuite_ice_qinq.py
+++ b/tests/TestSuite_ice_dcf_dual_vlan.py
@@ -2,7 +2,6 @@
 # Copyright(c) 2021-2022 Intel Corporation
 #
 
-import random
 import re
 import time
 
@@ -11,7 +10,7 @@ from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase, check_supported_nic, skip_unsupported_pkg
 from framework.utils import GREEN, RED
 
-from .rte_flow_common import RssProcessing
+from .rte_flow_common import FdirProcessing
 
 mac_qinq_ipv4_pay_src_ip = {
     "name": "mac_qinq_ipv4_pay_src_ip",
@@ -403,7 +402,7 @@ tv_mac_qinq_ipv6_tcp = {
 tvs_mac_l4_qinq_dcf_pipeline_mode = [tv_mac_qinq_ipv6_udp, tv_mac_qinq_ipv6_tcp]
 
 
-class TestICEQinq(TestCase):
+class TestICEDcfDualVlan(TestCase):
     @check_supported_nic(
         [
             "ICE_25G-E810C_SFP",
@@ -445,6 +444,9 @@ class TestICEQinq(TestCase):
         self.path = self.dut.apps_name["test-pmd"]
         self.pkt = Packet()
         self.pmd_output = PmdOutput(self.dut)
+        self.fdirprocess = FdirProcessing(
+            self, self.pmd_output, [self.tester_iface0], rxq=8
+        )
 
     def reload_ice(self):
         self.dut.send_expect("rmmod ice && modprobe ice", "# ")
@@ -462,35 +464,28 @@ class TestICEQinq(TestCase):
                 "# ",
             )
 
-    def setup_pf_vfs_env(self, vfs_num=4):
-
+    def setup_1pf_4vfs_env(self):
         if self.vf_flag is False:
             self.dut.generate_sriov_vfs_by_port(
-                self.used_dut_port, vfs_num, driver=self.kdriver
+                self.used_dut_port, 4, driver=self.kdriver
             )
             self.sriov_vfs_port = self.dut.ports_info[self.used_dut_port]["vfs_port"]
             self.vf_flag = True
-            if vfs_num > 1:
-                self.dut.send_expect(
-                    "ip link set %s vf 0 trust on" % (self.pf_interface), "# "
-                )
-                self.dut.send_expect(
-                    "ip link set %s vf 1 mac %s" % (self.pf_interface, self.vf1_mac),
-                    "# ",
-                )
-                self.dut.send_expect(
-                    "ip link set %s vf 2 mac %s" % (self.pf_interface, self.vf2_mac),
-                    "# ",
-                )
-                self.dut.send_expect(
-                    "ip link set %s vf 3 mac %s" % (self.pf_interface, self.vf3_mac),
-                    "# ",
-                )
-            else:
-                self.dut.send_expect(
-                    "ip link set %s vf 0 mac %s" % (self.pf_interface, self.vf1_mac),
-                    "# ",
-                )
+            self.dut.send_expect(
+                "ip link set %s vf 0 trust on" % (self.pf_interface), "# "
+            )
+            self.dut.send_expect(
+                "ip link set %s vf 1 mac %s" % (self.pf_interface, self.vf1_mac),
+                "# ",
+            )
+            self.dut.send_expect(
+                "ip link set %s vf 2 mac %s" % (self.pf_interface, self.vf2_mac),
+                "# ",
+            )
+            self.dut.send_expect(
+                "ip link set %s vf 3 mac %s" % (self.pf_interface, self.vf3_mac),
+                "# ",
+            )
 
             try:
                 for port in self.sriov_vfs_port:
@@ -502,16 +497,15 @@ class TestICEQinq(TestCase):
                 self.dut.send_expect(
                     "ip link set dev %s vf 0 spoofchk off" % self.pf_interface, "# "
                 )
-                if vfs_num == 4:
-                    self.dut.send_expect(
-                        "ip link set dev %s vf 1 spoofchk off" % self.pf_interface, "# "
-                    )
-                    self.dut.send_expect(
-                        "ip link set dev %s vf 2 spoofchk off" % self.pf_interface, "# "
-                    )
-                    self.dut.send_expect(
-                        "ip link set dev %s vf 3 spoofchk off" % self.pf_interface, "# "
-                    )
+                self.dut.send_expect(
+                    "ip link set dev %s vf 1 spoofchk off" % self.pf_interface, "# "
+                )
+                self.dut.send_expect(
+                    "ip link set dev %s vf 2 spoofchk off" % self.pf_interface, "# "
+                )
+                self.dut.send_expect(
+                    "ip link set dev %s vf 3 spoofchk off" % self.pf_interface, "# "
+                )
             except Exception as e:
                 self.destroy_iavf()
                 raise Exception(e)
@@ -521,141 +515,61 @@ class TestICEQinq(TestCase):
             self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
             self.vf_flag = False
 
-    def launch_testpmd(self, vfs_num=4, dcf_param=False):
-        if dcf_param:
-            port_options = {self.pci_list[0]: "cap=dcf,representor=[1]"}
+    def launch_testpmd(self, pipline_mode=False):
+        if pipline_mode:
+            port_options = {
+                self.pci_list[0]: "cap=dcf,representor=[1],pipeline-mode-support=1"
+            }
         else:
-            port_options = {self.pci_list[0]: "cap=dcf"}
-        if vfs_num > 1:
-            param = " "
-            self.pmd_output.start_testpmd(
-                cores="1S/4C/1T",
-                param=param,
-                ports=self.pci_list,
-                socket=self.ports_socket,
-                port_options=port_options,
-            )
-        else:
-            param = "--rxq=16 --txq=16"
-            self.pmd_output.start_testpmd(
-                cores="1S/4C/1T",
-                param=param,
-                ports=self.pci_list,
-                socket=self.ports_socket,
-            )
-        self.confing_testpmd(vfs_num, dcf_param)
+            port_options = {self.pci_list[0]: "cap=dcf,representor=[1]"}
+        param = " "
+        self.pmd_output.start_testpmd(
+            cores="1S/4C/1T",
+            param=param,
+            ports=self.pci_list,
+            socket=self.ports_socket,
+            port_options=port_options,
+        )
+        self.confing_testpmd()
 
-    def confing_testpmd(self, vfs_num, dcf_param):
+    def confing_testpmd(self):
         driver_type = "Device name.*?%s.*?\n(.*)" % self.sriov_vfs_port[0].pci
-        if dcf_param or vfs_num == 1:
-            flow_type = "mac"
-            if vfs_num > 1:
-                output = self.pmd_output.execute_cmd("show port info all")
-                out = re.findall(driver_type, output)
-                self.verify(len(out) == 2, "port0 and port1 driver not is net_ice_dcf")
-        else:
-            flow_type = "rxonly"
-            output = self.pmd_output.execute_cmd("show port info 0")
-            out = re.findall(driver_type, output)
-            self.verify(len(out) == 1, "vf0 driver not is net_ice_dcf")
-        self.pmd_output.execute_cmd("set fwd %s" % flow_type)
+        output = self.pmd_output.execute_cmd("show port info all")
+        out = re.findall(driver_type, output)
+        self.verify(len(out) == 2, "port0 and port1 driver not is net_ice_dcf")
+        self.pmd_output.execute_cmd("set fwd mac")
         self.pmd_output.execute_cmd("set verbose 1")
         self.pmd_output.execute_cmd("start")
 
-    def create_switch_rule(self, rule, session_name="", check_stats=True):
-        if session_name == "":
-            session_name = self.pmd_output
-        p = re.compile(r"Flow rule #(\d+) created")
-        rule_list = []
-        if isinstance(rule, list):
-            for rule in rule:
-                out = session_name.execute_cmd(rule)  # create a rule
-                m = p.search(out)
-                if m:
-                    rule_list.append(m.group(1))
-                else:
-                    rule_list.append(False)
-        else:
-            out = session_name.execute_cmd(rule)  # create a rule
-            m = p.search(out)
-            if m:
-                rule_list.append(m.group(1))
-            else:
-                rule_list.append(False)
-        if check_stats:
-            self.verify(
-                all(rule_list),
-                "some rules not created successfully, result %s, rule %s"
-                % (rule_list, rule),
-            )
-        else:
-            self.verify(
-                not any(rule_list),
-                "all rules should create failed, result %s" % rule_list,
-            )
-        return rule_list
-
-    def check_switch_rule(self, port_id=0, stats=True, rule_list=None):
-        out = self.pmd_output.execute_cmd("flow list %s" % port_id)
-        p = re.compile(r"ID\s+Group\s+Prio\s+Attr\s+Rule")
-        matched = p.search(out)
-        if stats:
-            self.verify(matched, "flow rule on port %s is not existed" % port_id)
-            if rule_list:
-                p = re.compile("^(\d+)\s")
-                li = out.splitlines()
-                res = list(filter(bool, list(map(p.match, li))))
-                result = [i.group(1) for i in res]
-                self.verify(
-                    sorted(result) == sorted(rule_list),
-                    "check rule list failed. expect %s, result %s"
-                    % (rule_list, result),
-                )
-        else:
-            self.verify(not matched, "flow rule on port %s is existed" % port_id)
-
-    def destroy_switch_rule(self, port_id=0, rule_id=None):
-        if rule_id is None:
-            rule_id = 0
-        if isinstance(rule_id, list):
-            for i in rule_id:
-                out = self.dut.send_command(
-                    "flow destroy %s rule %s" % (port_id, i), timeout=1
-                )
-                p = re.compile(r"Flow rule #(\d+) destroyed")
-                m = p.search(out)
-                self.verify(m, "flow rule %s delete failed" % rule_id)
-        else:
-            out = self.dut.send_command(
-                "flow destroy %s rule %s" % (port_id, rule_id), timeout=1
-            )
-            p = re.compile(r"Flow rule #(\d+) destroyed")
-            m = p.search(out)
-            self.verify(m, "flow rule %s delete failed" % rule_id)
-        self.check_switch_rule(stats=False)
+    def reset_vf(self):
+        self.pmd_output.execute_cmd("port stop 2")
+        self.pmd_output.execute_cmd("port reset 2")
+        self.pmd_output.execute_cmd("port start 2")
+        self.pmd_output.execute_cmd("start")
 
-    def send_packets(self, pkts, tx_port=None, count=1):
-        self.pkt.update_pkt(pkts)
-        tx_port = self.tester_iface0 if not tx_port else tx_port
-        self.pkt.send_pkt(crb=self.tester, tx_port=tx_port, count=count)
+    def tcpdump_send_packet_get_output(self, pkt):
+        self.tester.send_expect("rm -rf getPackageByTcpdump.pcap", "# ")
+        self.tester.send_expect(
+            "tcpdump -A -nn -e -vv -w getPackageByTcpdump.pcap -i %s 2> /dev/null& "
+            % (self.tester_iface0),
+            "#",
+        )
+        time.sleep(2)
+        out1 = self.fdirprocess.send_pkt_get_out(pkt)
+        out2 = self.pmd_output.execute_cmd("show port stats 0")
+        out = out1 + out2
+        self.tester.send_expect("killall tcpdump", "# ")
+        tcpdump_out = self.tester.send_expect(
+            "tcpdump -A -nn -vv -er getPackageByTcpdump.pcap", "# "
+        )
 
-    def send_pkts_getouput(self, pkts, port_id=0, count=1):
-        tx_port = self.tester_iface0 if port_id == 0 else self.tester_iface1
-        self.send_packets(pkts, tx_port=tx_port, count=count)
-        time.sleep(0.5)
-        out = self.pmd_output.get_output()
-        port_stats = self.pmd_output.execute_cmd("show port stats all")
-        self.pmd_output.execute_cmd("clear port stats all")
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("start")
-        return out + port_stats
+        return (out, tcpdump_out)
 
     def check_packets(self, out, port_id, pkt_num=1, check_stats=True):
         p = "port (\d+)/queue.*"
         result_list = re.findall(p, out)
         self.verify(
-            len(result_list) == pkt_num,
-            "received %s packets, expected to %s packets" % (result_list, pkt_num),
+            len(result_list) == pkt_num, "received packets mismatch".format(port_id)
         )
         for res in result_list:
             if check_stats:
@@ -675,20 +589,22 @@ class TestICEQinq(TestCase):
             self.logger.info((GREEN("========test subcase: %s========" % test["name"])))
             try:
                 port_id = test["check_param"]["port_id"]
-                rule_list = self.create_switch_rule(test["rule"])
-                self.check_switch_rule()
+                self.fdirprocess.validate_rule(test["rule"], check_stats=True)
+                rule_list = self.fdirprocess.create_rule(test["rule"], check_stats=True)
+                self.fdirprocess.check_rule(0, stats=True, rule_list=rule_list)
                 # send matched packets and check
                 matched_packets = test["scapy_str"]["matched"]
-                out = self.send_pkts_getouput(matched_packets)
+                out = self.fdirprocess.send_pkt_get_out(matched_packets)
                 self.check_packets(out, port_id, len(matched_packets))
                 # send mismatched packets and check
                 mismatched_packets = test["scapy_str"]["mismatched"]
-                out = self.send_pkts_getouput(mismatched_packets)
+                out = self.fdirprocess.send_pkt_get_out(mismatched_packets)
                 self.check_packets(
                     out, port_id, len(mismatched_packets), check_stats=False
                 )
-                self.destroy_switch_rule()
-                out = self.send_pkts_getouput(matched_packets)
+                self.fdirprocess.destroy_rule(0, rule_list)
+                self.fdirprocess.check_rule(0, stats=False, rule_list=rule_list)
+                out = self.fdirprocess.send_pkt_get_out(matched_packets)
                 self.check_packets(
                     out, port_id, len(matched_packets), check_stats=False
                 )
@@ -696,8 +612,8 @@ class TestICEQinq(TestCase):
                 self.logger.info((GREEN("subcase passed: %s" % test["name"])))
             except Exception as e:
                 self.logger.warning((RED(e)))
-                self.dut.send_command("flow flush 0", timeout=1)
-                self.dut.send_command("flow flush 1", timeout=1)
+                self.dut.send_command("flow flush 0")
+                self.dut.send_command("flow flush 1")
                 test_results[test["name"]] = False
                 self.logger.info((RED("subcase failed: %s" % test["name"])))
                 continue
@@ -707,104 +623,80 @@ class TestICEQinq(TestCase):
                 failed_cases.append(k)
         self.verify(all(test_results.values()), "{} failed.".format(failed_cases))
 
-    def start_tcpdump(self, rxItf):
-        self.tester.send_expect("rm -rf getPackageByTcpdump.pcap", "#")
-        self.tester.send_expect(
-            "tcpdump -A -nn -e -vv -w getPackageByTcpdump.pcap -i %s 2> /dev/null& "
-            % rxItf,
-            "#",
-        )
-        time.sleep(2)
-
-    def get_tcpdump_package(self):
-        time.sleep(1)
-        self.tester.send_expect("killall tcpdump", "#")
-        return self.tester.send_expect(
-            "tcpdump -A -nn -e -vv -r getPackageByTcpdump.pcap", "#"
-        )
-
-    def test_mac_qinq_ipv4_pay(self):
+    def test_dcf_mac_qinq_ipv4_pay(self):
         """
-        DCF switch for MAC_QINQ_IPV4_PAY
+        Test case 01: DCF switch for MAC_QINQ_IPV4_PAY
         """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_1pf_4vfs_env()
+        self.launch_testpmd()
         self._rte_flow_validate_pattern(mac_qinq_ipv4_pay)
 
-    def test_mac_qinq_ipv6_pay(self):
+    def test_dcf_mac_qinq_ipv6_pay(self):
         """
-        DCF switch for MAC_QINQ_IPV6_PAY
+        Test case 02: DCF switch for MAC_QINQ_IPV6_PAY
         """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_1pf_4vfs_env()
+        self.launch_testpmd()
         self._rte_flow_validate_pattern(mac_qinq_ipv6_pay)
 
     @skip_unsupported_pkg("os default")
-    def test_mac_qinq_pppoe_pay(self):
+    def test_dcf_mac_qinq_pppoe_pay(self):
         """
-        DCF switch for MAC_QINQ_PPPOE_PAY
+        Test case 03: DCF switch for MAC_QINQ_PPPOE_PAY
         """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_1pf_4vfs_env()
+        self.launch_testpmd()
         self._rte_flow_validate_pattern(mac_qinq_pppoe_pay)
 
     @skip_unsupported_pkg("os default")
-    def test_mac_qinq_pppoe_pay_proto(self):
+    def test_dcf_mac_qinq_pppoe_pay_proto(self):
         """
-        DCF switch for MAC_QINQ_PPPOE_PAY_Proto
+        Test case 04: DCF switch for MAC_QINQ_PPPOE_PAY_Proto
         """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_1pf_4vfs_env()
+        self.launch_testpmd()
         self._rte_flow_validate_pattern(mac_qinq_pppoe_proto)
 
     @skip_unsupported_pkg("os default")
-    def test_mac_qinq_pppoe_ipv4(self):
+    def test_dcf_mac_qinq_pppoe_ipv4(self):
         """
-        DCF switch for MAC_QINQ_PPPOE_IPV4
+        Test case 05: DCF switch for MAC_QINQ_PPPOE_IPV4
         """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_1pf_4vfs_env()
+        self.launch_testpmd()
         self._rte_flow_validate_pattern(mac_qinq_pppoe_ipv4)
 
     @skip_unsupported_pkg("os default")
-    def test_mac_qinq_pppoe_ipv6(self):
+    def test_dcf_mac_qinq_pppoe_ipv6(self):
         """
-        DCF switch for MAC_QINQ_PPPOE_IPV6
+        Test case 06: DCF switch for MAC_QINQ_PPPOE_IPV6
         """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_1pf_4vfs_env()
+        self.launch_testpmd()
         self._rte_flow_validate_pattern(mac_qinq_pppoe_ipv6)
 
-    def test_mac_l4_qinq_dcf_non_pipeline_mode(self):
+    def test_dcf_mac_l4_qinq_non_pipeline_mode(self):
         """
-        DCF switch for MAC_L4_QINQ
+        Test case 07: DCF switch for MAC_L4_QINQ
         """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_1pf_4vfs_env()
+        self.launch_testpmd()
         self._rte_flow_validate_pattern(tvs_mac_l4_qinq_dcf_non_pipeline_mode)
 
-    def test_mac_l4_qinq_dcf_pipeline_mode(self):
+    def test_dcf_mac_l4_qinq_pipeline_mode(self):
         """
-        DCF switch for MAC_L4_QINQ_IPV6
+        Test case 08: DCF switch for MAC_L4_QINQ_IPV6
         """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_1pf_4vfs_env()
+        self.launch_testpmd(pipline_mode=True)
         self._rte_flow_validate_pattern(tvs_mac_l4_qinq_dcf_pipeline_mode)
 
-    def reset_vf(self):
-        self.pmd_output.execute_cmd("port stop 2")
-        self.pmd_output.execute_cmd("port reset 2")
-        self.pmd_output.execute_cmd("port start 2")
-        self.pmd_output.execute_cmd("start")
-
     def send_packet_check_vlan_strip(self, pkts, outer=False, inner=False):
         for pkt in pkts:
             pkt_index = pkts.index(pkt)
-            self.start_tcpdump(self.tester_iface0)
-            out = self.send_pkts_getouput(pkt)
-            self.check_packets(out, 2, pkt_num=1)
-            tcpdump_out = self.get_tcpdump_package()
-            vlan_list = re.findall("vlan \d+", tcpdump_out)
+            out, tcpdump_out = self.tcpdump_send_packet_get_output(pkt)
+            self.check_packets(out, port_id=2, pkt_num=1)
+            vlan_list = re.findall("vlan\s+\d+", tcpdump_out)
             if pkt_index == 1:
                 vlan_num = 2
                 if outer or inner:
@@ -820,9 +712,9 @@ class TestICEQinq(TestCase):
                     len(vlan_list) == vlan_num, "received outer vlan packet error!!!"
                 )
 
-    def test_vlan_strip_in_pvid_enable(self):
+    def test_dcf_vlan_strip_in_pvid_enable(self):
         """
-        vlan strip when pvid enable
+        Test case 09: DCF vlan strip when pvid enable
         """
         pkts = [
             'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
@@ -830,8 +722,8 @@ class TestICEQinq(TestCase):
             'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=21,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
             % self.vf1_mac,
         ]
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_1pf_4vfs_env()
+        self.launch_testpmd()
         self.pmd_output.execute_cmd("stop")
         self.pmd_output.execute_cmd("vlan set strip on 1")
         self.reset_vf()
@@ -846,23 +738,21 @@ class TestICEQinq(TestCase):
         self.pmd_output.execute_cmd("vlan set strip on 2")
         self.send_packet_check_vlan_strip(pkts, outer=True, inner=True)
         self.pmd_output.execute_cmd("quit", "#")
-        self.launch_testpmd(dcf_param=True)
+        self.launch_testpmd()
         self.pmd_output.execute_cmd("stop")
         self.pmd_output.execute_cmd("vlan set strip on 2")
         self.pmd_output.execute_cmd("vlan set strip on 1")
         self.reset_vf()
         self.send_packet_check_vlan_strip(pkts, outer=True, inner=True)
 
-    def _send_packet_check_vlan_inter(
+    def send_packet_check_vlan_inter(
         self, pkts, out_vlan, port_id=3, vlan_header=None, iner_vlan=None
     ):
         for pkt in pkts:
             pkt_index = pkts.index(pkt)
-            self.start_tcpdump(self.tester_iface0)
-            out = self.send_pkts_getouput(pkt)
+            out, tcpdump_out = self.tcpdump_send_packet_get_output(pkt)
             self.check_packets(out, port_id)
-            p = "vlan (\d+)"
-            tcpdump_out = self.get_tcpdump_package()
+            p = "vlan\s+(\d+)"
             vlan_list = re.findall(p, tcpdump_out)
             if vlan_header:
                 header = re.findall(vlan_header, tcpdump_out)
@@ -921,9 +811,9 @@ class TestICEQinq(TestCase):
                     "vlan header not matched, expect: %s." % vlan_header,
                 )
 
-    def test_vlan_insert_in_pvid_enable(self):
+    def test_dcf_vlan_insert_in_pvid_enable(self):
         """
-        vlan insertion when pvid enable
+        Test case 10: DCF vlan insertion when pvid enable
         """
         out_vlan = 24
         iner_vlan = 11
@@ -934,45 +824,45 @@ class TestICEQinq(TestCase):
             'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
             % self.vf2_mac,
         ]
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_1pf_4vfs_env()
+        self.launch_testpmd()
         self.pmd_output.execute_cmd("stop")
         self.pmd_output.execute_cmd("tx_vlan set pvid 1 %d on" % out_vlan)
         self.reset_vf()
-        self._send_packet_check_vlan_inter(pkt_list, out_vlan, vlan_header=header)
+        self.send_packet_check_vlan_inter(pkt_list, out_vlan, vlan_header=header)
         header = "0x88a8"
         self.pmd_output.execute_cmd("stop")
         self.pmd_output.execute_cmd("vlan set outer tpid %s 1" % header)
         self.reset_vf()
-        self._send_packet_check_vlan_inter(pkt_list, out_vlan, vlan_header=header)
+        self.send_packet_check_vlan_inter(pkt_list, out_vlan, vlan_header=header)
         header = "0x9100"
         self.pmd_output.execute_cmd("stop")
         self.pmd_output.execute_cmd("vlan set outer tpid %s 1" % header)
         self.reset_vf()
-        self._send_packet_check_vlan_inter(pkt_list, out_vlan, vlan_header=header)
+        self.send_packet_check_vlan_inter(pkt_list, out_vlan, vlan_header=header)
         self.pmd_output.execute_cmd("stop")
         self.pmd_output.execute_cmd("port stop 2")
         self.pmd_output.execute_cmd("tx_vlan set 2 %d" % iner_vlan)
         self.pmd_output.execute_cmd("port start 2")
         self.pmd_output.execute_cmd("start")
-        self._send_packet_check_vlan_inter(
+        self.send_packet_check_vlan_inter(
             pkt_list, out_vlan, vlan_header=header, iner_vlan=iner_vlan
         )
         self.pmd_output.execute_cmd("quit", "# ")
-        self.launch_testpmd(dcf_param=True)
+        self.launch_testpmd()
         self.pmd_output.execute_cmd("stop")
         self.pmd_output.execute_cmd("port stop 2")
         self.pmd_output.execute_cmd("tx_vlan set 2 %d" % iner_vlan)
         self.pmd_output.execute_cmd("port start 2")
         self.pmd_output.execute_cmd("tx_vlan set pvid 1 %d on" % out_vlan)
         self.reset_vf()
-        self._send_packet_check_vlan_inter(
+        self.send_packet_check_vlan_inter(
             pkt_list, out_vlan, port_id=3, vlan_header=header, iner_vlan=iner_vlan
         )
 
-    def test_vlan_filter_in_pvid_enable(self):
+    def test_dcf_vlan_filter_in_pvid_enable(self):
         """
-        vlan filter when pvid enable
+        Test case 11: DCF vlan filter when pvid enable
         """
         pkt_list1 = [
             'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=11,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
@@ -991,281 +881,26 @@ class TestICEQinq(TestCase):
                 "ethtool --set-priv-flags %s %s on" % (self.pf_interface, self.flag),
                 "# ",
             )
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_1pf_4vfs_env()
+        self.launch_testpmd()
         self.pmd_output.execute_cmd("vlan set filter on 1")
         out = self.pmd_output.execute_cmd("rx_vlan add 11 1")
         self.verify("failed" in out, "add rx_vlan successfully for VF1 by representor")
         self.pmd_output.execute_cmd("vlan set filter on 2")
         self.pmd_output.execute_cmd("rx_vlan add 11 2")
         for pkt in pkt_list1:
-            out = self.send_pkts_getouput(pkt)
+            out = self.fdirprocess.send_pkt_get_out(pkt)
             self.check_packets(out, 2)
         for pkt in pkt_list2:
-            out = self.send_pkts_getouput(pkt)
+            out = self.fdirprocess.send_pkt_get_out(pkt)
             self.check_packets(out, 2, pkt_num=0, check_stats=False)
         self.pmd_output.execute_cmd("rx_vlan rm 11 2")
         for pkt in pkt_list1:
-            out = self.send_pkts_getouput(pkt)
+            out = self.fdirprocess.send_pkt_get_out(pkt)
             self.check_packets(out, 2, pkt_num=0, check_stats=False)
 
-    def check_vlan_offload(self, vlan_type, stats):
-        p = "VLAN offload.*\n.*?%s (\w+)" % vlan_type
-        out = self.pmd_output.execute_cmd("show port info 0")
-        vlan_stats = re.search(p, out).group(1)
-        self.verify(vlan_stats == stats, "VLAN stats mismatch")
-
-    def test_enable_disable_iavf_vlan_filter(self):
-        """
-        Enable/Disable IAVF VLAN filtering
-        """
-        pkt_list1 = [
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-        ]
-        pkt_list2 = [
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=11,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=11,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-        ]
-        if self.default_stats:
-            self.dut.send_expect(
-                "ethtool --set-priv-flags %s %s on" % (self.pf_interface, self.flag),
-                "# ",
-            )
-        self.setup_pf_vfs_env(vfs_num=1)
-        self.launch_testpmd(vfs_num=1)
-        self.pmd_output.execute_cmd("vlan set filter on 0")
-        self.check_vlan_offload(vlan_type="filter", stats="on")
-        out = self.send_pkts_getouput(pkt_list1)
-        receive_pkt = re.findall("dst=%s" % self.vf1_mac, out)
-        self.verify(len(receive_pkt) == 0, "Failed error received vlan packet!")
-
-        self.pmd_output.execute_cmd("rx_vlan add 1 0")
-        self.start_tcpdump(self.tester_iface0)
-        out = self.send_pkts_getouput(pkt_list1)
-        tcpdump_out = self.get_tcpdump_package()
-        receive_pkt = re.findall("dst=%s" % self.vf1_mac, out)
-        self.verify(len(receive_pkt) == 2, "Failed error received vlan packet!")
-        tester_pkt = re.findall("vlan \d+", tcpdump_out)
-        self.verify(len(tester_pkt) == 6, "Failed pass received vlan packet!")
-
-        out = self.send_pkts_getouput(pkt_list2)
-        receive_pkt = re.findall("dst=%s" % self.vf1_mac, out)
-        self.verify(len(receive_pkt) == 0, "Failed error received vlan packet!")
-
-        self.pmd_output.execute_cmd("rx_vlan rm 1 0")
-        out = self.send_pkts_getouput(pkt_list1)
-        receive_pkt = re.findall("dst=%s" % self.vf1_mac, out)
-        self.verify(len(receive_pkt) == 0, "Failed error received vlan packet!")
-
-    def test_enable_disable_iavf_vlan_strip(self):
-        """
-        Enable/Disable IAVF VLAN header stripping
-        """
-        pkt_list = [
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-        ]
-        if self.default_stats:
-            self.dut.send_expect(
-                "ethtool --set-priv-flags %s %s on" % (self.pf_interface, self.flag),
-                "# ",
-            )
-        self.setup_pf_vfs_env(vfs_num=1)
-        self.launch_testpmd(vfs_num=1)
-        self.pmd_output.execute_cmd("vlan set filter on 0")
-        self.pmd_output.execute_cmd("rx_vlan add 1 0")
-        self.check_vlan_offload(vlan_type="filter", stats="on")
-        self.pmd_output.execute_cmd("vlan set strip on 0")
-        self.check_vlan_offload(vlan_type="strip", stats="on")
-
-        self.start_tcpdump(self.tester_iface0)
-        out = self.send_pkts_getouput(pkt_list)
-        tcpdump_out = self.get_tcpdump_package()
-        receive_pkt = re.findall("dst=%s" % self.vf1_mac, out)
-        self.verify(len(receive_pkt) == 2, "Failed error received vlan packet!")
-        tester_pkt = re.findall("vlan \d+", tcpdump_out)
-        self.verify(len(tester_pkt) == 4, "Failed pass received vlan packet!")
-
-        self.pmd_output.execute_cmd("vlan set strip off 0")
-        self.check_vlan_offload(vlan_type="strip", stats="off")
-        self.start_tcpdump(self.tester_iface0)
-        out = self.send_pkts_getouput(pkt_list)
-        tcpdump_out = self.get_tcpdump_package()
-        receive_pkt = re.findall("dst=%s" % self.vf1_mac, out)
-        self.verify(len(receive_pkt) == 2, "Failed error received vlan packet!")
-        tester_pkt = re.findall("vlan \d+", tcpdump_out)
-        self.verify(len(tester_pkt) == 6, "Failed pass received vlan packet!")
-
-    def test_enable_disable_iavf_vlan_insert(self):
-        """
-        Enable/Disable IAVF VLAN header insertion
-        """
-        out_vlan = 1
-        pkt_list = [
-            'Ether(dst="%s",type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=11,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-        ]
-        if self.default_stats:
-            self.dut.send_expect(
-                "ethtool --set-priv-flags %s %s off" % (self.pf_interface, self.flag),
-                "# ",
-            )
-        self.setup_pf_vfs_env(vfs_num=1)
-        self.launch_testpmd(vfs_num=1)
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("port stop 0")
-        self.pmd_output.execute_cmd("tx_vlan set 0 1")
-        self.pmd_output.execute_cmd("port start 0")
-        self.pmd_output.execute_cmd("start")
-        self._send_packet_check_vlan_inter(pkt_list, out_vlan, port_id=0)
-
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("port stop 0")
-        self.pmd_output.execute_cmd("tx_vlan reset 0")
-        self.pmd_output.execute_cmd("port start 0")
-        self.pmd_output.execute_cmd("start")
-        self._send_packet_check_vlan_inter(pkt_list, out_vlan=0, port_id=0)
-
-    def _send_pkt_check_vlan_and_crc(
-        self, pkt, pkt_len=None, vlan_strip=False, crc_strip=False
-    ):
-        if pkt_len:
-            self.start_tcpdump(self.tester_iface0)
-        out = self.send_pkts_getouput(pkt)
-        pkt_length = re.search("length=(\d+)", out).group(1)
-        rx_bytes = re.search("RX-bytes:\s+(\d+)", out).group(1)
-        if crc_strip:
-            self.verify(rx_bytes == pkt_length, "CRC strip on failed")
-        else:
-            self.verify(int(rx_bytes) == int(pkt_length) + 4, "CRC strip off failed")
-        if pkt_len:
-            tcpdump_out = self.get_tcpdump_package()
-            vlan_list = re.findall("vlan\s+\d+", tcpdump_out)
-            if not vlan_strip:
-                self.verify(pkt_length == pkt_len, "vlan strip off failed")
-                self.verify(len(vlan_list) == 4, "Failed pass received vlan packet")
-            elif vlan_strip:
-                self.verify(
-                    int(pkt_length) + 4 == int(pkt_len), "vlan strip off failed"
-                )
-                self.verify(
-                    len(vlan_list) == 3 and vlan_list[0] != vlan_list[-1],
-                    "Failed error received vlan packet",
-                )
-
-    def test_enable_disable_iavf_CRC_strip(self):
-        """
-        Enable/disable AVF CRC stripping
-        """
-        param = "--rxq=16 --txq=16 --disable-crc-strip"
-        pkt = (
-            'Ether(dst="%s",type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac
-        )
-        if self.default_stats:
-            self.dut.send_expect(
-                "ethtool --set-priv-flags %s %s on" % (self.pf_interface, self.flag),
-                "# ",
-            )
-        self.setup_pf_vfs_env(vfs_num=1)
-        self.pmd_output.start_testpmd(
-            cores="1S/4C/1T", param=param, ports=self.pci_list, socket=self.ports_socket
-        )
-        self.pmd_output.execute_cmd("set fwd mac")
-        self.pmd_output.execute_cmd("set verbose 1")
-        self.pmd_output.execute_cmd("start")
-        self._send_pkt_check_vlan_and_crc(pkt)
-
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("port stop 0")
-        self.pmd_output.execute_cmd("port config 0 rx_offload keep_crc off")
-        self.pmd_output.execute_cmd("port start 0")
-        self.pmd_output.execute_cmd("start")
-        self._send_pkt_check_vlan_and_crc(pkt, crc_strip=True)
-
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("port stop 0")
-        self.pmd_output.execute_cmd("port config 0 rx_offload keep_crc on")
-        self.pmd_output.execute_cmd("port start 0")
-        self.pmd_output.execute_cmd("start")
-        self._send_pkt_check_vlan_and_crc(pkt)
-
-        self.pmd_output.execute_cmd("quit", "#")
-        self.launch_testpmd(vfs_num=1)
-        self.start_tcpdump(self.tester_iface0)
-        self._send_pkt_check_vlan_and_crc(pkt, crc_strip=True)
-
-    def test_CRC_strip_iavf_vlan_strip_coexists(self):
-        """
-        AVF CRC strip and Vlan strip co-exists
-        """
-        pkt = (
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac
-        )
-        if self.default_stats:
-            self.dut.send_expect(
-                "ethtool --set-priv-flags %s %s on" % (self.pf_interface, self.flag),
-                "# ",
-            )
-        self.setup_pf_vfs_env(vfs_num=1)
-        self.launch_testpmd(vfs_num=1)
-        self.check_vlan_offload(vlan_type="strip", stats="off")
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("vlan set strip off 0")
-        self.check_vlan_offload(vlan_type="strip", stats="off")
-        self.pmd_output.execute_cmd("vlan set filter on 0")
-        self.pmd_output.execute_cmd("rx_vlan add 1 0")
-        self.pmd_output.execute_cmd("start")
-
-        self.start_tcpdump(self.tester_iface0)
-        out = self.send_pkts_getouput(pkt)
-        tcpdump_out = self.get_tcpdump_package()
-        pkt_len = re.search("length=(\d+)", out).group(1)
-        vlan_list = re.findall("vlan\s+\d+", tcpdump_out)
-        self.verify(len(vlan_list) == 4, "vlan strip off failed")
-        rx_bytes = re.search("RX-bytes:\s+(\d+)", out).group(1)
-        tx_bytes = re.search("TX-bytes:\s+(\d+)", out).group(1)
-        self.verify(rx_bytes == tx_bytes == pkt_len, "CRC strip on failed")
-
-        self.pmd_output.execute_cmd("vlan set strip on 0")
-        self.check_vlan_offload(vlan_type="strip", stats="on")
-        self._send_pkt_check_vlan_and_crc(pkt=pkt, pkt_len=pkt_len, vlan_strip=True)
-
-        self.pmd_output.execute_cmd("vlan set strip off 0")
-        self.check_vlan_offload(vlan_type="strip", stats="off")
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("port stop 0")
-        self.pmd_output.execute_cmd("port config 0 rx_offload keep_crc on")
-        self.pmd_output.execute_cmd("port start 0")
-        self.pmd_output.execute_cmd("start")
-        self._send_pkt_check_vlan_and_crc(pkt=pkt, pkt_len=pkt_len)
-
-        out = self.pmd_output.execute_cmd("vlan set strip on 0")
-        p = "iavf_config_vlan_strip_v2(): fail to execute command VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2"
-        self.verify(p in out, "set vlan strip on successfully")
-        self._send_pkt_check_vlan_and_crc(pkt=pkt, pkt_len=pkt_len)
-
-        self.pmd_output.execute_cmd("vlan set strip off 0")
-        self.check_vlan_offload(vlan_type="strip", stats="off")
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("port stop 0")
-        self.pmd_output.execute_cmd("port config 0 rx_offload keep_crc off")
-        self.pmd_output.execute_cmd("port start 0")
-        self.pmd_output.execute_cmd("start")
-        self._send_pkt_check_vlan_and_crc(pkt=pkt, pkt_len=pkt_len, crc_strip=True)
-
     def tear_down(self):
-        self.pmd_output.execute_cmd("quit", "#")
+        self.pmd_output.quit()
         self.dut.kill_all()
         self.destroy_iavf()
 
-- 
2.25.1


  reply	other threads:[~2023-01-11  2:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11 10:38 [dts] [PATCH V2 0/5] " Song Jiale
2023-01-11 10:38 ` Song Jiale [this message]
2023-01-11 10:38 ` [dts] [PATCH V2 2/5] tests/kernelpf_iavf: split the test suite of ice_qinq Song Jiale
2023-01-11 10:38 ` [dts] [PATCH V2 3/5] test_plans/ice_dcf_dual_vlan: split ice_qinq suite Song Jiale
2023-01-11 10:38 ` [dts] [PATCH V2 4/5] test_plans/kernelpf_iavf: split the test suite of ice_qinq Song Jiale
2023-01-11 10:38 ` [dts] [PATCH V2 5/5] test_plans/index: " Song Jiale
2023-01-11  5:45   ` lijuan.tu

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=20230111103858.970228-2-songx.jiale@intel.com \
    --to=songx.jiale@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).