Hi I am running two applications in ryu controller, and would like to
exchange my own events between the two. I wrote a code (below), but the
function doesn't work.
***Event Class - Location /ryu/app/event_message
from ryu.controller import ofp_event, event
class EventMessage(event.EventBase):
def __init__(self, message):
super(EventMessage, self).__init__()
self.message = message
***App 1
from ryu.base import app_manager
from ryu.controller import ofp_event, event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls, set_ev_handler
from ryu.ofproto import ofproto_v1_3
from ryu.app import event_message
class ConnectionManager(app_manager.RyuApp):
OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
def __init__(self, *args, **kwargs):
super(ConnectionManager, self).__init__(*args, **kwargs)
. . .
bla bla bla
bla bla bla
. . .
else: # If something doesn't happen, a want to send a event
print >>sys.stderr, 'O cliente caiu'
msg = 'test'
self.send_event_to_observers(event_message.EventMessage(msg))
***App 2
from ryu.base import app_manager
from ryu.controller import ofp_event, event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls, set_ev_handler
from ryu.ofproto import ofproto_v1_3
from ryu.app import event_message
class ManagerRole(app_manager.RyuApp):
OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
def __init__(self, *args, **kwargs):
super(ManagerRole, self).__init__(*args, **kwargs)
. . .
bla bla bla
bla bla bla
. . .
@set_ev_cls(event_message.EventMessage) # At this point, a message
'test' should be printed
def event_Test(self, ev):
print ev.message
I don't know what is happening. If someone can help me, I'll be grateful.
Thanks.
--
*Eros S. Spalla* -
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel