use of org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.group._case.FlatBatchRemoveGroup in project openflowplugin by opendaylight.
the class SyncPlanPushStrategyFlatBatchImpl method assembleRemoveGroups.
@VisibleForTesting
static int assembleRemoveGroups(final List<Batch> batchBag, int batchOrder, final List<ItemSyncBox<Group>> groupsToRemoveOrUpdate) {
// process group add+update
int order = batchOrder;
if (groupsToRemoveOrUpdate != null) {
for (ItemSyncBox<Group> groupItemSyncBox : groupsToRemoveOrUpdate) {
if (!groupItemSyncBox.getItemsToPush().isEmpty()) {
final List<FlatBatchRemoveGroup> flatBatchRemoveGroupBag = new ArrayList<>(groupItemSyncBox.getItemsToUpdate().size());
int itemOrder = 0;
for (Group group : groupItemSyncBox.getItemsToPush()) {
flatBatchRemoveGroupBag.add(new FlatBatchRemoveGroupBuilder(group).setBatchOrder(itemOrder++).build());
}
final Batch batch = new BatchBuilder().setBatchChoice(new FlatBatchRemoveGroupCaseBuilder().setFlatBatchRemoveGroup(flatBatchRemoveGroupBag).build()).setBatchOrder(order).build();
order += itemOrder;
batchBag.add(batch);
}
}
}
return order;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.group._case.FlatBatchRemoveGroup in project openflowplugin by opendaylight.
the class FlatBatchGroupAdapters method adaptFlatBatchRemoveGroup.
/**
* Adapt flat batch remove group.
* @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.groups.service.rev160315.SalGroupsBatchService#removeGroupsBatch(RemoveGroupsBatchInput)}
*/
public static RemoveGroupsBatchInput adaptFlatBatchRemoveGroup(final BatchPlanStep planStep, final NodeRef node) {
final List<BatchRemoveGroups> batchGroups = new ArrayList<>();
for (FlatBatchRemoveGroup batchRemoveGroup : planStep.<FlatBatchRemoveGroup>getTaskBag()) {
final BatchRemoveGroups removeGroups = new BatchRemoveGroupsBuilder(batchRemoveGroup).setGroupId(batchRemoveGroup.getGroupId()).build();
batchGroups.add(removeGroups);
}
return new RemoveGroupsBatchInputBuilder().setBarrierAfter(planStep.isBarrierAfter()).setNode(node).setBatchRemoveGroups(batchGroups).build();
}
Aggregations