[dts] [PATCH V1] tests/dual_vlan check if the port is up

zhuwenhui wenhuix.zhu at intel.com
Sat Dec 29 02:46:39 CET 2018


The port is down when the packet is sent. After "start", 
make sure the port is really open, and then proceed to the next step.

Signed-off-by: zhuwenhui <wenhuix.zhu at intel.com>
---
 tests/TestSuite_dual_vlan.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/TestSuite_dual_vlan.py b/tests/TestSuite_dual_vlan.py
index 994ac42..374c2f5 100644
--- a/tests/TestSuite_dual_vlan.py
+++ b/tests/TestSuite_dual_vlan.py
@@ -40,6 +40,7 @@ Test the support of Dual VLAN Offload Features by Poll Mode Drivers.
 import utils
 import random
 import re
+import time
 
 txvlan = 3
 outvlan = 1
@@ -182,6 +183,16 @@ class TestDualVlan(TestCase):
             else:
                 self.verify("%s %s" % (mode, modeName[mode]) in out, "%s setting error" % mode)
 
+    def show_port(self):
+        out = self.dut.send_expect("show port info all", "testpmd> ")
+        global port_time_up
+        port_time_up = 0
+        while (port_time_up <= 10) and ("Link status: down" in out):
+            time.sleep(1)
+            out = self.dut.send_expect("show port info all", "testpmd> ")
+            port_time_up += 1
+        self.verify("Link status: down" not in out, "Port open failed")
+
     def multimode_test(self, caseIndex):
         """
         Setup Strip/Filter/Extend/Insert enable/disable for synthetic test.
@@ -200,6 +211,7 @@ class TestDualVlan(TestCase):
             self.dut.send_expect('tx_vlan set %s %s' % (dutTxPortId, txvlan), "testpmd> ")
             self.dut.send_expect('port start all', "testpmd> ")
             self.dut.send_expect('start', "testpmd> ")
+            self.show_port()
 
         configMode = "Strip %s, filter %s 0x1, extend %s, insert %s" % (temp[0], temp[1], temp[2], "on" if (caseDef & txCase) != 0 else "off")
 
@@ -218,6 +230,7 @@ class TestDualVlan(TestCase):
                 self.dut.send_expect('tx_vlan reset %s' % dutTxPortId, "testpmd> ")
                 self.dut.send_expect('port start all', "testpmd> ")
                 self.dut.send_expect('start', "testpmd> ")
+                self.show_port()
 
         else:
             self.dut.send_expect('rx_vlan add %s %s' % (invlan, dutRxPortId), "testpmd> ")
@@ -230,6 +243,7 @@ class TestDualVlan(TestCase):
                 self.dut.send_expect('tx_vlan reset %s' % dutTxPortId, "testpmd> ")
                 self.dut.send_expect('port start all', "testpmd> ")
                 self.dut.send_expect('start', "testpmd> ")
+                self.show_port()
             self.dut.send_expect('rx_vlan rm %s %s' % (invlan, dutRxPortId), "testpmd> ")
             self.dut.send_expect('rx_vlan rm %s %s' % (outvlan, dutRxPortId), "testpmd> ")
 
-- 
2.17.2



More information about the dts mailing list