Split out odl-netconf-device.yang
[netconf.git] / netconf / netconf-topology-singleton / src / test / java / org / opendaylight / netconf / topology / singleton / impl / MountPointEndToEndTest.java
index 2bccd69783d0431a70f314e2ecf4857f85f2b0da..c6de36f416d28254404825f412b9abd34b82cc27 100644 (file)
@@ -17,6 +17,7 @@ import static org.junit.Assert.fail;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.timeout;
@@ -27,8 +28,6 @@ import akka.testkit.javadsl.TestKit;
 import akka.util.Timeout;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -37,11 +36,9 @@ import com.google.common.util.concurrent.SettableFuture;
 import com.typesafe.config.ConfigFactory;
 import io.netty.util.concurrent.EventExecutor;
 import io.netty.util.concurrent.GlobalEventExecutor;
-import io.netty.util.concurrent.SucceededFuture;
 import java.io.File;
-import java.util.AbstractMap.SimpleEntry;
-import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Optional;
@@ -50,6 +47,7 @@ import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import org.apache.commons.io.FileUtils;
+import org.eclipse.jdt.annotation.NonNull;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -84,6 +82,7 @@ import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
 import org.opendaylight.mdsal.dom.api.DOMMountPoint;
 import org.opendaylight.mdsal.dom.api.DOMMountPointListener;
 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
+import org.opendaylight.mdsal.dom.api.DOMRpcAvailabilityListener;
 import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.mdsal.dom.api.DOMRpcImplementation;
 import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
@@ -93,15 +92,20 @@ import org.opendaylight.mdsal.dom.api.DOMService;
 import org.opendaylight.mdsal.dom.broker.DOMMountPointServiceImpl;
 import org.opendaylight.mdsal.dom.broker.DOMRpcRouter;
 import org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult;
+import org.opendaylight.mdsal.dom.spi.FixedDOMSchemaService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
 import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
 import org.opendaylight.mdsal.singleton.dom.impl.DOMClusterSingletonServiceProviderImpl;
 import org.opendaylight.netconf.client.NetconfClientDispatcher;
+import org.opendaylight.netconf.nettyutil.ReconnectFuture;
 import org.opendaylight.netconf.sal.connect.api.DeviceActionFactory;
+import org.opendaylight.netconf.sal.connect.api.RemoteDeviceServices;
+import org.opendaylight.netconf.sal.connect.api.RemoteDeviceServices.Rpcs;
 import org.opendaylight.netconf.sal.connect.api.SchemaResourceManager;
 import org.opendaylight.netconf.sal.connect.impl.DefaultSchemaResourceManager;
-import org.opendaylight.netconf.sal.connect.netconf.NetconfDevice.SchemaResourcesDTO;
+import org.opendaylight.netconf.sal.connect.netconf.NetconfDeviceSchema;
+import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCapabilities;
 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences;
 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil;
 import org.opendaylight.netconf.topology.singleton.impl.utils.ClusteringRpcException;
@@ -111,13 +115,13 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev221225.ConnectionOper.ConnectionStatus;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev221225.credentials.credentials.LoginPwUnencryptedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev221225.credentials.credentials.login.pw.unencrypted.LoginPasswordUnencryptedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.keystore.rev171017.Keystore;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPwUnencryptedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.login.pw.unencrypted.LoginPasswordUnencryptedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev221225.NetconfNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev221225.NetconfNodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev221225.network.topology.topology.topology.types.TopologyNetconf;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.topology.singleton.config.rev170419.Config;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.topology.singleton.config.rev170419.ConfigBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.GetTopInput;
@@ -129,17 +133,23 @@ 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.test.list.rev140701.two.level.list.TopLevelListKey;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.rfc8528.data.api.MountPointContext;
 import org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext;
 import org.opendaylight.yangtools.util.concurrent.FluentFutures;
+import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint32;
@@ -153,7 +163,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
+import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 import org.opendaylight.yangtools.yang.model.repo.spi.PotentialSchemaSource;
 import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory;
