Search in sources :

Example 6 with PathService

use of org.onosproject.net.topology.PathService in project onos by opennetworkinglab.

the class PathsWebResource method getDisjointPath.

/**
 * Gets all shortest disjoint path pairs between any two hosts or devices.
 * Returns array of all shortest disjoint path pairs between any two elements.
 * @onos.rsModel Paths
 * @param src source identifier
 * @param dst destination identifier
 * @return 200 OK with array of all shortest disjoint path pairs between any two elements
 */
@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);
    Set<org.onosproject.net.DisjointPath> paths = pathService.getDisjointPaths(elementId(src), elementId(dst));
    return ok(encodeArray(org.onosproject.net.DisjointPath.class, "paths", paths)).build();
}
Also used : PathService(org.onosproject.net.topology.PathService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 7 with PathService

use of org.onosproject.net.topology.PathService in project onos by opennetworkinglab.

the class PathsWebResource method getPath.

/**
 * Gets all shortest paths between any two hosts or devices.
 * Returns array of all shortest paths between any two elements.
 * @onos.rsModel Paths
 * @param src source identifier
 * @param dst destination identifier
 * @return 200 OK with array of all shortest paths between any two elements
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("{src}/{dst}")
public Response getPath(@PathParam("src") String src, @PathParam("dst") String dst) {
    PathService pathService = get(PathService.class);
    Set<org.onosproject.net.Path> paths = pathService.getPaths(elementId(src), elementId(dst));
    return ok(encodeArray(org.onosproject.net.Path.class, "paths", paths)).build();
}
Also used : Path(javax.ws.rs.Path) PathService(org.onosproject.net.topology.PathService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

PathService (org.onosproject.net.topology.PathService)7 Test (org.junit.Test)4 VirtualNetwork (org.onosproject.incubator.net.virtual.VirtualNetwork)4 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 DisjointPath (org.onosproject.net.DisjointPath)2 Path (org.onosproject.net.Path)2 DeviceId (org.onosproject.net.DeviceId)1 GeoDistanceLinkWeight (org.onosproject.net.topology.GeoDistanceLinkWeight)1 LinkWeigher (org.onosproject.net.topology.LinkWeigher)1 LinkWeigherAdapter (org.onosproject.net.topology.LinkWeigherAdapter)1 TopologyService (org.onosproject.net.topology.TopologyService)1