test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1] try to fix sometime dut port rx packets error
@ 2016-12-07  7:12 xu,huilong
  2016-12-14  8:12 ` Liu, Yong
  0 siblings, 1 reply; 4+ messages in thread
From: xu,huilong @ 2016-12-07  7:12 UTC (permalink / raw)
  To: dts; +Cc: xu,huilong

some time dut rx packet error, we guess the root case about scapy send packets.
so we try send packets again when check dut not rx packets.

Signed-off-by: xu,huilong <huilongx.xu@intel.com>
---
 tests/TestSuite_pmd.py | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py
index 7b9e6b5..e8a65e5 100644
--- a/tests/TestSuite_pmd.py
+++ b/tests/TestSuite_pmd.py
@@ -342,19 +342,23 @@ class TestPmd(TestCase,IxiaPacketGenerator):
         checksum = ''
         if checksum_test:
             checksum = 'chksum=0x1'
-
-        self.tester.scapy_foreground()
-        self.tester.scapy_append('nutmac="%s"' % mac)
-        self.tester.scapy_append('sendp([Ether(dst=nutmac, src="52:00:00:00:00:00")/IP(len=%s)/UDP(%s)/Raw(load="\x50"*%s)], iface="%s")' % (
-            load_size, checksum, padding, interface))
-
-        out = self.tester.scapy_execute()
-        time.sleep(.5)
-
-        port0_stats = self.get_stats(self.dut_ports[0])
-        p0tx_pkts, p0tx_bytes = [port0_stats['TX-packets'], port0_stats['TX-bytes']]
-        port1_stats = self.get_stats(self.dut_ports[1])
-        p1rx_pkts, p1rx_err, p1rx_bytes = [port1_stats['RX-packets'], port1_stats['RX-errors'], port1_stats['RX-bytes']]
+        for i in range(3):
+            self.tester.scapy_foreground()
+            self.tester.scapy_append('nutmac="%s"' % mac)
+            self.tester.scapy_append('sendp([Ether(dst=nutmac, src="52:00:00:00:00:00")/IP(len=%s)/UDP(%s)/Raw(load="\x50"*%s)], iface="%s")' % (
+                load_size, checksum, padding, interface))
+
+            out = self.tester.scapy_execute()
+            time.sleep((i + 1) * 0.5)
+
+            port0_stats = self.get_stats(self.dut_ports[0])
+            p0tx_pkts, p0tx_bytes = [port0_stats['TX-packets'], port0_stats['TX-bytes']]
+            port1_stats = self.get_stats(self.dut_ports[1])
+            p1rx_pkts, p1rx_err, p1rx_bytes = [port1_stats['RX-packets'], port1_stats['RX-errors'], port1_stats['RX-bytes']]
+            #dut port rx packets already
+            if (p1rx_pkts - gp1rx_pkts):
+                break
+            time.sleep(i)
 
         p0tx_pkts -= gp0tx_pkts
         p0tx_bytes -= gp0tx_bytes
-- 
1.9.3

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

end of thread, other threads:[~2016-12-14 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-07  7:12 [dts] [PATCH V1] try to fix sometime dut port rx packets error xu,huilong
2016-12-14  8:12 ` Liu, Yong
2016-12-14  9:11   ` Xu, HuilongX
2016-12-14 15:18     ` Liu, Yong

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).