private Boolean throttling = false; // if true, no more batching.
private volatile Boolean shuttingDown = false;
- private LLDPTLV chassisIdTlv, portIdTlv, ttlTlv, customTlv;
+ private LLDPTLV chassisIdTlv, systemNameTlv, portIdTlv, ttlTlv, customTlv;
private IPluginOutConnectionService connectionOutService;
class DiscoveryTransmit implements Runnable {
chassisIdTlv.setType(LLDPTLV.TLVType.ChassisID.getValue()).setLength((short) cidValue.length)
.setValue(cidValue);
+ // Create LLDP SystemName TLV
+ byte[] snValue = LLDPTLV.createSystemNameTLVValue(nodeConnector.getNode().toString());
+ systemNameTlv.setType(LLDPTLV.TLVType.SystemName.getValue()).setLength((short) snValue.length)
+ .setValue(snValue);
+
// Create LLDP PortID TLV
String portId = nodeConnector.getNodeConnectorIDString();
byte[] pidValue = LLDPTLV.createPortIDTLVValue(portId);
// Create discovery pkt
LLDP discoveryPkt = new LLDP();
- discoveryPkt.setChassisId(chassisIdTlv).setPortId(portIdTlv).setTtl(ttlTlv).setOptionalTLVList(customList);
+ discoveryPkt.setChassisId(chassisIdTlv).setPortId(portIdTlv).setTtl(ttlTlv).setSystemNameId(systemNameTlv)
+ .setOptionalTLVList(customList);
RawPacket rawPkt = null;
try {
updateProdEdge(edge, props);
} catch (Exception e) {
- logger.warn("Caught exception ", e);
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "Caught exception while attempting to snoop non controller generated or malformed LLDP frame sent by {} and received on {}: {}",
+ HexEncode.bytesToHexStringFormat(ethPkt.getSourceMACAddress()), dstNodeConnector,
+ e.getMessage());
+ }
}
}
List<LLDPTLV> optionalTLVList = lldp.getOptionalTLVList();
if (optionalTLVList == null) {
- logger.info("The discovery packet with null custom option from {}", dstNodeConnector);
+ logger.warn("The discovery packet with null custom option from {}", dstNodeConnector);
return false;
}
private void addDiscovery(Node node) {
Map<Long, ISwitch> switches = controller.getSwitches();
ISwitch sw = switches.get(node.getID());
- List<OFPhysicalPort> ports = sw.getEnabledPorts();
- if (ports == null) {
+ if (sw == null) {
+ //switch could be removed by now, stop propagation
return;
}
+ List<OFPhysicalPort> ports = sw.getEnabledPorts();
for (OFPhysicalPort port : ports) {
NodeConnector nodeConnector = NodeConnectorCreator.createOFNodeConnector(port.getPortNumber(), node);
if (!readyListHi.contains(nodeConnector)) {
moveToReadyListHi(dst);
}
+ //checking only OF map, since production edge discovery always overwrites any existing edge
+ UpdateType ut = edgeMap.containsKey(dst) ? UpdateType.CHANGED : UpdateType.ADDED;
// notify
- updateEdge(edge, UpdateType.ADDED, props);
+ updateEdge(edge, ut, props);
logger.trace("Add edge {}", edge);
}
return;
}
+
this.discoveryListener.notifyEdge(edge, type, props);
NodeConnector src = edge.getTailNodeConnector(), dst = edge.getHeadNodeConnector();
chassisIdTlv = new LLDPTLV();
chassisIdTlv.setType(LLDPTLV.TLVType.ChassisID.getValue());
+ // Create LLDP SystemName TLV
+ systemNameTlv = new LLDPTLV();
+ systemNameTlv.setType(LLDPTLV.TLVType.SystemName.getValue());
+
// Create LLDP PortID TLV
portIdTlv = new LLDPTLV();
portIdTlv.setType(LLDPTLV.TLVType.PortID.getValue());