net.floodlightcontroller.topology
Class TopologyManager

java.lang.Object
  extended by net.floodlightcontroller.topology.TopologyManager
All Implemented Interfaces:
IListener<OFType>, IOFMessageListener, IFloodlightModule, IFloodlightService, ILinkDiscovery, ILinkDiscoveryListener, IRoutingService, ITopologyService

public class TopologyManager
extends java.lang.Object
implements IFloodlightModule, ITopologyService, IRoutingService, ILinkDiscoveryListener, IOFMessageListener

Topology manager is responsible for maintaining the controller's notion of the network graph, as well as implementing tools for finding routes through the topology.


Nested Class Summary
protected  class TopologyManager.TopologyEvent
          Topology Event class to track topology related events
protected  class TopologyManager.TopologyEventInfo
          Topology Information exposed for a Topology related event - used inside the BigTopologyEvent class
protected  class TopologyManager.UpdateTopologyWorker
          Thread for recomputing topology.
 
Nested classes/interfaces inherited from interface net.floodlightcontroller.linkdiscovery.ILinkDiscovery
ILinkDiscovery.LDUpdate, ILinkDiscovery.LinkDirection, ILinkDiscovery.LinkType, ILinkDiscovery.SwitchType, ILinkDiscovery.UpdateOperation
 
Nested classes/interfaces inherited from interface net.floodlightcontroller.core.IListener
IListener.Command
 
Field Summary
static java.lang.String CONTEXT_TUNNEL_ENABLED
           
protected  IDebugCounter ctrIncoming
           
protected  TopologyInstance currentInstance
           
protected  TopologyInstance currentInstanceWithoutTunnels
           
protected  IDebugCounterService debugCounters
           
protected  IDebugEventService debugEvents
          Debug Events
protected  java.util.Map<NodePortTuple,java.util.Set<Link>> directLinks
          Set of direct links
protected  boolean dtLinksUpdated
          Flag that indicates if direct or tunnel links were updated as part of LDUpdate.
protected  IEventUpdater<TopologyManager.TopologyEvent> evTopology
           
protected  IFloodlightProviderService floodlightProvider
           
protected  java.util.concurrent.BlockingQueue<ILinkDiscovery.LDUpdate> ldUpdates
           
protected  ILinkDiscoveryService linkDiscovery
           
protected  boolean linksUpdated
          Flag that indicates if links (direct/tunnel/multihop links) were updated as part of LDUpdate.
protected static org.slf4j.Logger log
           
static java.lang.String MODULE_NAME
           
protected  SingletonTask newInstanceTask
           
protected static java.lang.String PACKAGE
          Debug Counters
protected  java.util.Map<NodePortTuple,java.util.Set<Link>> portBroadcastDomainLinks
          set of links that are broadcast domain links.
protected  IRestApiService restApi
           
protected  java.util.Map<NodePortTuple,java.util.Set<Link>> switchPortLinks
          Set of links organized by node port tuple
protected  java.util.Map<java.lang.Long,java.util.Set<java.lang.Integer>> switchPorts
          Set of ports for each switch
protected  IThreadPoolService threadPool
           
protected  int TOPOLOGY_COMPUTE_INTERVAL_MS
           
protected  java.util.ArrayList<ITopologyListener> topologyAware
           
protected  java.util.Set<NodePortTuple> tunnelPorts
          set of tunnel links
protected  boolean tunnelPortsUpdated
          Flag that indicates if tunnel ports were updated or not
 
Constructor Summary
TopologyManager()
           
 
Method Summary
 void addListener(ITopologyListener listener)
           
 void addOrUpdateLink(long srcId, int srcPort, long dstId, int dstPort, ILinkDiscovery.LinkType type)
           
protected  void addOrUpdateSwitch(long sw)
           
protected  void addOrUpdateTunnelLink(long srcId, int srcPort, long dstId, int dstPort)
           
