summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/ofproto/ofproto_v1_3.py2
-rw-r--r--ryu/ofproto/ofproto_v1_3_parser.py17
2 files changed, 16 insertions, 3 deletions
diff --git a/ryu/ofproto/ofproto_v1_3.py b/ryu/ofproto/ofproto_v1_3.py
index f7da8731..4699aefd 100644
--- a/ryu/ofproto/ofproto_v1_3.py
+++ b/ryu/ofproto/ofproto_v1_3.py
@@ -406,7 +406,7 @@ OFPFF_NO_PKT_COUNTS = 1 << 3 # Don't keep track of packet count.
OFPFF_NO_BYT_COUNTS = 1 << 4 # Don't keep track of byte count.
# struct ofp_group_mod
-OFP_GROUP_MOD_PACK_STR = '!HBBI'
+OFP_GROUP_MOD_PACK_STR = '!HBxI'
OFP_GROUP_MOD_SIZE = 16
assert (calcsize(OFP_GROUP_MOD_PACK_STR) + OFP_HEADER_SIZE ==
OFP_GROUP_MOD_SIZE)
diff --git a/ryu/ofproto/ofproto_v1_3_parser.py b/ryu/ofproto/ofproto_v1_3_parser.py
index 0d0bc665..53b002a1 100644
--- a/ryu/ofproto/ofproto_v1_3_parser.py
+++ b/ryu/ofproto/ofproto_v1_3_parser.py
@@ -1894,6 +1894,19 @@ class OFPBucket(object):
return msg
+ def serialize(self, buf, offset):
+ action_offset = offset + ofproto_v1_3.OFP_BUCKET_SIZE
+ action_len = 0
+ for a in self.actions:
+ a.serialize(buf, action_offset)
+ action_offset += a.len
+ action_len += a.len
+
+ self.len = utils.round_up(ofproto_v1_3.OFP_BUCKET_SIZE + action_len,
+ 8)
+ msg_pack_into(ofproto_v1_3.OFP_BUCKET_PACK_STR, buf, offset,
+ self.len, self.weight, self.watch_port, self.watch_group)
+
@_set_msg_type(ofproto_v1_3.OFPT_GROUP_MOD)
class OFPGroupMod(MsgBase):
@@ -1909,9 +1922,9 @@ class OFPGroupMod(MsgBase):
ofproto_v1_3.OFP_HEADER_SIZE,
self.command, self.type, self.group_id)
- offset = ofproto_v1_3.OFP_HEADER_SIZE + ofproto_v1_3.OFP_GROUP_MOD_SIZE
+ offset = ofproto_v1_3.OFP_GROUP_MOD_SIZE
for b in self.buckets:
- b.serialize(self, buf, offset)
+ b.serialize(self.buf, offset)
offset += b.len