Remove NetconfConnectorFactory 67/104267/3
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 6 Feb 2023 15:02:58 +0000 (16:02 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 6 Feb 2023 20:34:20 +0000 (21:34 +0100)
This interface is not used anywhere except for instantiation. Remove it.

Change-Id: I85ff414d10d8d54790989fea22f0c728c53c2e32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
apps/netconf-topology-impl/src/main/java/org/opendaylight/netconf/topology/impl/NetconfConnectorFactoryImpl.java [deleted file]
apps/netconf-topology-impl/src/main/resources/OSGI-INF/blueprint/netconf-topology.xml
apps/netconf-topology/src/main/java/org/opendaylight/netconf/topology/api/NetconfConnectorFactory.java [deleted file]

diff --git a/apps/netconf-topology-impl/src/main/java/org/opendaylight/netconf/topology/impl/NetconfConnectorFactoryImpl.java b/apps/netconf-topology-impl/src/main/java/org/opendaylight/netconf/topology/impl/NetconfConnectorFactoryImpl.java
deleted file mode 100644 (file)
index d4737bb..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2016 Inocybe Technologies 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.netconf.topology.impl;
-
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.MoreExecutors;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.common.api.CommitInfo;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.netconf.topology.api.NetconfConnectorFactory;
-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.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.Ipv6Address;
-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.credentials.credentials.LoginPwBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev221225.credentials.credentials.login.pw.LoginPasswordBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev221225.NetconfNodeBuilder;
-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.opendaylight.yangtools.yang.common.Uint16;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Created by adetalhouet on 2016-11-03.
- */
-public class NetconfConnectorFactoryImpl implements NetconfConnectorFactory {
-    private static final Logger LOG = LoggerFactory.getLogger(NetconfConnectorFactoryImpl.class);
-
-    private static final InstanceIdentifier<Topology> TOPOLOGY_PATH = InstanceIdentifier.create(NetworkTopology.class)
-            .child(Topology.class, new TopologyKey(new TopologyId("topology-netconf")));
-
-    @Override
-    public Node newInstance(final DataBroker dataBroker,
-                            final String instanceName,
-                            final String address,
-                            final Integer port,
-                            final String username,
-                            final String password,
-                            final Boolean tcpOnly,
-                            final Boolean reconnectOnSchemaChange) {
-
-        final NodeKey nodeKey = new NodeKey(new NodeId(instanceName));
-        final Node node =  new NodeBuilder()
-                .withKey(nodeKey)
-                .addAugmentation(new NetconfNodeBuilder()
-                    .setHost(createHost(address))
-                    .setPort(new PortNumber(Uint16.valueOf(port)))
-                    .setCredentials(new LoginPwBuilder()
-                        .setLoginPassword(new LoginPasswordBuilder()
-                            .setUsername(username)
-                            .setPassword(password)
-                            .build())
-                        .build())
-                    .setTcpOnly(tcpOnly)
-                    .setReconnectOnChangedSchema(reconnectOnSchemaChange)
-                    .build())
-                .build();
-
-        final InstanceIdentifier<Node> nodePath = TOPOLOGY_PATH.child(Node.class, nodeKey);
-        final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
-        transaction.put(LogicalDatastoreType.CONFIGURATION, nodePath, node);
-        transaction.commit().addCallback(new FutureCallback<CommitInfo>() {
-            @Override
-            public void onSuccess(final CommitInfo 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);
-            }
-        }, MoreExecutors.directExecutor());
-        return node;
-    }
-
-    private static Host createHost(final String host) {
-        try {
-            return new Host(new IpAddress(new Ipv4Address(host)));
-        } catch (IllegalArgumentException e) {
-            LOG.debug("Cannot interpret {} as an Ipv4Address", host, e);
-        }
-        try {
-            return new Host(new IpAddress(new Ipv6Address(host)));
-        } catch (IllegalArgumentException e) {
-            LOG.debug("Cannot interpret {} as an Ipv6Address", host, e);
-        }
-        return new Host(new DomainName(host));
-    }
-}
index e455f988177190aaf9073e98ac8361cad6e18497..e4d94554744308c48a22d4f9f683836d01ecc183 100644 (file)
         <argument ref="deviceActionFactory"/>
     </bean>
 
-    <bean id="netconfConnectorFactory" class="org.opendaylight.netconf.topology.impl.NetconfConnectorFactoryImpl"/>
-    <service ref="netconfConnectorFactory" interface="org.opendaylight.netconf.topology.api.NetconfConnectorFactory"
-             odl:type="default"/>
-
     <bean id="netconfKeystoreProvider"
           class="org.opendaylight.netconf.sal.connect.util.NetconfSalKeystoreService">
         <argument ref="dataBroker"/>
diff --git a/apps/netconf-topology/src/main/java/org/opendaylight/netconf/topology/api/NetconfConnectorFactory.java b/apps/netconf-topology/src/main/java/org/opendaylight/netconf/topology/api/NetconfConnectorFactory.java
deleted file mode 100644 (file)
index 2f0fead..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2016 Inocybe Technologies 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.netconf.topology.api;
-
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev221225.NetconfNode;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-
-/**
- * Created by adetalhouet on 2016-11-03.
- */
-public interface NetconfConnectorFactory {
-
-    /**
-     * Create a new netconf connector with default values.
-     *
-     * <p>
-     * This method will create a {@link Node} and a {@link NetconfNode}
-     * that will be added as an augmentation to the {@link Node}.
-     * Afterward, that {@link Node} will be written in the MDSAL datastore under the {@link NetconfTopology}.
-     * Listeners of that subtree located within network-topology bundle will setup the session.
-     *
-     * @param dataBroker Instance of the {@link DataBroker}
-     * @param instanceName The name of the node
-     * @param address The address
-     * @param port The port
-     * @param username The username of the netconf session
-     * @param password The password of the netconf session
-     * @param tcpOnly Whether to create a TCP or SSH session
-     * @param reconnectOnSchemaChange Whether to enable ietf-netconf-monitoring and register the NETCONF stream.
-     * @return The created {@link Node}
-     */
-    Node newInstance(DataBroker dataBroker,
-                     String instanceName,
-                     String address,
-                     Integer port,
-                     String username,
-                     String password,
-                     Boolean tcpOnly,
-                     Boolean reconnectOnSchemaChange);
-}