Remove netconf.util.NetconfConfiguration 29/105729/9
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 28 Apr 2023 09:24:15 +0000 (11:24 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 28 Apr 2023 14:53:10 +0000 (14:53 +0000)
This class is not really used, nor is the configuration file. Remove
the interface and all implementation details.

Change-Id: I8d8458c96509fb21c9f9bac7cf59d3567277ceb3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 files changed:
artifacts/pom.xml
features/netconf/odl-netconf-util/pom.xml
features/netconf/odl-netconf-util/src/main/feature/feature.xml
netconf/mdsal-netconf-ssh/src/test/java/org/opendaylight/netconf/ssh/EchoServer.java
netconf/mdsal-netconf-ssh/src/test/java/org/opendaylight/netconf/ssh/ProxyServer.java
netconf/mdsal-netconf-ssh/src/test/java/org/opendaylight/netconf/ssh/SSHServerTest.java
netconf/mdsal-netconf-ssh/src/test/java/org/opendaylight/netconf/ssh/SSHTest.java
protocol/netconf-util/pom.xml
protocol/netconf-util/src/main/java/org/opendaylight/netconf/util/NetconfConfiguration.java [deleted file]
protocol/netconf-util/src/main/java/org/opendaylight/netconf/util/NetconfConfigurationHolder.java [deleted file]
protocol/netconf-util/src/main/java/org/opendaylight/netconf/util/NetconfConfigurationImpl.java [deleted file]
protocol/netconf-util/src/main/resources/netconf.cfg [deleted file]

index 8e734a862920f7c6b40b8c8797f5ca1b6abf528c..56dcf9877e822d545f4f7878bddc8480f54ac430 100644 (file)
                 <artifactId>netconf-util</artifactId>
                 <version>${project.version}</version>
             </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>netconf-util</artifactId>
-                <version>${project.version}</version>
-                <classifier>config</classifier>
-                <type>cfg</type>
-            </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>sal-netconf-connector</artifactId>
index 0b519d079addaf64781e149d8bdf682df12c1585..a301a4ddf5afc7638569b7f14c6eedde7c3a8bad 100644 (file)
             <groupId>org.opendaylight.netconf</groupId>
             <artifactId>netconf-util</artifactId>
         </dependency>
-        <dependency>
-            <!-- finalname="etc/netconf.cfg" -->
-            <groupId>org.opendaylight.netconf</groupId>
-            <artifactId>netconf-util</artifactId>
-            <type>cfg</type>
-            <classifier>config</classifier>
-        </dependency>
     </dependencies>
 </project>
index ffad9793986a81aca944037ff00cd2bc27c973f5..7ea41309d07a6b22100f3f2c93e49941cd12f4b5 100644 (file)
@@ -8,9 +8,6 @@
  -->
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="odl-netconf-${project.version}">
     <feature name="odl-netconf-util" version="${project.version}">
-        <configfile finalname="etc/netconf.cfg">
-            mvn:org.opendaylight.netconf/netconf-util/${project.version}/cfg/config
-        </configfile>
         <feature version="[10,11)">odl-yangtools-codec</feature>
     </feature>
 </features>
index 6013f77ec46a2e752467781b42d74907fd9a75e9..55711776cccaed8e930093b6cb23a39b8d8da294 100644 (file)
@@ -21,7 +21,6 @@ import io.netty.handler.logging.LoggingHandler;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import org.opendaylight.netconf.util.NetconfConfiguration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -50,7 +49,7 @@ public class EchoServer implements Runnable {
                     });
 
             // Start the server.
-            LocalAddress localAddress = NetconfConfiguration.NETCONF_LOCAL_ADDRESS;
+            LocalAddress localAddress = new LocalAddress("netconf");
             ChannelFuture future = bootstrap.bind(localAddress).sync();
 
             // Wait until the server socket is closed.
