of14: Add bundle control message support

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Simon Horman 2014-03-11 10:42:09 +09:00 committed by FUJITA Tomonori
parent a376cc93c8
commit d3e1e267f1

View File

@ -991,6 +991,15 @@ class OFPRolePropExperimenter(OFPPropCommonExperimenter4ByteData):
pass
class OFPBundleProp(OFPPropBase):
_TYPES = {}
@OFPBundleProp.register_type(ofproto.OFPRPT_EXPERIMENTER)
class OFPBundlePropExperimenter(OFPPropCommonExperimenter4ByteData):
pass
class OFPMatchField(StringifyMixin):
_FIELDS_HEADERS = {}
@ -5786,3 +5795,58 @@ class OFPSetAsync(MsgBase):
bin_props += p.serialize()
self.buf += bin_props
@_set_msg_type(ofproto.OFPT_BUNDLE_CONTROL)
class OFPBundleCtrlMsg(MsgBase):
"""
Bundle control message
The controller uses this message to create, destroy and commit bundles
================ ======================================================
Attribute Description
================ ======================================================
bundle_id Id of the bundle
type One of the following values.
OFPBCT_OPEN_REQUEST
OFPBCT_OPEN_REPLY
OFPBCT_CLOSE_REQUEST
OFPBCT_CLOSE_REPLY
OFPBCT_COMMIT_REQUEST
OFPBCT_COMMIT_REPLY
OFPBCT_DISCARD_REQUEST
OFPBCT_DISCARD_REPLY
flags Bitmap of the following flags.
OFPBF_ATOMIC
OFPBF_ORDERED
properties List of ``OFPBundleProp`` subclass instance
================ ======================================================
Example::
def send_bundle_control(self, datapath):
ofp = datapath.ofproto
ofp_parser = datapath.ofproto_parser
req = ofp_parser.OFPBundleCtrlMsg(datapath, 7,
ofp.OFPBCT_OPEN_REQUEST,
[ofp.OFPBF_ATOMIC], [])
datapath.send_msg(req)
"""
def __init__(self, datapath, bundle_id, type_, flags, properties):
super(OFPBundleCtrlMsg, self).__init__(datapath)
self.bundle_id = bundle_id
self.type = type_
self.flags = flags
self.properties = properties
def _serialize_body(self):
bin_props = bytearray()
for p in self.properties:
bin_props += p.serialize()
msg_pack_into(ofproto.OFP_BUNDLE_CTRL_MSG_PACK_STR,
self.buf, ofproto.OFP_HEADER_SIZE, self.bundle_id,
self.type, self.flags)
self.buf += bin_props