net.floodlightcontroller.linkdiscovery.internal
Class LinkDiscoveryManager

java.lang.Object
  extended by net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager
All Implemented Interfaces:
IInfoProvider, IListener<OFType>, IOFMessageListener, IOFSwitchListener, IFloodlightModule, IFloodlightService, ILinkDiscoveryService, IStorageSourceListener

public class LinkDiscoveryManager
extends java.lang.Object
implements IOFMessageListener, IOFSwitchListener, IStorageSourceListener, ILinkDiscoveryService, IFloodlightModule, IInfoProvider

This class sends out LLDP messages containing the sending switch's datapath id as well as the outgoing port number. Received LLrescDP messages that match a known switch cause a new LinkTuple to be created according to the invariant rules listed below. This new LinkTuple is also passed to routing if it exists to trigger updates. This class also handles removing links that are associated to switch ports that go down, and switches that are disconnected. Invariants: -portLinks and switchLinks will not contain empty Sets outside of critical sections -portLinks contains LinkTuples where one of the src or dst SwitchPortTuple matches the map key -switchLinks contains LinkTuples where one of the src or dst SwitchPortTuple's id matches the switch id -Each LinkTuple will be indexed into switchLinks for both src.id and dst.id, and portLinks for each src and dst -The updates queue is only added to from within a held write lock


Nested Class Summary
 class LinkDiscoveryManager.DirectLinkEvent
           
protected  class LinkDiscoveryManager.QuarantineWorker
          Quarantine Ports.
 
Nested classes/interfaces inherited from interface net.floodlightcontroller.core.IListener
IListener.Command
 
Field Summary
protected  boolean AUTOPORTFAST_DEFAULT
          Flag to indicate if automatic port fast is enabled or not.
protected  boolean autoPortFastFeature
           
protected  int BDDP_TASK_INTERVAL
           
protected  int BDDP_TASK_SIZE
           
protected  SingletonTask bddpTask
          Quarantine task
protected  LLDPTLV controllerTLV
           
protected  IDebugCounterService debugCounters
           
protected  IDebugEventService debugEvents
           
protected  int DISCOVERY_TASK_INTERVAL
           
protected  SingletonTask discoveryTask
           
protected  IEventUpdater<LinkDiscoveryManager.DirectLinkEvent> evDirectLink
           
protected static int EVENT_HISTORY_SIZE
           
protected  IFloodlightProviderService floodlightProvider
           
protected  java.util.Set<net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager.MACRange> ignoreMACSet
           
protected  int LINK_TIMEOUT
           
protected  java.util.ArrayList<ILinkDiscoveryListener> linkDiscoveryAware
           
protected  java.util.Map<Link,LinkInfo> links
          Map from link to the most recent time it was verified functioning
protected  int LLDP_TO_ALL_INTERVAL
           
protected  int LLDP_TO_KNOWN_INTERVAL
           
protected  long lldpClock
           
protected  java.util.concurrent.locks.ReentrantReadWriteLock lock
           
protected static org.slf4j.Logger log
           
protected  java.util.concurrent.LinkedBlockingQueue<NodePortTuple> maintenanceQueue
           
static java.lang.String MODULE_NAME
           
protected static INotificationManager notifier
           
protected  java.util.Map<NodePortTuple,java.util.Set<Link>> portLinks
          Map from a id:port to the set of links containing it as an endpoint
protected  java.util.concurrent.LinkedBlockingQueue<NodePortTuple> quarantineQueue
          A list of ports that are quarantined for discovering links through them.
protected  IRestApiService restApi
           
protected  IFloodlightProviderService.Role role
           
protected  boolean shuttingDown
           
protected  IStorageSourceService storageSource
           
protected  java.util.Set<NodePortTuple> suppressLinkDiscovery
          List of ports through which LLDP/BDDPs are not sent.
protected  java.util.Map<java.lang.Long,java.util.Set<Link>> switchLinks
          Map from switch id to a set of all links with it as an endpoint
