Changes between Version 3 and Version 4 of Internal/OpenFlow/FloodlightFVModule


Ignore:
Timestamp:
Jun 13, 2012, 4:32:56 AM (12 years ago)
Author:
akoshibe
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Internal/OpenFlow/FloodlightFVModule

    v3 v4  
    9292 * mapping out the module registration mechanisms in Floodlight
    9393 * finding a "nice" way to make the modules register with FVController.
     94
     95(6/13):
     96[[BR]]
     97[[BR]]
     98A (not-so) quick revisit of the module loading system in Floodlight was done to figure out how exactly a module learns to subscribe to the main controller module.
     99
     100Starting at the top, in the ''init()'' function of each module is almost always this line:
     101{{{
     102floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
     103}}}   
     104Where ''context'' is an instance of `FloodlightModuleContext`, which contains a mapping between the interfaces and the services providing them. ''getServiceImpl()'', in the case above, returns the service providing the IFloodlightProviderService interface, which is the core controller.
     105
     106`FloodlightModuleLoader` is the actual class responsible for populating `FloodlightModuleContext`'s mapping; Recalling, from Main.java:
     107{{{
     108FloodlightModuleLoader fml = new FloodlightModuleLoader();
     109IFloodlightModuleContext moduleContext = fml.loadModulesFromConfig(settings.getModuleFile());
     110}}}
     111Internally, for each module exporting a service, in ''initModules()'' `FloodlightModuleLoader` calls ''getServiceImpls()'', an `IFloodlightModule` function that lets modules define the services that they export. It then uses `FloodlightModuleContext`'s ''addService()'' in order to fill its mapping.
     112
     113Returning to the controller mapped to ''IFloodlightProviderService.class'', we see that it is a service exported by the module `FloodlightProvider`. It is the first module to be loaded by the module loading system, and therefore the mapping to the controller is there for the rest of the modules to register with.
     114
     115This leads us to a potential way to place a module between the controller and the rest of the modules:
     116 * Re-name the real IFloodlightProviderService to something else
     117 * Implement a module that subscribes to the re-named controller service
     118 * Implement a FVController from IFloodlightProviderService
     119 * export this as a service with key IFloodlightProviderService.class
     120
     121This shouldn't require any change on the other modules (except the FloodlightProvider).