Bug 8725: Remove netconf device mounting via the config system 69/59669/3
authorTom Pantelis <tompantelis@gmail.com>
Thu, 29 Jun 2017 11:48:52 +0000 (07:48 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Wed, 5 Jul 2017 18:25:23 +0000 (18:25 +0000)
Change-Id: Ida7a236f0bd75978e07a64b38497ccf8aa75fea8
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
netconf/netconf-client/pom.xml
netconf/netconf-client/src/main/yang/odl-netconf-cfg.yang [deleted file]
netconf/netconf-topology-singleton/pom.xml
netconf/sal-netconf-connector/pom.xml
netconf/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java [deleted file]
netconf/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModuleFactory.java [deleted file]
netconf/sal-netconf-connector/src/main/yang/odl-sal-netconf-connector-cfg.yang [deleted file]
netconf/sal-netconf-connector/src/test/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModuleTest.java [deleted file]

index 072eeac5b638c931e279caa9a31ad3ba467fd137..7de7fbf6de2f7ff7bd50c2eec83ed9501dcb5f41 100644 (file)
@@ -10,9 +10,9 @@
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.controller</groupId>
-    <artifactId>config-parent</artifactId>
-    <version>0.7.0-SNAPSHOT</version>
+    <groupId>org.opendaylight.odlparent</groupId>
+    <artifactId>bundle-parent</artifactId>
+    <version>2.0.0</version>
     <relativePath/>
   </parent>
 
diff --git a/netconf/netconf-client/src/main/yang/odl-netconf-cfg.yang b/netconf/netconf-client/src/main/yang/odl-netconf-cfg.yang
deleted file mode 100644 (file)
index 21e6242..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// vi: set smarttab et sw=4 tabstop=4:
-module odl-netconf-cfg {
-
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:netconf";
-    prefix "cfg-net";
-
-    import config { prefix config; revision-date 2013-04-05; }
-
-    description
-        "This module contains the base YANG definitions for
-        netconf related services.
-
-        Copyright (c)2013 Cisco Systems, Inc. All rights reserved.;
-
-        This program and the accompanying materials are made available
-        under the terms of the Eclipse Public License v1.0 which
-        accompanies this distribution, and is available at
-        http://www.eclipse.org/legal/epl-v10.html";
-
-    revision "2014-04-08" {
-        description
-            "Initial revision.";
-    }
-
-    // We keep this as sal-netconf-connector and netconf-topology need it.
-    // Once they will be moved to blueprint, it will be safe to delete all
-    // together the netconf-config-dispatcher bundle.
-    identity netconf-client-dispatcher {
-        base "config:service-type";
-        config:java-class "org.opendaylight.netconf.client.NetconfClientDispatcher";
-        config:disable-osgi-service-registration;
-        status deprecated;
-    }
-}
\ No newline at end of file
index d0397d8463f2bff4e5b7b3c81a07104565a80648..4014443859b3a697654ad6848ae593cf44fd0dcf 100644 (file)
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal-clustering-commons</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>threadpool-config-api</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>mdsal-singleton-common-api</artifactId>
index fb52fbb0c2c87b800c6d80fa1717a9659fd378e9..87e88e669fbf8561ea20da83eee33b0cef8f51ff 100644 (file)
@@ -9,9 +9,9 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
-    <groupId>org.opendaylight.controller</groupId>
-    <artifactId>config-parent</artifactId>
-    <version>0.7.0-SNAPSHOT</version>
+    <groupId>org.opendaylight.mdsal</groupId>
+    <artifactId>binding-parent</artifactId>
+    <version>0.11.0-SNAPSHOT</version>
     <relativePath/>
   </parent>
 
 
   <dependencyManagement>
     <dependencies>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>mdsal-artifacts</artifactId>
+        <version>1.6.0-SNAPSHOT</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
       <dependency>
         <groupId>org.opendaylight.netconf</groupId>
         <artifactId>netconf-artifacts</artifactId>
       <groupId>${project.groupId}</groupId>
       <artifactId>netconf-notifications-api</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>netty-config-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>netty-threadgroup-config</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-binding-api</artifactId>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-binding-config</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>threadpool-config-api</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller.model</groupId>
       <artifactId>model-inventory</artifactId>
       <groupId>xmlunit</groupId>
       <artifactId>xmlunit</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>config-api</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>config-manager</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>config-manager</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>config-netconf-connector</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>config-persister-impl</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>config-util</artifactId>
-    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>netconf-impl</artifactId>
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>yang-test</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>logback-config</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-binding-broker-impl</artifactId>
diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java
deleted file mode 100644 (file)
index 34f2cbe..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * 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.config.yang.md.sal.connector.netconf;
-
-import static org.opendaylight.controller.config.api.JmxAttributeValidationException.checkCondition;
-import static org.opendaylight.controller.config.api.JmxAttributeValidationException.checkNotNull;
-
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import javax.annotation.Nullable;
-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.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host;
-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.netconf.node.connection.parameters.NonModuleCapabilities;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.parameters.NonModuleCapabilitiesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.parameters.YangModuleCapabilities;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.parameters.YangModuleCapabilitiesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.Credentials;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPasswordBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.schema.storage.YangLibrary;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.schema.storage.YangLibraryBuilder;
-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.TopologyId;
-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.TopologyKey;
-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.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Instead of using loopback (controller-config mount point) to create your netconf-connector,
- * you should use the network-topology capability.
- *
- * <p>
- * Follow instructions provided in this
- * <a href="https://wiki.opendaylight.org/view/OpenDaylight_Controller:Config:Examples:Netconf#Spawning_netconf_connectors_via_topology_configuration">wiki</a>.
- *
- * <p>
- * Deprecation notice in Carbon, removal planned for Nitrogen.
- */
-@Deprecated
-public final class NetconfConnectorModule
-        extends org.opendaylight.controller.config.yang.md.sal.connector.netconf.AbstractNetconfConnectorModule
-        implements BindingAwareConsumer {
-    private static final Logger LOG = LoggerFactory.getLogger(NetconfConnectorModule.class);
-
-    private static final InstanceIdentifier<Topology> TOPOLOGY_PATH = InstanceIdentifier.create(NetworkTopology.class)
-            .child(Topology.class, new TopologyKey(new TopologyId("topology-netconf")));
-    private final String instanceName;
-    private InstanceIdentifier<Node> nodePath;
-    private DataBroker dataBroker;
-
-    public NetconfConnectorModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-                                  final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-        instanceName = identifier.getInstanceName();
-    }
-
-    public NetconfConnectorModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
-                                  final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
-                                  final NetconfConnectorModule oldModule, final java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-        instanceName = identifier.getInstanceName();
-    }
-
-    @Override
-    protected void customValidation() {
-        checkNotNull(getAddress(), addressJmxAttribute);
-        checkCondition(isHostAddressPresent(getAddress()), "Host address not present in " + getAddress(),
-                addressJmxAttribute);
-        checkNotNull(getPort(), portJmxAttribute);
-
-        checkNotNull(getConnectionTimeoutMillis(), connectionTimeoutMillisJmxAttribute);
-        checkCondition(getConnectionTimeoutMillis() > 0, "must be > 0", connectionTimeoutMillisJmxAttribute);
-
-        checkNotNull(getDefaultRequestTimeoutMillis(), defaultRequestTimeoutMillisJmxAttribute);
-        checkCondition(getDefaultRequestTimeoutMillis() > 0, "must be > 0", defaultRequestTimeoutMillisJmxAttribute);
-
-        checkNotNull(getBetweenAttemptsTimeoutMillis(), betweenAttemptsTimeoutMillisJmxAttribute);
-        checkCondition(getBetweenAttemptsTimeoutMillis() > 0, "must be > 0", betweenAttemptsTimeoutMillisJmxAttribute);
-
-        // Check username + password in case of ssh
-        if (!getTcpOnly()) {
-            checkNotNull(getUsername(), usernameJmxAttribute);
-            checkNotNull(getPassword(), passwordJmxAttribute);
-        }
-    }
-
-    private static boolean isHostAddressPresent(final Host address) {
-        return address.getDomainName() != null || address.getIpAddress() != null
-                && (address.getIpAddress().getIpv4Address() != null || address.getIpAddress().getIpv6Address() != null);
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        getBindingRegistryDependency().registerConsumer(this);
-        return this::deleteNode;
-    }
-
-    @Override
-    public void onSessionInitialized(final BindingAwareBroker.ConsumerContext session) {
-        dataBroker = session.getSALService(DataBroker.class);
-        final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
-        final NodeId nodeId = new NodeId(instanceName);
-        final NodeKey nodeKey = new NodeKey(nodeId);
-        final Node node = createNetconfNode(nodeId, nodeKey);
-        nodePath = TOPOLOGY_PATH.child(Node.class, nodeKey);
-        transaction.put(LogicalDatastoreType.CONFIGURATION, nodePath, node);
-        final CheckedFuture<Void, TransactionCommitFailedException> submitFuture = transaction.submit();
-        Futures.addCallback(submitFuture, new FutureCallback<Void>() {
-            @Override
-            public void onSuccess(@Nullable final Void result) {
-                LOG.debug("Node {} was successfully added to the topology", instanceName);
-            }
-
-            @Override
-            public void onFailure(final Throwable throwable) {
-                LOG.error("Node {} creation failed: {}", instanceName, throwable);
-            }
-        });
-    }
-
-    private void deleteNode() {
-        if (dataBroker != null) {
-            final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
-            transaction.delete(LogicalDatastoreType.CONFIGURATION, nodePath);
-            final CheckedFuture<Void, TransactionCommitFailedException> submitFuture = transaction.submit();
-            Futures.addCallback(submitFuture, new FutureCallback<Void>() {
-                @Override
-                public void onSuccess(@Nullable final Void result) {
-                    LOG.debug("Node {} was successfully deleted from the topology", instanceName);
-                }
-
-                @Override
-                public void onFailure(final Throwable throwable) {
-                    LOG.error("Node {} deletion failed: {}", instanceName, throwable);
-                }
-            });
-
-        }
-    }
-
-    private Node createNetconfNode(final NodeId nodeId, final NodeKey nodeKey) {
-        final Credentials credentials = new LoginPasswordBuilder()
-                .setUsername(getUsername())
-                .setPassword(getPassword())
-                .build();
-
-        YangModuleCapabilities moduleCapabilities = null;
-        if (getYangModuleCapabilities() != null) {
-            moduleCapabilities = new YangModuleCapabilitiesBuilder()
-                    .setOverride(getYangModuleCapabilities().getOverride())
-                    .setCapability(getYangModuleCapabilities().getCapability())
-                    .build();
-        }
-
-        NonModuleCapabilities nonModuleCapabilities = null;
-        if (getNonModuleCapabilities() != null) {
-            nonModuleCapabilities = new NonModuleCapabilitiesBuilder()
-                    .setOverride(getNonModuleCapabilities().getOverride())
-                    .setCapability(getNonModuleCapabilities().getCapability())
-                    .build();
-        }
-
-        final YangLibrary yangLibrary;
-        if (getYangLibrary() != null) {
-            yangLibrary = new YangLibraryBuilder()
-                    .setYangLibraryUrl(getYangLibrary().getYangLibraryUrl())
-                    .setUsername(getYangLibrary().getUsername())
-                    .setPassword(getYangLibrary().getPassword())
-                    .build();
-        } else {
-            yangLibrary = null;
-        }
-        final NetconfNode netconfNode = new NetconfNodeBuilder()
-                .setHost(getAddress())
-                .setPort(getPort())
-                .setCredentials(credentials)
-                .setConnectionTimeoutMillis(getConnectionTimeoutMillis())
-                .setDefaultRequestTimeoutMillis(getDefaultRequestTimeoutMillis())
-                .setBetweenAttemptsTimeoutMillis(getBetweenAttemptsTimeoutMillis())
-                .setConcurrentRpcLimit(getConcurrentRpcLimit())
-                .setKeepaliveDelay(getKeepaliveDelay())
-                .setMaxConnectionAttempts(getMaxConnectionAttempts())
-                .setReconnectOnChangedSchema(getReconnectOnChangedSchema())
-                .setSchemaCacheDirectory(getSchemaCacheDirectory())
-                .setSleepFactor(getSleepFactor())
-                .setTcpOnly(getTcpOnly())
-                .setYangModuleCapabilities(moduleCapabilities)
-                .setNonModuleCapabilities(nonModuleCapabilities)
-                .setYangLibrary(yangLibrary)
-                .build();
-        return new NodeBuilder()
-                .setNodeId(nodeId)
-                .setKey(nodeKey)
-                .addAugmentation(NetconfNode.class, netconfNode)
-                .build();
-    }
-}
diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModuleFactory.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModuleFactory.java
deleted file mode 100644 (file)
index 0e5bb46..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * 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.config.yang.md.sal.connector.netconf;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
-import org.opendaylight.controller.config.spi.Module;
-import org.osgi.framework.BundleContext;
-
-@Deprecated
-public class NetconfConnectorModuleFactory extends
-        org.opendaylight.controller.config.yang.md.sal.connector.netconf.AbstractNetconfConnectorModuleFactory {
-
-    @Override
-    public Module createModule(final String instanceName, final DependencyResolver dependencyResolver,
-            final DynamicMBeanWithInstance old, final BundleContext bundleContext) throws Exception {
-        final NetconfConnectorModule module =
-                (NetconfConnectorModule) super.createModule(instanceName, dependencyResolver, old, bundleContext);
-        return module;
-    }
-
-    @Override
-    public Module createModule(final String instanceName, final DependencyResolver dependencyResolver,
-                               final BundleContext bundleContext) {
-        final NetconfConnectorModule module =
-                (NetconfConnectorModule) super.createModule(instanceName, dependencyResolver, bundleContext);
-        return module;
-    }
-}
diff --git a/netconf/sal-netconf-connector/src/main/yang/odl-sal-netconf-connector-cfg.yang b/netconf/sal-netconf-connector/src/main/yang/odl-sal-netconf-connector-cfg.yang
deleted file mode 100644 (file)
index ec5f31c..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-module odl-sal-netconf-connector-cfg {
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf";
-    prefix "sal-netconf";
-
-    import config { prefix config; revision-date 2013-04-05; }
-    import threadpool {prefix th;}
-    import netty {prefix netty;}
-    import opendaylight-md-sal-dom {prefix dom;}
-    import opendaylight-md-sal-binding {prefix md-sal-binding; revision-date 2013-10-28;}
-    import odl-netconf-cfg { prefix cfg-net; revision-date 2014-04-08; }
-    import ietf-inet-types {prefix inet; revision-date "2013-07-15";}
-
-    description
-        "Config definition for Netconf Connector modules";
-
-    revision "2015-08-03" {
-        description
-            "Non-mandatory keepalive executor";
-    }
-
-    revision "2013-10-28" {
-        description
-            "Initial revision";
-    }
-
-    identity sal-netconf-connector {
-        base config:module-type;
-        config:java-name-prefix NetconfConnector;
-        status deprecated;
-    }
-
-    grouping server {
-        leaf address {
-            type string;
-        }
-
-        leaf port {
-            type uint32;
-        }
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        status deprecated;
-        case sal-netconf-connector {
-            when "/config:modules/config:module/config:type = 'sal-netconf-connector'";
-
-            leaf address {
-                type inet:host;
-            }
-
-            leaf port {
-                type inet:port-number;
-            }
-
-            leaf tcp-only {
-                type boolean;
-            }
-
-            leaf username {
-                type string;
-            }
-
-            leaf password {
-                type string;
-            }
-
-            leaf concurrent-rpc-limit {
-                type uint16;
-                default 0;
-                description "Limit of concurrent messages that can be send before reply messages are received.
-                             If value less than 1 is provided, no limit will be enforced";
-            }
-
-            leaf schema-cache-directory {
-                type string;
-                default "schema";
-                description "The destination schema repository for yang files relative to the cache directory.  This may be specified per netconf mount
-                             so that the loaded yang files are stored to a distinct directory to avoid potential conflict.";
-            }
-
-            container yang-module-capabilities {
-                leaf override {
-                    type boolean;
-                    default false;
-                    description "Whether to override or merge this list of capabilities with capabilities from device";
-                }
-
-                leaf-list capability {
-                    type string;
-                    description "Set a list of capabilities to override capabilities provided in device's hello message.
-                                 Can be used for devices that do not report any yang modules in their hello message";
-                }
-            }
-
-            container non-module-capabilities {
-                leaf override {
-                    type boolean;
-                    default false;
-                    description "Whether to override or merge this list of non-module based capabilities with non-module
-                                 based capabilities from device";
-                }
-
-                leaf-list capability {
-                    type string;
-                    description "Set a list of non-module based capabilities to override or merge non-module capabilities
-                                 provided in device's hello message. Can be used for devices that do not report or
-                                 incorrectly report non-module based capabilities in their hello message";
-                }
-            }
-
-            leaf reconnect-on-changed-schema {
-                type boolean;
-                default false;
-                description "If true, the connector would auto disconnect/reconnect when schemas are changed in the remote device.
-                             The connector subscribes (right after connect) to base netconf notifications and listens for netconf-capability-change notification";
-            }
-
-            container dom-registry {
-                uses config:service-ref {
-                    refine type {
-                        mandatory false;
-                        config:required-identity dom:dom-broker-osgi-registry;
-                    }
-                }
-            }
-
-            container binding-registry {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
-                    }
-                }
-            }
-
-            container event-executor {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity netty:netty-event-executor;
-                    }
-                }
-            }
-
-            container processing-executor {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity th:threadpool;
-                    }
-                }
-
-                description "Makes up for flaws in netty threading design";
-            }
-
-            container client-dispatcher {
-                uses config:service-ref {
-                    refine type {
-                        mandatory false;
-                        config:required-identity cfg-net:netconf-client-dispatcher;
-                    }
-                }
-            }
-
-            leaf connection-timeout-millis {
-                description "Specifies timeout in milliseconds after which connection must be established.";
-                type uint32;
-                default 20000;
-            }
-
-            leaf default-request-timeout-millis {
-                description "Timeout for blocking operations within transactions.";
-                type uint32;
-                default 60000;
-            }
-
-            leaf max-connection-attempts {
-                description "Maximum number of connection retries. Non positive value or null is interpreted as infinity.";
-                type uint32;
-                default 0; // retry forever
-            }
-
-            leaf between-attempts-timeout-millis {
-                description "Initial timeout in milliseconds to wait between connection attempts. Will be multiplied by sleep-factor with every additional attempt";
-                type uint16;
-                default 2000;
-            }
-
-            leaf sleep-factor {
-                type decimal64 {
-                    fraction-digits 1;
-                }
-                default 1.5;
-            }
-
-            // Keepalive configuration
-            leaf keepalive-delay {
-                type uint32;
-                default 120;
-                description "Netconf connector sends keepalive RPCs while the session is idle, this delay specifies the delay between keepalive RPC in seconds
-                             If a value less than 1 is provided, no keepalives will be sent";
-            }
-
-            container keepalive-executor {
-                uses config:service-ref {
-                    refine type {
-                        mandatory false;
-                        config:required-identity th:scheduled-threadpool;
-                    }
-                    refine name {
-                        mandatory false;
-                    }
-                }
-
-                description "Dedicated solely to keepalive execution";
-            }
-
-            container yang-library {
-                leaf yang-library-url {
-                    config true;
-                    type inet:uri;
-                    description "Yang library to be plugged as additional source provider into the shared schema repository";
-                }
-
-                // credentials for basic http authentication for get request for yanglib data
-                leaf username {
-                    config true;
-                    type string;
-                }
-
-                leaf password {
-                    config true;
-                    type string;
-                }
-            }
-        }
-    }
-}
diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModuleTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModuleTest.java
deleted file mode 100644 (file)
index 9e918b6..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * 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.config.yang.md.sal.connector.netconf;
-
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import com.google.common.util.concurrent.Futures;
-import java.lang.reflect.Field;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-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.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.DomainName;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Host;
-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.node.topology.rev150114.NetconfNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPasswordBuilder;
-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.TopologyId;
-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.TopologyKey;
-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.NodeKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-public class NetconfConnectorModuleTest {
-
-    private static final String MODULE_NAME = "module-name";
-    private static final Host HOST = new Host(new DomainName("localhost"));
-    private static final PortNumber PORT = new PortNumber(17830);
-    private static final Boolean TCP_ONLY = Boolean.FALSE;
-    private static final LoginPassword LOGIN_PASSWORD = new LoginPasswordBuilder()
-            .setUsername("admin")
-            .setPassword("admin")
-            .build();
-    @Mock
-    private DependencyResolver resolver;
-    @Mock
-    private BindingAwareBroker bindingRegistry;
-    @Mock
-    private BindingAwareBroker.ConsumerContext session;
-    @Mock
-    private DataBroker dataBroker;
-    @Mock
-    private WriteTransaction transaction;
-    private NetconfConnectorModule module;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-        module = new NetconfConnectorModule(new ModuleIdentifier("factory", MODULE_NAME), resolver);
-        setViaReflection(module, "bindingRegistryDependency", bindingRegistry);
-        setViaReflection(module, "address", HOST);
-        setViaReflection(module, "port", PORT);
-        setViaReflection(module, "tcpOnly", TCP_ONLY);
-        setViaReflection(module, "username", LOGIN_PASSWORD.getUsername());
-        setViaReflection(module, "password", LOGIN_PASSWORD.getPassword());
-        doReturn(dataBroker).when(session).getSALService(DataBroker.class);
-        doReturn(transaction).when(dataBroker).newWriteOnlyTransaction();
-        doReturn(Futures.immediateCheckedFuture(null)).when(transaction).submit();
-        module.customValidation();
-    }
-
-    @Test
-    public void onSessionInitialized() throws Exception {
-        final AutoCloseable instance = module.createInstance();
-        verify(bindingRegistry).registerConsumer(module);
-        final NodeId nodeId = new NodeId(MODULE_NAME);
-        final KeyedInstanceIdentifier<Node, NodeKey> id = InstanceIdentifier.create(NetworkTopology.class)
-                .child(Topology.class, new TopologyKey(new TopologyId("topology-netconf")))
-                .child(Node.class, new NodeKey(nodeId));
-        //when session is initialized, topology node should be created
-        module.onSessionInitialized(session);
-        final ArgumentCaptor<Node> createdNodeCaptor = ArgumentCaptor.forClass(Node.class);
-        verify(transaction).put(eq(LogicalDatastoreType.CONFIGURATION), eq(id), createdNodeCaptor.capture());
-        verifyNode(nodeId, createdNodeCaptor.getValue());
-        //node should be deleted on close
-        instance.close();
-        verify(transaction).delete(LogicalDatastoreType.CONFIGURATION, id);
-        verify(transaction, times(2)).submit();
-    }
-
-    private static void verifyNode(final NodeId nodeId, final Node node) {
-        Assert.assertEquals(nodeId, node.getNodeId());
-        final NetconfNode netconfNode = node.getAugmentation(NetconfNode.class);
-        Assert.assertEquals(HOST, netconfNode.getHost());
-        Assert.assertEquals(PORT, netconfNode.getPort());
-        Assert.assertEquals(LOGIN_PASSWORD, netconfNode.getCredentials());
-        Assert.assertEquals(TCP_ONLY, netconfNode.isTcpOnly());
-    }
-
-    private static void setViaReflection(final Object object, final String fieldName, final Object value) {
-        try {
-            final Field field = AbstractNetconfConnectorModule.class.getDeclaredField(fieldName);
-            field.setAccessible(true);
-            field.set(object, value);
-        } catch (NoSuchFieldException | IllegalAccessException e) {
-            Assert.fail("Failed to set field via reflection: " + fieldName);
-        }
-    }
-
-}
\ No newline at end of file