test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1] tests/iavf_fdir: Adaptation regression modification
@ 2020-07-03  5:53 ChenBo
  2020-07-03  7:22 ` [dts] [WARNING: UNSCANNABLE EXTRACTION FAILED][WARNING: UNSCANNABLE EXTRACTION FAILED]RE: " Chen, BoX C
  2020-07-20  6:55 ` [dts] " Tu, Lijuan
  0 siblings, 2 replies; 3+ messages in thread
From: ChenBo @ 2020-07-03  5:53 UTC (permalink / raw)
  To: dts; +Cc: ChenBo

1.Use global variables instead of devil numbers.
2.Support for DUT and Tester is not the same ENV.
3.Fixed an issue with group packet exceptions.
4.Modify the environment cleanup process to increase code robustness.

Signed-off-by: ChenBo <box.c.chen@intel.com>
---
 tests/TestSuite_iavf_fdir.py | 58 +++++++++++++++++++-----------------
 tests/rte_flow_common.py     | 24 ++++++++-------
 2 files changed, 44 insertions(+), 38 deletions(-)

diff --git a/tests/TestSuite_iavf_fdir.py b/tests/TestSuite_iavf_fdir.py
index f1adc0f..f2004c6 100644
--- a/tests/TestSuite_iavf_fdir.py
+++ b/tests/TestSuite_iavf_fdir.py
@@ -37,6 +37,7 @@ from packet import Packet
 from pmd_output import PmdOutput
 from test_case import TestCase
 import rte_flow_common as rfc
+from rte_flow_common import CVL_TXQ_RXQ_NUMBER
 from multiprocessing import Process
 from multiprocessing import Manager
 
@@ -126,9 +127,9 @@ MAC_IPV6_PAY = {
 MAC_IPV6_PAY_protocol = {
     "match": [
         'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", src="2001::2", nh=44, tc=1, hlim=2)/("X"*480)',
-        'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/IPv6ExtHdrFragment(100)/("X"*480)',
+        'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/IPv6ExtHdrFragment()/("X"*480)',
         'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", nh=44)/TCP(sport=22,dport=23)/("X"*480)',
-        'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/IPv6ExtHdrFragment(100)/TCP(sport=22,dport=23)/("X"*480)',
+        'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/IPv6ExtHdrFragment()/TCP(sport=22,dport=23)/("X"*480)',
         'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020", nh=6)/("X"*480)',
         'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3900:2020")/TCP(sport=22,dport=23)/("X"*480)'],
     "mismatch": [
@@ -1302,11 +1303,16 @@ class TestIAVFFdir(TestCase):
 
         self.src_file_dir = 'dep/'
         self.dut_file_dir = '/tmp/'
+        self.cvlq_num = CVL_TXQ_RXQ_NUMBER
 
     def set_up(self):
         """
         Run before each test case.
         """
+        self.re_load_ice_driver()
+        time.sleep(1)
+        self.setup_2pf_4vf_env()
+        time.sleep(1)
         self.launch_testpmd()
 
     def setup_2pf_4vf_env(self, driver='default'):
@@ -1384,8 +1390,8 @@ class TestIAVFFdir(TestCase):
         self.dut.send_expect("rmmod ice", "# ", 40)
         ice_driver_file_location = self.suite_config["ice_driver_file_location"]
         self.dut.send_expect("insmod %s" % ice_driver_file_location, "# ")
-        self.dut.send_expect("ifconfig %s up" % self.tester_iface0, "# ", 15)
-        self.dut.send_expect("ifconfig %s up" % self.tester_iface1, "# ", 15)
+        self.dut.send_expect("ifconfig %s up" % self.dut_ports[0], "# ", 15)
+        self.dut.send_expect("ifconfig %s up" % self.dut_ports[1], "# ", 15)
 
     def config_testpmd(self):
         self.pmd_output.execute_cmd("set fwd rxonly")
@@ -1401,7 +1407,7 @@ class TestIAVFFdir(TestCase):
 
     def launch_testpmd(self):
         self.pmd_output.start_testpmd(cores="1S/4C/1T",
-                                      param="--rxq=16 --txq=16",
+                                      param="--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num),
                                       eal_param="-w %s -w %s" % (
                                            self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci),
                                       socket=self.ports_socket)
@@ -1508,7 +1514,7 @@ class TestIAVFFdir(TestCase):
             self.verify(not p.search(out), "flow rule on port %s is existed" % port_id)
 
     def check_rule_number(self, port_id=0, num=0):
-        out = self.pmd_output.execute_cmd("flow list %s" % port_id)
+        out = self.dut.send_command("flow list %s" % port_id, timeout=30)
         result_scanner = r'\d*.*?\d*.*?\d*.*?=>*'
         scanner = re.compile(result_scanner, re.DOTALL)
         li = scanner.findall(out)
@@ -1848,12 +1854,12 @@ class TestIAVFFdir(TestCase):
         m1 = p.search(out_pf1)
 
         eal_param = "-c 0xf -n 6 -w %s -w %s --file-prefix=pf0" % (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
-        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq=16 --txq=16")
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
         self.dut.send_expect(command, "testpmd> ", 300)
         self.config_testpmd()
 
         eal_param = "-c 0xf0 -n 6 -w %s -w %s --file-prefix=pf1" % (self.sriov_vfs_pf1[0].pci,self.sriov_vfs_pf1[1].pci)
-        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq=16 --txq=16")
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
         self.session_secondary.send_expect(command, "testpmd> ", 300)
         #self.session_secondary.config_testpmd()
         self.session_secondary.send_expect("set fwd rxonly", "testpmd> ")
@@ -2001,12 +2007,12 @@ class TestIAVFFdir(TestCase):
         m1 = p.search(out_pf1)
 
         eal_param = "-c 0xf -n 6 -w %s -w %s --file-prefix=pf0" % (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
-        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq=16 --txq=16")
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
         self.dut.send_expect(command, "testpmd> ", 300)
         self.config_testpmd()
 
         eal_param = "-c 0xf0 -n 6 -w %s -w %s --file-prefix=pf1" % (self.sriov_vfs_pf1[0].pci,self.sriov_vfs_pf1[1].pci)
-        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq=16 --txq=16")
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
         self.session_secondary.send_expect(command, "testpmd> ", 300)
         #self.session_secondary.config_testpmd()
         self.session_secondary.send_expect("set fwd rxonly", "testpmd> ")
@@ -2154,12 +2160,12 @@ class TestIAVFFdir(TestCase):
         m1 = p.search(out_pf1)
 
         eal_param = "-c 0xf -n 6 -w %s -w %s --file-prefix=pf0" % (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
-        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq=16 --txq=16")
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
         self.dut.send_expect(command, "testpmd> ", 300)
         self.config_testpmd()
 
         eal_param = "-c 0xf0 -n 6 -w %s -w %s --file-prefix=pf1" % (self.sriov_vfs_pf1[0].pci,self.sriov_vfs_pf1[1].pci)
-        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq=16 --txq=16")
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
         self.session_secondary.send_expect(command, "testpmd> ", 300)
         #self.session_secondary.config_testpmd()
         self.session_secondary.send_expect("set fwd rxonly", "testpmd> ")
@@ -2291,7 +2297,7 @@ class TestIAVFFdir(TestCase):
         self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
 
         eal_param = "-c f -n 6 -w %s -w %s" % (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
-        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir + src_file)
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num, self.cvlq_num) % self.dut_file_dir + src_file)
         self.dut.send_expect(command, "testpmd> ", 300)
         self.config_testpmd()
 
@@ -2361,7 +2367,7 @@ class TestIAVFFdir(TestCase):
         self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
 
         eal_param = "-c f -n 6 -w %s -w %s" % (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf1[0].pci)
-        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir + src_file)
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num, self.cvlq_num) % self.dut_file_dir + src_file)
         self.dut.send_expect(command, "testpmd> ", 300)
 
         self.config_testpmd()
@@ -2453,7 +2459,7 @@ class TestIAVFFdir(TestCase):
             self.verify(count == 513, "failed to create 1025 fdir rules on pf.")
         self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
         # create 1025 rules on pf1
-        fkr = open(self.dut_file_dir + src_file, "r+")
+        fkr = open(self.src_file_dir + src_file, "r+")
         kernel_rules = fkr.read()
         fkr.close()
         self.dut.send_expect(kernel_rules, "# ")
@@ -2477,7 +2483,7 @@ class TestIAVFFdir(TestCase):
 
         # start testpmd with creating rules in commandline
         eal_param = "-c f -n 6 -w %s -w %s" % (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
-        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir + src_file_vf)
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num, self.cvlq_num) % self.dut_file_dir + src_file_vf)
         fdw = open("15360_rules_vf_result.txt", "w")
         fdw.write(self.dut.send_expect(command, "testpmd> ", 360))
         fdw.close()
