Fix a bug in the shortest path computation:
If we are computing a path from/to the same DPID, and if the "in" and "out"
ports are same, then return null.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/ShortestPath.java b/src/main/java/net/onrc/onos/ofcontroller/topology/ShortestPath.java
index f187c27..9a8345c 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/topology/ShortestPath.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/ShortestPath.java
@@ -69,8 +69,11 @@
//
// Test whether we are computing a path from/to the same DPID.
// If "yes", then just add a single flow entry in the return result.
+ // However, if the "in" and "out" ports are same, return null.
//
if (dpid_src.equals(dpid_dest)) {
+ if (src.port().value() == dest.port().value())
+ return null; // "In" and "Out" ports are same
FlowEntry flowEntry = new FlowEntry();
flowEntry.setDpid(src.dpid());
flowEntry.setInPort(src.port());