OFPUTIL_FF_SEND_FLOW_REM = 1 << 0, /* All versions. */
OFPUTIL_FF_NO_PKT_COUNTS = 1 << 1, /* OpenFlow 1.3+. */
OFPUTIL_FF_NO_BYT_COUNTS = 1 << 2, /* OpenFlow 1.3+. */
-#define OFPUTIL_FF_STATE (OFPUTIL_FF_SEND_FLOW_REM \
- | OFPUTIL_FF_NO_PKT_COUNTS \
- | OFPUTIL_FF_NO_BYT_COUNTS)
- /* Flags that affect flow_mod behavior but are not part of flow state. */
+ /* These flags primarily affects flow_mod behavior. They are not
+ * particularly useful as part of flow state. We include them in flow
+ * state only because OpenFlow implies that they should be. */
OFPUTIL_FF_CHECK_OVERLAP = 1 << 3, /* All versions. */
- OFPUTIL_FF_EMERG = 1 << 4, /* OpenFlow 1.0 only. */
- OFPUTIL_FF_RESET_COUNTS = 1 << 5, /* OpenFlow 1.2+. */
+ OFPUTIL_FF_RESET_COUNTS = 1 << 4, /* OpenFlow 1.2+. */
+
+ /* Not supported by OVS. */
+ OFPUTIL_FF_EMERG = 1 << 5, /* OpenFlow 1.0 only. */
+
+ /* The set of flags maintained as part of a flow table entry. */
+#define OFPUTIL_FF_STATE (OFPUTIL_FF_SEND_FLOW_REM \
+ | OFPUTIL_FF_NO_PKT_COUNTS \
+ | OFPUTIL_FF_NO_BYT_COUNTS \
+ | OFPUTIL_FF_CHECK_OVERLAP \
+ | OFPUTIL_FF_RESET_COUNTS)
/* Flags that are only set by OVS for its internal use. Cannot be set via
* OpenFlow. */
OVS_VSWITCHD_STOP
AT_CLEANUP
+# It's really dumb that check_overlap and reset_counts are considered
+# part of flow state, but OpenFlow implies that it is, and OFTest and
+# some users insist on it.
+AT_SETUP([ofproto - add-flow and flags])
+OVS_VSWITCHD_START
+AT_CHECK([ovs-ofctl -F openflow10 add-flow br0 check_overlap,in_port=1,actions=drop])
+# Prior to OF1.3, flow dumps didn't include a "flags" field.
+AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
+OFPST_FLOW reply:
+ in_port=1 actions=drop
+])
+AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [dnl
+OFPST_FLOW reply (OF1.1):
+ in_port=1 actions=drop
+])
+AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [dnl
+OFPST_FLOW reply (OF1.2):
+ in_port=1 actions=drop
+])
+# OF1.3 makes the flags visible.
+AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip], [0], [dnl
+OFPST_FLOW reply (OF1.3):
+ check_overlap reset_counts in_port=1 actions=drop
+])
+AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip], [0], [dnl
+OFPST_FLOW reply (OF1.4):
+ check_overlap reset_counts in_port=1 actions=drop
+])
+AT_CHECK([ovs-ofctl -O OpenFlow15 dump-flows br0 | ofctl_strip], [0], [dnl
+OFPST_FLOW reply (OF1.5):
+ check_overlap reset_counts in_port=1 actions=drop
+])
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)])
OVS_VSWITCHD_START
AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1):
dnl Importance parameter will only be visible of flows that are added via OF1.4+ if dumped via OF1.4+
AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed '/ST_FLOW reply/d' | sort], [0], [dnl
importance=21, priority=21 actions=NORMAL
- priority=22 actions=NORMAL
+ reset_counts priority=22 actions=NORMAL
])
dnl Importance parameter will not be visible if flow is dumped with previous version prior to OF1.4+ whether added via OF1.4+