@@ -165,16 +175,15 @@ import org.slf4j.LoggerFactory;
  *
  * @author Thomas Pantelis
  */
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.StrictStubs.class)
 public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
     private static final Logger LOG = LoggerFactory.getLogger(MountPointEndToEndTest.class);
 
     private static final String TOP_MODULE_NAME = "opendaylight-mdsal-list-test";
     private static final String ACTOR_SYSTEM_NAME = "test";
     private static final String TOPOLOGY_ID = TopologyNetconf.QNAME.getLocalName();
-    private static final NodeId NODE_ID = new NodeId("node-id");
-    private static final InstanceIdentifier<Node> NODE_INSTANCE_ID = NetconfTopologyUtils.createTopologyNodeListPath(
-            new NodeKey(NODE_ID), TOPOLOGY_ID);
+    private static final @NonNull KeyedInstanceIdentifier<Node, NodeKey> NODE_INSTANCE_ID =
+        NetconfTopologyUtils.createTopologyNodeListPath(new NodeKey(new NodeId("node-id")), TOPOLOGY_ID);
 
     private static final String TEST_ROOT_DIRECTORY = "test-cache-root";
     private static final String TEST_DEFAULT_SUBDIR = "test-schema";
@@ -191,12 +200,14 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
     @Mock private ActorSystemProvider mockMasterActorSystemProvider;
     @Mock private DOMMountPointListener masterMountPointListener;
     private final DOMMountPointService masterMountPointService = new DOMMountPointServiceImpl();
-    private final DOMRpcRouter deviceRpcService = new DOMRpcRouter();
+    private Rpcs.Normalized deviceRpcService;
+
     private DOMClusterSingletonServiceProviderImpl masterClusterSingletonServiceProvider;
     private DataBroker masterDataBroker;
     private DOMDataBroker deviceDOMDataBroker;
     private ActorSystem masterSystem;
     private NetconfTopologyManager masterNetconfTopologyManager;
+
     private volatile SettableFuture<MasterSalFacade> masterSalFacadeFuture = SettableFuture.create();
 
     @Mock private ActorSystemProvider mockSlaveActorSystemProvider;