protected  void addRestletRoutable()
           
 void addSwitch(long sid)
           
 void addTunnelPort(long sw, int port)
           
 java.util.List<ILinkDiscovery.LDUpdate> applyUpdates()
          Updates concerning switch disconnect and port down are not processed.
 void clear()
           
 void clearCurrentTopology()
          Clears the current topology.
 boolean createNewInstance()
           
protected  boolean createNewInstance(java.lang.String reason)
          This function computes a new topology instance.
protected  void doFloodBDDP(long pinSwitch, OFPacketIn pi, FloodlightContext cntx)
          The BDDP packets are forwarded out of all the ports out of an openflowdomain.
 void doMultiActionPacketOut(byte[] packetData, IOFSwitch sw, java.util.Set<java.lang.Integer> ports, FloodlightContext cntx)
          TODO This method must be moved to a layer below forwarding so that anyone can use it.
protected  IListener.Command dropFilter(long sw, OFPacketIn pi, FloodlightContext cntx)
          If the packet-in switch port is disabled for all data traffic, then the packet will be dropped.
 NodePortTuple getAllowedIncomingBroadcastPort(long src, int srcPort)
          If the src broadcast domain port is not allowed for incoming broadcast, this method provides the topologically equivalent incoming broadcast-allowed src port.
 NodePortTuple getAllowedIncomingBroadcastPort(long src, int srcPort, boolean tunnelEnabled)
           
 NodePortTuple getAllowedOutgoingBroadcastPort(long src, int srcPort, long dst, int dstPort)
          If the dst is not allowed by the higher-level topology, this method provides the topologically equivalent broadcast port.
 NodePortTuple getAllowedOutgoingBroadcastPort(long src, int srcPort, long dst, int dstPort, boolean tunnelEnabled)
           
 java.util.Set<NodePortTuple> getBlockedPorts()
          Returns a set of blocked ports.
 java.util.Set<NodePortTuple> getBroadcastDomainPorts()
          Gets the set of ports that belong to a broadcast domain.
 java.util.Set<java.lang.Integer> getBroadcastPorts(long targetSw, long src, int srcPort)
          Get all the ports on the target switch (targetSw) on which a broadcast packet must be sent from a host whose attachment point is on switch port (src, srcPort).
 java.util.Set<java.lang.Integer> getBroadcastPorts(long targetSw, long src, int srcPort, boolean tunnelEnabled)
          Get all the ports on the target switch (targetSw) on which a broadcast packet must be sent from a host whose attachment point is on switch port (src, srcPort).
 TopologyInstance getCurrentInstance()
           
 TopologyInstance getCurrentInstance(boolean tunnelEnabled)
           
 NodePortTuple getIncomingSwitchPort(long src, int srcPort, long dst, int dstPort)
           
 NodePortTuple getIncomingSwitchPort(long src, int srcPort, long dst, int dstPort, boolean tunnelEnabled)
           
 long getL2DomainId(long switchId)
          Returns the identifier of the L2 domain of a given switch.
 long getL2DomainId(long switchId, boolean tunnelEnabled)
           
 java.util.Date getLastUpdateTime()
           
 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
 long getOpenflowDomainId(long switchId)
           
 long getOpenflowDomainId(long switchId, boolean tunnelEnabled)
           
 NodePortTuple getOutgoingSwitchPort(long src, int srcPort, long dst, int dstPort)
          Get the proper outgoing switchport for a given pair of src-dst switchports.
 NodePortTuple getOutgoingSwitchPort(long src, int srcPort, long dst, int dstPort, boolean tunnelEnabled)
           
 java.util.Map<NodePortTuple,java.util.Set<Link>> getPortBroadcastDomainLinks()
           
 java.util.Set<java.lang.Integer> getPorts(long sw)
          Switch methods
