Hello,
Thanks for the response.
But even after applying the patch i still see the same error. However
please note if the switch sends an error response to the Role Request
message there is no connection drop or any errors seen.
Regards,
Nitish
On Wed, Apr 17, 2013 at 11:56 PM, Isaku Yamahata <[email protected]>wrote:
> Hi. It seems parser bug.
> Can you please try this patch?
> If it fixes the issue, I'll pushes this patch.
>
> thanks,
>
> From 174ca4ed6504dfd1ed554a895761d6cd0f411f4f Mon Sep 17 00:00:00 2001
> From: Isaku Yamahata <[email protected]>
> Date: Wed, 17 Apr 2013 11:17:36 -0700
> Subject: [PATCH] ofproto/ofproto_v1_3_parser: parser should return msg, not
> implicit None
>
> Signed-off-by: Isaku Yamahata <[email protected]>
> ---
> ryu/ofproto/ofproto_v1_3_parser.py | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/ryu/ofproto/ofproto_v1_3_parser.py
> b/ryu/ofproto/ofproto_v1_3_parser.py
> index 53b002a..f2580c7 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,6 +2831,7 @@ 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
> @@ -2832,6 +2839,9 @@ class OFPGetAsyncReply(MsgBase):
> class OFPSetAsync(MsgBase):
> def __init__(self, datapath):
> 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):
> @@ -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
> --
> 1.7.10.4
>
>
>
> On Wed, Apr 17, 2013 at 02:27:46PM +0530, nitish nagesh wrote:
> > Hi All,
> >
> > I have written a simple controller app to generate a role request and
> > handle the role reply message and I am able to see that the app is able
> to
> > generate the Role Request message to the controller. Also from wireshark
> i saw
> > the Role Reply message does come back to the controller. But i see some
> error
> > messages on the controller console during handling the reply. Also post
> > receiving the Role Reply the controller seems to NOT process any further
> > messages (like OFPT_ECHO_REQUEST etc) and eventually the connection
> between the
> > switch and controller tears off. I am attaching my script along here
> also the
> > controller errors below. Please let me know if there is something wrong
> in the
> > script?
> >
> > Controller error Logs:
> > #> ryu-manager --ofp-tcp-listen-port 6633 role_msg.py --verbose
> > loading app role_msg.py
> > loading app ryu.controller.ofp_handler
> > instantiating app ryu.controller.ofp_handler
> > instantiating app role_msg.py
> > BRICK SndRcvRoleMsg
> > CONSUMES EventOFPSwitchFeatures
> > CONSUMES EventOFPRoleReply
> > BRICK ofp_event
> > PROVIDES EventOFPSwitchFeatures TO {'SndRcvRoleMsg': ['config']}
> > PROVIDES EventOFPRoleReply TO {'SndRcvRoleMsg': ['main']}
> > CONSUMES EventOFPHello
> > CONSUMES EventOFPSwitchFeatures
> > CONSUMES EventOFPErrorMsg
> > CONSUMES EventOFPEchoRequest
> >
> > connected socket:<socket fileno=4 sock=20.0.0.2:6633 peer=20.0.0.1:64538
> >
> > address:('20.0.0.1', 64538)
> > hello ev <ryu.controller.ofp_event.EventOFPHello object at 0x94b852c>
> > move onto config mode
> > connected socket:<socket fileno=4 sock=20.0.0.2:6633 peer=20.0.0.1:56984
> >
> > address:('20.0.0.1', 56984)
> > hello ev <ryu.controller.ofp_event.EventOFPHello object at 0x94b860c>
> > move onto config mode
> > EVENT ofp_event->SndRcvRoleMsg EventOFPSwitchFeatures
> > switch features ev version: 0x4 msg_type 0x6 xid 0x3d807786
> > move onto main mode
> > Traceback (most recent call last):
> > File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/controller
> > /controller.py", line 97, in deactivate
> > method(self)
> > File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/controller
> > /controller.py", line 172, in _recv_loop
> > ev = ofp_event.ofp_msg_to_ev(msg)
> > File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/controller
> > /ofp_event.py", line 42, in ofp_msg_to_ev
> > return _OFP_MSG_EVENTS[name](msg)
> > KeyError: 'EventNoneType'
> > Error in the datapath 1042997282520960 from ('20.0.0.1', 56984)
> > Traceback (most recent call last):
> > File "/usr/lib/pymodules/python2.7/gevent/greenlet.py", line 405, in
> run
> > result = self._run(*self.args, **self.kwargs)
> > File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/controller
> > /controller.py", line 308, in datapath_connection_factory
> > datapath.serve()
> > File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/controller
> > /controller.py", line 228, in serve
> > self._recv_loop()
> > File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/controller
> > /controller.py", line 97, in deactivate
> > method(self)
> > File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/controller
> > /controller.py", line 172, in _recv_loop
> > ev = ofp_event.ofp_msg_to_ev(msg)
> > File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.8-py2.7.egg/ryu/controller
> > /ofp_event.py", line 42, in ofp_msg_to_ev
> > return _OFP_MSG_EVENTS[name](msg)
> > KeyError: 'EventNoneType'
> > <Greenlet at 0x94b906c: datapath_connection_factory(<socket at 0x94b844c
> fileno
> > =4 sock=20.0.0.2:6633 p, ('20.0.0.1', 56984))> failed with KeyError
> >
> > Regards,
> > Nitish
>
> > from struct import *
> > from nose.tools import *
> > from ryu.base import app_manager
> > from ryu.controller import ofp_event
> > from ryu.controller.handler import MAIN_DISPATCHER
> > from ryu.controller.handler import CONFIG_DISPATCHER
> > from ryu.controller.handler import set_ev_cls
> > from ryu.ofproto import ofproto_v1_0
> > from ryu.ofproto import ofproto_v1_2
> > from ryu.ofproto.ofproto_parser import *
> > from ryu.ofproto.ofproto_v1_2_parser import *
> > from ryu.ofproto import ofproto_parser
> > from ryu.ofproto import ofproto_v1_2_parser
> > from ryu.ofproto.ofproto_parser import MsgBase
> > from ryu import utils
> >
> > LOG = logging.getLogger('testing Role Messages')
> >
> > class SndRcvRoleMsg(app_manager.RyuApp):
> >
> > role=ofproto_v1_2.OFPCR_ROLE_MASTER
> > generation_id=2
> >
> >
> > @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
> > def generate_role_req_msg(self, ev):
> > msg = ev.msg
> > datapath = msg.datapath
> >
> > if (self.role == ofproto_v1_2.OFPCR_ROLE_SLAVE) or (self.role ==
> ofproto_v1_2.OFPCR_ROLE_MASTER) or (self.role ==
> ofproto_v1_2.OFPCR_ROLE_EQUAL):
> > pass
> > else:
> > self.logger.debug('Invalid value for role')
> > return
> >
> > r = OFPRoleRequest(datapath, self.role, self.generation_id)
> > datapath.send_msg(r)
> >
> >
> >
> > @set_ev_cls(ofp_event.EventOFPRoleReply, MAIN_DISPATCHER)
> > def role_reply_msg_handler(self, ev):
> > msg = ev.msg
> > datapath = msg.datapath
> > self.logger.debug('RECEIVED ROLE REPLY MSG')
>
> >
> ------------------------------------------------------------------------------
> > 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
>
>
> --
> 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