* [dts][PATCH V1 1/2] tests/flow_classify*: wait for interface up
2022-02-24 15:28 [dts][PATCH V1 0/2] optimize script: wait for interface up Yu Jiang
@ 2022-02-24 15:28 ` Yu Jiang
2022-02-24 15:28 ` [dts][PATCH V1 2/2] tests/interrupt_pmd: " Yu Jiang
1 sibling, 0 replies; 4+ messages in thread
From: Yu Jiang @ 2022-02-24 15:28 UTC (permalink / raw)
To: lijuan.tu, dts; +Cc: Yu Jiang
optimize script: flow_classify/flow_classify_softnic,
1, use new method: is_interface_up to to ensure iface's link status before send_packets
2, wait_link_status_up for all ports after start testpmd
Signed-off-by: Yu Jiang <yux.jiang@intel.com>
---
tests/TestSuite_flow_classify.py | 1 +
tests/TestSuite_flow_classify_softnic.py | 9 ++++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/TestSuite_flow_classify.py b/tests/TestSuite_flow_classify.py
index 200d39e0..5b28b884 100644
--- a/tests/TestSuite_flow_classify.py
+++ b/tests/TestSuite_flow_classify.py
@@ -253,6 +253,7 @@ class TestFlowClassify(TestCase):
tx_iface = config.get('tx_intf')
cmd = "ifconfig {0} up".format(tx_iface)
self.tester.send_expect(cmd, '# ', 30)
+ self.verify(self.tester.is_interface_up(intf=tx_iface), "Wrong link status, should be up")
pkts = config.get('stream')
# stream config
stream_configs = config.get('stream configs')
diff --git a/tests/TestSuite_flow_classify_softnic.py b/tests/TestSuite_flow_classify_softnic.py
index 7b6642d0..c5004f16 100644
--- a/tests/TestSuite_flow_classify_softnic.py
+++ b/tests/TestSuite_flow_classify_softnic.py
@@ -179,12 +179,15 @@ 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])
+ self.pmdout.wait_link_status_up('all')
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])
tx_interface = self.tester.get_interface(tx_port)
rx_interface = self.tester.get_interface(rx_port)
+ # check tester's link status before send packet
+ for iface in [tx_interface, rx_interface]:
+ self.verify(self.tester.is_interface_up(intf=iface), "Wrong link status, should be up")
self.tcpdump_start_sniff(rx_interface, filters)
@@ -284,9 +287,9 @@ class TestFlowClassifySoftnic(TestCase):
"""
Sends continuous packets.
"""
- self.pmdout.wait_link_status_up(self.dut_ports[0])
+ self.pmdout.wait_link_status_up('all')
+ self.verify(self.tester.is_interface_up(intf=itf), "Wrong link status, should be up")
self.tester.scapy_foreground()
- time.sleep(2)
if src_dst == "src":
if ptype == "ipv4":
var = src_addr.split(".")
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dts][PATCH V1 2/2] tests/interrupt_pmd: wait for interface up
2022-02-24 15:28 [dts][PATCH V1 0/2] optimize script: wait for interface up Yu Jiang
2022-02-24 15:28 ` [dts][PATCH V1 1/2] tests/flow_classify*: " Yu Jiang
@ 2022-02-24 15:28 ` Yu Jiang
2022-02-27 14:19 ` Tu, Lijuan
1 sibling, 1 reply; 4+ messages in thread
From: Yu Jiang @ 2022-02-24 15:28 UTC (permalink / raw)
To: lijuan.tu, dts; +Cc: Yu Jiang
optimize script: interrupt_pmd,
use new method: is_interface_up to to ensure iface's link status before send_packets
Signed-off-by: Yu Jiang <yux.jiang@intel.com>
---
tests/TestSuite_interrupt_pmd.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/TestSuite_interrupt_pmd.py b/tests/TestSuite_interrupt_pmd.py
index db8efe44..dd413aca 100644
--- a/tests/TestSuite_interrupt_pmd.py
+++ b/tests/TestSuite_interrupt_pmd.py
@@ -129,10 +129,11 @@ class TestInterruptPmd(TestCase):
Send a packet to port
"""
for i in range(len(self.dut_ports[:portnum])):
+ txport = self.tester.get_local_port(self.dut_ports[i])
+ mac = self.dut.get_mac_address(self.dut_ports[i])
+ txItf = self.tester.get_interface(txport)
+ self.verify(self.tester.is_interface_up(intf=txItf), "Tester's %s should be up".format(txItf))
for j in range(num):
- txport = self.tester.get_local_port(self.dut_ports[i])
- mac = self.dut.get_mac_address(self.dut_ports[i])
- txItf = self.tester.get_interface(txport)
self.tester.scapy_append(
'sendp([Ether()/IP(dst="198.0.0.%d")/UDP()/Raw(\'X\'*18)], iface="%s")' % (j, txItf))
self.tester.scapy_execute()
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread