Adjust for Binding RPC codegen changes 05/71205/10
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 23 Apr 2018 09:01:30 +0000 (11:01 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 22 May 2018 16:38:42 +0000 (16:38 +0000)
This adjusts RPC implementations to conform to YANG-compatible
layout with ListenableFuture. It also fixes
BindingToNormalizedNodeCodec to realign it with mdsal version.

Since we are guaranteed to be dealing with ListenableFutures, this
patch also eliminates all references to JdkFutureAdapters.

Change-Id: I068a5821493b36e03d6a34a93bf49509b970507e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
28 files changed:
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DsbenchmarkProvider.java
benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchNonblockingProducer.java
benchmark/ntfbenchmark/src/main/java/ntfbenchmark/impl/NtfbenchmarkProvider.java
benchmark/rpcbenchmark/src/main/java/rpcbenchmark/impl/GlobalBindingRTCServer.java
benchmark/rpcbenchmark/src/main/java/rpcbenchmark/impl/RpcbenchmarkProvider.java
opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopic.java
opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopology.java
opendaylight/md-sal/messagebus-util/src/main/java/org/opendaylight/controller/messagebus/app/util/Util.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMRpcImplementationAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingToNormalizedNodeCodec.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerRpcTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/MessageCapturingFlowService.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceIT.java
opendaylight/md-sal/sal-cluster-admin-impl/src/main/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcService.java
opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActorTest.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/BasicRpcTestProvider.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/CarProvider.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/MdsalLowLevelTestProvider.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PurchaseCarProvider.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PrefixLeaderHandler.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PrefixShardHandler.java
opendaylight/md-sal/samples/toaster-consumer/src/main/java/org/opendaylight/controller/sample/kitchen/impl/KitchenServiceImpl.java
opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/OpendaylightToaster.java
opendaylight/md-sal/samples/toaster-provider/src/test/java/org/opendaylight/controller/sample/toaster/provider/OpenDaylightToasterTest.java

index 229eddf..160f488 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.dsbenchmark;
 
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.Collections;
-import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicReference;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
@@ -29,6 +29,9 @@ import org.opendaylight.dsbenchmark.txchain.TxchainBaWrite;
 import org.opendaylight.dsbenchmark.txchain.TxchainDomDelete;
 import org.opendaylight.dsbenchmark.txchain.TxchainDomRead;
 import org.opendaylight.dsbenchmark.txchain.TxchainDomWrite;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.CleanupStoreInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.CleanupStoreOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.CleanupStoreOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.DsbenchmarkService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestOutput;
@@ -90,14 +93,14 @@ public class DsbenchmarkProvider implements DsbenchmarkService, AutoCloseable {
     }
 
     @Override
-    public Future<RpcResult<Void>> cleanupStore() {
+    public ListenableFuture<RpcResult<CleanupStoreOutput>> cleanupStore(final CleanupStoreInput input) {
         cleanupTestStore();
         LOG.debug("Data Store cleaned up");
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new CleanupStoreOutputBuilder().build()).build());
     }
 
     @Override
-    public Future<RpcResult<StartTestOutput>> startTest(final StartTestInput input) {
+    public ListenableFuture<RpcResult<StartTestOutput>> startTest(final StartTestInput input) {
         LOG.info("Starting the data store benchmark test, input: {}", input);
 
         // Check if there is a test in progress
index ce2adc9..e92c1f7 100644 (file)
@@ -8,7 +8,6 @@
 
 package ntfbenchmark.impl;
 
-import com.google.common.base.Throwables;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.concurrent.ExecutionException;
@@ -51,7 +50,7 @@ public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer {
             try {
                 lastOkFuture.get();
             } catch (InterruptedException | ExecutionException e) {
-                throw Throwables.propagate(e);
+                throw new RuntimeException(e);
             }
         }
     }
index 4b2a1eb..f6c112d 100644 (file)
@@ -5,15 +5,14 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package ntfbenchmark.impl;
 
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
 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 org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
@@ -22,6 +21,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.StartTestInput.ProducerType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.StartTestOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.StartTestOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.TestStatusInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.TestStatusOutput;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -53,7 +53,7 @@ public class NtfbenchmarkProvider implements AutoCloseable, NtfbenchmarkService
     }
 
     @Override
