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

Tu, Lijuan lijuan.tu at intel.com
Fri Jan 11 02:32:28 CET 2019


Could you change an accurate name of show_port? The readers can't get your objective through your function name.
Through your function codes,  I got you want to verify the link status, so suggest you call it verify_link_up

> -----Original Message-----
> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of zhuwenhui
> Sent: Saturday, December 29, 2018 4:21 PM
> To: dts at dpdk.org
> Cc: Zhu, WenhuiX <wenhuix.zhu at intel.com>
> Subject: [dts] [PATCH V2] tests/dual_vlan check if the port is up
> 
> 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 | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/tests/TestSuite_dual_vlan.py b/tests/TestSuite_dual_vlan.py index
> 994ac42..cbb87d4 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")
[Lijuan] Port open and link status are two different concepts, suggest change to "Port %s Link down, please check your link" % port_id
> +
>      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> ")
> 
> @@ -364,6 +378,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()
> 
>          self.vlan_send_packet()
>          out = self.get_tcpdump_package() @@ -374,6 +389,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.vlan_send_packet()
>          out = self.get_tcpdump_package()
> --
> 2.17.2



More information about the dts mailing list