protected  java.util.Set<java.lang.Integer> getPortsToEliminateForBDDP(long sid)
          Get the set of ports to eliminate for sending out BDDP.
 java.util.Set<java.lang.Integer> getPortsWithLinks(long sw)
          Get all the ports connected to the switch
 java.util.Set<java.lang.Integer> getPortsWithLinks(long sw, boolean tunnelEnabled)
          Get all the ports connected to the switch
 Route getRoute(long src, int srcPort, long dst, int dstPort, long cookie)
          Provides a route between srcPort on src and dstPort on dst.
 Route getRoute(long src, int srcPort, long dst, int dstPort, long cookie, boolean tunnelEnabled)
          Provides a route between srcPort on src and dstPort on dst.
 Route getRoute(long src, long dst, long cookie)
          Provides a route between src and dst that allows tunnels.
 Route getRoute(long src, long dst, long cookie, boolean tunnelEnabled)
          Provides a route between src and dst, with option to allow or not allow tunnels in the path.
 java.util.ArrayList<Route> getRoutes(long srcDpid, long dstDpid, boolean tunnelEnabled)
          return all routes, if available
 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.
 java.util.Set<java.lang.Long> getSwitchesInOpenflowDomain(long switchDPID)
           
 java.util.Set<java.lang.Long> getSwitchesInOpenflowDomain(long switchDPID, boolean tunnelEnabled)
           
 java.util.Map<NodePortTuple,java.util.Set<Link>> getSwitchPortLinks()
           
 java.util.Map<java.lang.Long,java.util.Set<java.lang.Integer>> getSwitchPorts()
          Getters.
 int getTopologyComputeInterval()
          Get the time interval for the period topology updates, if any.
 java.util.Set<NodePortTuple> getTunnelPorts()
           
protected  void handleMiscellaneousPeriodicEvents()
           
protected  java.util.Set<NodePortTuple> identifyBroadcastDomainPorts()
          We expect every switch port to have at most two links.
 void informListeners(java.util.List<ILinkDiscovery.LDUpdate> linkUpdates)
           
 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 inSameL2Domain(long switch1, long switch2)
          Checks if the two switches are in the same Layer 2 domain.
 boolean inSameL2Domain(long switch1, long switch2, boolean tunnelEnabled)
           
 boolean inSameOpenflowDomain(long switch1, long switch2)
          Queries whether two switches are in the same cluster.
 boolean inSameOpenflowDomain(long switch1, long switch2, boolean tunnelEnabled)
           
 boolean isAllowed(long sw, int portId)
           
 boolean isAllowed(long sw, int portId, boolean tunnelEnabled)
           
 boolean isAttachmentPointPort(long switchid, int port)
          Query to determine if devices must be learned on a given switch port.
 boolean isAttachmentPointPort(long switchid, int port, boolean tunnelEnabled)
           
 boolean isBroadcastDomainPort(long sw, int port)
          Checks if the switchport is a broadcast domain port or not.
 boolean isBroadcastDomainPort(long sw, int port, boolean tunnelEnabled)
           
 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.
 boolean isConsistent(long oldSw, int oldPort, long newSw, int newPort)
          Checks if the new attachment point port is consistent with the old attachment point port.
 boolean isConsistent(long oldSw, int oldPort, long newSw, int newPort, boolean tunnelEnabled)
           
 boolean isIncomingBroadcastAllowed(long sw, int portId)
           
 boolean isIncomingBroadcastAllowed(long sw, int portId, boolean tunnelEnabled)
           
 boolean isInSameBroadcastDomain(long s1, int p1, long s2, int p2)
          Checks if the two switchports belong to the same broadcast domain.
 boolean isInSameBroadcastDomain(long s1, int p1, long s2, int p2, boolean tunnelEnabled)
           
 void linkDiscoveryUpdate(ILinkDiscovery.LDUpdate update)
           
 void linkDiscoveryUpdate(java.util.List<ILinkDiscovery.LDUpdate> updateList)
           
protected  IListener.Command processPacketInMessage(IOFSwitch sw, OFPacketIn pi, FloodlightContext cntx)
           
 IListener.Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx)
          This is the method Floodlight uses to call listeners with OpenFlow messages
