From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B205BDE3 for ; Thu, 24 Jan 2019 03:59:04 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jan 2019 18:59:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,514,1539673200"; d="scan'208";a="128418837" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.240.176.135]) by orsmga002.jf.intel.com with ESMTP; 23 Jan 2019 18:59:02 -0800 From: zhuwenhui To: dts@dpdk.org Cc: zhuwenhui Date: Thu, 24 Jan 2019 11:02:41 +0800 Message-Id: <1548298961-26285-1-git-send-email-wenhuix.zhu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH V3] tests/dual_vlan check if the link is up X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2019 02:59:05 -0000 The link maybe up failed after "start", make sure the link is really up, and then proceed to the next step. Signed-off-by: zhuwenhui --- V2: add show_port() V3: 1. update show_port() to check_link_up() 2. in check_link_up(), add the solution to show the port_id which is still down 3. use check_link_up() in test cases tests/TestSuite_dual_vlan.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/TestSuite_dual_vlan.py b/tests/TestSuite_dual_vlan.py index 994ac42..d7fba3d 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,17 @@ class TestDualVlan(TestCase): else: self.verify("%s %s" % (mode, modeName[mode]) in out, "%s setting error" % mode) + def verify_link_up(self): + ports = self.dut.get_ports(self.nic) + for port_id in range(len(ports)): + out = self.dut.send_expect("show port info %s" % port_id, "testpmd> ") + 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 %s" % port_id, "testpmd> ") + port_time_up += 1 + self.verify("Link status: down" not in out, "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 +212,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.verify_link_up() 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 +231,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.verify_link_up() else: self.dut.send_expect('rx_vlan add %s %s' % (invlan, dutRxPortId), "testpmd> ") @@ -230,6 +244,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.verify_link_up() 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 +379,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.verify_link_up() self.vlan_send_packet() out = self.get_tcpdump_package() @@ -374,6 +390,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.verify_link_up() self.vlan_send_packet() out = self.get_tcpdump_package() -- 2.17.2