Enable OpenFlow 1.0, 1.1, 1.2, and 1.3 by default.
authorBen Pfaff <blp@nicira.com>
Wed, 30 Apr 2014 13:54:09 +0000 (06:54 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 30 Apr 2014 13:54:09 +0000 (06:54 -0700)
The Open vSwitch software switch now supports all the required features of
OpenFlow 1.0 through 1.3, with one known trivial exception[*].  Enable them
by default in ovs-vswitchd.

For now, ovs-ofctl only enables OpenFlow 1.0 by default.  This is
because ovs-ofctl implements command such as "add-flow" as raw
OpenFlow requests, but those requests have subtly different semantics
in different OpenFlow versions.  For example:

    - In OpenFlow 1.0, a "mod-flow" operation that does not find any
      existing flow to modify adds a new flow.

    - In OpenFlow 1.1, a "mod-flow" operation that does not find any
      existing flow to modify adds a new flow, but only if the
      mod-flow did not match on the flow cookie.

    - In OpenFlow 1.2 and a later, a "mod-flow" operation never adds a
      new flow.

[*] OpenFlow 1.1, but not any earlier or later version of OpenFlow,
    requires support for VLANs introduced by Ethertype 0x88a8, but Open
    vSwitch does not support this Ethertype.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
FAQ
NEWS
lib/ofp-util.h
tests/ofproto-macros.at
tests/test-vconn.c
utilities/ovs-ofctl.c
vswitchd/vswitch.xml

diff --git a/FAQ b/FAQ
index c43b0c8..128abe8 100644 (file)
--- a/FAQ
+++ b/FAQ
@@ -1119,19 +1119,28 @@ A: The following table lists the versions of OpenFlow supported by
        2.0                yes    [*]    [*]    [*]    ---
        2.1                yes    [*]    [*]    [*]    ---
        2.2                yes    [*]    [*]    [*]    [%]
        2.0                yes    [*]    [*]    [*]    ---
        2.1                yes    [*]    [*]    [*]    ---
        2.2                yes    [*]    [*]    [*]    [%]
+       2.3                yes    yes    yes    yes    [%]
 
        [*] Supported, with one or more missing features.
        [%] Support is unsafe: ovs-vswitchd will abort when certain
            unimplemented features are tested.
 
 
        [*] Supported, with one or more missing features.
        [%] Support is unsafe: ovs-vswitchd will abort when certain
            unimplemented features are tested.
 
-   Because of missing features, OpenFlow 1.1, 1.2, and 1.3 must be
-   enabled manually.  The following command enables OpenFlow 1.0, 1.1,
-   1.2, and 1.3 on bridge br0:
+   Open vSwitch 2.3 enables OpenFlow 1.0, 1.1, 1.2, and 1.3 by default
+   in ovs-vswitchd.  In Open vSwitch 1.10 through 2.2, OpenFlow 1.1,
+   1.2, and 1.3 must be enabled manually in ovs-vswitchd.  Either way,
+   the user may override the default:
 
 
-       ovs-vsctl set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13
+       - To enable OpenFlow 1.0, 1.1, 1.2, and 1.3 on bridge br0:
 
 
-   Use the -O option to enable support for later versions of OpenFlow
-   in ovs-ofctl.  For example:
+         ovs-vsctl set bridge br0 protocols=OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13
+
+       - To enable only OpenFlow 1.0 on bridge br0:
+
+         ovs-vsctl set bridge br0 protocols=OpenFlow10
+
+   All current versions of ovs-ofctl enable only OpenFlow 1.0 by
+   default.  Use the -O option to enable support for later versions of
+   OpenFlow in ovs-ofctl.  For example:
 
        ovs-ofctl -O OpenFlow13 dump-flows br0
 
 
        ovs-ofctl -O OpenFlow13 dump-flows br0
 
@@ -1143,9 +1152,9 @@ A: The following table lists the versions of OpenFlow supported by
    invoked with a special --enable-of14 command line option.
 
    OPENFLOW-1.1+ in the Open vSwitch source tree tracks support for
    invoked with a special --enable-of14 command line option.
 
    OPENFLOW-1.1+ in the Open vSwitch source tree tracks support for
-   OpenFlow 1.1 and later features.  When support for a given OpenFlow
-   version is solidly implemented, Open vSwitch will enable that
-   version by default.
+   OpenFlow 1.1 and later features.  When support for OpenFlow 1.4 is
+   solidly implemented, Open vSwitch will enable that version by
+   default.
 
 Q: Does Open vSwitch support MPLS?
 
 
 Q: Does Open vSwitch support MPLS?
 
diff --git a/NEWS b/NEWS
index 74b57ff..ac7d6cc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
 Post-v2.2.0
 ---------------------
 Post-v2.2.0
 ---------------------
+   - OpenFlow 1.1, 1.2, and 1.3 are now enabled by default in
+     ovs-vswitchd.
 
 
 v2.2.0 - xx xxx xxx
 
 
 v2.2.0 - xx xxx xxx
index fe2c7c2..7c28034 100644 (file)
@@ -170,13 +170,15 @@ void ofputil_format_version_bitmap_names(struct ds *msg, uint32_t bitmap);
 uint32_t ofputil_protocols_to_version_bitmap(enum ofputil_protocol);
 enum ofputil_protocol ofputil_protocols_from_version_bitmap(uint32_t bitmap);
 
 uint32_t ofputil_protocols_to_version_bitmap(enum ofputil_protocol);
 enum ofputil_protocol ofputil_protocols_from_version_bitmap(uint32_t bitmap);
 
-/* Bitmap of OpenFlow versions that Open vSwitch supports. */
-#define OFPUTIL_SUPPORTED_VERSIONS \
-    ((1u << OFP10_VERSION) | (1u << OFP12_VERSION) | (1u << OFP13_VERSION))
-
-/* Bitmap of OpenFlow versions to enable by default (a subset of
- * OFPUTIL_SUPPORTED_VERSIONS). */
-#define OFPUTIL_DEFAULT_VERSIONS (1u << OFP10_VERSION)
+/* Bitmaps of OpenFlow versions that Open vSwitch supports, and that it enables
+ * by default.  When Open vSwitch has experimental or incomplete support for
+ * newer versions of OpenFlow, those versions should not be supported by
+ * default and thus should be omitted from the latter bitmap. */
+#define OFPUTIL_SUPPORTED_VERSIONS ((1u << OFP10_VERSION) | \
+                                    (1u << OFP11_VERSION) | \
+                                    (1u << OFP12_VERSION) | \
+                                    (1u << OFP13_VERSION))
+#define OFPUTIL_DEFAULT_VERSIONS OFPUTIL_SUPPORTED_VERSIONS
 
 enum ofputil_protocol ofputil_protocols_from_string(const char *s);
 
 
 enum ofputil_protocol ofputil_protocols_from_string(const char *s);
 