protected  IThreadPoolService threadPool
           
protected  java.util.concurrent.BlockingQueue<ILinkDiscovery.LDUpdate> updates
           
protected  java.lang.Thread updatesThread
           
 
Constructor Summary
LinkDiscoveryManager()
           
 
Method Summary
 void addListener(ILinkDiscoveryListener listener)
          Adds a listener to listen for ILinkDiscoveryService messages
 void addMACToIgnoreList(long mac, int ignoreBits)
          addMACToIgnoreList is a service provided by LinkDiscovery to ignore certain packets early in the packet-in processing chain.
protected  boolean addOrUpdateLink(Link lt, LinkInfo newInfo)
           
protected  void addToMaintenanceQueue(NodePortTuple npt)
          Add a switch port to maintenance queue.
protected  void addToQuarantineQueue(NodePortTuple npt)
          Add a switch port to the quarantine queue.
 void AddToSuppressLLDPs(long sw, int port)
          Add a switch port to the suppressed LLDP list.
protected  void deleteLink(Link link, java.lang.String reason)
          Delete a link
protected  void deleteLinks(java.util.List<Link> links, java.lang.String reason)
          Removes links from memory and storage.
protected  void deleteLinks(java.util.List<Link> links, java.lang.String reason, java.util.List<ILinkDiscovery.LDUpdate> updateList)
          Removes links from memory and storage.
protected  void deleteLinksOnPort(NodePortTuple npt, java.lang.String reason)
          Delete links incident on a given switch port.
protected  void discover(long sw, int port)
           
protected  void discover(NodePortTuple npt)
           
protected  void discoverLinks()
           
protected  void discoverOnAllPorts()
          Send LLDPs to all switch-ports
 OFPacketOut generateLLDPMessage(long sw, int port, boolean isStandard, boolean isReverse)
          Returns OFPacketOut which contains the LLDP data corresponding to switchport (sw, port).
protected  java.util.List<OFAction> getDiscoveryActions(IOFSwitch sw, OFPhysicalPort port)
          Get the actions for packet-out corresponding to a specific port.
 java.util.Map<java.lang.String,java.lang.Object> getInfo(java.lang.String type)
          Called when rest API requests information of a particular type
 LinkInfo getLinkInfo(Link link)
          Retrieves the link info for a given link
 java.util.Map<Link,LinkInfo> getLinks()
          Retrieves a map of all known link connections between OpenFlow switches and the associated info (valid time, port states) for the link.
 ILinkDiscovery.LinkType getLinkType(Link lt, LinkInfo info)
          Returns link type of a given link
 int getLldpFrequency()
          Get the LLDP sending period in seconds.
 int getLldpTimeout()
          Get the LLDP timeout value in seconds
 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<NodePortTuple,java.util.Set<Link>> getPortLinks()
          Get the map of node-port tuples from link DB
 java.util.Set<java.lang.Integer> getQuarantinedPorts(long sw)
          Get the set of quarantined ports on a switch
 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.
 IStorageSourceService getStorageSource()
          Gets the storage source for this ITopology
 java.util.Set<NodePortTuple> getSuppressLLDPsInfo()
          Retrieves a set of all switch ports on which lldps are suppressed.
 java.util.Map<java.lang.Long,java.util.Set<Link>> getSwitchLinks()
          Returns an unmodifiable map from switch id to a set of all links with it as an endpoint.
protected  ILinkDiscovery.UpdateOperation getUpdateOperation(int srcPortState)
           
protected  ILinkDiscovery.UpdateOperation getUpdateOperation(int srcPortState, int dstPortState)
           
protected  IListener.Command handlePacketIn(long sw, OFPacketIn pi, FloodlightContext cntx)
           
 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 isAutoPortFastFeature()
          Get the status of auto port fast feature.
 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.
protected  boolean isIncomingDiscoveryAllowed(long sw, int port, boolean isStandard)
          Check if incoming discovery messages are enabled or not.
