ofproto: Avoid abandoning an ofopgroup without committing it.
[sliver-openvswitch.git] / tests / ofproto.at
index 38bfb02..6682467 100644 (file)
@@ -275,6 +275,32 @@ AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLO
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
+AT_SETUP([ofproto - flow_mod negative test (OpenFlow 1.1)])
+OVS_VSWITCHD_START(
+  [set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13])
+AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:2])
+AT_CHECK([ovs-ofctl add-flow -O OpenFlow11 br0 table=1,action=goto_table:1],
+  [1], [], [stderr])
+
+# The output should look like this:
+#
+# OFPT_ERROR (OF1.1) (xid=0x2): OFPBRC_BAD_TABLE_ID
+# OFPT_FLOW_MOD (OF1.1) (xid=0x2):
+# (***truncated to 64 bytes from 160***)
+# 00000000  02 0e 00 a0 00 00 00 02-00 00 00 00 00 00 00 00 |................|
+# 00000010  00 00 00 00 00 00 00 00-01 00 00 00 00 00 80 00 |................|
+# 00000020  ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
+# 00000030  00 00 00 58 00 00 00 00-00 00 03 ff 00 00 00 00 |...X............|
+#
+# This 'sed' command captures the error message but drops details.
+AT_CHECK([sed '/truncated/d
+/^000000.0/d' stderr | STRIP_XIDS], [0],
+  [OFPT_ERROR (OF1.1): OFPBRC_BAD_TABLE_ID
+OFPT_FLOW_MOD (OF1.1):
+])
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
 AT_SETUP([ofproto - set-field flow_mod commands (NXM)])
 OVS_VSWITCHD_START
 AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop])
@@ -732,13 +758,13 @@ AT_CLEANUP
 AT_SETUP([ofproto - flow table configuration (OpenFlow 1.2)])
 OVS_VSWITCHD_START
 # Check the default configuration.
-(mid="wild=0xffffffffff, max=1000000,"
+(mid="wild=0xfffffffff, max=1000000,"
  tail="
                lookup=0, matched=0
-               match=0xffffffffff, instructions=0x00000007, config=0x00000003
+               match=0xfffffffff, instructions=0x00000007, config=0x00000003
                write_actions=0x00000000, apply_actions=0x00000000
-               write_setfields=0x000000ffffffffff
-               apply_setfields=0x000000ffffffffff
+               write_setfields=0x0000000fffffffff
+               apply_setfields=0x0000000fffffffff
                metadata_match=0xffffffffffffffff
                metadata_write=0xffffffffffffffff"
  echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
@@ -763,9 +789,9 @@ AT_CHECK(
 # Check that the configuration was updated.
 mv expout orig-expout
 (echo "OFPST_TABLE reply (OF1.2) (xid=0x2): 254 tables
-  0: main    : wild=0xffffffffff, max=1000000, active=0"
+  0: main    : wild=0xfffffffff, max=1000000, active=0"
  tail -n +3 orig-expout | head -7
- echo "  1: table1  : wild=0xffffffffff, max=  1024, active=0"
+ echo "  1: table1  : wild=0xfffffffff, max=  1024, active=0"
  tail -n +11 orig-expout) > expout
 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-tables br0], [0], [expout])
 OVS_VSWITCHD_STOP
@@ -1878,3 +1904,37 @@ NXT_FLOW_MONITOR_RESUMED:
 
 OVS_VSWITCHD_STOP
 AT_CLEANUP
+
+AT_SETUP([ofproto - event filtering (OpenFlow 1.3)])
+AT_KEYWORDS([monitor])
+OVS_VSWITCHD_START
+
+# Start a monitor, use the required protocol version
+ovs-ofctl -O OpenFlow13 monitor br0 --detach --no-chdir --pidfile >monitor.log 2>&1
+AT_CAPTURE_FILE([monitor.log])
+
+# Send an OpenFlow13 message (04), OFPT_GET_ASYNC_REQUEST (1a), length (8), xid (0a)
+ovs-appctl -t ovs-ofctl ofctl/send 041a00080000000a
+ovs-appctl -t ovs-ofctl ofctl/barrier
+
+# Check default setting
+read -r -d '' expected <<'EOF'
+EOF
+
+AT_CHECK([ofctl_strip < monitor.log], [], [dnl
+send: OFPT_GET_ASYNC_REQUEST (OF1.3):
+OFPT_GET_ASYNC_REPLY (OF1.3):
+ master:
+       PACKET_IN: no_match action
+     PORT_STATUS: add delete modify
+    FLOW_REMOVED: idle hard delete
+
+ slave:
+       PACKET_IN: (off)
+     PORT_STATUS: add delete modify
+    FLOW_REMOVED: (off)
+OFPT_BARRIER_REPLY (OF1.3):
+])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP