net.floodlightcontroller.core
Interface IFloodlightProviderService

All Superinterfaces:
IFloodlightService, java.lang.Runnable
All Known Implementing Classes:
Controller

public interface IFloodlightProviderService
extends IFloodlightService, java.lang.Runnable

The interface exposed by the core bundle that allows you to interact with connected switches.

Author:
David Erickson (daviderickson@cs.stanford.edu)

Nested Class Summary
static class IFloodlightProviderService.Role
          The role of the controller as used by the OF 1.2 and OVS failover and load-balancing mechanism.
 
Field Summary
static FloodlightContextStore<Ethernet> bcStore
          A FloodlightContextStore object that can be used to retrieve the packet-in payload
static java.lang.String CONTEXT_PI_PAYLOAD
          A value stored in the floodlight context containing a parsed packet representation of the payload of a packet-in message.
 
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 desc, 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)
          Record a switch event in in-memory debug-event
 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<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.
 void handleOutgoingMessage(IOFSwitch sw, OFMessage m, FloodlightContext bc)
          Process written messages through the message listeners for the controller
 boolean injectOfMessage(IOFSwitch sw, OFMessage msg)
          Re-injects an OFMessage back into the packet processing chain
 boolean injectOfMessage(IOFSwitch sw, OFMessage msg, FloodlightContext bContext)
          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 removeOFSwitchListener(IOFSwitchListener listener)
          Remove a switch listener
 void run()
          Run the main I/O loop of the Controller.
 void setAlwaysClearFlowsOnSwActivate(boolean value)
          Configure controller to always clear the flow table on the switch, when it connects to controller.
 void setRole(IFloodlightProviderService.Role role, java.lang.String changeDescription)
          Set the role of the controller
 void terminate()
          Terminate the process
 

Field Detail

CONTEXT_PI_PAYLOAD

static final java.lang.String CONTEXT_PI_PAYLOAD
A value stored in the floodlight context containing a parsed packet representation of the payload of a packet-in message.

See Also:
Constant Field Values

bcStore

static final FloodlightContextStore<Ethernet> bcStore
A FloodlightContextStore object that can be used to retrieve the packet-in payload

Method Detail

addOFMessageListener

void addOFMessageListener(OFType type,
                          IOFMessageListener listener)
Adds an OpenFlow message listener

Parameters:
type - The OFType the component wants to listen for
listener - The component that wants to listen for the message

removeOFMessageListener

void removeOFMessageListener(OFType type,
                             IOFMessageListener listener)
Removes an OpenFlow message listener

Parameters:
type - The OFType the component no long wants to listen for
listener - The component that no longer wants to receive the message

getListeners

java.util.Map<OFType,java.util.List<IOFMessageListener>> getListeners()
Return a non-modifiable list of all current listeners

Returns:
listeners

getSwitch

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. As such the returned switches not necessarily connected or in master role for the local controller. Multiple calls to this method with the same DPID may return different IOFSwitch references. A caller must not store or otherwise rely on IOFSwitch references to be constant over the lifecycle of a switch.

Parameters:
dpid - the dpid of the switch to query
Returns:
the IOFSwitch instance associated with the dpid, null if no switch with the dpid is known to the cluster

getAllSwitchDpids

java.util.Set<java.lang.Long> getAllSwitchDpids()
Returns a snapshot of the set DPIDs for all known switches. The returned set is owned by the caller: the caller can modify it at will and changes to the known switches are not reflected in the returned set. The caller needs to call getAllSwitchDpids() if an updated version is needed. See getSwitch(long) for what "known" switch is.

Returns:
the set of DPIDs of all known switches

getAllSwitchMap

java.util.Map<java.lang.Long,IOFSwitch> getAllSwitchMap()
Return a snapshot FIXME: asdf

Returns:

getRole

IFloodlightProviderService.Role getRole()
Get the current role of the controller


getRoleInfo

RoleInfo getRoleInfo()
Get the current role of the controller


getControllerNodeIPs

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.

See Also:
IHAListener

setRole

void setRole(IFloodlightProviderService.Role role,
             java.lang.String changeDescription)
