diff options
author | IWAMOTO Toshihiro <iwamoto@valinux.co.jp> | 2017-10-27 12:50:03 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-11-01 23:21:44 +0900 |
commit | 6e51b2a41d9e733ac41454bc26dc1a548da9a93f (patch) | |
tree | b30f515ee2f6967b59d9482de9d825bb76bf4441 | |
parent | 98d97b992ef399c3ee1c508d0101bcdf941e31f0 (diff) |
of14: Implement OFPBundleCtrlMsg parser
Copied from of15 implementation.
Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/ofproto/ofproto_v1_4_parser.py | 23 | ||||
-rw-r--r-- | ryu/tests/unit/ofproto/test_parser.py | 2 |
2 files changed, 23 insertions, 2 deletions
diff --git a/ryu/ofproto/ofproto_v1_4_parser.py b/ryu/ofproto/ofproto_v1_4_parser.py index f26075c0..f927fdba 100644 --- a/ryu/ofproto/ofproto_v1_4_parser.py +++ b/ryu/ofproto/ofproto_v1_4_parser.py @@ -5598,6 +5598,7 @@ class OFPSetAsync(MsgBase): self.buf += bin_props +@_register_parser @_set_msg_type(ofproto.OFPT_BUNDLE_CONTROL) class OFPBundleCtrlMsg(MsgBase): """ @@ -5637,7 +5638,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_ @@ -5654,6 +5656,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 2f9061cc..081500ad 100644 --- a/ryu/tests/unit/ofproto/test_parser.py +++ b/ryu/tests/unit/ofproto/test_parser.py @@ -118,7 +118,7 @@ implemented = { ofproto_v1_4.OFPT_ROLE_STATUS: (True, False), ofproto_v1_4.OFPT_TABLE_STATUS: (True, False), ofproto_v1_4.OFPT_REQUESTFORWARD: (True, True), - ofproto_v1_4.OFPT_BUNDLE_CONTROL: (False, True), + ofproto_v1_4.OFPT_BUNDLE_CONTROL: (True, True), ofproto_v1_4.OFPT_BUNDLE_ADD_MESSAGE: (False, True), }, 6: { |