testutils: add new functions to check for dataplane packets
`receive_pkt_check` and `receive_pkt_verify` had slightly different
functionality and neither were sufficient for complex tests. This change
deprecates them and adds new functions.
The high level `verify_packets` function is sufficient for most tests. When
more complex logic is needed the primitive functions `verify_packet`,
`verify_no_packet`, and `verify_no_other_packets` should be used directly.
All OpenFlow 1.0/1.3 tests are updated to use the new functions. The old
functions are left around for compatibility with out of tree tests.
diff --git a/tests-1.3/actions.py b/tests-1.3/actions.py
index e5b1e3a..4d48fbe 100644
--- a/tests-1.3/actions.py
+++ b/tests-1.3/actions.py
@@ -50,8 +50,7 @@
logging.info("Sending packet, expecting output to port %d", out_port)
self.dataplane.send(in_port, pktstr)
- receive_pkt_check(self.dataplane, pktstr, [out_port],
- set(openflow_ports()) - set([out_port]), self)
+ verify_packets(self, pktstr, [out_port])
class OutputMultiple(base_tests.SimpleDataPlane):
"""
@@ -86,8 +85,7 @@
logging.info("Sending packet, expecting output to ports %r", out_ports)
self.dataplane.send(in_port, pktstr)
- receive_pkt_check(self.dataplane, pktstr, out_ports,
- set(openflow_ports()) - set(out_ports), self)
+ verify_packets(self, pktstr, out_ports)
class BaseModifyPacketTest(base_tests.SimpleDataPlane):
"""
@@ -117,8 +115,8 @@
logging.info("Sending packet, expecting output to port %d", out_port)
self.dataplane.send(in_port, str(pkt))
- receive_pkt_check(self.dataplane, str(exp_pkt), [out_port],
- set(openflow_ports()) - set([out_port]), self)
+ verify_packets(self, str(exp_pkt), [out_port])
+
class PushVlan(BaseModifyPacketTest):
"""