remotePort,
remoteSwitch.getPort(remotePort)});
}
return Command.STOP;
}
if (suppressLinkDiscovery.contains(new NodePortTuple(
remoteSwitch.getId(),
remotePort))) {
if (log.isTraceEnabled()) {
log.trace("Ignoring link with suppressed src port: switch {} port {} {}",
new Object[] { remoteSwitch.getStringId(),
remotePort,
remoteSwitch.getPort(remotePort)});
}
return Command.STOP;
}
if (!iofSwitch.portEnabled(inPort)) {
if (log.isTraceEnabled()) {
log.trace("Ignoring link with disabled dest port: switch {} port {} {}",
new Object[] { HexString.toHexString(sw),
inPort,
iofSwitch.getPort(inPort)});
}
return Command.STOP;
}
// Store the time of update to this link, and push it out to
// routingEngine
Link lt = new Link(remoteSwitch.getId(), remotePort,
iofSwitch.getId(), inPort);
if (!isLinkAllowed(lt.getSrc(), lt.getSrcPort(),
lt.getDst(), lt.getDstPort()))
return Command.STOP;
// Continue only if link is allowed.
Long lastLldpTime = null;
Long lastBddpTime = null;
Long firstSeenTime = System.currentTimeMillis();
if (isStandard)
lastLldpTime = System.currentTimeMillis();
else
lastBddpTime = System.currentTimeMillis();
LinkInfo newLinkInfo = new LinkInfo(firstSeenTime, lastLldpTime,
lastBddpTime);
addOrUpdateLink(lt, newLinkInfo);
// Check if reverse link exists.
// If it doesn't exist and if the forward link was seen
// first seen within a small interval, send probe on the
// reverse link.
newLinkInfo = links.get(lt);
if (newLinkInfo != null && isStandard && isReverse == false) {
Link reverseLink = new Link(lt.getDst(), lt.getDstPort(),
lt.getSrc(), lt.getSrcPort());
LinkInfo reverseInfo = links.get(reverseLink);
if (reverseInfo == null) {
// the reverse link does not exist.
if (newLinkInfo.getFirstSeenTime() > System.currentTimeMillis()
- LINK_TIMEOUT) {
this.sendDiscoveryMessage(lt.getDst(), lt.getDstPort(),
isStandard, true);
}
}
}
// If the received packet is a BDDP packet, then create a reverse BDDP
// link as well.
if (!isStandard) {
Link reverseLink = new Link(lt.getDst(), lt.getDstPort(),
lt.getSrc(), lt.getSrcPort());
// srcPortState and dstPort state are reversed.
LinkInfo reverseInfo = new LinkInfo(firstSeenTime, lastLldpTime,
lastBddpTime);
addOrUpdateLink(reverseLink, reverseInfo);
}
// Remove the node ports from the quarantine and maintenance queues.
NodePortTuple nptSrc = new NodePortTuple(lt.getSrc(),
lt.getSrcPort());
NodePortTuple nptDst = new NodePortTuple(lt.getDst(),
lt.getDstPort());
removeFromQuarantineQueue(nptSrc);
removeFromMaintenanceQueue(nptSrc);
removeFromQuarantineQueue(nptDst);
removeFromMaintenanceQueue(nptDst);