The start method is called after the constructor.

class YourRyuApp(RyuApp):
    def __init__(self):
        pass

    def start(self):
       super(YourRyuApp, self).start()
       # do what you want here. For exemple, send events, loops, open
connections

@handler.set_ev_cls(ofp_event.
EventOFPStateChange, [handler.MAIN_DISPATCHER, handler.DEAD_DISPATCHER])
#This is to not terminate the application
def _state_change_handler(self, ev):
    pass

Cheers.




2014-04-08 21:19 GMT-03:00 LIU, Kun <[email protected]>:

> Thank you! I think I could trigger my own events in the handler functions
> of EventOFPXXX,  and then handle them. I don’t understand how to use the
> start() method to do this work, can you give me an example, please?
>
>
>
> Best Regards,
>
> Kun Liu
>
>
>
> *发件人:* Eros Spalla [mailto:[email protected]]
> *发送时间:* 2014年4月8日 22:25
> *收件人:* LIU, Kun
> *抄送:* FUJITA Tomonori; [email protected]
> *主题:* Re: 答复: [Ryu-devel] How does a RYU app trigger an event like
> EventOFPPacketIn ?
>
>
>
> can I think that these events(EventOFPXXX,  EventNetworkXXX) are RYU’s
> built-in events? Yes.
>
> and we can *only* define(and send) our own events during the handling of
> these build-in events? No. You can define your own event and send it
> whenever you want. For exemple, you can use ryu events, or the constructor
> method or the start() method to trigger your event.
>
> Cheers.
>
>
>
>
>
> 2014-04-08 5:51 GMT-03:00 LIU, Kun <[email protected]>:
>
> Hi, Spalla and Tomonori, thank you for the reply.  I read the RYU book(
> http://osrg.github.io/ryu-book/en/Ryubook.pdf) and learned that the
> application programming model(Page 135), there is a data path thread which
> will send events to the event loop,  can I think that these
> events(EventOFPXXX,  EventNetworkXXX) are RYU’s built-in events ?  and we
> can *only* define(and send) our own events during the handling of these
> build-in events ?
>
>
>
>
>
> *发件人:* Eros Spalla [mailto:[email protected]]
> *发送时间:* 2014年4月7日 21:07
> *收件人:* FUJITA Tomonori
> *抄送:* LIU, Kun; [email protected]
> *主题:* Re: [Ryu-devel] How does a RYU app trigger an event like
> EventOFPPacketIn ?
>
>
>
> Kun Liu. These links may help you.
>
> http://comments.gmane.org/gmane.network.ryu.devel/5728
> http://ryu.readthedocs.org/en/latest/api_ref.html
>
>
>
> 2014-04-06 22:10 GMT-03:00 FUJITA Tomonori <[email protected]
> >:
>
> On Thu, 3 Apr 2014 17:20:59 +0800
> "LIU, Kun" <[email protected]> wrote:
>
> > I am wondering how does a RYU app trigger an event
> > (e.g. ,EventOFPPacketIn) ? I plan to develop my own app with some
> > new defined events, however I do not know the mechanism of events,
> > and I cannot find out from the source codes. Thanks a lot.
>
> I would recommend you to check out a simpler example:
>
> https://github.com/osrg/ryu/blob/master/ryu/app/simple_switch_lacp.py
> https://github.com/osrg/ryu/blob/master/ryu/lib/lacplib.py
>
> The above example is not best though, however, good enough for
> defining your own events.
>
>
> ------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees_APR
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
>
>
>
> --
>
> *Eros S. Spalla* -
>
>
>
>
> --
>
> *Eros S. Spalla* -
>
>


-- 
*Eros S. Spalla* -
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to