protected  boolean isLinkAllowed(long src, int srcPort, long dst, int dstPort)
          This method is used to specifically ignore/consider specific links.
protected  boolean isLinkDiscoverySuppressed(long sw, int portNumber)
           
protected  boolean isOutgoingDiscoveryAllowed(long sw, int port, boolean isStandard, boolean isReverse)
          Check if outgoing discovery messages are enabled or not.
 boolean isShuttingDown()
           
 boolean isTunnelPort(long sw, int port)
          Returns if a given switchport is a tunnel endpoint or not
protected  void processBDDPLists()
          This method processes the quarantine list in bursts.
 java.lang.Long readLinkValidTime(Link lt)
           
protected  void readTopologyConfigFromStorage()
           
 IListener.Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx)
          This is the method Floodlight uses to call listeners with OpenFlow messages
protected  void removeFromMaintenanceQueue(NodePortTuple npt)
          Remove a switch port from maintenance queue.
protected  void removeFromQuarantineQueue(NodePortTuple npt)
          Remove a switch port from the quarantine queue.
 void RemoveFromSuppressLLDPs(long sw, int port)
          Remove a switch port from the suppressed LLDP list.
protected  void removeLinkFromStorage(Link lt)
          Removes a link from storage using an asynchronous call.
 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.
protected  void sendDiscoveryMessage(long sw, int port, boolean isStandard, boolean isReverse)
          Send link discovery message out of a given switch port.
 void setAutoPortFastFeature(boolean autoPortFastFeature)
          Set the state for auto port fast feature.
protected  void setControllerTLV()
           
 void setStorageSource(IStorageSourceService storageSource)
          Sets the IStorageSource to use for Topology
 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 switchActivated(long switchId)
          Fired when a switch becomes active *on the local controller*, I.e., the switch is connected to the local controller and is in MASTER mode
 void switchAdded(long switchId)
          Fired when switch becomes known to the controller cluster.
 void switchChanged(long switchId)
          Fired when any non-port related information (e.g., attributes, features) change after a switchAdded TODO: currently unused
 void switchPortChanged(long switchId, ImmutablePort port, IOFSwitch.PortChangeType type)
          We don't react the port changed notifications here.
 void switchRemoved(long sw)
          Fired when a switch disconnects from the cluster ,
protected  void timeoutLinks()
          Iterates through the list of links and deletes if the last discovery message reception time exceeds timeout values.
protected  boolean updateLink(Link lt, LinkInfo oldInfo, LinkInfo newInfo)
           
protected  void writeLinkToStorage(Link lt, LinkInfo linkInfo)
          Writes a LinkTuple and corresponding LinkInfo to storage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.slf4j.Logger log

notifier

protected static final INotificationManager notifier

MODULE_NAME

public static final java.lang.String MODULE_NAME
See Also:
Constant Field Values

evDirectLink

protected IEventUpdater<LinkDiscoveryManager.DirectLinkEvent> evDirectLink

floodlightProvider

protected IFloodlightProviderService floodlightProvider

storageSource

protected IStorageSourceService storageSource

threadPool

protected IThreadPoolService threadPool

restApi

protected IRestApiService restApi

debugCounters

protected IDebugCounterService debugCounters

debugEvents

protected IDebugEventService debugEvents

role

protected IFloodlightProviderService.Role role

EVENT_HISTORY_SIZE

protected static int EVENT_HISTORY_SIZE

discoveryTask

protected SingletonTask discoveryTask

DISCOVERY_TASK_INTERVAL

protected final int DISCOVERY_TASK_INTERVAL
See Also:
Constant Field Values

LINK_TIMEOUT

protected final int LINK_TIMEOUT
See Also:
Constant Field Values

LLDP_TO_ALL_INTERVAL

protected final int LLDP_TO_ALL_INTERVAL
See Also:
Constant Field Values

lldpClock

protected long lldpClock

LLDP_TO_KNOWN_INTERVAL

protected final int LLDP_TO_KNOWN_INTERVAL
See Also:
Constant Field Values

controllerTLV