@@ -2545,7 +2551,7 @@ class TestIAVFFdir(TestCase):
             self.verify(count == 14848, "failed to create 14848 fdir rules on pf.")
         self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
         # create 15360 rules on pf1
-        fkr = open(self.dut_file_dir + src_file, "r+")
+        fkr = open(self.src_file_dir + src_file, "r+")
         kernel_rules = fkr.read()
         fkr.close()
         self.dut.send_expect(kernel_rules, "# ")
@@ -2554,7 +2560,7 @@ class TestIAVFFdir(TestCase):
         self.dut.send_expect("ethtool -N %s flow-type tcp4 src-ip 192.168.100.0 dst-ip 192.168.100.2 src-port 32 dst-port 33 action 8" % self.pf1_intf, "Cannot insert RX class rule: No space left on device")
         # start testpmd with creating rules in commandline
         eal_param = "-c f -n 6 -w %s -w %s" % (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf1[0].pci)
-        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq=16 --txq=16")
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
         self.dut.send_expect(command, "testpmd> ", 20)
 
         self.config_testpmd()
@@ -2606,7 +2612,7 @@ class TestIAVFFdir(TestCase):
         self.destroy_env()
         self.setup_npf_nvf_env(pf_num=1,vf_num=16)
         self.dut.send_expect('ip link set %s vf 10 mac 00:11:22:33:44:55' % self.pf0_intf, '#')
-        command = "./%s/app/testpmd -c f -n 6 -- -i %s" % (self.dut.target, "--rxq=16 --txq=16")
+        command = "./%s/app/testpmd -c f -n 6 -- -i %s" % (self.dut.target, "--rxq=4 --txq=4")
         self.dut.send_expect(command, "testpmd> ", 360)
         self.config_testpmd()
         for port_id in range(11):
@@ -2637,9 +2643,6 @@ class TestIAVFFdir(TestCase):
 
         self.create_fdir_rule(rule, check_stats=False)
 
-        self.destroy_env()
-        self.setup_2pf_4vf_env()
-
     def test_stress_port_stop_start(self):
         """
         Rules can take effect after port stop/start
@@ -2681,7 +2684,7 @@ class TestIAVFFdir(TestCase):
         self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
 
         eal_param = "-c f -n 6 -w %s -w %s" % (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
-        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir + src_file)
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num, self.cvlq_num) % self.dut_file_dir + src_file)
         self.dut.send_expect(command, "testpmd> ", 900)
         self.config_testpmd()
         self.check_fdir_rule(port_id=0, stats=False)
@@ -2716,7 +2719,7 @@ class TestIAVFFdir(TestCase):
         self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
 
         eal_param = "-c f -n 6 -w %s -w %s" % (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
-        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir + src_file)
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num, self.cvlq_num) % self.dut_file_dir + src_file)
         self.dut.send_expect(command, "testpmd> ", 900)
         self.config_testpmd()
         self.check_fdir_rule(port_id=0, stats=False)
@@ -3101,7 +3104,7 @@ class TestIAVFFdir(TestCase):
 
         self.dut.send_expect("quit", "# ")
         self.pmd_output.start_testpmd(cores="1S/4C/1T",
-                                      param="--rxq=16 --txq=16 --enable-rx-cksum --port-topology=loop",
+                                      param="--rxq={} --txq={} --enable-rx-cksum --port-topology=loop".format(self.cvlq_num, self.cvlq_num),
                                       eal_param="-w %s" % self.sriov_vfs_pf0[0].pci,
                                       socket=self.ports_socket)
         vlan = 51
@@ -3197,7 +3200,7 @@ class TestIAVFFdir(TestCase):
 
         self.dut.send_expect("quit", "# ")
         self.pmd_output.start_testpmd(cores="1S/4C/1T",
-                                      param="--rxq=16 --txq=16 --enable-rx-cksum --port-topology=loop",
+                                      param="--rxq={} --txq={} --enable-rx-cksum --port-topology=loop".format(self.cvlq_num, self.cvlq_num),
                                       eal_param="-w %s" % self.sriov_vfs_pf0[0].pci,
                                       socket=self.ports_socket)
         vlan = 51
@@ -3286,7 +3289,7 @@ class TestIAVFFdir(TestCase):
 
         self.dut.send_expect("quit", "# ")
         self.pmd_output.start_testpmd(cores="1S/4C/1T",
-                                      param="--rxq=16 --txq=16 --enable-rx-cksum --port-topology=loop",
+                                      param="--rxq={} --txq={} --enable-rx-cksum --port-topology=loop".format(self.cvlq_num, self.cvlq_num),
                                       eal_param="-w %s" % self.sriov_vfs_pf0[0].pci,
                                       socket=self.ports_socket)
         vlan = 51
@@ -3353,6 +3356,7 @@ class TestIAVFFdir(TestCase):
 
     def tear_down(self):
         # destroy all flow rule on port 0
+        self.destroy_env()
         self.dut.kill_all()
         if getattr(self, 'session_secondary', None):
             self.dut.close_session(self.session_secondary)
diff --git a/tests/rte_flow_common.py b/tests/rte_flow_common.py
index 0574e49..3d46e5e 100644
--- a/tests/rte_flow_common.py
+++ b/tests/rte_flow_common.py
@@ -34,6 +34,8 @@ import time
 import re
 from utils import GREEN, RED
 
+CVL_TXQ_RXQ_NUMBER = 16
+
 # switch filter common functions
 def get_suite_config(test_case):
     """
@@ -400,7 +402,7 @@ def check_mark(out, pkt_num, check_param, stats=True):
             else:
                 raise Exception("got wrong output, not match pattern %s" % p.pattern)
             if mark_id is not None:
-                mark_list = set(int(i, 16) for i in fdir_scanner.findall(out))
+                mark_list = set(int(i, CVL_TXQ_RXQ_NUMBER) for i in fdir_scanner.findall(out))
                 verify(all([i == check_param["mark_id"] for i in mark_list]),
                        "failed: some packet mark id of %s not match" % mark_list)
             else:
@@ -424,11 +426,11 @@ def check_mark(out, pkt_num, check_param, stats=True):
 def verify_directed_by_rss(out, rxq=64, stats=True):
     p = re.compile('RSS\shash=(\w+)\s-\sRSS\squeue=(\w+)')
     pkt_info = p.findall(out)
-    pkt_queue = set([int(i[1], 16) for i in pkt_info])
+    pkt_queue = set([int(i[1], CVL_TXQ_RXQ_NUMBER) for i in pkt_info])
     if stats:
-        verify(all([int(i[0], 16) % rxq == int(i[1], 16) for i in pkt_info]), 'some pkt not directed by rss.')
+        verify(all([int(i[0], CVL_TXQ_RXQ_NUMBER) % rxq == int(i[1], CVL_TXQ_RXQ_NUMBER) for i in pkt_info]), 'some pkt not directed by rss.')
     else:
-        verify(not any([int(i[0], 16) % rxq == int(i[1], 16) for i in pkt_info]), 'some pkt directed by rss')
+        verify(not any([int(i[0], CVL_TXQ_RXQ_NUMBER) % rxq == int(i[1], CVL_TXQ_RXQ_NUMBER) for i in pkt_info]), 'some pkt directed by rss')
     return pkt_queue
 
 
