test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1] tests/TestSuite_cvl_dcf_switch_filter.py: modify max_rule_number test case
@ 2020-07-28 13:41 Nannan Lu
  2020-08-12  6:29 ` Tu, Lijuan
  0 siblings, 1 reply; 2+ messages in thread
From: Nannan Lu @ 2020-07-28 13:41 UTC (permalink / raw)
  To: dts; +Cc: Nannan Lu

Modify max_rule_number test case, since the max switch filter rule number
which can be created will be changed if firmware or kernel driver changed.

Signed-off-by: Nannan Lu <nannan.lu@intel.com>
---
 tests/TestSuite_cvl_dcf_switch_filter.py | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/tests/TestSuite_cvl_dcf_switch_filter.py b/tests/TestSuite_cvl_dcf_switch_filter.py
index afb6a28..c15fd31 100644
--- a/tests/TestSuite_cvl_dcf_switch_filter.py
+++ b/tests/TestSuite_cvl_dcf_switch_filter.py
@@ -855,7 +855,7 @@ tv_add_two_rules_with_different_input_set_different_vf_id = {
                   "expect_results":{"expect_pkts":[0, 0]}}
 }
 
-class SwitchFilterTest(TestCase):
+class CVLDCFSwitchFilterTest(TestCase):
 
     def bind_nics_driver(self, ports, driver=""):
         # modprobe vfio driver
@@ -1677,10 +1677,29 @@ class SwitchFilterTest(TestCase):
         rule_list_num = list(range(0, 32563))
         rule_list = [str(x) for x in rule_list_num]
         self.check_switch_filter_rule_list(0, rule_list)
-        #create the 32564th rule
-        rule = "flow create 0 ingress pattern eth / ipv4 src is 192.168.127.178 / end actions vf id 1 / end"
-        out = self.dut.send_expect(rule, "testpmd> ", timeout=2)
-        self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule failed to create.")
+        #create other rules to make switch filter table full
+        m = i
+        t = j
+        p = re.compile(r"Flow rule #(\d+) created")
+        switch_table_full_flag = False
+        count = 0
+        for i in range(m,255):
+            for j in range(t,255):
+                rule = 'flow create 0 ingress pattern eth / ipv4 src is 192.168.%d.%d / end actions vf id 1 / end \n' % (i, j)
+                matched_packet = 'Ether(dst="68:05:ca:8d:ed:a8")/IP(src="192.168.%d.%d")/TCP(sport=25,dport=23)/Raw("X"*480)' % (i, j)
+                out = self.dut.send_expect(rule, "testpmd> ", timeout=2)  #create a rule
+                m1 = p.search(out)
+                if m1:
+                    rule_list.append(m1.group(1))
+                    tv_max_rule_number["matched"]["scapy_str"].append(matched_packet)
+                    count += 1
+                else:
+                    self.verify("Failed to create flow" in out, "Log not provide a friendly output to indicate that the rule failed to create.")
+                    switch_table_full_flag = True
+                    break
+            if switch_table_full_flag:
+                break
+        tv_max_rule_number["matched"]["expect_results"]["expect_pkts"] += count
         #check the rule list
         self.check_switch_filter_rule_list(0, rule_list)
         #send matched packets and check
-- 
2.7.4


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

end of thread, other threads:[~2020-08-12  6:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28 13:41 [dts] [PATCH V1] tests/TestSuite_cvl_dcf_switch_filter.py: modify max_rule_number test case Nannan Lu
2020-08-12  6:29 ` 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).