index 50bb8b29ee7b5ce110b3f019d7bd18b12244bb67..7283fe2f14e869faa2cc9c7b350e0469bee7722c 100644 (file)
@@ -20,7 +20,6 @@ import io.netty.channel.socket.nio.NioServerSocketChannel;
 import io.netty.handler.logging.LogLevel;
 import io.netty.handler.logging.LoggingHandler;
 import java.net.InetSocketAddress;
-import org.opendaylight.netconf.util.NetconfConfiguration;
 
 public class ProxyServer implements Runnable {
     private final ProxyHandlerFactory proxyHandlerFactory;
@@ -35,7 +34,7 @@ public class ProxyServer implements Runnable {
         final EventLoopGroup bossGroup = new NioEventLoopGroup();
         EventLoopGroup workerGroup = new NioEventLoopGroup();
         try {
-            final LocalAddress localAddress = NetconfConfiguration.NETCONF_LOCAL_ADDRESS;
+            final LocalAddress localAddress = new LocalAddress("netconf");
             ServerBootstrap serverBootstrap = new ServerBootstrap();
             serverBootstrap.group(bossGroup, workerGroup)
                     .channel(NioServerSocketChannel.class)
index ff085de5c519b8030ed471c3ee66218480db0bbf..15c418de3350dd8614e1093816c8268680f1d6b7 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.netconf.ssh;
 
 import io.netty.channel.EventLoopGroup;
+import io.netty.channel.local.LocalAddress;
 import io.netty.channel.nio.NioEventLoopGroup;
 import java.io.File;
 import java.net.InetSocketAddress;
@@ -23,7 +24,6 @@ import org.opendaylight.netconf.shaded.sshd.client.future.AuthFuture;
 import org.opendaylight.netconf.shaded.sshd.client.future.ConnectFuture;
 import org.opendaylight.netconf.shaded.sshd.client.session.ClientSession;
 import org.opendaylight.netconf.shaded.sshd.common.util.security.SecurityUtils;
-import org.opendaylight.netconf.util.NetconfConfiguration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,7 +51,7 @@ public class SSHServerTest {
         final InetSocketAddress addr = InetSocketAddress.createUnresolved(HOST, PORT);
         server = new SshProxyServer(minaTimerEx, clientGroup, nioExec);
         server.bind(new SshProxyServerConfigurationBuilder()
-                .setBindingAddress(addr).setLocalAddress(NetconfConfiguration.NETCONF_LOCAL_ADDRESS)
+                .setBindingAddress(addr).setLocalAddress(new LocalAddress("netconf"))
                 .setAuthenticator((username, password) -> true)
                 .setKeyPairProvider(SecurityUtils.createGeneratorHostKeyProvider(sshKeyPair.toPath()))
                 .setIdleTimeout(Integer.MAX_VALUE).createSshProxyServerConfiguration());
index 5673c592db6b78e72ba664572e21fb66061388cd..d39c429ae3ff5c0b1485a8f42faa95a459abc2e6 100644 (file)
@@ -15,6 +15,7 @@ import com.google.common.base.Stopwatch;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.channel.ChannelInitializer;
 import io.netty.channel.EventLoopGroup;
+import io.netty.channel.local.LocalAddress;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.channel.socket.nio.NioSocketChannel;
 import io.netty.util.HashedWheelTimer;
@@ -32,7 +33,6 @@ import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.LoginPasswo
 import org.opendaylight.netconf.nettyutil.handler.ssh.client.AsyncSshHandler;
 import org.opendaylight.netconf.shaded.sshd.common.util.security.SecurityUtils;
 import org.opendaylight.netconf.ssh.EchoClientHandler.State;
-import org.opendaylight.netconf.util.NetconfConfiguration;
 
 public class SSHTest {
     public static final String AHOJ = "ahoj\n";
@@ -67,7 +67,7 @@ public class SSHTest {
         final InetSocketAddress addr = new InetSocketAddress("127.0.0.1", 10831);
         try (var sshProxyServer = new SshProxyServer(minaTimerEx, nettyGroup, nioExec)) {
             sshProxyServer.bind(new SshProxyServerConfigurationBuilder()
-                .setBindingAddress(addr).setLocalAddress(NetconfConfiguration.NETCONF_LOCAL_ADDRESS)
+                .setBindingAddress(addr).setLocalAddress(new LocalAddress("netconf"))
                 .setAuthenticator((username, password) -> true)
                 .setKeyPairProvider(SecurityUtils.createGeneratorHostKeyProvider(sshKeyPair.toPath()))
                 .setIdleTimeout(Integer.MAX_VALUE).createSshProxyServerConfiguration());
index c91b0b2f46775c14fcb84aebf63fa24c1bd586fe..8fd220244a3f58352981c1ac96d736c9032b9c38 100644 (file)
       <groupId>org.opendaylight.netconf</groupId>
       <artifactId>netconf-api</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.service.component.annotations</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.service.metatype.annotations</artifactId>
-    </dependency>
 
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
       </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>build-helper-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-artifacts</id>
-            <goals>
-              <goal>attach-artifact</goal>
-            </goals>
-            <phase>package</phase>
-            <configuration>
-              <artifacts>
-                <artifact>
-                  <file>${project.build.directory}/classes/netconf.cfg</file>
-                  <type>cfg</type>
-                  <classifier>config</classifier>
-                </artifact>
-              </artifacts>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
       <plugin>
         <artifactId>maven-jar-plugin</artifactId>
         <executions>
diff --git a/protocol/netconf-util/src/main/java/org/opendaylight/netconf/util/NetconfConfiguration.java b/protocol/netconf-util/src/main/java/org/opendaylight/netconf/util/NetconfConfiguration.java
deleted file mode 100644 (file)
index 6cada7f..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2017 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.util;
-
-import io.netty.channel.local.LocalAddress;
-import java.net.InetSocketAddress;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Configuration for NETCONF northbound.
- */
-public interface NetconfConfiguration {
-
-    /**
-     * LocalAddress constant for NETCONF northbound.
-     */
-    LocalAddress NETCONF_LOCAL_ADDRESS = new LocalAddress("netconf");
-
-    /**
-     * Default timeout for NETCONF northbound connections.
-     */
-    long DEFAULT_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(30);
-
-    /**
-     * NETCONF SSH server address.
-     *
-     * @return NETCONF SSH server address
-     */
-    InetSocketAddress getSshServerAddress();
-
-    /**
-     * NETCONF TCP server address.
-     *
-     * @return NETCONF TCP server address.
-     */
-    InetSocketAddress getTcpServerAddress();
-
-    /**
-     * Private key path for NETCONF.
-     *
-     * @return Private key path for NETCONF.
-     */
-    String getPrivateKeyPath();
-}
diff --git a/protocol/netconf-util/src/main/java/org/opendaylight/netconf/util/NetconfConfigurationHolder.java b/protocol/netconf-util/src/main/java/org/opendaylight/netconf/util/NetconfConfigurationHolder.java
deleted file mode 100644 (file)
index 28f2b87..0000000
+++ /dev/null
@@ -1,38 +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.netconf.util;
-
-import java.net.InetSocketAddress;
-
-final class NetconfConfigurationHolder {
-
-    private final InetSocketAddress tcpServerAddress;
-    private final InetSocketAddress sshServerAddress;
-    private final String privateKeyPath;
-
-    NetconfConfigurationHolder(final InetSocketAddress tcpServerAddress,
-                               final InetSocketAddress sshServerAddress,
-                               final String privateKeyPath) {
-        this.tcpServerAddress = tcpServerAddress;
-        this.sshServerAddress = sshServerAddress;
-        this.privateKeyPath = privateKeyPath;
-    }
-
-    String getPrivateKeyPath() {
-        return privateKeyPath;
-    }
-
-    InetSocketAddress getSshServerAddress() {
-        return sshServerAddress;
-    }
-
-    InetSocketAddress getTcpServerAddress() {
-        return tcpServerAddress;
-    }
-}
diff --git a/protocol/netconf-util/src/main/java/org/opendaylight/netconf/util/NetconfConfigurationImpl.java b/protocol/netconf-util/src/main/java/org/opendaylight/netconf/util/NetconfConfigurationImpl.java
deleted file mode 100644 (file)
index 6c440a3..0000000
+++ /dev/null
@@ -1,111 +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.netconf.util;
-
-import java.lang.annotation.Annotation;
-import java.net.InetSocketAddress;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.metatype.annotations.AttributeDefinition;
-import org.osgi.service.metatype.annotations.Designate;
-import org.osgi.service.metatype.annotations.ObjectClassDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Component(immediate = true, configurationPid = "netconf")
-@Designate(ocd = NetconfConfigurationImpl.Configuration.class)
-public class NetconfConfigurationImpl implements NetconfConfiguration {
-    @ObjectClassDefinition
-    public @interface Configuration {
-        @AttributeDefinition(name = "tcp-address")
-        String tcpAddress() default "127.0.0.1";
-        @AttributeDefinition(name = "tcp-port", min = "0", max = "65535")
-        int tcpPort() default 8383;
-        @AttributeDefinition(name = "ssh-address")
-        String sshAddress() default "0.0.0.0";
-        @AttributeDefinition(name = "ssh-port", min = "0", max = "65535")
-        int sshPort() default 1830;
-        @AttributeDefinition(name = "sshpk-path")
-        String sshPrivateKeyPath() default "./configuration/RSA.pk";
-    }
-
-    private static final Logger LOG = LoggerFactory.getLogger(NetconfConfigurationImpl.class);
-
-    private NetconfConfigurationHolder netconfConfiguration;
-
-    public NetconfConfigurationImpl() {
-        // for DI
-    }
-
-    public NetconfConfigurationImpl(final String tcpServerAddress, final int tcpServerPort,
-                                    final String sshServerAddress, final int sshServerPort,
-                                    final String privateKeyPath) {
-        activate(new Configuration() {
-            @Override
-            public Class<? extends Annotation> annotationType() {
-                return Configuration.class;
-            }
-
-            @Override
-            public String tcpAddress() {
-                return tcpServerAddress;
-            }
-
-            @Override
-            public int tcpPort() {
-                return tcpServerPort;
-            }
-
-            @Override
-            public String sshAddress() {
-                return sshServerAddress;
-            }
-
-            @Override
-            public int sshPort() {
-                return sshServerPort;
-            }
-
-            @Override
-            public String sshPrivateKeyPath() {
-                return privateKeyPath;
-            }
-        });
-    }
-
-    @Activate
-    void activate(final Configuration config) {
-        final InetSocketAddress sshServerAddress = new InetSocketAddress(config.sshAddress(), config.sshPort());
-        final InetSocketAddress tcpServerAddress = new InetSocketAddress(config.tcpAddress(), config.tcpPort());
-
-        netconfConfiguration = new NetconfConfigurationHolder(tcpServerAddress, sshServerAddress,
-            config.sshPrivateKeyPath());
-        LOG.debug("CSS netconf server configuration was updated");
-    }
-
-    @Deactivate
-    void deactivate(final Configuration config) {
-        netconfConfiguration = null;
-    }
-
-    @Override
-    public InetSocketAddress getSshServerAddress() {
-        return netconfConfiguration.getSshServerAddress();
-    }
-
-    @Override
-    public InetSocketAddress getTcpServerAddress() {
-        return netconfConfiguration.getTcpServerAddress();
-    }
-
-    @Override
-    public String getPrivateKeyPath() {
-        return netconfConfiguration.getPrivateKeyPath();
-    }
-}
diff --git a/protocol/netconf-util/src/main/resources/netconf.cfg b/protocol/netconf-util/src/main/resources/netconf.cfg
deleted file mode 100644 (file)
index 01d92ec..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-# netconf-tcp:
-#tcp-address=127.0.0.1
-#tcp-port=8383
-
-# netconf-ssh:
-#ssh-address=0.0.0.0
-#ssh-port=1830
-
-# Use Linux style path
-#ssh-pk-path = ./configuration/RSA.pk
\ No newline at end of file