use of org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.remove.meters.batch.input.BatchRemoveMeters in project openflowplugin by opendaylight.
the class SalMetersBatchServiceImpl method removeMetersBatch.
@Override
public Future<RpcResult<RemoveMetersBatchOutput>> removeMetersBatch(final RemoveMetersBatchInput input) {
LOG.trace("Removing meters @ {} : {}", PathUtil.extractNodeId(input.getNode()), input.getBatchRemoveMeters().size());
final ArrayList<ListenableFuture<RpcResult<RemoveMeterOutput>>> resultsLot = new ArrayList<>();
for (BatchRemoveMeters addMeter : input.getBatchRemoveMeters()) {
final RemoveMeterInput removeMeterInput = new RemoveMeterInputBuilder(addMeter).setMeterRef(createMeterRef(input.getNode(), addMeter)).setNode(input.getNode()).build();
resultsLot.add(JdkFutureAdapters.listenInPoolThread(salMeterService.removeMeter(removeMeterInput)));
}
final ListenableFuture<RpcResult<List<BatchFailedMetersOutput>>> commonResult = Futures.transform(Futures.allAsList(resultsLot), MeterUtil.<RemoveMeterOutput>createCumulativeFunction(input.getBatchRemoveMeters()), MoreExecutors.directExecutor());
ListenableFuture<RpcResult<RemoveMetersBatchOutput>> removeMetersBulkFuture = Futures.transform(commonResult, MeterUtil.METER_REMOVE_TRANSFORM, MoreExecutors.directExecutor());
if (input.isBarrierAfter()) {
removeMetersBulkFuture = BarrierUtil.chainBarrier(removeMetersBulkFuture, input.getNode(), transactionService, MeterUtil.METER_REMOVE_COMPOSING_TRANSFORM);
}
return removeMetersBulkFuture;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.remove.meters.batch.input.BatchRemoveMeters in project openflowplugin by opendaylight.
the class FlatBatchMeterAdapters method adaptFlatBatchRemoveMeter.
/**
* Adapt flat batch remove meter.
* @param planStep batch step containing changes of the same type
* @param node pointer for RPC routing
* @return input suitable for {@link org.opendaylight.yang.gen.v1.urn
* .opendaylight.meters.service.rev160316.SalMetersBatchService#removeMetersBatch(RemoveMetersBatchInput)}
*/
public static RemoveMetersBatchInput adaptFlatBatchRemoveMeter(final BatchPlanStep planStep, final NodeRef node) {
final List<BatchRemoveMeters> batchMeters = new ArrayList<>();
for (FlatBatchRemoveMeter batchRemoveMeter : planStep.<FlatBatchRemoveMeter>getTaskBag()) {
final BatchRemoveMeters removeMeters = new BatchRemoveMetersBuilder(batchRemoveMeter).setMeterId(batchRemoveMeter.getMeterId()).build();
batchMeters.add(removeMeters);
}
return new RemoveMetersBatchInputBuilder().setBarrierAfter(planStep.isBarrierAfter()).setNode(node).setBatchRemoveMeters(batchMeters).build();
}
Aggregations