protected  void registerTopologyDebugEvents()
           
 void removeLink(Link link)
           
 void removeLink(long srcId, int srcPort, long dstId, int dstPort)
           
 void removeSwitch(long sid)
           
 void removeTunnelPort(long sw, int port)
           
 boolean routeExists(long src, long dst)
          Check if a route exists between src and dst, including tunnel links in the path.
 boolean routeExists(long src, long dst, boolean tunnelEnabled)
          Check if a route exists between src and dst, with option to have or not have tunnels as part of the path.
 void setTopologyComputeInterval(int time_ms)
          Set the time interval for the period topology updates, if any.
 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.
 boolean updateTopology()
           
 
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

MODULE_NAME

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

CONTEXT_TUNNEL_ENABLED

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

switchPorts

protected java.util.Map<java.lang.Long,java.util.Set<java.lang.Integer>> switchPorts
Set of ports for each switch


switchPortLinks

protected java.util.Map<NodePortTuple,java.util.Set<Link>> switchPortLinks
Set of links organized by node port tuple


directLinks

protected java.util.Map<NodePortTuple,java.util.Set<Link>> directLinks
Set of direct links


portBroadcastDomainLinks

protected java.util.Map<NodePortTuple,java.util.Set<Link>> portBroadcastDomainLinks
set of links that are broadcast domain links.


tunnelPorts

protected java.util.Set<NodePortTuple> tunnelPorts
set of tunnel links


linkDiscovery

protected ILinkDiscoveryService linkDiscovery

threadPool

protected IThreadPoolService threadPool

floodlightProvider

protected IFloodlightProviderService floodlightProvider

restApi

protected IRestApiService restApi

debugCounters

protected IDebugCounterService debugCounters

topologyAware

protected java.util.ArrayList<ITopologyListener> topologyAware

ldUpdates

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

currentInstance

protected TopologyInstance currentInstance

currentInstanceWithoutTunnels

protected TopologyInstance currentInstanceWithoutTunnels

newInstanceTask

protected SingletonTask newInstanceTask

linksUpdated

protected boolean linksUpdated
Flag that indicates if links (direct/tunnel/multihop links) were updated as part of LDUpdate.


dtLinksUpdated

protected boolean dtLinksUpdated
Flag that indicates if direct or tunnel links were updated as part of LDUpdate.


tunnelPortsUpdated

protected boolean tunnelPortsUpdated
Flag that indicates if tunnel ports were updated or not


TOPOLOGY_COMPUTE_INTERVAL_MS

protected int TOPOLOGY_COMPUTE_INTERVAL_MS

PACKAGE

protected static final java.lang.String PACKAGE
Debug Counters


ctrIncoming

protected IDebugCounter ctrIncoming

debugEvents

protected IDebugEventService debugEvents
Debug Events


evTopology

protected IEventUpdater<TopologyManager.TopologyEvent> evTopology
Constructor Detail

TopologyManager

public TopologyManager()
Method Detail

getTopologyComputeInterval

public int getTopologyComputeInterval()
Get the time interval for the period topology updates, if any. The time returned is in milliseconds.

Returns:

setTopologyComputeInterval

public void setTopologyComputeInterval(int time_ms)
Set the time interval for the period topology updates, if any. The time is in milliseconds.


handleMiscellaneousPeriodicEvents

protected void handleMiscellaneousPeriodicEvents()

updateTopology

public boolean updateTopology()

linkDiscoveryUpdate

public void linkDiscoveryUpdate(java.util.List<ILinkDiscovery.LDUpdate> updateList)
Specified by:
linkDiscoveryUpdate in interface ILinkDiscoveryListener

linkDiscoveryUpdate

public void linkDiscoveryUpdate(ILinkDiscovery.LDUpdate update)
Specified by:
linkDiscoveryUpdate in interface ILinkDiscoveryListener

getLastUpdateTime

public java.util.Date getLastUpdateTime()
Specified by:
getLastUpdateTime in interface ITopologyService

addListener

public void addListener(ITopologyListener listener)
Specified by:
addListener in interface ITopologyService

isAttachmentPointPort

public boolean isAttachmentPointPort(long switchid,
                                     int port)
Description copied from interface: ITopologyService
Query to determine if devices must be learned on a given switch port.

Specified by:
isAttachmentPointPort in interface ITopologyService

isAttachmentPointPort