Set the role of the controller

Parameters:
role - The new role for the controller node
changeDescription - The reason or other information for this role change

addOFSwitchListener

void addOFSwitchListener(IOFSwitchListener listener)
Add a switch listener

Parameters:
listener - The module that wants to listen for events

removeOFSwitchListener

void removeOFSwitchListener(IOFSwitchListener listener)
Remove a switch listener

Parameters:
listener - The The module that no longer wants to listen for events

addHAListener

void addHAListener(IHAListener listener)
Adds a listener for HA role events

Parameters:
listener - The module that wants to listen for events

removeHAListener

void removeHAListener(IHAListener listener)
Removes a listener for HA role events

Parameters:
listener - The module that no longer wants to listen for events

addReadyForReconcileListener

void addReadyForReconcileListener(IReadyForReconcileListener l)
Add a listener for ready-for-flow-reconcile events

Parameters:
l -

terminate

void terminate()
Terminate the process


injectOfMessage

boolean injectOfMessage(IOFSwitch sw,
                        OFMessage msg)
Re-injects an OFMessage back into the packet processing chain

Parameters:
sw - The switch to use for the message
msg - the message to inject
Returns:
True if successfully re-injected, false otherwise
Throws:
java.lang.NullPointerException - if switch or msg is null

injectOfMessage

boolean injectOfMessage(IOFSwitch sw,
                        OFMessage msg,
                        FloodlightContext bContext)
Re-injects an OFMessage back into the packet processing chain

Parameters:
sw - The switch to use for the message
msg - the message to inject
bContext - a floodlight context to use if required. Can be null
Returns:
True if successfully re-injected, false otherwise
Throws:
java.lang.NullPointerException - if switch or msg is null

handleOutgoingMessage

void handleOutgoingMessage(IOFSwitch sw,
                           OFMessage m,
                           FloodlightContext bc)
Process written messages through the message listeners for the controller

Parameters:
sw - The switch being written to
m - the message
bc - any accompanying context object. Can be null in which case a new context will be allocated and passed to listeners
Throws:
java.lang.NullPointerException - if switch or msg is null

getOFMessageFactory

FloodlightFactory getOFMessageFactory()
Gets the FloodlightFactory

Returns:
an OpenFlow message factory

run

void run()
Run the main I/O loop of the Controller.

Specified by:
run in interface java.lang.Runnable

addInfoProvider

void addInfoProvider(java.lang.String type,
                     IInfoProvider provider)
Add an info provider of a particular type

Parameters:
type -
provider -

removeInfoProvider

void removeInfoProvider(java.lang.String type,
                        IInfoProvider provider)
Remove an info provider of a particular type

Parameters:
type -
provider -

getControllerInfo

java.util.Map<java.lang.String,java.lang.Object> getControllerInfo(java.lang.String type)
Return information of a particular type (for rest services)

Parameters:
type -
Returns:

getSystemStartTime

long getSystemStartTime()
Return the controller start time in milliseconds

Returns:

setAlwaysClearFlowsOnSwActivate

void setAlwaysClearFlowsOnSwActivate(boolean value)
Configure controller to always clear the flow table on the switch, when it connects to controller. This will be true for first time switch reconnect, as well as a switch re-attaching to Controller after HA switch over to ACTIVE role


getMemory

java.util.Map<java.lang.String,java.lang.Long> getMemory()
Get controller memory information


getUptime

java.lang.Long getUptime()
returns the uptime of this controller.

Returns:

addOFSwitchDriver

void addOFSwitchDriver(java.lang.String desc,
                       IOFSwitchDriver driver)
Adds an OFSwitch driver

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

addSwitchEvent

void addSwitchEvent(long switchDPID,
                    java.lang.String reason,
                    boolean flushNow)
Record a switch event in in-memory debug-event

Parameters:
switchDPID -
reason - Reason for this event
flushNow - see debug-event flushing in IDebugEventService

getUplinkPortPrefixSet

java.util.Set<java.lang.String> getUplinkPortPrefixSet()
Get the set of port prefixes that will define an UPLINK port.

Returns:
The set of prefixes