[ovs-dev,2/3] ovs-ofctl: Add "out_group" keyword for OF1.1+ matching on output group.
diff mbox

Message ID 1441751019-8625-2-git-send-email-blp@nicira.com
State Superseded
Headers show

Commit Message

Ben Pfaff Sept. 8, 2015, 10:23 p.m. UTC
It seems that OVS has never supported this OpenFlow feature in ovs-ofctl,
which makes it hard to test.  This commit adds support.

(Open vSwitch has supported this in OpenFlow for a long time; it's only
ovs-ofctl that didn't.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
---
 NEWS                     | 2 ++
 lib/ofp-parse.c          | 6 ++++++
 utilities/ovs-ofctl.8.in | 9 ++++++++-
 3 files changed, 16 insertions(+), 1 deletion(-)

Patch
diff mbox

diff --git a/NEWS b/NEWS
index ca22c8e..45f05c7 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@  Post-v2.4.0
      * OpenFlow 1.4+ "importance" is now considered for flow eviction.
      * OpenFlow 1.4+ OFPTC_EVICTION is now implemented.
      * OpenFlow 1.4+ OFPMP_TABLE_DESC is now implemented.
+   - ovs-ofctl:
+     * New "out_group" keyword for OpenFlow 1.1+ matching on output group.
    - Support for matching/generating options as well as the OAM bit with
      Geneve tunnels.
    - Support Multicast Listener Discovery (MLDv1 and MLDv2).
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index eaaa8ba..b797853 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -398,6 +398,12 @@  parse_ofp_str__(struct ofputil_flow_mod *fm, int command, char *string,
                     error = xasprintf("%s is not a valid OpenFlow port",
                                       value);
                 }
+            } else if (fields & F_OUT_PORT && !strcmp(name, "out_group")) {
+                *usable_protocols &= OFPUTIL_P_OF11_UP;
+                if (!ofputil_group_from_string(value, &fm->out_group)) {
+                    error = xasprintf("%s is not a valid OpenFlow group",
+                                      value);
+                }
             } else if (fields & F_PRIORITY && !strcmp(name, "priority")) {
                 uint16_t priority = 0;
 
diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in
index 8bb3715..16f4a30 100644
--- a/utilities/ovs-ofctl.8.in
+++ b/utilities/ovs-ofctl.8.in
@@ -2275,13 +2275,20 @@  check is expensive so it is best to avoid it.)
 .
 .PP
 The \fBdump\-flows\fR, \fBdump\-aggregate\fR, \fBdel\-flow\fR 
-and \fBdel\-flows\fR commands support one additional optional field:
+and \fBdel\-flows\fR commands support these additional optional fields:
 .
 .TP
 \fBout_port=\fIport\fR
 If set, a matching flow must include an output action to \fIport\fR,
 which must be an OpenFlow port number or name (e.g. \fBlocal\fR).
 .
+.TP
+\fBout_group=\fIport\fR
+If set, a matching flow must include an \fBgroup\fR action naming
+\fIgroup\fR, which must be an OpenFlow group number.  This field
+is supported in Open vSwitch 2.5 and later and requires OpenFlow 1.1
+or later.
+.
 .SS "Table Entry Output"
 .
 The \fBdump\-tables\fR and \fBdump\-aggregate\fR commands print information