protected LLDPTLV controllerTLV

lock

protected java.util.concurrent.locks.ReentrantReadWriteLock lock

AUTOPORTFAST_DEFAULT

protected boolean AUTOPORTFAST_DEFAULT
Flag to indicate if automatic port fast is enabled or not. Default is set to false -- Initialized in the init method as well.


autoPortFastFeature

protected boolean autoPortFastFeature

links

protected java.util.Map<Link,LinkInfo> links
Map from link to the most recent time it was verified functioning


switchLinks

protected java.util.Map<java.lang.Long,java.util.Set<Link>> switchLinks
Map from switch id to a set of all links with it as an endpoint


portLinks

protected java.util.Map<NodePortTuple,java.util.Set<Link>> portLinks
Map from a id:port to the set of links containing it as an endpoint


shuttingDown

protected volatile boolean shuttingDown

linkDiscoveryAware

protected java.util.ArrayList<ILinkDiscoveryListener> linkDiscoveryAware

updates

protected java.util.concurrent.BlockingQueue<ILinkDiscovery.LDUpdate> updates

updatesThread

protected java.lang.Thread updatesThread

suppressLinkDiscovery

protected java.util.Set<NodePortTuple> suppressLinkDiscovery
List of ports through which LLDP/BDDPs are not sent.


quarantineQueue

protected java.util.concurrent.LinkedBlockingQueue<NodePortTuple> quarantineQueue
A list of ports that are quarantined for discovering links through them. Data traffic from these ports are not allowed until the ports are released from quarantine.


maintenanceQueue

protected java.util.concurrent.LinkedBlockingQueue<NodePortTuple> maintenanceQueue

bddpTask

protected SingletonTask bddpTask
Quarantine task


BDDP_TASK_INTERVAL

protected final int BDDP_TASK_INTERVAL
See Also:
Constant Field Values

BDDP_TASK_SIZE

protected final int BDDP_TASK_SIZE
See Also:
Constant Field Values

ignoreMACSet

protected java.util.Set<net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager.MACRange> ignoreMACSet
Constructor Detail

LinkDiscoveryManager

public LinkDiscoveryManager()
Method Detail

generateLLDPMessage

public OFPacketOut generateLLDPMessage(long sw,
                                       int port,
                                       boolean isStandard,
                                       boolean isReverse)
Description copied from interface: ILinkDiscoveryService
Returns OFPacketOut which contains the LLDP data corresponding to switchport (sw, port). PacketOut does not contain actions. PacketOut length includes the minimum length and data length.

Specified by:
generateLLDPMessage in interface ILinkDiscoveryService

getLldpFrequency

public int getLldpFrequency()
Get the LLDP sending period in seconds.

Returns:
LLDP sending period in seconds.

getLldpTimeout

public int getLldpTimeout()
Get the LLDP timeout value in seconds

Returns:
LLDP timeout value in seconds

getPortLinks

public java.util.Map<NodePortTuple,java.util.Set<Link>> getPortLinks()
Description copied from interface: ILinkDiscoveryService
Get the map of node-port tuples from link DB

Specified by:
getPortLinks in interface ILinkDiscoveryService

getSuppressLLDPsInfo

public java.util.Set<NodePortTuple> getSuppressLLDPsInfo()
Description copied from interface: ILinkDiscoveryService
Retrieves a set of all switch ports on which lldps are suppressed.

Specified by:
getSuppressLLDPsInfo in interface ILinkDiscoveryService

AddToSuppressLLDPs

public void AddToSuppressLLDPs(long sw,
                               int port)
Add a switch port to the suppressed LLDP list. Remove any known links on the switch port.

Specified by:
AddToSuppressLLDPs in interface ILinkDiscoveryService

RemoveFromSuppressLLDPs

public void RemoveFromSuppressLLDPs(long sw,
                                    int port)
Remove a switch port from the suppressed LLDP list. Discover links on that switchport.

Specified by:
RemoveFromSuppressLLDPs in interface ILinkDiscoveryService

