X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Finternal%2FDiscoveryService.java;h=548bfb1f9fb26eb93ab4ca5bcd456d9bdc4082c3;hb=5aa8f995feede44d69bc26e70a67e6c44b01c758;hp=012807eee9ff622e5469a035b2a0e0e7b3294496;hpb=5466b63d3ad41fadf0aa4d5bf69b77c32f5d6638;p=controller.git diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java index 012807eee9..548bfb1f9f 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java @@ -125,7 +125,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa 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 { @@ -217,6 +217,11 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa 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); @@ -233,7 +238,8 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa // 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 { @@ -385,7 +391,12 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa 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()); + } } } @@ -406,7 +417,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa List 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; } @@ -825,8 +836,10 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa 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); } @@ -925,6 +938,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa return; } + this.discoveryListener.notifyEdge(edge, type, props); NodeConnector src = edge.getTailNodeConnector(), dst = edge.getHeadNodeConnector(); @@ -1462,6 +1476,10 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa 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());