TODO: backport to of14
Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 ryu/ofproto/ofproto_v1_5_parser.py    | 23 ++++++++++++++++++++++-
 ryu/tests/unit/ofproto/test_parser.py |  2 +-
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/ryu/ofproto/ofproto_v1_5_parser.py 
b/ryu/ofproto/ofproto_v1_5_parser.py
index 3c9d998..b351ebe 100644
--- a/ryu/ofproto/ofproto_v1_5_parser.py
+++ b/ryu/ofproto/ofproto_v1_5_parser.py
@@ -5957,6 +5957,7 @@ class OFPSetAsync(MsgBase):
         self.buf += bin_props
 
 
+@_register_parser
 @_set_msg_type(ofproto.OFPT_BUNDLE_CONTROL)
 class OFPBundleCtrlMsg(MsgBase):
     """
@@ -5996,7 +5997,8 @@ class OFPBundleCtrlMsg(MsgBase):
                                               [ofp.OFPBF_ATOMIC], [])
             datapath.send_msg(req)
     """
-    def __init__(self, datapath, bundle_id, type_, flags, properties):
+    def __init__(self, datapath, bundle_id=None, type_=None, flags=None,
+                 properties=None):
         super(OFPBundleCtrlMsg, self).__init__(datapath)
         self.bundle_id = bundle_id
         self.type = type_
@@ -6013,6 +6015,25 @@ class OFPBundleCtrlMsg(MsgBase):
                       self.type, self.flags)
         self.buf += bin_props
 
+    @classmethod
+    def parser(cls, datapath, version, msg_type, msg_len, xid, buf):
+        msg = super(OFPBundleCtrlMsg, cls).parser(datapath, version,
+                                                  msg_type, msg_len,
+                                                  xid, buf)
+        (bundle_id, type_, flags) = struct.unpack_from(
+            ofproto.OFP_BUNDLE_CTRL_MSG_PACK_STR, buf,
+            ofproto.OFP_HEADER_SIZE)
+        msg.bundle_id = bundle_id
+        msg.type = type_
+        msg.flags = flags
+        msg.properties = []
+        rest = msg.buf[ofproto.OFP_BUNDLE_CTRL_MSG_SIZE:]
+        while rest:
+            p, rest = OFPBundleProp.parse(rest)
+            msg.properties.append(p)
+
+        return msg
+
 
 @_set_msg_type(ofproto.OFPT_BUNDLE_ADD_MESSAGE)
 class OFPBundleAddMsg(MsgInMsgBase):
diff --git a/ryu/tests/unit/ofproto/test_parser.py 
b/ryu/tests/unit/ofproto/test_parser.py
index 7cd461f..542ab74 100644
--- a/ryu/tests/unit/ofproto/test_parser.py
+++ b/ryu/tests/unit/ofproto/test_parser.py
@@ -145,7 +145,7 @@ implemented = {
         ofproto_v1_5.OFPT_ROLE_STATUS: (True, False),
         ofproto_v1_5.OFPT_TABLE_STATUS: (True, False),
         ofproto_v1_5.OFPT_REQUESTFORWARD: (False, True),
-        ofproto_v1_5.OFPT_BUNDLE_CONTROL: (False, True),
+        ofproto_v1_5.OFPT_BUNDLE_CONTROL: (True, True),
         ofproto_v1_5.OFPT_BUNDLE_ADD_MESSAGE: (False, True),
     },
 }
-- 
2.1.0


------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to