isShuttingDown

public boolean isShuttingDown()

isTunnelPort

public boolean isTunnelPort(long sw,
                            int port)
Description copied from interface: ILinkDiscoveryService
Returns if a given switchport is a tunnel endpoint or not

Specified by:
isTunnelPort in interface ILinkDiscoveryService

getLinkType

public ILinkDiscovery.LinkType getLinkType(Link lt,
                                           LinkInfo info)
Description copied from interface: ILinkDiscoveryService
Returns link type of a given link

Specified by:
getLinkType in interface ILinkDiscoveryService
Returns:

getQuarantinedPorts

public java.util.Set<java.lang.Integer> getQuarantinedPorts(long sw)
Description copied from interface: ILinkDiscoveryService
Get the set of quarantined ports on a switch

Specified by:
getQuarantinedPorts in interface ILinkDiscoveryService

getSwitchLinks

public java.util.Map<java.lang.Long,java.util.Set<Link>> getSwitchLinks()
Description copied from interface: ILinkDiscoveryService
Returns an unmodifiable map from switch id to a set of all links with it as an endpoint.

Specified by:
getSwitchLinks in interface ILinkDiscoveryService

addMACToIgnoreList

public void addMACToIgnoreList(long mac,
                               int ignoreBits)
Description copied from interface: ILinkDiscoveryService
addMACToIgnoreList is a service provided by LinkDiscovery to ignore certain packets early in the packet-in processing chain. Since LinkDiscovery is first in the packet-in processing pipeline, it can efficiently drop these packets. Currently these packets are identified only by their source MAC address. Add a MAC address range to ignore list. All packet ins from this range will be dropped - use with care!

Specified by:
addMACToIgnoreList in interface ILinkDiscoveryService
Parameters:
mac - The base MAC address that is to be ignored
ignoreBits - The number of LSBs to ignore. A value of 0 will add only one MAC address 'mac' to ignore list. A value of 48 will add ALL MAC addresses to the ignore list. This will cause a drop of ALL packet ins.

isAutoPortFastFeature

public boolean isAutoPortFastFeature()
Description copied from interface: ILinkDiscoveryService
Get the status of auto port fast feature.

Specified by:
isAutoPortFastFeature in interface ILinkDiscoveryService

setAutoPortFastFeature

public void setAutoPortFastFeature(boolean autoPortFastFeature)
Description copied from interface: ILinkDiscoveryService
Set the state for auto port fast feature.

Specified by:
setAutoPortFastFeature in interface ILinkDiscoveryService

addListener

public void addListener(ILinkDiscoveryListener listener)
Description copied from interface: ILinkDiscoveryService
Adds a listener to listen for ILinkDiscoveryService messages

Specified by:
addListener in interface ILinkDiscoveryService
Parameters:
listener - The listener that wants the notifications

getLinks

public java.util.Map<Link,LinkInfo> getLinks()
Description copied from interface: ILinkDiscoveryService
Retrieves a map of all known link connections between OpenFlow switches and the associated info (valid time, port states) for the link.

Specified by:
getLinks in interface ILinkDiscoveryService

getLinkInfo

public LinkInfo getLinkInfo(Link link)
Description copied from interface: ILinkDiscoveryService
Retrieves the link info for a given link

Specified by:
getLinkInfo in interface ILinkDiscoveryService
Parameters:
link - link for which the link info should be returned
Returns:
the link info for the given link

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:

receive

public IListener.Command receive(IOFSwitch sw,
                                 OFMessage msg,
                                 FloodlightContext cntx)
Description copied from interface: IOFMessageListener
This is the method Floodlight uses to call listeners with OpenFlow messages

Specified by:
receive in interface IOFMessageListener
Parameters:
sw - the OpenFlow switch that sent this message
msg - the message
cntx - a Floodlight message context object you can use to pass information between listeners
Returns:
the command to continue or stop the execution

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.

handlePacketIn

protected IListener.Command handlePacketIn(long sw,
                                           OFPacketIn pi,
                                           FloodlightContext cntx)

