ofproto_v1_5_parser: Support OF1.5 OFPGroupMod structure

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 <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Yusuke Iwase 2015-08-03 14:23:18 +09:00 committed by FUJITA Tomonori
parent 7b2c49e822
commit 6fe9321485

View File

@ -5823,23 +5823,28 @@ class OFPGroupMod(MsgBase):
The controller sends this message to modify the group table.
================ ======================================================
Attribute Description
================ ======================================================
command One of the following values.
================== ======================================================
Attribute Description
================== ======================================================
command One of the following values.
| OFPGC_ADD
| OFPGC_MODIFY
| OFPGC_DELETE
type 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
buckets list of ``OFPBucket``
================ ======================================================
| 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__.
@ -5860,27 +5865,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):