Add import for netconf-node-optional
[netconf.git] / netconf / netconf-console / src / test / java / org / opendaylight / netconf / console / impl / NetconfCommandsImplTest.java
index 96c5b271e1962ff0dac318acd039f9cb20408fa6..03f7331720a5984ac21b536e2ed6f6c1fa0307cb 100644 (file)
@@ -5,7 +5,6 @@
  * 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.netconf.console.impl;
 
 import static junit.framework.TestCase.assertFalse;
@@ -13,34 +12,27 @@ import static junit.framework.TestCase.assertNull;
 import static junit.framework.TestCase.assertTrue;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.mock;
 
 import com.google.common.collect.ImmutableList;
-import java.io.InputStream;
+import com.google.common.collect.ImmutableMap;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumMap;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
-import java.util.concurrent.ExecutorService;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import javassist.ClassPool;
+import org.awaitility.Awaitility;
+import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
-import org.opendaylight.controller.cluster.databroker.ConcurrentDOMDataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.MountPointService;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter;
-import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreFactory;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.controller.sal.core.spi.data.DOMStore;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.binding.dom.adapter.test.ConcurrentDataBrokerTestCustomizer;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.netconf.console.utils.NetconfConsoleConstants;
 import org.opendaylight.netconf.console.utils.NetconfConsoleUtils;
 import org.opendaylight.netconf.console.utils.NetconfIidFactory;
@@ -52,6 +44,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev15
 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.connection.status.AvailableCapabilities;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.AvailableCapabilitiesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapability;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapabilityBuilder;
 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.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
