[dts] [PATCH] tests: change checking method for queue-region rule.

Peng Yuan yuan.peng at intel.com
Fri Dec 28 12:28:24 CET 2018


change the checking method of result when flushed the queue-region rules.

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 e971c46..5f4dbf4 100644
--- a/tests/TestSuite_queue_region.py
+++ b/tests/TestSuite_queue_region.py
@@ -109,6 +109,7 @@ class TestQueue_region(TestCase):
             self.send_packet_up(mac, pkt_type, prio)
         queue = self.get_queue_number()
         self.verify(queue in queue_region, "the packet doesn't enter the expected queue region.")
+        return queue
 
     def send_packet_pctype(self, mac, pkt_type="udp", frag=0, flags=None, tag=None, ethertype=None):
         """
@@ -230,7 +231,7 @@ class TestQueue_region(TestCase):
         #   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")
+        queue_udp = 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.
         if(self.nic in ["fortpark_TLV"]):
@@ -245,10 +246,10 @@ class TestQueue_region(TestCase):
 
         # 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_sctp = 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_ipv4 = self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="ipv4")
 
         queue_region = ["5"]
         self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="ipv4", frag=1)
@@ -258,10 +259,10 @@ class TestQueue_region(TestCase):
         # 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")
+            queue_ipv6tcp = 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_ipv6tcp = 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)
@@ -287,19 +288,19 @@ 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 not to the same queue after flush all the queue region rull.
+        # confirm packet not to the same queue after flush all the queue regions 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.verify(queue != queue_udp, "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.verify(queue != queue_sctp, "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.verify(queue != queue_ipv4, "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.")
+        self.verify(queue != queue_ipv6tcp, "the queue regions have not been flushed clearly.")
 
     def test_up_map_queue_region(self):
         # set queue region on a port
@@ -330,13 +331,13 @@ class TestQueue_region(TestCase):
         self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="ipv6_udp", prio=1)
 
         queue_region = ["10", "11", "12", "13"]
-        self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="tcp", prio=2)
+        queue_tcp = self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="tcp", prio=2)
 
         queue_region = ["10", "11", "12", "13"]
         self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="tcp", prio=7)
 
         queue_region = ["10", "11", "12", "13"]
-        self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="udp", prio=7)
+        queue_udp = self.send_and_check(queue_region, mac=self.pf_mac, pkt_type="udp", prio=7)
 
         self.send_packet_pctype(mac=self.pf_mac, pkt_type="udp")
         queue = self.get_queue_number()
@@ -352,10 +353,10 @@ class TestQueue_region(TestCase):
         # 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.verify(queue != queue_udp, "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.")
+        self.verify(queue != queue_tcp, "the queue regions have not been flushed clearly.")
 
     def test_boundary_values(self):
         # boundary value testing of "Set a queue region on a port"
-- 
2.5.0



More information about the dts mailing list