|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.floodlightcontroller.core.internal.Controller
public class Controller
The main controller class. Handles all setup and network listeners
Nested Class Summary | |
---|---|
static class |
Controller.Counters
|
class |
Controller.SwitchEvent
|
Nested classes/interfaces inherited from interface net.floodlightcontroller.core.IFloodlightProviderService |
---|
IFloodlightProviderService.Role |
Field Summary | |
---|---|
protected static boolean |
ALWAYS_DECODE_ETH
|
static int |
BATCH_MAX_SIZE
|
protected static java.lang.String |
CONTROLLER_ID
|
protected static java.lang.String |
CONTROLLER_INTERFACE_CONTROLLER_ID
|
protected static java.lang.String |
CONTROLLER_INTERFACE_DISCOVERED_IP
|
protected static java.lang.String |
CONTROLLER_INTERFACE_ID
|
protected static java.lang.String |
CONTROLLER_INTERFACE_NUMBER
|
protected static java.lang.String |
CONTROLLER_INTERFACE_TABLE_NAME
|
protected static java.lang.String |
CONTROLLER_INTERFACE_TYPE
|
protected static java.lang.String |
CONTROLLER_TABLE_NAME
|
protected java.util.HashMap<java.lang.String,java.lang.String> |
controllerNodeIPsCache
|
protected IDebugEventService |
debugEvents
|
protected IEventUpdater<Controller.SwitchEvent> |
evSwitch
|
protected FloodlightFactory |
factory
|
protected static java.lang.ThreadLocal<java.util.Stack<FloodlightContext>> |
flcontext_cache
flcontext_cache - Keep a thread local stack of contexts |
protected ListenerDispatcher<HAListenerTypeMarker,IHAListener> |
haListeners
|
protected LoadMonitor |
loadmonitor
|
protected static org.slf4j.Logger |
log
|
protected java.util.concurrent.ConcurrentMap<OFType,ListenerDispatcher<OFType,IOFMessageListener>> |
messageListeners
|
protected IFloodlightProviderService.Role |
notifiedRole
|
protected static INotificationManager |
notifier
|
protected java.lang.String |
openFlowHost
|
protected int |
openFlowPort
|
protected boolean |
overload_drop
|
protected java.util.Map<java.lang.String,java.util.List<IInfoProvider>> |
providerMap
|
protected java.util.Set<IReadyForReconcileListener> |
readyForReconcileListeners
|
protected static int |
SEND_BUFFER_SIZE
|
protected static java.lang.String |
SWITCH_CONFIG_CORE_SWITCH
|
protected static java.lang.String |
SWITCH_CONFIG_TABLE_NAME
|
protected java.util.Set<IOFSwitchListener> |
switchListeners
|
protected java.util.concurrent.BlockingQueue<net.floodlightcontroller.core.internal.Controller.IUpdate> |
updates
|
protected int |
workerThreads
|
Fields inherited from interface net.floodlightcontroller.core.IFloodlightProviderService |
---|
bcStore, CONTEXT_PI_PAYLOAD |
Constructor Summary | |
---|---|
Controller()
|
Method Summary | |
---|---|
void |
addHAListener(IHAListener listener)
Adds a listener for HA role events |
void |
addInfoProvider(java.lang.String type,
IInfoProvider provider)
Add an info provider of a particular type |
void |
addOFMessageListener(OFType type,
IOFMessageListener listener)
Adds an OpenFlow message listener |
void |
addOFSwitchDriver(java.lang.String manufacturerDescriptionPrefix,
IOFSwitchDriver driver)
Adds an OFSwitch driver |
void |
addOFSwitchListener(IOFSwitchListener listener)
Add a switch listener |
void |
addReadyForReconcileListener(IReadyForReconcileListener l)
Add a listener for ready-for-flow-reconcile events |
void |
addSwitchEvent(long switchDPID,
java.lang.String reason,
boolean flushNow)
Switch Added/Deleted Events |
protected static FloodlightContext |
flcontext_alloc()
flcontext_alloc - pop a context off the stack, if required create a new one |
protected void |
flcontext_free(FloodlightContext flcontext)
flcontext_free - Free the context to the current thread |
java.util.Set<java.lang.Long> |
getAllSwitchDpids()
Returns a snapshot of the set DPIDs for all known switches. |
java.util.Map<java.lang.Long,IOFSwitch> |
getAllSwitchMap()
Return a snapshot FIXME: asdf |
java.util.Map<java.lang.String,java.lang.Object> |
getControllerInfo(java.lang.String type)
Return information of a particular type (for rest services) |
java.util.Map<java.lang.String,java.lang.String> |
getControllerNodeIPs()
Get the current mapping of controller IDs to their IP addresses Returns a copy of the current mapping. |
java.util.Map<java.lang.String,java.lang.Object> |
getInfo(java.lang.String type)
Called when rest API requests information of a particular type |
protected IFloodlightProviderService.Role |
getInitialRole(java.util.Map<java.lang.String,java.lang.String> configParams)
Sets the initial role based on properties in the config params. |
java.util.Map<OFType,java.util.List<IOFMessageListener>> |
getListeners()
Return a non-modifiable list of all current listeners |
java.util.Map<java.lang.String,java.lang.Long> |
getMemory()
Get controller memory information |
FloodlightFactory |
getOFMessageFactory()
Gets the FloodlightFactory |
IFloodlightProviderService.Role |
getRole()
Get the current role of the controller |
RoleInfo |
getRoleInfo()
Get the current role of the controller |
IOFSwitch |
getSwitch(long dpid)
If the switch with the given DPID is known to any controller in the cluster, this method returns the associated IOFSwitch instance. |
long |
getSystemStartTime()
Return the controller start time in milliseconds |
java.util.Set<java.lang.String> |
getUplinkPortPrefixSet()
Get the set of port prefixes that will define an UPLINK port. |
java.lang.Long |
getUptime()
returns the uptime of this controller. |
protected void |
handleControllerNodeIPChanges()
Handle changes to the controller nodes IPs and dispatch update. |
protected void |
handleMessage(IOFSwitch sw,
OFMessage m,
FloodlightContext bContext)
Handle and dispatch a message to IOFMessageListeners. |
void |
handleOutgoingMessage(IOFSwitch sw,
OFMessage m,
FloodlightContext bc)
Process written messages through the message listeners for the controller |
void |
init(java.util.Map<java.lang.String,java.lang.String> configParams)
Initialize internal data structures |
boolean |
injectOfMessage(IOFSwitch sw,
OFMessage msg)
Re-injects an OFMessage back into the packet processing chain |
boolean |
injectOfMessage(IOFSwitch sw,
OFMessage msg,
FloodlightContext bc)
Re-injects an OFMessage back into the packet processing chain |
void |
removeHAListener(IHAListener listener)
Removes a listener for HA role events |
void |
removeInfoProvider(java.lang.String type,
IInfoProvider provider)
Remove an info provider of a particular type |
void |
removeOFMessageListener(OFType type,
IOFMessageListener listener)
Removes an OpenFlow message listener |
void |
removeOFMessageListeners(OFType type)
|
void |
removeOFSwitchListener(IOFSwitchListener listener)
Remove a switch listener |
void |
rowsDeleted(java.lang.String tableName,
java.util.Set<java.lang.Object> rowKeys)
Called when a new row is deleted from the table. |
void |
rowsModified(java.lang.String tableName,
java.util.Set<java.lang.Object> rowKeys)
Called when rows are inserted or updated in the table. |
void |
run()
Tell controller that we're ready to accept switches loop |
void |
setAlwaysClearFlowsOnSwActivate(boolean value)
Configure controller to always clear the flow table on the switch, when it connects to controller. |
void |
setDebugEvent(IDebugEventService debugEvent)
|
void |
setRole(IFloodlightProviderService.Role role,
java.lang.String roleChangeDescription)
Set the role of the controller |
void |
setUplinkPortPrefixSet(java.util.Set<java.lang.String> prefixSet)
|
void |
startupComponents()
Startup all of the controller's components |
void |
terminate()
Terminate the process |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.slf4j.Logger log
protected static final INotificationManager notifier
protected FloodlightFactory factory
protected java.util.concurrent.ConcurrentMap<OFType,ListenerDispatcher<OFType,IOFMessageListener>> messageListeners
protected java.util.HashMap<java.lang.String,java.lang.String> controllerNodeIPsCache
protected java.util.Set<IOFSwitchListener> switchListeners
protected ListenerDispatcher<HAListenerTypeMarker,IHAListener> haListeners
protected java.util.Set<IReadyForReconcileListener> readyForReconcileListeners
protected java.util.Map<java.lang.String,java.util.List<IInfoProvider>> providerMap
protected java.util.concurrent.BlockingQueue<net.floodlightcontroller.core.internal.Controller.IUpdate> updates
protected IDebugEventService debugEvents
protected java.lang.String openFlowHost
protected int openFlowPort
protected int workerThreads
protected volatile IFloodlightProviderService.Role notifiedRole
protected static final java.lang.String CONTROLLER_TABLE_NAME
protected static final java.lang.String CONTROLLER_ID
protected static final java.lang.String SWITCH_CONFIG_TABLE_NAME
protected static final java.lang.String SWITCH_CONFIG_CORE_SWITCH
protected static final java.lang.String CONTROLLER_INTERFACE_TABLE_NAME
protected static final java.lang.String CONTROLLER_INTERFACE_ID
protected static final java.lang.String CONTROLLER_INTERFACE_CONTROLLER_ID
protected static final java.lang.String CONTROLLER_INTERFACE_TYPE
protected static final java.lang.String CONTROLLER_INTERFACE_NUMBER
protected static final java.lang.String CONTROLLER_INTERFACE_DISCOVERED_IP
protected static final int SEND_BUFFER_SIZE
public static final int BATCH_MAX_SIZE
protected static final boolean ALWAYS_DECODE_ETH
protected IEventUpdater<Controller.SwitchEvent> evSwitch
protected final boolean overload_drop
protected final LoadMonitor loadmonitor
protected static final java.lang.ThreadLocal<java.util.Stack<FloodlightContext>> flcontext_cache
Constructor Detail |
---|
public Controller()
Method Detail |
---|
public java.util.Set<java.lang.String> getUplinkPortPrefixSet()
IFloodlightProviderService
getUplinkPortPrefixSet
in interface IFloodlightProviderService
public void setUplinkPortPrefixSet(java.util.Set<java.lang.String> prefixSet)
public void setDebugEvent(IDebugEventService debugEvent)
public IFloodlightProviderService.Role getRole()
IFloodlightProviderService
getRole
in interface IFloodlightProviderService
public RoleInfo getRoleInfo()
IFloodlightProviderService
getRoleInfo
in interface IFloodlightProviderService
public void setRole(IFloodlightProviderService.Role role, java.lang.String roleChangeDescription)
IFloodlightProviderService
setRole
in interface IFloodlightProviderService
role
- The new role for the controller noderoleChangeDescription
- The reason or other information for this role changeprotected static FloodlightContext flcontext_alloc()
protected void flcontext_free(FloodlightContext flcontext)
flcontext
- protected void handleMessage(IOFSwitch sw, OFMessage m, FloodlightContext bContext) throws java.io.IOException
sw
- The switch sending the messagem
- The message the switch sentflContext
- The floodlight context to use for this message. If
null, a new context will be allocated.
java.io.IOException
- FIXME: this method and the ChannelHandler disagree on which messages
should be dispatched and which shouldn'tpublic java.util.Map<java.lang.Long,IOFSwitch> getAllSwitchMap()
IFloodlightProviderService
getAllSwitchMap
in interface IFloodlightProviderService
public java.util.Set<java.lang.Long> getAllSwitchDpids()
IFloodlightProviderService
IFloodlightProviderService.getSwitch(long)
for what "known" switch is.
getAllSwitchDpids
in interface IFloodlightProviderService
public IOFSwitch getSwitch(long dpid)
IFloodlightProviderService
getSwitch
in interface IFloodlightProviderService
dpid
- the dpid of the switch to query
public void addOFSwitchListener(IOFSwitchListener listener)
IFloodlightProviderService
addOFSwitchListener
in interface IFloodlightProviderService
listener
- The module that wants to listen for eventspublic void removeOFSwitchListener(IOFSwitchListener listener)
IFloodlightProviderService
removeOFSwitchListener
in interface IFloodlightProviderService
listener
- The The module that no longer wants to listen for eventspublic void addOFMessageListener(OFType type, IOFMessageListener listener)
IFloodlightProviderService
addOFMessageListener
in interface IFloodlightProviderService
type
- The OFType the component wants to listen forlistener
- The component that wants to listen for the messagepublic void removeOFMessageListener(OFType type, IOFMessageListener listener)
IFloodlightProviderService
removeOFMessageListener
in interface IFloodlightProviderService
type
- The OFType the component no long wants to listen forlistener
- The component that no longer wants to receive the messagepublic void removeOFMessageListeners(OFType type)
public java.util.Map<OFType,java.util.List<IOFMessageListener>> getListeners()
IFloodlightProviderService
getListeners
in interface IFloodlightProviderService
public boolean injectOfMessage(IOFSwitch sw, OFMessage msg, FloodlightContext bc)
IFloodlightProviderService
injectOfMessage
in interface IFloodlightProviderService
sw
- The switch to use for the messagemsg
- the message to injectbc
- a floodlight context to use if required. Can be null
public void terminate()
IFloodlightProviderService
terminate
in interface IFloodlightProviderService
public boolean injectOfMessage(IOFSwitch sw, OFMessage msg)
IFloodlightProviderService
injectOfMessage
in interface IFloodlightProviderService
sw
- The switch to use for the messagemsg
- the message to inject
public void handleOutgoingMessage(IOFSwitch sw, OFMessage m, FloodlightContext bc)
IFloodlightProviderService
handleOutgoingMessage
in interface IFloodlightProviderService
sw
- The switch being written tom
- the messagebc
- any accompanying context object. Can be null in which case a
new context will be allocated and passed to listenerspublic FloodlightFactory getOFMessageFactory()
IFloodlightProviderService
getOFMessageFactory
in interface IFloodlightProviderService
protected IFloodlightProviderService.Role getInitialRole(java.util.Map<java.lang.String,java.lang.String> configParams)
configParams
- The config params for the FloodlightProvider service
public void run()
run
in interface java.lang.Runnable
run
in interface IFloodlightProviderService
java.io.IOException
public void init(java.util.Map<java.lang.String,java.lang.String> configParams)
public void startupComponents() throws FloodlightModuleException
FloodlightModuleException
public void addInfoProvider(java.lang.String type, IInfoProvider provider)
IFloodlightProviderService
addInfoProvider
in interface IFloodlightProviderService
public void removeInfoProvider(java.lang.String type, IInfoProvider provider)
IFloodlightProviderService
removeInfoProvider
in interface IFloodlightProviderService
public java.util.Map<java.lang.String,java.lang.Object> getControllerInfo(java.lang.String type)
IFloodlightProviderService
getControllerInfo
in interface IFloodlightProviderService
public void addHAListener(IHAListener listener)
IFloodlightProviderService
addHAListener
in interface IFloodlightProviderService
listener
- The module that wants to listen for eventspublic void removeHAListener(IHAListener listener)
IFloodlightProviderService
removeHAListener
in interface IFloodlightProviderService
listener
- The module that no longer wants to listen for eventspublic void addReadyForReconcileListener(IReadyForReconcileListener l)
IFloodlightProviderService
addReadyForReconcileListener
in interface IFloodlightProviderService
protected void handleControllerNodeIPChanges()
public java.util.Map<java.lang.String,java.lang.String> getControllerNodeIPs()
IFloodlightProviderService
getControllerNodeIPs
in interface IFloodlightProviderService
IHAListener
public void rowsModified(java.lang.String tableName, java.util.Set<java.lang.Object> rowKeys)
IStorageSourceListener
rowsModified
in interface IStorageSourceListener
tableName
- The table where the rows were insertedrowKeys
- The keys of the rows that were insertedpublic void rowsDeleted(java.lang.String tableName, java.util.Set<java.lang.Object> rowKeys)
IStorageSourceListener
rowsDeleted
in interface IStorageSourceListener
tableName
- The table where the rows were deletedrowKeys
- The keys of the rows that were deletedpublic long getSystemStartTime()
IFloodlightProviderService
getSystemStartTime
in interface IFloodlightProviderService
public void setAlwaysClearFlowsOnSwActivate(boolean value)
IFloodlightProviderService
setAlwaysClearFlowsOnSwActivate
in interface IFloodlightProviderService
public java.util.Map<java.lang.String,java.lang.Long> getMemory()
IFloodlightProviderService
getMemory
in interface IFloodlightProviderService
public java.lang.Long getUptime()
IFloodlightProviderService
getUptime
in interface IFloodlightProviderService
public void addOFSwitchDriver(java.lang.String manufacturerDescriptionPrefix, IOFSwitchDriver driver)
IFloodlightProviderService
addOFSwitchDriver
in interface IFloodlightProviderService
driver
- A IOFSwitchDriver instance to handle IOFSwitch instaniation
for the given manufacturer description prefixpublic void addSwitchEvent(long switchDPID, java.lang.String reason, boolean flushNow)
addSwitchEvent
in interface IFloodlightProviderService
reason
- Reason for this eventflushNow
- see debug-event flushing in IDebugEventServicepublic java.util.Map<java.lang.String,java.lang.Object> getInfo(java.lang.String type)
IInfoProvider
getInfo
in interface IInfoProvider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |