summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2014-03-11 10:42:09 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-03-16 21:42:27 +0900
commitd3e1e267f14801ee50b69b2f89d3e558834d2754 (patch)
tree088ae7e97af8a02cd10089d5011127cf302ff843
parenta376cc93c8e9e5448c03900703f32252d556efdd (diff)
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>
-rw-r--r--ryu/ofproto/ofproto_v1_4_parser.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/ryu/ofproto/ofproto_v1_4_parser.py b/ryu/ofproto/ofproto_v1_4_parser.py
index 1edc9b1e..186684a7 100644
--- a/ryu/ofproto/ofproto_v1_4_parser.py
+++ b/ryu/ofproto/ofproto_v1_4_parser.py
@@ -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