[ovs-dev] [PATCH v2 06/13] ofp-parse: Parse (draft) OpenFlow 1.5 bucket ids

Simon Horman simon.horman at netronome.com
Tue Nov 11 03:39:22 UTC 2014


This is part of support for (draft) OpenFlow 1.5 flow mod messages.

This adds support for specifying the bucket_id of buckets of groups in
ovs-ofctl and documents that accordingly.

ONF-JIRA: EXT-350
Signed-off-by: Simon Horman <simon.horman at netronome.com>

---
v2
* As suggested by Ben Pfaff
  - Use ONF-JIRA: EXT-350 annotation in changelog
---
 lib/ofp-parse.c          | 11 +++++++++--
 utilities/ovs-ofctl.8.in |  7 +++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 9d14077..1652b14 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -1120,6 +1120,13 @@ parse_bucket_str(struct ofputil_bucket *bucket, char *str_,
                 error = xasprintf("invalid watch_group id %"PRIu32,
                                   bucket->watch_group);
             }
+        } else if (!strcasecmp(key, "bucket_id")) {
+            error = str_to_u32(value, &bucket->bucket_id);
+            if (!error && bucket->bucket_id > OFPG15_BUCKET_MAX) {
+                error = xasprintf("invalid bucket_id id %"PRIu32,
+                                  bucket->bucket_id);
+            }
+            *usable_protocols &= OFPUTIL_P_OF15_UP;
         } else if (!strcasecmp(key, "action") || !strcasecmp(key, "actions")) {
             ds_put_format(&actions, "%s,", value);
         } else {
@@ -1198,7 +1205,7 @@ parse_ofp_group_mod_str__(struct ofputil_group_mod *gm, uint16_t command,
     *usable_protocols = OFPUTIL_P_OF11_UP;
 
     if (fields & F_BUCKETS) {
-        char *bkt_str = strstr(string, "bucket");
+        char *bkt_str = strstr(string, "bucket=");
 
         if (bkt_str) {
             *bkt_str = '\0';
@@ -1214,7 +1221,7 @@ parse_ofp_group_mod_str__(struct ofputil_group_mod *gm, uint16_t command,
             }
             bkt_str++;
 
-            next_bkt_str = strstr(bkt_str, "bucket");
+            next_bkt_str = strstr(bkt_str, "bucket=");
             if (next_bkt_str) {
                 *next_bkt_str = '\0';
             }
diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in
index 0fe2bd4..a6bbc97 100644
--- a/utilities/ovs-ofctl.8.in
+++ b/utilities/ovs-ofctl.8.in
@@ -1965,6 +1965,13 @@ comma-separated list of actions.
 The fields for \fIbucket_parameters\fR are:
 .
 .RS
+.IP \fBbucket_id=\fIid\fR
+The integer group id of the bucket.
+.
+This field was added in Open vSwtich 2.3 to conform with the
+OpenFlow 1.5 (draft) specification. It is not supported when
+earlier versions of OpenFlow are used. Internally Open vSwitch
+will allocate bucket ids if they are not specified using this field.
 .IP \fBactions=\fR[\fIaction\fR][\fB,\fIaction\fR...]\fR
 The syntax of actions are identical to the \fBactions=\fR field described in
 \fBFlow Syntax\fR above. Specyfing \fBactions=\fR is optional, any unknown
-- 
2.1.1




More information about the dev mailing list