use of org.onosproject.incubator.net.virtual.VirtualNetwork 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());
}
use of org.onosproject.incubator.net.virtual.VirtualNetwork in project onos by opennetworkinglab.
the class VirtualNetworkTopologyManagerTest method testIsInfrastructure.
/**
* Test isInfrastructure() method.
*/
@Test
public void testIsInfrastructure() {
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(), DID4);
ConnectPoint cp1 = new ConnectPoint(srcVirtualDevice.id(), PortNumber.portNumber(1));
ConnectPoint cp2 = new ConnectPoint(dstVirtualDevice.id(), PortNumber.portNumber(2));
// test the isInfrastructure() method.
Boolean isInfrastructure = topologyService.isInfrastructure(topology, cp1);
assertTrue("The connect point should be infrastructure.", isInfrastructure);
isInfrastructure = topologyService.isInfrastructure(topology, cp2);
assertFalse("The connect point should not be infrastructure.", isInfrastructure);
}
use of org.onosproject.incubator.net.virtual.VirtualNetwork in project onos by opennetworkinglab.
the class VirtualNetworkTopologyManagerTest method testGetPaths.
/**
* Test getPaths() and getPaths() by weight methods.
*/
@Test
public void testGetPaths() {
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.
Set<Path> paths = topologyService.getPaths(topology, srcVirtualDevice.id(), dstVirtualDevice.id());
assertNotNull("The paths should not be null.", paths);
assertEquals("The paths size did not match.", 1, paths.size());
// test the getPaths() by weight method.
LinkWeigher weight = new LinkWeigherAdapter(1.0);
Set<Path> paths1 = topologyService.getPaths(topology, srcVirtualDevice.id(), dstVirtualDevice.id(), weight);
assertNotNull("The paths should not be null.", paths1);
assertEquals("The paths size did not match.", 1, paths1.size());
Path path = paths1.iterator().next();
assertEquals("wrong path length", 1, path.links().size());
assertEquals("wrong path cost", ScalarWeight.toWeight(1.0), path.weight());
}
use of org.onosproject.incubator.net.virtual.VirtualNetwork in project onos by opennetworkinglab.
the class VirtualNetworkTopologyManagerTest method testCurrentTopology.
/**
* Tests the currentTopology() method.
*/
@Test
public void testCurrentTopology() {
VirtualNetwork virtualNetwork = setupVirtualNetworkTopology();
TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
Topology topology = topologyService.currentTopology();
assertNotNull("The topology should not be null.", topology);
}
use of org.onosproject.incubator.net.virtual.VirtualNetwork in project onos by opennetworkinglab.
the class VirtualNetworkTopologyManagerTest method testGetClusterLinksUsingNullCluster.
/**
* Test getClusterLinks() methods with a null cluster.
*/
@Test(expected = NullPointerException.class)
public void testGetClusterLinksUsingNullCluster() {
VirtualNetwork virtualNetwork = setupVirtualNetworkTopology();
TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
Topology topology = topologyService.currentTopology();
Set<TopologyCluster> clusters = topologyService.getClusters(topology);
// test the getClusterLinks() method using a null cluster.
Object[] objects = clusters.stream().toArray();
assertNotNull("The cluster should not be null.", objects);
Set<Link> clusterLinks = topologyService.getClusterLinks(topology, null);
}
Aggregations