@@ -223,7 +234,6 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
 
     private SchemaResourceManager resourceManager;
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
     @Before
     public void setUp() throws Exception {
         deleteCacheDir();
@@ -235,22 +245,35 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
 
         deviceSchemaContext = BindingRuntimeHelpers.createEffectiveModel(Top.class);
 
-        deviceRpcService.onModelContextUpdated(deviceSchemaContext);
+        final var router = new DOMRpcRouter(FixedDOMSchemaService.of(deviceSchemaContext));
 
         putTopRpcSchemaPath = findRpcDefinition("put-top").getQName();
         getTopRpcSchemaPath = findRpcDefinition("get-top").getQName();
 
-        deviceRpcService.getRpcProviderService().registerRpcImplementation(topRpcImplementation,
+        router.getRpcProviderService().registerRpcImplementation(topRpcImplementation,
                 DOMRpcIdentifier.create(putTopRpcSchemaPath), DOMRpcIdentifier.create(getTopRpcSchemaPath));
 
+        final var rpcService = router.getRpcService();
+        deviceRpcService = new Rpcs.Normalized() {
+            @Override
+            public ListenableFuture<? extends DOMRpcResult> invokeRpc(final QName type, final ContainerNode input) {
+                return rpcService.invokeRpc(type, input);
+            }
+
+            @Override
+            public <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(
+                    final T listener) {
+                return rpcService.registerRpcListener(listener);
+            }
+        };
+
         setupMaster();
 
         setupSlave();
 
         yangNodeInstanceId = bindingToNormalized.toYangInstanceIdentifier(NODE_INSTANCE_ID);
 
-        doReturn(new SucceededFuture(GlobalEventExecutor.INSTANCE, null)).when(mockClientDispatcher)
-                .createReconnectingClient(any());
+        doReturn(mock(ReconnectFuture.class)).when(mockClientDispatcher).createReconnectingClient(any());
 
         LOG.info("****** Setup complete");
     }
@@ -267,7 +290,7 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
     }
 
     private void setupMaster() throws Exception {
-        AbstractConcurrentDataBrokerTest dataBrokerTest = newDataBrokerTest();
+        final var dataBrokerTest = newDataBrokerTest();
         masterDataBroker = dataBrokerTest.getDataBroker();
         deviceDOMDataBroker = dataBrokerTest.getDomBroker();
         bindingToNormalized = dataBrokerTest.getDataBrokerTestCustomizer().getAdapterContext().currentSerializer();
@@ -281,13 +304,13 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
 
         doReturn(MoreExecutors.newDirectExecutorService()).when(mockThreadPool).getExecutor();
 
-        final SchemaResourcesDTO resources =  resourceManager.getSchemaResources(
-            new NetconfNodeBuilder().setSchemaCacheDirectory(TEST_DEFAULT_SUBDIR).build(), "test");
+        final var resources =  resourceManager.getSchemaResources(TEST_DEFAULT_SUBDIR, "test");
         resources.getSchemaRegistry().registerSchemaSource(
             id -> Futures.immediateFuture(YangTextSchemaSource.delegateForByteSource(id,
                     topModuleInfo.getYangTextByteSource())),
-            PotentialSchemaSource.create(RevisionSourceIdentifier.create(TOP_MODULE_NAME,
-                    topModuleInfo.getName().getRevision()), YangTextSchemaSource.class, 1));
+            PotentialSchemaSource.create(new SourceIdentifier(TOP_MODULE_NAME,
+                    topModuleInfo.getName().getRevision().map(Revision::toString).orElse(null)),
+                YangTextSchemaSource.class, 1));
 
         masterNetconfTopologyManager = new NetconfTopologyManager(BASE_SCHEMAS, masterDataBroker,
                 mockRpcProviderRegistry, mockActionProviderRegistry, masterClusterSingletonServiceProvider,
@@ -296,15 +319,16 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
                 mockRpcProviderService, deviceActionFactory, resourceManager) {
             @Override
             protected NetconfTopologyContext newNetconfTopologyContext(final NetconfTopologySetup setup,
-                final ServiceGroupIdentifier serviceGroupIdent, final Timeout actorResponseWaitTime,
-                final DeviceActionFactory deviceActionFact) {
-                NetconfTopologyContext context =
-                    super.newNetconfTopologyContext(setup, serviceGroupIdent, actorResponseWaitTime, deviceActionFact);
+                    final ServiceGroupIdentifier serviceGroupIdent, final Timeout actorResponseWaitTime,
+                    final DeviceActionFactory deviceActionFact) {
+                final var context = super.newNetconfTopologyContext(setup, serviceGroupIdent, actorResponseWaitTime,
+                    deviceActionFact);
 
-                NetconfTopologyContext spiedContext = spy(context);
+                final var spiedContext = spy(context);
                 doAnswer(invocation -> {
-                    final MasterSalFacade spiedFacade = (MasterSalFacade) spy(invocation.callRealMethod());
-                    doReturn(deviceDOMDataBroker).when(spiedFacade).newDeviceDataBroker();
+                    final var spiedFacade = (MasterSalFacade) spy(invocation.callRealMethod());
+                    doReturn(deviceDOMDataBroker).when(spiedFacade)
+                        .newDeviceDataBroker(any(MountPointContext.class), any(NetconfSessionPreferences.class));
                     masterSalFacadeFuture.set(spiedFacade);
                     return spiedFacade;
                 }).when(spiedContext).newMasterSalFacade();
@@ -376,19 +400,19 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
         testCleanup();
     }
 
-    private MasterSalFacade testMaster() throws InterruptedException, ExecutionException, TimeoutException {
+    private MasterSalFacade testMaster() throws Exception {
         LOG.info("****** Testing master");
 
         writeNetconfNode(TEST_DEFAULT_SUBDIR, masterDataBroker);
 
-        final MasterSalFacade masterSalFacade = masterSalFacadeFuture.get(5, TimeUnit.SECONDS);
-        final ArrayList<String> capabilities = Lists.newArrayList(
-            NetconfMessageTransformUtil.NETCONF_CANDIDATE_URI.toString());
+        final var masterSalFacade = masterSalFacadeFuture.get(5, TimeUnit.SECONDS);
+        masterSalFacade.onDeviceConnected(new NetconfDeviceSchema(NetconfDeviceCapabilities.empty(),
+            new EmptyMountPointContext(deviceSchemaContext)),
+            NetconfSessionPreferences.fromStrings(
+                List.of(NetconfMessageTransformUtil.NETCONF_CANDIDATE_URI.toString())),
+            new RemoteDeviceServices(deviceRpcService, null));
 
-        masterSalFacade.onDeviceConnected(new EmptyMountPointContext(deviceSchemaContext),
-                NetconfSessionPreferences.fromStrings(capabilities), deviceRpcService.getRpcService());
-
-        DOMMountPoint masterMountPoint = awaitMountPoint(masterMountPointService);
+        final var masterMountPoint = awaitMountPoint(masterMountPointService);
 
         LOG.info("****** Testing master DOMDataBroker operations");
 
@@ -400,7 +424,7 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
         return masterSalFacade;
     }
 
-    private void testSlave() throws InterruptedException, ExecutionException, TimeoutException {
+    private void testSlave() throws Exception {
         LOG.info("****** Testing slave");
 
         writeNetconfNode("slave", slaveDataBroker);
@@ -447,7 +471,7 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
         testDOMRpcService(getDOMRpcService(slaveMountPoint));
     }
 
-    private MasterSalFacade testMasterNodeUpdated() throws InterruptedException, ExecutionException, TimeoutException {
+    private MasterSalFacade testMasterNodeUpdated() throws Exception {
         LOG.info("****** Testing update master node");
 
         masterMountPointService.registerProvisionListener(masterMountPointListener);
@@ -458,12 +482,11 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
 
         verify(masterMountPointListener, timeout(5000)).onMountPointRemoved(yangNodeInstanceId);
 
-        MasterSalFacade masterSalFacade = masterSalFacadeFuture.get(5, TimeUnit.SECONDS);
-        final ArrayList<String> capabilities = Lists.newArrayList(
-            NetconfMessageTransformUtil.NETCONF_CANDIDATE_URI.toString());
-
-        masterSalFacade.onDeviceConnected(new EmptyMountPointContext(deviceSchemaContext),
-                NetconfSessionPreferences.fromStrings(capabilities), deviceRpcService.getRpcService());
+        final var masterSalFacade = masterSalFacadeFuture.get(5, TimeUnit.SECONDS);
+        masterSalFacade.onDeviceConnected(new NetconfDeviceSchema(NetconfDeviceCapabilities.empty(),
+            new EmptyMountPointContext(deviceSchemaContext)), NetconfSessionPreferences.fromStrings(List.of(
+                    NetconfMessageTransformUtil.NETCONF_CANDIDATE_URI.toString())),
+                new RemoteDeviceServices(deviceRpcService, null));
 
         verify(masterMountPointListener, timeout(5000)).onMountPointCreated(yangNodeInstanceId);
 
@@ -473,8 +496,7 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
         return masterSalFacade;
     }
 
-    private void testMasterDisconnected(final MasterSalFacade masterSalFacade)
-            throws InterruptedException, ExecutionException, TimeoutException {
+    private void testMasterDisconnected(final MasterSalFacade masterSalFacade) throws Exception {
         LOG.info("****** Testing master disconnected");
 
         masterSalFacade.onDeviceDisconnected();
@@ -487,7 +509,7 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
                         NODE_INSTANCE_ID).get(5, TimeUnit.SECONDS);
                 assertTrue(node.isPresent());
                 final NetconfNode netconfNode = node.get().augmentation(NetconfNode.class);
-                return netconfNode.getConnectionStatus() != NetconfNodeConnectionStatus.ConnectionStatus.Connected;
+                return netconfNode.getConnectionStatus() != ConnectionStatus.Connected;
             }
         });
 
@@ -503,11 +525,11 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
 
     private void testDOMRpcService(final DOMRpcService domRpcService)
             throws InterruptedException, ExecutionException, TimeoutException {
-        testPutTopRpc(domRpcService, new DefaultDOMRpcResult((NormalizedNode)null));
+        testPutTopRpc(domRpcService, new DefaultDOMRpcResult((ContainerNode)null));
         testPutTopRpc(domRpcService, null);
         testPutTopRpc(domRpcService, new DefaultDOMRpcResult(ImmutableList.of(
-                RpcResultBuilder.newError(ErrorType.APPLICATION, "tag1", "error1"),
-                RpcResultBuilder.newError(ErrorType.APPLICATION, "tag2", "error2"))));
+                RpcResultBuilder.newError(ErrorType.APPLICATION, new ErrorTag("tag1"), "error1"),
+                RpcResultBuilder.newError(ErrorType.APPLICATION, new ErrorTag("tag2"), "error2"))));
 
         testGetTopRpc(domRpcService, new DefaultDOMRpcResult(bindingToNormalized.toNormalizedNodeRpcData(
                 new GetTopOutputBuilder().setTopLevelList(oneTopLevelList()).build())));