@@ -458,23 +460,23 @@ def check_iavf_fdir_queue(out, pkt_num, check_param, stats=True):
                 verify(not any(q == queue for q in res_queue), "fail: queue id should not matched, expect queue %s, got %s" % (queue, res_queue))
                 print((GREEN("pass: queue id %s not matched" % res_queue)))
             elif isinstance(queue, list):
-                verify_iavf_fdir_directed_by_rss(out, rxq=16, stats=True)
+                verify_iavf_fdir_directed_by_rss(out, rxq=CVL_TXQ_RXQ_NUMBER, stats=True)
                 print((GREEN("pass: queue id %s not matched" % res_queue)))
             else:
                 raise Exception("wrong action value, expect queue_index or queue_group")
     else:
         raise Exception("got wrong output, not match pattern %s" % p.pattern)
 
-def verify_iavf_fdir_directed_by_rss(out, rxq=16, stats=True):
+def verify_iavf_fdir_directed_by_rss(out, rxq=CVL_TXQ_RXQ_NUMBER, stats=True):
     p = re.compile("RSS hash=(0x\w+) - RSS queue=(0x\w+)")
     pkt_info = p.findall(out)
     if stats:
         for i in pkt_info:
-            verify((int(i[0],16) % rxq == int(i[1],16)), "some packets are not directed by RSS")
+            verify((int(i[0],CVL_TXQ_RXQ_NUMBER) % rxq == int(i[1],CVL_TXQ_RXQ_NUMBER)), "some packets are not directed by RSS")
             print(GREEN("pass: queue id %s is redirected by RSS hash value %s" % (i[1], i[0])))
     else:
         for i in pkt_info:
-            verify((int(i[0],16) % rxq != int(i[1],16)), "some packets are not directed by RSS")
+            verify((int(i[0],CVL_TXQ_RXQ_NUMBER) % rxq != int(i[1],CVL_TXQ_RXQ_NUMBER)), "some packets are not directed by RSS")
 
 def check_iavf_fdir_passthru(out, pkt_num, check_param, stats=True):
     # check the actual queue is distributed by RSS
@@ -485,7 +487,7 @@ def check_iavf_fdir_passthru(out, pkt_num, check_param, stats=True):
     p = re.compile('RSS\shash=(\w+)\s-\sRSS\squeue=(\w+)')
     pkt_hash = p.findall(out)
     verify(pkt_num == len(pkt_hash), "fail: got wrong number of passthru packets, expect passthru packet number %s, got %s." % (pkt_num, len(pkt_hash)))
-    verify_iavf_fdir_directed_by_rss(out, rxq=16, stats=True)
+    verify_iavf_fdir_directed_by_rss(out, rxq=CVL_TXQ_RXQ_NUMBER, stats=True)
 
 def check_iavf_fdir_mark(out, pkt_num, check_param, stats=True):
     mark_scanner = "FDIR matched ID=(0x\w+)"
@@ -499,7 +501,7 @@ def check_iavf_fdir_mark(out, pkt_num, check_param, stats=True):
             mark_list = [i for i in res]
             print("mark list is: ", mark_list)
             verify(len(res) == pkt_num, "get wrong number of packet with mark_id")
-            verify(all([int(i, 16) == check_param["mark_id"] for i in res]),
+            verify(all([int(i, CVL_TXQ_RXQ_NUMBER) == check_param["mark_id"] for i in res]),
                         "failed: some packet mark id of %s not match" % mark_list)
             if check_param.get("queue") is not None:
                 check_iavf_fdir_queue(out, pkt_num, check_param, stats)
@@ -629,7 +631,7 @@ def check_iavf_packets_rss_queue(out, count, rss_match=True):
                 packet_sumnum = packet_sumnum + int(packet_num)
 
     if rss_match:
-        if queue_flag == 16 and packet_sumnum == count:
+        if queue_flag == CVL_TXQ_RXQ_NUMBER and packet_sumnum == count:
             log_msg = "Packets has send to %s queues" % queue_flag
             return True, log_msg
         else:
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dts] [WARNING: UNSCANNABLE EXTRACTION FAILED][WARNING: UNSCANNABLE EXTRACTION FAILED]RE: [PATCH V1] tests/iavf_fdir: Adaptation regression modification
  2020-07-03  5:53 [dts] [PATCH V1] tests/iavf_fdir: Adaptation regression modification ChenBo
@ 2020-07-03  7:22 ` Chen, BoX C
  2020-07-20  6:55 ` [dts] " Tu, Lijuan
  1 sibling, 0 replies; 3+ messages in thread
From: Chen, BoX C @ 2020-07-03  7:22 UTC (permalink / raw)
  To: dts

