From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DDAECA0C41; Sat, 20 Nov 2021 08:50:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A20FE40395; Sat, 20 Nov 2021 08:50:58 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 1CC6740143 for ; Sat, 20 Nov 2021 08:50:55 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10173"; a="234371399" X-IronPort-AV: E=Sophos;i="5.87,250,1631602800"; d="scan'208";a="234371399" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2021 23:50:55 -0800 X-IronPort-AV: E=Sophos;i="5.87,250,1631602800"; d="scan'208";a="508202527" Received: from unknown (HELO localhost.localdomain) ([10.240.183.163]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 19 Nov 2021 23:50:53 -0800 From: Yu Jiang To: xueqin.lin@intel.com, dts@dpdk.org Cc: Yu Jiang Subject: [dts][PATCH V1] Optimize script: wait_link_status_up after start testpmd Date: Sat, 20 Nov 2021 15:50:31 +0800 Message-Id: <1637394631-29857-1-git-send-email-yux.jiang@intel.com> X-Mailer: git-send-email 2.7.4 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org tests/ddp_gtp_qregion&dual_vlan&link_flowctrl&nvgre&qos_api optimize script: wait_link_status_up after start testpmd or before send_packets to enhance script robustness Signed-off-by: Yu Jiang --- tests/TestSuite_ddp_gtp_qregion.py | 2 ++ tests/TestSuite_dual_vlan.py | 31 ++++++------------------------- tests/TestSuite_link_flowctrl.py | 5 ++++- tests/TestSuite_nvgre.py | 5 +++-- tests/TestSuite_qos_api.py | 3 ++- 5 files changed, 17 insertions(+), 29 deletions(-) diff --git a/tests/TestSuite_ddp_gtp_qregion.py b/tests/TestSuite_ddp_gtp_qregion.py index e870db3..1fbb05c 100644 --- a/tests/TestSuite_ddp_gtp_qregion.py +++ b/tests/TestSuite_ddp_gtp_qregion.py @@ -322,6 +322,7 @@ class TestDdpGtpQregion(TestCase): self.dut_testpmd.execute_cmd('set fwd rxonly') self.dut_testpmd.execute_cmd('set verbose 1') self.dut_testpmd.execute_cmd('start') + self.dut_testpmd.wait_link_status_up(self.dut_ports[0]) qnum = self.send_verify_fd(flowtype, keywords, 'word_opt') self.verify(qnum == 0, "Receive packet from wrong queue!!!") self.raw_packet_generate(flowtype) @@ -385,6 +386,7 @@ class TestDdpGtpQregion(TestCase): self.dut_testpmd.execute_cmd('set fwd rxonly') self.dut_testpmd.execute_cmd('set verbose 1') self.dut_testpmd.execute_cmd('start') + self.dut_testpmd.wait_link_status_up(self.dut_ports[0]) self.send_and_verify(flowtype, qmin, qmax, keyword) def test_outer_dst_contrl_gtpcq(self): diff --git a/tests/TestSuite_dual_vlan.py b/tests/TestSuite_dual_vlan.py index 0f9247f..f7dbcf6 100644 --- a/tests/TestSuite_dual_vlan.py +++ b/tests/TestSuite_dual_vlan.py @@ -87,18 +87,14 @@ class TestDualVlan(TestCase): global dutTxPortId # Based on h/w type, choose how many ports to use - ports = self.dut.get_ports(self.nic) - self.verify(len(ports) >= 2, "Insufficient ports") - self.ports_socket = self.dut.get_numa_id(ports[0]) + self.dut_ports = self.dut.get_ports(self.nic) + self.verify(len(self.dut_ports) >= 2, "Insufficient ports") + self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) cores = self.dut.get_core_list('1S/2C/2T') coreMask = utils.create_mask(cores) - - ports = self.dut.get_ports(self.nic) - valports = [_ for _ in ports if self.tester.get_local_port(_) != -1] - + valports = [_ for _ in self.dut_ports if self.tester.get_local_port(_) != -1] portMask = utils.create_mask(valports[:2]) - dutRxPortId = valports[0] dutTxPortId = valports[1] @@ -141,7 +137,8 @@ class TestDualVlan(TestCase): vlanString += 'IP(len=46)],iface="%s", count=4)' % txItf self.tester.scapy_append(vlanString) - + # check link status before send pkg + self.pmdout.wait_link_status_up(self.dut_ports[0]) self.tester.scapy_execute() def mode_config(self, **modeName): @@ -185,17 +182,6 @@ 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. @@ -217,7 +203,6 @@ 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") @@ -236,7 +221,6 @@ 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> ") @@ -249,7 +233,6 @@ 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> ") @@ -378,7 +361,6 @@ 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() @@ -389,7 +371,6 @@ 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() diff --git a/tests/TestSuite_link_flowctrl.py b/tests/TestSuite_link_flowctrl.py index a102288..96ba231 100644 --- a/tests/TestSuite_link_flowctrl.py +++ b/tests/TestSuite_link_flowctrl.py @@ -134,6 +134,7 @@ class TestLinkFlowctrl(TestCase): self.dut.send_expect("set fwd csum", "testpmd> ") self.dut.send_expect("start", "testpmd> ", 60) + self.pmdout.wait_link_status_up(self.dutPorts[0]) def pause_frame_loss_test(self, rx_flow_control='off', tx_flow_control='off', @@ -171,6 +172,7 @@ class TestLinkFlowctrl(TestCase): return port_stats def send_packets(self, frame): + self.pmdout.wait_link_status_up(self.dutPorts[0]) tester_tx_port = self.tester.get_local_port(self.rx_port) tx_interface = self.tester.get_interface(tester_tx_port) tester_rx_port = self.tester.get_local_port(self.tx_port) @@ -530,7 +532,7 @@ class TestLinkFlowctrl(TestCase): self.dut.send_expect("port stop 0", "testpmd> ") self.dut.send_expect("port start 0", "testpmd> ", 60) self.dut.send_expect("start", "testpmd> ", 60) - + self.pmdout.wait_link_status_up(self.dutPorts[0]) tgenInput = self.get_tgen_input() result = self.start_traffic(tgenInput) self.logger.info("Packet loss: %.3f" % result) @@ -555,6 +557,7 @@ class TestLinkFlowctrl(TestCase): self.dut.send_expect("port stop 0", "testpmd> ") self.dut.send_expect("port start 0", "testpmd> ", 60) self.dut.send_expect("start", "testpmd> ", 60) + self.pmdout.wait_link_status_up(self.dutPorts[0]) result = self.start_traffic(tgenInput) self.logger.info("Packet loss: %.3f" % result) if self.nic == "niantic": diff --git a/tests/TestSuite_nvgre.py b/tests/TestSuite_nvgre.py index 63b95d1..4472d20 100644 --- a/tests/TestSuite_nvgre.py +++ b/tests/TestSuite_nvgre.py @@ -51,7 +51,6 @@ from scapy.layers.sctp import SCTP, SCTPChunkData from scapy.route import * from scapy.sendrecv import sniff from scapy.utils import rdpcap, socket, struct, wrpcap - import framework.utils as utils from framework.packet import IncreaseIP, IncreaseIPv6 from framework.pmd_output import PmdOutput @@ -499,6 +498,7 @@ class TestNvgre(TestCase): config.outer_mac_dst = self.dut_rx_port_mac config.create_pcap() self.dut.send_expect("start", "testpmd>", 10) + self.pmdout.wait_link_status_up(self.dut_rx_port) config.send_pcap() # check whether detect nvgre type out = self.dut.get_session_output() @@ -523,6 +523,7 @@ class TestNvgre(TestCase): # send nvgre packet config.create_pcap() self.dut.send_expect("start", "testpmd>", 10) + self.pmdout.wait_link_status_up(self.dut_rx_port) config.send_pcap() out = self.dut.get_session_output() print(out) @@ -595,7 +596,7 @@ class TestNvgre(TestCase): self.logger.info("nvgre packet %s" % arg_str) out = self.dut.send_expect("start", "testpmd>", 10) - + self.pmdout.wait_link_status_up(self.dut_rx_port) # create pcap file with supplied arguments config = NvgreTestConfig(self, **kwargs) config.outer_mac_dst = self.dut_rx_port_mac diff --git a/tests/TestSuite_qos_api.py b/tests/TestSuite_qos_api.py index 70b3d0d..82c4d0e 100644 --- a/tests/TestSuite_qos_api.py +++ b/tests/TestSuite_qos_api.py @@ -120,6 +120,7 @@ class TestQosApi(TestCase): self.dut.send_expect('port start all', 'testpmd> ') def scapy_send_packet_verify(self, n): + self.host_testpmd.wait_link_status_up(self.dut_ports[0]) self.tester.scapy_foreground() dmac = self.dut.get_mac_address(P0) queues_4tc = [0, 32, 64, 96] @@ -220,7 +221,7 @@ class TestQosApi(TestCase): self.perf_test(n) def perf_test(self, n): - + self.host_testpmd.wait_link_status_up(self.dut_ports[0]) dmac = self.dut.get_mac_address(self.dut_ports[0]) pkts = [] for i in range(n): -- 2.7.4