public class OFMTopologyManager extends OFModule implements ITopologyService, ILinkDiscoveryListener, IRoutingService
ILinkDiscoveryListener.LDUpdate, ILinkDiscoveryListener.UpdateOperation
Modifier and Type | Field and Description |
---|---|
protected java.util.List<ILinkDiscoveryListener.LDUpdate> |
appliedUpdates |
protected TopologyInstance |
currentInstance |
protected TopologyInstance |
currentInstanceWithoutTunnels |
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.
|
private java.util.Date |
lastUpdateTime |
protected java.util.concurrent.BlockingQueue<ILinkDiscoveryListener.LDUpdate> |
ldUpdates |
protected ILinkDiscoveryService |
linkDiscovery |
protected boolean |
linksUpdated
Flag that indicates if links (direct/tunnel/multihop links) were
updated as part of LDUpdate.
|
protected java.util.Map<NodePortTuple,java.util.Set<Link>> |
portBroadcastDomainLinks
set of links that are broadcast domain links.
|
private OFProtocol |
protocol |
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 java.util.ArrayList<ITopologyListener> |
topologyAware |
private Topology |
topologyModel |
protected java.util.Map<NodePortTuple,java.util.Set<Link>> |
tunnelLinks
set of tunnel links
|
controller
Constructor and Description |
---|
OFMTopologyManager() |
Modifier and Type | Method and Description |
---|---|
private boolean |
addLinkToStructure(java.util.Map<NodePortTuple,java.util.Set<Link>> s,
Link l)
Add the given link to the data structure.
|
void |
addListener(ITopologyListener listener) |
void |
addOrUpdateLink(long srcId,
int srcPort,
long dstId,
int dstPort,
ILinkDiscovery.LinkType type) |
private void |
addPortToSwitch(long s,
int p) |
void |
addSwitch(long sid) |
void |
applyUpdates()
Updates concerning switch disconnect and port down are not processed.
|
void |
clear() |
void |
clearCurrentTopology()
Clears the current topology.
|
protected boolean |
createNewInstance()
This function computes a new topology instance.
|
protected void |
doFloodBDDP(long pinSwitch,
org.openflow.protocol.interfaces.OFPacketIn pi)
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)
TODO This method must be moved to a layer below forwarding
so that anyone can use it.
|
protected boolean |
dropFilter(long sw,
org.openflow.protocol.interfaces.OFPacketIn pi)
If the packet-in switch port is disabled for all data traffic, then
the packet will be dropped.
|
NodePortTuple |
getAllowedIncomingBroadcastPort(long src,
short 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,
short srcPort,
boolean tunnelEnabled) |
NodePortTuple |
getAllowedOutgoingBroadcastPort(long src,
short srcPort,
long dst,
short dstPort)
If the dst is not allowed by the higher-level topology,
this method provides the topologically equivalent broadcast port.
|
NodePortTuple |
getAllowedOutgoingBroadcastPort(long src,
short srcPort,
long dst,
short 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.Short> |
getBroadcastPorts(long targetSw,
long src,
short srcPort)
Get broadcast ports on a target switch for a given attachmentpoint
point port.
|
java.util.Set<java.lang.Short> |
getBroadcastPorts(long targetSw,
long src,
short srcPort,
boolean tunnelEnabled) |
TopologyInstance |
getCurrentInstance() |
TopologyInstance |
getCurrentInstance(boolean tunnelEnabled) |
NodePortTuple |
getIncomingSwitchPort(long src,
short srcPort,
long dst,
short dstPort) |
NodePortTuple |
getIncomingSwitchPort(long src,
short srcPort,
long dst,
short dstPort,
boolean tunnelEnabled) |
protected int |
getInputPort(org.openflow.protocol.interfaces.OFPacketIn pi) |
long |
getL2DomainId(long switchId)
Returns the identifier of the L2 domain of a given switch.
|
long |
getL2DomainId(long switchId,
boolean tunnelEnabled) |
java.util.List<ILinkDiscoveryListener.LDUpdate> |
getLastLinkUpdates()
ITopologyListener provides topologyChanged notification,
but not *what* the changes were.
|
java.util.Date |
getLastUpdateTime() |
OFModel[] |
getModels()
returns the array of all
OFModel objects associated with this module. |
long |
getOpenflowDomainId(long switchId) |
long |
getOpenflowDomainId(long switchId,
boolean tunnelEnabled) |
NodePortTuple |
getOutgoingSwitchPort(long src,
short srcPort,
long dst,
short dstPort)
Get the proper outgoing switchport for a given pair of src-dst
switchports.
|
NodePortTuple |
getOutgoingSwitchPort(long src,
short srcPort,
long dst,
short dstPort,
boolean tunnelEnabled) |
java.util.Set<java.lang.Integer> |
getPorts(long sw)
Switch methods
|
java.util.Set<java.lang.Integer> |
getPortsWithLinks(long sw)
Gets a list of ports on a given switch that are known to topology.
|
java.util.Set<java.lang.Integer> |
getPortsWithLinks(long sw,
boolean tunnelEnabled) |
Route |
getRoute(long src,
long dst)
Provides a route between src and dst that allows tunnels.
|
Route |
getRoute(long src,
long dst,
boolean tunnelEnabled)
Provides a route between src and dst, with option to allow or
not allow tunnels in the path.
|
Route |
getRoute(long src,
short srcPort,
long dst,
short dstPort) |
Route |
getRoute(long src,
short srcPort,
long dst,
short dstPort,
boolean tunnelEnabled) |
java.util.Set<NodePortTuple> |
getTunnelPorts() |
protected boolean |
handleDisconnect(Connection conn)
Process the disconnection event from a switch.
|
boolean |
handleHandshakedEvent(Connection sw,
MessageContext context)
An abstract method that all subclasses should implement.
|
boolean |
handleMessage(Connection conn,
MessageContext context,
org.openflow.protocol.OFMessage msg,
java.util.List<org.openflow.protocol.OFMessage> outgoing)
This is starting point of OFMTopologyManager
|
void |
informListeners() |
void |
init() |
void |
initialize()
method that initializes this module.
|
protected void |
initiatePeriodicTopologyUpdate() |
boolean |
inSameL2Domain(long switch1,
long switch2)
Queries whether two switches are in the same island.
|
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,
short portId) |
boolean |
isAllowed(long sw,
short portId,
boolean tunnelEnabled) |
boolean |
isAttachmentPointPort(long switchid,
short port)
Query to determine if devices must be learned on a given switch port.
|
boolean |
isAttachmentPointPort(long switchid,
short port,
boolean tunnelEnabled) |
boolean |
isBroadcastDomainPort(long sw,
short port) |
boolean |
isBroadcastDomainPort(long sw,
short port,
boolean tunnelEnabled) |
boolean |
isConsistent(long oldSw,
short oldPort,
long newSw,
short newPort)
Indicates if an attachment point on the new switch port is consistent
with the attachment point on the old switch port or not.
|
boolean |
isConsistent(long oldSw,
short oldPort,
long newSw,
short newPort,
boolean tunnelEnabled) |
boolean |
isIncomingBroadcastAllowed(long sw,
short portId) |
boolean |
isIncomingBroadcastAllowed(long sw,
short portId,
boolean tunnelEnabled) |
boolean |
isInSameBroadcastDomain(long s1,
short p1,
long s2,
short p2)
Indicates if the two switch ports are connected to the same
broadcast domain or not.
|
boolean |
isInSameBroadcastDomain(long s1,
short p1,
long s2,
short p2,
boolean tunnelEnabled) |
void |
linkDiscoveryUpdate(ILinkDiscoveryListener.LDUpdate update)
Any class that implements ILinkDiscoveryListener receives
link update notifications via this callback method
|
private boolean |
processPacketInMessage(IOFSwitch sw,
org.openflow.protocol.interfaces.OFPacketIn pi,
MessageContext context,
java.util.List<org.openflow.protocol.OFMessage> outgoing)
From the OFPacketIn message received, this method performs following procedures.
|
void |
removeLink(Link link) |
void |
removeLink(long srcId,
int srcPort,
long dstId,
int dstPort) |
private boolean |
removeLinkFromStructure(java.util.Map<NodePortTuple,java.util.Set<Link>> s,
Link l)
Delete the given link from the data strucure.
|
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.
|
boolean |
updateTopology() |
getController, getModule, init, processDisconnect, processHandshakeFinished, processMessage, registerFilter, registerModule
protected java.util.Map<java.lang.Long,java.util.Set<java.lang.Integer>> switchPorts
protected java.util.Map<NodePortTuple,java.util.Set<Link>> switchPortLinks
protected java.util.Map<NodePortTuple,java.util.Set<Link>> directLinks
protected java.util.Map<NodePortTuple,java.util.Set<Link>> portBroadcastDomainLinks
protected java.util.Map<NodePortTuple,java.util.Set<Link>> tunnelLinks
protected TopologyInstance currentInstance
protected TopologyInstance currentInstanceWithoutTunnels
protected boolean linksUpdated
protected boolean dtLinksUpdated
protected ILinkDiscoveryService linkDiscovery
protected java.util.ArrayList<ITopologyListener> topologyAware
protected java.util.concurrent.BlockingQueue<ILinkDiscoveryListener.LDUpdate> ldUpdates
protected java.util.List<ILinkDiscoveryListener.LDUpdate> appliedUpdates
private java.util.Date lastUpdateTime
private Topology topologyModel
private OFProtocol protocol
public void initialize()
OFModule
OFMLinkDiscovery.initialize()
.initialize
in class OFModule
protected void initiatePeriodicTopologyUpdate()
public void init()
public boolean updateTopology()
public boolean handleMessage(Connection conn, MessageContext context, org.openflow.protocol.OFMessage msg, java.util.List<org.openflow.protocol.OFMessage> outgoing)
handleMessage
in class OFModule
conn
- context
- MessageContextoutgoing
- list of OFMessage objects to be delivered to switches after this method ends the executionmsg
- the actual message objectprotected boolean handleDisconnect(Connection conn)
OFModule
OFModule.processDisconnect(Connection)
.
All subclasses of OFModule should implement this method.handleDisconnect
in class OFModule
conn
- connection that the event has occurredpublic TopologyInstance getCurrentInstance(boolean tunnelEnabled)
public TopologyInstance getCurrentInstance()
public boolean isAllowed(long sw, short portId)
isAllowed
in interface ITopologyService
public boolean isAllowed(long sw, short portId, boolean tunnelEnabled)
isAllowed
in interface ITopologyService
protected int getInputPort(org.openflow.protocol.interfaces.OFPacketIn pi)
protected boolean dropFilter(long sw, org.openflow.protocol.interfaces.OFPacketIn pi)
sw
- switchpi
- Packet-IN messagepublic void doMultiActionPacketOut(byte[] packetData, IOFSwitch sw, java.util.Set<java.lang.Integer> ports)
packetData
- sw
- ports
- protected void doFloodBDDP(long pinSwitch, org.openflow.protocol.interfaces.OFPacketIn pi)
pinSwitch
- switch datapath idpi
- packet-in messageprivate boolean processPacketInMessage(IOFSwitch sw, org.openflow.protocol.interfaces.OFPacketIn pi, MessageContext context, java.util.List<org.openflow.protocol.OFMessage> outgoing)
sw
- the switch that the pi message is receivedpi
- OFPacketIn message itselfcontext
- MessageContext.outgoing
- list of OFMessage objects to be delivered to switches after this method ends the execution.public void addSwitch(long sid)
private void addPortToSwitch(long s, int p)
public void applyUpdates()
public void addOrUpdateLink(long srcId, int srcPort, long dstId, int dstPort, ILinkDiscovery.LinkType type)
public void removeLink(Link link)
public void removeLink(long srcId, int srcPort, long dstId, int dstPort)
public void clear()
public void clearCurrentTopology()
private boolean addLinkToStructure(java.util.Map<NodePortTuple,java.util.Set<Link>> s, Link l)
s
- Mapl
- Linkprivate boolean removeLinkFromStructure(java.util.Map<NodePortTuple,java.util.Set<Link>> s, Link l)
s
- Mapl
- Linkprotected boolean createNewInstance()
public void informListeners()
public boolean handleHandshakedEvent(Connection sw, MessageContext context)
OFModule
OFModule.processHandshakeFinished(Connection, MessageContext)
.
Normally, most of modules have very simple implementation for this method,
only returning true.handleHandshakedEvent
in class OFModule
sw
- connection that the event has occurredcontext
- message context for the handshaking messagespublic void linkDiscoveryUpdate(ILinkDiscoveryListener.LDUpdate update)
ILinkDiscoveryListener
linkDiscoveryUpdate
in interface ILinkDiscoveryListener
update
- ILinkDiscoveryListener.LDUpdate
public void addListener(ITopologyListener listener)
addListener
in interface ITopologyService
public java.util.Date getLastUpdateTime()
getLastUpdateTime
in interface ITopologyService
public boolean isAttachmentPointPort(long switchid, short port)
ITopologyService
isAttachmentPointPort
in interface ITopologyService
public boolean isAttachmentPointPort(long switchid, short port, boolean tunnelEnabled)
isAttachmentPointPort
in interface ITopologyService
public long getOpenflowDomainId(long switchId)
getOpenflowDomainId
in interface ITopologyService
public long getOpenflowDomainId(long switchId, boolean tunnelEnabled)
getOpenflowDomainId
in interface ITopologyService
public long getL2DomainId(long switchId)
ITopologyService
getL2DomainId
in interface ITopologyService
switchId
- The DPID of the switch in long formpublic long getL2DomainId(long switchId, boolean tunnelEnabled)
getL2DomainId
in interface ITopologyService
public boolean inSameOpenflowDomain(long switch1, long switch2)
ITopologyService
inSameOpenflowDomain
in interface ITopologyService
public boolean inSameOpenflowDomain(long switch1, long switch2, boolean tunnelEnabled)
inSameOpenflowDomain
in interface ITopologyService
public boolean inSameL2Domain(long switch1, long switch2)
ITopologyService
inSameL2Domain
in interface ITopologyService
public boolean inSameL2Domain(long switch1, long switch2, boolean tunnelEnabled)
inSameL2Domain
in interface ITopologyService
public boolean isBroadcastDomainPort(long sw, short port)
isBroadcastDomainPort
in interface ITopologyService
public boolean isBroadcastDomainPort(long sw, short port, boolean tunnelEnabled)
isBroadcastDomainPort
in interface ITopologyService
public boolean isConsistent(long oldSw, short oldPort, long newSw, short newPort)
ITopologyService
isConsistent
in interface ITopologyService
public boolean isConsistent(long oldSw, short oldPort, long newSw, short newPort, boolean tunnelEnabled)
isConsistent
in interface ITopologyService
public boolean isInSameBroadcastDomain(long s1, short p1, long s2, short p2)
ITopologyService
isInSameBroadcastDomain
in interface ITopologyService
public boolean isInSameBroadcastDomain(long s1, short p1, long s2, short p2, boolean tunnelEnabled)
isInSameBroadcastDomain
in interface ITopologyService
public java.util.Set<java.lang.Integer> getPortsWithLinks(long sw)
ITopologyService
getPortsWithLinks
in interface ITopologyService
sw
- The switch DPID in longpublic java.util.Set<java.lang.Integer> getPortsWithLinks(long sw, boolean tunnelEnabled)
getPortsWithLinks
in interface ITopologyService
public java.util.Set<java.lang.Short> getBroadcastPorts(long targetSw, long src, short srcPort)
ITopologyService
getBroadcastPorts
in interface ITopologyService
public java.util.Set<java.lang.Short> getBroadcastPorts(long targetSw, long src, short srcPort, boolean tunnelEnabled)
getBroadcastPorts
in interface ITopologyService
public boolean isIncomingBroadcastAllowed(long sw, short portId)
isIncomingBroadcastAllowed
in interface ITopologyService
public boolean isIncomingBroadcastAllowed(long sw, short portId, boolean tunnelEnabled)
isIncomingBroadcastAllowed
in interface ITopologyService
public NodePortTuple getOutgoingSwitchPort(long src, short srcPort, long dst, short dstPort)
ITopologyService
getOutgoingSwitchPort
in interface ITopologyService
public NodePortTuple getOutgoingSwitchPort(long src, short srcPort, long dst, short dstPort, boolean tunnelEnabled)
getOutgoingSwitchPort
in interface ITopologyService
public NodePortTuple getIncomingSwitchPort(long src, short srcPort, long dst, short dstPort)
getIncomingSwitchPort
in interface ITopologyService
public NodePortTuple getIncomingSwitchPort(long src, short srcPort, long dst, short dstPort, boolean tunnelEnabled)
getIncomingSwitchPort
in interface ITopologyService
public NodePortTuple getAllowedOutgoingBroadcastPort(long src, short srcPort, long dst, short dstPort)
ITopologyService
getAllowedOutgoingBroadcastPort
in interface ITopologyService
public NodePortTuple getAllowedOutgoingBroadcastPort(long src, short srcPort, long dst, short dstPort, boolean tunnelEnabled)
getAllowedOutgoingBroadcastPort
in interface ITopologyService
public NodePortTuple getAllowedIncomingBroadcastPort(long src, short srcPort)
ITopologyService
getAllowedIncomingBroadcastPort
in interface ITopologyService
public NodePortTuple getAllowedIncomingBroadcastPort(long src, short srcPort, boolean tunnelEnabled)
getAllowedIncomingBroadcastPort
in interface ITopologyService
public java.util.Set<NodePortTuple> getBroadcastDomainPorts()
ITopologyService
getBroadcastDomainPorts
in interface ITopologyService
public java.util.Set<NodePortTuple> getTunnelPorts()
getTunnelPorts
in interface ITopologyService
public java.util.Set<NodePortTuple> getBlockedPorts()
ITopologyService
getBlockedPorts
in interface ITopologyService
public java.util.List<ILinkDiscoveryListener.LDUpdate> getLastLinkUpdates()
ITopologyService
getLastLinkUpdates
in interface ITopologyService
public java.util.Set<java.lang.Integer> getPorts(long sw)
ITopologyService
getPorts
in interface ITopologyService
public Route getRoute(long src, long dst)
IRoutingService
getRoute
in interface IRoutingService
public Route getRoute(long src, long dst, boolean tunnelEnabled)
IRoutingService
getRoute
in interface IRoutingService
public Route getRoute(long src, short srcPort, long dst, short dstPort)
getRoute
in interface IRoutingService
public Route getRoute(long src, short srcPort, long dst, short dstPort, boolean tunnelEnabled)
getRoute
in interface IRoutingService
public boolean routeExists(long src, long dst)
IRoutingService
routeExists
in interface IRoutingService
public boolean routeExists(long src, long dst, boolean tunnelEnabled)
IRoutingService
routeExists
in interface IRoutingService