[-- Attachment #1: Type: text/plain, Size: 22493 bytes --]

Tested-by:  Chen, BoX C <BoX.C.Chen@intel.com>

Regards,
Chen Bo

> -----Original Message-----
> From: Chen, BoX C <box.c.chen@intel.com>
> Sent: July 3, 2020 13:53
> To: dts@dpdk.org
> Cc: Chen, BoX C <box.c.chen@intel.com>
> Subject: [dts][PATCH V1] tests/iavf_fdir: Adaptation regression modification
> 
> 1.Use global variables instead of devil numbers.
> 2.Support for DUT and Tester is not the same ENV.
> 3.Fixed an issue with group packet exceptions.
> 4.Modify the environment cleanup process to increase code robustness.
> 
> Signed-off-by: ChenBo <box.c.chen@intel.com>
> ---
>  tests/TestSuite_iavf_fdir.py | 58 +++++++++++++++++++-----------------
>  tests/rte_flow_common.py     | 24 ++++++++-------
>  2 files changed, 44 insertions(+), 38 deletions(-)
> 
> diff --git a/tests/TestSuite_iavf_fdir.py b/tests/TestSuite_iavf_fdir.py index
> f1adc0f..f2004c6 100644
> --- a/tests/TestSuite_iavf_fdir.py
> +++ b/tests/TestSuite_iavf_fdir.py
> @@ -37,6 +37,7 @@ from packet import Packet  from pmd_output import
> PmdOutput  from test_case import TestCase  import rte_flow_common as
> rfc
> +from rte_flow_common import CVL_TXQ_RXQ_NUMBER
>  from multiprocessing import Process
>  from multiprocessing import Manager
> 
> @@ -126,9 +127,9 @@ MAC_IPV6_PAY = {
>  MAC_IPV6_PAY_protocol = {
>      "match": [
> 
> 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3
> 900:2020", src="2001::2", nh=44, tc=1, hlim=2)/("X"*480)',
> -
> 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3
> 900:2020")/IPv6ExtHdrFragment(100)/("X"*480)',
> +
> + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:111
> + 1:3900:2020")/IPv6ExtHdrFragment()/("X"*480)',
> 
> 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3
> 900:2020", nh=44)/TCP(sport=22,dport=23)/("X"*480)',
> -
> 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3
> 900:2020")/IPv6ExtHdrFragment(100)/TCP(sport=22,dport=23)/("X"*480)',
> +
> + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:111
> + 1:3900:2020")/IPv6ExtHdrFragment()/TCP(sport=22,dport=23)/("X"*480)',
> 
> 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3
> 900:2020", nh=6)/("X"*480)',
> 
> 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:3
> 900:2020")/TCP(sport=22,dport=23)/("X"*480)'],
>      "mismatch": [
> @@ -1302,11 +1303,16 @@ class TestIAVFFdir(TestCase):
> 
>          self.src_file_dir = 'dep/'
>          self.dut_file_dir = '/tmp/'
> +        self.cvlq_num = CVL_TXQ_RXQ_NUMBER
> 
>      def set_up(self):
>          """
>          Run before each test case.
>          """
> +        self.re_load_ice_driver()
> +        time.sleep(1)
> +        self.setup_2pf_4vf_env()
> +        time.sleep(1)
>          self.launch_testpmd()
> 
>      def setup_2pf_4vf_env(self, driver='default'):
> @@ -1384,8 +1390,8 @@ class TestIAVFFdir(TestCase):
>          self.dut.send_expect("rmmod ice", "# ", 40)
>          ice_driver_file_location = self.suite_config["ice_driver_file_location"]
>          self.dut.send_expect("insmod %s" % ice_driver_file_location, "# ")
> -        self.dut.send_expect("ifconfig %s up" % self.tester_iface0, "# ", 15)
> -        self.dut.send_expect("ifconfig %s up" % self.tester_iface1, "# ", 15)
> +        self.dut.send_expect("ifconfig %s up" % self.dut_ports[0], "# ", 15)
> +        self.dut.send_expect("ifconfig %s up" % self.dut_ports[1], "#
> + ", 15)
> 
>      def config_testpmd(self):
>          self.pmd_output.execute_cmd("set fwd rxonly") @@ -1401,7 +1407,7
> @@ class TestIAVFFdir(TestCase):
> 
>      def launch_testpmd(self):
>          self.pmd_output.start_testpmd(cores="1S/4C/1T",
> -                                      param="--rxq=16 --txq=16",
> +                                      param="--rxq={}
> + --txq={}".format(self.cvlq_num, self.cvlq_num),
>                                        eal_param="-w %s -w %s" % (
>                                             self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci),
>                                        socket=self.ports_socket) @@ -1508,7 +1514,7 @@ class
> TestIAVFFdir(TestCase):
>              self.verify(not p.search(out), "flow rule on port %s is existed" %
> port_id)
> 
>      def check_rule_number(self, port_id=0, num=0):
> -        out = self.pmd_output.execute_cmd("flow list %s" % port_id)
> +        out = self.dut.send_command("flow list %s" % port_id,
> + timeout=30)
>          result_scanner = r'\d*.*?\d*.*?\d*.*?=>*'
>          scanner = re.compile(result_scanner, re.DOTALL)
>          li = scanner.findall(out)
> @@ -1848,12 +1854,12 @@ class TestIAVFFdir(TestCase):
>          m1 = p.search(out_pf1)
> 
>          eal_param = "-c 0xf -n 6 -w %s -w %s --file-prefix=pf0" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> eal_param, "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.dut.send_expect(command, "testpmd> ", 300)
>          self.config_testpmd()
> 
>          eal_param = "-c 0xf0 -n 6 -w %s -w %s --file-prefix=pf1" %
> (self.sriov_vfs_pf1[0].pci,self.sriov_vfs_pf1[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> eal_param, "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.session_secondary.send_expect(command, "testpmd> ", 300)
>          #self.session_secondary.config_testpmd()
>          self.session_secondary.send_expect("set fwd rxonly", "testpmd> ")
> @@ -2001,12 +2007,12 @@ class TestIAVFFdir(TestCase):
>          m1 = p.search(out_pf1)
> 
>          eal_param = "-c 0xf -n 6 -w %s -w %s --file-prefix=pf0" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> eal_param, "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.dut.send_expect(command, "testpmd> ", 300)
>          self.config_testpmd()
> 
>          eal_param = "-c 0xf0 -n 6 -w %s -w %s --file-prefix=pf1" %
> (self.sriov_vfs_pf1[0].pci,self.sriov_vfs_pf1[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> eal_param, "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.session_secondary.send_expect(command, "testpmd> ", 300)
>          #self.session_secondary.config_testpmd()
>          self.session_secondary.send_expect("set fwd rxonly", "testpmd> ")
> @@ -2154,12 +2160,12 @@ class TestIAVFFdir(TestCase):
>          m1 = p.search(out_pf1)
> 
>          eal_param = "-c 0xf -n 6 -w %s -w %s --file-prefix=pf0" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> eal_param, "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.dut.send_expect(command, "testpmd> ", 300)
>          self.config_testpmd()
> 
>          eal_param = "-c 0xf0 -n 6 -w %s -w %s --file-prefix=pf1" %
> (self.sriov_vfs_pf1[0].pci,self.sriov_vfs_pf1[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> eal_param, "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.session_secondary.send_expect(command, "testpmd> ", 300)
>          #self.session_secondary.config_testpmd()
>          self.session_secondary.send_expect("set fwd rxonly", "testpmd> ")
> @@ -2291,7 +2297,7 @@ class TestIAVFFdir(TestCase):
>          self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
> 
>          eal_param = "-c f -n 6 -w %s -w %s" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> eal_param, "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir +
> src_file)
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num,
> + self.cvlq_num) % self.dut_file_dir + src_file)
>          self.dut.send_expect(command, "testpmd> ", 300)
>          self.config_testpmd()
> 
> @@ -2361,7 +2367,7 @@ class TestIAVFFdir(TestCase):
>          self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
> 
>          eal_param = "-c f -n 6 -w %s -w %s" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf1[0].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> eal_param, "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir +
> src_file)
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num,
> + self.cvlq_num) % self.dut_file_dir + src_file)
>          self.dut.send_expect(command, "testpmd> ", 300)
> 
>          self.config_testpmd()
> @@ -2453,7 +2459,7 @@ class TestIAVFFdir(TestCase):
>              self.verify(count == 513, "failed to create 1025 fdir rules on pf.")
>          self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
>          # create 1025 rules on pf1
> -        fkr = open(self.dut_file_dir + src_file, "r+")
> +        fkr = open(self.src_file_dir + src_file, "r+")
>          kernel_rules = fkr.read()
>          fkr.close()
>          self.dut.send_expect(kernel_rules, "# ") @@ -2477,7 +2483,7 @@ class
> TestIAVFFdir(TestCase):
> 
>          # start testpmd with creating rules in commandline
>          eal_param = "-c f -n 6 -w %s -w %s" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> eal_param, "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir +
> src_file_vf)
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num,
> + self.cvlq_num) % self.dut_file_dir + src_file_vf)
>          fdw = open("15360_rules_vf_result.txt", "w")
>          fdw.write(self.dut.send_expect(command, "testpmd> ", 360))
>          fdw.close()
> @@ -2545,7 +2551,7 @@ class TestIAVFFdir(TestCase):
>              self.verify(count == 14848, "failed to create 14848 fdir rules on pf.")
>          self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
>          # create 15360 rules on pf1
> -        fkr = open(self.dut_file_dir + src_file, "r+")
> +        fkr = open(self.src_file_dir + src_file, "r+")
>          kernel_rules = fkr.read()
>          fkr.close()
>          self.dut.send_expect(kernel_rules, "# ") @@ -2554,7 +2560,7 @@ class
> TestIAVFFdir(TestCase):
>          self.dut.send_expect("ethtool -N %s flow-type tcp4 src-ip 192.168.100.0
> dst-ip 192.168.100.2 src-port 32 dst-port 33 action 8" % self.pf1_intf, "Cannot
> insert RX class rule: No space left on device")
>          # start testpmd with creating rules in commandline
>          eal_param = "-c f -n 6 -w %s -w %s" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf1[0].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> eal_param, "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.dut.send_expect(command, "testpmd> ", 20)
> 
>          self.config_testpmd()
> @@ -2606,7 +2612,7 @@ class TestIAVFFdir(TestCase):
>          self.destroy_env()
>          self.setup_npf_nvf_env(pf_num=1,vf_num=16)
>          self.dut.send_expect('ip link set %s vf 10 mac 00:11:22:33:44:55' %
> self.pf0_intf, '#')
> -        command = "./%s/app/testpmd -c f -n 6 -- -i %s" % (self.dut.target, "--
> rxq=16 --txq=16")
> +        command = "./%s/app/testpmd -c f -n 6 -- -i %s" %
> + (self.dut.target, "--rxq=4 --txq=4")
>          self.dut.send_expect(command, "testpmd> ", 360)
>          self.config_testpmd()
>          for port_id in range(11):
> @@ -2637,9 +2643,6 @@ class TestIAVFFdir(TestCase):
> 
>          self.create_fdir_rule(rule, check_stats=False)
> 
> -        self.destroy_env()
> -        self.setup_2pf_4vf_env()
> -
>      def test_stress_port_stop_start(self):
>          """
>          Rules can take effect after port stop/start @@ -2681,7 +2684,7 @@ class
> TestIAVFFdir(TestCase):
>          self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
> 
>          eal_param = "-c f -n 6 -w %s -w %s" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> eal_param, "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir +
> src_file)
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num,
> + self.cvlq_num) % self.dut_file_dir + src_file)
>          self.dut.send_expect(command, "testpmd> ", 900)
>          self.config_testpmd()
>          self.check_fdir_rule(port_id=0, stats=False) @@ -2716,7 +2719,7 @@
> class TestIAVFFdir(TestCase):
>          self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
> 
>          eal_param = "-c f -n 6 -w %s -w %s" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> eal_param, "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir +
> src_file)
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num,
> + self.cvlq_num) % self.dut_file_dir + src_file)
>          self.dut.send_expect(command, "testpmd> ", 900)
>          self.config_testpmd()
>          self.check_fdir_rule(port_id=0, stats=False) @@ -3101,7 +3104,7 @@
> class TestIAVFFdir(TestCase):
> 
>          self.dut.send_expect("quit", "# ")
>          self.pmd_output.start_testpmd(cores="1S/4C/1T",
> -                                      param="--rxq=16 --txq=16 --enable-rx-cksum --port-
> topology=loop",
> +                                      param="--rxq={} --txq={}
> + --enable-rx-cksum --port-topology=loop".format(self.cvlq_num,
> + self.cvlq_num),
>                                        eal_param="-w %s" % self.sriov_vfs_pf0[0].pci,
>                                        socket=self.ports_socket)
>          vlan = 51
> @@ -3197,7 +3200,7 @@ class TestIAVFFdir(TestCase):
> 
>          self.dut.send_expect("quit", "# ")
>          self.pmd_output.start_testpmd(cores="1S/4C/1T",
> -                                      param="--rxq=16 --txq=16 --enable-rx-cksum --port-
> topology=loop",
> +                                      param="--rxq={} --txq={}
> + --enable-rx-cksum --port-topology=loop".format(self.cvlq_num,
> + self.cvlq_num),
>                                        eal_param="-w %s" % self.sriov_vfs_pf0[0].pci,
>                                        socket=self.ports_socket)
>          vlan = 51
> @@ -3286,7 +3289,7 @@ class TestIAVFFdir(TestCase):
> 
>          self.dut.send_expect("quit", "# ")
>          self.pmd_output.start_testpmd(cores="1S/4C/1T",
> -                                      param="--rxq=16 --txq=16 --enable-rx-cksum --port-
> topology=loop",
> +                                      param="--rxq={} --txq={}
> + --enable-rx-cksum --port-topology=loop".format(self.cvlq_num,
> + self.cvlq_num),
>                                        eal_param="-w %s" % self.sriov_vfs_pf0[0].pci,
>                                        socket=self.ports_socket)
>          vlan = 51
> @@ -3353,6 +3356,7 @@ class TestIAVFFdir(TestCase):
> 
>      def tear_down(self):
>          # destroy all flow rule on port 0
> +        self.destroy_env()
>          self.dut.kill_all()
>          if getattr(self, 'session_secondary', None):
>              self.dut.close_session(self.session_secondary)
> diff --git a/tests/rte_flow_common.py b/tests/rte_flow_common.py index
> 0574e49..3d46e5e 100644
> --- a/tests/rte_flow_common.py
> +++ b/tests/rte_flow_common.py
> @@ -34,6 +34,8 @@ import time
>  import re
>  from utils import GREEN, RED
> 
> +CVL_TXQ_RXQ_NUMBER = 16
> +
>  # switch filter common functions
>  def get_suite_config(test_case):
>      """
> @@ -400,7 +402,7 @@ def check_mark(out, pkt_num, check_param,
> stats=True):
>              else:
>                  raise Exception("got wrong output, not match pattern %s" %
> p.pattern)
>              if mark_id is not None:
> -                mark_list = set(int(i, 16) for i in fdir_scanner.findall(out))
> +                mark_list = set(int(i, CVL_TXQ_RXQ_NUMBER) for i in
> + fdir_scanner.findall(out))
>                  verify(all([i == check_param["mark_id"] for i in mark_list]),
>                         "failed: some packet mark id of %s not match" % mark_list)
>              else:
> @@ -424,11 +426,11 @@ def check_mark(out, pkt_num, check_param,
> stats=True):
>  def verify_directed_by_rss(out, rxq=64, stats=True):
>      p = re.compile('RSS\shash=(\w+)\s-\sRSS\squeue=(\w+)')
>      pkt_info = p.findall(out)
> -    pkt_queue = set([int(i[1], 16) for i in pkt_info])
> +    pkt_queue = set([int(i[1], CVL_TXQ_RXQ_NUMBER) for i in pkt_info])
>      if stats:
> -        verify(all([int(i[0], 16) % rxq == int(i[1], 16) for i in pkt_info]), 'some pkt
> not directed by rss.')
> +        verify(all([int(i[0], CVL_TXQ_RXQ_NUMBER) % rxq == int(i[1],
> + CVL_TXQ_RXQ_NUMBER) for i in pkt_info]), 'some pkt not directed by
> + rss.')
>      else:
> -        verify(not any([int(i[0], 16) % rxq == int(i[1], 16) for i in pkt_info]), 'some
> pkt directed by rss')
> +        verify(not any([int(i[0], CVL_TXQ_RXQ_NUMBER) % rxq ==
> + int(i[1], CVL_TXQ_RXQ_NUMBER) for i in pkt_info]), 'some pkt directed
> + by rss')
>      return pkt_queue
> 
> 
> @@ -458,23 +460,23 @@ def check_iavf_fdir_queue(out, pkt_num,
> check_param, stats=True):
>                  verify(not any(q == queue for q in res_queue), "fail: queue id should
> not matched, expect queue %s, got %s" % (queue, res_queue))
>                  print((GREEN("pass: queue id %s not matched" % res_queue)))
>              elif isinstance(queue, list):
> -                verify_iavf_fdir_directed_by_rss(out, rxq=16, stats=True)
> +                verify_iavf_fdir_directed_by_rss(out,
> + rxq=CVL_TXQ_RXQ_NUMBER, stats=True)
>                  print((GREEN("pass: queue id %s not matched" % res_queue)))
>              else:
>                  raise Exception("wrong action value, expect queue_index or
> queue_group")
>      else:
>          raise Exception("got wrong output, not match pattern %s" % p.pattern)
> 
> -def verify_iavf_fdir_directed_by_rss(out, rxq=16, stats=True):
> +def verify_iavf_fdir_directed_by_rss(out, rxq=CVL_TXQ_RXQ_NUMBER,
> stats=True):
>      p = re.compile("RSS hash=(0x\w+) - RSS queue=(0x\w+)")
>      pkt_info = p.findall(out)
>      if stats:
>          for i in pkt_info:
> -            verify((int(i[0],16) % rxq == int(i[1],16)), "some packets are not
> directed by RSS")
> +            verify((int(i[0],CVL_TXQ_RXQ_NUMBER) % rxq ==
> + int(i[1],CVL_TXQ_RXQ_NUMBER)), "some packets are not directed by RSS")
>              print(GREEN("pass: queue id %s is redirected by RSS hash value %s" %
> (i[1], i[0])))
>      else:
>          for i in pkt_info:
> -            verify((int(i[0],16) % rxq != int(i[1],16)), "some packets are not
> directed by RSS")
> +            verify((int(i[0],CVL_TXQ_RXQ_NUMBER) % rxq !=
> + int(i[1],CVL_TXQ_RXQ_NUMBER)), "some packets are not directed by RSS")
> 
>  def check_iavf_fdir_passthru(out, pkt_num, check_param, stats=True):
>      # check the actual queue is distributed by RSS @@ -485,7 +487,7 @@ def
> check_iavf_fdir_passthru(out, pkt_num, check_param, stats=True):
>      p = re.compile('RSS\shash=(\w+)\s-\sRSS\squeue=(\w+)')
>      pkt_hash = p.findall(out)
>      verify(pkt_num == len(pkt_hash), "fail: got wrong number of passthru
> packets, expect passthru packet number %s, got %s." % (pkt_num,
> len(pkt_hash)))
> -    verify_iavf_fdir_directed_by_rss(out, rxq=16, stats=True)
> +    verify_iavf_fdir_directed_by_rss(out, rxq=CVL_TXQ_RXQ_NUMBER,
> + stats=True)
> 
>  def check_iavf_fdir_mark(out, pkt_num, check_param, stats=True):
>      mark_scanner = "FDIR matched ID=(0x\w+)"
> @@ -499,7 +501,7 @@ def check_iavf_fdir_mark(out, pkt_num,
> check_param, stats=True):
>              mark_list = [i for i in res]
>              print("mark list is: ", mark_list)
>              verify(len(res) == pkt_num, "get wrong number of packet with
> mark_id")
> -            verify(all([int(i, 16) == check_param["mark_id"] for i in res]),
> +            verify(all([int(i, CVL_TXQ_RXQ_NUMBER) ==
> + check_param["mark_id"] for i in res]),
>                          "failed: some packet mark id of %s not match" % mark_list)
>              if check_param.get("queue") is not None:
>                  check_iavf_fdir_queue(out, pkt_num, check_param, stats) @@ -
> 629,7 +631,7 @@ def check_iavf_packets_rss_queue(out, count,
> rss_match=True):
>                  packet_sumnum = packet_sumnum + int(packet_num)
> 
>      if rss_match:
> -        if queue_flag == 16 and packet_sumnum == count:
> +        if queue_flag == CVL_TXQ_RXQ_NUMBER and packet_sumnum ==
> count:
>              log_msg = "Packets has send to %s queues" % queue_flag
>              return True, log_msg
>          else:
> --
> 2.17.1


[-- Attachment #2: TestIAVFFdir.rar --]
[-- Type: application/octet-stream, Size: 130520 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dts] [PATCH V1] tests/iavf_fdir: Adaptation regression modification
  2020-07-03  5:53 [dts] [PATCH V1] tests/iavf_fdir: Adaptation regression modification ChenBo
  2020-07-03  7:22 ` [dts] [WARNING: UNSCANNABLE EXTRACTION FAILED][WARNING: UNSCANNABLE EXTRACTION FAILED]RE: " Chen, BoX C
@ 2020-07-20  6:55 ` Tu, Lijuan
  1 sibling, 0 replies; 3+ messages in thread
From: Tu, Lijuan @ 2020-07-20  6:55 UTC (permalink / raw)
  To: Chen, BoX C, dts; +Cc: Chen, BoX C

Applied, thanks

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of ChenBo
> Sent: 2020年7月3日 13:53
> To: dts@dpdk.org
> Cc: Chen, BoX C <box.c.chen@intel.com>
> Subject: [dts] [PATCH V1] tests/iavf_fdir: Adaptation regression modification
> 
> 1.Use global variables instead of devil numbers.
> 2.Support for DUT and Tester is not the same ENV.
> 3.Fixed an issue with group packet exceptions.
> 4.Modify the environment cleanup process to increase code robustness.
> 
> Signed-off-by: ChenBo <box.c.chen@intel.com>
> ---
>  tests/TestSuite_iavf_fdir.py | 58 +++++++++++++++++++-----------------
>  tests/rte_flow_common.py     | 24 ++++++++-------
>  2 files changed, 44 insertions(+), 38 deletions(-)
> 
> diff --git a/tests/TestSuite_iavf_fdir.py b/tests/TestSuite_iavf_fdir.py index
> f1adc0f..f2004c6 100644
> --- a/tests/TestSuite_iavf_fdir.py
> +++ b/tests/TestSuite_iavf_fdir.py
> @@ -37,6 +37,7 @@ from packet import Packet  from pmd_output import
> PmdOutput  from test_case import TestCase  import rte_flow_common as rfc
> +from rte_flow_common import CVL_TXQ_RXQ_NUMBER
>  from multiprocessing import Process
>  from multiprocessing import Manager
> 
> @@ -126,9 +127,9 @@ MAC_IPV6_PAY = {
>  MAC_IPV6_PAY_protocol = {
>      "match": [
> 
> 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:39
> 00:2020", src="2001::2", nh=44, tc=1, hlim=2)/("X"*480)',
> -
> 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:39
> 00:2020")/IPv6ExtHdrFragment(100)/("X"*480)',
> +
> + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:111
> + 1:3900:2020")/IPv6ExtHdrFragment()/("X"*480)',
> 
> 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:39
> 00:2020", nh=44)/TCP(sport=22,dport=23)/("X"*480)',
> -
> 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:39
> 00:2020")/IPv6ExtHdrFragment(100)/TCP(sport=22,dport=23)/("X"*480)',
> +
> + 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:111
> + 1:3900:2020")/IPv6ExtHdrFragment()/TCP(sport=22,dport=23)/("X"*480)',
> 
> 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:39
> 00:2020", nh=6)/("X"*480)',
> 
> 'Ether(dst="00:11:22:33:44:55")/IPv6(dst="CDCD:910A:2222:5498:8475:1111:39
> 00:2020")/TCP(sport=22,dport=23)/("X"*480)'],
>      "mismatch": [
> @@ -1302,11 +1303,16 @@ class TestIAVFFdir(TestCase):
> 
>          self.src_file_dir = 'dep/'
>          self.dut_file_dir = '/tmp/'
> +        self.cvlq_num = CVL_TXQ_RXQ_NUMBER
> 
>      def set_up(self):
>          """
>          Run before each test case.
>          """
> +        self.re_load_ice_driver()
> +        time.sleep(1)
> +        self.setup_2pf_4vf_env()
> +        time.sleep(1)
>          self.launch_testpmd()
> 
>      def setup_2pf_4vf_env(self, driver='default'):
> @@ -1384,8 +1390,8 @@ class TestIAVFFdir(TestCase):
>          self.dut.send_expect("rmmod ice", "# ", 40)
>          ice_driver_file_location = self.suite_config["ice_driver_file_location"]
>          self.dut.send_expect("insmod %s" % ice_driver_file_location, "# ")
> -        self.dut.send_expect("ifconfig %s up" % self.tester_iface0, "# ", 15)
> -        self.dut.send_expect("ifconfig %s up" % self.tester_iface1, "# ", 15)
> +        self.dut.send_expect("ifconfig %s up" % self.dut_ports[0], "# ", 15)
> +        self.dut.send_expect("ifconfig %s up" % self.dut_ports[1], "#
> + ", 15)
> 
>      def config_testpmd(self):
>          self.pmd_output.execute_cmd("set fwd rxonly") @@ -1401,7 +1407,7 @@
> class TestIAVFFdir(TestCase):
> 
>      def launch_testpmd(self):
>          self.pmd_output.start_testpmd(cores="1S/4C/1T",
> -                                      param="--rxq=16 --txq=16",
> +                                      param="--rxq={}
> + --txq={}".format(self.cvlq_num, self.cvlq_num),
>                                        eal_param="-w %s -w %s" % (
>                                             self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci),
>                                        socket=self.ports_socket) @@ -1508,7 +1514,7 @@ class
> TestIAVFFdir(TestCase):
>              self.verify(not p.search(out), "flow rule on port %s is existed" % port_id)
> 
>      def check_rule_number(self, port_id=0, num=0):
> -        out = self.pmd_output.execute_cmd("flow list %s" % port_id)
> +        out = self.dut.send_command("flow list %s" % port_id,
> + timeout=30)
>          result_scanner = r'\d*.*?\d*.*?\d*.*?=>*'
>          scanner = re.compile(result_scanner, re.DOTALL)
>          li = scanner.findall(out)
> @@ -1848,12 +1854,12 @@ class TestIAVFFdir(TestCase):
>          m1 = p.search(out_pf1)
> 
>          eal_param = "-c 0xf -n 6 -w %s -w %s --file-prefix=pf0" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param,
> "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.dut.send_expect(command, "testpmd> ", 300)
>          self.config_testpmd()
> 
>          eal_param = "-c 0xf0 -n 6 -w %s -w %s --file-prefix=pf1" %
> (self.sriov_vfs_pf1[0].pci,self.sriov_vfs_pf1[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param,
> "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.session_secondary.send_expect(command, "testpmd> ", 300)
>          #self.session_secondary.config_testpmd()
>          self.session_secondary.send_expect("set fwd rxonly", "testpmd> ") @@ -
> 2001,12 +2007,12 @@ class TestIAVFFdir(TestCase):
>          m1 = p.search(out_pf1)
> 
>          eal_param = "-c 0xf -n 6 -w %s -w %s --file-prefix=pf0" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param,
> "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.dut.send_expect(command, "testpmd> ", 300)
>          self.config_testpmd()
> 
>          eal_param = "-c 0xf0 -n 6 -w %s -w %s --file-prefix=pf1" %
> (self.sriov_vfs_pf1[0].pci,self.sriov_vfs_pf1[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param,
> "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.session_secondary.send_expect(command, "testpmd> ", 300)
>          #self.session_secondary.config_testpmd()
>          self.session_secondary.send_expect("set fwd rxonly", "testpmd> ") @@ -
> 2154,12 +2160,12 @@ class TestIAVFFdir(TestCase):
>          m1 = p.search(out_pf1)
> 
>          eal_param = "-c 0xf -n 6 -w %s -w %s --file-prefix=pf0" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param,
> "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.dut.send_expect(command, "testpmd> ", 300)
>          self.config_testpmd()
> 
>          eal_param = "-c 0xf0 -n 6 -w %s -w %s --file-prefix=pf1" %
> (self.sriov_vfs_pf1[0].pci,self.sriov_vfs_pf1[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param,
> "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.session_secondary.send_expect(command, "testpmd> ", 300)
>          #self.session_secondary.config_testpmd()
>          self.session_secondary.send_expect("set fwd rxonly", "testpmd> ") @@ -
> 2291,7 +2297,7 @@ class TestIAVFFdir(TestCase):
>          self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
> 
>          eal_param = "-c f -n 6 -w %s -w %s" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param,
> "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir + src_file)
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num,
> + self.cvlq_num) % self.dut_file_dir + src_file)
>          self.dut.send_expect(command, "testpmd> ", 300)
>          self.config_testpmd()
> 
> @@ -2361,7 +2367,7 @@ class TestIAVFFdir(TestCase):
>          self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
> 
>          eal_param = "-c f -n 6 -w %s -w %s" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf1[0].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param,
> "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir + src_file)
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num,
> + self.cvlq_num) % self.dut_file_dir + src_file)
>          self.dut.send_expect(command, "testpmd> ", 300)
> 
>          self.config_testpmd()
> @@ -2453,7 +2459,7 @@ class TestIAVFFdir(TestCase):
>              self.verify(count == 513, "failed to create 1025 fdir rules on pf.")
>          self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
>          # create 1025 rules on pf1
> -        fkr = open(self.dut_file_dir + src_file, "r+")
> +        fkr = open(self.src_file_dir + src_file, "r+")
>          kernel_rules = fkr.read()
>          fkr.close()
>          self.dut.send_expect(kernel_rules, "# ") @@ -2477,7 +2483,7 @@ class
> TestIAVFFdir(TestCase):
> 
>          # start testpmd with creating rules in commandline
>          eal_param = "-c f -n 6 -w %s -w %s" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param,
> "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir + src_file_vf)
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num,
> + self.cvlq_num) % self.dut_file_dir + src_file_vf)
>          fdw = open("15360_rules_vf_result.txt", "w")
>          fdw.write(self.dut.send_expect(command, "testpmd> ", 360))
>          fdw.close()
> @@ -2545,7 +2551,7 @@ class TestIAVFFdir(TestCase):
>              self.verify(count == 14848, "failed to create 14848 fdir rules on pf.")
>          self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
>          # create 15360 rules on pf1
> -        fkr = open(self.dut_file_dir + src_file, "r+")
> +        fkr = open(self.src_file_dir + src_file, "r+")
>          kernel_rules = fkr.read()
>          fkr.close()
>          self.dut.send_expect(kernel_rules, "# ") @@ -2554,7 +2560,7 @@ class
> TestIAVFFdir(TestCase):
>          self.dut.send_expect("ethtool -N %s flow-type tcp4 src-ip 192.168.100.0
> dst-ip 192.168.100.2 src-port 32 dst-port 33 action 8" % self.pf1_intf, "Cannot
> insert RX class rule: No space left on device")
>          # start testpmd with creating rules in commandline
>          eal_param = "-c f -n 6 -w %s -w %s" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf1[0].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param,
> "--rxq=16 --txq=16")
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={}".format(self.cvlq_num, self.cvlq_num))
>          self.dut.send_expect(command, "testpmd> ", 20)
> 
>          self.config_testpmd()
> @@ -2606,7 +2612,7 @@ class TestIAVFFdir(TestCase):
>          self.destroy_env()
>          self.setup_npf_nvf_env(pf_num=1,vf_num=16)
>          self.dut.send_expect('ip link set %s vf 10 mac 00:11:22:33:44:55' %
> self.pf0_intf, '#')
> -        command = "./%s/app/testpmd -c f -n 6 -- -i %s" % (self.dut.target, "--
> rxq=16 --txq=16")
> +        command = "./%s/app/testpmd -c f -n 6 -- -i %s" %
> + (self.dut.target, "--rxq=4 --txq=4")
>          self.dut.send_expect(command, "testpmd> ", 360)
>          self.config_testpmd()
>          for port_id in range(11):
> @@ -2637,9 +2643,6 @@ class TestIAVFFdir(TestCase):
> 
>          self.create_fdir_rule(rule, check_stats=False)
> 
> -        self.destroy_env()
> -        self.setup_2pf_4vf_env()
> -
>      def test_stress_port_stop_start(self):
>          """
>          Rules can take effect after port stop/start @@ -2681,7 +2684,7 @@ class
> TestIAVFFdir(TestCase):
>          self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
> 
>          eal_param = "-c f -n 6 -w %s -w %s" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param,
> "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir + src_file)
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num,
> + self.cvlq_num) % self.dut_file_dir + src_file)
>          self.dut.send_expect(command, "testpmd> ", 900)
>          self.config_testpmd()
>          self.check_fdir_rule(port_id=0, stats=False) @@ -2716,7 +2719,7 @@ class
> TestIAVFFdir(TestCase):
>          self.dut.session.copy_file_to(self.src_file_dir + src_file, self.dut_file_dir)
> 
>          eal_param = "-c f -n 6 -w %s -w %s" %
> (self.sriov_vfs_pf0[0].pci,self.sriov_vfs_pf0[1].pci)
> -        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, eal_param,
> "--rxq=16 --txq=16 --cmdline-file=%s" % self.dut_file_dir + src_file)
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + eal_param, "--rxq={} --txq={} --cmdline-file=%s".format(self.cvlq_num,
> + self.cvlq_num) % self.dut_file_dir + src_file)
>          self.dut.send_expect(command, "testpmd> ", 900)
>          self.config_testpmd()
>          self.check_fdir_rule(port_id=0, stats=False) @@ -3101,7 +3104,7 @@ class
> TestIAVFFdir(TestCase):
> 
>          self.dut.send_expect("quit", "# ")
>          self.pmd_output.start_testpmd(cores="1S/4C/1T",
> -                                      param="--rxq=16 --txq=16 --enable-rx-cksum --port-
> topology=loop",
> +                                      param="--rxq={} --txq={}
> + --enable-rx-cksum --port-topology=loop".format(self.cvlq_num,
> + self.cvlq_num),
>                                        eal_param="-w %s" % self.sriov_vfs_pf0[0].pci,
>                                        socket=self.ports_socket)
>          vlan = 51
> @@ -3197,7 +3200,7 @@ class TestIAVFFdir(TestCase):
> 
>          self.dut.send_expect("quit", "# ")
>          self.pmd_output.start_testpmd(cores="1S/4C/1T",
> -                                      param="--rxq=16 --txq=16 --enable-rx-cksum --port-
> topology=loop",
> +                                      param="--rxq={} --txq={}
> + --enable-rx-cksum --port-topology=loop".format(self.cvlq_num,
> + self.cvlq_num),
>                                        eal_param="-w %s" % self.sriov_vfs_pf0[0].pci,
>                                        socket=self.ports_socket)
>          vlan = 51
> @@ -3286,7 +3289,7 @@ class TestIAVFFdir(TestCase):
> 
>          self.dut.send_expect("quit", "# ")
>          self.pmd_output.start_testpmd(cores="1S/4C/1T",
> -                                      param="--rxq=16 --txq=16 --enable-rx-cksum --port-
> topology=loop",
> +                                      param="--rxq={} --txq={}
> + --enable-rx-cksum --port-topology=loop".format(self.cvlq_num,
> + self.cvlq_num),
>                                        eal_param="-w %s" % self.sriov_vfs_pf0[0].pci,
>                                        socket=self.ports_socket)
>          vlan = 51
> @@ -3353,6 +3356,7 @@ class TestIAVFFdir(TestCase):
> 
>      def tear_down(self):
>          # destroy all flow rule on port 0
> +        self.destroy_env()
>          self.dut.kill_all()
>          if getattr(self, 'session_secondary', None):
>              self.dut.close_session(self.session_secondary)
> diff --git a/tests/rte_flow_common.py b/tests/rte_flow_common.py index
> 0574e49..3d46e5e 100644
> --- a/tests/rte_flow_common.py
> +++ b/tests/rte_flow_common.py
> @@ -34,6 +34,8 @@ import time
>  import re
>  from utils import GREEN, RED
> 
> +CVL_TXQ_RXQ_NUMBER = 16
> +
>  # switch filter common functions
>  def get_suite_config(test_case):
>      """
> @@ -400,7 +402,7 @@ def check_mark(out, pkt_num, check_param,
> stats=True):
>              else:
>                  raise Exception("got wrong output, not match pattern %s" % p.pattern)
>              if mark_id is not None:
> -                mark_list = set(int(i, 16) for i in fdir_scanner.findall(out))
> +                mark_list = set(int(i, CVL_TXQ_RXQ_NUMBER) for i in
> + fdir_scanner.findall(out))
>                  verify(all([i == check_param["mark_id"] for i in mark_list]),
>                         "failed: some packet mark id of %s not match" % mark_list)
>              else:
> @@ -424,11 +426,11 @@ def check_mark(out, pkt_num, check_param,
> stats=True):
>  def verify_directed_by_rss(out, rxq=64, stats=True):
>      p = re.compile('RSS\shash=(\w+)\s-\sRSS\squeue=(\w+)')
>      pkt_info = p.findall(out)
> -    pkt_queue = set([int(i[1], 16) for i in pkt_info])
> +    pkt_queue = set([int(i[1], CVL_TXQ_RXQ_NUMBER) for i in pkt_info])
>      if stats:
> -        verify(all([int(i[0], 16) % rxq == int(i[1], 16) for i in pkt_info]), 'some pkt not
> directed by rss.')
> +        verify(all([int(i[0], CVL_TXQ_RXQ_NUMBER) % rxq == int(i[1],
> + CVL_TXQ_RXQ_NUMBER) for i in pkt_info]), 'some pkt not directed by
> + rss.')
>      else:
> -        verify(not any([int(i[0], 16) % rxq == int(i[1], 16) for i in pkt_info]), 'some
> pkt directed by rss')
> +        verify(not any([int(i[0], CVL_TXQ_RXQ_NUMBER) % rxq ==
> + int(i[1], CVL_TXQ_RXQ_NUMBER) for i in pkt_info]), 'some pkt directed
> + by rss')
>      return pkt_queue
> 
> 
> @@ -458,23 +460,23 @@ def check_iavf_fdir_queue(out, pkt_num,
> check_param, stats=True):
>                  verify(not any(q == queue for q in res_queue), "fail: queue id should not
> matched, expect queue %s, got %s" % (queue, res_queue))
>                  print((GREEN("pass: queue id %s not matched" % res_queue)))
>              elif isinstance(queue, list):
> -                verify_iavf_fdir_directed_by_rss(out, rxq=16, stats=True)
> +                verify_iavf_fdir_directed_by_rss(out,
> + rxq=CVL_TXQ_RXQ_NUMBER, stats=True)
>                  print((GREEN("pass: queue id %s not matched" % res_queue)))
>              else:
>                  raise Exception("wrong action value, expect queue_index or
> queue_group")
>      else:
>          raise Exception("got wrong output, not match pattern %s" % p.pattern)
> 
> -def verify_iavf_fdir_directed_by_rss(out, rxq=16, stats=True):
> +def verify_iavf_fdir_directed_by_rss(out, rxq=CVL_TXQ_RXQ_NUMBER,
> stats=True):
>      p = re.compile("RSS hash=(0x\w+) - RSS queue=(0x\w+)")
>      pkt_info = p.findall(out)
>      if stats:
>          for i in pkt_info:
> -            verify((int(i[0],16) % rxq == int(i[1],16)), "some packets are not directed
> by RSS")
> +            verify((int(i[0],CVL_TXQ_RXQ_NUMBER) % rxq ==
> + int(i[1],CVL_TXQ_RXQ_NUMBER)), "some packets are not directed by RSS")
>              print(GREEN("pass: queue id %s is redirected by RSS hash value %s" %
> (i[1], i[0])))
>      else:
>          for i in pkt_info:
> -            verify((int(i[0],16) % rxq != int(i[1],16)), "some packets are not directed
> by RSS")
> +            verify((int(i[0],CVL_TXQ_RXQ_NUMBER) % rxq !=
> + int(i[1],CVL_TXQ_RXQ_NUMBER)), "some packets are not directed by RSS")
> 
>  def check_iavf_fdir_passthru(out, pkt_num, check_param, stats=True):
>      # check the actual queue is distributed by RSS @@ -485,7 +487,7 @@ def
> check_iavf_fdir_passthru(out, pkt_num, check_param, stats=True):
>      p = re.compile('RSS\shash=(\w+)\s-\sRSS\squeue=(\w+)')
>      pkt_hash = p.findall(out)
>      verify(pkt_num == len(pkt_hash), "fail: got wrong number of passthru packets,
> expect passthru packet number %s, got %s." % (pkt_num, len(pkt_hash)))
> -    verify_iavf_fdir_directed_by_rss(out, rxq=16, stats=True)
> +    verify_iavf_fdir_directed_by_rss(out, rxq=CVL_TXQ_RXQ_NUMBER,
> + stats=True)
> 
>  def check_iavf_fdir_mark(out, pkt_num, check_param, stats=True):
>      mark_scanner = "FDIR matched ID=(0x\w+)"
> @@ -499,7 +501,7 @@ def check_iavf_fdir_mark(out, pkt_num, check_param,
> stats=True):
>              mark_list = [i for i in res]
>              print("mark list is: ", mark_list)
>              verify(len(res) == pkt_num, "get wrong number of packet with mark_id")
> -            verify(all([int(i, 16) == check_param["mark_id"] for i in res]),
> +            verify(all([int(i, CVL_TXQ_RXQ_NUMBER) ==
> + check_param["mark_id"] for i in res]),
>                          "failed: some packet mark id of %s not match" % mark_list)
>              if check_param.get("queue") is not None:
>                  check_iavf_fdir_queue(out, pkt_num, check_param, stats) @@ -629,7
> +631,7 @@ def check_iavf_packets_rss_queue(out, count, rss_match=True):
>                  packet_sumnum = packet_sumnum + int(packet_num)
> 
>      if rss_match:
> -        if queue_flag == 16 and packet_sumnum == count:
> +        if queue_flag == CVL_TXQ_RXQ_NUMBER and packet_sumnum == count:
>              log_msg = "Packets has send to %s queues" % queue_flag
>              return True, log_msg
>          else:
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-20  6:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-03  5:53 [dts] [PATCH V1] tests/iavf_fdir: Adaptation regression modification ChenBo
2020-07-03  7:22 ` [dts] [WARNING: UNSCANNABLE EXTRACTION FAILED][WARNING: UNSCANNABLE EXTRACTION FAILED]RE: " Chen, BoX C
2020-07-20  6:55 ` [dts] " Tu, Lijuan

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).