diff options
author | Isaku Yamahata <yamahata@valinux.co.jp> | 2013-04-24 12:19:53 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2013-04-24 19:17:44 +0900 |
commit | 97c1aad368215fbd8825048fe9db1cd71bbeebd0 (patch) | |
tree | abae4164acac7aa15d9fba707e3cd07a7bedac3a | |
parent | ec38a0233a9f63e119758f5f90e418badd924992 (diff) |
of1.3: parser should return msg, not implicit None
And OFPSetConfig should have serializer, not parser Because the message
is sent by controller to OF switch.
Cc: nitish nagesh <nagesh.nitish@gmail.com>
Cc: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/ofproto/ofproto_v1_3_parser.py | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/ryu/ofproto/ofproto_v1_3_parser.py b/ryu/ofproto/ofproto_v1_3_parser.py index d9a0ec3b..3213115b 100644 --- a/ryu/ofproto/ofproto_v1_3_parser.py +++ b/ryu/ofproto/ofproto_v1_3_parser.py @@ -1,5 +1,5 @@ # Copyright (C) 2012 Nippon Telegraph and Telephone Corporation. -# Copyright (C) 2012 Isaku Yamahata <yamahata at valinux co jp> +# Copyright (C) 2012, 2013 Isaku Yamahata <yamahata at valinux co jp> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -2793,6 +2793,8 @@ class OFPRoleRequest(MsgBase): class OFPRoleReply(MsgBase): def __init__(self, datapath): super(OFPRoleReply, self).__init__(datapath) + self.role = None + self.generation_id = None @classmethod def parser(cls, datapath, version, msg_type, msg_len, xid, buf): @@ -2802,6 +2804,7 @@ class OFPRoleReply(MsgBase): (msg.role, msg.generation_id) = struct.unpack_from( ofproto_v1_3.OFP_ROLE_REQUEST_PACK_STR, msg.buf, ofproto_v1_3.OFP_HEADER_SIZE) + return msg @_set_msg_type(ofproto_v1_3.OFPT_GET_ASYNC_REQUEST) @@ -2815,6 +2818,9 @@ class OFPGetAsyncRequest(MsgBase): class OFPGetAsyncReply(MsgBase): def __init__(self, datapath): super(OFPGetAsyncReply, self).__init__(datapath) + self.packet_in_mask = None + self.port_status_mask = None + self.flow_removed_mask = None @classmethod def parser(cls, datapath, version, msg_type, msg_len, xid, buf): @@ -2825,20 +2831,20 @@ class OFPGetAsyncReply(MsgBase): msg.flow_removed_mask) = struct.unpack_from( ofproto_v1_3.OFP_ASYNC_CONFIG_PACK_STR, msg.buf, ofproto_v1_3.OFP_HEADER_SIZE) + return msg -@_register_parser @_set_msg_type(ofproto_v1_3.OFPT_SET_ASYNC) class OFPSetAsync(MsgBase): - def __init__(self, datapath): + def __init__(self, datapath, + packet_in_mask, port_status_mask, flow_removed_mask): super(OFPSetAsync, self).__init__(datapath) + self.packet_in_mask = packet_in_mask + self.port_status_mask = port_status_mask + self.flow_removed_mask = flow_removed_mask - @classmethod - def parser(cls, datapath, version, msg_type, msg_len, xid, buf): - msg = super(OFPSetAsync, cls).parser(datapath, version, - msg_type, msg_len, - xid, buf) - (msg.packet_in_mask, msg.port_status_mask, - msg.flow_removed_mask) = struct.unpack_from( - ofproto_v1_3.OFP_ASYNC_CONFIG_PACK_STR, msg.buf, - ofproto_v1_3.OFP_HEADER_SIZE) + def _serialize_body(self): + msg_pack_into(ofproto_v1_3.OFP_ASYNC_CONFIG_PACK_STR, self.buf, + ofproto_v1_3.OFP_HEADER_SIZE, + self.packet_in_mask, self.port_status_mask, + self.flow_removed_mask) |