tests: Check that port status MODIFY messages are generated.
authorJean Tourrilhes <jean.tourrilhes@hp.com>
Thu, 19 Jun 2014 01:05:44 +0000 (18:05 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 8 Oct 2014 20:47:25 +0000 (13:47 -0700)
ONF-JIRA: EXT-338
Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
tests/ofproto.at

index 8f4dd42..382a09e 100644 (file)
@@ -2021,6 +2021,79 @@ ovs-appctl -t ovs-ofctl exit
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
+AT_SETUP([ofproto - asynchronous message control (OpenFlow 1.5)])
+OVS_VSWITCHD_START
+AT_CHECK([ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile])
+check_async () {
+    printf '\n\n--- check_async %d ---\n\n\n' $1
+    INDEX=$1
+    shift
+
+    ovs-appctl -t ovs-ofctl ofctl/barrier
+    ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
+    : > expout
+
+    # Other tests are not working with OF 1.5, and message
+    # format may change, so leave them out.
+
+    # OFPT_PORT_STATUS, OFPPR_ADD
+    ovs-vsctl add-port br0 test -- set Interface test type=dummy
+    if test X"$1" = X"OFPPR_ADD"; then shift;
+        echo >>expout "OFPT_PORT_STATUS (OF1.5): ADD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
+     config:     PORT_DOWN
+     state:      LINK_DOWN
+     speed: 0 Mbps now, 0 Mbps max"
+    fi
+
+    # OFPT_PORT_STATUS, OFPPR_MODIFY
+    ovs-ofctl -O OpenFlow15 -vwarn mod-port br0 test up
+    if test X"$1" = X"OFPPR_MODIFY"; then shift;
+        echo >>expout "OFPT_PORT_STATUS (OF1.5): MOD: ${INDEX}(test): addr:aa:55:aa:55:00:0x
+     config:     0
+     state:      LINK_DOWN
+     speed: 0 Mbps now, 0 Mbps max
+OFPT_PORT_STATUS (OF1.5): MOD: 2(test): addr:aa:55:aa:55:00:0x
+     config:     0
+     state:      0
+     speed: 0 Mbps now, 0 Mbps max"
+    fi
+
+    # OFPT_PORT_STATUS, OFPPR_DELETE
+    ovs-vsctl del-port br0 test
+    if test X"$1" = X"OFPPR_DELETE"; then shift;
+        echo >>expout "OFPT_PORT_STATUS (OF1.5): DEL: ${INDEX}(test): addr:aa:55:aa:55:00:0x
+     config:     0
+     state:      0
+     speed: 0 Mbps now, 0 Mbps max"
+    fi
+
+    AT_FAIL_IF([test X"$1" != X])
+
+    ovs-appctl -t ovs-ofctl ofctl/barrier
+    echo >>expout "OFPT_BARRIER_REPLY (OF1.5):"
+
+    AT_CHECK(
+      [[sed '
+s/ (xid=0x[0-9a-fA-F]*)//
+s/ *duration.*//
+s/00:0.$/00:0x/' < monitor.log]],
+      [0], [expout])
+}
+
+# It's a service connection so initially there should be no async messages.
+check_async 1
+
+# If we don't set this, async messages are not received.
+# Set miss_send_len to 128, turning on packet-ins for our service connection.
+ovs-appctl -t ovs-ofctl ofctl/send 0609000c0123456700000080
+check_async 2 OFPPR_ADD OFPPR_MODIFY OFPPR_DELETE
+
+# Set-async has changed in OF 1.4 and is not yet implemented.
+
+ovs-appctl -t ovs-ofctl exit
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
 dnl This test checks that the role request/response messaging works
 dnl and that generation_id is handled properly.
 AT_SETUP([ofproto - controller role (OpenFlow 1.2)])