use of org.onosproject.incubator.net.virtual.provider.VirtualNetworkProviderService in project onos by opennetworkinglab.
the class VirtualNetworkManagerTest method testTopologyChanged.
/**
* Test the topologyChanged() method.
*/
@Test
public void testTopologyChanged() {
VirtualNetwork virtualNetwork = setupVirtualNetworkTopology(tenantIdValue1);
VirtualNetworkProviderService providerService = manager.createProviderService(topologyProvider);
// Initial setup is two clusters of devices/links.
assertEquals("The cluster count did not match.", 2, topologyService.currentTopology().clusterCount());
// Adding this link will join the two clusters together.
List<Event> reasons = new ArrayList<>();
VirtualLink link = manager.createVirtualLink(virtualNetwork.id(), cp6, cp7);
virtualNetworkManagerStore.updateLink(link, link.tunnelId(), Link.State.ACTIVE);
VirtualLink link2 = manager.createVirtualLink(virtualNetwork.id(), cp7, cp6);
virtualNetworkManagerStore.updateLink(link2, link2.tunnelId(), Link.State.ACTIVE);
Topology topology = topologyService.currentTopology();
providerService.topologyChanged(topologyProvider.getConnectPoints(topology));
// Validate that all links are still active.
manager.getVirtualLinks(virtualNetwork.id()).forEach(virtualLink -> {
assertTrue("The virtual link should be active.", virtualLink.state().equals(Link.State.ACTIVE));
});
virtualNetworkManagerStore.updateLink(link, link.tunnelId(), Link.State.INACTIVE);
virtualNetworkManagerStore.updateLink(link2, link2.tunnelId(), Link.State.INACTIVE);
providerService.topologyChanged(topologyProvider.getConnectPoints(topology));
// Validate that all links are active again.
manager.getVirtualLinks(virtualNetwork.id()).forEach(virtualLink -> {
assertTrue("The virtual link should be active.", virtualLink.state().equals(Link.State.ACTIVE));
});
}
Aggregations