net.floodlightcontroller.topology
Class TopologyInstance

java.lang.Object
  extended by net.floodlightcontroller.topology.TopologyInstance

public class TopologyInstance
extends java.lang.Object

A representation of a network topology. Used internally by TopologyManager


Nested Class Summary
protected  class TopologyInstance.NodeDist
           
protected  class TopologyInstance.PathCacheLoader
           
 
Field Summary
protected  java.util.Set<Link> blockedLinks
          Set of links that are blocked.
protected  java.util.Set<NodePortTuple> blockedPorts
          Set of switch ports that are marked as blocked.
protected  java.util.Set<NodePortTuple> broadcastDomainPorts
           
protected  java.util.Map<java.lang.Long,java.util.Set<NodePortTuple>> clusterBroadcastNodePorts
           
protected  java.util.Map<java.lang.Long,BroadcastTree> clusterBroadcastTrees
           
protected  java.util.Set<Cluster> clusters
           
protected  java.util.Map<java.lang.Long,BroadcastTree> destinationRootedTrees
           
protected static org.slf4j.Logger log
           
static int LT_BD_LINK
           
static int LT_SH_LINK
           
static int LT_TUNNEL
           
static int MAX_LINK_WEIGHT
           
static int MAX_PATH_WEIGHT
           
static int PATH_CACHE_SIZE
           
protected  com.google.common.cache.LoadingCache<RouteId,Route> pathcache
           
protected  java.util.Map<java.lang.Long,Cluster> switchClusterMap
           
protected  java.util.Set<java.lang.Long> switches
           
protected  java.util.Map<NodePortTuple,java.util.Set<Link>> switchPortLinks
           
protected  java.util.Map<java.lang.Long,java.util.Set<java.lang.Integer>> switchPorts
           
protected  java.util.Set<NodePortTuple> tunnelPorts
           
 
Constructor Summary
TopologyInstance()
           
TopologyInstance(java.util.Map<java.lang.Long,java.util.Set<java.lang.Integer>> switchPorts, java.util.Map<NodePortTuple,java.util.Set<Link>> switchPortLinks, java.util.Set<NodePortTuple> broadcastDomainPorts)
           
TopologyInstance(java.util.Map<java.lang.Long,java.util.Set<java.lang.Integer>> switchPorts, java.util.Set<NodePortTuple> blockedPorts, java.util.Map<NodePortTuple,java.util.Set<Link>> switchPortLinks, java.util.Set<NodePortTuple> broadcastDomainPorts, java.util.Set<NodePortTuple> tunnelPorts)
           
 
Method Summary
protected  void addLinksToOpenflowDomains()
           
protected  Route buildroute(RouteId id)
           
protected  void calculateBroadcastNodePortsInClusters()
           
protected  void calculateBroadcastTreeInClusters()
           
protected  void calculateShortestPathTreeInClusters()
           
 void compute()
           
protected  BroadcastTree dijkstra(Cluster c, java.lang.Long root, java.util.Map<Link,java.lang.Integer> linkCost, boolean isDstRooted)
           
 NodePortTuple getAllowedIncomingBroadcastPort(long src, int srcPort)
           
 NodePortTuple getAllowedOutgoingBroadcastPort(long src, int srcPort, long dst, int dstPort)
           
protected  java.util.Set<Link> getBlockedLinks()
           
 java.util.Set<NodePortTuple> getBlockedPorts()
           
protected  java.util.Set<NodePortTuple> getBroadcastNodePortsInCluster(long sw)
           
 java.util.Set<java.lang.Integer> getBroadcastPorts(long targetSw, long src, int srcPort)
           
protected  BroadcastTree getBroadcastTreeForCluster(long clusterId)
           
protected  java.util.Set<Cluster> getClusters()
           
protected  int getCost(long srcId, long dstId)
           
 NodePortTuple getIncomingSwitchPort(long src, int srcPort, long dst, int dstPort)
           
protected  long getL2DomainId(long switchId)
           
protected  long getOpenflowDomainId(long switchId)
           
 NodePortTuple getOutgoingSwitchPort(long src, int srcPort, long dst, int dstPort)
           
 java.util.Set<java.lang.Integer> getPortsWithLinks(long sw)
           
protected  Route getRoute(long srcId, long dstId, long cookie)
           
