use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool in project netvirt by opendaylight.
the class StatisticsImpl method createIdPool.
private void createIdPool() {
if (checkPoolExists()) {
return;
}
CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(CountersServiceUtils.COUNTERS_PULL_NAME).setLow(CountersServiceUtils.COUNTERS_PULL_START).setHigh(CountersServiceUtils.COUNTERS_PULL_START + CountersServiceUtils.COUNTERS_PULL_END).build();
Future<RpcResult<Void>> result = idManagerService.createIdPool(createPool);
Futures.addCallback(JdkFutureAdapters.listenInPoolThread(result), new FutureCallback<RpcResult<Void>>() {
@Override
public void onFailure(Throwable error) {
LOG.error("Failed to create idPool for Aliveness Monitor Service", error);
}
@Override
public void onSuccess(@Nonnull RpcResult<Void> rpcResult) {
if (rpcResult.isSuccessful()) {
LOG.debug("Created IdPool for tap");
} else {
LOG.error("RPC to create Idpool failed {}", rpcResult.getErrors());
}
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool in project netvirt by opendaylight.
the class NatOverVxlanUtil method getIdPoolInstance.
private static InstanceIdentifier<IdPool> getIdPoolInstance(String poolName) {
InstanceIdentifier.InstanceIdentifierBuilder<IdPool> idPoolBuilder = InstanceIdentifier.builder(IdPools.class).child(IdPool.class, new IdPoolKey(poolName));
InstanceIdentifier<IdPool> id = idPoolBuilder.build();
return id;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool in project netvirt by opendaylight.
the class DhcpAllocationPoolManager method createIdAllocationPool.
protected void createIdAllocationPool(String networkId, AllocationPool pool) {
String poolName = getPoolKeyIdByAllocationPool(networkId, pool);
long low = DhcpServiceUtils.convertIpToLong(pool.getAllocateFrom());
long high = DhcpServiceUtils.convertIpToLong(pool.getAllocateTo());
CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(poolName).setLow(low).setHigh(high).build();
try {
Future<RpcResult<Void>> result = idManager.createIdPool(createPool);
if (result != null && result.get().isSuccessful()) {
LOG.info("DHCP Allocation Pool Service : Created IdPool name {}", poolName);
} else {
LOG.error("DHCP Allocation Pool Service : Unable to create IdPool name {}", poolName);
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Failed to create Pool for DHCP Allocation Pool Service", e);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool in project netvirt by opendaylight.
the class DhcpAllocationPoolManager method releaseIdAllocationPool.
protected void releaseIdAllocationPool(String networkId, AllocationPool pool) {
String poolName = getPoolKeyIdByAllocationPool(networkId, pool);
DeleteIdPoolInput deletePool = new DeleteIdPoolInputBuilder().setPoolName(poolName).build();
try {
Future<RpcResult<Void>> result = idManager.deleteIdPool(deletePool);
if (result != null && result.get().isSuccessful()) {
LOG.info("DHCP Allocation Pool Service : Deleted IdPool name {}", poolName);
} else {
LOG.error("DHCP Allocation Pool Service : Unable to delete IdPool name {}", poolName);
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Failed to delete Pool for DHCP Allocation Pool Service", e);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.id.pools.IdPool in project genius by opendaylight.
the class AlivenessMonitor method createIdPool.
private void createIdPool() {
CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(AlivenessMonitorConstants.MONITOR_IDPOOL_NAME).setLow(AlivenessMonitorConstants.MONITOR_IDPOOL_START).setHigh(AlivenessMonitorConstants.MONITOR_IDPOOL_SIZE).build();
Future<RpcResult<Void>> resultFuture = idManager.createIdPool(createPool);
Futures.addCallback(JdkFutureAdapters.listenInPoolThread(resultFuture), new FutureCallback<RpcResult<Void>>() {
@Override
public void onFailure(Throwable error) {
LOG.error("Failed to create idPool for Aliveness Monitor Service", error);
}
@Override
public void onSuccess(@Nonnull RpcResult<Void> result) {
if (result.isSuccessful()) {
LOG.debug("Created IdPool for Aliveness Monitor Service");
} else {
LOG.error("RPC to create Idpool failed {}", result.getErrors());
}
}
}, callbackExecutorService);
}
Aggregations