net.floodlightcontroller.flowcache
Class PortDownReconciliation

java.lang.Object
  extended by net.floodlightcontroller.flowcache.PortDownReconciliation
All Implemented Interfaces:
IListener<OFType>, IFloodlightModule, IFlowReconcileListener, ITopologyListener

public class PortDownReconciliation
extends java.lang.Object
implements IFloodlightModule, ITopologyListener, IFlowReconcileListener

Flow reconciliation module that is triggered by PORT_DOWN events. This module will recursively trace back all flows from the immediately affected switch and remove them (specifically flows with an idle timeout that would not be exhausted). Once the flows are deleted Floodlight will re-evaluate the path the traffic should take with it's updated topology map.

Author:
Jason Parraga

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.floodlightcontroller.core.IListener
IListener.Command
 
Field Summary
protected  FloodlightContext cntx
           
protected  IFloodlightProviderService floodlightProvider
           
protected  IFlowReconcileService frm
           
protected  ILinkDiscoveryService lds
           
protected  java.util.Map<Link,LinkInfo> links
           
protected static org.slf4j.Logger log
           
protected  int statsQueryXId
           
protected static java.util.List<OFFlowStatisticsReply> statsReply
           
protected  ITopologyService topology
           
protected static boolean waiting
           
 
Constructor Summary
PortDownReconciliation()
           
 
Method Summary
 void clearFlowMods(IOFSwitch sw, java.lang.Integer outPort)
           
 void clearFlowMods(IOFSwitch sw, OFMatch match, java.lang.Integer outPort)
           
 void deleteInvalidFlows(IOFSwitch sw, java.util.Map<java.lang.Integer,java.util.List<OFMatch>> invalidOutportAndMatch)
          Deletes flows with similar matches and output action ports on the specified switch
 java.util.List<OFFlowStatisticsReply> getFlows(IOFSwitch sw, java.lang.Integer outPort)
           
 java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleDependencies()
          Get a list of Modules that this module depends on.
 java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleServices()
          Return the list of interfaces that this module implements.
 java.lang.String getName()
          The name assigned to this listener
 java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> getServiceImpls()
          Instantiate (as needed) and return objects that implement each of the services exported by this module.
 void init(FloodlightModuleContext context)
          This is a hook for each module to do its internal initialization, e.g., call setService(context.getService("Service")) All module dependencies are resolved when this is called, but not every module is initialized.
 boolean isCallbackOrderingPostreq(OFType type, java.lang.String name)
          Check if the module called name is a callback ordering post-requisite for this module.
 boolean isCallbackOrderingPrereq(OFType type, java.lang.String name)
          Check if the module called name is a callback ordering prerequisite for this module.
 IListener.Command reconcileFlows(java.util.ArrayList<OFMatchReconcile> ofmRcList)
          Base case for the reconciliation of flows.
 void startUp(FloodlightModuleContext context)
          This is a hook for each module to do its external initializations, e.g., register for callbacks or query for state in other modules It is expected that this function will not block and that modules that want non-event driven CPU will spawn their own threads.
 void topologyChanged(java.util.List<ILinkDiscovery.LDUpdate> appliedUpdates)
          Happens when the switch clusters are recomputed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.slf4j.Logger log

topology

protected ITopologyService topology

floodlightProvider

protected IFloodlightProviderService floodlightProvider

frm

protected IFlowReconcileService frm

lds

protected ILinkDiscoveryService lds

links

protected java.util.Map<Link,LinkInfo> links

cntx

protected FloodlightContext cntx

waiting

protected static boolean waiting

statsQueryXId

protected int statsQueryXId

statsReply

protected static java.util.List<OFFlowStatisticsReply> statsReply
Constructor Detail

PortDownReconciliation

public PortDownReconciliation()
Method Detail

topologyChanged

public void topologyChanged(java.util.List<ILinkDiscovery.LDUpdate> appliedUpdates)
Description copied from interface: ITopologyListener
Happens when the switch clusters are recomputed

Specified by:
topologyChanged in interface ITopologyListener

getModuleServices

public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleServices()
Description copied from interface: IFloodlightModule
Return the list of interfaces that this module implements. All interfaces must inherit IFloodlightService

Specified by:
getModuleServices in interface IFloodlightModule
Returns:

getServiceImpls

