testutils: update verify_packet_in for OF 1.3
diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index 54e22e8..4669a3c 100644
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -1337,11 +1337,21 @@
@param reason Expected packet_in reason, or None
"""
- if in_port and in_port != msg.in_port:
+ if ofp.OFP_VERSION <= 2:
+ pkt_in_port = msg.in_port
+ else:
+ oxms = { type(oxm): oxm for oxm in msg.match.oxm_list }
+ if ofp.oxm.in_port in oxms:
+ pkt_in_port = oxms[ofp.oxm.in_port].value
+ else:
+ logging.warn("Missing in_port in packet-in message")
+ pkt_in_port = None
+
+ if in_port != None and in_port != pkt_in_port:
logging.debug("Incorrect packet_in in_port (expected %d, received %d)", in_port, msg.in_port)
return False
- if reason and reason != msg.reason:
+ if reason != None and reason != msg.reason:
logging.debug("Incorrect packet_in reason (expected %d, received %d)", reason, msg.reason)
return False