Disjoint Path Utils Exposed

- to TopologyStores
- to TopologyServices
- to PathServices
- to REST API

Change-Id: Ib2b5840df0f8e94f327ec8f91827d3d850634562

Change-Id: I03e59210e9c79c4f92dcfa8c7983642572708429

Change-Id: Ia5c17d1ded374ef688990bd30e7f99184aaca95b

Change-Id: Ibebae50bc722701e8212263587727ad8abd79805
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java
index baa1b1e..eae8c91 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java
@@ -82,4 +82,30 @@
         return ok(root).build();
     }
 
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    @Path("{src}/{dst}/disjoint")
+
+    public Response getDisjointPath(@PathParam("src") String src,
+                            @PathParam("dst") String dst) {
+        PathService pathService = get(PathService.class);
+
+        ElementId srcElement = isHostId(src);
+        ElementId dstElement = isHostId(dst);
+
+        if (srcElement == null) {
+            // Doesn't look like a host, assume it is a device
+            srcElement = DeviceId.deviceId(src);
+        }
+
+        if (dstElement == null) {
+            // Doesn't look like a host, assume it is a device
+            dstElement = DeviceId.deviceId(dst);
+        }
+        Set<org.onosproject.net.DisjointPath> paths =
+                pathService.getDisjointPaths(srcElement, dstElement);
+        ObjectNode root =
+                    encodeArray(org.onosproject.net.DisjointPath.class, "paths", paths);
+        return ok(root).build();
+    }
 }