Added initial implementation of the Titan + Gremlin based shortest-path
computation. It replaces the existing Floodlight backend, and
can be used with the existing REST-based API.
Added a test Python-script which is just a wrapper for
the "curl" call.
diff --git a/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java b/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java
index 70e406f..56c9bf3 100644
--- a/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java
+++ b/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java
@@ -4,7 +4,9 @@
import net.floodlightcontroller.routing.IRoutingService;
import net.floodlightcontroller.routing.Route;
+import net.floodlightcontroller.routing.TopoRouteService;
import net.floodlightcontroller.topology.NodePortTuple;
+import net.floodlightcontroller.core.INetMapTopologyService.ITopoRouteService;
import org.openflow.util.HexString;
import org.restlet.resource.Get;
@@ -18,9 +20,16 @@
@Get("json")
public List<NodePortTuple> retrieve() {
+ /*
IRoutingService routing =
(IRoutingService)getContext().getAttributes().
get(IRoutingService.class.getCanonicalName());
+ */
+ ITopoRouteService onos_routing = new TopoRouteService();
+ if (onos_routing == null) {
+ log.debug("ONOS Route Service not found");
+ return null;
+ }
String srcDpid = (String) getRequestAttributes().get("src-dpid");
String srcPort = (String) getRequestAttributes().get("src-port");
@@ -34,12 +43,19 @@
long longDstDpid = HexString.toLong(dstDpid);
short shortDstPort = Short.parseShort(dstPort);
+ /*
Route result = routing.getRoute(longSrcDpid, shortSrcPort, longDstDpid, shortDstPort);
if (result!=null) {
return routing.getRoute(longSrcDpid, shortSrcPort, longDstDpid, shortDstPort).getPath();
}
- else {
+ */
+ List<NodePortTuple> result =
+ onos_routing.GetShortestpath(new NodePortTuple(longSrcDpid, shortSrcPort),
+ new NodePortTuple(longDstDpid, shortDstPort));
+ if ((result != null) && (result.size() > 0)) {
+ return result;
+ } else {
log.debug("ERROR! no route found");
return null;
}