On Fri, Apr 19, 2013 at 12:56:53AM +0900, Isaku Yamahata wrote:
> On Thu, Apr 18, 2013 at 12:45:47PM +0900, Yoshihiro Kaneko wrote:
> >     @@ -2842,3 +2852,4 @@ class OFPSetAsync(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
> > 
> > 
> > Why OFPSetAsync does not have a serializer though it is a request message?
> 
> You're right. It should have serializer instead of parser.

Something like this? on top of the previous patch.

commit 68f848f2604a2f4f15dea5da92fa1311b2920635
Author: Isaku Yamahata <[email protected]>
Date:   Thu Apr 18 09:10:31 2013 -0700

    ofproto v1.3: OFPSetConfig should have serializer, not parser
    
    Because the message is sent by controller to OF switch.
    
    Signed-off-by: Isaku Yamahata <[email protected]>

diff --git a/ryu/ofproto/ofproto_v1_3_parser.py 
b/ryu/ofproto/ofproto_v1_3_parser.py
index f2580c7..b1622dd 100644
--- a/ryu/ofproto/ofproto_v1_3_parser.py
+++ b/ryu/ofproto/ofproto_v1_3_parser.py
@@ -2834,22 +2834,16 @@ class OFPGetAsyncReply(MsgBase):
         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 = None
-        self.port_status_mask = None
-        self.flow_removed_mask = None
-
-    @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)
-        return msg
+        self.packet_in_mask = packet_in_mask
+        self.port_status_mask = port_status_mask
+        self.flow_removed_mask = flow_removed_mask
+
+    def _serialize_body(self, buf, offset):
+        msg_pack_into(ofproto_v1_3.OFP_AYNC_CONFIG_PACK_STR, buf, offset,
+                      self.packet_in_mask, self.port_status_mask,
+                      self.flow_removed_mask)



-- 
yamahata

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to