On Wed, 12 Nov 2014 16:30:29 +0000 "Liu, Weijie" <[email protected]> wrote:
> I just begin learning Ryu. I have a question: > >>From tutorial, I know how to write a handler function for some Openflow >>event, e.g., pakcet-in. > > Now imagine that I would like to write some logic for some new event. For > example, if I press a button in the keyboard, my Ryu app will send out some > rules to the switches. Or when the system time reaches 12:00 pm, my Ryu app > will send out some other rules to the switches. > > In other words, the behaviors of my app can be controlled by some external > stuff. > > How can I implement these? Should I define new events for these non-Openflow > stuff? You can find a way to defining a new event at: https://github.com/osrg/ryu/tree/master/ryu/topology event.py defines events and you can see how to use these events in other files in the directory. However, I'm not sure what you need is defining new events. First your example, pressing a button, are you assume that you connect to your application via CLI like ssh? If so, probably you don't need your own event. You could use just a function call. The second example, you could simply use sleep() like: http://osrg.github.io/ryu-book/en/html/traffic_monitor.html#implementation-of-traffic-monitor ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
