[dts] [PATCH v3] tests: Add verification after flushing rule to TestSuite_queue_region.py

Peng Yuan yuan.peng at intel.com
Thu Aug 23 11:50:19 CEST 2018


Add some verification after flushing rule.
Change some actions for fortpark card.
The packet not match any queue region rule will goes to queue region 0.

Signed-off-by: Peng Yuan <yuan.peng at intel.com>

diff --git a/tests/TestSuite_queue_region.py b/tests/TestSuite_queue_region.py
index 7315077..e971c46 100644
--- a/tests/TestSuite_queue_region.py
+++ b/tests/TestSuite_queue_region.py
@@ -135,8 +135,6 @@ class TestQueue_region(TestCase):
         elif (pkt_type == "ipv6_tcp"):
             pkt = Packet(pkt_type='IPv6_TCP')
             pkt.config_layer('ether', {'dst': mac, 'src': self.tester_mac})
-            if (self.nic in ["fortpark_TLV"]):
-                pkt.config_layer('tcp', {'flags': flags})
         elif (pkt_type == "ipv6_sctp"):
             pkt = Packet(pkt_type='IPv6_SCTP')
             pkt.config_layer('ether', {'dst': mac, 'src': self.tester_mac})
@@ -181,6 +179,7 @@ class TestQueue_region(TestCase):
         dump all queue region rules that have been created in memory and compare that total rules number with the given expected number
         to see if they are equal, as to get your conclusion after you have deleted any queue region rule entry.
         """
+        print out
         self.verify("error" not in out, "the queue region settings has error.")
         actual_QRnum = re.findall("region_id.*", out)
         actual_FTnum = re.findall("flowtype_num\D*(\d*).*", out)
@@ -196,9 +195,6 @@ class TestQueue_region(TestCase):
         self.verify(actual_UserPrioritynum == UP_num, "the UP number count error")
 
     def test_pctype_map_queue_region(self):
-        # clear the environment
-        self.dut.send_expect("set port 0 queue-region flush off", "testpmd> ")
-
         # set queue region on a port
         self.dut.send_expect("set port 0 queue-region region_id 0 queue_start_index 1 queue_num 1", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 1 queue_start_index 3 queue_num 2", "testpmd> ")
@@ -206,42 +202,40 @@ class TestQueue_region(TestCase):
         self.dut.send_expect("set port 0 queue-region region_id 3 queue_start_index 8 queue_num 2", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 4 queue_start_index 11 queue_num 4", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 5 queue_start_index 15 queue_num 1", "testpmd> ")
-        self.dut.send_expect("set port 0 queue-region region_id 6 queue_start_index 2 queue_num 1", "testpmd> ")
+        self.dut.send_expect("set port 0 queue-region region_id 6 queue_start_index 5 queue_num 1", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 7 queue_start_index 10 queue_num 1", "testpmd> ")
 
         # Set the mapping of flowtype to region index on a port
         self.dut.send_expect("set port 0 queue-region region_id 0 flowtype 31", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 1 flowtype 32", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 2 flowtype 33", "testpmd> ")
-        self.dut.send_expect("set port 0 queue-region region_id 3 flowtype 34", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 4 flowtype 35", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 6 flowtype 36", "testpmd> ")
-
-        # the default UDP packet configuration of fortpark is not consistent with fortville
-        if(self.nic in ["fortpark_TLV"]):
-            self.dut.send_expect("set port 0 queue-region region_id 2 flowtype 39", "testpmd> ")
-        else:
-            self.dut.send_expect("set port 0 queue-region region_id 2 flowtype 41", "testpmd> ")
+        self.dut.send_expect("set port 0 queue-region region_id 2 flowtype 41", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 3 flowtype 43", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 4 flowtype 44", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 5 flowtype 45", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 7 flowtype 46", "testpmd> ")
-        self.dut.send_expect("set port 0 queue-region region_id 1 flowtype 63", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region flush on", "testpmd> ")
 
+        # mapping table:
+        # region  |  queue       |  flowtype  |  packet_type
+        #   0     |  1           |  31        |  IPv4_UDP
+        #   1     |  3,4         |  32        |  IPv4_TCP_SYN
+        #   2     |  6,7         |  33,41     |  IPv4_TCP, IPv6_UDP
+        #   3     |  8,9         |  43        |  IPv6_TCP
+        #   4     |  11,12,13,14 |  35,44     |  IPv4_Other, IPv6_SCTP
+        #   5     |  15          |  45        |  IPv6_Other
+        #   6     |  5           |  36        |  Frag_IPv4
+        #   7     |  10          |  46        |  Frag_IPv6
         # send the packets and verify the results
         queue_region = ["1"]
         self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="udp")
 
         # fortville can't parse the TCP SYN type packet, fortpark can parse it.
-        # but you need to update hardware defined pctype to software defined
-        # flow type mapping table manully.
         if(self.nic in ["fortpark_TLV"]):
-            self.dut.send_expect("port config 0 pctype mapping update 32 1", "testpmd> ")
-            self.dut.send_expect("port config all rss 1", "testpmd> ")
             queue_region = ["3", "4"]
             self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="tcp", flags="S")
-            self.dut.send_expect("port config all rss all", "testpmd> ")
         else:
             queue_region = ["6", "7"]
             self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="tcp", flags="S")
@@ -249,17 +243,25 @@ class TestQueue_region(TestCase):
         queue_region = ["6", "7"]
         self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="tcp", flags="PA")
 
-        queue_region = ["8", "9"]
+        # not assign ipv4-sctp packet to any queue region, the packet to queue region 0.
+        queue_region = ["1"]
         self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="sctp", tag=1)
 
         queue_region = ["11", "12", "13", "14"]
         self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="ipv4")
 
-        queue_region = ["2"]
+        queue_region = ["5"]
         self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="ipv4", frag=1)
 
-        queue_region = ["8", "9"]
-        self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="ipv6_tcp", flags="PA")
+        # fortville can't parse the TCP SYN type packet, fortpark can parse it.
+        # default is SYN mode.
+        # not assign ipv4-tcp SYN packet to any queue region, the packet to queue region 0.
+        if(self.nic in ["fortpark_TLV"]):
+            queue_region = ["1"]
+            self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="ipv6_tcp")
+        else:
+            queue_region = ["8", "9"]
+            self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="ipv6_tcp")
 
         queue_region = ["11", "12", "13", "14"]
         self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="ipv6_sctp", tag=2)
@@ -270,7 +272,8 @@ class TestQueue_region(TestCase):
         queue_region = ["15"]
         self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="ipv6")
 
-        queue_region = ["3", "4"]
+        # not assign L2 packet to any queue region, the packet to queue region 0.
+        queue_region = ["1"]
         self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="L2", ethertype=0x88bb)
 
         queue_region = ["11", "12", "13", "14"]
@@ -279,17 +282,28 @@ class TestQueue_region(TestCase):
         # clear all the queue region configuration
         # check if there is 1 flow rule have been created
         out = self.dut.send_expect("show port 0 queue-region", "testpmd> ")
-        self.get_and_compare_rules(out, 8, 12, 0)
+        self.get_and_compare_rules(out, 8, 10, 0)
         self.dut.send_expect("set port 0 queue-region flush off", "testpmd> ")
         out = self.dut.send_expect("show port 0 queue-region", "testpmd> ")
         self.get_and_compare_rules(out, 0, 0, 0)
 
-    def test_up_map_queue_region(self):
-        # clear the environment
-        self.dut.send_expect("set port 0 queue-region flush off", "testpmd> ")
+        # confirm packet not to the same queue after flush all the queue region rull.
+        self.send_packet_pctype(mac=self.pf_mac, pkt_type="udp")
+        queue = self.get_queue_number()
+        self.verify(queue not in ["1"], "the queue regions have not been flushed clearly.")
+        self.send_packet_pctype(mac=self.pf_mac, pkt_type="sctp")
+        queue = self.get_queue_number()
+        self.verify(queue not in ["1"], "the queue regions have not been flushed clearly.")
+        self.send_packet_pctype(mac=self.pf_mac, pkt_type="ipv4")
+        queue = self.get_queue_number()
+        self.verify(queue not in ["10", "11", "12", "13"], "the queue regions have not been flushed clearly.")
+        self.send_packet_pctype(mac=self.pf_mac, pkt_type="ipv6_tcp")
+        queue = self.get_queue_number()
+        self.verify(queue not in ["8", "9"], "the queue regions have not been flushed clearly.")
 
+    def test_up_map_queue_region(self):
         # set queue region on a port
-        self.dut.send_expect("set port 0 queue-region region_id 0 queue_start_index 0 queue_num 1", "testpmd> ")
+        self.dut.send_expect("set port 0 queue-region region_id 0 queue_start_index 14 queue_num 2", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 6 queue_start_index 1 queue_num 8", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region region_id 2 queue_start_index 10 queue_num 4", "testpmd> ")
 
@@ -300,8 +314,16 @@ class TestQueue_region(TestCase):
         self.dut.send_expect("set port 0 queue-region UP 7 region_id 2", "testpmd> ")
         self.dut.send_expect("set port 0 queue-region flush on", "testpmd> ")
 
+        # mapping table:
+        # region  |  queue            |  User Priority
+        #   0     |  14,15            |  3
+        #   6     |  1,2,3,4,5,6,7,8  |  1
+        #   2     |  10,11,12,13      |  2,7
         # send the packets and verify the results
-        queue_region = ["0"]
+        queue_region = ["14", "15"]
+        self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="udp", prio=4)
+
+        queue_region = ["14", "15"]
         self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="udp", prio=3)
 
         queue_region = ["1", "2", "3", "4", "5", "6", "7", "8"]
@@ -318,7 +340,7 @@ class TestQueue_region(TestCase):
 
         self.send_packet_pctype(mac=self.pf_mac, pkt_type="udp")
         queue = self.get_queue_number()
-        self.verify(queue not in ["10", "11", "12", "13"], "the packet doesn't enter the expected queue.")
+        self.verify(queue in ["14", "15"], "the packet doesn't enter the expected queue.")
 
         # clear all the queue region configuration
         out = self.dut.send_expect("show port 0 queue-region", "testpmd> ")
@@ -327,16 +349,16 @@ class TestQueue_region(TestCase):
         out = self.dut.send_expect("show port 0 queue-region", "testpmd> ")
         self.get_and_compare_rules(out, 0, 0, 0)
 
-        # confirm packet can't into the previous queue_region
+        # confirm packet not to the same queue after flush all the queue region rull.
         self.send_packet_up(mac=self.pf_mac, pkt_type="udp", prio=7)
         queue = self.get_queue_number()
         self.verify(queue not in ["10", "11", "12", "13"], "the queue regions have not been flushed clearly.")
+        self.send_packet_up(mac=self.pf_mac, pkt_type="tcp", prio=2)
+        queue = self.get_queue_number()
+        self.verify(queue not in ["10", "11", "12", "13"], "the queue regions have not been flushed clearly.")
 
     def test_boundary_values(self):
         # boundary value testing of "Set a queue region on a port"
-        # clear the environment
-        self.dut.send_expect("set port 0 queue-region flush off", "testpmd> ")
-
         # the following parameters can be set successfully
         outstring = self.dut.send_expect("set port 0 queue-region region_id 0 queue_start_index 0 queue_num 16", "testpmd> ")
         self.verify("error" not in outstring, "boundary value check failed")
-- 
2.7.4



More information about the dts mailing list