public boolean isAttachmentPointPort(long switchid,
                                     int port,
                                     boolean tunnelEnabled)
Specified by:
isAttachmentPointPort in interface ITopologyService

getOpenflowDomainId

public long getOpenflowDomainId(long switchId)
Specified by:
getOpenflowDomainId in interface ITopologyService

getOpenflowDomainId

public long getOpenflowDomainId(long switchId,
                                boolean tunnelEnabled)
Specified by:
getOpenflowDomainId in interface ITopologyService

getL2DomainId

public long getL2DomainId(long switchId)
Description copied from interface: ITopologyService
Returns the identifier of the L2 domain of a given switch.

Specified by:
getL2DomainId in interface ITopologyService
Parameters:
switchId - The DPID of the switch in long form
Returns:
The DPID of the switch that is the key for the cluster

getL2DomainId

public long getL2DomainId(long switchId,
                          boolean tunnelEnabled)
Specified by:
getL2DomainId in interface ITopologyService

inSameOpenflowDomain

public boolean inSameOpenflowDomain(long switch1,
                                    long switch2)
Description copied from interface: ITopologyService
Queries whether two switches are in the same cluster.

Specified by:
inSameOpenflowDomain in interface ITopologyService
Returns:
true if the switches are in the same cluster

inSameOpenflowDomain

public boolean inSameOpenflowDomain(long switch1,
                                    long switch2,
                                    boolean tunnelEnabled)
Specified by:
inSameOpenflowDomain in interface ITopologyService

isAllowed

public boolean isAllowed(long sw,
                         int portId)
Specified by:
isAllowed in interface ITopologyService

isAllowed

public boolean isAllowed(long sw,
                         int portId,
                         boolean tunnelEnabled)
Specified by:
isAllowed in interface ITopologyService

isIncomingBroadcastAllowed

public boolean isIncomingBroadcastAllowed(long sw,
                                          int portId)
Specified by:
isIncomingBroadcastAllowed in interface ITopologyService

isIncomingBroadcastAllowed

public boolean isIncomingBroadcastAllowed(long sw,
                                          int portId,
                                          boolean tunnelEnabled)
Specified by:
isIncomingBroadcastAllowed in interface ITopologyService

getPortsWithLinks

public java.util.Set<java.lang.Integer> getPortsWithLinks(long sw)
Get all the ports connected to the switch

Specified by:
getPortsWithLinks in interface ITopologyService
Parameters:
sw - The switch DPID in long
Returns:
The set of ports on this switch

getPortsWithLinks

public java.util.Set<java.lang.Integer> getPortsWithLinks(long sw,
                                                          boolean tunnelEnabled)
Get all the ports connected to the switch

Specified by:
getPortsWithLinks in interface ITopologyService

getBroadcastPorts

public java.util.Set<java.lang.Integer> getBroadcastPorts(long targetSw,
                                                          long src,
                                                          int srcPort)
Get all the ports on the target switch (targetSw) on which a broadcast packet must be sent from a host whose attachment point is on switch port (src, srcPort).

Specified by:
getBroadcastPorts in interface ITopologyService

getBroadcastPorts

public java.util.Set<java.lang.Integer> getBroadcastPorts(long targetSw,
                                                          long src,
                                                          int srcPort,
                                                          boolean tunnelEnabled)
Get all the ports on the target switch (targetSw) on which a broadcast packet must be sent from a host whose attachment point is on switch port (src, srcPort).

Specified by:
getBroadcastPorts in interface ITopologyService

getOutgoingSwitchPort

public NodePortTuple getOutgoingSwitchPort(long src,
                                           int srcPort,
                                           long dst,
                                           int dstPort)
Description copied from interface: ITopologyService
Get the proper outgoing switchport for a given pair of src-dst switchports.

Specified by:
getOutgoingSwitchPort in interface ITopologyService

getOutgoingSwitchPort

public NodePortTuple getOutgoingSwitchPort(long src,
                                           int srcPort,
                                           long dst,
                                           int dstPort,
                                           boolean tunnelEnabled)
