of1.3: fix error in group_mod

Signed-off-by: Zhang Dongya <fortitude.zhang@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Zhang Dongya 2013-03-06 01:28:20 +09:00 committed by FUJITA Tomonori
parent d8625d4f8f
commit db27b8f171
2 changed files with 16 additions and 3 deletions

View File

@ -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)

View File

@ -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