port_stats: check for packets >= expected
If an earlier test run sends a packet through the port, and if the switch takes
a second or so to make those counter updates visible to OpenFlow, then this
test would fail because the port stats would be higher than expected.
Changing the conditional reduces the usefulness of the test because it won't
catch overcounting errors, but it's necessary to make it correct.
diff --git a/tests/port_stats.py b/tests/port_stats.py
index 5f3a3f3..a61aed8 100644
--- a/tests/port_stats.py
+++ b/tests/port_stats.py
@@ -110,10 +110,10 @@
sent = item.tx_packets
recv = item.rx_packets
logging.info("Sent " + str(item.tx_packets) + " packets")
- if item.tx_packets == packet_sent:
+ if item.tx_packets >= packet_sent:
all_packets_sent = 1
logging.info("Received " + str(item.rx_packets) + " packets")
- if item.rx_packets == packet_recv:
+ if item.rx_packets >= packet_recv:
all_packets_received = 1
if all_packets_received and all_packets_sent: