Search in sources :

Example 21 with TopologyService

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

Example 22 with TopologyService

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

the class VirtualNetworkTopologyManagerTest method testGetDisjointPathsUsingNullWeight.

/**
 * Test getDisjointPaths() methods using a null weight.
 */
@Test(expected = NullPointerException.class)
public void testGetDisjointPathsUsingNullWeight() {
    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 weight.
    Set<DisjointPath> paths = topologyService.getDisjointPaths(topology, srcVirtualDevice.id(), dstVirtualDevice.id(), (LinkWeigher) null);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) Topology(org.onosproject.net.topology.Topology) DisjointPath(org.onosproject.net.DisjointPath) TopologyService(org.onosproject.net.topology.TopologyService) Test(org.junit.Test)

Example 23 with TopologyService

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

Example 24 with TopologyService

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

the class VirtualNetworkTopologyManagerTest method testGetPathsUsingNullSrcDeviceId.

/**
 * Test getPaths() method using a null src device identifier.
 */
@Test(expected = NullPointerException.class)
public void testGetPathsUsingNullSrcDeviceId() {
    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 getPaths() method using a null src device identifier.
    Set<Path> paths = topologyService.getPaths(topology, null, dstVirtualDevice.id());
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) Path(org.onosproject.net.Path) DisjointPath(org.onosproject.net.DisjointPath) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) Topology(org.onosproject.net.topology.Topology) TopologyService(org.onosproject.net.topology.TopologyService) Test(org.junit.Test)

Example 25 with TopologyService

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

the class VirtualNetworkTopologyManagerTest method testIsLatestByNullTopology.

/**
 * Test isLatest() method using a null topology.
 */
@Test(expected = NullPointerException.class)
public void testIsLatestByNullTopology() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
    // test the isLatest() method with a null topology.
    topologyService.isLatest(null);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) TopologyService(org.onosproject.net.topology.TopologyService) Test(org.junit.Test)

Aggregations

TopologyService (org.onosproject.net.topology.TopologyService)30 Topology (org.onosproject.net.topology.Topology)25 VirtualNetwork (org.onosproject.incubator.net.virtual.VirtualNetwork)24 Test (org.junit.Test)23 VirtualDevice (org.onosproject.incubator.net.virtual.VirtualDevice)13 DisjointPath (org.onosproject.net.DisjointPath)9 TopologyCluster (org.onosproject.net.topology.TopologyCluster)8 VirtualLink (org.onosproject.incubator.net.virtual.VirtualLink)5 ConnectPoint (org.onosproject.net.ConnectPoint)4 Path (org.onosproject.net.Path)4 DeviceId (org.onosproject.net.DeviceId)3 Link (org.onosproject.net.Link)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 Before (org.junit.Before)2 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)2 LinkWeigher (org.onosproject.net.topology.LinkWeigher)2 LinkWeigherAdapter (org.onosproject.net.topology.LinkWeigherAdapter)2