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.RyuApp
is 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_event
orsend_event_to_observers
to raise OpenFlow events.ryu.controller
: Theryu.controller.controller
handles 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_cls
decorator. We have seen the decoratorset_ev_cls
as well asCONFIG_DISPATCHER
andMAIN_DISPATCHER...