X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Frouting%2Fdijkstra_implementation%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Frouting%2Fdijkstra_implementation%2Finternal%2FDijkstraImplementation.java;h=64cc3fbe01045f8e2bf372fbae0ee8e360f9f908;hb=ab59b3b28b16f1a87d07b37cdc6dbe882d255bb5;hp=77e6d95dc953c597158be0c734355f51f2663fee;hpb=cdd14ba56a3898e80e73e72a0605f9d63b8ca774;p=controller.git diff --git a/opendaylight/routing/dijkstra_implementation/src/main/java/org/opendaylight/controller/routing/dijkstra_implementation/internal/DijkstraImplementation.java b/opendaylight/routing/dijkstra_implementation/src/main/java/org/opendaylight/controller/routing/dijkstra_implementation/internal/DijkstraImplementation.java index 77e6d95dc9..64cc3fbe01 100644 --- a/opendaylight/routing/dijkstra_implementation/src/main/java/org/opendaylight/controller/routing/dijkstra_implementation/internal/DijkstraImplementation.java +++ b/opendaylight/routing/dijkstra_implementation/src/main/java/org/opendaylight/controller/routing/dijkstra_implementation/internal/DijkstraImplementation.java @@ -61,17 +61,17 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { private IReadService readService; private static final long DEFAULT_LINK_SPEED = Bandwidth.BW1Gbps; - public void setLIstenRoutingUpdates(IListenRoutingUpdates i) { + public void setListenRoutingUpdates(IListenRoutingUpdates i) { if (this.routingAware == null) { this.routingAware = new HashSet(); } if (this.routingAware != null) { - log.debug("Adding routingAware listener: " + i); + log.debug("Adding routingAware listener: {}", i); this.routingAware.add(i); } } - public void unsetRoutingUpdates(IListenRoutingUpdates i) { + public void unsetListenRoutingUpdates(IListenRoutingUpdates i) { if (this.routingAware == null) { return; } @@ -111,22 +111,14 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { .getNodeConnectorProp(dstNC, Bandwidth.BandwidthPropName); - if ((bwSrc == null) || (bwDst == null)) { - log.error("bwSrc:{} or bwDst:{} is null", bwSrc, bwDst); - return (double) -1; - } - - long srcLinkSpeed = bwSrc.getValue(); - if (srcLinkSpeed == 0) { - log.trace("Edge {}: srcLinkSpeed is 0. Setting to {}!", - e, DEFAULT_LINK_SPEED); - srcLinkSpeed = DEFAULT_LINK_SPEED; + long srcLinkSpeed = 0, dstLinkSpeed = 0; + if ((bwSrc == null) || ((srcLinkSpeed = bwSrc.getValue()) == 0)) { + log.debug("srcNC: {} - Setting srcLinkSpeed to Default!",srcNC); + srcLinkSpeed = DEFAULT_LINK_SPEED; } - - long dstLinkSpeed = bwDst.getValue(); - if (dstLinkSpeed == 0) { - log.trace("Edge {}: dstLinkSpeed is 0. Setting to {}!", - e, DEFAULT_LINK_SPEED); + + if ((bwDst == null) || ((dstLinkSpeed = bwDst.getValue()) == 0)) { + log.debug("dstNC: {} - Setting dstLinkSpeed to Default!",dstNC); dstLinkSpeed = DEFAULT_LINK_SPEED; } @@ -140,10 +132,8 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { : avlDstThruPut; if (avlThruPut <= 0) { - log - .trace( - "Edge {}: Available Throughput {} is Zero/Negative", - e, avlThruPut); + log.debug("Edge {}: Available Throughput {} <= 0!", + e, avlThruPut); return (double) -1; } return (double) (Bandwidth.BW1Pbps / avlThruPut); @@ -177,8 +167,7 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { @Override public synchronized Path getMaxThroughputRoute(Node src, Node dst) { if (mtp == null) { - log - .error("Max Throughput Path Calculation has not been Initialized!"); + log.error("Max Throughput Path Calculation Uninitialized!"); return null; } @@ -186,16 +175,16 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { try { path = mtp.getMaxThroughputPath(src, dst); } catch (IllegalArgumentException ie) { - log.debug("A vertex is yet not known between " + src.toString() - + " " + dst.toString()); + log.debug("A vertex is yet not known between {} {}", src.toString(), + dst.toString()); return null; } Path res; try { res = new Path(path); } catch (ConstructionException e) { - log.debug("A vertex is yet not known between " + src.toString() - + " " + dst.toString()); + log.debug("A vertex is yet not known between {} {}", src.toString(), + dst.toString()); return null; } return res; @@ -210,16 +199,16 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { try { path = spt.getPath(src, dst); } catch (IllegalArgumentException ie) { - log.debug("A vertex is yet not known between " + src.toString() - + " " + dst.toString()); + log.debug("A vertex is yet not known between {} {}", src.toString(), + dst.toString()); return null; } Path res; try { res = new Path(path); } catch (ConstructionException e) { - log.debug("A vertex is yet not known between " + src.toString() - + " " + dst.toString()); + log.debug("A vertex is yet not known between {} {}", src.toString(), + dst.toString()); return null; } return res; @@ -298,14 +287,14 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { if (topo.containsVertex(src.getNode()) && topo.inDegree(src.getNode()) == 0 && topo.outDegree(src.getNode()) == 0) { - log.debug("Removing vertex " + src); + log.debug("Removing vertex {}", src); topo.removeVertex(src.getNode()); } if (topo.containsVertex(dst.getNode()) && topo.inDegree(dst.getNode()) == 0 && topo.outDegree(dst.getNode()) == 0) { - log.debug("Removing vertex " + dst); + log.debug("Removing vertex {}", dst); topo.removeVertex(dst.getNode()); } } @@ -314,8 +303,7 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { clearMaxThroughput(); } } else { - log.error("Cannot find topology for BW " + bw - + " this is unexpected!"); + log.error("Cannot find topology for BW {} this is unexpected!", bw); } return edgePresentInGraph; } @@ -348,7 +336,7 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { if (props != null) props.remove(bw); - log.debug("edgeUpdate: " + e.toString() + " bw: " + bw.getValue()); + log.debug("edgeUpdate: {} bw: {}", e.toString(), bw.getValue()); Short baseBW = Short.valueOf((short) 0); boolean add = (type == UpdateType.ADDED) ? true : false; @@ -360,7 +348,6 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware { updateTopo(e, (short) bw.getValue(), add); } if (this.routingAware != null) { - log.info("Invoking routingAware listeners"); for (IListenRoutingUpdates ra : this.routingAware) { try { ra.recalculateDone();