Add a fix to the Shortest-Path computation algorithm for the corner
case when computing a path from/to the same DPID.
In that case, we just return a list of "src" and "dest".
NOTE: The return value will change in the future to return
a single hop/entry instead of two. Currently, we need both entries
to capture the source and destination ports.
diff --git a/src/main/java/net/floodlightcontroller/routing/TopoRouteService.java b/src/main/java/net/floodlightcontroller/routing/TopoRouteService.java
index 7d98aa9..ba74b75 100644
--- a/src/main/java/net/floodlightcontroller/routing/TopoRouteService.java
+++ b/src/main/java/net/floodlightcontroller/routing/TopoRouteService.java
@@ -63,7 +63,18 @@
if (! iter.hasNext())
return null; // Destination vertex not found
Vertex v_dest = iter.next();
-
+
+ //
+ // Test whether we are computing a path from/to the same DPID.
+ // If "yes", then just list the "src" and "dest" in the return
+ // result.
+ //
+ if (dpid_src.equals(dpid_dest)) {
+ result_list.add(new NodePortTuple(src));
+ result_list.add(new NodePortTuple(dest));
+ return result_list;
+ }
+
//
// Implement the Gremlin script and run it
//