isLinkDiscoverySuppressed

protected boolean isLinkDiscoverySuppressed(long sw,
                                            int portNumber)

discoverLinks

protected void discoverLinks()

addToQuarantineQueue

protected void addToQuarantineQueue(NodePortTuple npt)
Add a switch port to the quarantine queue. Schedule the quarantine task if the quarantine queue was empty before adding this switch port.

Parameters:
npt -

removeFromQuarantineQueue

protected void removeFromQuarantineQueue(NodePortTuple npt)
Remove a switch port from the quarantine queue.


addToMaintenanceQueue

protected void addToMaintenanceQueue(NodePortTuple npt)
Add a switch port to maintenance queue.

Parameters:
npt -

removeFromMaintenanceQueue

protected void removeFromMaintenanceQueue(NodePortTuple npt)
Remove a switch port from maintenance queue.

Parameters:
npt -

processBDDPLists

protected void processBDDPLists()
This method processes the quarantine list in bursts. The task is at most once per BDDP_TASK_INTERVAL. One each call, BDDP_TASK_SIZE number of switch ports are processed. Once the BDDP packets are sent out through the switch ports, the ports are removed from the quarantine list.


discover

protected void discover(NodePortTuple npt)

discover

protected void discover(long sw,
                        int port)

isIncomingDiscoveryAllowed

protected boolean isIncomingDiscoveryAllowed(long sw,
                                             int port,
                                             boolean isStandard)
Check if incoming discovery messages are enabled or not.

Parameters:
sw -
port -
isStandard -
Returns:

isOutgoingDiscoveryAllowed

protected boolean isOutgoingDiscoveryAllowed(long sw,
                                             int port,
                                             boolean isStandard,
                                             boolean isReverse)
Check if outgoing discovery messages are enabled or not.

Parameters:
sw -
port -
isStandard -
isReverse -
Returns:

getDiscoveryActions

protected java.util.List<OFAction> getDiscoveryActions(IOFSwitch sw,
                                                       OFPhysicalPort port)
Get the actions for packet-out corresponding to a specific port. This is a placeholder for adding actions if any port-specific actions are desired. The default action is simply to output to the given port.

Parameters:
port -
Returns:

sendDiscoveryMessage

protected void sendDiscoveryMessage(long sw,
                                    int port,
                                    boolean isStandard,
                                    boolean isReverse)
Send link discovery message out of a given switch port. The discovery message may be a standard LLDP or a modified LLDP, where the dst mac address is set to :ff. TODO: The modified LLDP will updated in the future and may use a different eth-type.

Parameters:
sw -
port -
isStandard - indicates standard or modified LLDP
isReverse - indicates whether the LLDP was sent as a response

discoverOnAllPorts

protected void discoverOnAllPorts()
Send LLDPs to all switch-ports


getUpdateOperation

protected ILinkDiscovery.UpdateOperation getUpdateOperation(int srcPortState,
                                                            int dstPortState)

getUpdateOperation

protected ILinkDiscovery.UpdateOperation getUpdateOperation(int srcPortState)

isLinkAllowed

protected boolean isLinkAllowed(long src,
                                int srcPort,
                                long dst,
                                int dstPort)
This method is used to specifically ignore/consider specific links.


updateLink

protected boolean updateLink(Link lt,
                             LinkInfo oldInfo,
                             LinkInfo newInfo)

addOrUpdateLink

protected boolean addOrUpdateLink(Link lt,
                                  LinkInfo newInfo)

deleteLink

protected void deleteLink(Link link,
                          java.lang.String reason)
Delete a link

Parameters:
link - - link to be deleted.
reason - - reason why the link is deleted.

deleteLinks

protected void deleteLinks(java.util.List<Link> links,
                           java.lang.String reason)
Removes links from memory and storage.

Parameters:
links - The List of @LinkTuple to delete.

deleteLinks

protected void deleteLinks(java.util.List<Link> links,
                           java.lang.String reason,
                           java.util.List<ILinkDiscovery.LDUpdate> updateList)