protected  Route getRoute(ServiceChain sc, long srcId, int srcPort, long dstId, int dstPort, long cookie)
           
 java.util.Set<java.lang.Long> getSwitches()
           
protected  java.util.Set<java.lang.Long> getSwitchesInOpenflowDomain(long switchId)
           
 void identifyOpenflowDomains()
           
 boolean inSameBroadcastDomain(long s1, int p1, long s2, int p2)
           
 boolean inSameL2Domain(long switch1, long switch2)
           
protected  boolean inSameOpenflowDomain(long switch1, long switch2)
           
 boolean isAllowed(long sw, int portId)
           
 boolean isAttachmentPointPort(long switchid, int port)
           
protected  boolean isBlockedLink(Link l)
          Returns true if a link has either one of its switch ports blocked.
protected  boolean isBlockedPort(NodePortTuple npt)
           
 boolean isBroadcastDomainLink(Link l)
           
 boolean isBroadcastDomainPort(NodePortTuple npt)
           
 boolean isConsistent(long oldSw, int oldPort, long newSw, int newPort)
           
protected  boolean isIncomingBroadcastAllowedOnSwitchPort(long sw, int portId)
           
protected  boolean isInternalToOpenflowDomain(long switchid, int port)
           
protected  boolean isTunnelLink(Link l)
           
protected  boolean isTunnelPort(NodePortTuple npt)
           
 void printTopology()
           
