test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts][PATCH V1] Optimize script: wait_link_status_up after start testpmd
@ 2021-11-20  7:50 Yu Jiang
  0 siblings, 0 replies; 8+ messages in thread
From: Yu Jiang @ 2021-11-20  7:50 UTC (permalink / raw)
  To: xueqin.lin, dts; +Cc: Yu Jiang

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 <yux.jiang@intel.com>
---
 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


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [dts][PATCH V1] Optimize script: wait_link_status_up after start testpmd
@ 2021-11-24  8:33 Yu Jiang
  2021-11-30  3:28 ` Tu, Lijuan
  0 siblings, 1 reply; 8+ messages in thread
From: Yu Jiang @ 2021-11-24  8:33 UTC (permalink / raw)
  To: xueqin.lin, dts; +Cc: Yu Jiang

optimize script: checksum_offload/flow_classify_softnic/nvgre/vlan/vlan_ethertype_config/vxlan,
wait_link_status_up after start testpmd or before send_packets to enhance script robustness

Signed-off-by: Yu Jiang <yux.jiang@intel.com>
---
 tests/TestSuite_checksum_offload.py      |  4 ++--
 tests/TestSuite_flow_classify_softnic.py |  2 ++
 tests/TestSuite_nvgre.py                 |  5 +++--
 tests/TestSuite_vlan.py                  |  1 +
 tests/TestSuite_vlan_ethertype_config.py |  2 +-
 tests/TestSuite_vxlan.py                 | 18 +++++++++++-------
 6 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py
index 3338e33..f8b26ef 100644
--- a/tests/TestSuite_checksum_offload.py
+++ b/tests/TestSuite_checksum_offload.py
@@ -671,7 +671,7 @@ class TestChecksumOffload(TestCase):
         self.tester.send_expect("scapy", ">>>")
         self.checksum_enablehw(self.dut_ports[0])
         self.dut.send_expect("start", "testpmd>")
-
+        self.pmdout.wait_link_status_up(self.dut_ports[0])
         verification_errors: List[VerifyFailure] = []
 
         iface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))
@@ -701,7 +701,7 @@ class TestChecksumOffload(TestCase):
     def test_hardware_checksum_check_ip_tx(self):
         self.checksum_enablehw(self.dut_ports[0])
         self.dut.send_expect("start", "testpmd>")
-
+        self.pmdout.wait_link_status_up(self.dut_ports[0])
         verification_errors: List[VerifyFailure] = []
 
         iface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))
diff --git a/tests/TestSuite_flow_classify_softnic.py b/tests/TestSuite_flow_classify_softnic.py
index a2c15dc..7b6642d 100644
--- a/tests/TestSuite_flow_classify_softnic.py
+++ b/tests/TestSuite_flow_classify_softnic.py
@@ -179,6 +179,7 @@ class TestFlowClassifySoftnic(TestCase):
         Sent pkts that read from the pcap_file.
         Return the sniff pkts.
         """
+        self.pmdout.wait_link_status_up(self.dut_ports[0])
         tx_port = self.tester.get_local_port(self.dut_ports[from_port%self.port_num])
         rx_port = self.tester.get_local_port(self.dut_ports[to_port%self.port_num])
 
@@ -283,6 +284,7 @@ class TestFlowClassifySoftnic(TestCase):
         """
         Sends continuous packets.
         """
+        self.pmdout.wait_link_status_up(self.dut_ports[0])
         self.tester.scapy_foreground()
         time.sleep(2)
         if src_dst == "src":
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_vlan.py b/tests/TestSuite_vlan.py
index b8cbf8c..8318b76 100644
--- a/tests/TestSuite_vlan.py
+++ b/tests/TestSuite_vlan.py
@@ -90,6 +90,7 @@ class TestVlan(TestCase):
         """
         Send $num of packets to portid, if vid is -1, it means send a packet which does not include a vlan id.
         """
+        self.pmdout.wait_link_status_up(dutRxPortId)
         # The package stream : testTxPort->dutRxPort->dutTxport->testRxPort
         port = self.tester.get_local_port(dutRxPortId)
         self.txItf = self.tester.get_interface(port)
diff --git a/tests/TestSuite_vlan_ethertype_config.py b/tests/TestSuite_vlan_ethertype_config.py
index 5e3ed81..fc0d494 100644
--- a/tests/TestSuite_vlan_ethertype_config.py
+++ b/tests/TestSuite_vlan_ethertype_config.py
@@ -106,7 +106,7 @@ class TestVlanEthertypeConfig(TestCase):
         """
         if vid is -1, it means send pakcage not include vlan id.
         """
-
+        self.pmdout.wait_link_status_up(dutRxPortId)
         self.tpid_ori_file = "/tmp/tpid_ori.pcap"
         self.tpid_new_file = "/tmp/tpid_new.pcap"
         self.tester.send_expect("rm -rf /tmp/tpid_ori.pcap", "# ")
diff --git a/tests/TestSuite_vxlan.py b/tests/TestSuite_vxlan.py
index 1442578..9605c89 100644
--- a/tests/TestSuite_vxlan.py
+++ b/tests/TestSuite_vxlan.py
@@ -472,8 +472,8 @@ class TestVxlan(TestCase):
         config.outer_mac_dst = self.dut_port_mac
         config.create_pcap()
         self.dut.send_expect("start", "testpmd>", 10)
+        self.pmdout.wait_link_status_up(self.dut_port)
         config.send_pcap(self.tester_iface)
-
         # check whether detect vxlan type
         out = self.dut.get_session_output(timeout=2)
         print(out)
@@ -572,6 +572,7 @@ class TestVxlan(TestCase):
         # send vxlan packet
         config.create_pcap()
         self.dut.send_expect("start", "testpmd>", 10)
+        self.pmdout.wait_link_status_up(self.dut_port)
         config.send_pcap(self.tester_iface)
         out = self.dut.get_session_output(timeout=2)
         print(out)
@@ -606,7 +607,7 @@ class TestVxlan(TestCase):
         self.dut.send_expect("set verbose 1", "testpmd>", 10)
         self.enable_vxlan(self.dut_port)
         self.enable_vxlan(self.recv_port)
-
+        self.pmdout.wait_link_status_up(self.dut_port)
         # check normal packet
         self.send_and_detect(outer_udp_dst=1234)
         # check vxlan + UDP inner packet
@@ -642,7 +643,7 @@ class TestVxlan(TestCase):
         self.dut.send_expect("set verbose 1", "testpmd>", 10)
         self.enable_vxlan(self.dut_port)
         self.enable_vxlan(self.recv_port)
-
+        self.pmdout.wait_link_status_up(self.dut_port)
         # check normal ipv6 packet
         self.send_and_detect(outer_ip6_src="FE80:0:0:0:0:0:0:0",
                              outer_ip6_dst="FE80:0:0:0:0:0:0:1",
@@ -692,7 +693,7 @@ class TestVxlan(TestCase):
 
         self.enable_vxlan(self.dut_port)
         self.enable_vxlan(self.recv_port)
-
+        self.pmdout.wait_link_status_up(self.dut_port)
         # check normal packet + ip checksum invalid
         self.send_and_check(outer_ip_invalid=1, outer_udp_dst=1234)
         # check vxlan packet + inner ip checksum invalid
@@ -754,6 +755,7 @@ class TestVxlan(TestCase):
         self.dut.send_expect("set fwd csum", "testpmd>", 10)
         self.csum_set_type('outer-ip', self.recv_port)
         self.csum_set_type('udp', self.recv_port)
+        self.csum_set_type('outer-udp', self.recv_port)
         self.csum_set_type('tcp', self.recv_port)
         self.csum_set_type('sctp', self.recv_port)
         self.dut.send_expect("csum parse-tunnel on %d" %
@@ -761,7 +763,7 @@ class TestVxlan(TestCase):
 
         self.enable_vxlan(self.dut_port)
         self.enable_vxlan(self.recv_port)
-
+        self.pmdout.wait_link_status_up(self.dut_port)
         # check normal ipv6 packet
         self.send_and_check(outer_ip6_src="FE80:0:0:0:0:0:0:0",
                             outer_ip6_dst="FE80:0:0:0:0:0:0:1")
@@ -821,7 +823,7 @@ class TestVxlan(TestCase):
         self.dut.send_expect("set verbose 1", "testpmd>", 10)
         self.enable_vxlan(self.dut_port)
         self.enable_vxlan(self.recv_port)
-
+        self.pmdout.wait_link_status_up(self.dut_port)
         config = VxlanTestConfig(self)
         config_vlan = VxlanTestConfig(self, inner_vlan=1)
         config.outer_mac_dst = self.dut_port_mac
@@ -892,6 +894,7 @@ class TestVxlan(TestCase):
 
         self.enable_vxlan(self.dut_port)
         self.enable_vxlan(self.recv_port)
+        self.pmdout.wait_link_status_up(self.dut_port)
         rule = 'flow create {} ingress pattern eth / ipv4 / udp / vxlan vni is {} / eth dst is {} / end actions pf ' \
                '/ queue index {} / end'.format(self.dut_port,
                                                config.vni,
@@ -1048,7 +1051,7 @@ class TestVxlan(TestCase):
 
             self.dut.send_expect("set fwd io", "testpmd>", 10)
             self.dut.send_expect("start", "testpmd>", 10)
-
+            self.pmdout.wait_link_status_up(self.dut_port)
             if BIDIRECT:
                 wirespeed = self.wirespeed(self.nic, PACKET_LEN, 2)
             else:
@@ -1131,6 +1134,7 @@ class TestVxlan(TestCase):
             self.dut.send_expect("set fwd csum", "testpmd>", 10)
             self.enable_vxlan(self.dut_port)
             self.enable_vxlan(self.recv_port)
+            self.pmdout.wait_link_status_up(self.dut_port)
 
             # redirect flow to another queue by tunnel filter
             rule_config = {
-- 
2.7.4


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [dts][PATCH V1] Optimize script: wait_link_status_up after start testpmd
@ 2021-11-22  6:24 Yu Jiang
  2021-11-22  7:41 ` Jiang, YuX
  0 siblings, 1 reply; 8+ messages in thread
