Bug fix for ForwardingRulesManager:
[controller.git] / opendaylight / routing / dijkstra_implementation / src / main / java / org / opendaylight / controller / routing / dijkstra_implementation / internal / DijkstraImplementation.java
index 1fed3e1c036d53b89c2bb9ee6689128f3d937234..586432d8c09a55255b1577b409302fd40b2d7456 100644 (file)
@@ -61,7 +61,7 @@ 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<IListenRoutingUpdates>();
         }
@@ -71,7 +71,7 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware {
         }
     }
 
-    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;
                     }
 
@@ -277,7 +269,7 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware {
                                 .getNode(), dst
                                 .getNode(), EdgeType.DIRECTED);
                     } catch (ConstructionException e) {
-                        e.printStackTrace();
+                        log.error("",e);
                         return edgePresentInGraph;
                     }
                 }
@@ -286,7 +278,7 @@ public class DijkstraImplementation implements IRouting, ITopologyManagerAware {
                 try {
                     topo.removeEdge(new Edge(src, dst));
                 } catch (ConstructionException e) {
-                    e.printStackTrace();
+                    log.error("",e);
                     return edgePresentInGraph;
                 }