if (!Objects.equals(_idKey, other.getIdKey())) { return false; if (!Objects.equals(_poolName, other.getPoolName())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
public AllocateIdInputBuilder(AllocateIdInput base) { this._idKey = base.getIdKey(); this._poolName = base.getPoolName(); if (base instanceof AllocateIdInputImpl) { AllocateIdInputImpl impl = (AllocateIdInputImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
@Override public Future<RpcResult<AllocateIdOutput>> allocateId(AllocateIdInput input) { if (LOG.isDebugEnabled()) { LOG.debug("AllocateId called with input {}", input); } String idKey = input.getIdKey(); String poolName = input.getPoolName(); String localPoolName = IdUtils.getLocalPoolName(poolName); RpcResultBuilder<AllocateIdOutput> allocateIdRpcBuilder; long newIdValue = -1; AllocateIdOutputBuilder output = new AllocateIdOutputBuilder(); try { //allocateIdFromLocalPool method returns a list of IDs with one element. This element is obtatined by get(0) newIdValue = allocateIdFromLocalPool(poolName, localPoolName, idKey, 1).get(0); output.setIdValue(newIdValue); allocateIdRpcBuilder = RpcResultBuilder.success(); allocateIdRpcBuilder.withResult(output.build()); } catch (Exception ex) { LOG.error("Allocate id in pool {} failed due to {}", poolName, ex); allocateIdRpcBuilder = RpcResultBuilder.failed(); allocateIdRpcBuilder.withError(ErrorType.APPLICATION, ex.getMessage()); } return Futures.immediateFuture(allocateIdRpcBuilder.build()); }