This needs a rebase, please defer reviews until v2.

  Jarno

> On Feb 18, 2016, at 10:48 AM, Jarno Rajahalme <ja...@ovn.org> wrote:
> 
> ONF Extension 230 adds support for OpenFlow 1.4 bundles to OpenFlow
> 1.3.  Supporting this allows OpenFlow 1.3 controllers to start using
> bundles.
> 
> Signed-off-by: Jarno Rajahalme <ja...@ovn.org>
> ---
> NEWS                  |   5 +
> lib/ofp-errors.h      |  38 ++--
> lib/ofp-msgs.h        |  10 +-
> lib/ofp-util.c        |  22 ++-
> tests/ofproto.at      | 509 ++++++++++++++++++++++++++++++++++++++++++++++++--
> tests/ovs-ofctl.at    |  12 +-
> utilities/ovs-ofctl.c |  16 +-
> 7 files changed, 560 insertions(+), 52 deletions(-)
> 
> diff --git a/NEWS b/NEWS
> index 18fca10..6013a96 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -34,8 +34,13 @@ v2.5.0 - xx xxx xxxx
>      * Allow modifying the ICMPv4/ICMPv6 type and code fields.
>      * OpenFlow 1.4+ OFPT_SET_ASYNC_CONFIG and OFPT_GET_ASYNC_CONFIG are
>        now implemented.
> +     * OpenFlow 1.3 Extension 230, adding OpenFlow Bundles support, is
> +       now implemented.  Only flow mod and port mod messages are supported
> +       in bundles.
>    - ovs-ofctl:
>      * New "out_group" keyword for OpenFlow 1.1+ matching on output group.
> +     * '--bundle' option now adds implicit OpenFlow 1.3 support, instead
> +       of the un-official 1.4 support in OVS 2.4.
>    - Tunnels:
>      * Geneve tunnels can now match and set options and the OAM bit.
>      * The nonstandard GRE64 tunnel extension has been dropped.
> diff --git a/lib/ofp-errors.h b/lib/ofp-errors.h
> index 8e13873..7fcf394 100644
> --- a/lib/ofp-errors.h
> +++ b/lib/ofp-errors.h
> @@ -652,55 +652,59 @@ enum ofperr {
> /* ## OFPET_BUNDLE_FAILED  ## */
> /* ## -------------------- ## */
> 
> -    /* OF1.4+(17,0).  Unspecified error. */
> +    /* ONF1.3(2300), OF1.4+(17,0).  Unspecified error. */
>     OFPERR_OFPBFC_UNKNOWN,
> 
> -    /* OF1.4+(17,1).  Permissions error. */
> +    /* ONF1.3(2301), OF1.4+(17,1).  Permissions error. */
>     OFPERR_OFPBFC_EPERM,
> 
> -    /* OF1.4+(17,2).  Bundle ID doesn't exist. */
> +    /* ONF1.3(2302), OF1.4+(17,2).  Bundle ID doesn't exist. */
>     OFPERR_OFPBFC_BAD_ID,
> 
> -    /* OF1.4+(17,3).  Bundle ID already exists. */
> +    /* ONF1.3(2303), OF1.4+(17,3).  Bundle ID already exists. */
>     OFPERR_OFPBFC_BUNDLE_EXIST,
> 
> -    /* OF1.4+(17,4).  Bundle ID is closed. */
> +    /* ONF1.3(2304), OF1.4+(17,4).  Bundle ID is closed. */
>     OFPERR_OFPBFC_BUNDLE_CLOSED,
> 
> -    /* OF1.4+(17,5).  Too many bundle IDs. */
> +    /* ONF1.3(2305), OF1.4+(17,5).  Too many bundle IDs. */
>     OFPERR_OFPBFC_OUT_OF_BUNDLES,
> 
> -    /* OF1.4+(17,6).  Unsupported of unknown message control type. */
> +    /* ONF1.3(2306), OF1.4+(17,6).  Unsupported of unknown message control
> +     * type. */
>     OFPERR_OFPBFC_BAD_TYPE,
> 
> -    /* OF1.4+(17,7).  Unsupported, unknown, or inconsistent flags. */
> +    /* ONF1.3(2307), OF1.4+(17,7).  Unsupported, unknown, or inconsistent
> +     * flags. */
>     OFPERR_OFPBFC_BAD_FLAGS,
> 
> -    /* OF1.4+(17,8).  Length problem in included message. */
> +    /* ONF1.3(2308), OF1.4+(17,8).  Length problem in included message. */
>     OFPERR_OFPBFC_MSG_BAD_LEN,
> 
> -    /* OF1.4+(17,9).  Inconsistent or duplicate XID. */
> +    /* ONF1.3(2309), OF1.4+(17,9).  Inconsistent or duplicate XID. */
>     OFPERR_OFPBFC_MSG_BAD_XID,
> 
> -    /* OF1.4+(17,10).  Unsupported message in this bundle. */
> +    /* ONF1.3(2310), OF1.4+(17,10).  Unsupported message in this bundle. */
>     OFPERR_OFPBFC_MSG_UNSUP,
> 
> -    /* OF1.4+(17,11).  Unsupported message combination in this bundle. */
> +    /* ONF1.3(2311), OF1.4+(17,11).  Unsupported message combination in this
> +     * bundle. */
>     OFPERR_OFPBFC_MSG_CONFLICT,
> 
> -    /* OF1.4+(17,12).  Cant handle this many messages in bundle. */
> +    /* ONF1.3(2312), OF1.4+(17,12).  Cant handle this many messages in
> +     * bundle. */
>     OFPERR_OFPBFC_MSG_TOO_MANY,
> 
> -    /* OF1.4+(17,13).  One message in bundle failed. */
> +    /* ONF1.3(2313), OF1.4+(17,13).  One message in bundle failed. */
>     OFPERR_OFPBFC_MSG_FAILED,
> 
> -    /* OF1.4+(17,14).  Bundle is taking too long. */
> +    /* ONF1.3(2314), OF1.4+(17,14).  Bundle is taking too long. */
>     OFPERR_OFPBFC_TIMEOUT,
> 
> -    /* OF1.4+(17,15).  Bundle is locking the resource. */
> +    /* ONF1.3(2315), OF1.4+(17,15).  Bundle is locking the resource. */
>     OFPERR_OFPBFC_BUNDLE_IN_PROGRESS,
> 
> -    /* NX1.4+(22).  In an OFPT_BUNDLE_ADD_MESSAGE, the OpenFlow version in 
> the
> +    /* NX1.3+(22).  In an OFPT_BUNDLE_ADD_MESSAGE, the OpenFlow version in 
> the
>      * inner and outer messages differ. */
>     OFPERR_NXBFC_BAD_VERSION,
> 
> diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h
> index 38a2803..843812e 100644
> --- a/lib/ofp-msgs.h
> +++ b/lib/ofp-msgs.h
> @@ -259,9 +259,13 @@ enum ofpraw {
> 
>     /* OFPT 1.4+ (33): struct ofp14_bundle_ctrl_msg, uint8_t[8][]. */
>     OFPRAW_OFPT14_BUNDLE_CONTROL,
> +    /* ONFT 1.3 (2300): struct ofp14_bundle_ctrl_msg, uint8_t[8][]. */
> +    OFPRAW_ONFT13_BUNDLE_CONTROL,
> 
>     /* OFPT 1.4+ (34): struct ofp14_bundle_ctrl_msg, uint8_t[]. */
>     OFPRAW_OFPT14_BUNDLE_ADD_MESSAGE,
> +    /* ONFT 1.3 (2301): struct ofp14_bundle_ctrl_msg, uint8_t[]. */
> +    OFPRAW_ONFT13_BUNDLE_ADD_MESSAGE,
> 
> /* Standard statistics. */
> 
> @@ -580,9 +584,11 @@ enum ofptype {
>     /* Request forwarding by the switch. */
>     OFPTYPE_REQUESTFORWARD,       /* OFPRAW_OFPT14_REQUESTFORWARD. */
> 
> -    OFPTYPE_BUNDLE_CONTROL,       /* OFPRAW_OFPT14_BUNDLE_CONTROL. */
> +    OFPTYPE_BUNDLE_CONTROL,       /* OFPRAW_OFPT14_BUNDLE_CONTROL.
> +                                   * OFPRAW_ONFT13_BUNDLE_CONTROL. */
> 
> -    OFPTYPE_BUNDLE_ADD_MESSAGE,   /* OFPRAW_OFPT14_BUNDLE_ADD_MESSAGE. */
> +    OFPTYPE_BUNDLE_ADD_MESSAGE,   /* OFPRAW_OFPT14_BUNDLE_ADD_MESSAGE.
> +                                   * OFPRAW_ONFT13_BUNDLE_ADD_MESSAGE. */
> 
>     /* Statistics. */
>     OFPTYPE_DESC_STATS_REQUEST,      /* OFPRAW_OFPST_DESC_REQUEST. */
> diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> index aa4d2f3..b717817 100644
> --- a/lib/ofp-util.c
> +++ b/lib/ofp-util.c
> @@ -9095,7 +9095,8 @@ ofputil_decode_bundle_ctrl(const struct ofp_header *oh,
> 
>     ofpbuf_use_const(&b, oh, ntohs(oh->length));
>     raw = ofpraw_pull_assert(&b);
> -    ovs_assert(raw == OFPRAW_OFPT14_BUNDLE_CONTROL);
> +    ovs_assert(raw == OFPRAW_OFPT14_BUNDLE_CONTROL
> +               || raw == OFPRAW_ONFT13_BUNDLE_CONTROL);
> 
>     m = b.msg;
>     msg->bundle_id = ntohl(m->bundle_id);
> @@ -9116,12 +9117,14 @@ ofputil_encode_bundle_ctrl_request(enum ofp_version 
> ofp_version,
>     case OFP10_VERSION:
>     case OFP11_VERSION:
>     case OFP12_VERSION:
> -    case OFP13_VERSION:
> -        ovs_fatal(0, "bundles need OpenFlow 1.4 or later "
> +        ovs_fatal(0, "bundles need OpenFlow 1.3 or later "
>                      "(\'-O OpenFlow14\')");
> +    case OFP13_VERSION:
>     case OFP14_VERSION:
>     case OFP15_VERSION:
> -        request = ofpraw_alloc(OFPRAW_OFPT14_BUNDLE_CONTROL, ofp_version, 0);
> +        request = ofpraw_alloc(ofp_version == OFP13_VERSION
> +                               ? OFPRAW_ONFT13_BUNDLE_CONTROL
> +                               : OFPRAW_OFPT14_BUNDLE_CONTROL, ofp_version, 
> 0);
>         m = ofpbuf_put_zeros(request, sizeof *m);
> 
>         m->bundle_id = htonl(bc->bundle_id);
> @@ -9142,7 +9145,9 @@ ofputil_encode_bundle_ctrl_reply(const struct 
> ofp_header *oh,
>     struct ofpbuf *buf;
>     struct ofp14_bundle_ctrl_msg *m;
> 
> -    buf = ofpraw_alloc_reply(OFPRAW_OFPT14_BUNDLE_CONTROL, oh, 0);
> +    buf = ofpraw_alloc_reply(oh->version == OFP13_VERSION
> +                             ? OFPRAW_ONFT13_BUNDLE_CONTROL
> +                             : OFPRAW_OFPT14_BUNDLE_CONTROL, oh, 0);
>     m = ofpbuf_put_zeros(buf, sizeof *m);
> 
>     m->bundle_id = htonl(msg->bundle_id);
> @@ -9258,7 +9263,8 @@ ofputil_decode_bundle_add(const struct ofp_header *oh,
> 
>     ofpbuf_use_const(&b, oh, ntohs(oh->length));
>     raw = ofpraw_pull_assert(&b);
> -    ovs_assert(raw == OFPRAW_OFPT14_BUNDLE_ADD_MESSAGE);
> +    ovs_assert(raw == OFPRAW_OFPT14_BUNDLE_ADD_MESSAGE
> +               || raw == OFPRAW_ONFT13_BUNDLE_ADD_MESSAGE);
> 
>     m = ofpbuf_pull(&b, sizeof *m);
>     msg->bundle_id = ntohl(m->bundle_id);
> @@ -9304,7 +9310,9 @@ ofputil_encode_bundle_add(enum ofp_version ofp_version,
>     struct ofp14_bundle_ctrl_msg *m;
> 
>     /* Must use the same xid as the embedded message. */
> -    request = ofpraw_alloc_xid(OFPRAW_OFPT14_BUNDLE_ADD_MESSAGE, ofp_version,
> +    request = ofpraw_alloc_xid(ofp_version == OFP13_VERSION
> +                               ? OFPRAW_ONFT13_BUNDLE_ADD_MESSAGE
> +                               : OFPRAW_OFPT14_BUNDLE_ADD_MESSAGE, 
> ofp_version,
>                                msg->msg->xid, 0);
>     m = ofpbuf_put_zeros(request, sizeof *m);
> 
> diff --git a/tests/ofproto.at b/tests/ofproto.at
> index ea3e073..7dd3d4b 100644
> --- a/tests/ofproto.at
> +++ b/tests/ofproto.at
> @@ -3918,7 +3918,7 @@ OVS_VSWITCHD_STOP
> AT_CLEANUP
> 
> 
> -AT_SETUP([ofproto - bundles, open (OpenFlow 1.4)])
> +AT_SETUP([ofproto - bundle open (OpenFlow 1.4)])
> AT_KEYWORDS([monitor])
> OVS_VSWITCHD_START
> 
> @@ -3942,7 +3942,7 @@ OFPT_BARRIER_REPLY (OF1.4):
> OVS_VSWITCHD_STOP
> AT_CLEANUP
> 
> -AT_SETUP([ofproto - bundles, double open (OpenFlow 1.4)])
> +AT_SETUP([ofproto - bundle double open (OpenFlow 1.4)])
> AT_KEYWORDS([monitor])
> OVS_VSWITCHD_START
> 
> @@ -4172,7 +4172,7 @@ add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc 
> actions=7
> delete in_port=2 dl_src=00:88:99:aa:bb:cc
> ])
> 
> -AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> +AT_CHECK([ovs-ofctl -O OpenFlow14 --bundle add-flows br0 flows.txt])
> 
> AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
>  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
> @@ -4185,7 +4185,7 @@ modify actions=drop
> modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
> ])
> 
> -AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> +AT_CHECK([ovs-ofctl -O OpenFlow14 --bundle add-flows br0 flows.txt])
> 
> AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
>  idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
> @@ -4200,7 +4200,7 @@ delete_strict in_port=2 dl_src=00:66:77:88:99:aa
> add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
> ])
> 
> -AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> +AT_CHECK([ovs-ofctl -O OpenFlow14 --bundle add-flows br0 flows.txt])
> 
> AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
>  idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
> @@ -4223,8 +4223,8 @@ vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
> vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
>  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
> vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
> - version bitmap: 0x05
> -vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 
> and earlier, peer supports version 0x05)
> + version bitmap: 0x04, 0x05
> +vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 
> and earlier, peer supports versions 0x04, 0x05)
> vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
>  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
> vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
> @@ -4275,8 +4275,8 @@ vconn|DBG|unix: sent (Success): NXST_FLOW reply:
> vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
>  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
> vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
> - version bitmap: 0x05
> -vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 
> and earlier, peer supports version 0x05)
> + version bitmap: 0x04, 0x05
> +vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 
> and earlier, peer supports versions 0x04, 0x05)
> vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
>  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
> vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
> @@ -4306,8 +4306,8 @@ vconn|DBG|unix: sent (Success): NXST_FLOW reply:
> vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
>  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
> vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
> - version bitmap: 0x05
> -vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 
> and earlier, peer supports version 0x05)
> + version bitmap: 0x04, 0x05
> +vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 
> and earlier, peer supports versions 0x04, 0x05)
> vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
>  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
> vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
> @@ -4375,7 +4375,7 @@ delete in_port=2 dl_src=00:88:99:aa:bb:cc
> add table=254 actions=drop
> ])
> 
> -AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/|WARN|/d
> +AT_CHECK([ovs-ofctl -O OpenFlow14 --bundle add-flows br0 flows.txt 2>&1 | 
> sed '/|WARN|/d
> s/unix:.*br0\.mgmt/unix:br0.mgmt/' | sed 's/(.* error)/(error)/'],
> [0], [dnl
> OFPT_ERROR (OF1.4) (xid=0xb): OFPBRC_EPERM
> @@ -4395,3 +4395,488 @@ NXST_FLOW reply:
> 
> OVS_VSWITCHD_STOP
> AT_CLEANUP
> +
> +
> +AT_SETUP([ofproto - bundle open (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_EXPERIMENTER (04), length (0018),
> +# xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
> +# ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
> +# message type (0000), and flags (0002)
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 00 00 02"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl exit
> +
> +AT_CHECK([ofctl_strip < monitor.log], [], [dnl
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=OPEN_REQUEST flags=ordered
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=OPEN_REPLY flags=0
> +OFPT_BARRIER_REPLY (OF1.3):
> +])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +AT_SETUP([ofproto - bundle double open (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 twice an OpenFlow13 message (04), OFPT_EXPERIMENTER (04), length 
> (0018),
> +# xid (0000000a), ONF_EXPERIMENTER_ID (4F4E4600),
> +# ONFT_BUNDLE_CONTROL (2300 = 0x08FC), bundle id (00000001),
> +# message type (0000), and flags (0002)
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 00 00 02"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 00 00 02"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl exit
> +
> +AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=OPEN_REQUEST flags=ordered
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=OPEN_REPLY flags=0
> +OFPT_BARRIER_REPLY (OF1.3):
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=OPEN_REQUEST flags=ordered
> +OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=OPEN_REQUEST flags=ordered
> +OFPT_BARRIER_REPLY (OF1.3):
> +])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +AT_SETUP([ofproto - bundle close without open (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])
> +
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 02 00 02"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl exit
> +
> +AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
> +OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
> +OFPT_BARRIER_REPLY (OF1.3):
> +])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +AT_SETUP([ofproto - bundle double close (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])
> +
> +# Open, Close, Close
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 00 00 02"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 02 00 02"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 02 00 02"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl exit
> +
> +AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=OPEN_REQUEST flags=ordered
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=OPEN_REPLY flags=0
> +OFPT_BARRIER_REPLY (OF1.3):
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=CLOSE_REPLY flags=0
> +OFPT_BARRIER_REPLY (OF1.3):
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
> +OFPT_ERROR (OF1.3): OFPBFC_BUNDLE_CLOSED
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=CLOSE_REQUEST flags=ordered
> +OFPT_BARRIER_REPLY (OF1.3):
> +])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +AT_SETUP([ofproto - bundle close, different flags (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])
> +
> +# Open, Close
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 00 00 02"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 02 00 01"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl exit
> +
> +AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=OPEN_REQUEST flags=ordered
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=OPEN_REPLY flags=0
> +OFPT_BARRIER_REPLY (OF1.3):
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
> +OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=CLOSE_REQUEST flags=atomic
> +OFPT_BARRIER_REPLY (OF1.3):
> +])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +AT_SETUP([ofproto - bundle commit without open (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])
> +
> +# Commit
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 04 00 02"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl exit
> +
> +AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
> +OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=COMMIT_REQUEST flags=ordered
> +OFPT_BARRIER_REPLY (OF1.3):
> +])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +AT_SETUP([ofproto - bundle commit, different flags (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])
> +
> +# Open, Commit
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 00 00 02"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 04 00 01"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl exit
> +
> +AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=OPEN_REQUEST flags=ordered
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=OPEN_REPLY flags=0
> +OFPT_BARRIER_REPLY (OF1.3):
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
> +OFPT_ERROR (OF1.3): OFPBFC_BAD_FLAGS
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=COMMIT_REQUEST flags=atomic
> +OFPT_BARRIER_REPLY (OF1.3):
> +])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +AT_SETUP([ofproto - bundle discard without open (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])
> +
> +# Discard
> +ovs-appctl -t ovs-ofctl ofctl/send "04 04 00 18 00 00 00 0a 4F 4E 46 00 00 
> 00 08 FC 00 00 00 01 00 06 00 02"
> +ovs-appctl -t ovs-ofctl ofctl/barrier
> +ovs-appctl -t ovs-ofctl exit
> +
> +AT_CHECK([ofctl_strip < monitor.log], [0], [dnl
> +send: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
> +OFPT_ERROR (OF1.3): OFPBFC_BAD_ID
> +ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0x1 type=DISCARD_REQUEST flags=ordered
> +OFPT_BARRIER_REPLY (OF1.3):
> +])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +
> +AT_SETUP([ofproto - bundle with multiple flow mods (OpenFlow 1.3)])
> +AT_KEYWORDS([monitor])
> +OVS_VSWITCHD_START
> +
> +AT_CHECK([ovs-appctl vlog/set vconn:dbg])
> +
> +AT_CHECK([ovs-ofctl del-flows br0])
> +
> +AT_DATA([flows.txt], [dnl
> +add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
> +add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
> +add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
> +add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
> +delete
> +add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
> +add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
> +add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
> +delete in_port=2 dl_src=00:88:99:aa:bb:cc
> +])
> +
> +AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> +
> +AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> + idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
> + idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
> +NXST_FLOW reply:
> +])
> +
> +AT_DATA([flows.txt], [dnl
> +modify actions=drop
> +modify_strict in_port=2 dl_src=00:77:88:99:aa:bb actions=7
> +])
> +
> +AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> +
> +AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> + idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
> + idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
> +NXST_FLOW reply:
> +])
> +
> +# Adding an existing flow acts as a modify, and delete_strict also works.
> +AT_DATA([flows.txt], [dnl
> +add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=8
> +delete_strict in_port=2 dl_src=00:66:77:88:99:aa
> +add in_port=2 dl_src=00:66:77:88:99:aa actions=drop
> +])
> +
> +AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
> +
> +AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> + idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
> + in_port=2,dl_src=00:66:77:88:99:aa actions=drop
> +NXST_FLOW reply:
> +])
> +
> +dnl Check logs for OpenFlow trace
> +# Prevent race.
> +OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- 
> "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3])
> +AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl
> +vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
> + version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
> +vconn|DBG|unix: received: OFPT_HELLO:
> + version bitmap: 0x01
> +vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 
> and earlier, peer supports version 0x01)
> +vconn|DBG|unix: received: OFPT_FLOW_MOD: DEL actions=drop
> +vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
> +vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
> +vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
> + version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
> +vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
> + version bitmap: 0x04
> +vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 
> and earlier, peer supports version 0x04)
> +vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
> +vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0 type=OPEN_REPLY flags=0
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 
> actions=output:1
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 
> actions=output:2
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 
> actions=output:3
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 
> actions=output:4
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): DEL table:255 actions=drop
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa idle:50 
> actions=output:5
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 
> actions=output:6
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:88:99:aa:bb:cc idle:70 
> actions=output:7
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): DEL table:255 in_port=2,dl_src=00:88:99:aa:bb:cc 
> actions=drop
> +vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
> +vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0 type=COMMIT_REPLY flags=0
> +vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
> + version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
> +vconn|DBG|unix: received: OFPT_HELLO:
> + version bitmap: 0x01
> +vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 
> and earlier, peer supports version 0x01)
> +vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
> +vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
> +vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
> +vconn|DBG|unix: received: NXST_FLOW request:
> +vconn|DBG|unix: sent (Success): NXST_FLOW reply:
> + idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:5
> + idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:6
> +vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
> + version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
> +vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
> + version bitmap: 0x04
> +vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 
> and earlier, peer supports version 0x04)
> +vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
> +vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0 type=OPEN_REPLY flags=0
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): MOD actions=drop
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): MOD_STRICT in_port=2,dl_src=00:77:88:99:aa:bb 
> actions=output:7
> +vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
> +vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0 type=COMMIT_REPLY flags=0
> +vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
> + version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
> +vconn|DBG|unix: received: OFPT_HELLO:
> + version bitmap: 0x01
> +vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 
> and earlier, peer supports version 0x01)
> +vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
> +vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
> +vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
> +vconn|DBG|unix: received: NXST_FLOW request:
> +vconn|DBG|unix: sent (Success): NXST_FLOW reply:
> + idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=drop
> + idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:7
> +vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
> + version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
> +vconn|DBG|unix: received: OFPT_HELLO (OF1.3):
> + version bitmap: 0x04
> +vconn|DBG|unix: negotiated OpenFlow version 0x04 (we support version 0x06 
> and earlier, peer supports version 0x04)
> +vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
> +vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0 type=OPEN_REPLY flags=0
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:77:88:99:aa:bb idle:60 
> actions=output:8
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): DEL_STRICT table:255 
> in_port=2,dl_src=00:66:77:88:99:aa actions=drop
> +vconn|DBG|unix: received: ONFT_BUNDLE_ADD_MESSAGE (OF1.3):
> + bundle_id=0 flags=atomic ordered
> +OFPT_FLOW_MOD (OF1.3): ADD in_port=2,dl_src=00:66:77:88:99:aa actions=drop
> +vconn|DBG|unix: received: ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
> +vconn|DBG|unix: sent (Success): ONFT_BUNDLE_CONTROL (OF1.3):
> + bundle_id=0 type=COMMIT_REPLY flags=0
> +vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
> + version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
> +vconn|DBG|unix: received: OFPT_HELLO:
> + version bitmap: 0x01
> +vconn|DBG|unix: negotiated OpenFlow version 0x01 (we support version 0x06 
> and earlier, peer supports version 0x01)
> +vconn|DBG|unix: received: NXT_SET_FLOW_FORMAT: format=nxm
> +vconn|DBG|unix: received: OFPT_BARRIER_REQUEST:
> +vconn|DBG|unix: sent (Success): OFPT_BARRIER_REPLY:
> +vconn|DBG|unix: received: NXST_FLOW request: 
> +vconn|DBG|unix: sent (Success): NXST_FLOW reply:
> + idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:8
> + in_port=2,dl_src=00:66:77:88:99:aa actions=drop
> +])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> +
> +
> +AT_SETUP([ofproto - failing bundle commit (OpenFlow 1.3)])
> +AT_KEYWORDS([monitor])
> +OVS_VSWITCHD_START
> +
> +AT_CHECK([ovs-ofctl del-flows br0])
> +
> +ovs-ofctl add-flows br0 - <<EOF
> +idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=11
> +idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=22
> +idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=33
> +EOF
> +AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> + idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
> + idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
> + idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
> +NXST_FLOW reply:
> +])
> +
> +# last line uses illegal table number (OVS internal table)
> +AT_DATA([flows.txt], [dnl
> +add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=1
> +add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=2
> +add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=3
> +modify idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=4
> +delete
> +add idle_timeout=50 in_port=2 dl_src=00:66:77:88:99:aa actions=5
> +add idle_timeout=60 in_port=2 dl_src=00:77:88:99:aa:bb actions=6
> +add idle_timeout=70 in_port=2 dl_src=00:88:99:aa:bb:cc actions=7
> +delete in_port=2 dl_src=00:88:99:aa:bb:cc
> +add table=254 actions=drop
> +])
> +
> +AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt 2>&1 | sed '/|WARN|/d
> +s/unix:.*br0\.mgmt/unix:br0.mgmt/' | sed 's/(.* error)/(error)/'],
> +[0], [dnl
> +OFPT_ERROR (OF1.3) (xid=0xb): OFPBRC_EPERM
> +OFPT_FLOW_MOD (OF1.3) (xid=0xb): ADD table:254 actions=drop
> +OFPT_ERROR (OF1.3) (xid=0xd): OFPBFC_MSG_FAILED
> +ONFT_BUNDLE_CONTROL (OF1.3) (xid=0xd):
> + bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
> +ovs-ofctl: talking to unix:br0.mgmt (error)
> +])
> +
> +AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> + idle_timeout=50, in_port=2,dl_src=00:66:77:88:99:aa actions=output:11
> + idle_timeout=60, in_port=2,dl_src=00:77:88:99:aa:bb actions=output:22
> + idle_timeout=70, in_port=2,dl_src=00:88:99:aa:bb:cc actions=output:33
> +NXST_FLOW reply:
> +])
> +
> +OVS_VSWITCHD_STOP
> +AT_CLEANUP
> diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
> index f26f622..40b84b9 100644
> --- a/tests/ovs-ofctl.at
> +++ b/tests/ovs-ofctl.at
> @@ -2892,11 +2892,11 @@ AT_CHECK([ovs-appctl vlog/set vconn:dbg])
> 
> dnl Add flows to br0 with importance via OF1.4+, using an OF1.4+ bundle. For 
> more details refer "ovs-ofctl rule with importance" test case.
> for i in 1 2 3 4 5 6 7 8; do echo 
> "table=$i,dl_vlan=$i,importance=$i,actions=drop"; done > add-flows.txt
> -AT_CHECK([ovs-ofctl --bundle add-flows br0 add-flows.txt])
> +AT_CHECK([ovs-ofctl -O OpenFlow14 --bundle add-flows br0 add-flows.txt])
> 
> dnl Replace some flows in the bridge.
> for i in 1 3 5 7; do echo " table=$i, importance=`expr $i + 10`, dl_vlan=$i 
> actions=drop"; done > replace-flows.txt
> -AT_CHECK([ovs-ofctl --bundle replace-flows br0 replace-flows.txt])
> +AT_CHECK([ovs-ofctl -O OpenFlow14 --bundle replace-flows br0 
> replace-flows.txt])
> 
> dnl Dump them and compare the dump flows output against the expected output.
> cat replace-flows.txt > expout
> @@ -2911,8 +2911,8 @@ AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], 
> [0], [dnl
> vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
>  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
> vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
> - version bitmap: 0x05
> -vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 
> and earlier, peer supports version 0x05)
> + version bitmap: 0x04, 0x05
> +vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 
> and earlier, peer supports versions 0x04, 0x05)
> vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
>  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
> vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
> @@ -2948,8 +2948,8 @@ vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL 
> (OF1.4):
> vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
>  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
> vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
> - version bitmap: 0x05
> -vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 
> and earlier, peer supports version 0x05)
> + version bitmap: 0x04, 0x05
> +vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 
> and earlier, peer supports versions 0x04, 0x05)
> vconn|DBG|unix: received: OFPST_FLOW request (OF1.4):
> vconn|DBG|unix: sent (Success): OFPST_FLOW reply (OF1.4):
>  table=1, importance=1, dl_vlan=1 actions=drop
> diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
> index 96d6c89..3f7c75c 100644
> --- a/utilities/ovs-ofctl.c
> +++ b/utilities/ovs-ofctl.c
> @@ -67,8 +67,8 @@
> 
> VLOG_DEFINE_THIS_MODULE(ofctl);
> 
> -/* --bundle: Use OpenFlow 1.4 bundle for making the flow table change atomic.
> - * NOTE: Also the flow mod will use OpenFlow 1.4, so the semantics may be
> +/* --bundle: Use OpenFlow 1.3+ bundle for making the flow table change 
> atomic.
> + * NOTE: Also the flow mod will use OpenFlow 1.3, so the semantics may be
>  * different (see the comment in parse_options() for details).
>  */
> static bool bundle = false;
> @@ -307,14 +307,14 @@ parse_options(int argc, char *argv[])
> 
>     free(short_options);
> 
> -    /* Implicit OpenFlow 1.4 with the '--bundle' option. */
> +    /* Implicit OpenFlow 1.3 with the '--bundle' option. */
>     if (bundle) {
> -        /* Add implicit allowance for OpenFlow 1.4. */
> +        /* Add implicit allowance for OpenFlow 1.3. */
>         add_allowed_ofp_versions(ofputil_protocols_to_version_bitmap(
> -                                     OFPUTIL_P_OF14_OXM));
> +                                     OFPUTIL_P_OF13_OXM));
>         /* Remove all prior versions. */
>         mask_allowed_ofp_versions(ofputil_protocols_to_version_bitmap(
> -                                     OFPUTIL_P_OF14_UP));
> +                                     OFPUTIL_P_OF13_UP));
>     }
>     versions = get_allowed_ofp_versions();
>     version_protocols = ofputil_protocols_from_version_bitmap(versions);
> @@ -1317,8 +1317,8 @@ bundle_flow_mod__(const char *remote, struct 
> ofputil_flow_mod *fms,
> 
>     list_init(&requests);
> 
> -    /* Bundles need OpenFlow 1.4+. */
> -    usable_protocols &= OFPUTIL_P_OF14_UP;
> +    /* Bundles need OpenFlow 1.3+. */
> +    usable_protocols &= OFPUTIL_P_OF13_UP;
>     protocol = open_vconn_for_flow_mod(remote, &vconn, usable_protocols);
> 
>     for (i = 0; i < n_fms; i++) {
> -- 
> 2.1.4
> 


_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to