From: Yu Jiang @ 2021-11-22  6:24 UTC (permalink / raw)
  To: xueqin.lin, dts; +Cc: Yu Jiang

optimize script: ddp_gtp_qregion&dual_vlan&external_memory&link_flowctrl&mtu_update&qos_api&scatter
wait_link_status_up after start testpmd or before send_packets to enhance script robustness

Signed-off-by: Yu Jiang <yux.jiang@intel.com>
---
 tests/TestSuite_ddp_gtp_qregion.py |  2 ++
 tests/TestSuite_dual_vlan.py       | 31 ++++++-------------------------
 tests/TestSuite_external_memory.py |  4 +++-
 tests/TestSuite_link_flowctrl.py   |  5 ++++-
 tests/TestSuite_mtu_update.py      |  1 +
 tests/TestSuite_qos_api.py         |  3 ++-
 tests/TestSuite_scatter.py         |  1 +
 7 files changed, 19 insertions(+), 28 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_external_memory.py b/tests/TestSuite_external_memory.py
index f68a9a6..2f862fa 100644
--- a/tests/TestSuite_external_memory.py
+++ b/tests/TestSuite_external_memory.py
@@ -40,6 +40,7 @@ import time
 
 import framework.utils as utils
 from framework.test_case import TestCase
+from framework.pmd_output import PmdOutput
 
 
 class TestExternalMemory(TestCase):
