From 6942189d8f37affa01745405dfa1abf03486985f Mon Sep 17 00:00:00 2001 From: Yuichi Ito Date: Mon, 23 Jun 2014 14:39:12 +0900 Subject: [PATCH] sw test tool: Modify conditions of ofp_packet_in_reason OF 1.4.0 spec (B.14.2 More descriptive reasons for packet-in) says: The main change is that the the "output action" reason OFPR_ACTION is effectively split into four reasons, "apply-action", "action-set", "group bucket" and "packet-out", representing the four distinct context where this action is used. A set of reason values for ofp_packet_in message in OF 1.3.3 is: enum ofp_packet_in_reason { OFPR_NO_MATCH = 0, /* No matching flow (table-miss flow entry). */ OFPR_ACTION = 1, /* Action explicitly output to controller. */ OFPR_INVALID_TTL = 2, /* Packet has invalid TTL */ }; And a new set of reason values for ofp_packet_in message in OF 1.4.0 is: enum ofp_packet_in_reason { OFPR_TABLE_MISS = 0, /* No matching flow (table-miss flow entry). */ OFPR_APPLY_ACTION = 1, /* Output to controller in apply-actions. */ OFPR_INVALID_TTL = 2, /* Packet has invalid TTL */ OFPR_ACTION_SET = 3, /* Output to controller in action set. */ OFPR_GROUP = 4, /* Output to controller in group bucket. */ OFPR_PACKET_OUT = 5, /* Output to controller in packet-out. */ }; Therefore, "reason != OFPR_ACTION" means "reason == OFPR_NOMATCH or reason == OFPR_INVALID_TTL". NOTE: OFPR_TABLE_MISS is defined as OFPR_NO_MATCH in ryu.ofproto.ofproto_v1_4. Signed-off-by: Yuichi Ito Signed-off-by: FUJITA Tomonori --- ryu/tests/switch/tester.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ryu/tests/switch/tester.py b/ryu/tests/switch/tester.py index a59205ed..98788a92 100644 --- a/ryu/tests/switch/tester.py +++ b/ryu/tests/switch/tester.py @@ -642,7 +642,8 @@ class OfTester(app_manager.RyuApp): if msg.datapath.id != pkt_in_src_model.dp.id: pkt_type = 'packet-in' err_msg = 'SW[dpid=%s]' % dpid_lib.dpid_to_str(msg.datapath.id) - elif msg.reason != ofproto_v1_3.OFPR_ACTION: + elif msg.reason == msg.datapath.ofproto.OFPR_NO_MATCH or \ + msg.reason == msg.datapath.ofproto.OFPR_INVALID_TTL: pkt_type = 'packet-in' err_msg = 'OFPPacketIn[reason=%d]' % msg.reason elif repr(msg.data) != repr(model_pkt):