Add TopoRouteService to the list of modules to be loaded on startup.
diff --git a/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java b/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java
index fd9d201..3fa7510 100644
--- a/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java
+++ b/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java
@@ -2,11 +2,10 @@
import java.util.List;
+import net.floodlightcontroller.core.INetMapTopologyService.ITopoRouteService;
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;
@@ -20,14 +19,11 @@
@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");
+ ITopoRouteService topoRouteService =
+ (ITopoRouteService)getContext().getAttributes().
+ get(ITopoRouteService.class.getCanonicalName());
+ if (topoRouteService == null) {
+ log.debug("Topology Route Service not found");
return null;
}
@@ -43,16 +39,9 @@
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();
- }
- */
List<NodePortTuple> result =
- onos_routing.getShortestPath(new NodePortTuple(longSrcDpid, shortSrcPort),
- new NodePortTuple(longDstDpid, shortDstPort));
+ topoRouteService.getShortestPath(new NodePortTuple(longSrcDpid, shortSrcPort),
+ new NodePortTuple(longDstDpid, shortDstPort));
if ((result != null) && (result.size() > 0)) {
return result;
} else {