OpenFlow Spec 1.5 adds bucket_id and properties fields.
And also introduces command_bucket_id field which indicates
Bucket Id used as part of the new commands, OFPGC_INSERT_BUCKET
and OFPGC_REMOVE_BUCKET.

This patch adds these fields support and fixes the example of
usage according to this changes.

Signed-off-by: IWASE Yusuke <[email protected]>
---
 ryu/ofproto/ofproto_v1_5_parser.py | 64 ++++++++++++++++++++++++--------------
 1 file changed, 41 insertions(+), 23 deletions(-)

diff --git a/ryu/ofproto/ofproto_v1_5_parser.py 
b/ryu/ofproto/ofproto_v1_5_parser.py
index 4d08ad9..a40c79f 100644
--- a/ryu/ofproto/ofproto_v1_5_parser.py
+++ b/ryu/ofproto/ofproto_v1_5_parser.py
@@ -5798,23 +5798,28 @@ class OFPGroupMod(MsgBase):
 
     The controller sends this message to modify the group table.
 
-    ================ ======================================================
-    Attribute        Description
-    ================ ======================================================
-    command          One of the following values.
-
-                     | OFPGC_ADD
-                     | OFPGC_MODIFY
-                     | OFPGC_DELETE
-    type             One of the following values.
-
-                     | OFPGT_ALL
-                     | OFPGT_SELECT
-                     | OFPGT_INDIRECT
-                     | OFPGT_FF
-    group_id         Group identifier
-    buckets          list of ``OFPBucket``
-    ================ ======================================================
+    ================== ======================================================
+    Attribute          Description
+    ================== ======================================================
+    command            One of the following values.
+
+                       | OFPGC_ADD
+                       | OFPGC_MODIFY
+                       | OFPGC_DELETE
+                       | OFPGC_INSERT_BUCKET
+                       | OFPGC_REMOVE_BUCKET
+    type               One of the following values.
+
+                       | OFPGT_ALL
+                       | OFPGT_SELECT
+                       | OFPGT_INDIRECT
+                       | OFPGT_FF
+    group_id           Group identifier.
+    command_bucket_id  Bucket Id used as part of OFPGC_INSERT_BUCKET and
+                       OFPGC_REMOVE_BUCKET commands execution.
+    buckets            List of ``OFPBucket`` instance
+    properties         List of ``OFPGroupProp`` instance
+    ================== ======================================================
 
     ``type`` attribute corresponds to ``type_`` parameter of __init__.
 
@@ -5835,27 +5840,40 @@ class OFPGroupMod(MsgBase):
                                             actions)]
 
             group_id = 1
+            command_bucket_id=1
             req = ofp_parser.OFPGroupMod(datapath, ofp.OFPGC_ADD,
-                                         ofp.OFPGT_SELECT, group_id, buckets)
+                                         ofp.OFPGT_SELECT, group_id,
+                                         command_bucket_id, buckets)
             datapath.send_msg(req)
     """
     def __init__(self, datapath, command=ofproto.OFPGC_ADD,
-                 type_=ofproto.OFPGT_ALL, group_id=0, buckets=[]):
+                 type_=ofproto.OFPGT_ALL, group_id=0, command_bucket_id=0,
+                 buckets=[], properties=[], bucket_array_len=None):
         super(OFPGroupMod, self).__init__(datapath)
         self.command = command
         self.type = type_
         self.group_id = group_id
+        self.command_bucket_id = command_bucket_id
         self.buckets = buckets
+        self.properties = properties
 
     def _serialize_body(self):
-        msg_pack_into(ofproto.OFP_GROUP_MOD_PACK_STR, self.buf,
-                      ofproto.OFP_HEADER_SIZE,
-                      self.command, self.type, self.group_id)
-
         offset = ofproto.OFP_GROUP_MOD_SIZE
+        self.bucket_array_len = 0
         for b in self.buckets:
             b.serialize(self.buf, offset)
             offset += b.len
+            self.bucket_array_len += b.len
+
+        msg_pack_into(ofproto.OFP_GROUP_MOD_PACK_STR, self.buf,
+                      ofproto.OFP_HEADER_SIZE,
+                      self.command, self.type, self.group_id,
+                      self.bucket_array_len, self.command_bucket_id)
+
+        bin_props = bytearray()
+        for p in self.properties:
+            bin_props += p.serialize()
+        self.buf += bin_props
 
 
 class OFPPortModProp(OFPPropBase):
-- 
1.9.1



------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to