public java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> getServiceImpls()
Description copied from interface: IFloodlightModule
Instantiate (as needed) and return objects that implement each of the services exported by this module. The map returned maps the implemented service to the object. The object could be the same object or different objects for different exported services.

Specified by:
getServiceImpls in interface IFloodlightModule
Returns:
The map from service interface class to service implementation

getModuleDependencies

public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleDependencies()
Description copied from interface: IFloodlightModule
Get a list of Modules that this module depends on. The module system will ensure that each these dependencies is resolved before the subsequent calls to init().

Specified by:
getModuleDependencies in interface IFloodlightModule
Returns:
The Collection of IFloodlightServices that this module depends on.

init

public void init(FloodlightModuleContext context)
          throws FloodlightModuleException
Description copied from interface: IFloodlightModule
This is a hook for each module to do its internal initialization, e.g., call setService(context.getService("Service")) All module dependencies are resolved when this is called, but not every module is initialized.

Specified by:
init in interface IFloodlightModule
Throws:
FloodlightModuleException

startUp

public void startUp(FloodlightModuleContext context)
Description copied from interface: IFloodlightModule
This is a hook for each module to do its external initializations, e.g., register for callbacks or query for state in other modules It is expected that this function will not block and that modules that want non-event driven CPU will spawn their own threads.

Specified by:
startUp in interface IFloodlightModule

getName

public java.lang.String getName()
Description copied from interface: IListener
The name assigned to this listener

Specified by:
getName in interface IListener<OFType>
Returns:

isCallbackOrderingPrereq

public boolean isCallbackOrderingPrereq(OFType type,
                                        java.lang.String name)
Description copied from interface: IListener
Check if the module called name is a callback ordering prerequisite for this module. In other words, if this function returns true for the given name, then this listener will be called after that message listener.

Specified by:
isCallbackOrderingPrereq in interface IListener<OFType>
Parameters:
type - the object type to which this applies
name - the name of the module
Returns:
whether name is a prerequisite.

isCallbackOrderingPostreq

public boolean isCallbackOrderingPostreq(OFType type,
                                         java.lang.String name)
Description copied from interface: IListener
Check if the module called name is a callback ordering post-requisite for this module. In other words, if this function returns true for the given name, then this listener will be called before that message listener.

Specified by:
isCallbackOrderingPostreq in interface IListener<OFType>
Parameters:
type - the object type to which this applies
name - the name of the module
Returns:
whether name is a post-requisite.

reconcileFlows

public IListener.Command reconcileFlows(java.util.ArrayList<OFMatchReconcile> ofmRcList)
Base case for the reconciliation of flows. This is triggered at the switch which is immediately affected by the PORT_DOWN event

Specified by:
reconcileFlows in interface IFlowReconcileListener
Parameters:
ofmRcList - input flow matches, to be updated to be consistent with the policies of this reconciler Additional OFMatch-es can be added to the "list" as needed. For example after a new ACL application, one flow-match may result in multiple flow-matches The method must also update the ReconcileAction member in ofmRcList entries to indicate if the flow needs to be modified, deleted or left unchanged OR of a new entry is to be added after flow reconciliation
Returns:
the Command whether to STOP or Continue

getFlows

public java.util.List<OFFlowStatisticsReply> getFlows(IOFSwitch sw,
                                                      java.lang.Integer outPort)
Parameters:
sw - the switch object that we wish to get flows from
outPort - the output action port we wish to find flows with
Returns:
a list of OFFlowStatisticsReply objects or essentially flows

clearFlowMods

public void clearFlowMods(IOFSwitch sw,
                          java.lang.Integer outPort)
Parameters:
sw - The switch we wish to remove flows from
outPort - The specific Output Action OutPort of specific flows we wish to delete

clearFlowMods

public void clearFlowMods(IOFSwitch sw,
                          OFMatch match,
                          java.lang.Integer outPort)
Parameters:
sw - The switch we wish to remove flows from
match - The specific OFMatch object of specific flows we wish to delete
outPort - The specific Output Action OutPort of specific flows we wish to delete

deleteInvalidFlows

public void deleteInvalidFlows(IOFSwitch sw,
                               java.util.Map<java.lang.Integer,java.util.List<OFMatch>> invalidOutportAndMatch)
Deletes flows with similar matches and output action ports on the specified switch

Parameters:
sw - the switch to query flows on
match - the problematic OFMatch from the base switch which we wish to find and remove
outPort - the output action port wanted from the flows, which follows the route to the base switch