@@ -532,7 +554,7 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
         testRpc(domRpcService, getTopRpcSchemaPath, getTopInput, result);
     }
 
-    private void testRpc(final DOMRpcService domRpcService, final QName qname, final NormalizedNode input,
+    private void testRpc(final DOMRpcService domRpcService, final QName qname, final ContainerNode input,
             final DOMRpcResult result) throws InterruptedException, ExecutionException, TimeoutException {
         final FluentFuture<DOMRpcResult> future = result == null ? FluentFutures.immediateNullFluentFuture()
                 : FluentFutures.immediateFluentFuture(result);
@@ -543,11 +565,11 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
         }
 
         assertNotNull(actual);
-        assertEquals(result.getResult(), actual.getResult());
+        assertEquals(result.value(), actual.value());
 
-        assertEquals(result.getErrors().size(), actual.getErrors().size());
-        Iterator<? extends RpcError> iter1 = result.getErrors().iterator();
-        Iterator<? extends RpcError> iter2 = actual.getErrors().iterator();
+        assertEquals(result.errors().size(), actual.errors().size());
+        Iterator<? extends RpcError> iter1 = result.errors().iterator();
+        Iterator<? extends RpcError> iter2 = actual.errors().iterator();
         while (iter1.hasNext() && iter2.hasNext()) {
             RpcError err1 = iter1.next();
             RpcError err2 = iter2.next();
@@ -560,11 +582,10 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
         }
     }
 
