Update the REST shortest-path computation backend to use the in-memory
topology, so the result is consistent with the shortest-path computation
as done by the rest of the system.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java b/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
index b340996..0d33b27 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
@@ -1,5 +1,6 @@
package net.onrc.onos.ofcontroller.topology.web;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.ofcontroller.topology.ITopologyNetService;
import net.onrc.onos.ofcontroller.topology.TopologyManager;
import net.onrc.onos.ofcontroller.util.DataPath;
@@ -18,11 +19,22 @@
@Get("json")
public DataPath retrieve() {
- ITopologyNetService topologyNetService = new TopologyManager("");
+ // Get the services that are needed for the computation
+ ITopologyNetService topologyNetService =
+ (ITopologyNetService)getContext().getAttributes().
+ get(ITopologyNetService.class.getCanonicalName());
+ IFlowService flowService =
+ (IFlowService)getContext().getAttributes().
+ get(IFlowService.class.getCanonicalName());
+
if (topologyNetService == null) {
log.debug("Topology Net Service not found");
return null;
}
+ if (flowService == null) {
+ log.debug("Flow Service not found");
+ return null;
+ }
String srcDpidStr = (String) getRequestAttributes().get("src-dpid");
String srcPortStr = (String) getRequestAttributes().get("src-port");
@@ -37,7 +49,8 @@
Port dstPort = new Port(Short.parseShort(dstPortStr));
DataPath result =
- topologyNetService.getDatabaseShortestPath(
+ topologyNetService.getTopologyShortestPath(
+ flowService.getTopology(),
new SwitchPort(srcDpid, srcPort),
new SwitchPort(dstDpid, dstPort));
if (result != null) {