use of org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.update.flows.batch.input.BatchUpdateFlows 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.update.flows.batch.input.BatchUpdateFlows in project openflowplugin by opendaylight.
the class FlatBatchFlowAdapters method adaptFlatBatchUpdateFlow.
/**
* Adapt flat batch update flow.
* @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.flows.service.rev160314.SalFlowsBatchService#updateFlowsBatch(UpdateFlowsBatchInput)}
*/
public static UpdateFlowsBatchInput adaptFlatBatchUpdateFlow(final BatchPlanStep planStep, final NodeRef node) {
final List<BatchUpdateFlows> batchFlows = new ArrayList<>();
for (FlatBatchUpdateFlow batchUpdateFlow : planStep.<FlatBatchUpdateFlow>getTaskBag()) {
final BatchUpdateFlows updateFlows = new BatchUpdateFlowsBuilder(batchUpdateFlow).build();
batchFlows.add(updateFlows);
}
return new UpdateFlowsBatchInputBuilder().setBarrierAfter(planStep.isBarrierAfter()).setNode(node).setBatchUpdateFlows(batchFlows).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.update.flows.batch.input.BatchUpdateFlows in project openflowplugin by opendaylight.
the class SalFlowsBatchServiceImpl method updateFlowsBatch.
@Override
public Future<RpcResult<UpdateFlowsBatchOutput>> updateFlowsBatch(final UpdateFlowsBatchInput input) {
LOG.trace("Updating flows @ {} : {}", PathUtil.extractNodeId(input.getNode()), input.getBatchUpdateFlows().size());
final ArrayList<ListenableFuture<RpcResult<UpdateFlowOutput>>> resultsLot = new ArrayList<>();
for (BatchUpdateFlows batchFlow : input.getBatchUpdateFlows()) {
final UpdateFlowInput updateFlowInput = new UpdateFlowInputBuilder(input).setOriginalFlow(new OriginalFlowBuilder(batchFlow.getOriginalBatchedFlow()).build()).setUpdatedFlow(new UpdatedFlowBuilder(batchFlow.getUpdatedBatchedFlow()).build()).setFlowRef(createFlowRef(input.getNode(), batchFlow)).setNode(input.getNode()).build();
resultsLot.add(JdkFutureAdapters.listenInPoolThread(salFlowService.updateFlow(updateFlowInput)));
}
final ListenableFuture<RpcResult<List<BatchFailedFlowsOutput>>> commonResult = Futures.transform(Futures.successfulAsList(resultsLot), FlowUtil.<UpdateFlowOutput>createCumulatingFunction(input.getBatchUpdateFlows()), MoreExecutors.directExecutor());
ListenableFuture<RpcResult<UpdateFlowsBatchOutput>> updateFlowsBulkFuture = Futures.transform(commonResult, FlowUtil.FLOW_UPDATE_TRANSFORM, MoreExecutors.directExecutor());
if (input.isBarrierAfter()) {
updateFlowsBulkFuture = BarrierUtil.chainBarrier(updateFlowsBulkFuture, input.getNode(), transactionService, FlowUtil.FLOW_UPDATE_COMPOSING_TRANSFORM);
}
return updateFlowsBulkFuture;
}
Aggregations