use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput in project netvirt by opendaylight.
the class DhcpAllocationPoolManager method createIdAllocation.
private long createIdAllocation(String groupIdKey, String idKey) {
AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(groupIdKey).setIdKey(idKey).build();
try {
Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
RpcResult<AllocateIdOutput> rpcResult = result.get();
return rpcResult.getResult().getIdValue();
} catch (NullPointerException | InterruptedException | ExecutionException e) {
LOG.trace("Failed to allocate id for DHCP Allocation Pool Service", e);
}
return 0;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput in project netvirt by opendaylight.
the class ArpResponderUtil method retrieveStandardArpResponderGroupId.
/**
* Uses the IdManager to retrieve ARP Responder GroupId from ELAN pool.
*
* @param idManager
* the id manager
* @return the integer
*/
public static Long retrieveStandardArpResponderGroupId(IdManagerService idManager) {
AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(ArpResponderConstant.ELAN_ID_POOL_NAME.value()).setIdKey(ArpResponderConstant.ARP_RESPONDER_GROUP_ID.value()).build();
try {
Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
RpcResult<AllocateIdOutput> rpcResult = result.get();
if (rpcResult.isSuccessful()) {
LOG.trace("Retrieved Group Id is {}", rpcResult.getResult().getIdValue());
return rpcResult.getResult().getIdValue();
} else {
LOG.warn("RPC Call to Allocate Id returned with Errors {}", rpcResult.getErrors());
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Exception when Allocating Id", e);
}
return 0L;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput in project genius by opendaylight.
the class IfmUtil method allocateId.
public static Integer allocateId(IdManagerService idManager, String poolName, String idKey) {
AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
try {
Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
RpcResult<AllocateIdOutput> rpcResult = result.get();
if (rpcResult.isSuccessful()) {
return rpcResult.getResult().getIdValue().intValue();
} else {
LOG.warn("RPC Call to Get Unique Id returned with Errors {}", rpcResult.getErrors());
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Exception when getting Unique Id", e);
}
return INVALID_ID;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput in project genius by opendaylight.
the class AlivenessMonitor method getUniqueId.
private int getUniqueId(final String idKey) {
AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(AlivenessMonitorConstants.MONITOR_IDPOOL_NAME).setIdKey(idKey).build();
Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
try {
RpcResult<AllocateIdOutput> rpcResult = result.get();
if (rpcResult.isSuccessful()) {
return rpcResult.getResult().getIdValue().intValue();
} else {
LOG.warn("RPC Call to Get Unique Id returned with Errors {}", rpcResult.getErrors());
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Exception when getting Unique Id for key {}", idKey, e);
}
return INVALID_ID;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput in project netvirt by opendaylight.
the class VpnUtil method getUniqueId.
public static int getUniqueId(IdManagerService idManager, String poolName, String idKey) {
AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
try {
Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
RpcResult<AllocateIdOutput> rpcResult = result.get();
if (rpcResult.isSuccessful()) {
return rpcResult.getResult().getIdValue().intValue();
} else {
LOG.error("getUniqueId: RPC Call to Get Unique Id from pool {} with key {} returned with Errors {}", poolName, idKey, rpcResult.getErrors());
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("getUniqueId: Exception when getting Unique Id from pool {} for key {}", poolName, idKey, e);
}
return 0;
}
Aggregations