diff mbox series

[V1] Optimize script: wait_link_status_up after start testpmd

Message ID 1637742820-28741-1-git-send-email-yux.jiang@intel.com (mailing list archive)
State New
Headers show
Series [V1] Optimize script: wait_link_status_up after start testpmd | expand

Checks

Context Check Description
ci/Intel-dts-suite-test fail Testing issues

Commit Message

Yu Jiang Nov. 24, 2021, 8:33 a.m. UTC
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 mbox series

Patch

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 = {