if (!Objects.equals(_idKey, other.getIdKey())) { return false; if (!Objects.equals(_poolName, other.getPoolName())) { return false; if (!Objects.equals(_size, other.getSize())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
public AllocateIdRangeInputBuilder(AllocateIdRangeInput base) { this._idKey = base.getIdKey(); this._poolName = base.getPoolName(); this._size = base.getSize(); if (base instanceof AllocateIdRangeInputImpl) { AllocateIdRangeInputImpl impl = (AllocateIdRangeInputImpl) 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.AllocateIdRangeInput> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdRangeInput>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
@Override public Future<RpcResult<AllocateIdRangeOutput>> allocateIdRange(AllocateIdRangeInput input) { if (LOG.isDebugEnabled()) { LOG.debug("AllocateIdRange called with input {}", input); } String idKey = input.getIdKey(); String poolName = input.getPoolName(); long size = input.getSize(); String localPoolName = IdUtils.getLocalPoolName(poolName); RpcResultBuilder<AllocateIdRangeOutput> allocateIdRangeRpcBuilder; List<Long> newIdValuesList = new ArrayList<>(); AllocateIdRangeOutputBuilder output = new AllocateIdRangeOutputBuilder(); try { newIdValuesList = allocateIdFromLocalPool(poolName, localPoolName, idKey, size); Collections.sort(newIdValuesList); output.setIdValues(newIdValuesList); allocateIdRangeRpcBuilder = RpcResultBuilder.success(); allocateIdRangeRpcBuilder.withResult(output.build()); } catch (NullPointerException e){ LOG.error("Not enough Ids available in the pool {} for requested size {}", poolName, size); allocateIdRangeRpcBuilder = RpcResultBuilder.failed(); allocateIdRangeRpcBuilder.withError(ErrorType.APPLICATION, e.getMessage()); } catch (Exception ex) { LOG.error("Allocate id range in pool {} failed due to {}", poolName, ex); allocateIdRangeRpcBuilder = RpcResultBuilder.failed(); allocateIdRangeRpcBuilder.withError(ErrorType.APPLICATION, ex.getMessage()); } return Futures.immediateFuture(allocateIdRangeRpcBuilder.build()); }