net.floodlightcontroller.core.internal
Interface ISwitchDriverRegistry


public interface ISwitchDriverRegistry

Maintain a registry for SwitchDrivers. Drivers can register with the registry and a user can get IOFSwitch instances based on the switch's OFDescriptionStatistics. A driver registers itself by specifying a prefix string of the switch's manufacturer description. When a user request an IOFSwitch instance the registry matches the manufacturer description of the switch against the prefixes in the registry. See getOFSwitchInstance() for a description of the lookup contract

Author:
gregor

Method Summary
 void addSwitchDriver(java.lang.String manufacturerDescriptionPrefix, IOFSwitchDriver driver)
          Register an IOFSwitchDriver with the registry
 IOFSwitch getOFSwitchInstance(OFDescriptionStatistics description)
          Return an IOFSwitch instance according to the description stats.
 

Method Detail

addSwitchDriver

void addSwitchDriver(java.lang.String manufacturerDescriptionPrefix,
                     IOFSwitchDriver driver)
Register an IOFSwitchDriver with the registry

Parameters:
manufacturerDescriptionPrefix - Register the given prefix with the driver.
driver - A IOFSwitchDriver instance to handle IOFSwitch instaniation for the given manufacturer description prefix
Throws:
java.lang.IllegalStateException - If the the manufacturer description is already registered
NullPointerExeption - if manufacturerDescriptionPrefix is null
NullPointerExeption - if driver is null

getOFSwitchInstance

IOFSwitch getOFSwitchInstance(OFDescriptionStatistics description)
Return an IOFSwitch instance according to the description stats. The driver with the longest matching prefix will be picked first. The description is then handed over to the choosen driver to return an IOFSwitch instance. If the driver does not return an IOFSwitch (returns null) the registry will continue to the next driver with a matching manufacturer description prefix. If no driver returns an IOFSwitch instance the registry returns a default OFSwitchImpl instance. The returned switch will have its description reply and switch properties set according to the DescriptionStats passed in

Parameters:
description - The OFDescriptionStatistics for which to return an IOFSwitch implementation
Returns:
A IOFSwitch implementation matching the description or an OFSwitchImpl if no driver returned a more concrete instance.
Throws:
java.lang.NullPointerException - If the OFDescriptionStatistics or any of its members is null.