@@ -49,7 +50,7 @@ class TestExternalMemory(TestCase):
         """
         self.dut_ports = self.dut.get_ports(self.nic)
         self.verify(len(self.dut_ports) >= 2, "Insufficient ports")
-
+        self.pmdout = PmdOutput(self.dut)
         self.app_testpmd_path = self.dut.apps_name['test-pmd']
 
     def set_up(self):
@@ -134,6 +135,7 @@ class TestExternalMemory(TestCase):
 
     def verifier_result(self):
         self.dut.send_expect("start", "testpmd>",10)
+        self.pmdout.wait_link_status_up(self.dut_ports[0])
         self.scapy_send_packet(20)
         out = self.dut.send_expect("stop", "testpmd>", 10)
 
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_mtu_update.py b/tests/TestSuite_mtu_update.py
index ad13a8a..f16eb8e 100644
--- a/tests/TestSuite_mtu_update.py
+++ b/tests/TestSuite_mtu_update.py
@@ -235,6 +235,7 @@ class TestMtuUpdate(TestCase):
         self.exec("port start all")
         self.exec("set fwd mac")
         self.exec("start")
+        self.pmdout.wait_link_status_up(self.dut_ports[0])
         """
         On 1G NICs, when the jubmo frame MTU set > 1500, the software adjust it to MTU+4.
         """
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):
diff --git a/tests/TestSuite_scatter.py b/tests/TestSuite_scatter.py
index 85312c5..499c0ab 100644
--- a/tests/TestSuite_scatter.py
+++ b/tests/TestSuite_scatter.py
@@ -110,6 +110,7 @@ class TestScatter(TestCase):
 
         self.dut.send_expect("set fwd mac", "testpmd> ", 120)
         self.dut.send_expect("start", "testpmd> ")
+        self.pmdout.wait_link_status_up(self.port)
 
         for offset in [-1, 0, 1, 4, 5]:
             ret = self.scatter_pktgen_send_packet(self.mbsize + offset)
-- 
2.7.4


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [dts][PATCH V1] Optimize script: wait_link_status_up after start testpmd
@ 2021-11-19  7:33 Yu Jiang
  2021-11-19  8:31 ` Jiang, YuX
  0 siblings, 1 reply; 8+ messages in thread
From: Yu Jiang @ 2021-11-19  7:33 UTC (permalink / raw)
  To: xueqin.lin, dts; +Cc: Yu Jiang

tests/external_memory&mtu_update&scatter&vxlan: optimize script:
wait_link_status_up after start testpmd to enhance script robustness

Signed-off-by: Yu Jiang <yux.jiang@intel.com>
---
 tests/TestSuite_external_memory.py |  4 +++-
 tests/TestSuite_mtu_update.py      |  1 +
 tests/TestSuite_scatter.py         |  1 +
 tests/TestSuite_vxlan.py           | 18 +++++++++++-------
 4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/tests/TestSuite_external_memory.py b/tests/TestSuite_external_memory.py
index f68a9a6..2f862fa 100644
--- a/tests/TestSuite_external_memory.py
+++ b/tests/TestSuite_external_memory.py
@@ -40,6 +40,7 @@ import time
 
 import framework.utils as utils
 from framework.test_case import TestCase
+from framework.pmd_output import PmdOutput
 
 
 class TestExternalMemory(TestCase):
@@ -49,7 +50,7 @@ class TestExternalMemory(TestCase):
         """
         self.dut_ports = self.dut.get_ports(self.nic)
         self.verify(len(self.dut_ports) >= 2, "Insufficient ports")