-    private void testFailedRpc(final DOMRpcService domRpcService, final QName qname, final NormalizedNode input)
+    private void testFailedRpc(final DOMRpcService domRpcService, final QName qname, final ContainerNode input)
             throws InterruptedException, TimeoutException {
         try {
-            invokeRpc(domRpcService, qname, input, FluentFutures.immediateFailedFluentFuture(
-                    new ClusteringRpcException("mock")));
+            invokeRpc(domRpcService, qname, input, Futures.immediateFailedFuture(new ClusteringRpcException("mock")));
             fail("Expected exception");
         } catch (ExecutionException e) {
             assertTrue(e.getCause() instanceof ClusteringRpcException);
@@ -572,8 +593,8 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
         }
     }
 
-    private DOMRpcResult invokeRpc(final DOMRpcService domRpcService, final QName qname, final NormalizedNode input,
-            final FluentFuture<DOMRpcResult> returnFuture)
+    private DOMRpcResult invokeRpc(final DOMRpcService domRpcService, final QName qname, final ContainerNode input,
+            final ListenableFuture<DOMRpcResult> returnFuture)
                 throws InterruptedException, ExecutionException, TimeoutException {
         topRpcImplementation.init(returnFuture);
         final ListenableFuture<? extends DOMRpcResult> resultFuture = domRpcService.invokeRpc(qname, input);
@@ -613,32 +634,34 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
         assertTrue(readTx.cancel());
     }
 
