use of org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RemoveFlowsRpcInput in project openflowplugin by opendaylight.
the class SalBulkFlowServiceImpl method removeFlowsRpc.
@Override
public Future<RpcResult<Void>> removeFlowsRpc(RemoveFlowsRpcInput input) {
List<ListenableFuture<RpcResult<RemoveFlowOutput>>> bulkResults = new ArrayList<>();
for (BulkFlowBaseContentGrouping bulkFlow : input.getBulkFlowItem()) {
RemoveFlowInputBuilder flowInputBuilder = new RemoveFlowInputBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow) bulkFlow);
final NodeRef nodeRef = bulkFlow.getNode();
flowInputBuilder.setNode(nodeRef);
flowInputBuilder.setTableId(bulkFlow.getTableId());
Future<RpcResult<RemoveFlowOutput>> rpcAddFlowResult = flowService.removeFlow(flowInputBuilder.build());
bulkResults.add(JdkFutureAdapters.listenInPoolThread(rpcAddFlowResult));
}
return handleResultFuture(Futures.allAsList(bulkResults));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RemoveFlowsRpcInput in project openflowplugin by opendaylight.
the class SalBulkFlowServiceImplTest method testAddRemoveFlowsRpc.
@Test
public void testAddRemoveFlowsRpc() throws Exception {
Mockito.when(mockSalFlowService.addFlow(Matchers.<AddFlowInput>any())).thenReturn(RpcResultBuilder.success(new AddFlowOutputBuilder().build()).buildFuture());
Mockito.when(mockSalFlowService.removeFlow(Matchers.<RemoveFlowInput>any())).thenReturn(RpcResultBuilder.success(new RemoveFlowOutputBuilder().build()).buildFuture());
final BulkFlowItemBuilder bulkFlowItemBuilder = new BulkFlowItemBuilder();
final InstanceIdentifier<Node> nodeId = BulkOMaticUtils.getFlowCapableNodeId("1");
bulkFlowItemBuilder.setNode(new NodeRef(nodeId));
final BulkFlowItem bulkFlowItem = bulkFlowItemBuilder.build();
final List<BulkFlowItem> bulkFlowItems = new ArrayList<>();
bulkFlowItems.add(bulkFlowItem);
final AddFlowsRpcInputBuilder addFlowsRpcInputBuilder = new AddFlowsRpcInputBuilder();
addFlowsRpcInputBuilder.setBulkFlowItem(bulkFlowItems);
final AddFlowsRpcInput addFlowsRpcInput = addFlowsRpcInputBuilder.build();
salBulkFlowService.addFlowsRpc(addFlowsRpcInput);
verify(mockSalFlowService).addFlow(Matchers.<AddFlowInput>any());
final RemoveFlowsRpcInputBuilder removeFlowsRpcInputBuilder = new RemoveFlowsRpcInputBuilder();
removeFlowsRpcInputBuilder.setBulkFlowItem(bulkFlowItems);
final RemoveFlowsRpcInput removeFlowsRpcInput = removeFlowsRpcInputBuilder.build();
salBulkFlowService.removeFlowsRpc(removeFlowsRpcInput);
verify(mockSalFlowService).removeFlow(Matchers.<RemoveFlowInput>any());
}
Aggregations