On Wed, Jun 29, 2016 at 12:29:25AM +0200, Jan Scheurich wrote:
> This patch adds support for a new Group Mod command OFPGC_ADD_OR_MOD to
> OVS for all OpenFlow versions that support groups (OF11 and higher).
> The new ADD_OR_MOD creates a group that does not yet exist (like ADD)
> and modifies an existing group (like MODIFY).
> 
> Rational: In OpenFlow 1.x the Group Mod commands OFPGC_ADD and
> OFPGC_MODIFY have strict semantics: ADD fails if the group exists,
> while MODIFY fails if the group does not exist. This requires a
> controller to exactly know the state of the switch when programming a
> group in order not run the risk of getting an OFP Error message in
> response. This is hard to achieve and maintain at all times in view of
> possible switch and controller restarts or other connection losses
> between switch and controller.
> 
> Due to the un-acknowledged nature of the Group Mod message programming
> groups safely and efficiently at the same time is virtually impossible
> as the controller has to either query the existence of the group prior
> to each Group Mod message or to insert a Barrier Request/Reply after
> every group to be sure that no Error can be received at a later stage
> and require a complicated roll-back of any dependent actions taken
> between the failed Group Mod and the Error.
> 
> In the ovs-ofctl command line the ADD_OR_MOD command is made available
> through the new option --may-create in the mod-group command:
> 
> $ ovs-ofctl -Oopenflow13 del-groups br-int group_id=100
> 
> $ ovs-ofctl -Oopenflow13 mod-group br-int
> group_id=100,type=indirect,bucket=actions=2 OFPT_ERROR (OF1.3)
> (xid=0x2): OFPGMFC_UNKNOWN_GROUP OFPT_GROUP_MOD (OF1.3) (xid=0x2):
>  MOD group_id=100,type=indirect,bucket=actions=output:2
> 
> $ ovs-ofctl -Oopenflow13 --may-create mod-group br-int
> group_id=100,type=indirect,bucket=actions=2
> 
> $ ovs-ofctl -Oopenflow13 dump-groups br-int
> OFPST_GROUP_DESC reply (OF1.3) (xid=0x2):
>  group_id=100,type=indirect,bucket=actions=output:2
> 
> $ ovs-ofctl -Oopenflow13 --may-create mod-group br-int
> group_id=100,type=indirect,bucket=actions=3
> 
> $ ovs-ofctl -Oopenflow13 dump-groups br-int
> OFPST_GROUP_DESC reply (OF1.3) (xid=0x2):
>  group_id=100,type=indirect,bucket=actions=output:3
>  
> Patch v3:
> - Rebased to master
> 
> Patch v2:
> - Replaced new ovs-ofctl write-group command with --may-create option for 
> mod-group
> - Updated ovs-ofctl --help message
> - Added a test for the new command option
> - Updated documentation
> 
> Signed-off-by: Jan Scheurich <jan.scheurich at web.de>

Thanks for the patch!  I applied this to master, folding in the
following incremental.

--8<--------------------------cut here-------------------------->8--

diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in
index d69fe13..94e78d7 100755
--- a/utilities/ovs-ofctl.8.in
+++ b/utilities/ovs-ofctl.8.in
@@ -434,7 +434,11 @@ Add each group entry to \fIswitch\fR's tables.
 .IP "[\fB\-\-may\-create\fR] \fBmod\-group \fIswitch group\fR"
 .IQ "[\fB\-\-may\-create\fR] \fBmod\-group \fIswitch \fB\- < \fIfile\fR"
 Modify the action buckets in entries from \fIswitch\fR's tables for
-each group entry. Optionally create non-existing group entries.
+each group entry.  If a specified group does not already exist, then
+without \fB\-\-may\-create\fR, this command has no effect; with
+\fB\-\-may\-create\fR, it creates a new group.  The
+\fB\-\-may\-create\fR option uses an Open vSwitch extension to
+OpenFlow only implemented in Open vSwitch 2.6 and later.
 .
 .IP "\fBdel\-groups \fIswitch\fR"
 .IQ "\fBdel\-groups \fIswitch \fR[\fIgroup\fR]"
@@ -2944,14 +2948,8 @@ Bundles require OpenFlow 1.4 or higher.  An explicit 
\fB-O
 OpenFlow14\fR option is not needed, but you may need to enable
 OpenFlow 1.4 support for OVS by setting the OVSDB \fIprotocols\fR
 column in the \fIbridge\fR table.
-.
 .RE
 .
-.IP "\fB\-\-may\-create\fR"
-A mod-group command creates a group if it doesn't exist yet. This uses
-an Open vSwitch extension to OpenFlow and only works with Open vSwitch
-2.6 and later.
-.
 .so lib/ofp-version.man
 .
 .IP "\fB\-F \fIformat\fR[\fB,\fIformat\fR...]"
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 0bf8e44..8b02722 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -84,9 +84,9 @@ static bool enable_color;
  */
 static bool strict;
 
-/* --may-create: A mod-group command creates a group that does not yet exist.
- */
-static bool may_create = false;
+/* --may-create: If true, the mod-group command creates a group that does not
+ * yet exist; otherwise, such a command has no effect. */
+static bool may_create;
 
 /* --readd: If true, on replace-flows, re-add even flows that have not changed
  * (to reset flow counters). */
@@ -416,7 +416,7 @@ usage(void)
            "  snoop SWITCH                snoop on SWITCH and its controller\n"
            "  add-group SWITCH GROUP      add group described by GROUP\n"
            "  add-groups SWITCH FILE      add group from FILE\n"
-           "  mod-group SWITCH GROUP      modify specific group\n"
+           "  [--may-create] mod-group SWITCH GROUP   modify specific group\n"
            "  del-groups SWITCH [GROUP]   delete matching GROUPs\n"
            "  insert-buckets SWITCH [GROUP] add buckets to GROUP\n"
            "  remove-buckets SWITCH [GROUP] remove buckets from GROUP\n"
@@ -452,7 +452,6 @@ usage(void)
     vlog_usage();
     printf("\nOther options:\n"
            "  --strict                    use strict match for flow commands\n"
-           "  --may-create                mod-group creates a non-existing 
group\n"
            "  --readd                     replace flows that haven't changed\n"
            "  -F, --flow-format=FORMAT    force particular flow format\n"
            "  -P, --packet-in-format=FRMT force particular packet in format\n"
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to