Search in sources :

Example 16 with TopologyService

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

the class VirtualNetworkTopologyManagerTest method testIsBroadcastPoint.

/**
 * Test isBroadcastPoint() method.
 */
@Test
public void testIsBroadcastPoint() {
    VirtualNetwork virtualNetwork = setupVirtualNetworkTopology();
    TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
    Topology topology = topologyService.currentTopology();
    VirtualDevice srcVirtualDevice = getVirtualDevice(virtualNetwork.id(), DID1);
    ConnectPoint cp = new ConnectPoint(srcVirtualDevice.id(), PortNumber.portNumber(1));
    // test the isBroadcastPoint() method.
    Boolean isBroadcastPoint = topologyService.isBroadcastPoint(topology, cp);
    assertTrue("The connect point should be a broadcast point.", isBroadcastPoint);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) Topology(org.onosproject.net.topology.Topology) ConnectPoint(org.onosproject.net.ConnectPoint) TopologyService(org.onosproject.net.topology.TopologyService) Test(org.junit.Test)

Example 17 with TopologyService

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

the class VirtualNetworkTopologyManagerTest method testGetClusterDevicesLinks.

/**
 * Test getClusterDevices() and getClusterLinks() methods.
 */
@Test
public void testGetClusterDevicesLinks() {
    VirtualNetwork virtualNetwork = setupVirtualNetworkTopology();
    TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
    Topology topology = topologyService.currentTopology();
    Set<TopologyCluster> clusters = topologyService.getClusters(topology);
    assertNotNull("The clusters should not be null.", clusters);
    assertEquals("The clusters size did not match.", 2, clusters.size());
    // test the getClusterDevices() method.
    Object[] objects = clusters.stream().toArray();
    assertNotNull("The cluster should not be null.", objects);
    Set<DeviceId> clusterDevices = topologyService.getClusterDevices(topology, (TopologyCluster) objects[0]);
    assertNotNull("The devices should not be null.", clusterDevices);
    assertEquals("The devices size did not match.", 3, clusterDevices.size());
    Set<DeviceId> clusterDevices1 = topologyService.getClusterDevices(topology, (TopologyCluster) objects[1]);
    assertNotNull("The devices should not be null.", clusterDevices1);
    assertEquals("The devices size did not match.", 1, clusterDevices1.size());
    // test the getClusterLinks() method.
    Set<Link> clusterLinks = topologyService.getClusterLinks(topology, (TopologyCluster) objects[0]);
    assertNotNull("The links should not be null.", clusterLinks);
    assertEquals("The links size did not match.", 6, clusterLinks.size());
    Set<Link> clusterLinks1 = topologyService.getClusterLinks(topology, (TopologyCluster) objects[1]);
    assertNotNull("The links should not be null.", clusterLinks1);
    assertEquals("The links size did not match.", 0, clusterLinks1.size());
}
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) Link(org.onosproject.net.Link) VirtualLink(org.onosproject.incubator.net.virtual.VirtualLink) TopologyService(org.onosproject.net.topology.TopologyService) Test(org.junit.Test)

Example 18 with TopologyService

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

the class VirtualNetworkTopologyManagerTest method testGetDisjointPathsUsingNullRiskProfile.

/**
 * Test getDisjointPaths() methods using a null risk profile.
 */
@Test(expected = NullPointerException.class)
public void testGetDisjointPathsUsingNullRiskProfile() {
    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 risk profile.
    Set<DisjointPath> paths = topologyService.getDisjointPaths(topology, srcVirtualDevice.id(), dstVirtualDevice.id(), (Map<Link, Object>) 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) Link(org.onosproject.net.Link) VirtualLink(org.onosproject.incubator.net.virtual.VirtualLink) TopologyService(org.onosproject.net.topology.TopologyService) Test(org.junit.Test)

Example 19 with TopologyService

use of org.onosproject.net.topology.TopologyService 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);
}
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 20 with TopologyService

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

the class VirtualNetworkTopologyManagerTest method testIsBroadcastUsingNullConnectPoint.

/**
 * Test isBroadcastPoint() method using a null connect point.
 */
@Test(expected = NullPointerException.class)
public void testIsBroadcastUsingNullConnectPoint() {
    VirtualNetwork virtualNetwork = setupVirtualNetworkTopology();
    TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
    Topology topology = topologyService.currentTopology();
    // test the isInfrastructure() method using a null connect point.
    Boolean isInfrastructure = topologyService.isBroadcastPoint(topology, null);
}
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)

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