@@ -61,21 +55,9 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 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.binding.data.codec.gen.impl.DataObjectSerializerGenerator;
-import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
-import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
-import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
-import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils;
-import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class NetconfCommandsImplTest {
 
@@ -86,114 +68,113 @@ public class NetconfCommandsImplTest {
             NetconfNodeConnectionStatus.ConnectionStatus.Connected;
     private static final String CAP_PREFIX = "prefix";
 
+    private static EffectiveModelContext SCHEMA_CONTEXT;
+
     private DataBroker dataBroker;
-    private SchemaContext schemaContext;
     private NetconfCommandsImpl netconfCommands;
 
-    @Before
-    public void setUp() throws TransactionCommitFailedException, TimeoutException, InterruptedException {
-        schemaContext = parseYangStreams(getYangSchemas());
-        schemaContext.getModules();
-        final SchemaService schemaService = createSchemaService();
-
-        final DOMStore operStore = InMemoryDOMDataStoreFactory.create("DOM-OPER", schemaService);
-        final DOMStore configStore = InMemoryDOMDataStoreFactory.create("DOM-CFG", schemaService);
-
-        final EnumMap<LogicalDatastoreType, DOMStore> datastores = new EnumMap<>(LogicalDatastoreType.class);
-        datastores.put(LogicalDatastoreType.CONFIGURATION, configStore);
-        datastores.put(LogicalDatastoreType.OPERATIONAL, operStore);
-
-        final ExecutorService listenableFutureExecutor = SpecialExecutors.newBlockingBoundedCachedThreadPool(
-                16, 16, "CommitFutures");
-
-        final ConcurrentDOMDataBroker cDOMDataBroker = new ConcurrentDOMDataBroker(datastores, listenableFutureExecutor);
+    @BeforeClass
+    public static void beforeClass() {
+        SCHEMA_CONTEXT = YangParserTestUtils.parseYangResources(NetconfCommandsImplTest.class,
+            "/schemas/network-topology@2013-10-21.yang", "/schemas/ietf-inet-types@2013-07-15.yang",
+            "/schemas/yang-ext.yang", "/schemas/netconf-node-topology.yang", "/schemas/netconf-node-optional.yang");
+    }
 
-        final ClassPool pool = ClassPool.getDefault();
-        final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(pool));
-        final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(generator);
-        final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
-        codecRegistry.onBindingRuntimeContextUpdated(BindingRuntimeContext.create(moduleInfoBackedContext, schemaContext));
+    @AfterClass
+    public static void afterClass() {
+        SCHEMA_CONTEXT = null;
+    }
 
-        final GeneratedClassLoadingStrategy loading = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
-        final BindingToNormalizedNodeCodec bindingToNormalized = new BindingToNormalizedNodeCodec(loading, codecRegistry);
-        bindingToNormalized.onGlobalContextUpdated(schemaContext);
-        dataBroker = new BindingDOMDataBrokerAdapter(cDOMDataBroker, bindingToNormalized);
+    @Before
+    public void setUp() throws Exception {
+        ConcurrentDataBrokerTestCustomizer customizer = new ConcurrentDataBrokerTestCustomizer(true);
+        dataBroker = customizer.createDataBroker();
+        customizer.updateSchema(SCHEMA_CONTEXT);
 
-        final MountPointService mountPointService = mock(MountPointService.class);
-        netconfCommands = new NetconfCommandsImpl(dataBroker, mountPointService);
+        netconfCommands = new NetconfCommandsImpl(dataBroker);
     }
 
     @Test
-    public void testListDevice() throws TimeoutException, TransactionCommitFailedException {
+    public void testListDevice() throws TimeoutException, InterruptedException, ExecutionException {
         createTopology(LogicalDatastoreType.OPERATIONAL);
 
-        final Map map = netconfCommands.listDevices();
+        final Map<?, ?> map = netconfCommands.listDevices();
         map.containsKey(NetconfConsoleConstants.NETCONF_ID);
         assertTrue(map.containsKey(NODE_ID));
 
-        final Map mapNode = (Map) map.get(NODE_ID);
+        final Map<?, ?> mapNode = (Map<?, ?>) map.get(NODE_ID);
         assertBaseNodeAttributes(mapNode);
     }
 
     @Test
-    public void testShowDevice() throws TimeoutException, TransactionCommitFailedException {
+    public void testShowDevice() throws TimeoutException, InterruptedException, ExecutionException {
         createTopology(LogicalDatastoreType.OPERATIONAL);
 
-        final Map mapCorrect = netconfCommands.showDevice(IP, String.valueOf(PORT));
+        final Map<?, ?> mapCorrect = netconfCommands.showDevice(IP, String.valueOf(PORT));
         mapCorrect.containsKey(NetconfConsoleConstants.NETCONF_ID);
         assertTrue(mapCorrect.containsKey(NODE_ID));
 
-        assertBaseNodeAttributesImmutableList((Map) mapCorrect.get(NODE_ID));
+        assertBaseNodeAttributesImmutableList((Map<?, ?>) mapCorrect.get(NODE_ID));
 
-        final Map mapWrongPort = netconfCommands.showDevice(IP, "1");
+        final Map<?, ?> mapWrongPort = netconfCommands.showDevice(IP, "1");
         assertFalse(mapWrongPort.containsKey(NODE_ID));
 
-        final Map mapWrongIP = netconfCommands.showDevice("1.1.1.1", String.valueOf(PORT));
+        final Map<?, ?> mapWrongIP = netconfCommands.showDevice("1.1.1.1", String.valueOf(PORT));
         assertFalse(mapWrongIP.containsKey(NODE_ID));
 
-        final Map mapId = netconfCommands.showDevice(NODE_ID);
+        final Map<?, ?> mapId = netconfCommands.showDevice(NODE_ID);
         assertTrue(mapId.containsKey(NODE_ID));
-        assertBaseNodeAttributesImmutableList((Map) mapId.get(NODE_ID));
+        assertBaseNodeAttributesImmutableList((Map<?, ?>) mapId.get(NODE_ID));
     }
 
     @Test
-    public void testConnectDisconnectDevice() throws InterruptedException, TimeoutException, TransactionCommitFailedException {
-        final NetconfNode netconfNode = new NetconfNodeBuilder().setPort(new PortNumber(7777)).
-                setHost(HostBuilder.getDefaultInstance("10.10.1.1")).build();
+    public void testConnectDisconnectDevice() throws InterruptedException, TimeoutException, ExecutionException {
+        final NetconfNode netconfNode = new NetconfNodeBuilder()
+                .setPort(new PortNumber(Uint16.valueOf(7777))).setHost(HostBuilder.getDefaultInstance("10.10.1.1"))
+                .build();
 
         createTopology(LogicalDatastoreType.CONFIGURATION);
         netconfCommands.connectDevice(netconfNode, "netconf-ID");
-        NetconfConsoleUtils.waitForUpdate("10.10.1.1");
 
-        final Topology topology = NetconfConsoleUtils.read(LogicalDatastoreType.CONFIGURATION,
-                NetconfIidFactory.NETCONF_TOPOLOGY_IID, dataBroker);
-        final List<Node> nodes = topology.getNode();
-        assertEquals(2, nodes.size());
+        Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> {
+            final Topology topology = NetconfConsoleUtils.read(LogicalDatastoreType.CONFIGURATION,
+                    NetconfIidFactory.NETCONF_TOPOLOGY_IID, dataBroker);
+            final Collection<Node> nodes = topology.nonnullNode().values();
+            if (nodes.size() != 2) {
+                return false;
+            }
 
-        final Optional<Node> storedNode = nodes.stream().filter(node ->
-                node.getKey().getNodeId().getValue().equals("netconf-ID")).findFirst();
+            final Optional<Node> storedNode = nodes.stream().filter(node ->
+                    node.key().getNodeId().getValue().equals("netconf-ID")).findFirst();
 
-        assertTrue(storedNode.isPresent());
+            assertTrue(storedNode.isPresent());
 
-        NetconfNode storedNetconfNode = storedNode.get().getAugmentation(NetconfNode.class);
-        assertEquals(7777, storedNetconfNode.getPort().getValue().longValue());
-        assertEquals("10.10.1.1", storedNetconfNode.getHost().getIpAddress().getIpv4Address().getValue());
+            NetconfNode storedNetconfNode = storedNode.get().augmentation(NetconfNode.class);
+            assertEquals(7777, storedNetconfNode.getPort().getValue().longValue());
+            assertEquals("10.10.1.1", storedNetconfNode.getHost().getIpAddress().getIpv4Address().getValue());
+            return true;
+        });
 
         netconfCommands.disconnectDevice("netconf-ID");
 
-        final Topology topologyDeleted = NetconfConsoleUtils.read(LogicalDatastoreType.CONFIGURATION,
-                NetconfIidFactory.NETCONF_TOPOLOGY_IID, dataBroker);
-        final List<Node> nodesDeleted = topologyDeleted.getNode();
-        assertEquals(1, nodesDeleted.size());
+        Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> {
+            final Topology topologyDeleted = NetconfConsoleUtils.read(LogicalDatastoreType.CONFIGURATION,
+                    NetconfIidFactory.NETCONF_TOPOLOGY_IID, dataBroker);
+            final Collection<Node> nodesDeleted = topologyDeleted.nonnullNode().values();
+            if (nodesDeleted.size() != 1) {
+                return false;
+            }
 
-        final Optional<Node> storedNodeDeleted = nodesDeleted.stream().filter(node ->
-                node.getKey().getNodeId().getValue().equals("netconf-ID")).findFirst();
+            final Optional<Node> storedNodeDeleted = nodesDeleted.stream().filter(node ->
+                    node.key().getNodeId().getValue().equals("netconf-ID")).findFirst();
 
-        assertFalse(storedNodeDeleted.isPresent());
+            assertFalse(storedNodeDeleted.isPresent());
+            return true;
+        });
     }
 
     @Test
-    public void testUpdateDevice() throws TimeoutException, TransactionCommitFailedException {
+    public void testUpdateDevice() throws TimeoutException, InterruptedException, ExecutionException {
         //We need both, read data from OPERATIONAL DS and update data in CONFIGURATIONAL DS
         createTopology(LogicalDatastoreType.OPERATIONAL);
         createTopology(LogicalDatastoreType.CONFIGURATION);
@@ -201,25 +182,30 @@ public class NetconfCommandsImplTest {
         final Map<String, String> update = new HashMap<>();
         update.put(NetconfConsoleConstants.NETCONF_IP, "7.7.7.7");
         update.put(NetconfConsoleConstants.TCP_ONLY, "true");
+        update.put(NetconfConsoleConstants.SCHEMALESS, "true");
 
         netconfCommands.updateDevice(NODE_ID, "admin", "admin", update);
-        NetconfConsoleUtils.waitForUpdate("7.7.7.7");
 
-        final Topology topology = NetconfConsoleUtils.read(LogicalDatastoreType.CONFIGURATION,
-                NetconfIidFactory.NETCONF_TOPOLOGY_IID, dataBroker);
-        final List<Node> nodes = topology.getNode();
-        assertEquals(1, nodes.size());
+        Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> {
+            final Topology topology = NetconfConsoleUtils.read(LogicalDatastoreType.CONFIGURATION,
+                    NetconfIidFactory.NETCONF_TOPOLOGY_IID, dataBroker);
+            final Collection<Node> nodes = topology.nonnullNode().values();
+            if (nodes.size() != 1) {
+                return false;
+            }
 
-        final Optional<Node> storedNode = nodes.stream().filter(node ->
-                node.getKey().getNodeId().getValue().equals(NODE_ID)).findFirst();
-        assertTrue(storedNode.isPresent());
+            final Optional<Node> storedNode = nodes.stream().filter(node ->
+                    node.key().getNodeId().getValue().equals(NODE_ID)).findFirst();
+            assertTrue(storedNode.isPresent());
 
-        NetconfNode storedNetconfNode = storedNode.get().getAugmentation(NetconfNode.class);
-        assertEquals("7.7.7.7", storedNetconfNode.getHost().getIpAddress().getIpv4Address().getValue());
+            NetconfNode storedNetconfNode = storedNode.get().augmentation(NetconfNode.class);
+            assertEquals("7.7.7.7", storedNetconfNode.getHost().getIpAddress().getIpv4Address().getValue());
+            return true;
+        });
     }
 
     @Test
-    public void testNetconfNodeFromIp() throws TimeoutException, TransactionCommitFailedException {
+    public void testNetconfNodeFromIp() throws TimeoutException, InterruptedException, ExecutionException {
         final List<Node> nodesNotExist = NetconfConsoleUtils.getNetconfNodeFromIp(IP, dataBroker);
         assertNull(nodesNotExist);
         createTopology(LogicalDatastoreType.OPERATIONAL);
@@ -228,43 +214,44 @@ public class NetconfCommandsImplTest {
         assertEquals(1, nodes.size());
     }
 
-    private void createTopology(LogicalDatastoreType dataStoreType) throws TransactionCommitFailedException, TimeoutException {
-        final List<Node> nodes = new ArrayList<>();
+    private void createTopology(final LogicalDatastoreType dataStoreType)
+            throws TimeoutException, InterruptedException, ExecutionException {
         final Node node = getNetconfNode(NODE_ID, IP, PORT, CONN_STATUS, CAP_PREFIX);
-        nodes.add(node);
 
-        final Topology topology = new TopologyBuilder().
-                setKey(new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName()))).
-                setTopologyId(new TopologyId(TopologyNetconf.QNAME.getLocalName())).setNode(nodes).build();
+        final Topology topology = new TopologyBuilder()
+                .withKey(new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName())))
+                .setTopologyId(new TopologyId(TopologyNetconf.QNAME.getLocalName()))
+                .setNode(ImmutableMap.of(node.key(), node)).build();
 
         final WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
         writeTransaction.put(dataStoreType, NetconfIidFactory.NETCONF_TOPOLOGY_IID, topology);
-        writeTransaction.submit().checkedGet(2, TimeUnit.SECONDS);
+        writeTransaction.commit().get(2, TimeUnit.SECONDS);
     }
 
-    private Node getNetconfNode(String nodeIdent, String ip, int portNumber, NetconfNodeConnectionStatus.ConnectionStatus cs,
-                                String notificationCapabilityPrefix) {
+    private static Node getNetconfNode(final String nodeIdent, final String ip, final int portNumber,
+            final NetconfNodeConnectionStatus.ConnectionStatus cs, final String notificationCapabilityPrefix) {
 
         final Host host = HostBuilder.getDefaultInstance(ip);
-        final PortNumber port = new PortNumber(portNumber);
+        final PortNumber port = new PortNumber(Uint16.valueOf(portNumber));
 
-        final List<String> avCapList = new ArrayList<>();
-        avCapList.add(notificationCapabilityPrefix + "_availableCapabilityString1");
-        final AvailableCapabilities avCaps = new AvailableCapabilitiesBuilder().setAvailableCapability(avCapList).build();
+        final List<AvailableCapability> avCapList = new ArrayList<>();
+        avCapList.add(new AvailableCapabilityBuilder()
+                .setCapabilityOrigin(AvailableCapability.CapabilityOrigin.UserDefined)
+                .setCapability(notificationCapabilityPrefix + "_availableCapabilityString1").build());
+        final AvailableCapabilities avCaps =
+                new AvailableCapabilitiesBuilder().setAvailableCapability(avCapList).build();
 
-        final NetconfNode nn = new NetconfNodeBuilder().setConnectionStatus(cs).setHost(host).setPort(port).
-                setAvailableCapabilities(avCaps).build();
         final NodeId nodeId = new NodeId(nodeIdent);
         final NodeKey nk = new NodeKey(nodeId);
-        final NodeBuilder nb = new NodeBuilder();
-        nb.setKey(nk);
-        nb.setNodeId(nodeId);
-        nb.addAugmentation(NetconfNode.class, nn);
-        return nb.build();
+        return new NodeBuilder()
+                .withKey(nk)
+                .setNodeId(nodeId)
+                .addAugmentation(new NetconfNodeBuilder()
+                    .setConnectionStatus(cs).setHost(host).setPort(port).setAvailableCapabilities(avCaps).build())
+                .build();
     }
 
-    private void assertBaseNodeAttributes(Map mapNode) {
-
+    private static void assertBaseNodeAttributes(final Map<?, ?> mapNode) {
         assertTrue(mapNode.containsKey(NetconfConsoleConstants.NETCONF_ID));
         assertTrue(mapNode.containsKey(NetconfConsoleConstants.NETCONF_IP));
         assertTrue(mapNode.containsKey(NetconfConsoleConstants.NETCONF_PORT));
@@ -276,7 +263,7 @@ public class NetconfCommandsImplTest {
         assertEquals(CONN_STATUS.name().toLowerCase(), mapNode.get(NetconfConsoleConstants.STATUS));
     }
 
-    private void assertBaseNodeAttributesImmutableList(Map mapNode) {
+    private static void assertBaseNodeAttributesImmutableList(final Map<?, ?> mapNode) {
         assertTrue(mapNode.containsKey(NetconfConsoleConstants.NETCONF_ID));
         assertTrue(mapNode.containsKey(NetconfConsoleConstants.NETCONF_IP));
         assertTrue(mapNode.containsKey(NetconfConsoleConstants.NETCONF_PORT));
@@ -287,67 +274,4 @@ public class NetconfCommandsImplTest {
         assertEquals(ImmutableList.of(String.valueOf(PORT)), mapNode.get(NetconfConsoleConstants.NETCONF_PORT));
         assertEquals(ImmutableList.of(CONN_STATUS.name()), mapNode.get(NetconfConsoleConstants.STATUS));
     }
-
-    private List<InputStream> getYangSchemas() {
-        final List<String> schemaPaths = Arrays.asList("/schemas/network-topology@2013-10-21.yang",
-                "/schemas/ietf-inet-types@2013-07-15.yang", "/schemas/yang-ext.yang", "/schemas/netconf-node-topology.yang");
-        final List<InputStream> schemas = new ArrayList<>();
-        for (String schemaPath : schemaPaths) {
-            final InputStream resourceAsStream = getClass().getResourceAsStream(schemaPath);
-            schemas.add(resourceAsStream);
-        }
-        return schemas;
-    }
-
-    private static SchemaContext parseYangStreams(final List<InputStream> streams) {
-        CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR
-                .newBuild();
-        final SchemaContext schemaContext;
-        try {
-            schemaContext = reactor.buildEffective(streams);
-        } catch (ReactorException e) {
-            throw new RuntimeException("Unable to build schema context from " + streams, e);
-        }
-        return schemaContext;
-    }
-
-    private SchemaService createSchemaService() {
-        return new SchemaService() {
-
-            @Override
-            public void addModule(Module module) {
-            }
-
-            @Override
-            public void removeModule(Module module) {
-
-            }
-
-            @Override
-            public SchemaContext getSessionContext() {
-                return schemaContext;
-            }
-
-            @Override
-            public SchemaContext getGlobalContext() {
-                return schemaContext;
-            }
-
-            @Override
-            public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(final SchemaContextListener listener) {
-                listener.onGlobalContextUpdated(getGlobalContext());
-                return new ListenerRegistration<SchemaContextListener>() {
-                    @Override
-                    public void close() {
-
-                    }
-
-                    @Override
-                    public SchemaContextListener getInstance() {
-                        return listener;
-                    }
-                };
-            }
-        };
-    }
 }