OpenFlow operations with Ryu
To begin with, let's look at two basic components of Ryu code that we have seen in the switch application:
ryu.base.app_manager: The component that centrally manages Ryu applications.ryu.base.app_manager.RyuAppis the base class that all Ryu applications inherit. It provides contexts to Ryu applications and routes messages among Ryu applications (contexts are ordinary Python objects shared among Ryu applications). It also contains methods such assend_eventorsend_event_to_observersto raise OpenFlow events.ryu.controller: Theryu.controller.controllerhandles connections from switches and routes events to appropriate entities:ryu.controller.ofp_event: This is the OpenFlow event definition.ryu.controller.ofp_handler: This is the handler of an OpenFlow event. A Ryu application registers itself to listen for specific events usingryu.controller.handler.set_ev_clsdecorator. We have seen the decoratorset_ev_clsas well asCONFIG_DISPATCHERandMAIN_DISPATCHER...