Specified by:
getOutgoingSwitchPort in interface ITopologyService

getIncomingSwitchPort

public NodePortTuple getIncomingSwitchPort(long src,
                                           int srcPort,
                                           long dst,
                                           int dstPort)
Specified by:
getIncomingSwitchPort in interface ITopologyService

getIncomingSwitchPort

public NodePortTuple getIncomingSwitchPort(long src,
                                           int srcPort,
                                           long dst,
                                           int dstPort,
                                           boolean tunnelEnabled)
Specified by:
getIncomingSwitchPort in interface ITopologyService

isInSameBroadcastDomain

public boolean isInSameBroadcastDomain(long s1,
                                       int p1,
                                       long s2,
                                       int p2)
Checks if the two switchports belong to the same broadcast domain.

Specified by:
isInSameBroadcastDomain in interface ITopologyService
Returns:

isInSameBroadcastDomain

public boolean isInSameBroadcastDomain(long s1,
                                       int p1,
                                       long s2,
                                       int p2,
                                       boolean tunnelEnabled)
Specified by:
isInSameBroadcastDomain in interface ITopologyService

isBroadcastDomainPort

public boolean isBroadcastDomainPort(long sw,
                                     int port)
Checks if the switchport is a broadcast domain port or not.

Specified by:
isBroadcastDomainPort in interface ITopologyService

isBroadcastDomainPort

public boolean isBroadcastDomainPort(long sw,
                                     int port,
                                     boolean tunnelEnabled)
Specified by:
isBroadcastDomainPort in interface ITopologyService

isConsistent

public boolean isConsistent(long oldSw,
                            int oldPort,
                            long newSw,
                            int newPort)
Checks if the new attachment point port is consistent with the old attachment point port.

Specified by:
isConsistent in interface ITopologyService

isConsistent

public boolean isConsistent(long oldSw,
                            int oldPort,
                            long newSw,
                            int newPort,
                            boolean tunnelEnabled)
Specified by:
isConsistent in interface ITopologyService

inSameL2Domain

public boolean inSameL2Domain(long switch1,
                              long switch2)
Checks if the two switches are in the same Layer 2 domain.

Specified by:
inSameL2Domain in interface ITopologyService
Returns:
True of they are in the same island, false otherwise

inSameL2Domain

public boolean inSameL2Domain(long switch1,
                              long switch2,
                              boolean tunnelEnabled)
Specified by:
inSameL2Domain in interface ITopologyService

getAllowedOutgoingBroadcastPort

public NodePortTuple getAllowedOutgoingBroadcastPort(long src,
                                                     int srcPort,
                                                     long dst,
                                                     int dstPort)
Description copied from interface: ITopologyService
If the dst is not allowed by the higher-level topology, this method provides the topologically equivalent broadcast port.

Specified by:
getAllowedOutgoingBroadcastPort in interface ITopologyService
Returns:
the allowed broadcast port

getAllowedOutgoingBroadcastPort

public NodePortTuple getAllowedOutgoingBroadcastPort(long src,
                                                     int srcPort,
                                                     long dst,
                                                     int dstPort,
                                                     boolean tunnelEnabled)
Specified by:
getAllowedOutgoingBroadcastPort in interface ITopologyService

getAllowedIncomingBroadcastPort

public NodePortTuple getAllowedIncomingBroadcastPort(long src,
                                                     int srcPort)
Description copied from interface: ITopologyService
If the src broadcast domain port is not allowed for incoming broadcast, this method provides the topologically equivalent incoming broadcast-allowed src port.

Specified by:
getAllowedIncomingBroadcastPort in interface ITopologyService
Returns:
the allowed broadcast port

getAllowedIncomingBroadcastPort

public NodePortTuple getAllowedIncomingBroadcastPort(long src,
                                                     int srcPort,
                                                     boolean tunnelEnabled)
Specified by:
getAllowedIncomingBroadcastPort in interface ITopologyService

getSwitchesInOpenflowDomain

public java.util.Set<java.lang.Long> getSwitchesInOpenflowDomain(long switchDPID)
Specified by:
getSwitchesInOpenflowDomain in interface ITopologyService