-
+        self.pmdout = PmdOutput(self.dut)
         self.app_testpmd_path = self.dut.apps_name['test-pmd']
 
     def set_up(self):
@@ -134,6 +135,7 @@ class TestExternalMemory(TestCase):
 
     def verifier_result(self):
         self.dut.send_expect("start", "testpmd>",10)
+        self.pmdout.wait_link_status_up(self.dut_ports[0])
         self.scapy_send_packet(20)
         out = self.dut.send_expect("stop", "testpmd>", 10)
 
diff --git a/tests/TestSuite_mtu_update.py b/tests/TestSuite_mtu_update.py
index ad13a8a..f16eb8e 100644
--- a/tests/TestSuite_mtu_update.py
+++ b/tests/TestSuite_mtu_update.py
@@ -235,6 +235,7 @@ class TestMtuUpdate(TestCase):
         self.exec("port start all")
         self.exec("set fwd mac")
         self.exec("start")
+        self.pmdout.wait_link_status_up(self.dut_ports[0])
         """
         On 1G NICs, when the jubmo frame MTU set > 1500, the software adjust it to MTU+4.
         """
diff --git a/tests/TestSuite_scatter.py b/tests/TestSuite_scatter.py
index 85312c5..499c0ab 100644
--- a/tests/TestSuite_scatter.py
+++ b/tests/TestSuite_scatter.py
@@ -110,6 +110,7 @@ class TestScatter(TestCase):
 
         self.dut.send_expect("set fwd mac", "testpmd> ", 120)
         self.dut.send_expect("start", "testpmd> ")
+        self.pmdout.wait_link_status_up(self.port)
 
         for offset in [-1, 0, 1, 4, 5]:
             ret = self.scatter_pktgen_send_packet(self.mbsize + offset)
diff --git a/tests/TestSuite_vxlan.py b/tests/TestSuite_vxlan.py
index 1442578..9605c89 100644
--- a/tests/TestSuite_vxlan.py
+++ b/tests/TestSuite_vxlan.py
@@ -472,8 +472,8 @@ class TestVxlan(TestCase):
         config.outer_mac_dst = self.dut_port_mac
         config.create_pcap()
         self.dut.send_expect("start", "testpmd>", 10)
+        self.pmdout.wait_link_status_up(self.dut_port)
         config.send_pcap(self.tester_iface)
-
         # check whether detect vxlan type
         out = self.dut.get_session_output(timeout=2)
         print(out)
@@ -572,6 +572,7 @@ class TestVxlan(TestCase):
         # send vxlan packet
         config.create_pcap()
         self.dut.send_expect("start", "testpmd>", 10)
+        self.pmdout.wait_link_status_up(self.dut_port)
         config.send_pcap(self.tester_iface)
         out = self.dut.get_session_output(timeout=2)
         print(out)
