use of org.onosproject.net.topology.TopologyService in project onos by opennetworkinglab.
the class VirtualNetworkTopologyManagerTest method testGetDisjointPathsUsingNullSrcDeviceId.
/**
* Test getDisjointPaths() methods using a null src device identifier.
*/
@Test(expected = NullPointerException.class)
public void testGetDisjointPathsUsingNullSrcDeviceId() {
VirtualNetwork virtualNetwork = setupVirtualNetworkTopology();
TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
Topology topology = topologyService.currentTopology();
VirtualDevice srcVirtualDevice = getVirtualDevice(virtualNetwork.id(), DID1);
VirtualDevice dstVirtualDevice = getVirtualDevice(virtualNetwork.id(), DID2);
// test the getDisjointPaths() method using a null src device identifier.
Set<DisjointPath> paths = topologyService.getDisjointPaths(topology, null, dstVirtualDevice.id());
}
use of org.onosproject.net.topology.TopologyService in project onos by opennetworkinglab.
the class VirtualNetworkTopologyManagerTest method testGetGraph.
/**
* Test getGraph() method.
*/
@Test
public void testGetGraph() {
manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
Topology topology = topologyService.currentTopology();
// test the getGraph() method.
assertNotNull("The graph should not be null.", topologyService.getGraph(topology));
}
use of org.onosproject.net.topology.TopologyService in project onos by opennetworkinglab.
the class VirtualNetworkTopologyManagerTest method testGetClusterDevicesUsingNullCluster.
/**
* Test getClusterDevices() methods with a null cluster.
*/
@Test(expected = NullPointerException.class)
public void testGetClusterDevicesUsingNullCluster() {
VirtualNetwork virtualNetwork = setupVirtualNetworkTopology();
TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
Topology topology = topologyService.currentTopology();
Set<TopologyCluster> clusters = topologyService.getClusters(topology);
// test the getClusterDevices() method using a null cluster.
Object[] objects = clusters.stream().toArray();
assertNotNull("The cluster should not be null.", objects);
Set<DeviceId> clusterDevices = topologyService.getClusterDevices(topology, null);
}
use of org.onosproject.net.topology.TopologyService in project onos by opennetworkinglab.
the class TopologyWebResource method getClusters.
/**
* Gets overview of topology SCCs.
*
* @return 200 OK with topology clusters overview
* @onos.rsModel TopologyClusters
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("clusters")
public Response getClusters() {
TopologyService service = get(TopologyService.class);
Topology topology = service.currentTopology();
Iterable<TopologyCluster> clusters = service.getClusters(topology);
ObjectNode root = encodeArray(TopologyCluster.class, "clusters", clusters);
return ok(root).build();
}
use of org.onosproject.net.topology.TopologyService 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();
}
Aggregations