getSwitchesInOpenflowDomain

public java.util.Set<java.lang.Long> getSwitchesInOpenflowDomain(long switchDPID,
                                                                 boolean tunnelEnabled)
Specified by:
getSwitchesInOpenflowDomain in interface ITopologyService

getBroadcastDomainPorts

public java.util.Set<NodePortTuple> getBroadcastDomainPorts()
Description copied from interface: ITopologyService
Gets the set of ports that belong to a broadcast domain.

Specified by:
getBroadcastDomainPorts in interface ITopologyService
Returns:
The set of ports that belong to a broadcast domain.

getTunnelPorts

public java.util.Set<NodePortTuple> getTunnelPorts()
Specified by:
getTunnelPorts in interface ITopologyService

getBlockedPorts

public java.util.Set<NodePortTuple> getBlockedPorts()
Description copied from interface: ITopologyService
Returns a set of blocked ports. The set of blocked ports is the union of all the blocked ports across all instances.

Specified by:
getBlockedPorts in interface ITopologyService
Returns:

getRoute

public Route getRoute(long src,
                      long dst,
                      long cookie)
Description copied from interface: IRoutingService
Provides a route between src and dst that allows tunnels. The cookie is provisioned for callers of getRoute to provide additional information to influence the route to be returned, if the underlying routing implementation supports choice among multiple routes.

Specified by:
getRoute in interface IRoutingService
Parameters:
src - Source switch DPID.
dst - Destination switch DPID.
cookie - cookie (usage determined by implementation; ignored by topology instance now).

getRoute

public Route getRoute(long src,
                      long dst,
                      long cookie,
                      boolean tunnelEnabled)
Description copied from interface: IRoutingService
Provides a route between src and dst, with option to allow or not allow tunnels in the path.

Specified by:
getRoute in interface IRoutingService
Parameters:
src - Source switch DPID.
dst - Destination switch DPID.
cookie - cookie (usage determined by implementation; ignored by topology instance now).
tunnelEnabled - boolean option.

getRoute

public Route getRoute(long src,
                      int srcPort,
                      long dst,
                      int dstPort,
                      long cookie)
Description copied from interface: IRoutingService
Provides a route between srcPort on src and dstPort on dst.

Specified by:
getRoute in interface IRoutingService
srcPort - Source port on source switch.
dstPort - dstPort on Destination switch.
cookie - cookie (usage determined by implementation; ignored by topology instance now).

getRoute

public Route getRoute(long src,
                      int srcPort,
                      long dst,
                      int dstPort,
                      long cookie,
                      boolean tunnelEnabled)
Description copied from interface: IRoutingService
Provides a route between srcPort on src and dstPort on dst.

Specified by:
getRoute in interface IRoutingService
srcPort - Source port on source switch.
dstPort - dstPort on Destination switch.
cookie - cookie (usage determined by implementation; ignored by topology instance now).
tunnelEnabled - boolean option.

routeExists

public boolean routeExists(long src,
                           long dst)
Description copied from interface: IRoutingService
Check if a route exists between src and dst, including tunnel links in the path.

Specified by:
routeExists in interface IRoutingService

routeExists

public boolean routeExists(long src,
                           long dst,
                           boolean tunnelEnabled)
Description copied from interface: IRoutingService
Check if a route exists between src and dst, with option to have or not have tunnels as part of the path.

Specified by:
routeExists in interface IRoutingService

getRoutes

public java.util.ArrayList<Route> getRoutes(long srcDpid,
                                            long dstDpid,
                                            boolean tunnelEnabled)
Description copied from interface: IRoutingService
return all routes, if available

Specified by:
getRoutes in interface IRoutingService

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.

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

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

registerTopologyDebugEvents

protected void registerTopologyDebugEvents()
                                    throws FloodlightModuleException
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

addRestletRoutable

protected void addRestletRoutable()

dropFilter

protected IListener.Command dropFilter(long sw,
                                       OFPacketIn pi,
                                       FloodlightContext cntx)
