diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java index 9f00f4a3d399e25cbe46f25e6d8673ca2b1fdac0..3a992edcdf074e15dbf900390cd07efff4caea63 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java @@ -378,8 +378,8 @@ IFloodlightModule, IInfoProvider { */ long time = System.currentTimeMillis(); long swLatency = iofSwitch.getLatency().getValue(); - if (log.isDebugEnabled()) { - log.debug("SETTING LLDP LATENCY TLV: Current Time {}; {} control plane latency {}; sum {}", new Object[] { time, iofSwitch.getId(), swLatency, time + swLatency }); + if (log.isTraceEnabled()) { + log.trace("SETTING LLDP LATENCY TLV: Current Time {}; {} control plane latency {}; sum {}", new Object[] { time, iofSwitch.getId(), swLatency, time + swLatency }); } byte[] timestampTLVValue = ByteBuffer.allocate(Long.SIZE / 8 + 4) .put((byte) 0x00) @@ -702,8 +702,8 @@ IFloodlightModule, IInfoProvider { ByteBuffer tsBB = ByteBuffer.wrap(lldptlv.getValue()); /* skip OpenFlow OUI (4 bytes above) */ long swLatency = iofSwitch.getLatency().getValue(); timestamp = tsBB.getLong(4); /* include the RX switch latency to "subtract" it */ - if (log.isDebugEnabled()) { - log.debug("RECEIVED LLDP LATENCY TLV: Got timestamp of {}; Switch {} latency of {}", new Object[] { timestamp, iofSwitch.getId(), iofSwitch.getLatency().getValue() }); + if (log.isTraceEnabled()) { + log.trace("RECEIVED LLDP LATENCY TLV: Got timestamp of {}; Switch {} latency of {}", new Object[] { timestamp, iofSwitch.getId(), iofSwitch.getLatency().getValue() }); } timestamp = timestamp + swLatency; } else if (lldptlv.getType() == 12 && lldptlv.getLength() == 8) { @@ -783,8 +783,8 @@ IFloodlightModule, IInfoProvider { // routingEngine long time = System.currentTimeMillis(); U64 latency = (timestamp != 0 && (time - timestamp) > 0) ? U64.of(time - timestamp) : U64.ZERO; - if (log.isDebugEnabled()) { - log.debug("COMPUTING FINAL DATAPLANE LATENCY: Current time {}; Dataplane+{} latency {}; Overall latency from {} to {} is {}", + if (log.isTraceEnabled()) { + log.trace("COMPUTING FINAL DATAPLANE LATENCY: Current time {}; Dataplane+{} latency {}; Overall latency from {} to {} is {}", new Object[] { time, iofSwitch.getId(), timestamp, remoteSwitch.getId(), iofSwitch.getId(), String.valueOf(latency.getValue()) }); } Link lt = new Link(remoteSwitch.getId(), remotePort, @@ -1386,7 +1386,7 @@ IFloodlightModule, IInfoProvider { lk.setLatency(latencyToUse); linkChanged = true; } else { - log.debug("No need to update link {} latency", lk.toString()); + log.trace("No need to update link latency {}", lk.toString()); } return linkChanged; @@ -1443,7 +1443,7 @@ IFloodlightModule, IInfoProvider { updateOperation = UpdateOperation.LINK_UPDATED; LinkType linkType = getLinkType(lt, newInfo); if (linkType == ILinkDiscovery.LinkType.DIRECT_LINK) { - log.info("Inter-switch link updated: {}", lt); + log.debug("Inter-switch link updated: {}", lt); eventCategory.newEventNoFlush(new DirectLinkEvent(lt.getSrc(), lt.getSrcPort(), lt.getDst(), lt.getDstPort(), "link-port-state-updated::rcvd LLDP")); diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java index b70196760e087d59c7581a64e280e58869b9c0e6..8aadb71ae3cd3d9a141132e0a8234d7d6fd81687 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java @@ -231,15 +231,15 @@ public class TopologyInstance { } public void printTopology() { - log.info("-----------------Topology-----------------------"); - log.info("All Links: {}", allLinks); - log.info("Broadcast Tree: {}", finiteBroadcastTree); - log.info("Broadcast Domain Ports: {}", broadcastDomainPorts); - log.info("Tunnel Ports: {}", tunnelPorts); - log.info("Clusters: {}", clusters); - log.info("Destination Rooted Full Trees: {}", destinationRootedFullTrees); - log.info("Broadcast Node Ports: {}", broadcastNodePorts); - log.info("-----------------------------------------------"); + log.debug("-----------------Topology-----------------------"); + log.debug("All Links: {}", allLinks); + log.debug("Broadcast Tree: {}", finiteBroadcastTree); + log.debug("Broadcast Domain Ports: {}", broadcastDomainPorts); + log.debug("Tunnel Ports: {}", tunnelPorts); + log.debug("Clusters: {}", clusters); + log.debug("Destination Rooted Full Trees: {}", destinationRootedFullTrees); + log.debug("Broadcast Node Ports: {}", broadcastNodePorts); + log.debug("-----------------------------------------------"); } protected void addLinksToOpenflowDomains() { diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java index c76f63f0cd34a0abf36a6ec0482a3de9a16a56b3..22c697fd0caaba35f376d51212958fe2ee0bd153 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java @@ -305,7 +305,6 @@ public class TopologyManager implements IFloodlightModule, ITopologyService, IRo // ILinkDiscoveryListener // ********************** - @Override public void linkDiscoveryUpdate(List<LDUpdate> updateList) { if (log.isTraceEnabled()) { @@ -322,16 +321,10 @@ public class TopologyManager implements IFloodlightModule, ITopologyService, IRo ldUpdates.add(update); } - - // **************** // ITopologyService // **************** - // - // ITopologyService interface methods - // - @Override public Map<DatapathId, Set<Link>> getAllLinks(){ @@ -922,8 +915,7 @@ public class TopologyManager implements IFloodlightModule, ITopologyService, IRo newInstanceTask = new SingletonTask(ses, new UpdateTopologyWorker()); if (role != HARole.STANDBY) - newInstanceTask.reschedule(TOPOLOGY_COMPUTE_INTERVAL_MS, - TimeUnit.MILLISECONDS); + newInstanceTask.reschedule(TOPOLOGY_COMPUTE_INTERVAL_MS, TimeUnit.MILLISECONDS); linkDiscoveryService.addListener(this); floodlightProviderService.addOFMessageListener(OFType.PACKET_IN, this); @@ -1384,29 +1376,30 @@ public class TopologyManager implements IFloodlightModule, ITopologyService, IRo } /** - * Add the given link to the data structure. Returns true if a link was - * added. + * Add the given link to the data structure. * @param s * @param l - * @return */ - private boolean addLinkToStructure(Map<NodePortTuple, - Set<Link>> s, Link l) { - boolean result1 = false, result2 = false; - + private void addLinkToStructure(Map<NodePortTuple, Set<Link>> s, Link l) { NodePortTuple n1 = new NodePortTuple(l.getSrc(), l.getSrcPort()); NodePortTuple n2 = new NodePortTuple(l.getDst(), l.getDstPort()); if (s.get(n1) == null) { s.put(n1, new HashSet<Link>()); - } + } if (s.get(n2) == null) { s.put(n2, new HashSet<Link>()); } - result1 = s.get(n1).add(l); - result2 = s.get(n2).add(l); - - return (result1 || result2); + /* + * Since we don't include latency in .equals(), we need + * to explicitly remove the existing link (if present). + * Otherwise, new latency values for existing links will + * never be accepted. + */ + s.get(n1).remove(l); + s.get(n2).remove(l); + s.get(n1).add(l); + s.get(n2).add(l); } /**