use of org.onosproject.vpls.config.VplsAppConfig in project onos by opennetworkinglab.
the class VplsStoreTest method testRemoveVpls.
/**
* Removes a VPLS from store; checks if config store is also updated.
*/
@Test
public void testRemoveVpls() {
VplsData vplsData = VplsData.of(VPLS1, VLAN);
vplsStore.addVpls(vplsData);
vplsStore.removeVpls(vplsData);
Collection<VplsData> vplsDataCollection = vplsStore.getAllVpls();
assertEquals(0, vplsDataCollection.size());
VplsAppConfig storedConfig = vplsStore.networkConfigService.getConfig(null, VplsAppConfig.class);
assertNotEquals(-1L, storedConfig.updateTime());
assertEquals(0, storedConfig.vplss().size());
}
use of org.onosproject.vpls.config.VplsAppConfig in project onos by opennetworkinglab.
the class DistributedVplsStore method writeVplsToNetConfig.
/**
* Writes all VPLS data to the network configuration store.
*
* @param vplsDataCollection the VPLSs data
*/
public void writeVplsToNetConfig(Collection<VplsData> vplsDataCollection) {
VplsAppConfig config = networkConfigService.addConfig(appId, VplsAppConfig.class);
if (config == null) {
log.debug("VPLS config is not available now");
return;
}
config.clearVplsConfig();
// Setup update time for this VPLS application configuration
WallClockTimestamp ts = new WallClockTimestamp();
config.updateTime(ts.unixTimestamp());
vplsDataCollection.forEach(vplsData -> {
Set<String> interfaceNames = vplsData.interfaces().stream().map(Interface::name).collect(Collectors.toSet());
VplsConfig vplsConfig = new VplsConfig(vplsData.name(), interfaceNames, vplsData.encapsulationType());
config.addVpls(vplsConfig);
});
networkConfigService.applyConfig(appId, VplsAppConfig.class, config.node());
}
use of org.onosproject.vpls.config.VplsAppConfig in project onos by opennetworkinglab.
the class VplsStoreTest method testAddVpls.
/**
* Adds a VPLS to the store; checks if config store is also updated.
*/
@Test
public void testAddVpls() {
VplsData vplsData = VplsData.of(VPLS1, VLAN);
vplsStore.addVpls(vplsData);
Collection<VplsData> vplsDataCollection = vplsStore.getAllVpls();
assertEquals(1, vplsDataCollection.size());
assertTrue(vplsDataCollection.contains(vplsData));
VplsAppConfig storedConfig = vplsStore.networkConfigService.getConfig(null, VplsAppConfig.class);
assertNotEquals(-1L, storedConfig.updateTime());
assertEquals(1, storedConfig.vplss().size());
VplsConfig vplsConfig = storedConfig.vplss().iterator().next();
assertEquals(VPLS1, vplsConfig.name());
assertEquals(0, vplsConfig.ifaces().size());
assertEquals(VLAN, vplsConfig.encap());
}
use of org.onosproject.vpls.config.VplsAppConfig in project onos by opennetworkinglab.
the class VplsStoreTest method testUpdateVpls.
/**
* Updates a VPLS from store; checks if config store is also updated.
*/
@Test
public void testUpdateVpls() {
VplsData vplsData = VplsData.of(VPLS1, VLAN);
vplsStore.addVpls(vplsData);
vplsData.addInterface(V100H1);
vplsData.addInterface(V100H2);
vplsStore.updateVpls(vplsData);
Collection<VplsData> vplsDataCollection = vplsStore.getAllVpls();
assertEquals(1, vplsDataCollection.size());
VplsData newVplsData = vplsDataCollection.iterator().next();
assertEquals(vplsData, newVplsData);
VplsAppConfig storedConfig = vplsStore.networkConfigService.getConfig(null, VplsAppConfig.class);
assertNotEquals(-1L, storedConfig.updateTime());
assertEquals(1, storedConfig.vplss().size());
VplsConfig vplsConfig = storedConfig.vplss().iterator().next();
assertEquals(VPLS1, vplsConfig.name());
assertEquals(2, vplsConfig.ifaces().size());
assertTrue(vplsConfig.ifaces().contains(V100H1.name()));
assertTrue(vplsConfig.ifaces().contains(V100H2.name()));
assertEquals(VLAN, vplsConfig.encap());
}
Aggregations