If the packet-in switch port is disabled for all data traffic, then the packet will be dropped. Otherwise, the packet will follow the normal processing chain.

Parameters:
sw -
pi -
cntx -
Returns:

doMultiActionPacketOut

public void doMultiActionPacketOut(byte[] packetData,
                                   IOFSwitch sw,
                                   java.util.Set<java.lang.Integer> ports,
                                   FloodlightContext cntx)
TODO This method must be moved to a layer below forwarding so that anyone can use it.

Parameters:
packetData -
sw -
ports -
cntx -

getPortsToEliminateForBDDP

protected java.util.Set<java.lang.Integer> getPortsToEliminateForBDDP(long sid)
Get the set of ports to eliminate for sending out BDDP. The method returns all the ports that are suppressed for link discovery on the switch. packets.

Parameters:
sid -
Returns:

doFloodBDDP

protected void doFloodBDDP(long pinSwitch,
                           OFPacketIn pi,
                           FloodlightContext cntx)
The BDDP packets are forwarded out of all the ports out of an openflowdomain. Get all the switches in the same openflow domain as the sw (disabling tunnels). Then get all the external switch ports and send these packets out.

Parameters:
sw -
pi -
cntx -

processPacketInMessage

protected IListener.Command processPacketInMessage(IOFSwitch sw,
                                                   OFPacketIn pi,
                                                   FloodlightContext cntx)

applyUpdates

public java.util.List<ILinkDiscovery.LDUpdate> applyUpdates()
Updates concerning switch disconnect and port down are not processed. LinkDiscoveryManager is expected to process those messages and send multiple link removed messages. However, all the updates from LinkDiscoveryManager would be propagated to the listeners of topology.


addOrUpdateSwitch

protected void addOrUpdateSwitch(long sw)

addTunnelPort

public void addTunnelPort(long sw,
                          int port)

removeTunnelPort

public void removeTunnelPort(long sw,
                             int port)

createNewInstance

public boolean createNewInstance()

createNewInstance

protected boolean createNewInstance(java.lang.String reason)
This function computes a new topology instance. It ignores links connected to all broadcast domain ports and tunnel ports. The method returns if a new instance of topology was created or not.


identifyBroadcastDomainPorts

protected java.util.Set<NodePortTuple> identifyBroadcastDomainPorts()
We expect every switch port to have at most two links. Both these links must be unidirectional links connecting to the same switch port. If not, we will mark this as a broadcast domain port.


informListeners

public void informListeners(java.util.List<ILinkDiscovery.LDUpdate> linkUpdates)

addSwitch

public void addSwitch(long sid)

removeSwitch

public void removeSwitch(long sid)

addOrUpdateTunnelLink

protected void addOrUpdateTunnelLink(long srcId,
                                     int srcPort,
                                     long dstId,
                                     int dstPort)

addOrUpdateLink

public void addOrUpdateLink(long srcId,
                            int srcPort,
                            long dstId,
                            int dstPort,
                            ILinkDiscovery.LinkType type)

removeLink

public void removeLink(Link link)

removeLink

public void removeLink(long srcId,
                       int srcPort,
                       long dstId,
                       int dstPort)

clear

public void clear()

clearCurrentTopology

public void clearCurrentTopology()
Clears the current topology. Note that this does NOT send out updates.


getSwitchPorts

public java.util.Map<java.lang.Long,java.util.Set<java.lang.Integer>> getSwitchPorts()
Getters. No Setters.


getSwitchPortLinks

public java.util.Map<NodePortTuple,java.util.Set<Link>> getSwitchPortLinks()

getPortBroadcastDomainLinks

public java.util.Map<NodePortTuple,java.util.Set<Link>> getPortBroadcastDomainLinks()

getCurrentInstance

public TopologyInstance getCurrentInstance(boolean tunnelEnabled)

getCurrentInstance

public TopologyInstance getCurrentInstance()

getPorts

public java.util.Set<java.lang.Integer> getPorts(long sw)
Switch methods

Specified by:
getPorts in interface ITopologyService