import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.AddFlowsDsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.AddFlowsDsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.AddFlowsRpcInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.AddFlowsRpcOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.BulkFlowBaseContentGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.FlowRpcAddMultipleInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.FlowRpcAddMultipleOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.FlowRpcAddTestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.FlowRpcAddTestOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.FlowTestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.FlowTestOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.ReadFlowTestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.ReadFlowTestOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RegisterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RegisterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RegisterOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RemoveFlowsDsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RemoveFlowsDsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RemoveFlowsRpcInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RemoveFlowsRpcOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.SalBulkFlowService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.TableTestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.TableTestOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.bulk.flow.ds.list.grouping.BulkFlowDsItem;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
this.flowService = Preconditions.checkNotNull(flowService);
this.dataBroker = Preconditions.checkNotNull(dataBroker);
- JdkFutures.addErrorLogging(register(), LOG, "register");
+ JdkFutures.addErrorLogging(register(new RegisterInputBuilder().build()), LOG, "register");
}
@Override
- public Future<RpcResult<Void>> addFlowsDs(AddFlowsDsInput input) {
+ public ListenableFuture<RpcResult<AddFlowsDsOutput>> addFlowsDs(AddFlowsDsInput input) {
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
boolean createParentsNextTime = MoreObjects.firstNonNull(input.isAlwaysCreateParents(), Boolean.FALSE);
boolean createParents = true;
createParents = createParentsNextTime;
}
ListenableFuture<Void> submitFuture = writeTransaction.submit();
- return handleResultFuture(Futures.allAsList(submitFuture));
+ return Futures.transform(handleResultFuture(Futures.allAsList(submitFuture)), voidRpcResult -> {
+ if (voidRpcResult.isSuccessful()) {
+ return RpcResultBuilder.<AddFlowsDsOutput>success().build();
+ } else {
+ return RpcResultBuilder.<AddFlowsDsOutput>failed().build();
+ }
+ },MoreExecutors.directExecutor());
}
private InstanceIdentifier<Flow> getFlowInstanceIdentifier(BulkFlowDsItem bulkFlow) {
}
@Override
- public Future<RpcResult<Void>> removeFlowsDs(RemoveFlowsDsInput input) {
+ public ListenableFuture<RpcResult<RemoveFlowsDsOutput>> removeFlowsDs(RemoveFlowsDsInput input) {
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
for (BulkFlowDsItem bulkFlow : input.getBulkFlowDsItem()) {
writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, getFlowInstanceIdentifier(bulkFlow));
}
- return handleResultFuture(Futures.allAsList(writeTransaction.submit()));
+ return Futures.transform(handleResultFuture(Futures.allAsList(writeTransaction.submit())), voidRpcResult -> {
+ if (voidRpcResult.isSuccessful()) {
+ return RpcResultBuilder.<RemoveFlowsDsOutput>success().build();
+ } else {
+ return RpcResultBuilder.<RemoveFlowsDsOutput>failed().build();
+ }
+ }, MoreExecutors.directExecutor());
}
private <T> ListenableFuture<RpcResult<Void>> handleResultFuture(ListenableFuture<List<T>> submitFuture) {
}
@Override
- public Future<RpcResult<Void>> addFlowsRpc(AddFlowsRpcInput input) {
+ public ListenableFuture<RpcResult<AddFlowsRpcOutput>> addFlowsRpc(AddFlowsRpcInput input) {
List<ListenableFuture<RpcResult<AddFlowOutput>>> bulkResults = new ArrayList<>();
for (BulkFlowBaseContentGrouping bulkFlow : input.getBulkFlowItem()) {
Future<RpcResult<AddFlowOutput>> rpcAddFlowResult = flowService.addFlow(flowInputBuilder.build());
bulkResults.add(JdkFutureAdapters.listenInPoolThread(rpcAddFlowResult));
}
- return handleResultFuture(Futures.allAsList(bulkResults));
+ return Futures.transform(handleResultFuture(Futures.allAsList(bulkResults)), voidRpcResult -> {
+ if (voidRpcResult.isSuccessful()) {
+ return RpcResultBuilder.<AddFlowsRpcOutput>success().build();
+ } else {
+ return RpcResultBuilder.<AddFlowsRpcOutput>failed().build();
+ }
+ },MoreExecutors.directExecutor());
}
@Override
- public Future<RpcResult<Void>> readFlowTest(ReadFlowTestInput input) {
+ public ListenableFuture<RpcResult<ReadFlowTestOutput>> readFlowTest(ReadFlowTestInput input) {
FlowReader flowReader = FlowReader.getNewInstance(dataBroker, input.getDpnCount().intValue(),
input.getFlowsPerDpn().intValue(), input.isVerbose(), input.isIsConfigDs(),
input.getStartTableId().shortValue(), input.getEndTableId().shortValue());
flowCounterBeanImpl.setReader(flowReader);
fjService.execute(flowReader);
- RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.success();
+ RpcResultBuilder<ReadFlowTestOutput> rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.build());
}
@Override
- public Future<RpcResult<Void>> flowRpcAddTest(FlowRpcAddTestInput input) {
+ public ListenableFuture<RpcResult<FlowRpcAddTestOutput>> flowRpcAddTest(FlowRpcAddTestInput input) {
FlowWriterDirectOFRpc flowAddRpcTestImpl = new FlowWriterDirectOFRpc(dataBroker, flowService, fjService);
flowAddRpcTestImpl.rpcFlowAdd(input.getDpnId(), input.getFlowCount().intValue(),
input.getRpcBatchSize().intValue());
- RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.success();
+ RpcResultBuilder<FlowRpcAddTestOutput> rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.build());
}
@Override
- public Future<RpcResult<Void>> register() {
- RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.success();
+ public ListenableFuture<RpcResult<RegisterOutput>> register(RegisterInput input) {
+ RpcResultBuilder<RegisterOutput> rpcResultBuilder = RpcResultBuilder.success();
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
String pathToMBean = String.format("%s:type=%s", FlowCounter.class.getPackage().getName(),
}
@Override
- public Future<RpcResult<Void>> removeFlowsRpc(RemoveFlowsRpcInput input) {
+ public ListenableFuture<RpcResult<RemoveFlowsRpcOutput>> removeFlowsRpc(RemoveFlowsRpcInput input) {
List<ListenableFuture<RpcResult<RemoveFlowOutput>>> bulkResults = new ArrayList<>();
for (BulkFlowBaseContentGrouping bulkFlow : input.getBulkFlowItem()) {
Future<RpcResult<RemoveFlowOutput>> rpcAddFlowResult = flowService.removeFlow(flowInputBuilder.build());
bulkResults.add(JdkFutureAdapters.listenInPoolThread(rpcAddFlowResult));
}
- return handleResultFuture(Futures.allAsList(bulkResults));
+ return Futures.transform(handleResultFuture(Futures.allAsList(bulkResults)), voidRpcResult -> {
+ if (voidRpcResult.isSuccessful()) {
+ return RpcResultBuilder.<RemoveFlowsRpcOutput>success().build();
+ } else {
+ return RpcResultBuilder.<RemoveFlowsRpcOutput>failed().build();
+ }
+ }, MoreExecutors.directExecutor());
}
@Override
- public Future<RpcResult<Void>> flowTest(FlowTestInput input) {
+ public ListenableFuture<RpcResult<FlowTestOutput>> flowTest(FlowTestInput input) {
if (input.isTxChain()) {
FlowWriterTxChain flowTester = new FlowWriterTxChain(dataBroker, fjService);
flowCounterBeanImpl.setWriter(flowTester);
input.getBatchSize().intValue(), input.getStartTableId().shortValue(),
input.getEndTableId().shortValue());
}
- RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.success();
+ RpcResultBuilder<FlowTestOutput> rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.build());
}
if (input.isSeq()) {
input.getEndTableId().shortValue());
}
}
- RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.success();
+ RpcResultBuilder<FlowTestOutput> rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.build());
}
@Override
- public Future<RpcResult<Void>> tableTest(final TableTestInput input) {
+ public ListenableFuture<RpcResult<TableTestOutput>> tableTest(final TableTestInput input) {
final TableWriter writer = new TableWriter(dataBroker, fjService);
flowCounterBeanImpl.setWriter(writer);
switch (input.getOperation()) {
input.getEndTableId().shortValue());
break;
default:
- RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.failed();
+ RpcResultBuilder<TableTestOutput> rpcResultBuilder = RpcResultBuilder.failed();
return Futures.immediateFuture(rpcResultBuilder.build());
}
- RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.success();
+ RpcResultBuilder<TableTestOutput> rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.build());
}
@Override
- public Future<RpcResult<Void>> flowRpcAddMultiple(FlowRpcAddMultipleInput input) {
+ public ListenableFuture<RpcResult<FlowRpcAddMultipleOutput>> flowRpcAddMultiple(FlowRpcAddMultipleInput input) {
FlowWriterDirectOFRpc flowTesterRPC = new FlowWriterDirectOFRpc(dataBroker, flowService, fjService);
flowTesterRPC.rpcFlowAddAll(input.getFlowCount().intValue(), input.getRpcBatchSize().intValue());
- RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.success();
+ RpcResultBuilder<FlowRpcAddMultipleOutput> rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.build());
}
}
import com.google.common.base.Optional;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.FlowRpcAddMultipleInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.FlowRpcAddTestInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.FlowRpcAddTestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.FlowRpcAddTestOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.FlowTestInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.FlowTestInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.ReadFlowTestInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.ReadFlowTestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.ReadFlowTestOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RemoveFlowsDsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RemoveFlowsDsInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.bulk.flow.service.rev150608.RemoveFlowsRpcInput;
.setStartTableId(1L).setEndTableId(2L).setIsConfigDs(false).setFlowsPerDpn(1L).setVerbose(true);
final ReadFlowTestInput readFlowTestInput = readFlowTestInputBuilder.build();
- final Future<RpcResult<Void>> resultFuture = salBulkFlowService.readFlowTest(readFlowTestInput);
+ final ListenableFuture<RpcResult<ReadFlowTestOutput>> resultFuture
+ = salBulkFlowService.readFlowTest(readFlowTestInput);
Assert.assertTrue(resultFuture.get().isSuccessful());
}
.setDpnId("1").setRpcBatchSize(1L);
final FlowRpcAddTestInput flowRpcAddTestInput = flowRpcAddTestInputBuilder.build();
- final Future<RpcResult<Void>> resultFuture = salBulkFlowService.flowRpcAddTest(flowRpcAddTestInput);
+ final ListenableFuture<RpcResult<FlowRpcAddTestOutput>> resultFuture
+ = salBulkFlowService.flowRpcAddTest(flowRpcAddTestInput);
Assert.assertTrue(resultFuture.get().isSuccessful());
}
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicLong;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.SalBundleService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.Messages;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.MessagesBuilder;
.setNode(nodeRef).setBundleId(bundleIdValue).setFlags(BUNDLE_FLAGS)
.setMessages(createMessages(nodeRef, flowNode)).build();
- Future<RpcResult<Void>> openBundle = salBundleService.controlBundle(openBundleInput);
+ ListenableFuture<RpcResult<ControlBundleOutput>> openBundle
+ = salBundleService.controlBundle(openBundleInput);
- ListenableFuture<RpcResult<Void>> addBundleMessagesFuture = Futures
+ ListenableFuture<RpcResult<AddBundleMessagesOutput>> addBundleMessagesFuture = Futures
.transformAsync(JdkFutureAdapters.listenInPoolThread(openBundle), rpcResult -> {
if (rpcResult.isSuccessful()) {
return JdkFutureAdapters
}
return Futures.immediateFuture(null);
}, MoreExecutors.directExecutor());
- ListenableFuture<RpcResult<Void>> commitBundleFuture = Futures.transformAsync(addBundleMessagesFuture,
- rpcResult -> {
- if (rpcResult.isSuccessful()) {
- return JdkFutureAdapters
- .listenInPoolThread(salBundleService.controlBundle(commitBundleInput));
- }
- return Futures.immediateFuture(null);
- }, MoreExecutors.directExecutor());
+ ListenableFuture<RpcResult<ControlBundleOutput>> commitBundleFuture
+ = Futures.transformAsync(addBundleMessagesFuture, rpcResult -> {
+ if (rpcResult.isSuccessful()) {
+ return JdkFutureAdapters
+ .listenInPoolThread(salBundleService.controlBundle(commitBundleInput));
+ }
+ return Futures.immediateFuture(null);
+ }, MoreExecutors.directExecutor());
/* Bundles not supported for meters */
List<Meter> meters = flowNode.get().getMeter() != null ? flowNode.get().getMeter()
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
-import java.util.concurrent.Future;
import javax.annotation.Nullable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
}
@Override
- public Future<RpcResult<ReconcileNodeOutput>> reconcileNode(ReconcileNodeInput input) {
+ public ListenableFuture<RpcResult<ReconcileNodeOutput>> reconcileNode(ReconcileNodeInput input) {
LOG.debug("Triggering reconciliation for node: {}", input.getNodeId().toString());
Node nodeDpn = buildNode(input.getNodeId().longValue());
InstanceIdentifier<FlowCapableNode> connectedNode = InstanceIdentifier.builder(Nodes.class)
package test.mock.util;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.SalBundleService;
import org.opendaylight.yangtools.yang.common.RpcResult;
private final List<AddBundleMessagesInput> addBundleMessagesInput = new ArrayList<>();
@Override
- public Future<RpcResult<java.lang.Void>> controlBundle(ControlBundleInput input) {
+ public ListenableFuture<RpcResult<ControlBundleOutput>> controlBundle(ControlBundleInput input) {
getControlBundleInput().add(input);
return null;
}
@Override
- public Future<RpcResult<java.lang.Void>> addBundleMessages(AddBundleMessagesInput input) {
+ public ListenableFuture<RpcResult<AddBundleMessagesOutput>> addBundleMessages(AddBundleMessagesInput input) {
getAddBundleMessagesInput().add(input);
return null;
}
*/
package test.mock.util;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
private final List<UpdateFlowInput> updateFlowCalls = new ArrayList<>();
@Override
- public Future<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
+ public ListenableFuture<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
addFlowCalls.add(input);
return null;
}
@Override
- public Future<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
+ public ListenableFuture<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
removeFlowCalls.add(input);
return null;
}
@Override
- public Future<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
+ public ListenableFuture<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
updateFlowCalls.add(input);
return null;
}
*/
package test.mock.util;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
private final List<UpdateGroupInput> updateGroupCalls = new ArrayList<>();
@Override
- public Future<RpcResult<AddGroupOutput>> addGroup(AddGroupInput input) {
+ public ListenableFuture<RpcResult<AddGroupOutput>> addGroup(AddGroupInput input) {
addGroupCalls.add(input);
return null;
}
@Override
- public Future<RpcResult<RemoveGroupOutput>> removeGroup(RemoveGroupInput input) {
+ public ListenableFuture<RpcResult<RemoveGroupOutput>> removeGroup(RemoveGroupInput input) {
removeGroupCalls.add(input);
return null;
}
@Override
- public Future<RpcResult<UpdateGroupOutput>> updateGroup(UpdateGroupInput input) {
+ public ListenableFuture<RpcResult<UpdateGroupOutput>> updateGroup(UpdateGroupInput input) {
updateGroupCalls.add(input);
return null;
}
*/
package test.mock.util;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput;
private final List<UpdateMeterInput> updateMeterCalls = new ArrayList<>();
@Override
- public Future<RpcResult<AddMeterOutput>> addMeter(AddMeterInput input) {
+ public ListenableFuture<RpcResult<AddMeterOutput>> addMeter(AddMeterInput input) {
addMeterCalls.add(input);
return null;
}
@Override
- public Future<RpcResult<RemoveMeterOutput>> removeMeter(RemoveMeterInput input) {
+ public ListenableFuture<RpcResult<RemoveMeterOutput>> removeMeter(RemoveMeterInput input) {
removeMeterCalls.add(input);
return null;
}
@Override
- public Future<RpcResult<UpdateMeterOutput>> updateMeter(UpdateMeterInput input) {
+ public ListenableFuture<RpcResult<UpdateMeterOutput>> updateMeter(UpdateMeterInput input) {
updateMeterCalls.add(input);
return null;
}
*/
package test.mock.util;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
}
@Override
- public Future<RpcResult<UpdateTableOutput>> updateTable(UpdateTableInput input) {
+ public ListenableFuture<RpcResult<UpdateTableOutput>> updateTable(UpdateTableInput input) {
updateTableInput.add(input);
return null;
}
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.util.concurrent.AsyncFunction;
-import com.google.common.util.concurrent.JdkFutureAdapters;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.FlowCapableTransactionService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
final SendBarrierInput barrierInput = new SendBarrierInputBuilder()
.setNode(new NodeRef(nodeIdent))
.build();
- return JdkFutureAdapters.listenInPoolThread(flowCapableTransactionService.sendBarrier(barrierInput));
+ ListenableFuture<RpcResult<SendBarrierOutput>> result
+ = flowCapableTransactionService.sendBarrier(barrierInput);
+
+ return Futures.transformAsync(result, input1 -> {
+ if (input1.isSuccessful()) {
+ return Futures.<RpcResult<Void>>immediateFuture(RpcResultBuilder.<Void>success().build());
+ } else {
+ return Futures.<RpcResult<Void>>immediateFailedFuture(null);
+ }
+ });
};
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.FlowCapableTransactionService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutputBuilder;
@Before
public void setUp() throws Exception {
Mockito.when(flowCapableTxService.sendBarrier(Matchers.<SendBarrierInput>any()))
- .thenReturn(RpcResultBuilder.success((Void) null).buildFuture());
+ .thenReturn(RpcResultBuilder.success((SendBarrierOutput) null).buildFuture());
Mockito.doAnswer(createSalServiceFutureAnswer()).when(groupCommitter).add(
Matchers.<InstanceIdentifier<Group>>any(), Matchers.<Group>any(),
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.FlowCapableTransactionService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.Buckets;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder;
Futures.transformAsync(testRabbit, ReconcileUtil.chainBarrierFlush(NODE_IDENT, flowCapableService),
MoreExecutors.directExecutor());
Mockito.when(flowCapableService.sendBarrier(barrierInputCaptor.capture()))
- .thenReturn(RpcResultBuilder.<Void>success().buildFuture());
+ .thenReturn(RpcResultBuilder.<SendBarrierOutput>success().buildFuture());
Mockito.verify(flowCapableService, Mockito.never()).sendBarrier(Matchers.<SendBarrierInput>any());
Assert.assertFalse(vehicle.isDone());
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.lldp.speaker.rev141023.OperStatus;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
LOG.debug("Port {} added to LLDPSpeaker.nodeConnectorMap", nodeConnectorId.getValue());
// Transmit packet for first time immediately
- final Future<RpcResult<Void>> resultFuture = packetProcessingService.transmitPacket(packet);
+ final Future<RpcResult<TransmitPacketOutput>> resultFuture = packetProcessingService.transmitPacket(packet);
JdkFutures.addErrorLogging(resultFuture, LOG, "transmitPacket");
}
package org.opendaylight.openflowplugin.applications.lldpspeaker;
import com.google.common.util.concurrent.Futures;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.lldp.speaker.rev141023.ChangeOperationalStatusInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.lldp.speaker.rev141023.ChangeOperationalStatusOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.lldp.speaker.rev141023.GetLldpFloodIntervalInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.lldp.speaker.rev141023.GetLldpFloodIntervalOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.lldp.speaker.rev141023.GetLldpFloodIntervalOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.lldp.speaker.rev141023.GetOperationalStatusInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.lldp.speaker.rev141023.GetOperationalStatusOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.lldp.speaker.rev141023.GetOperationalStatusOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.lldp.speaker.rev141023.LldpSpeakerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.lldp.speaker.rev141023.SetLldpFloodIntervalInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.lldp.speaker.rev141023.SetLldpFloodIntervalOutput;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
}
@Override
- public Future<RpcResult<Void>> changeOperationalStatus(final ChangeOperationalStatusInput input) {
+ public ListenableFuture<RpcResult<ChangeOperationalStatusOutput>> changeOperationalStatus(final
+ ChangeOperationalStatusInput
+ input) {
speakerInstance.setOperationalStatus(input.getOperationalStatus());
- RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.success();
+ RpcResultBuilder<ChangeOperationalStatusOutput> rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.build());
}
@Override
- public Future<RpcResult<GetOperationalStatusOutput>> getOperationalStatus() {
+ public ListenableFuture<RpcResult<GetOperationalStatusOutput>> getOperationalStatus(
+ GetOperationalStatusInput input) {
RpcResultBuilder<GetOperationalStatusOutput> rpcResultBuilder = RpcResultBuilder.success();
GetOperationalStatusOutputBuilder getOperationalStatusOutputBuilder = new GetOperationalStatusOutputBuilder();
getOperationalStatusOutputBuilder.setOperationalStatus(speakerInstance.getOperationalStatus());
}
@Override
- public Future<RpcResult<Void>> setLldpFloodInterval(final SetLldpFloodIntervalInput input) {
+ public ListenableFuture<RpcResult<SetLldpFloodIntervalOutput>> setLldpFloodInterval(final SetLldpFloodIntervalInput
+ input) {
speakerInstance.setLldpFloodInterval(input.getInterval());
- RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.success();
+ RpcResultBuilder<SetLldpFloodIntervalOutput> rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.build());
}
@Override
- public Future<RpcResult<GetLldpFloodIntervalOutput>> getLldpFloodInterval() {
+ public ListenableFuture<RpcResult<GetLldpFloodIntervalOutput>> getLldpFloodInterval(
+ GetLldpFloodIntervalInput intput) {
RpcResultBuilder<GetLldpFloodIntervalOutput> rpcResultBuilder = RpcResultBuilder.success();
GetLldpFloodIntervalOutputBuilder getLldpFloodIntervalOutputBuilder = new GetLldpFloodIntervalOutputBuilder();
getLldpFloodIntervalOutputBuilder.setInterval(speakerInstance.getLldpFloodInterval());
package org.opendaylight.openflowplugin.applications.southboundcli;
import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import java.math.BigInteger;
import java.time.LocalDateTime;
@Override
- public Future<RpcResult<ReconcileOutput>> reconcile(ReconcileInput input) {
+ public ListenableFuture<RpcResult<ReconcileOutput>> reconcile(ReconcileInput input) {
boolean reconcileAllNodes = input.isReconcileAllNodes();
List<BigInteger> inputNodes = input.getNodes();
if (inputNodes == null) {
return result;
}
- private Future<RpcResult<ReconcileOutput>> buildErrorResponse(String msg) {
+ private ListenableFuture<RpcResult<ReconcileOutput>> buildErrorResponse(String msg) {
SettableFuture<RpcResult<ReconcileOutput>> result = SettableFuture.create();
LOG.error(msg);
RpcError error = RpcResultBuilder.newError(RpcError.ErrorType.PROTOCOL, "reconcile", msg);
package org.opendaylight.openflowplugin.extension.test;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoadBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.DstBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.test.rev130819.TestFlowInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.test.rev130819.TestFlowOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.test.rev130819.TestService;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
@Override
- public Future<RpcResult<Void>> testFlow(TestFlowInput input) {
+ public ListenableFuture<RpcResult<TestFlowOutput>> testFlow(TestFlowInput input) {
AddFlowInputBuilder flow = new AddFlowInputBuilder();
flow.setPriority(2);
flow.setMatch(createMatchBld().build());
pushFlowViaRpc(flow.build());
- return Futures.immediateFuture(RpcResultBuilder.<Void>status(true).build());
+ return Futures.immediateFuture(RpcResultBuilder.<TestFlowOutput>status(true).build());
}
private void pushFlowViaRpc(AddFlowInput addFlowInput) {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModOutput;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.Logger;
}
@Override
- public Future<RpcResult<BarrierOutput>> barrier(final BarrierInput input) {
+ public ListenableFuture<RpcResult<BarrierOutput>> barrier(final BarrierInput input) {
return sendToSwitchExpectRpcResultFuture(input, BarrierOutput.class, "barrier-input sending failed");
}
@Override
- public Future<RpcResult<EchoOutput>> echo(final EchoInput input) {
+ public ListenableFuture<RpcResult<EchoOutput>> echo(final EchoInput input) {
return sendToSwitchExpectRpcResultFuture(input, EchoOutput.class, "echo-input sending failed");
}
@Override
- public Future<RpcResult<Void>> echoReply(final EchoReplyInput input) {
+ public ListenableFuture<RpcResult<EchoReplyOutput>> echoReply(final EchoReplyInput input) {
return sendToSwitchFuture(input, "echo-reply sending failed");
}
@Override
- public Future<RpcResult<Void>> experimenter(final ExperimenterInput input) {
+ public ListenableFuture<RpcResult<ExperimenterOutput>> experimenter(final ExperimenterInput input) {
return sendToSwitchFuture(input, "experimenter sending failed");
}
@Override
- public Future<RpcResult<Void>> flowMod(final FlowModInput input) {
+ public ListenableFuture<RpcResult<FlowModOutput>> flowMod(final FlowModInput input) {
return sendToSwitchFuture(input, "flow-mod sending failed");
}
@Override
- public Future<RpcResult<GetConfigOutput>> getConfig(final GetConfigInput input) {
+ public ListenableFuture<RpcResult<GetConfigOutput>> getConfig(final GetConfigInput input) {
return sendToSwitchExpectRpcResultFuture(input, GetConfigOutput.class, "get-config-input sending failed");
}
@Override
- public Future<RpcResult<GetFeaturesOutput>> getFeatures(final GetFeaturesInput input) {
+ public ListenableFuture<RpcResult<GetFeaturesOutput>> getFeatures(final GetFeaturesInput input) {
return sendToSwitchExpectRpcResultFuture(input, GetFeaturesOutput.class, "get-features-input sending failed");
}
@Override
- public Future<RpcResult<GetQueueConfigOutput>> getQueueConfig(final GetQueueConfigInput input) {
+ public ListenableFuture<RpcResult<GetQueueConfigOutput>> getQueueConfig(final GetQueueConfigInput input) {
return sendToSwitchExpectRpcResultFuture(input, GetQueueConfigOutput.class,
"get-queue-config-input sending failed");
}
@Override
- public Future<RpcResult<Void>> groupMod(final GroupModInput input) {
+ public ListenableFuture<RpcResult<GroupModOutput>> groupMod(final GroupModInput input) {
return sendToSwitchFuture(input, "group-mod-input sending failed");
}
@Override
- public Future<RpcResult<Void>> hello(final HelloInput input) {
+ public ListenableFuture<RpcResult<HelloOutput>> hello(final HelloInput input) {
return sendToSwitchFuture(input, "hello-input sending failed");
}
@Override
- public Future<RpcResult<Void>> meterMod(final MeterModInput input) {
+ public ListenableFuture<RpcResult<MeterModOutput>> meterMod(final MeterModInput input) {
return sendToSwitchFuture(input, "meter-mod-input sending failed");
}
@Override
- public Future<RpcResult<Void>> packetOut(final PacketOutInput input) {
+ public ListenableFuture<RpcResult<PacketOutOutput>> packetOut(final PacketOutInput input) {
return sendToSwitchFuture(input, "packet-out-input sending failed");
}
@Override
- public Future<RpcResult<Void>> multipartRequest(final MultipartRequestInput input) {
+ public ListenableFuture<RpcResult<MultipartRequestOutput>> multipartRequest(final MultipartRequestInput input) {
return sendToSwitchFuture(input, "multi-part-request sending failed");
}
@Override
- public Future<RpcResult<Void>> portMod(final PortModInput input) {
+ public ListenableFuture<RpcResult<PortModOutput>> portMod(final PortModInput input) {
return sendToSwitchFuture(input, "port-mod-input sending failed");
}
@Override
- public Future<RpcResult<RoleRequestOutput>> roleRequest(final RoleRequestInput input) {
+ public ListenableFuture<RpcResult<RoleRequestOutput>> roleRequest(final RoleRequestInput input) {
return sendToSwitchExpectRpcResultFuture(input, RoleRequestOutput.class,
"role-request-config-input sending failed");
}
@Override
- public Future<RpcResult<Void>> setConfig(final SetConfigInput input) {
+ public ListenableFuture<RpcResult<SetConfigOutput>> setConfig(final SetConfigInput input) {
return sendToSwitchFuture(input, "set-config-input sending failed");
}
@Override
- public Future<RpcResult<Void>> tableMod(final TableModInput input) {
+ public ListenableFuture<RpcResult<TableModOutput>> tableMod(final TableModInput input) {
return sendToSwitchFuture(input, "table-mod-input sending failed");
}
@Override
- public Future<RpcResult<GetAsyncOutput>> getAsync(final GetAsyncInput input) {
+ public ListenableFuture<RpcResult<GetAsyncOutput>> getAsync(final GetAsyncInput input) {
return sendToSwitchExpectRpcResultFuture(input, GetAsyncOutput.class, "get-async-input sending failed");
}
@Override
- public Future<RpcResult<Void>> setAsync(final SetAsyncInput input) {
+ public ListenableFuture<RpcResult<SetAsyncOutput>> setAsync(final SetAsyncInput input) {
return sendToSwitchFuture(input, "set-async-input sending failed");
}
* <li>else {@link RpcResult} will contain errors and failed status</li>
* </ul>
*/
- protected ListenableFuture<RpcResult<Void>> sendToSwitchFuture(final DataObject input, final String failureInfo) {
- return enqueueMessage(new SimpleRpcListener(input, failureInfo));
+ protected <O extends DataObject> ListenableFuture<RpcResult<O>> sendToSwitchFuture(final Object input,
+ final String failureInfo) {
+ SimpleRpcListener<O> listener = new SimpleRpcListener(input, failureInfo);
+ return enqueueMessage(listener);
}
private <T> ListenableFuture<RpcResult<T>> enqueueMessage(final AbstractRpcListener<T> promise) {
import com.google.common.util.concurrent.ListenableFuture;
import io.netty.channel.Channel;
import java.net.InetSocketAddress;
-import java.util.concurrent.Future;
import org.opendaylight.openflowjava.statistics.CounterEventTypes;
import org.opendaylight.openflowjava.statistics.StatisticsCounters;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEvent;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEvent;
}
@Override
- public Future<RpcResult<Void>> flowMod(final FlowModInput input) {
+ public ListenableFuture<RpcResult<FlowModOutput>> flowMod(final FlowModInput input) {
statisticsCounters.incrementCounter(CounterEventTypes.DS_FLOW_MODS_ENTERED);
return super.flowMod(input);
}
}
@Override
- protected ListenableFuture<RpcResult<Void>> sendToSwitchFuture(final DataObject input, final String failureInfo) {
+ protected <O extends DataObject> ListenableFuture<RpcResult<O>> sendToSwitchFuture(final Object input,
+ final String failureInfo) {
statisticsCounters.incrementCounter(CounterEventTypes.DS_ENTERED_OFJAVA);
return super.sendToSwitchFuture(input, failureInfo);
}
* Create RcpError object.
*
* @param info error info
- * @param severity - error severity
* @param message error message
* @param cause - details of reason
* @return RpcError
*/
package org.opendaylight.openflowjava.protocol.impl.core.connection;
-final class SimpleRpcListener extends AbstractRpcListener<Void> {
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+final class SimpleRpcListener<T extends DataObject> extends AbstractRpcListener<T> {
SimpleRpcListener(final Object message, final String failureInfo) {
super(message, failureInfo);
}
*/
@Test
public void testSuccessfulRpc() {
- SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+ SimpleRpcListener<?> listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
listener.operationSuccessful();
SettableFuture<RpcResult<?>> result = SettableFuture.create();
result.set(RpcResultBuilder.success((Void)null).build());
@Test
public void testOperationComplete() {
when(future.isSuccess()).thenReturn(false);
- SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+ SimpleRpcListener<?> listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
listener.operationComplete(future);
verify(future, times(1)).cause();
try {
@Test
public void testOperationComplete2() {
when(future.isSuccess()).thenReturn(true);
- SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+ SimpleRpcListener<?> listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
listener.operationComplete(future);
verify(future, times(0)).cause();
try {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
LOG.debug("sending hello message: version{}, xid={}, version bitmap={}", helloVersion, helloXid,
MessageFactory.digVersions(helloInput.getElements()));
- Future<RpcResult<Void>> helloResult = connectionAdapter.hello(helloInput);
+ Future<RpcResult<HelloOutput>> helloResult = connectionAdapter.hello(helloInput);
- ListenableFuture<RpcResult<Void>> rpcResultListenableFuture = JdkFutureAdapters.listenInPoolThread(helloResult);
- Futures.addCallback(rpcResultListenableFuture, new FutureCallback<RpcResult<Void>>() {
+ ListenableFuture<RpcResult<HelloOutput>> rpcResultListenableFuture
+ = JdkFutureAdapters.listenInPoolThread(helloResult);
+ Futures.addCallback(rpcResultListenableFuture, new FutureCallback<RpcResult<HelloOutput>>() {
@Override
- public void onSuccess(@Nonnull RpcResult<Void> result) {
+ public void onSuccess(@Nonnull RpcResult<HelloOutput> result) {
if (result.isSuccessful()) {
LOG.debug("hello successfully sent, xid={}, addr={}", helloXid,
connectionAdapter.getRemoteAddress());
}
@Override
- public ListenableFuture<Void> closeServiceInstance() {
+ public ListenableFuture<?> closeServiceInstance() {
contextChainMastershipWatcher.onSlaveRoleAcquired(deviceInfo);
- final ListenableFuture<List<Void>> servicesToBeClosed = Futures
- .allAsList(Lists.reverse(contexts)
- .stream()
- .map(OFPContext::closeServiceInstance)
- .collect(Collectors.toList()));
+ final ListenableFuture<?> servicesToBeClosed = Futures.allAsList(Lists.reverse(contexts).stream()
+ .map(OFPContext::closeServiceInstance)
+ .collect(Collectors.toList()));
return Futures.transform(servicesToBeClosed, (input) -> {
LOG.info("Closed clustering services for node {}", deviceInfo);
@Override
@SuppressWarnings("checkstyle:IllegalCatch")
- public ListenableFuture<Void> closeServiceInstance() {
- ListenableFuture<Void> result = Futures.immediateFuture(null);
+ public ListenableFuture<?> closeServiceInstance() {
+ ListenableFuture<?> result = Futures.immediateFuture(null);
if (monitor.enterIf(isStoppable)) {
try {
LOG.info("Stopping {} service for node {}", this, getDeviceInfo());
state = STOPPING;
- final ListenableFuture<Void> resultFuture = delegate.closeServiceInstance();
+ final ListenableFuture<?> resultFuture = delegate.closeServiceInstance();
- Futures.addCallback(resultFuture, new FutureCallback<Void>() {
+ Futures.addCallback(resultFuture, new FutureCallback<Object>() {
@Override
- public void onSuccess(@Nullable final Void result) {
+ public void onSuccess(@Nullable final Object result) {
state = TERMINATED;
}
}
}
}
-}
\ No newline at end of file
+}
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.List;
import java.util.Optional;
-import java.util.concurrent.Future;
import java.util.stream.Collectors;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
}
@Override
- public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> handleAndReply(
+ public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> handleAndReply(
final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
return Futures.transform(handleServiceCall(input),
(Function<RpcResult<List<MultipartReply>>,
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
-import java.util.concurrent.Future;
import javax.annotation.Nonnull;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
@Override
@SuppressWarnings("unchecked")
- public Future<RpcResult<SendExperimenterMpRequestOutput>> handleAndReply(SendExperimenterMpRequestInput input) {
+ public ListenableFuture<RpcResult<SendExperimenterMpRequestOutput>> handleAndReply(
+ SendExperimenterMpRequestInput input) {
final ListenableFuture<RpcResult<List<MultipartReply>>> multipartFuture = handleServiceCall(input);
final SettableFuture<RpcResult<SendExperimenterMpRequestOutput>> finalFuture = SettableFuture.create();
import java.util.Collections;
import java.util.List;
import java.util.Optional;
-import java.util.concurrent.Future;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
}
@Override
-
- public Future<RpcResult<UpdateTableOutput>> handleAndReply(UpdateTableInput input) {
+ public ListenableFuture<RpcResult<UpdateTableOutput>> handleAndReply(UpdateTableInput input) {
final ListenableFuture<RpcResult<List<MultipartReply>>> multipartFuture = handleServiceCall(input);
final SettableFuture<RpcResult<UpdateTableOutput>> finalFuture = SettableFuture.create();
*/
package org.opendaylight.openflowplugin.impl.services.sal;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.impl.services.AbstractVoidService;
+import org.opendaylight.openflowplugin.impl.services.AbstractSimpleService;
import org.opendaylight.openflowplugin.impl.services.util.ServiceException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.FlowCapableTransactionService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yangtools.yang.common.RpcResult;
-public class FlowCapableTransactionServiceImpl extends AbstractVoidService<SendBarrierInput>
+public class FlowCapableTransactionServiceImpl extends AbstractSimpleService<SendBarrierInput, SendBarrierOutput>
implements FlowCapableTransactionService {
public FlowCapableTransactionServiceImpl(final RequestContextStack requestContextStack,
final DeviceContext deviceContext) {
- super(requestContextStack, deviceContext);
+ super(requestContextStack, deviceContext, SendBarrierOutput.class);
}
@Override
- public Future<RpcResult<Void>> sendBarrier(final SendBarrierInput input) {
+ public ListenableFuture<RpcResult<SendBarrierOutput>> sendBarrier(final SendBarrierInput input) {
return handleServiceCall(input);
}
*/
package org.opendaylight.openflowplugin.impl.services.sal;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
}
@Override
- public Future<RpcResult<SetConfigOutput>> setConfig(final SetConfigInput input) {
+ public ListenableFuture<RpcResult<SetConfigOutput>> setConfig(final SetConfigInput input) {
return handleServiceCall(input);
}
*/
package org.opendaylight.openflowplugin.impl.services.sal;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.Optional;
-import java.util.concurrent.Future;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.impl.services.AbstractVoidService;
+import org.opendaylight.openflowplugin.impl.services.AbstractSimpleService;
import org.opendaylight.openflowplugin.impl.services.util.ServiceException;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PacketOutConvertor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketOutput;
import org.opendaylight.yangtools.yang.common.RpcResult;
-public final class PacketProcessingServiceImpl extends AbstractVoidService<TransmitPacketInput>
+public final class PacketProcessingServiceImpl extends AbstractSimpleService<TransmitPacketInput, TransmitPacketOutput>
implements PacketProcessingService {
private final ConvertorExecutor convertorExecutor;
public PacketProcessingServiceImpl(final RequestContextStack requestContextStack,
final DeviceContext deviceContext,
final ConvertorExecutor convertorExecutor) {
- super(requestContextStack, deviceContext);
+ super(requestContextStack, deviceContext, TransmitPacketOutput.class);
this.convertorExecutor = convertorExecutor;
}
@Override
- public Future<RpcResult<Void>> transmitPacket(final TransmitPacketInput input) {
+ public ListenableFuture<RpcResult<TransmitPacketOutput>> transmitPacket(final TransmitPacketInput input) {
return handleServiceCall(input);
}
package org.opendaylight.openflowplugin.impl.services.sal;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.Objects;
-import java.util.concurrent.Future;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.impl.services.singlelayer.SingleLayerGetAsyncConfigService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.GetAsyncOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SalAsyncConfigService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SetAsyncInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SetAsyncOutput;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
public SalAsyncConfigServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
setAsyncConfigService = new SingleLayerSetAsyncConfigService(requestContextStack, deviceContext);
- getAsyncConfigService = new SingleLayerGetAsyncConfigService(requestContextStack, deviceContext);
+ this.getAsyncConfigService = new SingleLayerGetAsyncConfigService(requestContextStack, deviceContext);
}
@Override
- public Future<RpcResult<Void>> setAsync(SetAsyncInput input) {
+ public ListenableFuture<RpcResult<SetAsyncOutput>> setAsync(SetAsyncInput input) {
return setAsyncConfigService.handleServiceCall(input);
}
@Override
- public Future<RpcResult<GetAsyncOutput>> getAsync(GetAsyncInput input) {
+ public ListenableFuture<RpcResult<GetAsyncOutput>> getAsync(GetAsyncInput input) {
return Futures.transform(getAsyncConfigService.handleServiceCall(input), result ->
Objects.nonNull(result) && result.isSuccessful()
? RpcResultBuilder.success(new GetAsyncOutputBuilder(result.getResult())).build()
: RpcResultBuilder.<GetAsyncOutput>failed().build(),
MoreExecutors.directExecutor());
}
-}
\ No newline at end of file
+}
import com.google.common.util.concurrent.SettableFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SalExperimenterMessageService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.SalBundleService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.messages.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.BundleAddMessageSalBuilder;
}
@Override
- public Future<RpcResult<Void>> controlBundle(ControlBundleInput input) {
+ public ListenableFuture<RpcResult<ControlBundleOutput>> controlBundle(ControlBundleInput input) {
final SendExperimenterInputBuilder experimenterInputBuilder = new SendExperimenterInputBuilder();
experimenterInputBuilder.setNode(input.getNode());
experimenterInputBuilder.setExperimenterMessageOfChoice(
new BundleControlSalBuilder().setSalControlData(new SalControlDataBuilder(input).build()).build());
- return experimenterMessageService.sendExperimenter(experimenterInputBuilder.build());
+ return Futures.transform(experimenterMessageService.sendExperimenter(
+ experimenterInputBuilder.build()), sendExperimenterOutputRpcResult -> {
+ if (sendExperimenterOutputRpcResult.isSuccessful()) {
+ return RpcResultBuilder.<ControlBundleOutput>success().build();
+ } else {
+ return RpcResultBuilder.<ControlBundleOutput>failed().build();
+ }
+ }, MoreExecutors.directExecutor());
}
@Override
- public Future<RpcResult<Void>> addBundleMessages(AddBundleMessagesInput input) {
- final List<ListenableFuture<RpcResult<Void>>> partialResults = new ArrayList<>();
+ public ListenableFuture<RpcResult<AddBundleMessagesOutput>> addBundleMessages(AddBundleMessagesInput input) {
+ final List<ListenableFuture<RpcResult<SendExperimenterOutput>>> partialResults = new ArrayList<>();
final SendExperimenterInputBuilder experimenterInputBuilder = new SendExperimenterInputBuilder();
final BundleAddMessageSalBuilder bundleAddMessageBuilder = new BundleAddMessageSalBuilder();
final SalAddMessageDataBuilder dataBuilder = new SalAddMessageDataBuilder();
dataBuilder.setBundleInnerMessage(message.getBundleInnerMessage());
experimenterInputBuilder.setExperimenterMessageOfChoice(
bundleAddMessageBuilder.setSalAddMessageData(dataBuilder.build()).build());
- ListenableFuture<RpcResult<Void>> res = JdkFutureAdapters
+ ListenableFuture<RpcResult<SendExperimenterOutput>> res = JdkFutureAdapters
.listenInPoolThread(experimenterMessageService.sendExperimenter(experimenterInputBuilder.build()));
partialResults.add(res);
}
return processResults(partialResults);
}
- private static Future<RpcResult<Void>> processResults(
- final List<ListenableFuture<RpcResult<Void>>> partialResults) {
- final SettableFuture<RpcResult<Void>> result = SettableFuture.create();
- Futures.addCallback(Futures.successfulAsList(partialResults), new FutureCallback<List<RpcResult<Void>>>() {
+ private static ListenableFuture<RpcResult<AddBundleMessagesOutput>> processResults(
+ final List<ListenableFuture<RpcResult<SendExperimenterOutput>>> partialResults) {
+ final SettableFuture<RpcResult<AddBundleMessagesOutput>> result = SettableFuture.create();
+ Futures.addCallback(Futures.successfulAsList(partialResults),new FutureCallback<
+ List<RpcResult<SendExperimenterOutput>>>() {
@Override
- public void onSuccess(@Nonnull List<RpcResult<Void>> results) {
+ public void onSuccess(@Nonnull List<RpcResult<SendExperimenterOutput>> results) {
final ArrayList<RpcError> errors = new ArrayList<>();
- final RpcResultBuilder<Void> rpcResultBuilder;
- for (RpcResult<Void> res : results) {
+ final RpcResultBuilder<AddBundleMessagesOutput> rpcResultBuilder;
+ for (RpcResult<SendExperimenterOutput> res : results) {
if (res == null) {
errors.add(RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, "BundleExtensionService",
"RpcResult is null."));
if (errors.isEmpty()) {
rpcResultBuilder = RpcResultBuilder.success();
} else {
- rpcResultBuilder = RpcResultBuilder.<Void>failed().withRpcErrors(errors);
+ rpcResultBuilder = RpcResultBuilder.<AddBundleMessagesOutput>failed().withRpcErrors(errors);
}
result.set(rpcResultBuilder.build());
}
@Override
public void onFailure(Throwable throwable) {
- RpcResultBuilder<Void> rpcResultBuilder = RpcResultBuilder.failed();
+ RpcResultBuilder<AddBundleMessagesOutput> rpcResultBuilder = RpcResultBuilder.failed();
result.set(rpcResultBuilder.build());
}
}, MoreExecutors.directExecutor());
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
-import java.util.concurrent.Future;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.impl.services.EchoService;
}
@Override
- public Future<RpcResult<SendEchoOutput>> sendEcho(final SendEchoInput sendEchoInput) {
+ public ListenableFuture<RpcResult<SendEchoOutput>> sendEcho(final SendEchoInput sendEchoInput) {
final EchoInputBuilder echoInputBld = new EchoInputBuilder()
.setData(sendEchoInput.getData());
return transform(echoService.handleServiceCall(echoInputBld));
}
- private Future<RpcResult<SendEchoOutput>>
+ private ListenableFuture<RpcResult<SendEchoOutput>>
transform(final ListenableFuture<RpcResult<EchoOutput>> rpcResultListenableFuture) {
return Futures.transform(rpcResultListenableFuture, input -> {
Preconditions.checkNotNull(input, "echoOutput value is never expected to be NULL");
*/
package org.opendaylight.openflowplugin.impl.services.sal;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
import org.opendaylight.openflowplugin.extension.api.exception.ConversionException;
import org.opendaylight.openflowplugin.extension.api.exception.ConverterNotFoundException;
-import org.opendaylight.openflowplugin.impl.services.AbstractVoidService;
+import org.opendaylight.openflowplugin.impl.services.AbstractSimpleService;
import org.opendaylight.openflowplugin.impl.services.util.ServiceException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SalExperimenterMessageService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.slf4j.LoggerFactory;
-public class SalExperimenterMessageServiceImpl extends AbstractVoidService<SendExperimenterInput>
+public class SalExperimenterMessageServiceImpl extends AbstractSimpleService<SendExperimenterInput,
+ SendExperimenterOutput>
implements SalExperimenterMessageService {
private static final Logger LOG = LoggerFactory.getLogger(SalExperimenterMessageServiceImpl.class);
public SalExperimenterMessageServiceImpl(final RequestContextStack requestContextStack,
final DeviceContext deviceContext,
final ExtensionConverterProvider extensionConverterProvider) {
- super(requestContextStack, deviceContext);
+ super(requestContextStack, deviceContext, SendExperimenterOutput.class);
this.extensionConverterProvider = extensionConverterProvider;
}
}
@Override
- public Future<RpcResult<Void>> sendExperimenter(SendExperimenterInput input) {
+ public ListenableFuture<RpcResult<SendExperimenterOutput>> sendExperimenter(SendExperimenterInput input) {
return handleServiceCall(input);
}
}
package org.opendaylight.openflowplugin.impl.services.sal;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
}
@Override
- public Future<RpcResult<SendExperimenterMpRequestOutput>>
+ public ListenableFuture<RpcResult<SendExperimenterMpRequestOutput>>
sendExperimenterMpRequest(SendExperimenterMpRequestInput input) {
return singleLayerService.canUseSingleLayerSerialization()
? singleLayerService.handleAndReply(input)
}
@Override
- public Future<RpcResult<ProcessFlatBatchOutput>> processFlatBatch(final ProcessFlatBatchInput input) {
+ public ListenableFuture<RpcResult<ProcessFlatBatchOutput>> processFlatBatch(final ProcessFlatBatchInput input) {
LOG.trace("processing flat batch @ {} : {}",
PathUtil.extractNodeId(input.getNode()).getValue(),
input.getBatch().size());
}
@VisibleForTesting
- Future<RpcResult<ProcessFlatBatchOutput>> executeBatchPlan(final List<BatchStepJob> batchJobsChain) {
+ ListenableFuture<RpcResult<ProcessFlatBatchOutput>> executeBatchPlan(final List<BatchStepJob> batchJobsChain) {
BatchStepJob batchJob;
final List<ListenableFuture<RpcResult<ProcessFlatBatchOutput>>> firedJobs = new ArrayList<>();
ListenableFuture<RpcResult<ProcessFlatBatchOutput>> chainSummaryResult =
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
-import java.util.concurrent.Future;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
}
@Override
- public Future<RpcResult<AddFlowOutput>> addFlow(final AddFlowInput input) {
+ public ListenableFuture<RpcResult<AddFlowOutput>> addFlow(final AddFlowInput input) {
final FlowRegistryKey flowRegistryKey =
FlowRegistryKeyFactory.create(deviceContext.getDeviceInfo().getVersion(), input);
final ListenableFuture<RpcResult<AddFlowOutput>> future;
}
@Override
- public Future<RpcResult<RemoveFlowOutput>> removeFlow(final RemoveFlowInput input) {
+ public ListenableFuture<RpcResult<RemoveFlowOutput>> removeFlow(final RemoveFlowInput input) {
final ListenableFuture<RpcResult<RemoveFlowOutput>> future;
if (flowRemoveMessage.canUseSingleLayerSerialization()) {
}
@Override
- public Future<RpcResult<UpdateFlowOutput>> updateFlow(final UpdateFlowInput input) {
+ public ListenableFuture<RpcResult<UpdateFlowOutput>> updateFlow(final UpdateFlowInput input) {
final UpdatedFlow updated = input.getUpdatedFlow();
final OriginalFlow original = input.getOriginalFlow();
import com.google.common.util.concurrent.MoreExecutors;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import org.opendaylight.openflowplugin.impl.util.BarrierUtil;
import org.opendaylight.openflowplugin.impl.util.FlowUtil;
import org.opendaylight.openflowplugin.impl.util.PathUtil;
}
@Override
- public Future<RpcResult<RemoveFlowsBatchOutput>> removeFlowsBatch(final RemoveFlowsBatchInput input) {
+ public ListenableFuture<RpcResult<RemoveFlowsBatchOutput>> removeFlowsBatch(final RemoveFlowsBatchInput input) {
LOG.trace("Removing flows @ {} : {}",
PathUtil.extractNodeId(input.getNode()),
input.getBatchRemoveFlows().size());
}
@Override
- public Future<RpcResult<AddFlowsBatchOutput>> addFlowsBatch(final AddFlowsBatchInput input) {
+ public ListenableFuture<RpcResult<AddFlowsBatchOutput>> addFlowsBatch(final AddFlowsBatchInput input) {
LOG.trace("Adding flows @ {} : {}", PathUtil.extractNodeId(input.getNode()), input.getBatchAddFlows().size());
final ArrayList<ListenableFuture<RpcResult<AddFlowOutput>>> resultsLot = new ArrayList<>();
for (BatchFlowInputGrouping batchFlow : input.getBatchAddFlows()) {
}
@Override
- public Future<RpcResult<UpdateFlowsBatchOutput>> updateFlowsBatch(final UpdateFlowsBatchInput input) {
+ public ListenableFuture<RpcResult<UpdateFlowsBatchOutput>> updateFlowsBatch(final UpdateFlowsBatchInput input) {
LOG.trace("Updating flows @ {} : {}",
PathUtil.extractNodeId(input.getNode()),
input.getBatchUpdateFlows().size());
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
-import java.util.concurrent.Future;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
}
@Override
- public Future<RpcResult<AddGroupOutput>> addGroup(final AddGroupInput input) {
+ public ListenableFuture<RpcResult<AddGroupOutput>> addGroup(final AddGroupInput input) {
final ListenableFuture<RpcResult<AddGroupOutput>> resultFuture =
addGroupMessage.canUseSingleLayerSerialization()
? addGroupMessage.handleServiceCall(input)
@Override
- public Future<RpcResult<UpdateGroupOutput>> updateGroup(final UpdateGroupInput input) {
+ public ListenableFuture<RpcResult<UpdateGroupOutput>> updateGroup(final UpdateGroupInput input) {
final ListenableFuture<RpcResult<UpdateGroupOutput>> resultFuture =
updateGroupMessage.canUseSingleLayerSerialization()
? updateGroupMessage.handleServiceCall(input.getUpdatedGroup())
}
@Override
- public Future<RpcResult<RemoveGroupOutput>> removeGroup(final RemoveGroupInput input) {
+ public ListenableFuture<RpcResult<RemoveGroupOutput>> removeGroup(final RemoveGroupInput input) {
final ListenableFuture<RpcResult<RemoveGroupOutput>> resultFuture =
removeGroupMessage.canUseSingleLayerSerialization()
? removeGroupMessage.handleServiceCall(input)
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import java.util.stream.Collectors;
import org.opendaylight.openflowplugin.impl.util.BarrierUtil;
import org.opendaylight.openflowplugin.impl.util.GroupUtil;
}
@Override
- public Future<RpcResult<UpdateGroupsBatchOutput>> updateGroupsBatch(final UpdateGroupsBatchInput input) {
+ public ListenableFuture<RpcResult<UpdateGroupsBatchOutput>> updateGroupsBatch(final UpdateGroupsBatchInput input) {
final List<BatchUpdateGroups> batchUpdateGroups = input.getBatchUpdateGroups();
LOG.trace("Updating groups @ {} : {}", PathUtil.extractNodeId(input.getNode()), batchUpdateGroups.size());
}
@Override
- public Future<RpcResult<AddGroupsBatchOutput>> addGroupsBatch(final AddGroupsBatchInput input) {
+ public ListenableFuture<RpcResult<AddGroupsBatchOutput>> addGroupsBatch(final AddGroupsBatchInput input) {
LOG.trace("Adding groups @ {} : {}", PathUtil.extractNodeId(input.getNode()), input.getBatchAddGroups().size());
final ArrayList<ListenableFuture<RpcResult<AddGroupOutput>>> resultsLot = new ArrayList<>();
for (BatchAddGroups addGroup : input.getBatchAddGroups()) {
}
@Override
- public Future<RpcResult<RemoveGroupsBatchOutput>> removeGroupsBatch(final RemoveGroupsBatchInput input) {
+ public ListenableFuture<RpcResult<RemoveGroupsBatchOutput>> removeGroupsBatch(final RemoveGroupsBatchInput input) {
LOG.trace("Removing groups @ {} : {}", PathUtil.extractNodeId(input.getNode()),
input.getBatchRemoveGroups().size());
final ArrayList<ListenableFuture<RpcResult<RemoveGroupOutput>>> resultsLot = new ArrayList<>();
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
-import java.util.concurrent.Future;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
}
@Override
- public Future<RpcResult<AddMeterOutput>> addMeter(final AddMeterInput input) {
+ public ListenableFuture<RpcResult<AddMeterOutput>> addMeter(final AddMeterInput input) {
final ListenableFuture<RpcResult<AddMeterOutput>> resultFuture =
addMeterMessage.canUseSingleLayerSerialization()
? addMeterMessage.handleServiceCall(input)
}
@Override
- public Future<RpcResult<UpdateMeterOutput>> updateMeter(final UpdateMeterInput input) {
+ public ListenableFuture<RpcResult<UpdateMeterOutput>> updateMeter(final UpdateMeterInput input) {
final ListenableFuture<RpcResult<UpdateMeterOutput>> resultFuture =
updateMeterMessage.canUseSingleLayerSerialization()
? updateMeterMessage.handleServiceCall(input.getUpdatedMeter())
}
@Override
- public Future<RpcResult<RemoveMeterOutput>> removeMeter(final RemoveMeterInput input) {
+ public ListenableFuture<RpcResult<RemoveMeterOutput>> removeMeter(final RemoveMeterInput input) {
final ListenableFuture<RpcResult<RemoveMeterOutput>> resultFuture =
removeMeterMessage.canUseSingleLayerSerialization()
? removeMeterMessage.handleServiceCall(input)
import com.google.common.util.concurrent.MoreExecutors;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import java.util.stream.Collectors;
import org.opendaylight.openflowplugin.impl.util.BarrierUtil;
import org.opendaylight.openflowplugin.impl.util.MeterUtil;
}
@Override
- public Future<RpcResult<UpdateMetersBatchOutput>> updateMetersBatch(final UpdateMetersBatchInput input) {
+ public ListenableFuture<RpcResult<UpdateMetersBatchOutput>> updateMetersBatch(final UpdateMetersBatchInput input) {
final List<BatchUpdateMeters> batchUpdateMeters = input.getBatchUpdateMeters();
LOG.trace("Updating meters @ {} : {}", PathUtil.extractNodeId(input.getNode()), batchUpdateMeters.size());
}
@Override
- public Future<RpcResult<AddMetersBatchOutput>> addMetersBatch(final AddMetersBatchInput input) {
+ public ListenableFuture<RpcResult<AddMetersBatchOutput>> addMetersBatch(final AddMetersBatchInput input) {
LOG.trace("Adding meters @ {} : {}", PathUtil.extractNodeId(input.getNode()), input.getBatchAddMeters().size());
final ArrayList<ListenableFuture<RpcResult<AddMeterOutput>>> resultsLot = new ArrayList<>();
for (BatchAddMeters addMeter : input.getBatchAddMeters()) {
}
@Override
- public Future<RpcResult<RemoveMetersBatchOutput>> removeMetersBatch(final RemoveMetersBatchInput input) {
+ public ListenableFuture<RpcResult<RemoveMetersBatchOutput>> removeMetersBatch(final RemoveMetersBatchInput input) {
LOG.trace("Removing meters @ {} : {}",
PathUtil.extractNodeId(input.getNode()),
input.getBatchRemoveMeters().size());
*/
package org.opendaylight.openflowplugin.impl.services.sal;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.Optional;
-import java.util.concurrent.Future;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
}
@Override
- public Future<RpcResult<UpdatePortOutput>> updatePort(final UpdatePortInput input) {
+ public ListenableFuture<RpcResult<UpdatePortOutput>> updatePort(final UpdatePortInput input) {
return portMessage.canUseSingleLayerSerialization()
? portMessage.handleServiceCall(getPortFromInput(input))
: handleServiceCall(input);
}
@Override
- public Future<RpcResult<SetRoleOutput>> setRole(final SetRoleInput input) {
+ public ListenableFuture<RpcResult<SetRoleOutput>> setRole(final SetRoleInput input) {
LOG.info("SetRole called with input:{}", input);
// Check current connection state
return BigInteger.ZERO;
}
}
-}
\ No newline at end of file
+}
*/
package org.opendaylight.openflowplugin.impl.services.sal;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProvider;
}
@Override
- public Future<RpcResult<UpdateTableOutput>> updateTable(final UpdateTableInput input) {
+ public ListenableFuture<RpcResult<UpdateTableOutput>> updateTable(final UpdateTableInput input) {
return singleLayerService.canUseSingleLayerSerialization()
? singleLayerService.handleAndReply(input)
: multiLayerService.handleAndReply(input);
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
-import java.util.concurrent.Future;
import java.util.stream.Collectors;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
}
@Override
- public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> handleAndReply(
+ public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> handleAndReply(
final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
return Futures.transform(handleServiceCall(input), result -> {
if (Preconditions.checkNotNull(result).isSuccessful()) {
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import java.util.List;
-import java.util.concurrent.Future;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
}
@Override
- public Future<RpcResult<SendExperimenterMpRequestOutput>> handleAndReply(SendExperimenterMpRequestInput input) {
+ public ListenableFuture<RpcResult<SendExperimenterMpRequestOutput>> handleAndReply(
+ SendExperimenterMpRequestInput input) {
final SettableFuture<RpcResult<SendExperimenterMpRequestOutput>> future = SettableFuture.create();
Futures.addCallback(handleServiceCall(input), new FutureCallback<RpcResult<List<MultipartReply>>>() {
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.impl.services.AbstractVoidService;
+import org.opendaylight.openflowplugin.impl.services.AbstractSimpleService;
import org.opendaylight.openflowplugin.impl.services.util.ServiceException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.AsyncConfigMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SetAsyncInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SetAsyncOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
-public class SingleLayerSetAsyncConfigService extends AbstractVoidService<SetAsyncInput> {
+public class SingleLayerSetAsyncConfigService extends AbstractSimpleService<SetAsyncInput, SetAsyncOutput> {
public SingleLayerSetAsyncConfigService(final RequestContextStack requestContextStack,
final DeviceContext deviceContext) {
- super(requestContextStack, deviceContext);
+ super(requestContextStack, deviceContext, SetAsyncOutput.class);
}
@Override
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import java.math.BigInteger;
import java.util.List;
-import java.util.concurrent.Future;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
}
@Override
- public Future<RpcResult<UpdateTableOutput>> handleAndReply(UpdateTableInput input) {
+ public ListenableFuture<RpcResult<UpdateTableOutput>> handleAndReply(UpdateTableInput input) {
final SettableFuture<RpcResult<UpdateTableOutput>> finalFuture = SettableFuture.create();
Futures.addCallback(handleServiceCall(input), new FutureCallback<RpcResult<List<MultipartReply>>>() {
package org.opendaylight.openflowplugin.impl.statistics;
import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Future;
import java.util.concurrent.Semaphore;
import javax.annotation.Nonnull;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.ChangeStatisticsWorkModeInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.ChangeStatisticsWorkModeOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.GetStatisticsWorkModeInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.GetStatisticsWorkModeOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.GetStatisticsWorkModeOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.StatisticsManagerControlService;
}
@Override
- public Future<RpcResult<GetStatisticsWorkModeOutput>> getStatisticsWorkMode() {
+ public ListenableFuture<RpcResult<GetStatisticsWorkModeOutput>> getStatisticsWorkMode(
+ GetStatisticsWorkModeInput input) {
return RpcResultBuilder.success(new GetStatisticsWorkModeOutputBuilder()
.setMode(workMode)
.build()).buildFuture();
}
@Override
- public Future<RpcResult<Void>> changeStatisticsWorkMode(ChangeStatisticsWorkModeInput input) {
+ public ListenableFuture<RpcResult<ChangeStatisticsWorkModeOutput>> changeStatisticsWorkMode(
+ ChangeStatisticsWorkModeInput input) {
if (workModeGuard.tryAcquire()) {
final StatisticsWorkMode targetWorkMode = input.getMode();
isStatisticsFullyDisabled = StatisticsWorkMode.FULLYDISABLED.equals(targetWorkMode);
});
workModeGuard.release();
- return RpcResultBuilder.<Void>success().buildFuture();
+ return RpcResultBuilder.<ChangeStatisticsWorkModeOutput>success().buildFuture();
}
- return RpcResultBuilder.<Void>failed()
+ return RpcResultBuilder.<ChangeStatisticsWorkModeOutput>failed()
.withError(RpcError.ErrorType.APPLICATION,
"Statistics work mode change is already in progress")
.buildFuture();
*/
package org.opendaylight.openflowplugin.impl.statistics.services;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary;
*/
@Override
@Deprecated
- public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>>
+ public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>>
getAggregateFlowStatisticsFromFlowTableForAllFlows(
final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
if (delegate != null) {
}
@Override
- public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>
+ public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>
getAggregateFlowStatisticsFromFlowTableForGivenMatch(
final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
return singleLayerService.canUseSingleLayerSerialization()
*/
@Override
@Deprecated
- public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
+ public ListenableFuture<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
final GetAllFlowStatisticsFromFlowTableInput input) {
if (delegate != null) {
return delegate.getAllFlowStatisticsFromFlowTable(input);
*/
@Override
@Deprecated
- public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
- final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
+ public ListenableFuture<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>>
+ getAllFlowsStatisticsFromAllFlowTables(final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
if (delegate != null) {
return delegate.getAllFlowsStatisticsFromAllFlowTables(input);
} else {
*/
@Override
@Deprecated
- public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
+ public ListenableFuture<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
final GetFlowStatisticsFromFlowTableInput input) {
if (delegate != null) {
return delegate.getFlowStatisticsFromFlowTable(input);
*/
package org.opendaylight.openflowplugin.impl.statistics.services;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicLong;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
}
@Override
- public Future<RpcResult<GetFlowTablesStatisticsOutput>> getFlowTablesStatistics(
+ public ListenableFuture<RpcResult<GetFlowTablesStatisticsOutput>> getFlowTablesStatistics(
final GetFlowTablesStatisticsInput input) {
return handleAndNotify(input, notificationPublishService);
}
*/
package org.opendaylight.openflowplugin.impl.statistics.services;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.atomic.AtomicLong;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
}
@Override
- public Future<RpcResult<GetAllGroupStatisticsOutput>> getAllGroupStatistics(
+ public ListenableFuture<RpcResult<GetAllGroupStatisticsOutput>> getAllGroupStatistics(
final GetAllGroupStatisticsInput input) {
return allGroups.handleAndNotify(input, notificationPublishService);
}
@Override
- public Future<RpcResult<GetGroupDescriptionOutput>> getGroupDescription(final GetGroupDescriptionInput input) {
+ public ListenableFuture<RpcResult<GetGroupDescriptionOutput>> getGroupDescription(
+ final GetGroupDescriptionInput input) {
return groupDesc.handleAndNotify(input, notificationPublishService);
}
@Override
- public Future<RpcResult<GetGroupFeaturesOutput>> getGroupFeatures(final GetGroupFeaturesInput input) {
+ public ListenableFuture<RpcResult<GetGroupFeaturesOutput>> getGroupFeatures(final GetGroupFeaturesInput input) {
return groupFeat.handleAndNotify(input, notificationPublishService);
}
@Override
- public Future<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(final GetGroupStatisticsInput input) {
+ public ListenableFuture<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(
+ final GetGroupStatisticsInput input) {
return groupStats.handleAndNotify(input, notificationPublishService);
}
}
*/
package org.opendaylight.openflowplugin.impl.statistics.services;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.atomic.AtomicLong;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
}
@Override
- public Future<RpcResult<GetAllMeterConfigStatisticsOutput>> getAllMeterConfigStatistics(
+ public ListenableFuture<RpcResult<GetAllMeterConfigStatisticsOutput>> getAllMeterConfigStatistics(
final GetAllMeterConfigStatisticsInput input) {
return allMeterConfig.handleAndNotify(input, notificationPublishService);
}
@Override
- public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(
+ public ListenableFuture<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(
final GetAllMeterStatisticsInput input) {
return allMeterStats.handleAndNotify(input, notificationPublishService);
}
@Override
- public Future<RpcResult<GetMeterFeaturesOutput>> getMeterFeatures(final GetMeterFeaturesInput input) {
+ public ListenableFuture<RpcResult<GetMeterFeaturesOutput>> getMeterFeatures(final GetMeterFeaturesInput input) {
return meterFeatures.handleAndNotify(input, notificationPublishService);
}
@Override
- public Future<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(final GetMeterStatisticsInput input) {
+ public ListenableFuture<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(
+ final GetMeterStatisticsInput input) {
return meterStats.handleAndNotify(input, notificationPublishService);
}
}
*/
package org.opendaylight.openflowplugin.impl.statistics.services;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.atomic.AtomicLong;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
}
@Override
- public Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> getAllNodeConnectorsStatistics(
+ public ListenableFuture<RpcResult<GetAllNodeConnectorsStatisticsOutput>> getAllNodeConnectorsStatistics(
final GetAllNodeConnectorsStatisticsInput input) {
return allPortStats.handleAndNotify(input, notificationPublishService);
}
@Override
- public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
+ public ListenableFuture<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
final GetNodeConnectorStatisticsInput input) {
return portStats.handleAndNotify(input, notificationPublishService);
}
*/
package org.opendaylight.openflowplugin.impl.statistics.services;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.atomic.AtomicLong;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
}
@Override
- public Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> getAllQueuesStatisticsFromAllPorts(
+ public ListenableFuture<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> getAllQueuesStatisticsFromAllPorts(
final GetAllQueuesStatisticsFromAllPortsInput input) {
return allQueuesAllPorts.handleAndNotify(input, notificationPublishService);
}
@Override
- public Future<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> getAllQueuesStatisticsFromGivenPort(
+ public ListenableFuture<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> getAllQueuesStatisticsFromGivenPort(
final GetAllQueuesStatisticsFromGivenPortInput input) {
return allQueuesOnePort.handleAndNotify(input, notificationPublishService);
}
@Override
- public Future<RpcResult<GetQueueStatisticsFromGivenPortOutput>> getQueueStatisticsFromGivenPort(
+ public ListenableFuture<RpcResult<GetQueueStatisticsFromGivenPortOutput>> getQueueStatisticsFromGivenPort(
final GetQueueStatisticsFromGivenPortInput input) {
return oneQueueOnePort.handleAndNotify(input, notificationPublishService);
}
*/
package org.opendaylight.openflowplugin.impl.statistics.services.compatibility;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.atomic.AtomicLong;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
*/
@Override
@Deprecated
- public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>
+ public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>
getAggregateFlowStatisticsFromFlowTableForGivenMatch(
final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
throw new IllegalAccessError("unsupported by backward compatibility delegate service "
}
@Override
- public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>>
+ public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>>
getAggregateFlowStatisticsFromFlowTableForAllFlows(
final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
return aggregateFlowsInTable.handleAndNotify(input, notificationService);
}
@Override
- public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
+ public ListenableFuture<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
final GetAllFlowStatisticsFromFlowTableInput input) {
return allFlowsInTable.handleAndNotify(input, notificationService);
}
@Override
- public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
- final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
+ public ListenableFuture<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>>
+ getAllFlowsStatisticsFromAllFlowTables(final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
return allFlowsInAllTables.handleAndNotify(input, notificationService);
}
@Override
- public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
+ public ListenableFuture<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
final GetFlowStatisticsFromFlowTableInput input) {
return flowsInTable.handleAndNotify(input, notificationService);
}
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.List;
-import java.util.concurrent.Future;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
* @param input the input
* @return the future
*/
- Future<RpcResult<O>> handleAndReply(final I input) {
+ ListenableFuture<RpcResult<O>> handleAndReply(final I input) {
final ListenableFuture<RpcResult<List<T>>> rpcReply = handleServiceCall(input);
ListenableFuture<RpcResult<O>> rpcResult = Futures.transform(rpcReply,
this::transformResult,
package org.opendaylight.openflowplugin.impl.statistics.services.direct;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetGroupStatisticsInput;
@Override
@SuppressWarnings("unchecked")
- public Future<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(GetGroupStatisticsInput input) {
+ public ListenableFuture<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(GetGroupStatisticsInput input) {
return provider.lookup(AbstractGroupDirectStatisticsService.class)
.map(service -> service.handleAndReply(input))
.orElse(missingImplementation(AbstractGroupDirectStatisticsService.class));
@Override
@SuppressWarnings("unchecked")
- public Future<RpcResult<GetQueueStatisticsOutput>> getQueueStatistics(GetQueueStatisticsInput input) {
+ public ListenableFuture<RpcResult<GetQueueStatisticsOutput>> getQueueStatistics(GetQueueStatisticsInput input) {
return provider.lookup(AbstractQueueDirectStatisticsService.class)
.map(service -> service.handleAndReply(input))
.orElse(missingImplementation(AbstractQueueDirectStatisticsService.class));
@Override
@SuppressWarnings("unchecked")
- public Future<RpcResult<GetFlowStatisticsOutput>> getFlowStatistics(GetFlowStatisticsInput input) {
+ public ListenableFuture<RpcResult<GetFlowStatisticsOutput>> getFlowStatistics(GetFlowStatisticsInput input) {
return provider.lookup(AbstractFlowDirectStatisticsService.class)
.map(service -> service.handleAndReply(input))
.orElse(missingImplementation(AbstractFlowDirectStatisticsService.class));
@Override
@SuppressWarnings("unchecked")
- public Future<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(GetMeterStatisticsInput input) {
+ public ListenableFuture<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(GetMeterStatisticsInput input) {
return provider.lookup(AbstractMeterDirectStatisticsService.class)
.map(service -> service.handleAndReply(input))
.orElse(missingImplementation(AbstractMeterDirectStatisticsService.class));
@Override
@SuppressWarnings("unchecked")
- public Future<RpcResult<GetNodeConnectorStatisticsOutput>>
+ public ListenableFuture<RpcResult<GetNodeConnectorStatisticsOutput>>
getNodeConnectorStatistics(GetNodeConnectorStatisticsInput input) {
return provider.lookup(AbstractPortDirectStatisticsService.class)
.map(service -> service.handleAndReply(input))
.orElse(missingImplementation(AbstractPortDirectStatisticsService.class));
}
- private static <T extends DataObject> Future<RpcResult<T>> missingImplementation(Class service) {
+ private static <T extends DataObject> ListenableFuture<RpcResult<T>> missingImplementation(Class service) {
return RpcResultBuilder.<T>failed().withError(
RpcError.ErrorType.APPLICATION,
String.format("No implementation found for direct statistics service %s.", service.getCanonicalName()))
import com.google.common.util.concurrent.JdkFutureAdapters;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
-import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.FlowCapableTransactionService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yangtools.yang.common.RpcResult;
public static <T> ListenableFuture<RpcResult<T>> chainBarrier(
final ListenableFuture<RpcResult<T>> input, final NodeRef nodeRef,
final FlowCapableTransactionService transactionService,
- final Function<Pair<RpcResult<T>, RpcResult<Void>>, RpcResult<T>> compositeTransform) {
- final MutablePair<RpcResult<T>, RpcResult<Void>> resultPair = new MutablePair<>();
+ final Function<Pair<RpcResult<T>, RpcResult<SendBarrierOutput>>, RpcResult<T>> compositeTransform) {
+ final MutablePair<RpcResult<T>, RpcResult<SendBarrierOutput>> resultPair = new MutablePair<>();
// store input result and append barrier
- final ListenableFuture<RpcResult<Void>> barrierResult = Futures.transformAsync(input,
+ final ListenableFuture<RpcResult<SendBarrierOutput>> barrierResult = Futures.transformAsync(input,
interInput -> {
resultPair.setLeft(interInput);
final SendBarrierInput barrierInput = createSendBarrierInput(nodeRef);
return JdkFutureAdapters.listenInPoolThread(transactionService.sendBarrier(barrierInput));
}, MoreExecutors.directExecutor());
// store barrier result and return initiated pair
- final ListenableFuture<Pair<RpcResult<T>, RpcResult<Void>>> compositeResult = Futures.transform(
- barrierResult, new Function<RpcResult<Void>, Pair<RpcResult<T>, RpcResult<Void>>>() {
- @Nullable
- @Override
- public Pair<RpcResult<T>, RpcResult<Void>> apply(@Nullable final RpcResult<Void> input) {
- resultPair.setRight(input);
- return resultPair;
- }
- }, MoreExecutors.directExecutor());
+ final ListenableFuture<Pair<RpcResult<T>, RpcResult<SendBarrierOutput>>> compositeResult = Futures.transform(
+ barrierResult,
+ input1 -> {
+ resultPair.setRight(input1);
+ return resultPair;
+ }, MoreExecutors.directExecutor());
// append assembling transform to barrier result
return Futures.transform(compositeResult, compositeTransform, MoreExecutors.directExecutor());
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.AddFlowsBatchOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.AddFlowsBatchOutputBuilder;
* Attach barrier response to given {@link RpcResult}<RemoveFlowsBatchOutput>.
*/
public static final Function<Pair<RpcResult<RemoveFlowsBatchOutput>,
- RpcResult<Void>>,
+ RpcResult<SendBarrierOutput>>,
RpcResult<RemoveFlowsBatchOutput>>
FLOW_REMOVE_COMPOSING_TRANSFORM = createComposingFunction();
/**
* Attach barrier response to given {@link RpcResult}<AddFlowsBatchOutput>.
*/
- public static final Function<Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<Void>>, RpcResult<AddFlowsBatchOutput>>
+ public static final Function<Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddFlowsBatchOutput>>
FLOW_ADD_COMPOSING_TRANSFORM = createComposingFunction();
/**
* Attach barrier response to given {@link RpcResult}<UpdateFlowsBatchOutput>.
*/
public static final Function<Pair<RpcResult<UpdateFlowsBatchOutput>,
- RpcResult<Void>>,
+ RpcResult<SendBarrierOutput>>,
RpcResult<UpdateFlowsBatchOutput>>
FLOW_UPDATE_COMPOSING_TRANSFORM = createComposingFunction();
*/
@VisibleForTesting
static <T extends BatchFlowOutputListGrouping>
- Function<Pair<RpcResult<T>, RpcResult<Void>>, RpcResult<T>> createComposingFunction() {
+ Function<Pair<RpcResult<T>, RpcResult<SendBarrierOutput>>, RpcResult<T>> createComposingFunction() {
return input -> {
final RpcResultBuilder<T> resultBld;
if (input.getLeft().isSuccessful() && input.getRight().isSuccessful()) {
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
return resultBld.build();
};
public static final Function<Pair<RpcResult<AddGroupsBatchOutput>,
- RpcResult<Void>>,
+ RpcResult<SendBarrierOutput>>,
RpcResult<AddGroupsBatchOutput>>
GROUP_ADD_COMPOSING_TRANSFORM = createComposingFunction();
return resultBld.build();
};
public static final Function<Pair<RpcResult<RemoveGroupsBatchOutput>,
- RpcResult<Void>>,
+ RpcResult<SendBarrierOutput>>,
RpcResult<RemoveGroupsBatchOutput>>
GROUP_REMOVE_COMPOSING_TRANSFORM = createComposingFunction();
return resultBld.build();
};
public static final Function<Pair<RpcResult<UpdateGroupsBatchOutput>,
- RpcResult<Void>>,
+ RpcResult<SendBarrierOutput>>,
RpcResult<UpdateGroupsBatchOutput>>
GROUP_UPDATE_COMPOSING_TRANSFORM = createComposingFunction();
* @return reusable static function
*/
@VisibleForTesting
- static <T extends BatchGroupOutputListGrouping> Function<Pair<RpcResult<T>, RpcResult<Void>>, RpcResult<T>>
+ static <T extends BatchGroupOutputListGrouping> Function<Pair<RpcResult<T>, RpcResult<SendBarrierOutput>>,
+ RpcResult<T>>
createComposingFunction() {
return input -> {
final RpcResultBuilder<T> resultBld;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef;
return resultBld.build();
};
public static final Function<Pair<RpcResult<AddMetersBatchOutput>,
- RpcResult<Void>>,
+ RpcResult<SendBarrierOutput>>,
RpcResult<AddMetersBatchOutput>>
METER_ADD_COMPOSING_TRANSFORM = createComposingFunction();
return resultBld.build();
};
public static final Function<Pair<RpcResult<RemoveMetersBatchOutput>,
- RpcResult<Void>>,
+ RpcResult<SendBarrierOutput>>,
RpcResult<RemoveMetersBatchOutput>>
METER_REMOVE_COMPOSING_TRANSFORM = createComposingFunction();
return resultBld.build();
};
public static final Function<Pair<RpcResult<UpdateMetersBatchOutput>,
- RpcResult<Void>>,
+ RpcResult<SendBarrierOutput>>,
RpcResult<UpdateMetersBatchOutput>>
METER_UPDATE_COMPOSING_TRANSFORM = createComposingFunction();
*/
@VisibleForTesting
static <T extends BatchMeterOutputListGrouping>
- Function<Pair<RpcResult<T>, RpcResult<Void>>, RpcResult<T>> createComposingFunction() {
+ Function<Pair<RpcResult<T>, RpcResult<SendBarrierOutput>>, RpcResult<T>> createComposingFunction() {
return input -> {
final RpcResultBuilder<T> resultBld;
if (input.getLeft().isSuccessful() && input.getRight().isSuccessful()) {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder;
Mockito.verify(connection).setMessageListener(ofpListenerAC.capture());
// prepare void reply (hello rpc output)
- final SettableFuture<RpcResult<Void>> voidResponseFx = SettableFuture.<RpcResult<Void>>create();
+ final SettableFuture<RpcResult<HelloOutput>> voidResponseFx = SettableFuture.create();
Mockito.when(connection.hello(Matchers.any(HelloInput.class))).thenReturn(voidResponseFx);
// prepare getFeature reply (getFeture rpc output)
final SettableFuture<RpcResult<GetFeaturesOutput>> featureResponseFx =
// deliver hello send output (void)
Thread.sleep(100L);
- final RpcResult<Void> helloResponse = RpcResultBuilder.success((Void) null).build();
+ final RpcResult<HelloOutput> helloResponse = RpcResultBuilder.success((HelloOutput) null).build();
voidResponseFx.set(helloResponse);
// send hello reply
Mockito.verify(connection).setMessageListener(ofpListenerAC.capture());
// prepare void reply (hello rpc output)
- final SettableFuture<RpcResult<Void>> voidResponseFx = SettableFuture.<RpcResult<Void>>create();
+ final SettableFuture<RpcResult<HelloOutput>> voidResponseFx = SettableFuture.create();
Mockito.when(connection.hello(Matchers.any(HelloInput.class))).thenReturn(voidResponseFx);
// prepare getFeature reply (getFeture rpc output)
final SettableFuture<RpcResult<GetFeaturesOutput>> featureResponseFx =
// deliver hello send output (void)
Thread.sleep(100L);
- final RpcResult<Void> helloResponse = RpcResultBuilder.success((Void) null).build();
+ final RpcResult<HelloOutput> helloResponse = RpcResultBuilder.success((HelloOutput) null).build();
voidResponseFx.set(helloResponse);
// deliver getFeature output
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.ElementsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder;
resultFeatures = RpcResultBuilder.success(new GetFeaturesOutputBuilder().build()).build();
Mockito.when(adapter.hello(Matchers.any(HelloInput.class)))
- .thenReturn(Futures.immediateFuture(RpcResultBuilder.success((Void) null).build()));
+ .thenReturn(Futures.immediateFuture(RpcResultBuilder.success((HelloOutput) null).build()));
}
/**
package org.opendaylight.openflowplugin.impl.connection.listener;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import java.net.InetSocketAddress;
-import java.util.concurrent.Future;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.TimeUnit;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
*/
@Test
public void testOnSwitchIdleEvent1() throws Exception {
- final Future<RpcResult<EchoOutput>> echoReply =
+ final ListenableFuture<RpcResult<EchoOutput>> echoReply =
Futures.immediateFuture(RpcResultBuilder.success(new EchoOutputBuilder().setXid(0L).build()).build());
Mockito.when(connectionAdapter.echo(Matchers.any(EchoInput.class))).thenReturn(echoReply);
Mockito.verify(connectionContext, Mockito.timeout(SAFE_TIMEOUT).atLeastOnce()).getConnectionState();
Mockito.verify(connectionContext, Mockito.timeout(SAFE_TIMEOUT).atLeastOnce()).getFeatures();
}
-}
\ No newline at end of file
+}
import static org.mockito.Mockito.when;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import io.netty.util.HashedWheelTimer;
-import java.util.concurrent.Future;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@Mock
private DeviceContext deviceContext;
@Mock
- private Future<RpcResult<SetRoleOutput>> setRoleFuture;
+ private ListenableFuture<RpcResult<SetRoleOutput>> setRoleFuture;
@Mock
private OpenflowProviderConfig config;
private RoleContext roleContext;
verify(setRoleFuture).cancel(true);
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.GetAsyncOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.GetAsyncOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SetAsyncInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SetAsyncOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput;
import org.opendaylight.yangtools.yang.common.RpcResult;
final ListenableFuture<RpcResult<SetAsyncInput>> replyFuture = Futures.immediateFuture(replyRpcResult);
Mockito.when(mockedRequestContext.getFuture()).thenReturn(replyFuture);
- final Future<RpcResult<Void>> setAsyncResult =
+ final ListenableFuture<RpcResult<SetAsyncOutput>> setAsyncResult =
salAsyncConfigService.setAsync(new SetAsyncInputBuilder().build());
Assert.assertNotNull(setAsyncResult);
experimenterBuilder.setExperimenterMessageOfChoice(new BundleControlSalBuilder()
.setSalControlData(new SalControlDataBuilder(input).build())
.build());
+ Mockito.when(experimenterMessageService.sendExperimenter(Matchers.any())).thenReturn(SettableFuture.create());
service.controlBundle(input);
Mockito.verify(experimenterMessageService).sendExperimenter(experimenterBuilder.build());
}
return messages;
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.FlowCapableTransactionService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.AddFlowsBatchInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.AddFlowsBatchInputBuilder;
salFlowsBatchService = new SalFlowsBatchServiceImpl(salFlowService, transactionService);
Mockito.when(transactionService.sendBarrier(Matchers.<SendBarrierInput>any()))
- .thenReturn(RpcResultBuilder.<Void>success().buildFuture());
+ .thenReturn(RpcResultBuilder.<SendBarrierOutput>success().buildFuture());
}
@After
import org.mockito.runners.MockitoJUnitRunner;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.FlowCapableTransactionService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutputBuilder;
salGroupsBatchService = new SalGroupsBatchServiceImpl(salGroupService, transactionService);
Mockito.when(transactionService.sendBarrier(Matchers.<SendBarrierInput>any()))
- .thenReturn(RpcResultBuilder.<Void>success().buildFuture());
+ .thenReturn(RpcResultBuilder.<SendBarrierOutput>success().buildFuture());
}
@After
import org.mockito.runners.MockitoJUnitRunner;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.FlowCapableTransactionService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
public void setUp() throws Exception {
salMetersBatchService = new SalMetersBatchServiceImpl(salMeterService, transactionService);
- Mockito.when(transactionService.sendBarrier(Matchers.<SendBarrierInput>any()))
- .thenReturn(RpcResultBuilder.<Void>success().buildFuture());
+ Mockito.when(transactionService.sendBarrier(Matchers.any()))
+ .thenReturn(RpcResultBuilder.<SendBarrierOutput>success().buildFuture());
}
@After
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.lang.reflect.Field;
import java.math.BigInteger;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.ChangeStatisticsWorkModeInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.ChangeStatisticsWorkModeOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.GetStatisticsWorkModeOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.StatisticsManagerControlService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.StatisticsWorkMode;
@Test
public void testGetStatisticsWorkMode() throws Exception {
- final Future<RpcResult<GetStatisticsWorkModeOutput>> workMode = statisticsManager.getStatisticsWorkMode();
+ final Future<RpcResult<GetStatisticsWorkModeOutput>> workMode = statisticsManager.getStatisticsWorkMode(null);
Assert.assertTrue(workMode.isDone());
Assert.assertTrue(workMode.get().isSuccessful());
assertNotNull(workMode.get().getResult());
new ChangeStatisticsWorkModeInputBuilder()
.setMode(StatisticsWorkMode.FULLYDISABLED);
- final Future<RpcResult<Void>> workMode = statisticsManager
+ final ListenableFuture<RpcResult<ChangeStatisticsWorkModeOutput>> workMode = statisticsManager
.changeStatisticsWorkMode(changeStatisticsWorkModeInputBld.build());
checkWorkModeChangeOutcome(workMode);
verify(statisticContext).disableGathering();
}
- private static void checkWorkModeChangeOutcome(Future<RpcResult<Void>> workMode)
+ private static void checkWorkModeChangeOutcome(ListenableFuture<RpcResult<ChangeStatisticsWorkModeOutput>> workMode)
throws InterruptedException, ExecutionException {
Assert.assertTrue(workMode.isDone());
Assert.assertTrue(workMode.get().isSuccessful());
new ChangeStatisticsWorkModeInputBuilder()
.setMode(StatisticsWorkMode.FULLYDISABLED);
- Future<RpcResult<Void>> workMode = statisticsManager
+ ListenableFuture<RpcResult<ChangeStatisticsWorkModeOutput>> workMode = statisticsManager
.changeStatisticsWorkMode(changeStatisticsWorkModeInputBld.build());
checkWorkModeChangeOutcome(workMode);
new ChangeStatisticsWorkModeInputBuilder()
.setMode(StatisticsWorkMode.FULLYDISABLED);
- Future<RpcResult<Void>> workMode;
+ ListenableFuture<RpcResult<ChangeStatisticsWorkModeOutput>> workMode;
workMode = statisticsManager.changeStatisticsWorkMode(
changeStatisticsWorkModeInputBld.build());
checkWorkModeChangeOutcome(workMode);
import org.mockito.runners.MockitoJUnitRunner;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.FlowCapableTransactionService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
@Mock
private FlowCapableTransactionService transactionService;
@Mock
- private Function<Pair<RpcResult<String>, RpcResult<Void>>, RpcResult<String>> compositeTransform;
+ private Function<Pair<RpcResult<String>, RpcResult<SendBarrierOutput>>, RpcResult<String>> compositeTransform;
@Captor
- private ArgumentCaptor<Pair<RpcResult<String>, RpcResult<Void>>> pairCpt;
+ private ArgumentCaptor<Pair<RpcResult<String>, RpcResult<SendBarrierOutput>>> pairCpt;
@Before
public void setUp() throws Exception {
Mockito.when(transactionService.sendBarrier(Matchers.<SendBarrierInput>any()))
- .thenReturn(RpcResultBuilder.<Void>success().buildFuture());
+ .thenReturn(RpcResultBuilder.<SendBarrierOutput>success().buildFuture());
}
@After
Mockito.verify(transactionService).sendBarrier(Matchers.<SendBarrierInput>any());
Mockito.verify(compositeTransform).apply(pairCpt.capture());
- final Pair<RpcResult<String>, RpcResult<Void>> value = pairCpt.getValue();
+ final Pair<RpcResult<String>, RpcResult<SendBarrierOutput>> value = pairCpt.getValue();
Assert.assertTrue(value.getLeft().isSuccessful());
Assert.assertEquals(data, value.getLeft().getResult());
Assert.assertTrue(value.getRight().isSuccessful());
Assert.assertEquals(NODE_REF, barrierInput.getNode());
Assert.assertEquals(SendBarrierInput.class, barrierInput.getImplementedInterface());
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.AddFlowsBatchOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.AddFlowsBatchOutputBuilder;
@Test
public void testCreateComposingFunction_success_success() throws Exception {
- final Function<Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<Void>>, RpcResult<AddFlowsBatchOutput>>
- compositeFunction = FlowUtil.createComposingFunction();
+ final Function<Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddFlowsBatchOutput>> compositeFunction = FlowUtil.createComposingFunction();
final RpcResult<AddFlowsBatchOutput> addFlowBatchOutput = createAddFlowsBatchSuccessOutput();
- final RpcResult<Void> barrierOutput = RpcResultBuilder.<Void>success().build();
- final Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<Void>> input = Pair.of(addFlowBatchOutput, barrierOutput);
+ final RpcResult<SendBarrierOutput> barrierOutput = RpcResultBuilder.<SendBarrierOutput>success().build();
+ final Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<SendBarrierOutput>> input
+ = Pair.of(addFlowBatchOutput, barrierOutput);
final RpcResult<AddFlowsBatchOutput> composite = compositeFunction.apply(input);
Assert.assertTrue(composite.isSuccessful());
@Test
public void testCreateComposingFunction_failure_success() throws Exception {
- final Function<Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<Void>>, RpcResult<AddFlowsBatchOutput>>
- compositeFunction = FlowUtil.createComposingFunction();
+ final Function<Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddFlowsBatchOutput>> compositeFunction = FlowUtil.createComposingFunction();
final RpcResult<AddFlowsBatchOutput> addFlowBatchOutput = createAddFlowsBatchFailureOutcome();
- final RpcResult<Void> barrierOutput = RpcResultBuilder.<Void>success().build();
- final Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<Void>> input = Pair.of(addFlowBatchOutput, barrierOutput);
+ final RpcResult<SendBarrierOutput> barrierOutput = RpcResultBuilder.<SendBarrierOutput>success().build();
+ final Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<SendBarrierOutput>> input
+ = Pair.of(addFlowBatchOutput, barrierOutput);
final RpcResult<AddFlowsBatchOutput> composite = compositeFunction.apply(input);
Assert.assertFalse(composite.isSuccessful());
@Test
public void testCreateComposingFunction_success_failure() throws Exception {
- final Function<Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<Void>>, RpcResult<AddFlowsBatchOutput>>
- compositeFunction = FlowUtil.createComposingFunction();
+ final Function<Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddFlowsBatchOutput>> compositeFunction = FlowUtil.createComposingFunction();
final RpcResult<AddFlowsBatchOutput> addFlowBatchOutput = createAddFlowsBatchSuccessOutput();
- final RpcResult<Void> barrierOutput = createBarrierFailureOutcome();
- final Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<Void>> input = Pair.of(addFlowBatchOutput, barrierOutput);
+ final RpcResult<SendBarrierOutput> barrierOutput = createBarrierFailureOutcome();
+ final Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<SendBarrierOutput>> input
+ = Pair.of(addFlowBatchOutput, barrierOutput);
final RpcResult<AddFlowsBatchOutput> composite = compositeFunction.apply(input);
Assert.assertFalse(composite.isSuccessful());
@Test
public void testCreateComposingFunction_failure_failure() throws Exception {
- final Function<Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<Void>>, RpcResult<AddFlowsBatchOutput>>
- compositeFunction = FlowUtil.createComposingFunction();
+ final Function<Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddFlowsBatchOutput>> compositeFunction = FlowUtil.createComposingFunction();
final RpcResult<AddFlowsBatchOutput> addFlowBatchOutput = createAddFlowsBatchFailureOutcome();
- final RpcResult<Void> barrierOutput = createBarrierFailureOutcome();
- final Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<Void>> input = Pair.of(addFlowBatchOutput, barrierOutput);
+ final RpcResult<SendBarrierOutput> barrierOutput = createBarrierFailureOutcome();
+ final Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<SendBarrierOutput>> input
+ = Pair.of(addFlowBatchOutput, barrierOutput);
final RpcResult<AddFlowsBatchOutput> composite = compositeFunction.apply(input);
Assert.assertFalse(composite.isSuccessful());
Assert.assertEquals(1, composite.getResult().getBatchFailedFlowsOutput().size());
}
- private RpcResult<Void> createBarrierFailureOutcome() {
- return RpcResultBuilder.<Void>failed()
+ private RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
+ return RpcResultBuilder.<SendBarrierOutput>failed()
.withError(RpcError.ErrorType.APPLICATION, "ut-barrier-error")
.build();
}
import org.apache.commons.lang3.tuple.Pair;
import org.junit.Assert;
import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
@Test
public void testCreateComposingFunction_success_success() throws Exception {
- final Function<Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<Void>>, RpcResult<AddGroupsBatchOutput>>
- compositeFunction = GroupUtil.createComposingFunction();
+ final Function<Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddGroupsBatchOutput>> compositeFunction = GroupUtil.createComposingFunction();
final RpcResult<AddGroupsBatchOutput> addGroupBatchOutput = createAddGroupsBatchSuccessOutput();
- final RpcResult<Void> barrierOutput = RpcResultBuilder.<Void>success().build();
- final Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<Void>> input =
+ final RpcResult<SendBarrierOutput> barrierOutput = RpcResultBuilder.<SendBarrierOutput>success().build();
+ final Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<SendBarrierOutput>> input =
Pair.of(addGroupBatchOutput, barrierOutput);
final RpcResult<AddGroupsBatchOutput> composite = compositeFunction.apply(input);
@Test
public void testCreateComposingFunction_failure_success() throws Exception {
- final Function<Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<Void>>, RpcResult<AddGroupsBatchOutput>>
- compositeFunction = GroupUtil.createComposingFunction();
+ final Function<Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddGroupsBatchOutput>> compositeFunction = GroupUtil.createComposingFunction();
final RpcResult<AddGroupsBatchOutput> addGroupBatchOutput = createAddGroupsBatchFailureOutcome();
- final RpcResult<Void> barrierOutput = RpcResultBuilder.<Void>success().build();
- final Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<Void>> input =
+ final RpcResult<SendBarrierOutput> barrierOutput = RpcResultBuilder.<SendBarrierOutput>success().build();
+ final Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<SendBarrierOutput>> input =
Pair.of(addGroupBatchOutput, barrierOutput);
final RpcResult<AddGroupsBatchOutput> composite = compositeFunction.apply(input);
@Test
public void testCreateComposingFunction_success_failure() throws Exception {
- final Function<Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<Void>>, RpcResult<AddGroupsBatchOutput>>
- compositeFunction = GroupUtil.createComposingFunction();
+ final Function<Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddGroupsBatchOutput>> compositeFunction = GroupUtil.createComposingFunction();
final RpcResult<AddGroupsBatchOutput> addGroupBatchOutput = createAddGroupsBatchSuccessOutput();
- final RpcResult<Void> barrierOutput = createBarrierFailureOutcome();
- final Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<Void>> input =
+ final RpcResult<SendBarrierOutput> barrierOutput = createBarrierFailureOutcome();
+ final Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<SendBarrierOutput>> input =
Pair.of(addGroupBatchOutput, barrierOutput);
final RpcResult<AddGroupsBatchOutput> composite = compositeFunction.apply(input);
@Test
public void testCreateComposingFunction_failure_failure() throws Exception {
- final Function<Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<Void>>, RpcResult<AddGroupsBatchOutput>>
- compositeFunction = GroupUtil.createComposingFunction();
+ final Function<Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddGroupsBatchOutput>> compositeFunction = GroupUtil.createComposingFunction();
final RpcResult<AddGroupsBatchOutput> addGroupBatchOutput = createAddGroupsBatchFailureOutcome();
- final RpcResult<Void> barrierOutput = createBarrierFailureOutcome();
- final Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<Void>> input =
+ final RpcResult<SendBarrierOutput> barrierOutput = createBarrierFailureOutcome();
+ final Pair<RpcResult<AddGroupsBatchOutput>, RpcResult<SendBarrierOutput>> input =
Pair.of(addGroupBatchOutput, barrierOutput);
final RpcResult<AddGroupsBatchOutput> composite = compositeFunction.apply(input);
assertEquals(GROUP_ACTION_BITMAP, bitmap);
}
- private RpcResult<Void> createBarrierFailureOutcome() {
- return RpcResultBuilder.<Void>failed()
+ private RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
+ return RpcResultBuilder.<SendBarrierOutput>failed()
.withError(RpcError.ErrorType.APPLICATION, "ut-barrier-error")
.build();
}
.withRpcErrors(batchOutcomeWithError.getErrors())
.build();
}
-}
\ No newline at end of file
+}
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
@Test
public void testCreateComposingFunction_success_success() throws Exception {
- final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>>, RpcResult<AddMetersBatchOutput>>
- compositeFunction = MeterUtil.createComposingFunction();
+ final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddMetersBatchOutput>> compositeFunction = MeterUtil.createComposingFunction();
final RpcResult<AddMetersBatchOutput> addGroupBatchOutput = createAddMetersBatchSuccessOutput();
- final RpcResult<Void> barrierOutput = RpcResultBuilder.<Void>success().build();
- final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>> input =
+ final RpcResult<SendBarrierOutput> barrierOutput = RpcResultBuilder.<SendBarrierOutput>success().build();
+ final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>> input =
Pair.of(addGroupBatchOutput, barrierOutput);
final RpcResult<AddMetersBatchOutput> composite = compositeFunction.apply(input);
@Test
public void testCreateComposingFunction_failure_success() throws Exception {
- final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>>, RpcResult<AddMetersBatchOutput>>
- compositeFunction = MeterUtil.createComposingFunction();
+ final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddMetersBatchOutput>> compositeFunction = MeterUtil.createComposingFunction();
final RpcResult<AddMetersBatchOutput> addGroupBatchOutput = createAddMetersBatchFailureOutcome();
- final RpcResult<Void> barrierOutput = RpcResultBuilder.<Void>success().build();
- final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>> input =
+ final RpcResult<SendBarrierOutput> barrierOutput = RpcResultBuilder.<SendBarrierOutput>success().build();
+ final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>> input =
Pair.of(addGroupBatchOutput, barrierOutput);
final RpcResult<AddMetersBatchOutput> composite = compositeFunction.apply(input);
@Test
public void testCreateComposingFunction_success_failure() throws Exception {
- final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>>, RpcResult<AddMetersBatchOutput>>
- compositeFunction = MeterUtil.createComposingFunction();
+ final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddMetersBatchOutput>> compositeFunction = MeterUtil.createComposingFunction();
final RpcResult<AddMetersBatchOutput> addGroupBatchOutput = createAddMetersBatchSuccessOutput();
- final RpcResult<Void> barrierOutput = createBarrierFailureOutcome();
- final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>> input =
+ final RpcResult<SendBarrierOutput> barrierOutput = createBarrierFailureOutcome();
+ final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>> input =
Pair.of(addGroupBatchOutput, barrierOutput);
final RpcResult<AddMetersBatchOutput> composite = compositeFunction.apply(input);
@Test
public void testCreateComposingFunction_failure_failure() throws Exception {
- final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>>, RpcResult<AddMetersBatchOutput>>
- compositeFunction = MeterUtil.createComposingFunction();
+ final Function<Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>>,
+ RpcResult<AddMetersBatchOutput>> compositeFunction = MeterUtil.createComposingFunction();
final RpcResult<AddMetersBatchOutput> addGroupBatchOutput = createAddMetersBatchFailureOutcome();
- final RpcResult<Void> barrierOutput = createBarrierFailureOutcome();
- final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<Void>> input =
+ final RpcResult<SendBarrierOutput> barrierOutput = createBarrierFailureOutcome();
+ final Pair<RpcResult<AddMetersBatchOutput>, RpcResult<SendBarrierOutput>> input =
Pair.of(addGroupBatchOutput, barrierOutput);
final RpcResult<AddMetersBatchOutput> composite = compositeFunction.apply(input);
Assert.assertEquals(1, composite.getResult().getBatchFailedMetersOutput().size());
}
- private RpcResult<Void> createBarrierFailureOutcome() {
- return RpcResultBuilder.<Void>failed()
+ private RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
+ return RpcResultBuilder.<SendBarrierOutput>failed()
.withError(RpcError.ErrorType.APPLICATION, "ut-barrier-error")
.build();
}
.withRpcErrors(batchOutcomeWithError.getErrors())
.build();
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.SalBundleService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.Messages;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.MessagesBuilder;
LOG.debug("Open successful: {}, msg: {}", voidRpcResult.isSuccessful(),
voidRpcResult.getErrors());
- final CompletableFuture<RpcResult<Void>> addFuture =
+ final CompletableFuture<RpcResult<AddBundleMessagesOutput>> addFuture =
makeCompletableFuture(bundleService.addBundleMessages(addBundleMessagesInput));
return addFuture;
LOG.debug("AddBundleMessages successful: {}, msg: {}", voidRpcResult.isSuccessful(),
voidRpcResult.getErrors());
- final CompletableFuture<RpcResult<Void>> controlCommitFuture =
+ final CompletableFuture<RpcResult<ControlBundleOutput>> controlCommitFuture =
makeCompletableFuture(bundleService.controlBundle(commitBundleInput));
return controlCommitFuture;
package org.opendaylight.openflowplugin.test;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
* .service.rev130918.AddGroupInput)
*/
@Override
- public Future<RpcResult<AddGroupOutput>> addGroup(AddGroupInput input) {
+ public ListenableFuture<RpcResult<AddGroupOutput>> addGroup(AddGroupInput input) {
String plus = "addGroup - " + input;
OpenflowpluginGroupTestServiceProvider.LOG.info(plus);
return null;
* .group.service.rev130918.RemoveGroupInput)
*/
@Override
- public Future<RpcResult<RemoveGroupOutput>> removeGroup(
+ public ListenableFuture<RpcResult<RemoveGroupOutput>> removeGroup(
RemoveGroupInput input) {
String plus = "removeGroup - " + input;
OpenflowpluginGroupTestServiceProvider.LOG.info(plus);
* .group.service.rev130918.UpdateGroupInput)
*/
@Override
- public Future<RpcResult<UpdateGroupOutput>> updateGroup(
+ public ListenableFuture<RpcResult<UpdateGroupOutput>> updateGroup(
UpdateGroupInput input) {
String plus = "updateGroup - " + input;
OpenflowpluginGroupTestServiceProvider.LOG.info(plus);
package org.opendaylight.openflowplugin.test;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
* .service.rev130918.AddMeterInput)
*/
@Override
- public Future<RpcResult<AddMeterOutput>> addMeter(final AddMeterInput input) {
+ public ListenableFuture<RpcResult<AddMeterOutput>> addMeter(final AddMeterInput input) {
String plus = "addMeter - " + input;
OpenflowpluginMeterTestServiceProvider.LOG.info(plus);
return null;
* .meter.service.rev130918.RemoveMeterInput)
*/
@Override
- public Future<RpcResult<RemoveMeterOutput>> removeMeter(
+ public ListenableFuture<RpcResult<RemoveMeterOutput>> removeMeter(
final RemoveMeterInput input) {
String plus = "removeMeter - " + input;
OpenflowpluginMeterTestServiceProvider.LOG.info(plus);
* .meter.service.rev130918.UpdateMeterInput)
*/
@Override
- public Future<RpcResult<UpdateMeterOutput>> updateMeter(
+ public ListenableFuture<RpcResult<UpdateMeterOutput>> updateMeter(
final UpdateMeterInput input) {
String plus = "updateMeter - " + input;
OpenflowpluginMeterTestServiceProvider.LOG.info(plus);
package org.opendaylight.openflowplugin.test;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
* .table.service.rev131026.UpdateTableInput)
*/
@Override
- public Future<RpcResult<UpdateTableOutput>> updateTable(
+ public ListenableFuture<RpcResult<UpdateTableOutput>> updateTable(
UpdateTableInput input) {
String plus = "updateTable - " + input;
OpenflowpluginTableFeaturesTestServiceProvider.LOG.info(plus);
package org.opendaylight.openflowplugin.test;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
* service.rev130819.AddFlowInput)
*/
@Override
- public Future<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
+ public ListenableFuture<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
String plus = "addFlow - " + input;
OpenflowpluginTestServiceProvider.LOG.info(plus);
return null;
* .service.rev130819.RemoveFlowInput)
*/
@Override
- public Future<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
+ public ListenableFuture<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
String plus = "removeFlow - " + input;
OpenflowpluginTestServiceProvider.LOG.info(plus);
return null;
* .service.rev130819.UpdateFlowInput)
*/
@Override
- public Future<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
+ public ListenableFuture<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
String plus = "updateFlow - " + input;
OpenflowpluginTestServiceProvider.LOG.info(plus);
return null;