-    public Future<RpcResult<StartTestOutput>> startTest(final StartTestInput input) {
+    public ListenableFuture<RpcResult<StartTestOutput>> startTest(final StartTestInput input) {
         final int producerCount = input.getProducers().intValue();
         final int listenerCount = input.getListeners().intValue();
         final int iterations = input.getIterations().intValue();
@@ -135,7 +135,7 @@ public class NtfbenchmarkProvider implements AutoCloseable, NtfbenchmarkService
     }
 
     @Override
-    public Future<RpcResult<TestStatusOutput>> testStatus() {
+    public ListenableFuture<RpcResult<TestStatusOutput>> testStatus(final TestStatusInput input) {
         // TODO Auto-generated method stub
         return null;
     }
index 7e97768..edded6a 100644 (file)
@@ -8,8 +8,8 @@
 
 package rpcbenchmark.impl;
 
-import java.util.concurrent.Future;
-
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchInput;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchOutput;
 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchOutputBuilder;
@@ -22,8 +22,6 @@ import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.util.concurrent.Futures;
-
 public class GlobalBindingRTCServer implements RpcbenchPayloadService {
 
     private static final Logger LOG = LoggerFactory.getLogger(GlobalBindingRTCServer.class);
@@ -34,8 +32,7 @@ public class GlobalBindingRTCServer implements RpcbenchPayloadService {
     }
 
     @Override
-    public Future<RpcResult<GlobalRpcBenchOutput>> globalRpcBench(
-            final GlobalRpcBenchInput input) {
+    public ListenableFuture<RpcResult<GlobalRpcBenchOutput>> globalRpcBench(final GlobalRpcBenchInput input) {
         GlobalRpcBenchOutput output = new GlobalRpcBenchOutputBuilder(input).build();
         RpcResult<GlobalRpcBenchOutput> result = RpcResultBuilder.success(output).build();
         numRpcs++;
@@ -43,8 +40,7 @@ public class GlobalBindingRTCServer implements RpcbenchPayloadService {
     }
 
     @Override
-    public Future<RpcResult<RoutedRpcBenchOutput>> routedRpcBench(
-            final RoutedRpcBenchInput input) {
+    public ListenableFuture<RpcResult<RoutedRpcBenchOutput>> routedRpcBench(final RoutedRpcBenchInput input) {
         RoutedRpcBenchOutput output = new RoutedRpcBenchOutputBuilder(input).build();
         RpcResult<RoutedRpcBenchOutput> result = RpcResultBuilder.success(output).build();
         numRpcs++;
index 7f8be49..8e8e31e 100644 (file)
@@ -5,14 +5,13 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package rpcbenchmark.impl;
 
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
@@ -26,6 +25,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rpcbench
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rpcbenchmark.rev150702.StartTestInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rpcbenchmark.rev150702.StartTestOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rpcbenchmark.rev150702.StartTestOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rpcbenchmark.rev150702.TestStatusInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rpcbenchmark.rev150702.TestStatusOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rpcbenchmark.rev150702.TestStatusOutput.ExecStatus;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rpcbenchmark.rev150702.TestStatusOutputBuilder;
@@ -60,7 +60,7 @@ public class RpcbenchmarkProvider implements AutoCloseable, RpcbenchmarkService
     }
 
     @Override
-    public Future<RpcResult<StartTestOutput>> startTest(final StartTestInput input) {
+    public ListenableFuture<RpcResult<StartTestOutput>> startTest(final StartTestInput input) {
         LOG.debug("startTest {}", input);
 
         final RTCClient client;
@@ -135,7 +135,7 @@ public class RpcbenchmarkProvider implements AutoCloseable, RpcbenchmarkService
     }
 
     @Override
-    public Future<RpcResult<TestStatusOutput>> testStatus() {
+    public ListenableFuture<RpcResult<TestStatusOutput>> testStatus(final TestStatusInput input) {
         LOG.info("testStatus");
         TestStatusOutput output = new TestStatusOutputBuilder()
                                         .setGlobalServerCnt((long)globalServer.getNumRpcs())
index fc4dad6..8b57d2d 100644 (file)
@@ -31,6 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.even
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.TopicId;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventsource.rev141202.DisJoinTopicInput;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventsource.rev141202.DisJoinTopicInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventsource.rev141202.DisJoinTopicOutput;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventsource.rev141202.EventSourceService;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventsource.rev141202.JoinTopicInput;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventsource.rev141202.JoinTopicInputBuilder;
@@ -77,7 +78,7 @@ public final class EventSourceTopic implements DataTreeChangeListener<Node>, Aut
     }
 
     @Override
-    public void onDataTreeChanged(Collection<DataTreeModification<Node>> changes) {
+    public void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes) {
         for (DataTreeModification<Node> change: changes) {
             final DataObjectModification<Node> rootNode = change.getRootNode();
             switch (rootNode.getModificationType()) {
@@ -184,7 +185,7 @@ public final class EventSourceTopic implements DataTreeChangeListener<Node>, Aut
         }
         for (final InstanceIdentifier<?> eventSourceNodeId : joinedEventSources) {
             try {
-                final RpcResult<Void> result = sourceService
+                final RpcResult<DisJoinTopicOutput> result = sourceService
                         .disJoinTopic(getDisJoinTopicInputArgument(eventSourceNodeId)).get();
                 if (result.isSuccessful() == false) {
                     for (final RpcError err : result.getErrors()) {
index 73819b2..8f7bc92 100644 (file)
@@ -10,10 +10,10 @@ package org.opendaylight.controller.messagebus.app.impl;
 
 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 java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Future;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -28,6 +28,8 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.even
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.CreateTopicOutput;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.CreateTopicOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.DestroyTopicInput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.DestroyTopicOutput;
+import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.DestroyTopicOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.EventAggregatorService;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.NotificationPattern;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.TopicId;
@@ -143,7 +145,7 @@ public class EventSourceTopology implements EventAggregatorService, EventSourceR
     }
 
     @Override
-    public Future<RpcResult<CreateTopicOutput>> createTopic(final CreateTopicInput input) {
+    public ListenableFuture<RpcResult<CreateTopicOutput>> createTopic(final CreateTopicInput input) {
         LOG.debug("Received Topic creation request: NotificationPattern -> {}, NodeIdPattern -> {}",
                 input.getNotificationPattern(),
                 input.getNodeIdPattern());
@@ -167,12 +169,12 @@ public class EventSourceTopology implements EventAggregatorService, EventSourceR
     }
 
     @Override
-    public Future<RpcResult<Void>> destroyTopic(final DestroyTopicInput input) {
+    public ListenableFuture<RpcResult<DestroyTopicOutput>> destroyTopic(final DestroyTopicInput input) {
         final EventSourceTopic topicToDestroy = eventSourceTopicMap.remove(input.getTopicId());
         if (topicToDestroy != null) {
             topicToDestroy.close();
         }
-        return Util.resultRpcSuccessFor((Void) null);
+        return Util.resultRpcSuccessFor(new DestroyTopicOutputBuilder().build());
     }
 
     @Override
index a3f976d..0b28e55 100644 (file)
@@ -9,9 +9,9 @@
 package org.opendaylight.controller.messagebus.app.util;
 
 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 java.util.regex.Pattern;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
@@ -21,9 +21,8 @@ public final class Util {
     private Util() {
     }
 
-    public static <T> Future<RpcResult<T>> resultRpcSuccessFor(final T output) {
-        final RpcResult<T> result = RpcResultBuilder.success(output).build();
-        return Futures.immediateFuture(result);
+    public static <T> ListenableFuture<RpcResult<T>> resultRpcSuccessFor(final T output) {
+        return Futures.immediateFuture(RpcResultBuilder.success(output).build());
     }
 
     /**
index 3967ff1..83be512 100644 (file)
@@ -40,20 +40,10 @@ public interface RpcConsumerRegistry extends BindingAwareService, BindingService
      *
      * The returned proxy is automatically updated with the most recent
      * registered implementation.
-     * <p>
-     * The generated RPC method APIs require implementors to return a {@link java.util.concurrent.Future Future}
-     * instance that wraps the {@link org.opendaylight.yangtools.yang.common.RpcResult RpcResult}. Since
-     * RPC methods may be implemented asynchronously, callers should avoid blocking on the
-     * {@link java.util.concurrent.Future Future} result. Instead, it is recommended to use
-     * {@link com.google.common.util.concurrent.JdkFutureAdapters#listenInPoolThread(java.util.concurrent.Future)}
-     * or {@link com.google.common.util.concurrent.JdkFutureAdapters#listenInPoolThread(java.util.concurrent.Future,
-     *     java.util.concurrent.Executor)}
-     * to listen for Rpc Result. This will asynchronously listen for future result in executor and
-     * will not block current thread.
      *
      * {@code
      *   final Future<RpcResult<SomeRpcOutput>> future = someRpcService.someRpc( ... );
-     *   Futures.addCallback(JdkFutureAdapters.listenInThreadPool(future),
+     *   Futures.addCallback(future,
      *       new FutureCallback<RpcResult<SomeRpcOutput>>() {
      *           public void onSuccess(RpcResult<SomeRpcOutput> result) {
      *               // process result ...
index 1554f11..7e07901 100644 (file)
@@ -11,7 +11,6 @@ import com.google.common.base.Preconditions;
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.lang.reflect.Method;
 import java.util.HashMap;
@@ -83,7 +82,7 @@ public class BindingDOMRpcImplementationAdapter implements DOMRpcImplementation
     }
 
     private ListenableFuture<RpcResult<?>> invoke(final SchemaPath schemaPath, final DataObject input) {
-        return JdkFutureAdapters.listenInPoolThread(invoker.invokeRpc(delegate, schemaPath.getLastComponent(), input));
+        return invoker.invokeRpc(delegate, schemaPath.getLastComponent(), input);
     }
 
     private CheckedFuture<DOMRpcResult, DOMRpcException> transformResult(
index e341a04..f179aa6 100644 (file)
@@ -48,15 +48,12 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -329,18 +326,13 @@ public class BindingToNormalizedNodeCodec
     private Method findRpcMethod(final Class<? extends RpcService> key, final RpcDefinition rpcDef)
             throws NoSuchMethodException {
         final String methodName = BindingMapping.getMethodName(rpcDef.getQName());
-        if (rpcDef.getInput() != null && isExplicitStatement(rpcDef.getInput())) {
+        if (rpcDef.getInput() != null) {
             final Class<?> inputClz = runtimeContext().getClassForSchema(rpcDef.getInput());
             return key.getMethod(methodName, inputClz);
         }
         return key.getMethod(methodName);
     }
 
-    private static boolean isExplicitStatement(final ContainerSchemaNode node) {
-        return node instanceof EffectiveStatement
-                && ((EffectiveStatement) node).getDeclared().getStatementSource() == StatementSource.DECLARATION;
-    }
-
     private BindingRuntimeContext runtimeContext() {
         return this.futureSchema.runtimeContext();
     }
index a6b5cba..dbb839e 100644 (file)
@@ -13,6 +13,7 @@ import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertTrue;
 
 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.junit.After;
@@ -64,7 +65,8 @@ public class CrossBrokerRpcTest {
     public static final InstanceIdentifier<TopLevelList> BA_NODE_B_ID = NODES_PATH.child(TopLevelList.class, NODE_B);
     public static final InstanceIdentifier<TopLevelList> BA_NODE_C_ID = NODES_PATH.child(TopLevelList.class, NODE_C);
 
-    public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_NODE_C_ID = createBINodeIdentifier(NODE_C);
+    public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_NODE_C_ID =
+            createBINodeIdentifier(NODE_C);
 
 
     @Before
@@ -122,7 +124,8 @@ public class CrossBrokerRpcTest {
 
         OpendaylightOfMigrationTestModelService baKnockInvoker =
                 providerRegistry.getRpcService(OpendaylightOfMigrationTestModelService.class);
-        Future<RpcResult<KnockKnockOutput>> baResult = baKnockInvoker.knockKnock((knockKnock(BA_NODE_C_ID).setQuestion("Who's there?").build()));
+        Future<RpcResult<KnockKnockOutput>> baResult = baKnockInvoker.knockKnock(knockKnock(BA_NODE_C_ID)
+            .setQuestion("Who's there?").build());
         assertNotNull(baResult);
         assertEquals(output, baResult.get().getResult());
     }
@@ -136,16 +139,18 @@ public class CrossBrokerRpcTest {
         testContext.close();
     }
 
-    private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBINodeIdentifier(final TopLevelListKey listKey) {
+    private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBINodeIdentifier(
+            final TopLevelListKey listKey) {
         return org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder().node(Top.QNAME)
                 .node(TopLevelList.QNAME)
                 .nodeWithKey(TopLevelList.QNAME, NODE_ID_QNAME, listKey.getName()).build();
     }
 
-    private Future<RpcResult<KnockKnockOutput>> knockResult(final boolean success, final String answer) {
-        KnockKnockOutput output = new KnockKnockOutputBuilder() //
-                .setAnswer(answer).build();
-        RpcResult<KnockKnockOutput> result = RpcResultBuilder.<KnockKnockOutput>status(success).withResult(output).build();
+    private static ListenableFuture<RpcResult<KnockKnockOutput>> knockResult(final boolean success,
+            final String answer) {
+        KnockKnockOutput output = new KnockKnockOutputBuilder().setAnswer(answer).build();
+        RpcResult<KnockKnockOutput> result = RpcResultBuilder.<KnockKnockOutput>status(success).withResult(output)
+                .build();
         return Futures.immediateFuture(result);
     }
 
index 041c207..3d7f1ae 100644 (file)
@@ -14,9 +14,9 @@ import static org.junit.Assert.fail;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 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.ExecutionException;
-import java.util.concurrent.Future;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -33,6 +33,7 @@ import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactor
 import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.OpendaylightTestRpcServiceService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.RockTheHouseInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.RockTheHouseOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey;
@@ -143,7 +144,7 @@ public class DOMRpcServiceTestBugfix560 {
         assertNotNull(rpcService);
 
         try {
-            final Future<RpcResult<Void>> result = rpcService
+            final ListenableFuture<RpcResult<RockTheHouseOutput>> result = rpcService
                     .rockTheHouse(new RockTheHouseInputBuilder().build());
             assertTrue(result.get().isSuccessful());
         } catch (final IllegalStateException ex) {
index 0f93897..37514ae 100644 (file)
@@ -9,8 +9,9 @@ package org.opendaylight.controller.sal.binding.test.connect.dom;
 
 import static org.junit.Assert.assertNotNull;
 
-import java.util.concurrent.Future;
-
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
+import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.KnockKnockInput;
@@ -20,21 +21,18 @@ import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Multimap;
-
 public class MessageCapturingFlowService implements OpendaylightOfMigrationTestModelService, AutoCloseable {
 
-    private Future<RpcResult<KnockKnockOutput>> knockKnockResult;
+    private ListenableFuture<RpcResult<KnockKnockOutput>> knockKnockResult;
 
     private final Multimap<InstanceIdentifier<?>, KnockKnockInput> receivedKnocks = HashMultimap.create();
     private RoutedRpcRegistration<OpendaylightOfMigrationTestModelService> registration;
 
-    public Future<RpcResult<KnockKnockOutput>> getKnockKnockResult() {
+    public ListenableFuture<RpcResult<KnockKnockOutput>> getKnockKnockResult() {
         return knockKnockResult;
     }
 
-    public MessageCapturingFlowService setKnockKnockResult(Future<RpcResult<KnockKnockOutput>> kkOutput) {
+    public MessageCapturingFlowService setKnockKnockResult(final ListenableFuture<RpcResult<KnockKnockOutput>> kkOutput) {
         this.knockKnockResult = kkOutput;
         return this;
     }
@@ -43,22 +41,23 @@ public class MessageCapturingFlowService implements OpendaylightOfMigrationTestM
         return receivedKnocks;
     }
 
-    public MessageCapturingFlowService registerTo(RpcProviderRegistry registry) {
+    public MessageCapturingFlowService registerTo(final RpcProviderRegistry registry) {
         registration = registry.addRoutedRpcImplementation(OpendaylightOfMigrationTestModelService.class, this);
         assertNotNull(registration);
         return this;
     }
 
+    @Override
     public void close() throws Exception {
         registration.close();
     }
 
-    public MessageCapturingFlowService registerPath(Class<? extends BaseIdentity> context, InstanceIdentifier<?> path) {
+    public MessageCapturingFlowService registerPath(final Class<? extends BaseIdentity> context, final InstanceIdentifier<?> path) {
         registration.registerPath(context, path);
         return this;
     }
 
-    public MessageCapturingFlowService unregisterPath(Class<? extends BaseIdentity> context, InstanceIdentifier<?> path) {
+    public MessageCapturingFlowService unregisterPath(final Class<? extends BaseIdentity> context, final InstanceIdentifier<?> path) {
         registration.unregisterPath(context, path);
         return this;
     }
@@ -67,14 +66,14 @@ public class MessageCapturingFlowService implements OpendaylightOfMigrationTestM
         return new MessageCapturingFlowService();
     }
 
-    public static MessageCapturingFlowService create(RpcProviderRegistry registry) {
+    public static MessageCapturingFlowService create(final RpcProviderRegistry registry) {
         MessageCapturingFlowService ret = new MessageCapturingFlowService();
         ret.registerTo(registry);
         return ret;
     }
 
     @Override
-    public Future<RpcResult<KnockKnockOutput>> knockKnock(KnockKnockInput input) {
+    public ListenableFuture<RpcResult<KnockKnockOutput>> knockKnock(final KnockKnockInput input) {
         receivedKnocks.put(input.getKnockerId(), input);
         return knockKnockResult;
     }
index 66a12ed..7bd2802 100644 (file)
@@ -24,6 +24,7 @@ import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.rpc.routing.rev140701.OpendaylightTestRoutedRpcService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.rpc.routing.rev140701.RoutedSimpleRouteInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.rpc.routing.rev140701.RoutedSimpleRouteInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.rpc.routing.rev140701.RoutedSimpleRouteOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.rpc.routing.rev140701.TestContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.Lists;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.UnorderedContainer;
@@ -58,9 +59,9 @@ public class RoutedServiceIT extends AbstractIT {
         odlRoutedService1 = mock(OpendaylightTestRoutedRpcService.class, "First Flow Service");
         odlRoutedService2 = mock(OpendaylightTestRoutedRpcService.class, "Second Flow Service");
         Mockito.when(odlRoutedService1.routedSimpleRoute(Mockito.<RoutedSimpleRouteInput>any()))
-            .thenReturn(Futures.<RpcResult<Void>>immediateFuture(null));
+            .thenReturn(Futures.<RpcResult<RoutedSimpleRouteOutput>>immediateFuture(null));
         Mockito.when(odlRoutedService2.routedSimpleRoute(Mockito.<RoutedSimpleRouteInput>any()))
-            .thenReturn(Futures.<RpcResult<Void>>immediateFuture(null));
+            .thenReturn(Futures.<RpcResult<RoutedSimpleRouteOutput>>immediateFuture(null));
     }
 
     @Test
index 1bda653..427d285 100644 (file)
@@ -12,7 +12,6 @@ import akka.actor.Status.Success;
 import akka.dispatch.OnComplete;
 import akka.pattern.Patterns;
 import akka.util.Timeout;
-
 import com.google.common.base.Function;
 import com.google.common.base.Strings;
 import com.google.common.base.Throwables;
@@ -30,7 +29,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
-import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import org.apache.commons.lang3.SerializationUtils;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
@@ -51,16 +49,26 @@ import org.opendaylight.controller.cluster.datastore.utils.ClusterUtils;
 import org.opendaylight.controller.cluster.raft.client.messages.GetSnapshot;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddPrefixShardReplicaInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddPrefixShardReplicaOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddPrefixShardReplicaOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddReplicasForAllShardsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddReplicasForAllShardsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddReplicasForAllShardsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddShardReplicaInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddShardReplicaOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddShardReplicaOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.BackupDatastoreInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.BackupDatastoreOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.BackupDatastoreOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ChangeMemberVotingStatesForAllShardsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ChangeMemberVotingStatesForAllShardsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ChangeMemberVotingStatesForAllShardsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ChangeMemberVotingStatesForShardInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ChangeMemberVotingStatesForShardOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ChangeMemberVotingStatesForShardOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ClusterAdminService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.DataStoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.FlipMemberVotingStatesForAllShardsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.FlipMemberVotingStatesForAllShardsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.FlipMemberVotingStatesForAllShardsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.GetPrefixShardRoleInput;
@@ -70,11 +78,17 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.GetShardRoleOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.GetShardRoleOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.MakeLeaderLocalInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.MakeLeaderLocalOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.MakeLeaderLocalOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemoveAllShardReplicasInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemoveAllShardReplicasOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemoveAllShardReplicasOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemovePrefixShardReplicaInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemovePrefixShardReplicaOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemovePrefixShardReplicaOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemoveShardReplicaInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemoveShardReplicaOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemoveShardReplicaOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.member.voting.states.input.MemberVotingState;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.shard.result.output.ShardResult;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.shard.result.output.ShardResultBuilder;
@@ -101,9 +115,9 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     private final BindingNormalizedNodeSerializer serializer;
     private final Timeout makeLeaderLocalTimeout;
 
-    public ClusterAdminRpcService(DistributedDataStoreInterface configDataStore,
-            DistributedDataStoreInterface operDataStore,
-            BindingNormalizedNodeSerializer serializer) {
+    public ClusterAdminRpcService(final DistributedDataStoreInterface configDataStore,
+            final DistributedDataStoreInterface operDataStore,
+            final BindingNormalizedNodeSerializer serializer) {
         this.configDataStore = configDataStore;
         this.operDataStore = operDataStore;
         this.serializer = serializer;
@@ -114,7 +128,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @Override
-    public Future<RpcResult<Void>> addShardReplica(final AddShardReplicaInput input) {
+    public ListenableFuture<RpcResult<AddShardReplicaOutput>> addShardReplica(final AddShardReplicaInput input) {
         final String shardName = input.getShardName();
         if (Strings.isNullOrEmpty(shardName)) {
             return newFailedRpcResultFuture("A valid shard name must be specified");
@@ -127,17 +141,17 @@ public class ClusterAdminRpcService implements ClusterAdminService {
 
         LOG.info("Adding replica for shard {}", shardName);
 
-        final SettableFuture<RpcResult<Void>> returnFuture = SettableFuture.create();
+        final SettableFuture<RpcResult<AddShardReplicaOutput>> returnFuture = SettableFuture.create();
         ListenableFuture<Success> future = sendMessageToShardManager(dataStoreType, new AddShardReplica(shardName));
         Futures.addCallback(future, new FutureCallback<Success>() {
             @Override
-            public void onSuccess(Success success) {
+            public void onSuccess(final Success success) {
                 LOG.info("Successfully added replica for shard {}", shardName);
-                returnFuture.set(newSuccessfulResult());
+                returnFuture.set(newSuccessfulResult(new AddShardReplicaOutputBuilder().build()));
             }
 
             @Override
-            public void onFailure(Throwable failure) {
+            public void onFailure(final Throwable failure) {
                 onMessageFailure(String.format("Failed to add replica for shard %s", shardName),
                         returnFuture, failure);
             }
@@ -147,7 +161,8 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @Override
-    public Future<RpcResult<Void>> removeShardReplica(RemoveShardReplicaInput input) {
+    public ListenableFuture<RpcResult<RemoveShardReplicaOutput>> removeShardReplica(
+            final RemoveShardReplicaInput input) {
         final String shardName = input.getShardName();
         if (Strings.isNullOrEmpty(shardName)) {
             return newFailedRpcResultFuture("A valid shard name must be specified");
@@ -165,18 +180,18 @@ public class ClusterAdminRpcService implements ClusterAdminService {
 
         LOG.info("Removing replica for shard {} memberName {}, datastoreType {}", shardName, memberName, dataStoreType);
 
-        final SettableFuture<RpcResult<Void>> returnFuture = SettableFuture.create();
+        final SettableFuture<RpcResult<RemoveShardReplicaOutput>> returnFuture = SettableFuture.create();
         ListenableFuture<Success> future = sendMessageToShardManager(dataStoreType,
                 new RemoveShardReplica(shardName, MemberName.forName(memberName)));
         Futures.addCallback(future, new FutureCallback<Success>() {
             @Override
-            public void onSuccess(Success success) {
+            public void onSuccess(final Success success) {
                 LOG.info("Successfully removed replica for shard {}", shardName);
-                returnFuture.set(newSuccessfulResult());
+                returnFuture.set(newSuccessfulResult(new RemoveShardReplicaOutputBuilder().build()));
             }
 
             @Override
-            public void onFailure(Throwable failure) {
+            public void onFailure(final Throwable failure) {
                 onMessageFailure(String.format("Failed to remove replica for shard %s", shardName),
                         returnFuture, failure);
             }
@@ -186,7 +201,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @Override
-    public Future<RpcResult<Void>> makeLeaderLocal(final MakeLeaderLocalInput input) {
+    public ListenableFuture<RpcResult<MakeLeaderLocalOutput>> makeLeaderLocal(final MakeLeaderLocalInput input) {
         final String shardName = input.getShardName();
         if (Strings.isNullOrEmpty(shardName)) {
             return newFailedRpcResultFuture("A valid shard name must be specified");
@@ -223,19 +238,19 @@ public class ClusterAdminRpcService implements ClusterAdminService {
             }
         }, actorContext.getClientDispatcher());
 
-        final SettableFuture<RpcResult<Void>> future = SettableFuture.create();
+        final SettableFuture<RpcResult<MakeLeaderLocalOutput>> future = SettableFuture.create();
         makeLeaderLocalAsk.future().onComplete(new OnComplete<Object>() {
             @Override
             public void onComplete(final Throwable failure, final Object success) throws Throwable {
                 if (failure != null) {
                     LOG.error("Leadership transfer failed for shard {}.", shardName, failure);
-                    future.set(RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION,
+                    future.set(RpcResultBuilder.<MakeLeaderLocalOutput>failed().withError(ErrorType.APPLICATION,
                             "leadership transfer failed", failure).build());
                     return;
                 }
 
                 LOG.debug("Leadership transfer complete");
-                future.set(RpcResultBuilder.<Void>success().build());
+                future.set(RpcResultBuilder.success(new MakeLeaderLocalOutputBuilder().build()).build());
             }
         }, actorContext.getClientDispatcher());
 
@@ -243,7 +258,8 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @Override
-    public Future<RpcResult<Void>> addPrefixShardReplica(final AddPrefixShardReplicaInput input) {
+    public ListenableFuture<RpcResult<AddPrefixShardReplicaOutput>> addPrefixShardReplica(
+            final AddPrefixShardReplicaInput input) {
 
         final InstanceIdentifier<?> identifier = input.getShardPrefix();
         if (identifier == null) {
@@ -258,17 +274,17 @@ public class ClusterAdminRpcService implements ClusterAdminService {
         LOG.info("Adding replica for shard {}, datastore type {}", identifier, dataStoreType);
 
         final YangInstanceIdentifier prefix = serializer.toYangInstanceIdentifier(identifier);
-        final SettableFuture<RpcResult<Void>> returnFuture = SettableFuture.create();
+        final SettableFuture<RpcResult<AddPrefixShardReplicaOutput>> returnFuture = SettableFuture.create();
         ListenableFuture<Success> future = sendMessageToShardManager(dataStoreType, new AddPrefixShardReplica(prefix));
         Futures.addCallback(future, new FutureCallback<Success>() {
             @Override
-            public void onSuccess(Success success) {
+            public void onSuccess(final Success success) {
                 LOG.info("Successfully added replica for shard {}", prefix);
-                returnFuture.set(newSuccessfulResult());
+                returnFuture.set(newSuccessfulResult(new AddPrefixShardReplicaOutputBuilder().build()));
             }
 
             @Override
-            public void onFailure(Throwable failure) {
+            public void onFailure(final Throwable failure) {
                 onMessageFailure(String.format("Failed to add replica for shard %s", prefix),
                         returnFuture, failure);
             }
@@ -278,7 +294,8 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @Override
-    public Future<RpcResult<Void>> removePrefixShardReplica(final RemovePrefixShardReplicaInput input) {
+    public ListenableFuture<RpcResult<RemovePrefixShardReplicaOutput>> removePrefixShardReplica(
+            final RemovePrefixShardReplicaInput input) {
 
         final InstanceIdentifier<?> identifier = input.getShardPrefix();
         if (identifier == null) {
@@ -299,14 +316,14 @@ public class ClusterAdminRpcService implements ClusterAdminService {
                 identifier, memberName, dataStoreType);
         final YangInstanceIdentifier prefix = serializer.toYangInstanceIdentifier(identifier);
 
-        final SettableFuture<RpcResult<Void>> returnFuture = SettableFuture.create();
+        final SettableFuture<RpcResult<RemovePrefixShardReplicaOutput>> returnFuture = SettableFuture.create();
         final ListenableFuture<Success> future = sendMessageToShardManager(dataStoreType,
                 new RemovePrefixShardReplica(prefix, MemberName.forName(memberName)));
         Futures.addCallback(future, new FutureCallback<Success>() {
             @Override
             public void onSuccess(final Success success) {
                 LOG.info("Successfully removed replica for shard {}", prefix);
-                returnFuture.set(newSuccessfulResult());
+                returnFuture.set(newSuccessfulResult(new RemovePrefixShardReplicaOutputBuilder().build()));
             }
 
             @Override
@@ -320,7 +337,8 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @Override
-    public Future<RpcResult<AddReplicasForAllShardsOutput>> addReplicasForAllShards() {
+    public ListenableFuture<RpcResult<AddReplicasForAllShardsOutput>> addReplicasForAllShards(
+            final AddReplicasForAllShardsInput input) {
         LOG.info("Adding replicas for all shards");
 
         final List<Entry<ListenableFuture<Success>, ShardResultBuilder>> shardResultData = new ArrayList<>();
@@ -336,7 +354,8 @@ public class ClusterAdminRpcService implements ClusterAdminService {
 
 
     @Override
-    public Future<RpcResult<RemoveAllShardReplicasOutput>> removeAllShardReplicas(RemoveAllShardReplicasInput input) {
+    public ListenableFuture<RpcResult<RemoveAllShardReplicasOutput>> removeAllShardReplicas(
+            final RemoveAllShardReplicasInput input) {
         LOG.info("Removing replicas for all shards");
 
         final String memberName = input.getMemberName();
@@ -357,7 +376,8 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @Override
-    public Future<RpcResult<Void>> changeMemberVotingStatesForShard(ChangeMemberVotingStatesForShardInput input) {
+    public ListenableFuture<RpcResult<ChangeMemberVotingStatesForShardOutput>> changeMemberVotingStatesForShard(
+            final ChangeMemberVotingStatesForShardInput input) {
         final String shardName = input.getShardName();
         if (Strings.isNullOrEmpty(shardName)) {
             return newFailedRpcResultFuture("A valid shard name must be specified");
@@ -379,17 +399,17 @@ public class ClusterAdminRpcService implements ClusterAdminService {
         LOG.info("Change member voting states for shard {}: {}", shardName,
                 changeVotingStatus.getMeberVotingStatusMap());
 
-        final SettableFuture<RpcResult<Void>> returnFuture = SettableFuture.create();
+        final SettableFuture<RpcResult<ChangeMemberVotingStatesForShardOutput>> returnFuture = SettableFuture.create();
         ListenableFuture<Success> future = sendMessageToShardManager(dataStoreType, changeVotingStatus);
         Futures.addCallback(future, new FutureCallback<Success>() {
             @Override
-            public void onSuccess(Success success) {
+            public void onSuccess(final Success success) {
                 LOG.info("Successfully changed member voting states for shard {}", shardName);
-                returnFuture.set(newSuccessfulResult());
+                returnFuture.set(newSuccessfulResult(new ChangeMemberVotingStatesForShardOutputBuilder().build()));
             }
 
             @Override
-            public void onFailure(Throwable failure) {
+            public void onFailure(final Throwable failure) {
                 onMessageFailure(String.format("Failed to change member voting states for shard %s", shardName),
                         returnFuture, failure);
             }
@@ -399,7 +419,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @Override
-    public Future<RpcResult<ChangeMemberVotingStatesForAllShardsOutput>> changeMemberVotingStatesForAllShards(
+    public ListenableFuture<RpcResult<ChangeMemberVotingStatesForAllShardsOutput>> changeMemberVotingStatesForAllShards(
             final ChangeMemberVotingStatesForAllShardsInput input) {
         List<MemberVotingState> memberVotingStates = input.getMemberVotingState();
         if (memberVotingStates == null || memberVotingStates.isEmpty()) {
@@ -421,7 +441,8 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @Override
-    public Future<RpcResult<FlipMemberVotingStatesForAllShardsOutput>> flipMemberVotingStatesForAllShards() {
+    public ListenableFuture<RpcResult<FlipMemberVotingStatesForAllShardsOutput>> flipMemberVotingStatesForAllShards(
+            final FlipMemberVotingStatesForAllShardsInput input) {
         final List<Entry<ListenableFuture<Success>, ShardResultBuilder>> shardResultData = new ArrayList<>();
         Function<String, Object> messageSupplier = FlipShardMembersVotingStatus::new;
 
@@ -436,7 +457,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @Override
-    public Future<RpcResult<GetShardRoleOutput>> getShardRole(final GetShardRoleInput input) {
+    public ListenableFuture<RpcResult<GetShardRoleOutput>> getShardRole(final GetShardRoleInput input) {
         final String shardName = input.getShardName();
         if (Strings.isNullOrEmpty(shardName)) {
             return newFailedRpcResultFuture("A valid shard name must be specified");
@@ -479,7 +500,8 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @Override
-    public Future<RpcResult<GetPrefixShardRoleOutput>> getPrefixShardRole(final GetPrefixShardRoleInput input) {
+    public ListenableFuture<RpcResult<GetPrefixShardRoleOutput>> getPrefixShardRole(
+            final GetPrefixShardRoleInput input) {
         final InstanceIdentifier<?> identifier = input.getShardPrefix();
         if (identifier == null) {
             return newFailedRpcResultFuture("A valid shard identifier must be specified");
@@ -525,23 +547,23 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @Override
-    public Future<RpcResult<Void>> backupDatastore(final BackupDatastoreInput input) {
+    public ListenableFuture<RpcResult<BackupDatastoreOutput>> backupDatastore(final BackupDatastoreInput input) {
         LOG.debug("backupDatastore: {}", input);
 
         if (Strings.isNullOrEmpty(input.getFilePath())) {
             return newFailedRpcResultFuture("A valid file path must be specified");
         }
 
-        final SettableFuture<RpcResult<Void>> returnFuture = SettableFuture.create();
+        final SettableFuture<RpcResult<BackupDatastoreOutput>> returnFuture = SettableFuture.create();
         ListenableFuture<List<DatastoreSnapshot>> future = sendMessageToShardManagers(GetSnapshot.INSTANCE);
         Futures.addCallback(future, new FutureCallback<List<DatastoreSnapshot>>() {
             @Override
-            public void onSuccess(List<DatastoreSnapshot> snapshots) {
+            public void onSuccess(final List<DatastoreSnapshot> snapshots) {
                 saveSnapshotsToFile(new DatastoreSnapshotList(snapshots), input.getFilePath(), returnFuture);
             }
 
             @Override
-            public void onFailure(Throwable failure) {
+            public void onFailure(final Throwable failure) {
                 onDatastoreBackupFailure(input.getFilePath(), returnFuture, failure);
             }
         }, MoreExecutors.directExecutor());
@@ -549,8 +571,8 @@ public class ClusterAdminRpcService implements ClusterAdminService {
         return returnFuture;
     }
 
-    private ChangeShardMembersVotingStatus toChangeShardMembersVotingStatus(final String shardName,
-            List<MemberVotingState> memberVotingStatus) {
+    private static ChangeShardMembersVotingStatus toChangeShardMembersVotingStatus(final String shardName,
+            final List<MemberVotingState> memberVotingStatus) {
         Map<String, Boolean> serverVotingStatusMap = new HashMap<>();
         for (MemberVotingState memberStatus: memberVotingStatus) {
             serverVotingStatusMap.put(memberStatus.getMemberName(), memberStatus.isVoting());
@@ -567,7 +589,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
         for (final Entry<ListenableFuture<Success>, ShardResultBuilder> entry : shardResultData) {
             Futures.addCallback(entry.getKey(), new FutureCallback<Success>() {
                 @Override
-                public void onSuccess(Success result) {
+                public void onSuccess(final Success result) {
                     synchronized (shardResults) {
                         ShardResultBuilder shardResult = entry.getValue();
                         LOG.debug("onSuccess for shard {}, type {}", shardResult.getShardName(),
@@ -578,7 +600,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
                 }
 
                 @Override
-                public void onFailure(Throwable failure) {
+                public void onFailure(final Throwable failure) {
                     synchronized (shardResults) {
                         ShardResultBuilder shardResult = entry.getValue();
                         LOG.warn("{} for shard {}, type {}", failureLogMsgPrefix, shardResult.getShardName(),
@@ -600,9 +622,9 @@ public class ClusterAdminRpcService implements ClusterAdminService {
         return returnFuture;
     }
 
-    private <T> void sendMessageToManagerForConfiguredShards(DataStoreType dataStoreType,
-            List<Entry<ListenableFuture<T>, ShardResultBuilder>> shardResultData,
-            Function<String, Object> messageSupplier) {
+    private <T> void sendMessageToManagerForConfiguredShards(final DataStoreType dataStoreType,
+            final List<Entry<ListenableFuture<T>, ShardResultBuilder>> shardResultData,
+            final Function<String, Object> messageSupplier) {
         ActorContext actorContext = dataStoreType == DataStoreType.Config ? configDataStore.getActorContext()
                 : operDataStore.getActorContext();
         Set<String> allShardNames = actorContext.getConfiguration().getAllShardNames();
@@ -617,8 +639,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
         }
     }
 
-    @SuppressWarnings("unchecked")
-    private <T> ListenableFuture<List<T>> sendMessageToShardManagers(Object message) {
+    private <T> ListenableFuture<List<T>> sendMessageToShardManagers(final Object message) {
         Timeout timeout = SHARD_MGR_TIMEOUT;
         ListenableFuture<T> configFuture = ask(configDataStore.getActorContext().getShardManager(), message, timeout);
         ListenableFuture<T> operFuture = ask(operDataStore.getActorContext().getShardManager(), message, timeout);
@@ -626,7 +647,7 @@ public class ClusterAdminRpcService implements ClusterAdminService {
         return Futures.allAsList(configFuture, operFuture);
     }
 
-    private <T> ListenableFuture<T> sendMessageToShardManager(DataStoreType dataStoreType, Object message) {
+    private <T> ListenableFuture<T> sendMessageToShardManager(final DataStoreType dataStoreType, final Object message) {
         ActorRef shardManager = dataStoreType == DataStoreType.Config
                 ? configDataStore.getActorContext().getShardManager()
                         : operDataStore.getActorContext().getShardManager();
@@ -634,38 +655,38 @@ public class ClusterAdminRpcService implements ClusterAdminService {
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
-    private static void saveSnapshotsToFile(DatastoreSnapshotList snapshots, String fileName,
-            SettableFuture<RpcResult<Void>> returnFuture) {
+    private static void saveSnapshotsToFile(final DatastoreSnapshotList snapshots, final String fileName,
+            final SettableFuture<RpcResult<BackupDatastoreOutput>> returnFuture) {
         try (FileOutputStream fos = new FileOutputStream(fileName)) {
             SerializationUtils.serialize(snapshots, fos);
 
-            returnFuture.set(newSuccessfulResult());
+            returnFuture.set(newSuccessfulResult(new BackupDatastoreOutputBuilder().build()));
             LOG.info("Successfully backed up datastore to file {}", fileName);
         } catch (IOException | RuntimeException e) {
             onDatastoreBackupFailure(fileName, returnFuture, e);
         }
     }
 
-    private static void onDatastoreBackupFailure(String fileName, SettableFuture<RpcResult<Void>> returnFuture,
-            Throwable failure) {
+    private static <T> void onDatastoreBackupFailure(final String fileName,
+            final SettableFuture<RpcResult<T>> returnFuture, final Throwable failure) {
         onMessageFailure(String.format("Failed to back up datastore to file %s", fileName), returnFuture, failure);
     }
 
-    private static void onMessageFailure(String msg, final SettableFuture<RpcResult<Void>> returnFuture,
-            Throwable failure) {
+    private static <T> void onMessageFailure(final String msg, final SettableFuture<RpcResult<T>> returnFuture,
+            final Throwable failure) {
         LOG.error(msg, failure);
-        returnFuture.set(ClusterAdminRpcService.<Void>newFailedRpcResultBuilder(String.format("%s: %s", msg,
+        returnFuture.set(ClusterAdminRpcService.<T>newFailedRpcResultBuilder(String.format("%s: %s", msg,
                 failure.getMessage())).build());
     }
 
-    private <T> ListenableFuture<T> ask(ActorRef actor, Object message, Timeout timeout) {
+    private <T> ListenableFuture<T> ask(final ActorRef actor, final Object message, final Timeout timeout) {
         final SettableFuture<T> returnFuture = SettableFuture.create();
 
         @SuppressWarnings("unchecked")
         scala.concurrent.Future<T> askFuture = (scala.concurrent.Future<T>) Patterns.ask(actor, message, timeout);
         askFuture.onComplete(new OnComplete<T>() {
             @Override
-            public void onComplete(Throwable failure, T resp) {
+            public void onComplete(final Throwable failure, final T resp) {
                 if (failure != null) {
                     returnFuture.setException(failure);
                 } else {
@@ -677,23 +698,19 @@ public class ClusterAdminRpcService implements ClusterAdminService {
         return returnFuture;
     }
 
-    private static <T> ListenableFuture<RpcResult<T>> newFailedRpcResultFuture(String message) {
+    private static <T> ListenableFuture<RpcResult<T>> newFailedRpcResultFuture(final String message) {
         return ClusterAdminRpcService.<T>newFailedRpcResultBuilder(message).buildFuture();
     }
 
-    private static <T> RpcResultBuilder<T> newFailedRpcResultBuilder(String message) {
+    private static <T> RpcResultBuilder<T> newFailedRpcResultBuilder(final String message) {
         return newFailedRpcResultBuilder(message, null);
     }
 
-    private static <T> RpcResultBuilder<T> newFailedRpcResultBuilder(String message, Throwable cause) {
+    private static <T> RpcResultBuilder<T> newFailedRpcResultBuilder(final String message, final Throwable cause) {
         return RpcResultBuilder.<T>failed().withError(ErrorType.RPC, message, cause);
     }
 
-    private static RpcResult<Void> newSuccessfulResult() {
-        return newSuccessfulResult(null);
-    }
-
-    private static <T> RpcResult<T> newSuccessfulResult(T data) {
+    private static <T> RpcResult<T> newSuccessfulResult(final T data) {
         return RpcResultBuilder.success(data).build();
     }
 }
index df5cef2..a2806bb 100644 (file)
@@ -82,13 +82,19 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.People;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddPrefixShardReplicaInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddPrefixShardReplicaInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddPrefixShardReplicaOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddReplicasForAllShardsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddReplicasForAllShardsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddShardReplicaInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddShardReplicaOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.BackupDatastoreInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.BackupDatastoreOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ChangeMemberVotingStatesForAllShardsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ChangeMemberVotingStatesForAllShardsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ChangeMemberVotingStatesForShardInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ChangeMemberVotingStatesForShardOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.DataStoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.FlipMemberVotingStatesForAllShardsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.FlipMemberVotingStatesForAllShardsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.GetPrefixShardRoleInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.GetPrefixShardRoleInputBuilder;
@@ -97,11 +103,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.GetShardRoleInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.GetShardRoleOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.MakeLeaderLocalInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.MakeLeaderLocalOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemoveAllShardReplicasInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemoveAllShardReplicasOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemovePrefixShardReplicaInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemovePrefixShardReplicaInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemovePrefixShardReplicaOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemoveShardReplicaInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.RemoveShardReplicaOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.member.voting.states.input.MemberVotingStateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.shard.result.output.ShardResult;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.shard.result.output.ShardResultBuilder;
@@ -146,7 +155,7 @@ public class ClusterAdminRpcServiceTest {
 
         ClusterAdminRpcService service = new ClusterAdminRpcService(node.configDataStore(), node.operDataStore(), null);
 
-        RpcResult<Void> rpcResult = service .backupDatastore(new BackupDatastoreInputBuilder()
+        RpcResult<BackupDatastoreOutput> rpcResult = service .backupDatastore(new BackupDatastoreInputBuilder()
                 .setFilePath(fileName).build()).get(5, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
 
@@ -178,8 +187,8 @@ public class ClusterAdminRpcServiceTest {
         assertEquals("getErrors", 1, rpcResult.getErrors().size());
     }
 
-    private static void verifyDatastoreSnapshot(String type, DatastoreSnapshot datastoreSnapshot,
-            String... expShardNames) {
+    private static void verifyDatastoreSnapshot(final String type, final DatastoreSnapshot datastoreSnapshot,
+            final String... expShardNames) {
         assertNotNull("Missing DatastoreSnapshot for type " + type, datastoreSnapshot);
         Set<String> shardNames = new HashSet<>();
         for (DatastoreSnapshot.ShardSnapshot s: datastoreSnapshot.getShardSnapshots()) {
@@ -414,7 +423,7 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service = new ClusterAdminRpcService(memberNode.configDataStore(),
                 memberNode.operDataStore(), null);
 
-        RpcResult<Void> rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder()
+        RpcResult<AddShardReplicaOutput> rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder()
                 .setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
         verifyFailedRpcResult(rpcResult);
 
@@ -427,8 +436,8 @@ public class ClusterAdminRpcServiceTest {
         verifyFailedRpcResult(rpcResult);
     }
 
-    private static NormalizedNode<?, ?> writeCarsNodeAndVerify(AbstractDataStore writeToStore,
-            AbstractDataStore readFromStore) throws Exception {
+    private static NormalizedNode<?, ?> writeCarsNodeAndVerify(final AbstractDataStore writeToStore,
+            final AbstractDataStore readFromStore) throws Exception {
         DOMStoreWriteTransaction writeTx = writeToStore.newWriteOnlyTransaction();
         NormalizedNode<?, ?> carsNode = CarsModel.create();
         writeTx.write(CarsModel.BASE_PATH, carsNode);
@@ -443,17 +452,16 @@ public class ClusterAdminRpcServiceTest {
         return carsNode;
     }
 
-    private static void readCarsNodeAndVerify(AbstractDataStore readFromStore,
-            NormalizedNode<?, ?> expCarsNode) throws Exception {
+    private static void readCarsNodeAndVerify(final AbstractDataStore readFromStore,
+            final NormalizedNode<?, ?> expCarsNode) throws Exception {
         Optional<NormalizedNode<?, ?>> optional = readFromStore.newReadOnlyTransaction()
                 .read(CarsModel.BASE_PATH).get(15, TimeUnit.SECONDS);
         assertTrue("isPresent", optional.isPresent());
         assertEquals("Data node", expCarsNode, optional.get());
     }
 
-    private RpcResult<GetShardRoleOutput> getShardRole(final MemberNode memberNode,
-                                                       final BindingNormalizedNodeSerializer serializer,
-                                                       final String shardName) throws Exception {
+    private static RpcResult<GetShardRoleOutput> getShardRole(final MemberNode memberNode,
+            final BindingNormalizedNodeSerializer serializer, final String shardName) throws Exception {
 
         final GetShardRoleInput input = new GetShardRoleInputBuilder()
                 .setDataStoreType(DataStoreType.Config)
@@ -464,10 +472,9 @@ public class ClusterAdminRpcServiceTest {
                 new ClusterAdminRpcService(memberNode.configDataStore(), memberNode.operDataStore(), serializer);
 
         return service.getShardRole(input).get(10, TimeUnit.SECONDS);
-
     }
 
-    private RpcResult<GetPrefixShardRoleOutput> getPrefixShardRole(
+    private static RpcResult<GetPrefixShardRoleOutput> getPrefixShardRole(
             final MemberNode memberNode,
             final InstanceIdentifier<?> identifier,
             final BindingNormalizedNodeSerializer serializer) throws Exception {
@@ -481,14 +488,11 @@ public class ClusterAdminRpcServiceTest {
                 new ClusterAdminRpcService(memberNode.configDataStore(), memberNode.operDataStore(), serializer);
 
         return service.getPrefixShardRole(input).get(10, TimeUnit.SECONDS);
-
     }
 
-    private void addPrefixShardReplica(final MemberNode memberNode,
-                                       final InstanceIdentifier<?> identifier,
-                                       final BindingNormalizedNodeSerializer serializer,
-                                       final String shardName,
-                                       final String... peerMemberNames) throws Exception {
+    private static void addPrefixShardReplica(final MemberNode memberNode, final InstanceIdentifier<?> identifier,
+            final BindingNormalizedNodeSerializer serializer, final String shardName,
+            final String... peerMemberNames) throws Exception {
 
         final AddPrefixShardReplicaInput input = new AddPrefixShardReplicaInputBuilder()
                 .setShardPrefix(identifier)
@@ -497,7 +501,8 @@ public class ClusterAdminRpcServiceTest {
         final ClusterAdminRpcService service =
                 new ClusterAdminRpcService(memberNode.configDataStore(), memberNode.operDataStore(), serializer);
 
-        final RpcResult<Void> rpcResult = service.addPrefixShardReplica(input).get(10, TimeUnit.SECONDS);
+        final RpcResult<AddPrefixShardReplicaOutput> rpcResult = service.addPrefixShardReplica(input)
+                .get(10, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
 
         verifyRaftPeersPresent(memberNode.configDataStore(), shardName, peerMemberNames);
@@ -505,12 +510,9 @@ public class ClusterAdminRpcServiceTest {
         assertTrue("Replica shard not present", optional.isPresent());
     }
 
-    private void removePrefixShardReplica(final MemberNode memberNode,
-                                          final InstanceIdentifier<?> identifier,
-                                          final String removeFromMember,
-                                          final BindingNormalizedNodeSerializer serializer,
-                                          final String shardName,
-                                          final String... peerMemberNames) throws Exception {
+    private static void removePrefixShardReplica(final MemberNode memberNode, final InstanceIdentifier<?> identifier,
+            final String removeFromMember, final BindingNormalizedNodeSerializer serializer, final String shardName,
+            final String... peerMemberNames) throws Exception {
         final RemovePrefixShardReplicaInput input = new RemovePrefixShardReplicaInputBuilder()
                 .setDataStoreType(DataStoreType.Config)
                 .setShardPrefix(identifier)
@@ -519,21 +521,22 @@ public class ClusterAdminRpcServiceTest {
         final ClusterAdminRpcService service =
                 new ClusterAdminRpcService(memberNode.configDataStore(), memberNode.operDataStore(), serializer);
 
-        final RpcResult<Void> rpcResult = service.removePrefixShardReplica(input).get(10, TimeUnit.SECONDS);
+        final RpcResult<RemovePrefixShardReplicaOutput> rpcResult = service.removePrefixShardReplica(input)
+                .get(10, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
 
         verifyRaftPeersPresent(memberNode.configDataStore(), shardName, peerMemberNames);
     }
 
-    private static void doAddShardReplica(MemberNode memberNode, String shardName, String... peerMemberNames)
-            throws Exception {
+    private static void doAddShardReplica(final MemberNode memberNode, final String shardName,
+            final String... peerMemberNames) throws Exception {
         memberNode.waitForMembersUp(peerMemberNames);
 
         ClusterAdminRpcService service = new ClusterAdminRpcService(memberNode.configDataStore(),
                 memberNode.operDataStore(), null);
 
-        RpcResult<Void> rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName(shardName)
-                .setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
+        RpcResult<AddShardReplicaOutput> rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder()
+            .setShardName(shardName).setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
 
         verifyRaftPeersPresent(memberNode.configDataStore(), shardName, peerMemberNames);
@@ -548,12 +551,12 @@ public class ClusterAdminRpcServiceTest {
         verifyRaftPeersPresent(memberNode.operDataStore(), shardName, peerMemberNames);
     }
 
-    private static void doMakeShardLeaderLocal(final MemberNode memberNode, String shardName, String newLeader)
-            throws Exception {
+    private static void doMakeShardLeaderLocal(final MemberNode memberNode, final String shardName,
+            final String newLeader) throws Exception {
         ClusterAdminRpcService service = new ClusterAdminRpcService(memberNode.configDataStore(),
                 memberNode.operDataStore(), null);
 
-        final RpcResult<Void> rpcResult = service.makeLeaderLocal(new MakeLeaderLocalInputBuilder()
+        final RpcResult<MakeLeaderLocalOutput> rpcResult = service.makeLeaderLocal(new MakeLeaderLocalInputBuilder()
                 .setDataStoreType(DataStoreType.Config).setShardName(shardName).build())
                 .get(10, TimeUnit.SECONDS);
 
@@ -561,10 +564,9 @@ public class ClusterAdminRpcServiceTest {
 
         verifyRaftState(memberNode.configDataStore(), shardName, raftState -> assertThat(raftState.getLeader(),
                 containsString(newLeader)));
-
     }
 
-    private static <T> T verifySuccessfulRpcResult(RpcResult<T> rpcResult) {
+    private static <T> T verifySuccessfulRpcResult(final RpcResult<T> rpcResult) {
         if (!rpcResult.isSuccessful()) {
             if (rpcResult.getErrors().size() > 0) {
                 RpcError error = Iterables.getFirst(rpcResult.getErrors(), null);
@@ -577,7 +579,7 @@ public class ClusterAdminRpcServiceTest {
         return rpcResult.getResult();
     }
 
-    private static void verifyFailedRpcResult(RpcResult<?> rpcResult) {
+    private static void verifyFailedRpcResult(final RpcResult<?> rpcResult) {
         assertFalse("RpcResult", rpcResult.isSuccessful());
         assertEquals("RpcResult errors size", 1, rpcResult.getErrors().size());
         RpcError error = Iterables.getFirst(rpcResult.getErrors(), null);
@@ -610,7 +612,7 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service3 = new ClusterAdminRpcService(replicaNode3.configDataStore(),
                 replicaNode3.operDataStore(), null);
 
-        RpcResult<Void> rpcResult = service3.removeShardReplica(new RemoveShardReplicaInputBuilder()
+        RpcResult<RemoveShardReplicaOutput> rpcResult = service3.removeShardReplica(new RemoveShardReplicaInputBuilder()
                 .setShardName("cars").setMemberName("member-3").setDataStoreType(DataStoreType.Config).build())
                 .get(10, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
@@ -671,7 +673,7 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service1 = new ClusterAdminRpcService(leaderNode1.configDataStore(),
                 leaderNode1.operDataStore(), null);
 
-        RpcResult<Void> rpcResult = service1.removeShardReplica(new RemoveShardReplicaInputBuilder()
+        RpcResult<RemoveShardReplicaOutput> rpcResult = service1.removeShardReplica(new RemoveShardReplicaInputBuilder()
                 .setShardName("cars").setMemberName("member-1").setDataStoreType(DataStoreType.Config).build())
                 .get(10, TimeUnit.SECONDS);
         verifySuccessfulRpcResult(rpcResult);
@@ -721,8 +723,8 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service = new ClusterAdminRpcService(newReplicaNode2.configDataStore(),
                 newReplicaNode2.operDataStore(), null);
 
-        RpcResult<AddReplicasForAllShardsOutput> rpcResult =
-                service.addReplicasForAllShards().get(10, TimeUnit.SECONDS);
+        RpcResult<AddReplicasForAllShardsOutput> rpcResult = service.addReplicasForAllShards(
+            new AddReplicasForAllShardsInputBuilder().build()).get(10, TimeUnit.SECONDS);
         AddReplicasForAllShardsOutput result = verifySuccessfulRpcResult(rpcResult);
         verifyShardResults(result.getShardResult(), successShardResult("cars", DataStoreType.Config),
                 successShardResult("people", DataStoreType.Config),
@@ -825,7 +827,7 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service3 = new ClusterAdminRpcService(replicaNode3.configDataStore(),
                 replicaNode3.operDataStore(), null);
 
-        RpcResult<Void> rpcResult = service3
+        RpcResult<ChangeMemberVotingStatesForShardOutput> rpcResult = service3
                 .changeMemberVotingStatesForShard(new ChangeMemberVotingStatesForShardInputBuilder()
                         .setShardName("cars").setDataStoreType(DataStoreType.Config)
                         .setMemberVotingState(ImmutableList.of(
@@ -859,7 +861,7 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service = new ClusterAdminRpcService(leaderNode.configDataStore(),
                 leaderNode.operDataStore(), null);
 
-        RpcResult<Void> rpcResult = service
+        RpcResult<ChangeMemberVotingStatesForShardOutput> rpcResult = service
                 .changeMemberVotingStatesForShard(new ChangeMemberVotingStatesForShardInputBuilder()
                         .setShardName("cars").setDataStoreType(DataStoreType.Config)
                         .setMemberVotingState(ImmutableList
@@ -951,8 +953,8 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service3 = new ClusterAdminRpcService(replicaNode3.configDataStore(),
                 replicaNode3.operDataStore(), null);
 
-        RpcResult<FlipMemberVotingStatesForAllShardsOutput> rpcResult = service3.flipMemberVotingStatesForAllShards()
-                .get(10, TimeUnit.SECONDS);
+        RpcResult<FlipMemberVotingStatesForAllShardsOutput> rpcResult = service3.flipMemberVotingStatesForAllShards(
+            new FlipMemberVotingStatesForAllShardsInputBuilder().build()).get(10, TimeUnit.SECONDS);
         FlipMemberVotingStatesForAllShardsOutput result = verifySuccessfulRpcResult(rpcResult);
         verifyShardResults(result.getShardResult(), successShardResult("cars", DataStoreType.Config),
                 successShardResult("people", DataStoreType.Config),
@@ -981,7 +983,8 @@ public class ClusterAdminRpcServiceTest {
 
         // Flip the voting states back to the original states.
 
-        rpcResult = service3.flipMemberVotingStatesForAllShards(). get(10, TimeUnit.SECONDS);
+        rpcResult = service3.flipMemberVotingStatesForAllShards(
+            new FlipMemberVotingStatesForAllShardsInputBuilder().build()).get(10, TimeUnit.SECONDS);
         result = verifySuccessfulRpcResult(rpcResult);
         verifyShardResults(result.getShardResult(), successShardResult("cars", DataStoreType.Config),
                 successShardResult("people", DataStoreType.Config),
@@ -1045,8 +1048,8 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service1 = new ClusterAdminRpcService(replicaNode1.configDataStore(),
                 replicaNode1.operDataStore(), null);
 
-        RpcResult<FlipMemberVotingStatesForAllShardsOutput> rpcResult = service1.flipMemberVotingStatesForAllShards()
-                .get(10, TimeUnit.SECONDS);
+        RpcResult<FlipMemberVotingStatesForAllShardsOutput> rpcResult = service1.flipMemberVotingStatesForAllShards(
+            new FlipMemberVotingStatesForAllShardsInputBuilder().build()).get(10, TimeUnit.SECONDS);
         FlipMemberVotingStatesForAllShardsOutput result = verifySuccessfulRpcResult(rpcResult);
         verifyShardResults(result.getShardResult(), successShardResult("cars", DataStoreType.Config),
                 successShardResult("people", DataStoreType.Config),
@@ -1112,8 +1115,8 @@ public class ClusterAdminRpcServiceTest {
         ClusterAdminRpcService service1 = new ClusterAdminRpcService(leaderNode1.configDataStore(),
                 leaderNode1.operDataStore(), null);
 
-        RpcResult<FlipMemberVotingStatesForAllShardsOutput> rpcResult = service1.flipMemberVotingStatesForAllShards()
-                .get(10, TimeUnit.SECONDS);
+        RpcResult<FlipMemberVotingStatesForAllShardsOutput> rpcResult = service1.flipMemberVotingStatesForAllShards(
+            new FlipMemberVotingStatesForAllShardsInputBuilder().build()).get(10, TimeUnit.SECONDS);
         FlipMemberVotingStatesForAllShardsOutput result = verifySuccessfulRpcResult(rpcResult);
         verifyShardResults(result.getShardResult(), successShardResult("cars", DataStoreType.Config),
                 successShardResult("people", DataStoreType.Config),
@@ -1137,8 +1140,8 @@ public class ClusterAdminRpcServiceTest {
         });
     }
 
-    private static void setupPersistedServerConfigPayload(ServerConfigurationPayload serverConfig,
-            String member, String datastoreTypeSuffix, String... shards) {
+    private static void setupPersistedServerConfigPayload(final ServerConfigurationPayload serverConfig,
+            final String member, final String datastoreTypeSuffix, final String... shards) {
         String[] datastoreTypes = {"config_", "oper_"};
         for (String type : datastoreTypes) {
             for (String shard : shards) {
@@ -1158,8 +1161,8 @@ public class ClusterAdminRpcServiceTest {
     }
 
     @SafeVarargs
-    private static void verifyVotingStates(AbstractDataStore[] datastores, String[] shards,
-            SimpleEntry<String, Boolean>... expStates) throws Exception {
+    private static void verifyVotingStates(final AbstractDataStore[] datastores, final String[] shards,
+            final SimpleEntry<String, Boolean>... expStates) throws Exception {
         for (AbstractDataStore datastore: datastores) {
             for (String shard: shards) {
                 verifyVotingStates(datastore, shard, expStates);
@@ -1168,8 +1171,8 @@ public class ClusterAdminRpcServiceTest {
     }
 
     @SafeVarargs
-    private static void verifyVotingStates(AbstractDataStore datastore, String shardName,
-            SimpleEntry<String, Boolean>... expStates) throws Exception {
+    private static void verifyVotingStates(final AbstractDataStore datastore, final String shardName,
+            final SimpleEntry<String, Boolean>... expStates) throws Exception {
         String localMemberName = datastore.getActorContext().getCurrentMemberName().getName();
         Map<String, Boolean> expStateMap = new HashMap<>();
         for (Entry<String, Boolean> e: expStates) {
@@ -1187,7 +1190,7 @@ public class ClusterAdminRpcServiceTest {
         });
     }
 
-    private static void verifyShardResults(List<ShardResult> shardResults, ShardResult... expShardResults) {
+    private static void verifyShardResults(final List<ShardResult> shardResults, final ShardResult... expShardResults) {
         Map<String, ShardResult> expResultsMap = new HashMap<>();
         for (ShardResult r: expShardResults) {
             expResultsMap.put(r.getShardName() + "-" + r.getDataStoreType(), r);
@@ -1210,11 +1213,11 @@ public class ClusterAdminRpcServiceTest {
         }
     }
 
-    private static ShardResult successShardResult(String shardName, DataStoreType type) {
+    private static ShardResult successShardResult(final String shardName, final DataStoreType type) {
         return new ShardResultBuilder().setDataStoreType(type).setShardName(shardName).setSucceeded(TRUE).build();
     }
 
-    private static ShardResult failedShardResult(String shardName, DataStoreType type) {
+    private static ShardResult failedShardResult(final String shardName, final DataStoreType type) {
         return new ShardResultBuilder().setDataStoreType(type).setShardName(shardName).setSucceeded(FALSE).build();
     }
 }
index b1b3ff4..ce60c59 100644 (file)
@@ -19,13 +19,12 @@ import akka.actor.ActorRef;
 import akka.pattern.Patterns;
 import akka.util.Timeout;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.Uninterruptibles;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 import org.junit.After;
@@ -111,17 +110,15 @@ public class DataTreeCohortActorTest extends AbstractActorTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testAsyncCohort() throws Exception {
-        ExecutorService executor = Executors.newSingleThreadExecutor();
+        ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
 
         doReturn(Futures.makeChecked(executeWithDelay(executor, mockPostCanCommit),
             ex -> new DataValidationFailedException(YangInstanceIdentifier.EMPTY, "mock")))
                 .when(mockCohort).canCommit(any(Object.class), any(Collection.class), any(SchemaContext.class));
 
-        doReturn(JdkFutureAdapters.listenInPoolThread(executor.submit(() ->
-            mockPostPreCommit), MoreExecutors.directExecutor())).when(mockPostCanCommit).preCommit();
+        doReturn(executor.submit(() -> mockPostPreCommit)).when(mockPostCanCommit).preCommit();
 
-        doReturn(JdkFutureAdapters.listenInPoolThread(executor.submit(() ->
-            null), MoreExecutors.directExecutor())).when(mockPostPreCommit).commit();
+        doReturn(executor.submit(() -> null)).when(mockPostPreCommit).commit();
 
         ActorRef cohortActor = newCohortActor("testAsyncCohort");
 
@@ -190,14 +187,14 @@ public class DataTreeCohortActorTest extends AbstractActorTest {
         verify(mockPostPreCommit).abort();
     }
 
-    private <T> ListenableFuture<T> executeWithDelay(ExecutorService executor, T result) {
-        return JdkFutureAdapters.listenInPoolThread(executor.submit(() -> {
+    private static <T> ListenableFuture<T> executeWithDelay(final ListeningExecutorService executor, final T result) {
+        return executor.submit(() -> {
             Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
             return result;
-        }), MoreExecutors.directExecutor());
+        });
     }
 
-    private ActorRef newCohortActor(String name) {
+    private ActorRef newCohortActor(final String name) {
         return actorFactory.createActor(DataTreeCohortActor.props(mockCohort, YangInstanceIdentifier.EMPTY), name);
     }
 
@@ -213,7 +210,7 @@ public class DataTreeCohortActorTest extends AbstractActorTest {
         doReturn(Futures.immediateFuture(null)).when(mockPostPreCommit).commit();
     }
 
-    private static void askAndAwait(ActorRef actor, CommitProtocolCommand<?> message) throws Exception {
+    private static void askAndAwait(final ActorRef actor, final CommitProtocolCommand<?> message) throws Exception {
         Timeout timeout = new Timeout(5, TimeUnit.SECONDS);
         Object result = Await.result(Patterns.ask(actor, message, timeout), timeout.duration());
         assertTrue("Expected Success but was " + result, result instanceof Success);
index 75b31d4..a5e66fd 100644 (file)
@@ -10,12 +10,14 @@ package org.opendaylight.controller.clustering.it.provider;
 
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
-import java.util.concurrent.Future;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
 import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.controller.basic.rpc.test.rev160120.BasicGlobalInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.controller.basic.rpc.test.rev160120.BasicGlobalOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.controller.basic.rpc.test.rev160120.BasicGlobalOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.controller.basic.rpc.test.rev160120.BasicRpcTestService;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
@@ -59,9 +61,9 @@ public class BasicRpcTestProvider implements ClusterSingletonService, BasicRpcTe
     }
 
     @Override
-    public Future<RpcResult<Void>> basicGlobal() {
+    public ListenableFuture<RpcResult<BasicGlobalOutput>> basicGlobal(final BasicGlobalInput input) {
         LOG.info("Basic test global rpc invoked");
 
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new BasicGlobalOutputBuilder().build()).build());
     }
 }
index ed0aa1e..c0744de 100644 (file)
@@ -12,9 +12,9 @@ import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.CheckedFuture;
 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 java.util.Collection;
-import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -37,11 +37,30 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.Cars;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.RegisterCommitCohortInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.RegisterCommitCohortOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.RegisterCommitCohortOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.RegisterLoggingDtclInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.RegisterLoggingDtclOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.RegisterLoggingDtclOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.RegisterOwnershipInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.RegisterOwnershipOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.RegisterOwnershipOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.StopStressTestInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.StopStressTestOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.StopStressTestOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.StressTestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.StressTestOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.StressTestOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterCommitCohortInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterCommitCohortOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterCommitCohortOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterLoggingDtclsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterLoggingDtclsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterLoggingDtclsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterOwnershipInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterOwnershipOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterOwnershipOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.cars.CarEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.cars.CarEntryBuilder;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
@@ -113,14 +132,14 @@ public class CarProvider implements CarService {
     }
 
     @Override
-    public Future<RpcResult<Void>> stressTest(final StressTestInput input) {
+    public ListenableFuture<RpcResult<StressTestOutput>> stressTest(final StressTestInput input) {
         final int inputRate;
         final long inputCount;
 
         // If rate is not provided, or given as zero, then just return.
         if (input.getRate() == null || input.getRate() == 0) {
             LOG_PURCHASE_CAR.info("Exiting stress test as no rate is given.");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed()
+            return Futures.immediateFuture(RpcResultBuilder.<StressTestOutput>failed()
                     .withError(ErrorType.PROTOCOL, "invalid rate")
                     .build());
         }
@@ -146,7 +165,7 @@ public class CarProvider implements CarService {
             tx.submit().checkedGet(5, TimeUnit.SECONDS);
         } catch (TransactionCommitFailedException | TimeoutException e) {
             LOG_PURCHASE_CAR.error("Put Cars failed",e);
-            return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+            return Futures.immediateFuture(RpcResultBuilder.success(new StressTestOutputBuilder().build()).build());
         }
 
         stopThread = false;
@@ -185,7 +204,7 @@ public class CarProvider implements CarService {
                 }
 
                 if (count.get() % 1000 == 0) {
-                    LOG_PURCHASE_CAR.info("Cars created {}, time: {}",count.get(),sw.elapsed(TimeUnit.SECONDS));
+                    LOG_PURCHASE_CAR.info("Cars created {}, time: {}", count.get(), sw.elapsed(TimeUnit.SECONDS));
                 }
 
                 // Check if a count is specified in input and we have created that many cars.
@@ -198,11 +217,11 @@ public class CarProvider implements CarService {
         });
         testThread.start();
 
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new StressTestOutputBuilder().build()).build());
     }
 
     @Override
-    public Future<RpcResult<StopStressTestOutput>> stopStressTest() {
+    public ListenableFuture<RpcResult<StopStressTestOutput>> stopStressTest(final StopStressTestInput input) {
         stopThread();
         StopStressTestOutputBuilder stopStressTestOutput;
         stopStressTestOutput = new StopStressTestOutputBuilder()
@@ -220,7 +239,7 @@ public class CarProvider implements CarService {
 
 
     @Override
-    public Future<RpcResult<Void>> registerOwnership(final RegisterOwnershipInput input) {
+    public ListenableFuture<RpcResult<RegisterOwnershipOutput>> registerOwnership(final RegisterOwnershipInput input) {
         if (registeredListener.compareAndSet(false, true)) {
             ownershipService.registerListener(ENTITY_TYPE, ownershipListener);
         }
@@ -229,16 +248,17 @@ public class CarProvider implements CarService {
         try {
             ownershipService.registerCandidate(entity);
         } catch (CandidateAlreadyRegisteredException e) {
-            return RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION,
+            return RpcResultBuilder.<RegisterOwnershipOutput>failed().withError(ErrorType.APPLICATION,
                     "Could not register for car " + input.getCarId(), e).buildFuture();
         }
 
-        return RpcResultBuilder.<Void>success().buildFuture();
+        return RpcResultBuilder.success(new RegisterOwnershipOutputBuilder().build()).buildFuture();
     }
 
     @Override
-    public Future<RpcResult<Void>> unregisterOwnership(final UnregisterOwnershipInput input) {
-        return RpcResultBuilder.<Void>success().buildFuture();
+    public ListenableFuture<RpcResult<UnregisterOwnershipOutput>> unregisterOwnership(
+            final UnregisterOwnershipInput input) {
+        return RpcResultBuilder.success(new UnregisterOwnershipOutputBuilder().build()).buildFuture();
     }
 
     private static class CarEntityOwnershipListener implements EntityOwnershipListener {
@@ -249,17 +269,19 @@ public class CarProvider implements CarService {
     }
 
     @Override
-    public Future<RpcResult<java.lang.Void>> registerLoggingDtcl() {
+    public ListenableFuture<RpcResult<RegisterLoggingDtclOutput>> registerLoggingDtcl(
+            final RegisterLoggingDtclInput input) {
         LOG_CAR_PROVIDER.info("Registering a new CarDataTreeChangeListener");
         final ListenerRegistration<CarDataTreeChangeListener> carsDtclRegistration =
                 dataProvider.registerDataTreeChangeListener(CARS_DTID, new CarDataTreeChangeListener());
 
         carsDtclRegistrations.add(carsDtclRegistration);
-        return RpcResultBuilder.<Void>success().buildFuture();
+        return RpcResultBuilder.success(new RegisterLoggingDtclOutputBuilder().build()).buildFuture();
     }
 
     @Override
-    public Future<RpcResult<java.lang.Void>> unregisterLoggingDtcls() {
+    public ListenableFuture<RpcResult<UnregisterLoggingDtclsOutput>> unregisterLoggingDtcls(
+            final UnregisterLoggingDtclsInput input) {
         LOG_CAR_PROVIDER.info("Unregistering the CarDataTreeChangeListener(s)");
         synchronized (carsDtclRegistrations) {
             int numListeners = 0;
@@ -270,15 +292,16 @@ public class CarProvider implements CarService {
             carsDtclRegistrations.clear();
             LOG_CAR_PROVIDER.info("Unregistered {} CaraDataTreeChangeListener(s)", numListeners);
         }
-        return RpcResultBuilder.<Void>success().buildFuture();
+        return RpcResultBuilder.success(new UnregisterLoggingDtclsOutputBuilder().build()).buildFuture();
     }
 
     @Override
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public Future<RpcResult<Void>> unregisterCommitCohort() {
+    public ListenableFuture<RpcResult<UnregisterCommitCohortOutput>> unregisterCommitCohort(
+            final UnregisterCommitCohortInput input) {
         closeCommitCohortRegistration();
 
-        return RpcResultBuilder.<Void>success().buildFuture();
+        return RpcResultBuilder.success(new UnregisterCommitCohortOutputBuilder().build()).buildFuture();
     }
 
     private void closeCommitCohortRegistration() {
@@ -290,9 +313,10 @@ public class CarProvider implements CarService {
     }
 
     @Override
-    public synchronized Future<RpcResult<Void>> registerCommitCohort() {
+    public synchronized ListenableFuture<RpcResult<RegisterCommitCohortOutput>> registerCommitCohort(
+            final RegisterCommitCohortInput input) {
         if (commitCohortReg.get() != null) {
-            return RpcResultBuilder.<Void>success().buildFuture();
+            return RpcResultBuilder.success(new RegisterCommitCohortOutputBuilder().build()).buildFuture();
         }
 
         final DOMDataTreeCommitCohortRegistry commitCohortRegistry = (DOMDataTreeCommitCohortRegistry)
@@ -300,7 +324,7 @@ public class CarProvider implements CarService {
 
         if (commitCohortRegistry == null) {
             // Shouldn't happen
-            return RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION,
+            return RpcResultBuilder.<RegisterCommitCohortOutput>failed().withError(ErrorType.APPLICATION,
                     "DOMDataTreeCommitCohortRegistry not found").buildFuture();
         }
 
@@ -319,6 +343,6 @@ public class CarProvider implements CarService {
 
         LOG_CAR_PROVIDER.info("Registered commit cohort");
 
-        return RpcResultBuilder.<Void>success().buildFuture();
+        return RpcResultBuilder.success(new RegisterCommitCohortOutputBuilder().build()).buildFuture();
     }
 }
index ec3da0e..e2ac03b 100644 (file)
@@ -20,12 +20,12 @@ import com.google.common.base.Optional;
 import com.google.common.base.Strings;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import org.opendaylight.controller.cluster.ActorSystemProvider;
@@ -70,30 +70,75 @@ import org.opendaylight.mdsal.dom.api.DOMDataTreeService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.AddShardReplicaInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.AddShardReplicaOutput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.BecomePrefixLeaderInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.BecomePrefixLeaderOutput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.CheckPublishNotificationsInput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.CheckPublishNotificationsOutput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.CheckPublishNotificationsOutputBuilder;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.CreatePrefixShardInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.CreatePrefixShardOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.DeconfigureIdIntsShardInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.DeconfigureIdIntsShardOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.IsClientAbortedInput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.IsClientAbortedOutput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.ProduceTransactionsInput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.ProduceTransactionsOutput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterBoundConstantInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterBoundConstantOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterBoundConstantOutputBuilder;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterConstantInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterConstantOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterConstantOutputBuilder;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterDefaultConstantInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterDefaultConstantOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterFlappingSingletonInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterFlappingSingletonOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterFlappingSingletonOutputBuilder;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterSingletonConstantInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterSingletonConstantOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RegisterSingletonConstantOutputBuilder;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RemovePrefixShardInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RemovePrefixShardOutput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RemoveShardReplicaInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RemoveShardReplicaOutput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.ShutdownPrefixShardReplicaInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.ShutdownPrefixShardReplicaOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.ShutdownPrefixShardReplicaOutputBuilder;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.ShutdownShardReplicaInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.ShutdownShardReplicaOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.ShutdownShardReplicaOutputBuilder;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.StartPublishNotificationsInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.StartPublishNotificationsOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.StartPublishNotificationsOutputBuilder;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.SubscribeDdtlInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.SubscribeDdtlOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.SubscribeDdtlOutputBuilder;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.SubscribeDtclInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.SubscribeDtclOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.SubscribeDtclOutputBuilder;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.SubscribeYnlInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.SubscribeYnlOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.SubscribeYnlOutputBuilder;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterBoundConstantInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterBoundConstantOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterBoundConstantOutputBuilder;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterConstantInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterConstantOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterConstantOutputBuilder;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterDefaultConstantInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterDefaultConstantOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterFlappingSingletonInput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterFlappingSingletonOutput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterFlappingSingletonOutputBuilder;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterSingletonConstantInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterSingletonConstantOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnregisterSingletonConstantOutputBuilder;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeDdtlInput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeDdtlOutput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeDdtlOutputBuilder;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeDtclInput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeDtclOutput;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeDtclOutputBuilder;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeYnlInput;
@@ -189,14 +234,16 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
 
     @Override
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public Future<RpcResult<Void>> unregisterSingletonConstant() {
+    public ListenableFuture<RpcResult<UnregisterSingletonConstantOutput>> unregisterSingletonConstant(
+            final UnregisterSingletonConstantInput input) {
         LOG.debug("unregister-singleton-constant");
 
         if (getSingletonConstantRegistration == null) {
             LOG.debug("No get-singleton-constant registration present.");
             final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "missing-registration",
                     "No get-singleton-constant rpc registration present.");
-            final RpcResult<Void> result = RpcResultBuilder.<Void>failed().withRpcError(rpcError).build();
+            final RpcResult<UnregisterSingletonConstantOutput> result =
+                    RpcResultBuilder.<UnregisterSingletonConstantOutput>failed().withRpcError(rpcError).build();
             return Futures.immediateFuture(result);
         }
 
@@ -204,18 +251,21 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
             getSingletonConstantRegistration.close();
             getSingletonConstantRegistration = null;
 
-            return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+            return Futures.immediateFuture(RpcResultBuilder.success(
+                new UnregisterSingletonConstantOutputBuilder().build()).build());
         } catch (Exception e) {
             LOG.debug("There was a problem closing the singleton constant service", e);
             final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "error-closing",
                     "There was a problem closing get-singleton-constant");
-            final RpcResult<Void> result = RpcResultBuilder.<Void>failed().withRpcError(rpcError).build();
+            final RpcResult<UnregisterSingletonConstantOutput> result =
+                    RpcResultBuilder.<UnregisterSingletonConstantOutput>failed().withRpcError(rpcError).build();
             return Futures.immediateFuture(result);
         }
     }
 
     @Override
-    public Future<RpcResult<Void>> startPublishNotifications(final StartPublishNotificationsInput input) {
+    public ListenableFuture<RpcResult<StartPublishNotificationsOutput>> startPublishNotifications(
+            final StartPublishNotificationsInput input) {
         LOG.debug("publish-notifications, input: {}", input);
 
         final PublishNotificationsTask task = new PublishNotificationsTask(notificationPublishService, input.getId(),
@@ -225,16 +275,17 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
 
         task.start();
 
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new StartPublishNotificationsOutputBuilder().build())
+            .build());
     }
 
     @Override
-    public Future<RpcResult<Void>> subscribeDtcl() {
+    public ListenableFuture<RpcResult<SubscribeDtclOutput>> subscribeDtcl(final SubscribeDtclInput input) {
 
         if (dtclReg != null) {
             final RpcError error = RpcResultBuilder.newError(ErrorType.RPC, "Registration present.",
                     "There is already dataTreeChangeListener registered on id-ints list.");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            return Futures.immediateFuture(RpcResultBuilder.<SubscribeDtclOutput>failed().withRpcError(error).build());
         }
 
         idIntsListener = new IdIntsListener();
@@ -245,58 +296,61 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
                                 CONTROLLER_CONFIG, WriteTransactionsHandler.ID_INT_YID),
                         idIntsListener);
 
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new SubscribeDtclOutputBuilder().build()).build());
     }
 
     @Override
-    public Future<RpcResult<WriteTransactionsOutput>> writeTransactions(final WriteTransactionsInput input) {
+    public ListenableFuture<RpcResult<WriteTransactionsOutput>> writeTransactions(final WriteTransactionsInput input) {
         LOG.debug("write-transactions, input: {}", input);
         return WriteTransactionsHandler.start(domDataBroker, input);
     }
 
     @Override
-    public Future<RpcResult<IsClientAbortedOutput>> isClientAborted() {
+    public ListenableFuture<RpcResult<IsClientAbortedOutput>> isClientAborted(final IsClientAbortedInput input) {
         return null;
     }
 
     @Override
-    public Future<RpcResult<Void>> removeShardReplica(final RemoveShardReplicaInput input) {
+    public ListenableFuture<RpcResult<RemoveShardReplicaOutput>> removeShardReplica(
+            final RemoveShardReplicaInput input) {
         return null;
     }
 
     @Override
-    public Future<RpcResult<Void>> subscribeYnl(final SubscribeYnlInput input) {
+    public ListenableFuture<RpcResult<SubscribeYnlOutput>> subscribeYnl(final SubscribeYnlInput input) {
 
         LOG.debug("subscribe-ynl, input: {}", input);
 
         if (ynlRegistrations.containsKey(input.getId())) {
             final RpcError error = RpcResultBuilder.newError(ErrorType.RPC, "Registration present.",
                     "There is already ynl listener registered for this id: " + input.getId());
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            return Futures.immediateFuture(RpcResultBuilder.<SubscribeYnlOutput>failed().withRpcError(error).build());
         }
 
         ynlRegistrations.put(input.getId(),
                 notificationService.registerNotificationListener(new YnlListener(input.getId())));
 
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new SubscribeYnlOutputBuilder().build()).build());
     }
 
     @Override
-    public Future<RpcResult<Void>> removePrefixShard(final RemovePrefixShardInput input) {
+    public ListenableFuture<RpcResult<RemovePrefixShardOutput>> removePrefixShard(final RemovePrefixShardInput input) {
         LOG.debug("remove-prefix-shard, input: {}", input);
 
         return prefixShardHandler.onRemovePrefixShard(input);
     }
 
     @Override
-    public Future<RpcResult<Void>> becomePrefixLeader(final BecomePrefixLeaderInput input) {
+    public ListenableFuture<RpcResult<BecomePrefixLeaderOutput>> becomePrefixLeader(
+            final BecomePrefixLeaderInput input) {
         LOG.debug("become-prefix-leader, input: {}", input);
 
         return prefixLeaderHandler.makeLeaderLocal(input);
     }
 
     @Override
-    public Future<RpcResult<Void>> unregisterBoundConstant(final UnregisterBoundConstantInput input) {
+    public ListenableFuture<RpcResult<UnregisterBoundConstantOutput>> unregisterBoundConstant(
+            final UnregisterBoundConstantInput input) {
         LOG.debug("unregister-bound-constant, {}", input);
 
         final DOMRpcImplementationRegistration<RoutedGetConstantService> rpcRegistration =
@@ -306,54 +360,62 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
             LOG.debug("No get-contexted-constant registration for context: {}", input.getContext());
             final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "missing-registration",
                     "No get-constant rpc registration present.");
-            final RpcResult<Void> result = RpcResultBuilder.<Void>failed().withRpcError(rpcError).build();
+            final RpcResult<UnregisterBoundConstantOutput> result =
+                    RpcResultBuilder.<UnregisterBoundConstantOutput>failed().withRpcError(rpcError).build();
             return Futures.immediateFuture(result);
         }
 
         rpcRegistration.close();
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new UnregisterBoundConstantOutputBuilder().build())
+            .build());
     }
 
     @Override
-    public Future<RpcResult<Void>> registerSingletonConstant(final RegisterSingletonConstantInput input) {
+    public ListenableFuture<RpcResult<RegisterSingletonConstantOutput>> registerSingletonConstant(
+            final RegisterSingletonConstantInput input) {
 
         LOG.debug("Received register-singleton-constant rpc, input: {}", input);
 
         if (input.getConstant() == null) {
             final RpcError error = RpcResultBuilder.newError(
                     ErrorType.RPC, "Invalid input.", "Constant value is null");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            return Futures.immediateFuture(RpcResultBuilder.<RegisterSingletonConstantOutput>failed()
+                .withRpcError(error).build());
         }
 
         getSingletonConstantRegistration =
                 SingletonGetConstantService.registerNew(singletonService, domRpcService, input.getConstant());
 
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new RegisterSingletonConstantOutputBuilder().build())
+            .build());
     }
 
     @Override
-    public Future<RpcResult<Void>> registerDefaultConstant(final RegisterDefaultConstantInput input) {
+    public ListenableFuture<RpcResult<RegisterDefaultConstantOutput>> registerDefaultConstant(
+            final RegisterDefaultConstantInput input) {
         return null;
     }
 
     @Override
-    public Future<RpcResult<Void>> unregisterConstant() {
+    public ListenableFuture<RpcResult<UnregisterConstantOutput>> unregisterConstant(
+            final UnregisterConstantInput input) {
 
         if (globalGetConstantRegistration == null) {
             final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "missing-registration",
                     "No get-constant rpc registration present.");
-            final RpcResult<Void> result = RpcResultBuilder.<Void>failed().withRpcError(rpcError).build();
-            return Futures.immediateFuture(result);
+            return Futures.immediateFuture(RpcResultBuilder.<UnregisterConstantOutput>failed().withRpcError(rpcError)
+                .build());
         }
 
         globalGetConstantRegistration.close();
         globalGetConstantRegistration = null;
 
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new UnregisterConstantOutputBuilder().build()).build());
     }
 
     @Override
-    public Future<RpcResult<UnregisterFlappingSingletonOutput>> unregisterFlappingSingleton() {
+    public ListenableFuture<RpcResult<UnregisterFlappingSingletonOutput>> unregisterFlappingSingleton(
+            final UnregisterFlappingSingletonInput input) {
         LOG.debug("unregister-flapping-singleton received.");
 
         if (flappingSingletonService == null) {
@@ -374,17 +436,17 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
     }
 
     @Override
-    public Future<RpcResult<Void>> addShardReplica(final AddShardReplicaInput input) {
+    public ListenableFuture<RpcResult<AddShardReplicaOutput>> addShardReplica(final AddShardReplicaInput input) {
         return null;
     }
 
     @Override
-    public Future<RpcResult<Void>> subscribeDdtl() {
+    public ListenableFuture<RpcResult<SubscribeDdtlOutput>> subscribeDdtl(final SubscribeDdtlInput input) {
 
         if (ddtlReg != null) {
             final RpcError error = RpcResultBuilder.newError(ErrorType.RPC, "Registration present.",
                     "There is already dataTreeChangeListener registered on id-ints list.");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            return Futures.immediateFuture(RpcResultBuilder.<SubscribeDdtlOutput>failed().withRpcError(error).build());
         }
 
         idIntsDdtl = new IdIntsDOMDataTreeLIstener();
@@ -396,32 +458,35 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
                     true, Collections.emptyList());
         } catch (DOMDataTreeLoopException e) {
             LOG.error("Failed to register DOMDataTreeListener.", e);
-
         }
 
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new SubscribeDdtlOutputBuilder().build()).build());
     }
 
     @Override
-    public Future<RpcResult<Void>> registerBoundConstant(final RegisterBoundConstantInput input) {
+    public ListenableFuture<RpcResult<RegisterBoundConstantOutput>> registerBoundConstant(
+            final RegisterBoundConstantInput input) {
         LOG.debug("register-bound-constant: {}", input);
 
         if (input.getContext() == null) {
             final RpcError error = RpcResultBuilder.newError(
                     ErrorType.RPC, "Invalid input.", "Context value is null");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            return Futures.immediateFuture(RpcResultBuilder.<RegisterBoundConstantOutput>failed().withRpcError(error)
+                .build());
         }
 
         if (input.getConstant() == null) {
             final RpcError error = RpcResultBuilder.newError(
                     ErrorType.RPC, "Invalid input.", "Constant value is null");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            return Futures.immediateFuture(RpcResultBuilder.<RegisterBoundConstantOutput>failed().withRpcError(error)
+                .build());
         }
 
         if (routedRegistrations.containsKey(input.getContext())) {
             final RpcError error = RpcResultBuilder.newError(ErrorType.RPC, "Registration present.",
                     "There is already a rpc registered for context: " + input.getContext());
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            return Futures.immediateFuture(RpcResultBuilder.<RegisterBoundConstantOutput>failed().withRpcError(error)
+                .build());
         }
 
         final DOMRpcImplementationRegistration<RoutedGetConstantService> rpcRegistration =
@@ -429,26 +494,30 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
                         input.getConstant(), input.getContext());
 
         routedRegistrations.put(input.getContext(), rpcRegistration);
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new RegisterBoundConstantOutputBuilder().build())
+            .build());
     }
 
     @Override
-    public Future<RpcResult<Void>> registerFlappingSingleton() {
+    public ListenableFuture<RpcResult<RegisterFlappingSingletonOutput>> registerFlappingSingleton(
+            final RegisterFlappingSingletonInput input) {
         LOG.debug("Received register-flapping-singleton.");
 
         if (flappingSingletonService != null) {
             final RpcError error = RpcResultBuilder.newError(
                     ErrorType.RPC, "Registration present.", "flapping-singleton already registered");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            return Futures.immediateFuture(RpcResultBuilder.<RegisterFlappingSingletonOutput>failed()
+                .withRpcError(error).build());
         }
 
         flappingSingletonService = new FlappingSingletonService(singletonService);
 
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new RegisterFlappingSingletonOutputBuilder().build())
+            .build());
     }
 
     @Override
-    public Future<RpcResult<UnsubscribeDtclOutput>> unsubscribeDtcl() {
+    public ListenableFuture<RpcResult<UnsubscribeDtclOutput>> unsubscribeDtcl(final UnsubscribeDtclInput input) {
         LOG.debug("Received unsubscribe-dtcl");
 
         if (idIntsListener == null || dtclReg == null) {
@@ -504,19 +573,20 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
     }
 
     @Override
-    public Future<RpcResult<Void>> createPrefixShard(final CreatePrefixShardInput input) {
+    public ListenableFuture<RpcResult<CreatePrefixShardOutput>> createPrefixShard(final CreatePrefixShardInput input) {
         LOG.debug("create-prefix-shard, input: {}", input);
 
         return prefixShardHandler.onCreatePrefixShard(input);
     }
 
     @Override
-    public Future<RpcResult<Void>> deconfigureIdIntsShard() {
+    public ListenableFuture<RpcResult<DeconfigureIdIntsShardOutput>> deconfigureIdIntsShard(
+            final DeconfigureIdIntsShardInput input) {
         return null;
     }
 
     @Override
-    public Future<RpcResult<UnsubscribeYnlOutput>> unsubscribeYnl(final UnsubscribeYnlInput input) {
+    public ListenableFuture<RpcResult<UnsubscribeYnlOutput>> unsubscribeYnl(final UnsubscribeYnlInput input) {
         LOG.debug("Received unsubscribe-ynl, input: {}", input);
 
         if (!ynlRegistrations.containsKey(input.getId())) {
@@ -536,7 +606,7 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
     }
 
     @Override
-    public Future<RpcResult<CheckPublishNotificationsOutput>> checkPublishNotifications(
+    public ListenableFuture<RpcResult<CheckPublishNotificationsOutput>> checkPublishNotifications(
             final CheckPublishNotificationsInput input) {
 
         final PublishNotificationsTask task = publishNotificationsTasks.get(input.getId());
@@ -561,27 +631,31 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
     }
 
     @Override
-    public Future<RpcResult<ProduceTransactionsOutput>> produceTransactions(final ProduceTransactionsInput input) {
+    public ListenableFuture<RpcResult<ProduceTransactionsOutput>> produceTransactions(
+            final ProduceTransactionsInput input) {
         LOG.debug("producer-transactions, input: {}", input);
         return ProduceTransactionsHandler.start(domDataTreeService, input);
     }
 
     @Override
-    public Future<RpcResult<Void>> shutdownShardReplica(final ShutdownShardReplicaInput input) {
+    public ListenableFuture<RpcResult<ShutdownShardReplicaOutput>> shutdownShardReplica(
+            final ShutdownShardReplicaInput input) {
         LOG.debug("Received shutdown-shard-replica rpc, input: {}", input);
 
         final String shardName = input.getShardName();
         if (Strings.isNullOrEmpty(shardName)) {
             final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "bad-element",
                     "A valid shard name must be specified");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(rpcError).build());
+            return Futures.immediateFuture(RpcResultBuilder.<ShutdownShardReplicaOutput>failed().withRpcError(rpcError)
+                .build());
         }
 
-        return shutdownShardGracefully(shardName);
+        return shutdownShardGracefully(shardName, new ShutdownShardReplicaOutputBuilder().build());
     }
 
     @Override
-    public Future<RpcResult<Void>> shutdownPrefixShardReplica(final ShutdownPrefixShardReplicaInput input) {
+    public ListenableFuture<RpcResult<ShutdownPrefixShardReplicaOutput>> shutdownPrefixShardReplica(
+            final ShutdownPrefixShardReplicaInput input) {
         LOG.debug("Received shutdown-prefix-shard-replica rpc, input: {}", input);
 
         final InstanceIdentifier<?> shardPrefix = input.getPrefix();
@@ -589,17 +663,18 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
         if (shardPrefix == null) {
             final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "bad-element",
                     "A valid shard prefix must be specified");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(rpcError).build());
+            return Futures.immediateFuture(RpcResultBuilder.<ShutdownPrefixShardReplicaOutput>failed()
+                .withRpcError(rpcError).build());
         }
 
         final YangInstanceIdentifier shardPath = bindingNormalizedNodeSerializer.toYangInstanceIdentifier(shardPrefix);
         final String cleanPrefixShardName = ClusterUtils.getCleanShardName(shardPath);
 
-        return shutdownShardGracefully(cleanPrefixShardName);
+        return shutdownShardGracefully(cleanPrefixShardName, new ShutdownPrefixShardReplicaOutputBuilder().build());
     }
 
-    private SettableFuture<RpcResult<Void>> shutdownShardGracefully(final String shardName) {
-        final SettableFuture<RpcResult<Void>> rpcResult = SettableFuture.create();
+    private <T> SettableFuture<RpcResult<T>> shutdownShardGracefully(final String shardName, final T success) {
+        final SettableFuture<RpcResult<T>> rpcResult = SettableFuture.create();
         final ActorContext context = configDataStore.getActorContext();
 
         long timeoutInMS = Math.max(context.getDatastoreContext().getShardRaftConfig()
@@ -622,13 +697,13 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
             @Override
             public void onComplete(final Throwable throwable, final Boolean gracefulStopResult) throws Throwable {
                 if (throwable != null) {
-                    final RpcResult<Void> failedResult = RpcResultBuilder.<Void>failed()
+                    final RpcResult<T> failedResult = RpcResultBuilder.<T>failed()
                             .withError(ErrorType.APPLICATION, "Failed to gracefully shutdown shard", throwable).build();
                     rpcResult.set(failedResult);
                 } else {
                     // according to Patterns.gracefulStop API, we don't have to
                     // check value of gracefulStopResult
-                    rpcResult.set(RpcResultBuilder.<Void>success().build());
+                    rpcResult.set(RpcResultBuilder.success(success).build());
                 }
             }
         }, context.getClientDispatcher());
@@ -636,34 +711,37 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService
     }
 
     @Override
-    public Future<RpcResult<Void>> registerConstant(final RegisterConstantInput input) {
+    public ListenableFuture<RpcResult<RegisterConstantOutput>> registerConstant(final RegisterConstantInput input) {
 
         LOG.debug("Received register-constant rpc, input: {}", input);
 
         if (input.getConstant() == null) {
             final RpcError error = RpcResultBuilder.newError(
                     ErrorType.RPC, "Invalid input.", "Constant value is null");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            return Futures.immediateFuture(RpcResultBuilder.<RegisterConstantOutput>failed().withRpcError(error)
+                .build());
         }
 
         if (globalGetConstantRegistration != null) {
             final RpcError error = RpcResultBuilder.newError(ErrorType.RPC, "Registration present.",
                     "There is already a get-constant rpc registered.");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            return Futures.immediateFuture(RpcResultBuilder.<RegisterConstantOutput>failed().withRpcError(error)
+                .build());
         }
 
         globalGetConstantRegistration = GetConstantService.registerNew(domRpcService, input.getConstant());
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new RegisterConstantOutputBuilder().build()).build());
     }
 
     @Override
-    public Future<RpcResult<Void>> unregisterDefaultConstant() {
+    public ListenableFuture<RpcResult<UnregisterDefaultConstantOutput>> unregisterDefaultConstant(
+            final UnregisterDefaultConstantInput input) {
         return null;
     }
 
     @Override
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public Future<RpcResult<UnsubscribeDdtlOutput>> unsubscribeDdtl() {
+    public ListenableFuture<RpcResult<UnsubscribeDdtlOutput>> unsubscribeDdtl(final UnsubscribeDdtlInput input) {
         LOG.debug("Received unsubscribe-ddtl.");
 
         if (idIntsDdtl == null || ddtlReg == null) {
index 868b9d0..736b869 100644 (file)
@@ -10,15 +10,17 @@ package org.opendaylight.controller.clustering.it.provider;
 
 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.concurrent.Future;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.CarPurchaseService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.AddPersonInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.AddPersonOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.AddPersonOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.People;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.PeopleService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.PersonContext;
@@ -49,12 +51,12 @@ public class PeopleProvider implements PeopleService, AutoCloseable {
     }
 
     @Override
-    public Future<RpcResult<Void>> addPerson(final AddPersonInput input) {
+    public ListenableFuture<RpcResult<AddPersonOutput>> addPerson(final AddPersonInput input) {
         LOG.info("RPC addPerson : adding person [{}]", input);
 
         PersonBuilder builder = new PersonBuilder(input);
         final Person person = builder.build();
-        final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
+        final SettableFuture<RpcResult<AddPersonOutput>> futureResult = SettableFuture.create();
 
         // Each entry will be identifiable by a unique key, we have to create that identifier
         final InstanceIdentifier.InstanceIdentifierBuilder<Person> personIdBuilder =
@@ -71,13 +73,13 @@ public class PeopleProvider implements PeopleService, AutoCloseable {
                 LOG.info("RPC addPerson : person added successfully [{}]", person);
                 rpcRegistration.registerPath(PersonContext.class, personId);
                 LOG.info("RPC addPerson : routed rpc registered for instance ID [{}]", personId);
-                futureResult.set(RpcResultBuilder.<Void>success().build());
+                futureResult.set(RpcResultBuilder.success(new AddPersonOutputBuilder().build()).build());
             }
 
             @Override
             public void onFailure(final Throwable ex) {
                 LOG.error(String.format("RPC addPerson : person addition failed [%s]", person), ex);
-                futureResult.set(RpcResultBuilder.<Void>failed()
+                futureResult.set(RpcResultBuilder.<AddPersonOutput>failed()
                         .withError(RpcError.ErrorType.APPLICATION, ex.getMessage()).build());
             }
         }, MoreExecutors.directExecutor());
index ebd5b2e..457d819 100644 (file)
@@ -8,10 +8,12 @@
 
 package org.opendaylight.controller.clustering.it.provider;
 
+import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
-import java.util.concurrent.Future;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.BuyCarInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.BuyCarOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.BuyCarOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.CarBoughtBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.purchase.rev140818.CarPurchaseService;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -32,14 +34,14 @@ public class PurchaseCarProvider implements CarPurchaseService, AutoCloseable {
 
 
     @Override
-    public Future<RpcResult<Void>> buyCar(BuyCarInput input) {
+    public ListenableFuture<RpcResult<BuyCarOutput>> buyCar(final BuyCarInput input) {
         LOG.info("Routed RPC buyCar : generating notification for buying car [{}]", input);
-        final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
+        final SettableFuture<RpcResult<BuyCarOutput>> futureResult = SettableFuture.create();
         CarBoughtBuilder carBoughtBuilder = new CarBoughtBuilder();
         carBoughtBuilder.setCarId(input.getCarId());
         carBoughtBuilder.setPersonId(input.getPersonId());
         notificationProvider.publish(carBoughtBuilder.build());
-        futureResult.set(RpcResultBuilder.<Void>success().build());
+        futureResult.set(RpcResultBuilder.success(new BuyCarOutputBuilder().build()).build());
         return futureResult;
     }
 
index 0eb8b37..0d8391a 100644 (file)
@@ -21,6 +21,8 @@ import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeProducerException;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeService;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.BecomePrefixLeaderInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.BecomePrefixLeaderOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.BecomePrefixLeaderOutputBuilder;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
@@ -41,7 +43,7 @@ public class PrefixLeaderHandler {
         this.serializer = serializer;
     }
 
-    public ListenableFuture<RpcResult<Void>> makeLeaderLocal(final BecomePrefixLeaderInput input) {
+    public ListenableFuture<RpcResult<BecomePrefixLeaderOutput>> makeLeaderLocal(final BecomePrefixLeaderInput input) {
 
         final YangInstanceIdentifier yid = serializer.toYangInstanceIdentifier(input.getPrefix());
         final DOMDataTreeIdentifier prefix = new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, yid);
@@ -66,6 +68,6 @@ public class PrefixLeaderHandler {
                     "clustering-it", e));
         }
 
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(new BecomePrefixLeaderOutputBuilder().build()).build());
     }
 }
index e3b6f98..efc64a9 100644 (file)
@@ -37,7 +37,11 @@ import org.opendaylight.mdsal.dom.api.DOMDataTreeService;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeShardingConflictException;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.CreatePrefixShardInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.CreatePrefixShardOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.CreatePrefixShardOutputBuilder;
 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RemovePrefixShardInput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RemovePrefixShardOutput;
+import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.RemovePrefixShardOutputBuilder;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
@@ -73,9 +77,10 @@ public class PrefixShardHandler {
         this.serializer = serializer;
     }
 
-    public ListenableFuture<RpcResult<Void>> onCreatePrefixShard(final CreatePrefixShardInput input) {
+    public ListenableFuture<RpcResult<CreatePrefixShardOutput>> onCreatePrefixShard(
+            final CreatePrefixShardInput input) {
 
-        final SettableFuture<RpcResult<Void>> future = SettableFuture.create();
+        final SettableFuture<RpcResult<CreatePrefixShardOutput>> future = SettableFuture.create();
 
         final CompletionStage<DistributedShardRegistration> completionStage;
         final YangInstanceIdentifier identifier = serializer.toYangInstanceIdentifier(input.getPrefix());
@@ -94,7 +99,7 @@ public class PrefixShardHandler {
                     @Override
                     public void onSuccess(@Nullable final Void result) {
                         LOG.debug("Initial list write successful.");
-                        future.set(RpcResultBuilder.<Void>success().build());
+                        future.set(RpcResultBuilder.success(new CreatePrefixShardOutputBuilder().build()).build());
                     }
 
                     @Override
@@ -103,7 +108,7 @@ public class PrefixShardHandler {
 
                         final RpcError error = RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION,
                                 "create-shard-failed", "Shard creation failed", "cluster-test-app", "", throwable);
-                        future.set(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+                        future.set(RpcResultBuilder.<CreatePrefixShardOutput>failed().withRpcError(error).build());
                     }
                 }, MoreExecutors.directExecutor());
             });
@@ -112,7 +117,7 @@ public class PrefixShardHandler {
 
                 final RpcError error = RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, "create-shard-failed",
                         "Shard creation failed", "cluster-test-app", "", throwable);
-                future.set(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+                future.set(RpcResultBuilder.<CreatePrefixShardOutput>failed().withRpcError(error).build());
                 return null;
             });
         } catch (final DOMDataTreeShardingConflictException e) {
@@ -120,13 +125,14 @@ public class PrefixShardHandler {
 
             final RpcError error = RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, "create-shard-failed",
                     "Sharding conflict", "cluster-test-app", "", e);
-            future.set(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            future.set(RpcResultBuilder.<CreatePrefixShardOutput>failed().withRpcError(error).build());
         }
 
         return future;
     }
 
-    public ListenableFuture<RpcResult<Void>> onRemovePrefixShard(final RemovePrefixShardInput input) {
+    public ListenableFuture<RpcResult<RemovePrefixShardOutput>> onRemovePrefixShard(
+            final RemovePrefixShardInput input) {
 
         final YangInstanceIdentifier identifier = serializer.toYangInstanceIdentifier(input.getPrefix());
         final DistributedShardRegistration registration = registrations.get(identifier);
@@ -134,19 +140,20 @@ public class PrefixShardHandler {
         if (registration == null) {
             final RpcError error = RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, "registration-missing",
                     "No shard registered at this prefix.");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            return Futures.immediateFuture(RpcResultBuilder.<RemovePrefixShardOutput>failed().withRpcError(error)
+                .build());
         }
 
-        final SettableFuture<RpcResult<Void>> future = SettableFuture.create();
+        final SettableFuture<RpcResult<RemovePrefixShardOutput>> future = SettableFuture.create();
 
         final CompletionStage<Void> close = registration.close();
-        close.thenRun(() -> future.set(RpcResultBuilder.<Void>success().build()));
+        close.thenRun(() -> future.set(RpcResultBuilder.success(new RemovePrefixShardOutputBuilder().build()).build()));
         close.exceptionally(throwable -> {
             LOG.warn("Shard[{}] removal failed:", identifier, throwable);
 
             final RpcError error = RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, "remove-shard-failed",
                     "Shard removal failed", "cluster-test-app", "", throwable);
-            future.set(RpcResultBuilder.<Void>failed().withRpcError(error).build());
+            future.set(RpcResultBuilder.<RemovePrefixShardOutput>failed().withRpcError(error).build());
             return null;
         });
 
index 1899afb..c1c43f7 100644 (file)
@@ -5,13 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.sample.kitchen.impl;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableList.Builder;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -25,6 +23,8 @@ import org.opendaylight.controller.sample.kitchen.api.KitchenService;
 import org.opendaylight.controller.sample.kitchen.api.KitchenServiceRuntimeMXBean;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastInput;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastInputBuilder;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastOutput;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToastType;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterListener;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterOutOfBread;
@@ -42,6 +42,7 @@ public class KitchenServiceImpl extends AbstractMXBean
         implements KitchenService, KitchenServiceRuntimeMXBean, ToasterListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(KitchenServiceImpl.class);
+    private static final MakeToastOutput EMPTY_MAKE_OUTPUT = new MakeToastOutputBuilder().build();
 
     private final ToasterService toaster;
 
@@ -49,25 +50,24 @@ public class KitchenServiceImpl extends AbstractMXBean
 
     private volatile boolean toasterOutOfBread;
 
-    public KitchenServiceImpl(ToasterService toaster) {
+    public KitchenServiceImpl(final ToasterService toaster) {
         super("KitchenService", "toaster-consumer", null);
         this.toaster = toaster;
     }
 
     @Override
-    public Future<RpcResult<Void>> makeBreakfast(EggsType eggsType, Class<? extends ToastType> toastType,
-            int toastDoneness) {
-        // Call makeToast and use JdkFutureAdapters to convert the Future to a ListenableFuture, The
-        // OpendaylightToaster impl already returns a ListenableFuture so the conversion is actually a no-op.
+    public Future<RpcResult<Void>> makeBreakfast(final EggsType eggsType, final Class<? extends ToastType> toastType,
+            final int toastDoneness) {
+        // Call makeToast, The OpendaylightToaster impl already returns a ListenableFuture so the conversion is
+        // actually a no-op.
 
-        ListenableFuture<RpcResult<Void>> makeToastFuture = JdkFutureAdapters
-                .listenInPoolThread(makeToast(toastType, toastDoneness), executor);
+        ListenableFuture<RpcResult<MakeToastOutput>> makeToastFuture = makeToast(toastType, toastDoneness);
 
         ListenableFuture<RpcResult<Void>> makeEggsFuture = makeEggs(eggsType);
 
         // Combine the 2 ListenableFutures into 1 containing a list RpcResults.
 
-        ListenableFuture<List<RpcResult<Void>>> combinedFutures = Futures
+        ListenableFuture<List<RpcResult<? extends Object>>> combinedFutures = Futures
                 .allAsList(ImmutableList.of(makeToastFuture, makeEggsFuture));
 
         // Then transform the RpcResults into 1.
@@ -75,7 +75,7 @@ public class KitchenServiceImpl extends AbstractMXBean
         return Futures.transformAsync(combinedFutures, results -> {
             boolean atLeastOneSucceeded = false;
             Builder<RpcError> errorList = ImmutableList.builder();
-            for (RpcResult<Void> result : results) {
+            for (RpcResult<? extends Object> result : results) {
                 if (result.isSuccessful()) {
                     atLeastOneSucceeded = true;
                 }
@@ -87,19 +87,21 @@ public class KitchenServiceImpl extends AbstractMXBean
 
             return Futures.immediateFuture(RpcResultBuilder.<Void>status(atLeastOneSucceeded)
                     .withRpcErrors(errorList.build()).build());
-        });
+        }, MoreExecutors.directExecutor());
     }
 
-    private ListenableFuture<RpcResult<Void>> makeEggs(EggsType eggsType) {
+    private ListenableFuture<RpcResult<Void>> makeEggs(final EggsType eggsType) {
         return executor.submit(() -> RpcResultBuilder.<Void>success().build());
     }
 
-    private Future<RpcResult<Void>> makeToast(Class<? extends ToastType> toastType, int toastDoneness) {
+    private ListenableFuture<RpcResult<MakeToastOutput>> makeToast(final Class<? extends ToastType> toastType,
+            final int toastDoneness) {
 
         if (toasterOutOfBread) {
             LOG.info("We're out of toast but we can make eggs");
-            return Futures.immediateFuture(RpcResultBuilder.<Void>success().withWarning(ErrorType.APPLICATION,
-                    "partial-operation", "Toaster is out of bread but we can make you eggs").build());
+            return Futures.immediateFuture(RpcResultBuilder.success(EMPTY_MAKE_OUTPUT)
+                .withWarning(ErrorType.APPLICATION, "partial-operation",
+                    "Toaster is out of bread but we can make you eggs").build());
         }
 
         // Access the ToasterService to make the toast.
@@ -134,7 +136,7 @@ public class KitchenServiceImpl extends AbstractMXBean
      * Implemented from the ToasterListener interface.
      */
     @Override
-    public void onToasterOutOfBread(ToasterOutOfBread notification) {
+    public void onToasterOutOfBread(final ToasterOutOfBread notification) {
         LOG.info("ToasterOutOfBread notification");
         toasterOutOfBread = true;
     }
@@ -143,7 +145,7 @@ public class KitchenServiceImpl extends AbstractMXBean
      * Implemented from the ToasterListener interface.
      */
     @Override
-    public void onToasterRestocked(ToasterRestocked notification) {
+    public void onToasterRestocked(final ToasterRestocked notification) {
         LOG.info("ToasterRestocked notification - amountOfBread: " + notification.getAmountOfBread());
         toasterOutOfBread = false;
     }
index 4078409..cbac02c 100644 (file)
@@ -19,6 +19,7 @@ import com.google.common.base.Preconditions;
 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.Collection;
 import java.util.concurrent.Callable;
@@ -38,9 +39,16 @@ import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.CancelToastInput;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.CancelToastOutput;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.CancelToastOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.DisplayString;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastInput;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastOutput;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.RestockToasterInput;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.RestockToasterOutput;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.RestockToasterOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.Toaster;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.Toaster.ToasterStatus;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterBuilder;
@@ -62,6 +70,10 @@ import org.slf4j.LoggerFactory;
 public class OpendaylightToaster extends AbstractMXBean
         implements ToasterService, ToasterProviderRuntimeMXBean, DataTreeChangeListener<Toaster>, AutoCloseable {
 
+    private static final CancelToastOutput EMPTY_CANCEL_OUTPUT = new CancelToastOutputBuilder().build();
+    private static final MakeToastOutput EMPTY_MAKE_OUTPUT = new MakeToastOutputBuilder().build();
+    private static final RestockToasterOutput EMPTY_RESTOCK_OUTPUT = new RestockToasterOutputBuilder().build();
+
     private static final Logger LOG = LoggerFactory.getLogger(OpendaylightToaster.class);
 
     private static final InstanceIdentifier<Toaster> TOASTER_IID = InstanceIdentifier.builder(Toaster.class).build();
@@ -89,7 +101,7 @@ public class OpendaylightToaster extends AbstractMXBean
                 .setMaxMakeToastTries(2).build());
     }
 
-    public OpendaylightToaster(ToasterAppConfig toasterAppConfig) {
+    public OpendaylightToaster(final ToasterAppConfig toasterAppConfig) {
         super("OpendaylightToaster", "toaster-provider", null);
         executor = Executors.newFixedThreadPool(1);
         this.toasterAppConfig = toasterAppConfig;
@@ -145,7 +157,7 @@ public class OpendaylightToaster extends AbstractMXBean
                 public void onFailure(final Throwable failure) {
                     LOG.error("Delete of the operational Toaster failed", failure);
                 }
-            });
+            }, MoreExecutors.directExecutor());
         }
     }
 
@@ -161,7 +173,7 @@ public class OpendaylightToaster extends AbstractMXBean
      * Implemented from the DataTreeChangeListener interface.
      */
     @Override
-    public void onDataTreeChanged(Collection<DataTreeModification<Toaster>> changes) {
+    public void onDataTreeChanged(final Collection<DataTreeModification<Toaster>> changes) {
         for (DataTreeModification<Toaster> change: changes) {
             DataObjectModification<Toaster> rootNode = change.getRootNode();
             if (rootNode.getModificationType() == WRITE) {
@@ -186,41 +198,41 @@ public class OpendaylightToaster extends AbstractMXBean
      * RPC call implemented from the ToasterService interface that cancels the current toast, if any.
      */
     @Override
-    public Future<RpcResult<Void>> cancelToast() {
+    public ListenableFuture<RpcResult<CancelToastOutput>> cancelToast(final CancelToastInput input) {
         Future<?> current = currentMakeToastTask.getAndSet(null);
         if (current != null) {
             current.cancel(true);
         }
 
         // Always return success from the cancel toast call
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(EMPTY_CANCEL_OUTPUT).build());
     }
 
     /**
      * RPC call implemented from the ToasterService interface that attempts to make toast.
      */
     @Override
-    public Future<RpcResult<Void>> makeToast(final MakeToastInput input) {
+    public ListenableFuture<RpcResult<MakeToastOutput>> makeToast(final MakeToastInput input) {
         LOG.info("makeToast: " + input);
 
-        final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
+        final SettableFuture<RpcResult<MakeToastOutput>> futureResult = SettableFuture.create();
 
         checkStatusAndMakeToast(input, futureResult, toasterAppConfig.getMaxMakeToastTries());
 
         return futureResult;
     }
 
-    private RpcError makeToasterOutOfBreadError() {
+    private static RpcError makeToasterOutOfBreadError() {
         return RpcResultBuilder.newError(APPLICATION, "resource-denied", "Toaster is out of bread", "out-of-stock",
                 null, null);
     }
 
-    private RpcError makeToasterInUseError() {
+    private static RpcError makeToasterInUseError() {
         return RpcResultBuilder.newWarning(APPLICATION, "in-use", "Toaster is busy", null, null, null);
     }
 
-    private void checkStatusAndMakeToast(final MakeToastInput input, final SettableFuture<RpcResult<Void>> futureResult,
-            final int tries) {
+    private void checkStatusAndMakeToast(final MakeToastInput input,
+            final SettableFuture<RpcResult<MakeToastOutput>> futureResult, final int tries) {
         // Read the ToasterStatus and, if currently Up, try to write the status to Down.
         // If that succeeds, then we essentially have an exclusive lock and can proceed
         // to make toast.
@@ -260,7 +272,7 @@ public class OpendaylightToaster extends AbstractMXBean
                 // TransactionStatus in the RpcResult as an error condition.
                 return Futures.immediateFailedCheckedFuture(
                         new TransactionCommitFailedException("", makeToasterInUseError()));
-            });
+            }, MoreExecutors.directExecutor());
 
         Futures.addCallback(commitFuture, new FutureCallback<Void>() {
             @Override
@@ -281,22 +293,22 @@ public class OpendaylightToaster extends AbstractMXBean
                         LOG.debug("Got OptimisticLockFailedException - trying again");
                         checkStatusAndMakeToast(input, futureResult, tries - 1);
                     } else {
-                        futureResult.set(RpcResultBuilder.<Void>failed()
+                        futureResult.set(RpcResultBuilder.<MakeToastOutput>failed()
                                 .withError(ErrorType.APPLICATION, ex.getMessage()).build());
                     }
                 } else if (ex instanceof TransactionCommitFailedException) {
                     LOG.debug("Failed to commit Toaster status", ex);
 
                     // Probably already making toast.
-                    futureResult.set(RpcResultBuilder.<Void>failed()
+                    futureResult.set(RpcResultBuilder.<MakeToastOutput>failed()
                             .withRpcErrors(((TransactionCommitFailedException)ex).getErrorList()).build());
                 } else {
                     LOG.debug("Unexpected error committing Toaster status", ex);
-                    futureResult.set(RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION,
+                    futureResult.set(RpcResultBuilder.<MakeToastOutput>failed().withError(ErrorType.APPLICATION,
                             "Unexpected error committing Toaster status", ex).build());
                 }
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     /**
@@ -305,7 +317,7 @@ public class OpendaylightToaster extends AbstractMXBean
      * ToasterRestocked notification.
      */
     @Override
-    public Future<RpcResult<java.lang.Void>> restockToaster(final RestockToasterInput input) {
+    public ListenableFuture<RpcResult<RestockToasterOutput>> restockToaster(final RestockToasterInput input) {
         LOG.info("restockToaster: " + input);
 
         amountOfBreadInStock.set(input.getAmountOfBreadToStock());
@@ -316,7 +328,7 @@ public class OpendaylightToaster extends AbstractMXBean
             notificationProvider.offerNotification(reStockedNotification);
         }
 
-        return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
+        return Futures.immediateFuture(RpcResultBuilder.success(EMPTY_RESTOCK_OUTPUT).build());
     }
 
     /**
@@ -336,7 +348,7 @@ public class OpendaylightToaster extends AbstractMXBean
         return toastsMade.get();
     }
 
-    private void setToasterStatusUp(final Function<Boolean,Void> resultCallback) {
+    private void setToasterStatusUp(final Function<Boolean, MakeToastOutput> resultCallback) {
         WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
         tx.put(OPERATIONAL,TOASTER_IID, buildToaster(ToasterStatus.Up));
 
@@ -361,7 +373,7 @@ public class OpendaylightToaster extends AbstractMXBean
                     resultCallback.apply(result);
                 }
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private boolean outOfBread() {
@@ -371,9 +383,10 @@ public class OpendaylightToaster extends AbstractMXBean
     private class MakeToastTask implements Callable<Void> {
 
         final MakeToastInput toastRequest;
-        final SettableFuture<RpcResult<Void>> futureResult;
+        final SettableFuture<RpcResult<MakeToastOutput>> futureResult;
 
-        MakeToastTask(final MakeToastInput toastRequest, final SettableFuture<RpcResult<Void>> futureResult) {
+        MakeToastTask(final MakeToastInput toastRequest,
+            final SettableFuture<RpcResult<MakeToastOutput>> futureResult) {
             this.toastRequest = toastRequest;
             this.futureResult = futureResult;
         }
@@ -404,7 +417,7 @@ public class OpendaylightToaster extends AbstractMXBean
             setToasterStatusUp(result -> {
                 currentMakeToastTask.set(null);
                 LOG.debug("Toast done");
-                futureResult.set(RpcResultBuilder.<Void>success().build());
+                futureResult.set(RpcResultBuilder.success(EMPTY_MAKE_OUTPUT).build());
                 return null;
             });
 
index 23a51e1..62b1234 100644 (file)
@@ -27,6 +27,7 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.DisplayString;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastInput;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastInputBuilder;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastOutput;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.Toaster;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.WheatBread;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -76,9 +77,9 @@ public class OpenDaylightToasterTest extends AbstractConcurrentDataBrokerTest {
         // NOTE: In a real test we would want to override the Thread.sleep() to
         // prevent our junit test
         // for sleeping for a second...
-        Future<RpcResult<Void>> makeToast = toaster.makeToast(toastInput);
+        Future<RpcResult<MakeToastOutput>> makeToast = toaster.makeToast(toastInput);
 
-        RpcResult<Void> rpcResult = makeToast.get();
+        RpcResult<MakeToastOutput> rpcResult = makeToast.get();
 
         assertNotNull(rpcResult);
         assertTrue(rpcResult.isSuccessful());

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.