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