100 | | This section describes the architecture and some of the implementations of the various parts of the controller. These are largely references to source code and their Javadocs. |
101 | | * ref: http://www.openflowhub.org/display/floodlightcontroller/Advanced+Tutorial |
| 100 | This section describes the architecture and some of the implementations of the various parts of the controller, with focus on the controller core functions (net.floodlightcontroller.core* area of source code). This section is fairly dense, and is best referenced alongside the source code. |
| 101 | |
| 102 | To start, here are some references: |
| 103 | * Floodlight wiki: http://www.openflowhub.org/display/floodlightcontroller/Floodlight+Controller+Wiki |
| 104 | * javadocs: http://floodlight.openflowhub.org/files/javadoc/ |
| 105 | You can also generate the docs yourself with `ant javadoc` in your working directory. You may also want to join the [http://groups.google.com/a/openflowhub.org/group/floodlight-dev/subscribe floodlight-dev mailing list]. |
| 106 | |
| 107 | === Overview === |
| 108 | |
103 | | * the core, which listens to !OpenFlow messages and dispatches events, and |
104 | | * secondary modules which handle the events e.g PACKET_INs. |
105 | | The secondary modules register with the core module when the controller is starting up. They do everything from recording certain aspects of flows to providing a RESTful API to modifying the flow tables within switches. They may also export services to leverage other modules, such as the REST API. |
| 110 | 1. the core, which listens to !OpenFlow messages and dispatches events, and |
| 111 | 2. various modules which handle the events |
| 112 | In general, events encompass a range of things, including a switch joining/leaving the network, the reception of a !OpenFlow message e.g. a PACKET_IN, and the controller's role changing. |
| 113 | |
| 114 | === Listeners, Modules, and registration === |
| 115 | |
| 116 | In general, modules are implementations of several interfaces, including, but not limited to: |
| 117 | |
| 118 | * `IFloodlightModule` - defines interfaces uniform across modules |
| 119 | * `IOFSwitchListener` - lets a module be notified of switches joining and leaving |
| 120 | * `IOFMessageListener` - lets a module be notified of various types of !OpenFlow messages |
| 121 | |
| 122 | A module always implements the first interface, but may implement one or both of the latter two as ''listeners''. For example, The REST API module (interested in everything under the sun) implements both, while the Hub module (interested in just PACKET_INs) only implements `IOFMessageListener`. |
| 123 | |
| 124 | Class `Controller`, Floodlight's core controller implementation, dispatches events to the modules by calling the modules' event handling functions such as ''receive()''. The controller keeps mappings of which modules implement which listener in two map structures, ''switchListeners'' and ''messageListeners''. These maps are used by the controller to dispatch the events to the proper listeners. `IFloodLightProviderService`, the interface that `Controller` implements, in turn provides two functions, ''addOFSwitchListener()'' and ''addOFMessageListener()'', which the modules can call in their initialization functions to add themselves to the appropriate map. The controller's listener maps are populated at startup, when the module loader initializes each required module. |