-    private static void writeNetconfNode(final String cacheDir, final DataBroker databroker)
-            throws InterruptedException, ExecutionException, TimeoutException {
-        final Node node = new NodeBuilder()
-                .setNodeId(NODE_ID)
-                .addAugmentation(new NetconfNodeBuilder()
-                    .setHost(new Host(new IpAddress(new Ipv4Address("127.0.0.1"))))
-                    .setPort(new PortNumber(Uint16.valueOf(1234)))
-                    .setActorResponseWaitTime(Uint16.valueOf(10))
-                    .setTcpOnly(Boolean.TRUE)
-                    .setSchemaless(Boolean.FALSE)
-                    .setKeepaliveDelay(Uint32.ZERO)
-                    .setConnectionTimeoutMillis(Uint32.valueOf(5000))
-                    .setDefaultRequestTimeoutMillis(Uint32.valueOf(5000))
-                    .setMaxConnectionAttempts(Uint32.ONE)
-                    .setCredentials(new LoginPwUnencryptedBuilder()
-                        .setLoginPasswordUnencrypted(new LoginPasswordUnencryptedBuilder()
-                            .setUsername("user")
-                            .setPassword("pass")
-                            .build())
+    private static void writeNetconfNode(final String cacheDir, final DataBroker dataBroker) throws Exception {
+        putData(dataBroker, NODE_INSTANCE_ID, new NodeBuilder()
+            .withKey(NODE_INSTANCE_ID.getKey())
+            .addAugmentation(new NetconfNodeBuilder()
+                .setHost(new Host(new IpAddress(new Ipv4Address("127.0.0.1"))))
+                .setPort(new PortNumber(Uint16.valueOf(1234)))
+                .setActorResponseWaitTime(Uint16.valueOf(10))
+                .setTcpOnly(Boolean.TRUE)
+                .setSchemaless(Boolean.FALSE)
+                .setKeepaliveDelay(Uint32.ZERO)
+                .setConnectionTimeoutMillis(Uint32.valueOf(5000))
+                .setDefaultRequestTimeoutMillis(Uint32.valueOf(5000))
+                .setMaxConnectionAttempts(Uint32.ONE)
+                .setCredentials(new LoginPwUnencryptedBuilder()
+                    .setLoginPasswordUnencrypted(new LoginPasswordUnencryptedBuilder()
+                        .setUsername("user")
+                        .setPassword("pass")
                         .build())
-                    .setSchemaCacheDirectory(cacheDir)
                     .build())
-                .build();
+                .setSchemaCacheDirectory(cacheDir)
+                .build())
+            .build());
+    }
 
-        final WriteTransaction writeTx = databroker.newWriteOnlyTransaction();
-        writeTx.put(LogicalDatastoreType.CONFIGURATION, NODE_INSTANCE_ID, node);
+    private static <T extends DataObject> void putData(final DataBroker databroker, final InstanceIdentifier<T> path,
+            final T data) throws Exception {
+        final var writeTx = databroker.newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, path, data);
         writeTx.commit().get(5, TimeUnit.SECONDS);
     }
 
@@ -656,28 +679,27 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
     private static void verifyTopologyNodesCreated(final DataBroker dataBroker) {
         await().atMost(5, TimeUnit.SECONDS).until(() -> {
             try (ReadTransaction readTx = dataBroker.newReadOnlyTransaction()) {
-                Optional<Topology> configTopology = readTx.read(LogicalDatastoreType.CONFIGURATION,
-                        NetconfTopologyUtils.createTopologyListPath(TOPOLOGY_ID)).get(3, TimeUnit.SECONDS);
-                Optional<Topology> operTopology = readTx.read(LogicalDatastoreType.OPERATIONAL,
-                        NetconfTopologyUtils.createTopologyListPath(TOPOLOGY_ID)).get(3, TimeUnit.SECONDS);
-                return configTopology.isPresent() && operTopology.isPresent();
+                return readTx.exists(LogicalDatastoreType.OPERATIONAL,
+                    NetconfTopologyUtils.createTopologyListPath(TOPOLOGY_ID)).get(3, TimeUnit.SECONDS);
             }
         });
     }
 
     private AbstractConcurrentDataBrokerTest newDataBrokerTest() throws Exception {
-        AbstractConcurrentDataBrokerTest dataBrokerTest = new AbstractConcurrentDataBrokerTest(true) {
+        final var dataBrokerTest = new AbstractConcurrentDataBrokerTest(true) {
             @Override
-            protected Set<YangModuleInfo> getModuleInfos() throws Exception {
-                return ImmutableSet.of(BindingReflections.getModuleInfo(NetconfNode.class),
+            protected Set<YangModuleInfo> getModuleInfos() {
+                return Set.of(BindingReflections.getModuleInfo(NetconfNode.class),
                         BindingReflections.getModuleInfo(NetworkTopology.class),
-                        BindingReflections.getModuleInfo(Topology.class),
                         BindingReflections.getModuleInfo(Keystore.class),
                         topModuleInfo);
             }
         };
 
         dataBrokerTest.setup();
+
+        final var path = NetconfTopologyUtils.createTopologyListPath(TOPOLOGY_ID);
+        putData(dataBrokerTest.getDataBroker(), path, new TopologyBuilder().withKey(path.getKey()).build());
         return dataBrokerTest;
     }
 
@@ -700,16 +722,14 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
 
     private static <T extends DOMService> T getMountPointService(final DOMMountPoint mountPoint,
             final Class<T> serviceClass) {
-        final Optional<T> maybeService = mountPoint.getService(serviceClass);
-        assertTrue(maybeService.isPresent());
-        return maybeService.get();
+        return mountPoint.getService(serviceClass).orElseThrow();
     }
 
     private DOMMountPoint awaitMountPoint(final DOMMountPointService mountPointService) {
         await().atMost(5, TimeUnit.SECONDS).until(() ->
                 mountPointService.getMountPoint(yangNodeInstanceId).isPresent());
 
-        return mountPointService.getMountPoint(yangNodeInstanceId).get();
+        return mountPointService.getMountPoint(yangNodeInstanceId).orElseThrow();
     }
 
     private RpcDefinition findRpcDefinition(final String rpc) {
@@ -728,16 +748,16 @@ public class MountPointEndToEndTest extends AbstractBaseSchemasTest {
 
     private static class TopDOMRpcImplementation implements DOMRpcImplementation {
         private volatile SettableFuture<Entry<DOMRpcIdentifier, NormalizedNode>> rpcInvokedFuture;
-        private volatile FluentFuture<DOMRpcResult> returnFuture;
+        private volatile ListenableFuture<DOMRpcResult> returnFuture;
 
         @Override
-        public FluentFuture<DOMRpcResult> invokeRpc(final DOMRpcIdentifier rpc, final NormalizedNode input) {
-            rpcInvokedFuture.set(new SimpleEntry<>(rpc, input));
+        public ListenableFuture<DOMRpcResult> invokeRpc(final DOMRpcIdentifier rpc, final ContainerNode input) {
+            rpcInvokedFuture.set(Map.entry(rpc, input));
             return returnFuture;
         }
 
-        void init(final FluentFuture<DOMRpcResult> retFuture) {
-            this.returnFuture = retFuture;
+        void init(final ListenableFuture<DOMRpcResult> retFuture) {
+            returnFuture = retFuture;
             rpcInvokedFuture = SettableFuture.create();
         }