use of org.onosproject.net.topology.TopologyService in project onos by opennetworkinglab.
the class VirtualNetworkTopologyProviderTest method setUp.
@Before
public void setUp() throws Exception {
virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
coreService = new VirtualNetworkTopologyProviderTest.TestCoreService();
TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService());
virtualNetworkManagerStore.activate();
manager = new VirtualNetworkManager();
TestUtils.setField(manager, "coreService", coreService);
TestUtils.setField(manager, "store", virtualNetworkManagerStore);
TestUtils.setField(manager, "intentService", intentService);
NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher());
testDirectory = new TestServiceDirectory();
TestUtils.setField(manager, "serviceDirectory", testDirectory);
manager.activate();
manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
topologyProvider = new DefaultVirtualNetworkProvider();
topologyProvider.topologyService = topologyService;
topologyProvider.providerRegistry = virtualNetworkRegistry;
topologyProvider.activate();
setupVirtualNetworkTopology();
changed = new Semaphore(0, true);
}
use of org.onosproject.net.topology.TopologyService in project onos by opennetworkinglab.
the class VirtualNetworkTopologyManagerTest method testGetDisjointPaths.
/**
* Test getDisjointPaths() methods.
*/
@Test
public void testGetDisjointPaths() {
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.
Set<DisjointPath> paths = topologyService.getDisjointPaths(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 getDisjointPaths() method using a weight.
LinkWeigher weight = new LinkWeigherAdapter(1.0);
Set<DisjointPath> paths1 = topologyService.getDisjointPaths(topology, srcVirtualDevice.id(), dstVirtualDevice.id(), weight);
assertNotNull("The paths should not be null.", paths1);
assertEquals("The paths size did not match.", 1, paths1.size());
}
use of org.onosproject.net.topology.TopologyService 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.TopologyService 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.TopologyService in project onos by opennetworkinglab.
the class VirtualNetworkTopologyManagerTest method testGetPathsUsingNullWeight.
/**
* Test getPaths() method using a null weight.
*/
@Test(expected = NullPointerException.class)
public void testGetPathsUsingNullWeight() {
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 weight.
Set<Path> paths = topologyService.getPaths(topology, srcVirtualDevice.id(), dstVirtualDevice.id(), (LinkWeigher) null);
}
Aggregations