Removes links from memory and storage.

Parameters:
links - The List of @LinkTuple to delete.

deleteLinksOnPort

protected void deleteLinksOnPort(NodePortTuple npt,
                                 java.lang.String reason)
Delete links incident on a given switch port.

Parameters:
npt -
reason -

timeoutLinks

protected void timeoutLinks()
Iterates through the list of links and deletes if the last discovery message reception time exceeds timeout values.


setControllerTLV

protected void setControllerTLV()

switchPortChanged

public void switchPortChanged(long switchId,
                              ImmutablePort port,
                              IOFSwitch.PortChangeType type)
We don't react the port changed notifications here. we listen for OFPortStatus messages directly. Might consider using this notifier instead

Specified by:
switchPortChanged in interface IOFSwitchListener

switchAdded

public void switchAdded(long switchId)
Description copied from interface: IOFSwitchListener
Fired when switch becomes known to the controller cluster. I.e., the switch is connected at some controller in the cluster

Specified by:
switchAdded in interface IOFSwitchListener
Parameters:
switchId - the datapath Id of the new switch

switchRemoved

public void switchRemoved(long sw)
Description copied from interface: IOFSwitchListener
Fired when a switch disconnects from the cluster ,

Specified by:
switchRemoved in interface IOFSwitchListener
Parameters:
sw - the datapath Id of the switch

switchActivated

public void switchActivated(long switchId)
Description copied from interface: IOFSwitchListener
Fired when a switch becomes active *on the local controller*, I.e., the switch is connected to the local controller and is in MASTER mode

Specified by:
switchActivated in interface IOFSwitchListener
Parameters:
switchId - the datapath Id of the switch

switchChanged

public void switchChanged(long switchId)
Description copied from interface: IOFSwitchListener
Fired when any non-port related information (e.g., attributes, features) change after a switchAdded TODO: currently unused

Specified by:
switchChanged in interface IOFSwitchListener

setStorageSource

public void setStorageSource(IStorageSourceService storageSource)
Sets the IStorageSource to use for Topology

Parameters:
storageSource - the storage source to use

getStorageSource

public IStorageSourceService getStorageSource()
Gets the storage source for this ITopology

Returns:
The IStorageSource ITopology is writing to

rowsModified

public void rowsModified(java.lang.String tableName,
                         java.util.Set<java.lang.Object> rowKeys)
Description copied from interface: IStorageSourceListener
Called when rows are inserted or updated in the table.

Specified by:
rowsModified in interface IStorageSourceListener
Parameters:
tableName - The table where the rows were inserted
rowKeys - The keys of the rows that were inserted

rowsDeleted

public void rowsDeleted(java.lang.String tableName,
                        java.util.Set<java.lang.Object> rowKeys)
Description copied from interface: IStorageSourceListener
Called when a new row is deleted from the table.

Specified by:
rowsDeleted in interface IStorageSourceListener
Parameters:
tableName - The table where the rows were deleted
rowKeys - The keys of the rows that were deleted

readTopologyConfigFromStorage

protected void readTopologyConfigFromStorage()

writeLinkToStorage

protected void writeLinkToStorage(Link lt,
                                  LinkInfo linkInfo)
Writes a LinkTuple and corresponding LinkInfo to storage

Parameters:
lt - The LinkTuple to write
linkInfo - The LinkInfo to write

removeLinkFromStorage

protected void removeLinkFromStorage(Link lt)
Removes a link from storage using an asynchronous call.

Parameters:
lt - The LinkTuple to delete.

readLinkValidTime

public java.lang.Long readLinkValidTime(Link lt)

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)
             throws FloodlightModuleException
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
Throws:
FloodlightModuleException

getInfo

public java.util.Map<java.lang.String,java.lang.Object> getInfo(java.lang.String type)
Description copied from interface: IInfoProvider
Called when rest API requests information of a particular type

Specified by:
getInfo in interface IInfoProvider
Returns: