use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.ip.pools.VtepIpPool in project genius by opendaylight.
the class VtepConfigSchemaListener method processAvailableIps.
/**
* Calculate available IPs from the subnet mask specified in the schema.
* Pushes the available and allocated IP address to config DS.
*
* @param schema
* the schema
*/
private VtepIpPool processAvailableIps(final VtepConfigSchema schema) {
String subnetCidr = ItmUtils.getSubnetCidrAsString(schema.getSubnet());
SubnetUtils subnetUtils = new SubnetUtils(subnetCidr);
List<IpAddress> availableIps = calculateAvailableIps(subnetUtils, schema.getExcludeIpFilter(), schema.getGatewayIp());
VtepIpPool vtepIpPool = new VtepIpPoolBuilder().setSubnetCidr(subnetCidr).setAvailableIpaddress(availableIps).setAllocatedIpaddress(new ArrayList<>()).build();
MDSALUtil.syncWrite(this.dataBroker, LogicalDatastoreType.CONFIGURATION, ItmUtils.getVtepIpPoolIdentifier(subnetCidr), vtepIpPool);
LOG.info("Vtep IP Pool with key:{} added to config DS", subnetCidr);
return vtepIpPool;
}
Aggregations