use of org.onosproject.net.topology.PathService in project onos by opennetworkinglab.
the class VirtualNetworkPathManagerTest method testGetPathsOnEmptyVnet.
/**
* Tests getPaths(), getDisjointPaths()
* on an empty virtual network.
*/
@Test
public void testGetPathsOnEmptyVnet() {
VirtualNetwork vnet = setupEmptyVnet();
PathService pathService = manager.get(vnet.id(), PathService.class);
Set<Path> paths = pathService.getPaths(DID1, DID3);
assertEquals("incorrect path count", 0, paths.size());
Set<DisjointPath> disjointPaths = pathService.getDisjointPaths(DID1, DID3);
assertEquals("incorrect path count", 0, disjointPaths.size());
}
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();
}
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();
}
use of org.onosproject.net.topology.PathService in project onos by opennetworkinglab.
the class PathPainterTopovMessageHandler method init.
// ===============-=-=-=-=-=-======================-=-=-=-=-=-=-===========
@Override
public void init(UiConnection connection, ServiceDirectory directory) {
super.init(connection, directory);
pathService = directory.get(PathService.class);
topologyService = directory.get(TopologyService.class);
linkData = new GeoDistanceLinkWeight(directory.get(DeviceService.class));
addListeners();
}
use of org.onosproject.net.topology.PathService in project onos by opennetworkinglab.
the class VirtualNetworkPathManagerTest method testGetPathsWithNullSrc.
/**
* Tests getPaths() using a null source device on an empty virtual network.
*/
@Test(expected = NullPointerException.class)
public void testGetPathsWithNullSrc() {
VirtualNetwork vnet = setupEmptyVnet();
PathService pathService = manager.get(vnet.id(), PathService.class);
pathService.getPaths(null, DID3);
}
Aggregations