public class Links extends OFModel
OFMLinkDiscovery
Modifier and Type | Class and Description |
---|---|
(package private) class |
Links.RESTLink
class to convert Link information into JSON format.
|
OFModel.RESTApi, OFModel.RESTWebUI
Modifier and Type | Field and Description |
---|---|
private OFModel.RESTApi[] |
apis
All RESTApi objects associated with this model.
|
protected int |
LINK_TIMEOUT
Timeout as part of LLDP process
|
private java.util.Map<Link,LinkInfo> |
links
Association between a link and the link information
|
private java.util.concurrent.locks.ReentrantReadWriteLock |
lock
Lock for guaranteeing synchronized access to
links ; |
private OFMLinkDiscovery |
manager
reference to the module of this model.
|
private java.util.Map<NodePortTuple,java.util.Set<Link>> |
portBroadcastDomainLinks
Set of link tuples over which multicast LLDPs are received
and unicast LLDPs are not received.
|
private java.util.Map<NodePortTuple,java.util.Set<Link>> |
portLinks
Map from a id:port to the set of links containing it as an endpoint
|
private 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
|
Constructor and Description |
---|
Links(OFMLinkDiscovery manager)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addLinkToBroadcastDomain(Link lt)
Put a link into the map of
portBroadcastDomainLinks . |
private boolean |
addOrUpdateLink(Link lt,
LinkInfo newInfo)
Add or Update a link information.
|
Link |
addOrUpdateLink(long remoteSwitchId,
int remotePort,
org.openflow.protocol.interfaces.OFPortDesc remotePhyPort,
long localSwitchId,
int localInPort,
org.openflow.protocol.interfaces.OFPortDesc localInPhyPort,
boolean isStandard,
boolean isReverse)
Add or update link information. used by OFMLinkDiscovery.handleLldp method.
|
private void |
deleteLinks(java.util.List<Link> links)
Delete links from the
switchLinks and portLinks structures. |
void |
deleteLinksOnPort(NodePortTuple npt)
Delete all links associated with a
NodePortTuple object. |
OFModel.RESTApi[] |
getAllRestApi()
return the list of all RESTApi objects.
|
java.lang.String |
getStringRepresentation()
Get the string representation of
portLinks . |
void |
removeLinkFromBroadcastDomain(Link lt)
Remove a link from the map of
portBroadcastDomainLinks . |
void |
timeoutLinks()
Iterates through the list of links and deletes if the
last discovery message reception time exceeds timeout values.
|
java.lang.String |
toString()
return the name of this Model.
|
boolean |
updatePortStatus(java.lang.Long switchId,
int portnum,
org.openflow.protocol.interfaces.OFPortStatus ps)
Update port status.
|
protected final int LINK_TIMEOUT
private java.util.concurrent.locks.ReentrantReadWriteLock lock
links
;private java.util.Map<Link,LinkInfo> links
private java.util.Map<java.lang.Long,java.util.Set<Link>> switchLinks
private java.util.Map<NodePortTuple,java.util.Set<Link>> portLinks
private java.util.Map<NodePortTuple,java.util.Set<Link>> portBroadcastDomainLinks
private OFMLinkDiscovery manager
private OFModel.RESTApi[] apis
public Links(OFMLinkDiscovery manager)
manager
- reference to the module of this modelpublic void timeoutLinks()
public void addLinkToBroadcastDomain(Link lt)
portBroadcastDomainLinks
.
Broadcast domain links are the links found via BDDP packets.lt
- link to put into the list.public void removeLinkFromBroadcastDomain(Link lt)
portBroadcastDomainLinks
.
Broadcast domain links are the links found via BDDP packets.lt
- link to removepublic void deleteLinksOnPort(NodePortTuple npt)
NodePortTuple
object.npt
- a node-port tuplepublic Link addOrUpdateLink(long remoteSwitchId, int remotePort, org.openflow.protocol.interfaces.OFPortDesc remotePhyPort, long localSwitchId, int localInPort, org.openflow.protocol.interfaces.OFPortDesc localInPhyPort, boolean isStandard, boolean isReverse)
Link
and LinkInfo
object,
(remote is set to source, and local is set to destination)
this method first calls addOrUpdateLink(Link, LinkInfo)
method.
Then, if the LinkInfo
is correctly set,
search the LinkInfo
object for the reverse link.
If none, this method sends out a LLDP discovery for the reverse link
by calling OFMLinkDiscovery.sendDiscoveryMessage(long, short, boolean, boolean)
.
For a BDDP packet, this method just tries to enrolls the reverse link information
by calling addOrUpdateLink(Link, LinkInfo)
.public boolean updatePortStatus(java.lang.Long switchId, int portnum, org.openflow.protocol.interfaces.OFPortStatus ps)
switchId
- switch identifierportnum
- port numberps
- OFPortStatus messagepublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getStringRepresentation()
portLinks
.private void deleteLinks(java.util.List<Link> links)
switchLinks
and portLinks
structures.
Called by deleteLinksOnPort(NodePortTuple)
.links
- private boolean addOrUpdateLink(Link lt, LinkInfo newInfo)
links
structure.
If the link was discovered via BDDP packets, the links goes to the
portBroadcastDomainLinks
by calling addLinkToBroadcastDomain(Link)
.
portBroadcastDomainLinks
structure.
lt
- target link to update or addnewInfo
- information of the linkpublic OFModel.RESTApi[] getAllRestApi()
getAllRestApi
in class OFModel