use of org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.meter._case.FlatBatchRemoveMeter 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.meter._case.FlatBatchRemoveMeter in project openflowplugin by opendaylight.
the class SyncPlanPushStrategyFlatBatchImpl method assembleRemoveMeters.
@VisibleForTesting
static int assembleRemoveMeters(final List<Batch> batchBag, int batchOrder, final ItemSyncBox<Meter> meterItemSyncBox) {
// process meter remove
int order = batchOrder;
if (meterItemSyncBox != null && !meterItemSyncBox.getItemsToPush().isEmpty()) {
final List<FlatBatchRemoveMeter> flatBatchRemoveMeterBag = new ArrayList<>(meterItemSyncBox.getItemsToUpdate().size());
int itemOrder = 0;
for (Meter meter : meterItemSyncBox.getItemsToPush()) {
flatBatchRemoveMeterBag.add(new FlatBatchRemoveMeterBuilder(meter).setBatchOrder(itemOrder++).build());
}
final Batch batch = new BatchBuilder().setBatchChoice(new FlatBatchRemoveMeterCaseBuilder().setFlatBatchRemoveMeter(flatBatchRemoveMeterBag).build()).setBatchOrder(order).build();
order += itemOrder;
batchBag.add(batch);
}
return order;
}
Aggregations