use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder in project openflowplugin by opendaylight.
the class SalMeterServiceImplTest method updateMeter.
private void updateMeter() throws Exception {
final UpdatedMeter dummyUpdatedMeter = new UpdatedMeterBuilder().setMeterId(new MeterId(DUMMY_METTER_ID)).build();
final OriginalMeter dummyOriginalMeter = new OriginalMeterBuilder().setMeterId(new MeterId(DUMMY_METTER_ID)).build();
final UpdateMeterInput updateMeterInput = new UpdateMeterInputBuilder().setUpdatedMeter(dummyUpdatedMeter).setOriginalMeter(dummyOriginalMeter).build();
this.<AddMeterOutput>mockSuccessfulFuture();
salMeterService.updateMeter(updateMeterInput);
verify(mockedRequestContextStack).createRequestContext();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder in project openflowplugin by opendaylight.
the class MeterForwarder method update.
@Override
public void update(final InstanceIdentifier<Meter> identifier, final Meter original, final Meter update, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
final UpdateMeterInputBuilder builder = new UpdateMeterInputBuilder();
builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
builder.setMeterRef(new MeterRef(identifier));
builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
builder.setUpdatedMeter(new UpdatedMeterBuilder(update).build());
builder.setOriginalMeter(new OriginalMeterBuilder(original).build());
final Future<RpcResult<UpdateMeterOutput>> resultFuture = this.provider.getSalMeterService().updateMeter(builder.build());
JdkFutures.addErrorLogging(resultFuture, LOG, "updateMeter");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder in project openflowplugin by opendaylight.
the class MeterForwarder method update.
@Override
public Future<RpcResult<UpdateMeterOutput>> update(final InstanceIdentifier<Meter> identifier, final Meter original, final Meter update, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
LOG.trace("Received the Meter UPDATE request [Tbl id, node Id {} {} {}", identifier, nodeIdent, update);
final UpdateMeterInputBuilder builder = new UpdateMeterInputBuilder();
builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
builder.setMeterRef(new MeterRef(identifier));
builder.setUpdatedMeter(new UpdatedMeterBuilder(update).build());
builder.setOriginalMeter(new OriginalMeterBuilder(original).build());
return salMeterService.updateMeter(builder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder in project openflowplugin by opendaylight.
the class SalMetersBatchServiceImpl method updateMetersBatch.
@Override
public Future<RpcResult<UpdateMetersBatchOutput>> updateMetersBatch(final UpdateMetersBatchInput input) {
final List<BatchUpdateMeters> batchUpdateMeters = input.getBatchUpdateMeters();
LOG.trace("Updating meters @ {} : {}", PathUtil.extractNodeId(input.getNode()), batchUpdateMeters.size());
final ArrayList<ListenableFuture<RpcResult<UpdateMeterOutput>>> resultsLot = new ArrayList<>();
for (BatchUpdateMeters batchMeter : batchUpdateMeters) {
final UpdateMeterInput updateMeterInput = new UpdateMeterInputBuilder(input).setOriginalMeter(new OriginalMeterBuilder(batchMeter.getOriginalBatchedMeter()).build()).setUpdatedMeter(new UpdatedMeterBuilder(batchMeter.getUpdatedBatchedMeter()).build()).setMeterRef(createMeterRef(input.getNode(), batchMeter)).setNode(input.getNode()).build();
resultsLot.add(JdkFutureAdapters.listenInPoolThread(salMeterService.updateMeter(updateMeterInput)));
}
final Iterable<Meter> meters = batchUpdateMeters.stream().map(BatchMeterInputUpdateGrouping::getUpdatedBatchedMeter).collect(Collectors.toList());
final ListenableFuture<RpcResult<List<BatchFailedMetersOutput>>> commonResult = Futures.transform(Futures.allAsList(resultsLot), MeterUtil.<UpdateMeterOutput>createCumulativeFunction(meters, batchUpdateMeters.size()), MoreExecutors.directExecutor());
ListenableFuture<RpcResult<UpdateMetersBatchOutput>> updateMetersBulkFuture = Futures.transform(commonResult, MeterUtil.METER_UPDATE_TRANSFORM, MoreExecutors.directExecutor());
if (input.isBarrierAfter()) {
updateMetersBulkFuture = BarrierUtil.chainBarrier(updateMetersBulkFuture, input.getNode(), transactionService, MeterUtil.METER_UPDATE_COMPOSING_TRANSFORM);
}
return updateMetersBulkFuture;
}
Aggregations