use of org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.batch.flow.input.update.grouping.OriginalBatchedFlowBuilder in project openflowplugin by opendaylight.
the class SalFlowsBatchServiceImplTest method createEmptyBatchUpdateFlow.
private static BatchUpdateFlows createEmptyBatchUpdateFlow(final String flowIdValue, final int priority) {
final BatchAddFlows emptyOriginalFlow = createEmptyBatchAddFlow(flowIdValue, priority);
final BatchAddFlows emptyUpdatedFlow = createEmptyBatchAddFlow(flowIdValue, priority + 1);
return new BatchUpdateFlowsBuilder().setFlowId(new FlowId(flowIdValue)).setOriginalBatchedFlow(new OriginalBatchedFlowBuilder(emptyOriginalFlow).build()).setUpdatedBatchedFlow(new UpdatedBatchedFlowBuilder(emptyUpdatedFlow).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.batch.flow.input.update.grouping.OriginalBatchedFlowBuilder in project openflowplugin by opendaylight.
the class SyncPlanPushStrategyFlatBatchImpl method assembleAddOrUpdateFlows.
@VisibleForTesting
static int assembleAddOrUpdateFlows(final List<Batch> batchBag, int batchOrder, final Map<TableKey, ItemSyncBox<Flow>> flowItemSyncTableMap) {
// process flow add+update
int order = batchOrder;
if (flowItemSyncTableMap != null) {
for (Map.Entry<TableKey, ItemSyncBox<Flow>> syncBoxEntry : flowItemSyncTableMap.entrySet()) {
final ItemSyncBox<Flow> flowItemSyncBox = syncBoxEntry.getValue();
if (!flowItemSyncBox.getItemsToPush().isEmpty()) {
final List<FlatBatchAddFlow> flatBatchAddFlowBag = new ArrayList<>(flowItemSyncBox.getItemsToUpdate().size());
int itemOrder = 0;
for (Flow flow : flowItemSyncBox.getItemsToPush()) {
flatBatchAddFlowBag.add(new FlatBatchAddFlowBuilder(flow).setBatchOrder(itemOrder++).setFlowId(flow.getId()).build());
}
final Batch batch = new BatchBuilder().setBatchChoice(new FlatBatchAddFlowCaseBuilder().setFlatBatchAddFlow(flatBatchAddFlowBag).build()).setBatchOrder(order).build();
order += itemOrder;
batchBag.add(batch);
}
if (!flowItemSyncBox.getItemsToUpdate().isEmpty()) {
final List<FlatBatchUpdateFlow> flatBatchUpdateFlowBag = new ArrayList<>(flowItemSyncBox.getItemsToUpdate().size());
int itemOrder = 0;
for (ItemSyncBox.ItemUpdateTuple<Flow> flowUpdate : flowItemSyncBox.getItemsToUpdate()) {
flatBatchUpdateFlowBag.add(new FlatBatchUpdateFlowBuilder().setBatchOrder(itemOrder++).setFlowId(flowUpdate.getUpdated().getId()).setOriginalBatchedFlow(new OriginalBatchedFlowBuilder(flowUpdate.getOriginal()).build()).setUpdatedBatchedFlow(new UpdatedBatchedFlowBuilder(flowUpdate.getUpdated()).build()).build());
}
final Batch batch = new BatchBuilder().setBatchChoice(new FlatBatchUpdateFlowCaseBuilder().setFlatBatchUpdateFlow(flatBatchUpdateFlowBag).build()).setBatchOrder(order).build();
order += itemOrder;
batchBag.add(batch);
}
}
}
return order;
}
Aggregations