use of org.onosproject.net.topology.Topology in project onos by opennetworkinglab.
the class VirtualNetworkTopologyManagerTest method testGetClusters.
/**
* Test getClusters() method.
*/
@Test
public void testGetClusters() {
VirtualNetwork virtualNetwork = setupVirtualNetworkTopology();
TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
Topology topology = topologyService.currentTopology();
// test the getClusters() method.
assertNotNull("The clusters should not be null.", topologyService.getClusters(topology));
assertEquals("The clusters size did not match.", 2, topologyService.getClusters(topology).size());
}
use of org.onosproject.net.topology.Topology in project onos by opennetworkinglab.
the class VirtualNetworkTopologyManagerTest method testGetClusterUsingNullClusterId.
/**
* Test getCluster() method using a null cluster identifier.
*/
@Test(expected = NullPointerException.class)
public void testGetClusterUsingNullClusterId() {
VirtualNetwork virtualNetwork = setupVirtualNetworkTopology();
TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
Topology topology = topologyService.currentTopology();
Set<TopologyCluster> clusters = topologyService.getClusters(topology);
TopologyCluster cluster = clusters.stream().findFirst().get();
// test the getCluster() method with a null cluster identifier
TopologyCluster cluster1 = topologyService.getCluster(topology, null);
}
use of org.onosproject.net.topology.Topology in project onos by opennetworkinglab.
the class TopologyManagerTest method clusters.
@Test
public void clusters() {
submitTopologyGraph();
Topology topology = service.currentTopology();
assertNotNull("topo expected", topology);
assertEquals("wrong cluster count", 2, topology.clusterCount());
assertEquals("wrong device count", 6, topology.deviceCount());
assertEquals("wrong link count", 10, topology.linkCount());
assertEquals("wrong cluster count", 2, service.getClusters(topology).size());
TopologyCluster cluster = service.getCluster(topology, clusterId(0));
assertEquals("wrong device count", 4, cluster.deviceCount());
assertEquals("wrong device count", 4, service.getClusterDevices(topology, cluster).size());
assertEquals("wrong link count", 8, cluster.linkCount());
assertEquals("wrong link count", 8, service.getClusterLinks(topology, cluster).size());
}
use of org.onosproject.net.topology.Topology in project onos by opennetworkinglab.
the class TopologyManagerTest method precomputedPath.
@Test
public void precomputedPath() {
submitTopologyGraph();
Topology topology = service.currentTopology();
Set<Path> paths = service.getPaths(topology, did("a"), did("c"));
assertEquals("wrong path count", 2, paths.size());
Path path = paths.iterator().next();
assertEquals("wrong path length", 2, path.links().size());
assertEquals("wrong path cost", ScalarWeight.toWeight(2), path.weight());
}
use of org.onosproject.net.topology.Topology in project onos by opennetworkinglab.
the class TopologyManagerTest method basics.
@Test
public void basics() {
Topology topology = service.currentTopology();
assertNull("no topo expected", topology);
submitTopologyGraph();
validateEvents(TOPOLOGY_CHANGED);
topology = service.currentTopology();
assertTrue("should be latest", service.isLatest(topology));
submitTopologyGraph();
validateEvents(TOPOLOGY_CHANGED);
assertFalse("should be latest", service.isLatest(topology));
}
Aggregations