@@ -606,7 +607,7 @@ class TestVxlan(TestCase):
         self.dut.send_expect("set verbose 1", "testpmd>", 10)
         self.enable_vxlan(self.dut_port)
         self.enable_vxlan(self.recv_port)
-
+        self.pmdout.wait_link_status_up(self.dut_port)
         # check normal packet
         self.send_and_detect(outer_udp_dst=1234)
         # check vxlan + UDP inner packet
@@ -642,7 +643,7 @@ class TestVxlan(TestCase):
         self.dut.send_expect("set verbose 1", "testpmd>", 10)
         self.enable_vxlan(self.dut_port)
         self.enable_vxlan(self.recv_port)
-
+        self.pmdout.wait_link_status_up(self.dut_port)
         # check normal ipv6 packet
         self.send_and_detect(outer_ip6_src="FE80:0:0:0:0:0:0:0",
                              outer_ip6_dst="FE80:0:0:0:0:0:0:1",
@@ -692,7 +693,7 @@ class TestVxlan(TestCase):
 
         self.enable_vxlan(self.dut_port)
         self.enable_vxlan(self.recv_port)
-
+        self.pmdout.wait_link_status_up(self.dut_port)
         # check normal packet + ip checksum invalid
         self.send_and_check(outer_ip_invalid=1, outer_udp_dst=1234)
         # check vxlan packet + inner ip checksum invalid
@@ -754,6 +755,7 @@ class TestVxlan(TestCase):
         self.dut.send_expect("set fwd csum", "testpmd>", 10)
         self.csum_set_type('outer-ip', self.recv_port)
         self.csum_set_type('udp', self.recv_port)
+        self.csum_set_type('outer-udp', self.recv_port)
         self.csum_set_type('tcp', self.recv_port)
         self.csum_set_type('sctp', self.recv_port)
         self.dut.send_expect("csum parse-tunnel on %d" %
@@ -761,7 +763,7 @@ class TestVxlan(TestCase):
 
         self.enable_vxlan(self.dut_port)
         self.enable_vxlan(self.recv_port)
-
+        self.pmdout.wait_link_status_up(self.dut_port)
         # check normal ipv6 packet
         self.send_and_check(outer_ip6_src="FE80:0:0:0:0:0:0:0",
                             outer_ip6_dst="FE80:0:0:0:0:0:0:1")
@@ -821,7 +823,7 @@ class TestVxlan(TestCase):
         self.dut.send_expect("set verbose 1", "testpmd>", 10)
         self.enable_vxlan(self.dut_port)
         self.enable_vxlan(self.recv_port)
-
+        self.pmdout.wait_link_status_up(self.dut_port)
         config = VxlanTestConfig(self)
         config_vlan = VxlanTestConfig(self, inner_vlan=1)
         config.outer_mac_dst = self.dut_port_mac
@@ -892,6 +894,7 @@ class TestVxlan(TestCase):
 
         self.enable_vxlan(self.dut_port)
         self.enable_vxlan(self.recv_port)
+        self.pmdout.wait_link_status_up(self.dut_port)
         rule = 'flow create {} ingress pattern eth / ipv4 / udp / vxlan vni is {} / eth dst is {} / end actions pf ' \
                '/ queue index {} / end'.format(self.dut_port,
                                                config.vni,
@@ -1048,7 +1051,7 @@ class TestVxlan(TestCase):
 
             self.dut.send_expect("set fwd io", "testpmd>", 10)
             self.dut.send_expect("start", "testpmd>", 10)
-
+            self.pmdout.wait_link_status_up(self.dut_port)
             if BIDIRECT:
                 wirespeed = self.wirespeed(self.nic, PACKET_LEN, 2)
             else:
@@ -1131,6 +1134,7 @@ class TestVxlan(TestCase):
             self.dut.send_expect("set fwd csum", "testpmd>", 10)
             self.enable_vxlan(self.dut_port)
             self.enable_vxlan(self.recv_port)
+            self.pmdout.wait_link_status_up(self.dut_port)
 
             # redirect flow to another queue by tunnel filter
             rule_config = {
-- 
2.7.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-30  3:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-20  7:50 [dts][PATCH V1] Optimize script: wait_link_status_up after start testpmd Yu Jiang
  -- strict thread matches above, loose matches on Subject: below --
2021-11-24  8:33 Yu Jiang
2021-11-30  3:28 ` Tu, Lijuan
2021-11-22  6:24 Yu Jiang
2021-11-22  7:41 ` Jiang, YuX
2021-11-22 14:51   ` Tu, Lijuan
2021-11-19  7:33 Yu Jiang
2021-11-19  8:31 ` Jiang, YuX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).