index 52f5af2..fe765ee 100644 (file)
@@ -83,7 +83,7 @@ m4_define([OVS_VSWITCHD_START],
 /ofproto|INFO|datapath ID changed to fedcba9876543210/d']])
 
    dnl Add bridges, ports, etc.
 /ofproto|INFO|datapath ID changed to fedcba9876543210/d']])
 
    dnl Add bridges, ports, etc.
-   AT_CHECK([ovs-vsctl -- add-br br0 -- set bridge br0 datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]] fail-mode=secure -- $1 m4_if([$2], [], [], [| ${PERL} $srcdir/uuidfilt.pl])], [0], [$2])
+   AT_CHECK([ovs-vsctl -- add-br br0 -- set bridge br0 datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 fail-mode=secure -- $1 m4_if([$2], [], [], [| ${PERL} $srcdir/uuidfilt.pl])], [0], [$2])
 ])
 
 m4_divert_push([PREPARE_TESTS])
 ])
 
 m4_divert_push([PREPARE_TESTS])
index 8b24bd8..ec66f86 100644 (file)
@@ -231,7 +231,7 @@ test_read_hello(int argc OVS_UNUSED, char *argv[])
        if (retval == sizeof hello) {
            enum ofpraw raw;
 
        if (retval == sizeof hello) {
            enum ofpraw raw;
 
-           CHECK(hello.version, OFP10_VERSION);
+           CHECK(hello.version, OFP13_VERSION);
            CHECK(ofpraw_decode_partial(&raw, &hello, sizeof hello), 0);
            CHECK(raw, OFPRAW_OFPT_HELLO);
            CHECK(ntohs(hello.length), sizeof hello);
            CHECK(ofpraw_decode_partial(&raw, &hello, sizeof hello), 0);
            CHECK(raw, OFPRAW_OFPT_HELLO);
            CHECK(ntohs(hello.length), sizeof hello);
@@ -304,7 +304,7 @@ test_send_hello(const char *type, const void *out, size_t out_size,
            if (retval == sizeof hello) {
                enum ofpraw raw;
 
            if (retval == sizeof hello) {
                enum ofpraw raw;
 
-               CHECK(hello.version, OFP10_VERSION);
+               CHECK(hello.version, OFP13_VERSION);
                CHECK(ofpraw_decode_partial(&raw, &hello, sizeof hello), 0);
                CHECK(raw, OFPRAW_OFPT_HELLO);
                CHECK(ntohs(hello.length), sizeof hello);
                CHECK(ofpraw_decode_partial(&raw, &hello, sizeof hello), 0);
                CHECK(raw, OFPRAW_OFPT_HELLO);
                CHECK(ntohs(hello.length), sizeof hello);
@@ -355,7 +355,7 @@ test_send_plain_hello(int argc OVS_UNUSED, char *argv[])
     const char *type = argv[1];
     struct ofpbuf *hello;
 
     const char *type = argv[1];
     struct ofpbuf *hello;
 
-    hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP10_VERSION,
+    hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP13_VERSION,
                              htonl(0x12345678), 0);
     test_send_hello(type, ofpbuf_data(hello), ofpbuf_size(hello), 0);
     ofpbuf_delete(hello);
                              htonl(0x12345678), 0);
     test_send_hello(type, ofpbuf_data(hello), ofpbuf_size(hello), 0);
     ofpbuf_delete(hello);
@@ -371,7 +371,7 @@ test_send_long_hello(int argc OVS_UNUSED, char *argv[])
     struct ofpbuf *hello;
     enum { EXTRA_BYTES = 8 };
 
     struct ofpbuf *hello;
     enum { EXTRA_BYTES = 8 };
 
-    hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP10_VERSION,
+    hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP13_VERSION,
                              htonl(0x12345678), EXTRA_BYTES);
     ofpbuf_put_zeros(hello, EXTRA_BYTES);
     ofpmsg_update_length(hello);
                              htonl(0x12345678), EXTRA_BYTES);
     ofpbuf_put_zeros(hello, EXTRA_BYTES);
     ofpmsg_update_length(hello);
@@ -387,7 +387,7 @@ test_send_echo_hello(int argc OVS_UNUSED, char *argv[])
     const char *type = argv[1];
     struct ofpbuf *echo;
 
     const char *type = argv[1];
     struct ofpbuf *echo;
 
-    echo = ofpraw_alloc_xid(OFPRAW_OFPT_ECHO_REQUEST, OFP10_VERSION,
+    echo = ofpraw_alloc_xid(OFPRAW_OFPT_ECHO_REQUEST, OFP13_VERSION,
                              htonl(0x12345678), 0);
     test_send_hello(type, ofpbuf_data(echo), ofpbuf_size(echo), EPROTO);
     ofpbuf_delete(echo);
                              htonl(0x12345678), 0);
     test_send_hello(type, ofpbuf_data(echo), ofpbuf_size(echo), EPROTO);
     ofpbuf_delete(echo);
@@ -413,7 +413,7 @@ test_send_invalid_version_hello(int argc OVS_UNUSED, char *argv[])
     const char *type = argv[1];
     struct ofpbuf *hello;
 
     const char *type = argv[1];
     struct ofpbuf *hello;
 
-    hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP10_VERSION,
+    hello = ofpraw_alloc_xid(OFPRAW_OFPT_HELLO, OFP13_VERSION,
                              htonl(0x12345678), 0);
     ((struct ofp_header *) ofpbuf_data(hello))->version = 0;
     test_send_hello(type, ofpbuf_data(hello), ofpbuf_size(hello), EPROTO);
                              htonl(0x12345678), 0);
     ((struct ofp_header *) ofpbuf_data(hello))->version = 0;
     test_send_hello(type, ofpbuf_data(hello), ofpbuf_size(hello), EPROTO);
