use of org.onosproject.net.config.NetworkConfigEvent in project onos by opennetworkinglab.
the class VplsConfigManagerTest method testReloadConfig.
/**
* Reloads network configuration by sending a network config event.
*/
@Test
public void testReloadConfig() {
NetworkConfigEvent event = new NetworkConfigEvent(NetworkConfigEvent.Type.CONFIG_ADDED, null, VplsAppConfig.class);
((TestConfigService) vplsConfigManager.configService).sendEvent(event);
Collection<VplsData> vplss = vplsConfigManager.vpls.getAllVpls();
assertEquals(2, vplss.size());
VplsData expect = VplsData.of(VPLS1);
expect.addInterfaces(ImmutableSet.of(V100H1, V100H2));
expect.state(VplsData.VplsState.ADDED);
assertTrue(vplss.contains(expect));
expect = VplsData.of(VPLS2, EncapsulationType.VLAN);
expect.addInterfaces(ImmutableSet.of(V200H1, V200H2));
expect.state(VplsData.VplsState.ADDED);
System.out.println(vplss);
assertTrue(vplss.contains(expect));
}
use of org.onosproject.net.config.NetworkConfigEvent in project fabric-tna by stratum.
the class IntManagerTest method testUpdateIntConfig.
/**
* Test updating the INT configuration with the config listener.
*/
@Test
public void testUpdateIntConfig() {
testActivateWithoutConfig();
NetworkConfigListener listener = intConfigListener.getValue();
CompletableFuture<Void> completableFuture = new CompletableFuture<>();
reset(intProgrammable);
expect(intProgrammable.setUpIntConfig(INT_CONFIG_2)).andAnswer(() -> {
completableFuture.complete(null);
return true;
}).once();
replay(intProgrammable);
NetworkConfigEvent event = new NetworkConfigEvent(NetworkConfigEvent.Type.CONFIG_UPDATED, APP_ID, INT_CONFIG_2, INT_CONFIG_1, IntReportConfig.class);
assertTrue(listener.isRelevant(event));
listener.event(event);
try {
completableFuture.get(1, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
fail("Didn't get expected call within 1 second.");
}
verifyAll();
}
use of org.onosproject.net.config.NetworkConfigEvent in project fabric-tna by stratum.
the class IntManagerTest method testUpdateSrConfig.
/**
* Test updating the segment routing device configuration with the config listener.
*/
@Test
public void testUpdateSrConfig() {
testActivateWithoutConfig();
NetworkConfigListener listener = srConfigListener.getValue();
CompletableFuture<Void> completableFuture = new CompletableFuture<>();
reset(intProgrammable, netcfgService, deviceService, mastershipService);
expect(netcfgService.getConfig(APP_ID, IntReportConfig.class)).andReturn(INT_CONFIG_1).anyTimes();
expect(intProgrammable.setUpIntConfig(INT_CONFIG_1)).andAnswer(() -> {
completableFuture.complete(null);
return true;
}).once();
expect(deviceService.getDevice(DEVICE_ID_1)).andReturn(mockDevice).anyTimes();
expect(deviceService.isAvailable(DEVICE_ID_1)).andReturn(true).anyTimes();
expect(mastershipService.isLocalMaster(DEVICE_ID_1)).andReturn(true).anyTimes();
replay(intProgrammable, netcfgService, deviceService, mastershipService);
NetworkConfigEvent event = new NetworkConfigEvent(NetworkConfigEvent.Type.CONFIG_ADDED, APP_ID, SR_CONFIG_1, null, SegmentRoutingDeviceConfig.class);
assertTrue(listener.isRelevant(event));
listener.event(event);
try {
completableFuture.get(1, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
fail("Didn't get expected call within 1 second.");
}
verifyAll();
}
Aggregations