commit | 2ec191fa981e52278c0c0f4657e4769019ac6cf1 | [log] [tgz] |
---|---|---|
author | Nikhil Cheerla <nikhil@onlabs.us> | Thu Jul 09 12:34:54 2015 -0700 |
committer | Thomas Vachuska <tom@onlab.us> | Tue Sep 22 14:29:19 2015 -0700 |
tree | 32c801a9062964b59778a1d4a69218dc8665efdd | |
parent | 1cf0f9a41f00aa682298f84d669eb8841f918a5f [diff] |
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(); + } }