Re: [Ryu-devel] ryu's event mechanism

2013-03-12 Thread Can Zhang
Hi there, After reading some of the source code, I figured out that this might be a better minimal example for raising and receiving events in ryu: --- import gevent from ryu.base import app_manager from ryu.controller import event from ryu.controller.handler import set_ev_cls TEST_EVENT_E

Re: [Ryu-devel] ryu's event mechanism

2013-03-01 Thread can.
But I still cannot see the 'recv: xxx' as expected, here are the outputs: - loading app ryu.controller.ofp_handler loading app event.py instantiating app ryu.controller.ofp_handler instantiating app event.py - and nothing more. 2013/3/1 OHMURA Kei > 2013/3/1 can. : > > What I want is a

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread OHMURA Kei
2013/3/1 can. : > Thanks Kei, > > You mean a normal app does not need to call that method explicitly? And what > that method is supposed to do? Yes. bin/ryu-manager.py creates Ryu app instance. Please see it. Thanks, > > > 2013/3/1 OHMURA Kei >> >> 2013/3/1 can. : >> > I think I get it. I shoul

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread can.
Thanks Kei, You mean a normal app does not need to call that method explicitly? And what that method is supposed to do? 2013/3/1 OHMURA Kei > 2013/3/1 can. : > > I think I get it. I should add ` self.register_observer(EventTest, > > self.name) ` in TestEvent.__init__(). Thanks very much! > > A

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread OHMURA Kei
2013/3/1 can. : > I think I get it. I should add ` self.register_observer(EventTest, > self.name) ` in TestEvent.__init__(). Thanks very much! > And I also see register_handler() in class RyuApp, when should I use it? IIUC, your app don't need to use it. Thanks, > > > 2013/3/1 can. >> >> But I

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread can.
I think I get it. I should add ` self.register_observer(EventTest, self.name) ` in TestEvent.__init__(). Thanks very much! And I also see register_handler() in class RyuApp, when should I use it? 2013/3/1 can. > But I still cannot see the 'recv: xxx' as expected, here are the outputs: > - >

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread YAMAMOTO Takashi
hi, > I tried what you said, as: > - > class Event_1(event.EventBase): > def __init__(self): > super(Event_1, self).__init__() > self.msg = 'event 1' > > class Hehe(app_manager.RyuApp): > def __init__(self): > super(Hehe, self).__init__() > self.registe

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread can.
I tried what you said, as: - class Event_1(event.EventBase): def __init__(self): super(Event_1, self).__init__() self.msg = 'event 1' class Hehe(app_manager.RyuApp): def __init__(self): super(Hehe, self).__init__() self.register_observer(Event_1, self.na

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread OHMURA Kei
2013/3/1 can. : > What I want is a minimal example of handling event, including: > 1) define an event > 2) send an event > 3) receive an event The following code would help your understanding? -- import gevent from ryu.base import app_manager from ryu.controller import event from ryu.controller.

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread can.
What I want is a minimal example of handling event, including: 1) define an event 2) send an event 3) receive an event 2013/2/28 Isaku Yamahata > On Thu, Feb 28, 2013 at 04:13:36PM +0800, can. wrote: > > Hi there, > > > > I'm trying to figure out ryu's event mechanism by sending and receiving >

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread Isaku Yamahata
On Thu, Feb 28, 2013 at 04:13:36PM +0800, can. wrote: > Hi there, > > I'm trying to figure out ryu's event mechanism by sending and receiving an > event. Below is the test code I wrote: > - > from ryu.base import app_manager > from ryu.controller import event, handler > > class Hehe(app_m

Re: [Ryu-devel] ryu's event mechanism

2013-02-28 Thread FUJITA Tomonori
On Thu, 28 Feb 2013 16:13:36 +0800 "can." wrote: > Hi there, > > I'm trying to figure out ryu's event mechanism by sending and receiving an > event. Below is the test code I wrote: > - > from ryu.base import app_manager > from ryu.controller import event, handler > > class Hehe(app_mana