protected  boolean routeExists(long srcId, long dstId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LT_SH_LINK

public static final int LT_SH_LINK
See Also:
Constant Field Values

LT_BD_LINK

public static final int LT_BD_LINK
See Also:
Constant Field Values

LT_TUNNEL

public static final int LT_TUNNEL
See Also:
Constant Field Values

MAX_LINK_WEIGHT

public static final int MAX_LINK_WEIGHT
See Also:
Constant Field Values

MAX_PATH_WEIGHT

public static final int MAX_PATH_WEIGHT
See Also:
Constant Field Values

PATH_CACHE_SIZE

public static final int PATH_CACHE_SIZE
See Also:
Constant Field Values

log

protected static org.slf4j.Logger log

switchPorts

protected java.util.Map<java.lang.Long,java.util.Set<java.lang.Integer>> switchPorts

blockedPorts

protected java.util.Set<NodePortTuple> blockedPorts
Set of switch ports that are marked as blocked. A set of blocked switch ports may be provided at the time of instantiation. In addition, we may add additional ports to this set.


switchPortLinks

protected java.util.Map<NodePortTuple,java.util.Set<Link>> switchPortLinks

blockedLinks

protected java.util.Set<Link> blockedLinks
Set of links that are blocked.


switches

protected java.util.Set<java.lang.Long> switches

broadcastDomainPorts

protected java.util.Set<NodePortTuple> broadcastDomainPorts

tunnelPorts

protected java.util.Set<NodePortTuple> tunnelPorts

clusters

protected java.util.Set<Cluster> clusters

switchClusterMap

protected java.util.Map<java.lang.Long,Cluster> switchClusterMap

destinationRootedTrees

protected java.util.Map<java.lang.Long,BroadcastTree> destinationRootedTrees

clusterBroadcastNodePorts

protected java.util.Map<java.lang.Long,java.util.Set<NodePortTuple>> clusterBroadcastNodePorts

clusterBroadcastTrees

protected java.util.Map<java.lang.Long,BroadcastTree> clusterBroadcastTrees

pathcache

protected com.google.common.cache.LoadingCache<RouteId,Route> pathcache
Constructor Detail

TopologyInstance

public TopologyInstance()

TopologyInstance

public TopologyInstance(java.util.Map<java.lang.Long,java.util.Set<java.lang.Integer>> switchPorts,
                        java.util.Map<NodePortTuple,java.util.Set<Link>> switchPortLinks,
                        java.util.Set<NodePortTuple> broadcastDomainPorts)

TopologyInstance

public TopologyInstance(java.util.Map<java.lang.Long,java.util.Set<java.lang.Integer>> switchPorts,
                        java.util.Set<NodePortTuple> blockedPorts,
                        java.util.Map<NodePortTuple,java.util.Set<Link>> switchPortLinks,
                        java.util.Set<NodePortTuple> broadcastDomainPorts,
                        java.util.Set<NodePortTuple> tunnelPorts)
Method Detail

compute

public void compute()

printTopology

public void printTopology()

addLinksToOpenflowDomains

protected void addLinksToOpenflowDomains()

identifyOpenflowDomains

public void identifyOpenflowDomains()

getBlockedPorts

public java.util.Set<NodePortTuple> getBlockedPorts()

getBlockedLinks

protected java.util.Set<Link> getBlockedLinks()

isBlockedLink

protected boolean isBlockedLink(Link l)
Returns true if a link has either one of its switch ports blocked.

Parameters:
l -
Returns:

isBlockedPort

protected boolean isBlockedPort(NodePortTuple npt)

isTunnelPort

protected boolean isTunnelPort(NodePortTuple npt)

isTunnelLink

protected boolean isTunnelLink(Link l)

isBroadcastDomainLink

public boolean isBroadcastDomainLink(Link l)

isBroadcastDomainPort

public boolean isBroadcastDomainPort(NodePortTuple npt)

dijkstra

protected BroadcastTree dijkstra(Cluster c,
                                 java.lang.Long root,
                                 java.util.Map<Link,java.lang.Integer> linkCost,
                                 boolean isDstRooted)

calculateShortestPathTreeInClusters

protected void calculateShortestPathTreeInClusters()

calculateBroadcastTreeInClusters

protected void calculateBroadcastTreeInClusters()

calculateBroadcastNodePortsInClusters

protected void calculateBroadcastNodePortsInClusters()

buildroute

protected Route buildroute(RouteId id)

getCost

protected int getCost(long srcId,
                      long dstId)

getClusters

protected java.util.Set<Cluster> getClusters()

routeExists

protected boolean routeExists(long srcId,
                              long dstId)

getRoute

protected Route getRoute(ServiceChain sc,
                         long srcId,
                         int srcPort,
                         long dstId,
                         int dstPort,
                         long cookie)

getRoute

protected Route getRoute(long srcId,
                         long dstId,
                         long cookie)

getBroadcastTreeForCluster

protected BroadcastTree getBroadcastTreeForCluster(long clusterId)

isInternalToOpenflowDomain

protected boolean isInternalToOpenflowDomain(long switchid,
                                             int port)

isAttachmentPointPort

public boolean isAttachmentPointPort(long switchid,
                                     int port)

getOpenflowDomainId

protected long getOpenflowDomainId(long switchId)

getL2DomainId

protected long getL2DomainId(long switchId)

getSwitchesInOpenflowDomain

protected java.util.Set<java.lang.Long> getSwitchesInOpenflowDomain(long switchId)

inSameOpenflowDomain

protected boolean inSameOpenflowDomain(long switch1,
                                       long switch2)

isAllowed

public boolean isAllowed(long sw,
                         int portId)

isIncomingBroadcastAllowedOnSwitchPort

protected boolean isIncomingBroadcastAllowedOnSwitchPort(long sw,
                                                         int portId)

isConsistent

public boolean isConsistent(long oldSw,
                            int oldPort,
                            long newSw,
                            int newPort)

getBroadcastNodePortsInCluster

protected java.util.Set<NodePortTuple> getBroadcastNodePortsInCluster(long sw)

inSameBroadcastDomain

public boolean inSameBroadcastDomain(long s1,
                                     int p1,
                                     long s2,
                                     int p2)

inSameL2Domain

public boolean inSameL2Domain(long switch1,
                              long switch2)

getOutgoingSwitchPort

public NodePortTuple getOutgoingSwitchPort(long src,
                                           int srcPort,
                                           long dst,
                                           int dstPort)

getIncomingSwitchPort

public NodePortTuple getIncomingSwitchPort(long src,
                                           int srcPort,
                                           long dst,
                                           int dstPort)

getSwitches

public java.util.Set<java.lang.Long> getSwitches()

getPortsWithLinks

public java.util.Set<java.lang.Integer> getPortsWithLinks(long sw)

getBroadcastPorts

public java.util.Set<java.lang.Integer> getBroadcastPorts(long targetSw,
                                                          long src,
                                                          int srcPort)

getAllowedOutgoingBroadcastPort

public NodePortTuple getAllowedOutgoingBroadcastPort(long src,
                                                     int srcPort,
                                                     long dst,
                                                     int dstPort)

getAllowedIncomingBroadcastPort

public NodePortTuple getAllowedIncomingBroadcastPort(long src,
                                                     int srcPort)