Search in sources :

Example 1 with PathService

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());
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) Path(org.onosproject.net.Path) DisjointPath(org.onosproject.net.DisjointPath) PathService(org.onosproject.net.topology.PathService) DisjointPath(org.onosproject.net.DisjointPath) Test(org.junit.Test)

Example 2 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 3 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)

Example 4 with PathService

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();
}
Also used : GeoDistanceLinkWeight(org.onosproject.net.topology.GeoDistanceLinkWeight) PathService(org.onosproject.net.topology.PathService) TopologyService(org.onosproject.net.topology.TopologyService)

Example 5 with PathService

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);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) PathService(org.onosproject.net.topology.PathService) Test(org.junit.Test)

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