index 91c7f28..deba9dd 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -174,6 +174,23 @@ parse_options(int argc, char *argv[])
     uint32_t versions;
     enum ofputil_protocol version_protocols;
 
     uint32_t versions;
     enum ofputil_protocol version_protocols;
 
+    /* For now, ovs-ofctl only enables OpenFlow 1.0 by default.  This is
+     * because ovs-ofctl implements command such as "add-flow" as raw OpenFlow
+     * requests, but those requests have subtly different semantics in
+     * different OpenFlow versions.  For example:
+     *
+     *     - In OpenFlow 1.0, a "mod-flow" operation that does not find any
+     *       existing flow to modify adds a new flow.
+     *
+     *     - In OpenFlow 1.1, a "mod-flow" operation that does not find any
+     *       existing flow to modify adds a new flow, but only if the mod-flow
+     *       did not match on the flow cookie.
+     *
+     *     - In OpenFlow 1.2 and a later, a "mod-flow" operation never adds a
+     *       new flow.
+     */
+    set_allowed_ofp_versions("OpenFlow10");
+
     for (;;) {
         unsigned long int timeout;
         int c;
     for (;;) {
         unsigned long int timeout;
         int c;
index 78594e7..5aec270 100644 (file)
 
       <column name="protocols">
        <p>
 
       <column name="protocols">
        <p>
-         List of OpenFlow protocols that may be used when negotiating a
-         connection with a controller.  A default value of
-         <code>OpenFlow10</code> will be used if this column is empty.
+         List of OpenFlow protocols that may be used when negotiating
+         a connection with a controller.  OpenFlow 1.0, 1.1, 1.2, and
+         1.3 are enabled by default if this column is empty.
        </p>
 
        <p>
        </p>
 
        <p>