Remove org.opendaylight.netconf.topology.sb.keypair 39/104339/7
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 9 Feb 2023 10:06:54 +0000 (11:06 +0100)
committerRobert Varga <nite@hq.sk>
Thu, 9 Feb 2023 13:59:08 +0000 (13:59 +0000)
This configuration holds the private key location and its pass phrase.
While we inject these values, they are not used anywhere.

JIRA: NETCONF-960
Change-Id: I0a5fd425a59137ac4d0dac5e2f2fd630c4f202bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
apps/netconf-topology-impl/pom.xml
apps/netconf-topology-impl/src/main/resources/OSGI-INF/blueprint/netconf-topology.xml
apps/netconf-topology-impl/src/main/resources/initial/odl-sb-netconf-client-keypair.cfg [deleted file]
apps/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManager.java
apps/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java
apps/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/utils/NetconfTopologySetup.java
apps/netconf-topology-singleton/src/main/resources/OSGI-INF/blueprint/netconf-topology-singleton.xml
apps/netconf-topology/src/main/java/org/opendaylight/netconf/topology/spi/AbstractNetconfTopology.java

index 6d93cf6b4a5f5b17ee699bd7f46109ec75b4fe19..ba9248d7891af39bc43a0555dec9c1e76854f5b3 100644 (file)
             <artifactId>netconf-topology</artifactId>
         </dependency>
     </dependencies>
-
-    <build>
-        <plugins>
-            <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/initial/odl-sb-netconf-client-keypair.cfg
-                                    </file>
-                                    <type>cfg</type>
-                                    <classifier>config</classifier>
-                                </artifact>
-                            </artifacts>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
 </project>
index e4d94554744308c48a22d4f9f683836d01ecc183..0534272754be2c83504a5c4996e15ee3d1f4226f 100644 (file)
@@ -8,7 +8,6 @@
 -->
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
            xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
-           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
            odl:use-default-for-reference-types="true">
 
     <reference id="clientDispatcherDependency"
     <reference id="baseSchemas"
                interface="org.opendaylight.netconf.sal.connect.netconf.schema.mapping.BaseNetconfSchemas"/>
 
-    <cm:property-placeholder persistent-id="org.opendaylight.netconf.topology.sb.keypair" update-strategy="none">
-      <cm:default-properties>
-        <cm:property name="private-key-path" value=""/>
-        <cm:property name="private-key-passphrase" value=""/>
-      </cm:default-properties>
-    </cm:property-placeholder>
-
     <bean id="netconfTopology" class="org.opendaylight.netconf.topology.impl.NetconfTopologyImpl"
           init-method="init"
           destroy-method="close">
-        <cm:managed-properties persistent-id="org.opendaylight.netconf.topology.sb.keypair"
-                           update-strategy="container-managed"/>
         <argument value="topology-netconf"/>
         <argument ref="clientDispatcherDependency"/>
         <argument ref="eventExecutor"/>
@@ -58,8 +48,6 @@
         <argument ref="schemaManager"/>
         <argument ref="dataBroker"/>
         <argument ref="mountPointService"/>
-        <property name="privateKeyPath" value="${private-key-path}"/>
-        <property name="privateKeyPassphrase" value="${private-key-passphrase}"/>
         <argument ref="encryptionService" />
         <argument ref="rpcProviderService" />
         <argument ref="baseSchemas"/>
diff --git a/apps/netconf-topology-impl/src/main/resources/initial/odl-sb-netconf-client-keypair.cfg b/apps/netconf-topology-impl/src/main/resources/initial/odl-sb-netconf-client-keypair.cfg
deleted file mode 100644 (file)
index 8aa5993..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-# This configuration provides the provision to enable key based authentication for netconf southbound client. 
-# The configuration file should be created by name odl-sb-netconf-client-keypair.cfg inside controller/etc directory. 
-# Following configurations should be done in this file
-# private-key-path - Path for private key file. (Paths are identified relative to controller directory).
-#     eg. If private key file exists in controller/etc/id_rsa, the path can be mentioned as etc/id_rsa
-# private-key-passphrase - Passphrase that was used to encrypt the private key. 
-#       In case of no passphrase, keep it blank or unassigned.
-
-private-key-path=etc/RSA-PK
-private-key-passphrase=abc
index 85859608d49d2b2cfc82e689bc5fb89b3200d811..34d44e352a5757fec30174a0b6c651ac56b7b2a0 100644 (file)
@@ -314,8 +314,6 @@ public class NetconfTopologyManager
                 .setSchemaResourceDTO(resourceManager.getSchemaResources(netconfNode.getSchemaCacheDirectory(),
                     deviceId))
                 .setIdleTimeout(writeTxIdleTimeout)
-                .setPrivateKeyPath(privateKeyPath)
-                .setPrivateKeyPassphrase(privateKeyPassphrase)
                 .setEncryptionService(encryptionService)
                 .build();
     }
index c7be846b4b0ae2b4b3ec624a1ef51551f1a8382e..35174120ec4c9045095bcb3028b90a99691d981b 100644 (file)
@@ -74,8 +74,6 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
 
     private final NetconfTopologySetup netconfTopologyDeviceSetup;
     private final RemoteDeviceId remoteDeviceId;
-    private final String privateKeyPath;
-    private final String privateKeyPassphrase;
     private final AAAEncryptionService encryptionService;
     private final NetconfKeystoreAdapter keystoreAdapter;
     private final DeviceActionFactory deviceActionFactory;
@@ -89,8 +87,6 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
         this.netconfTopologyDeviceSetup = requireNonNull(netconfTopologyDeviceSetup);
         this.remoteDeviceId = remoteDeviceId;
         this.deviceActionFactory = requireNonNull(deviceActionFactory);
-        privateKeyPath = netconfTopologyDeviceSetup.getPrivateKeyPath();
-        privateKeyPassphrase = netconfTopologyDeviceSetup.getPrivateKeyPassphrase();
         encryptionService = netconfTopologyDeviceSetup.getEncryptionService();
         keystoreAdapter = new NetconfKeystoreAdapter(netconfTopologyDeviceSetup.getDataBroker());
     }
index ab199f69001d7d5d071c9f009c90dffc9d763489..eb22092307b7941ce117277391fab5c8bd2f77ee 100644 (file)
@@ -41,30 +41,26 @@ public class NetconfTopologySetup {
     private final String topologyId;
     private final NetconfDevice.SchemaResourcesDTO schemaResourceDTO;
     private final Duration idleTimeout;
-    private final String privateKeyPath;
-    private final String privateKeyPassphrase;
     private final AAAEncryptionService encryptionService;
     private final BaseNetconfSchemas baseSchemas;
 
     NetconfTopologySetup(final NetconfTopologySetupBuilder builder) {
-        this.clusterSingletonServiceProvider = builder.getClusterSingletonServiceProvider();
-        this.rpcProviderRegistry = builder.getRpcProviderRegistry();
-        this.actionProviderRegistry = builder.getActionProviderRegistry();
-        this.dataBroker = builder.getDataBroker();
-        this.instanceIdentifier = builder.getInstanceIdentifier();
-        this.node = builder.getNode();
-        this.keepaliveExecutor = builder.getKeepaliveExecutor();
-        this.processingExecutor = builder.getProcessingExecutor();
-        this.actorSystem = builder.getActorSystem();
-        this.eventExecutor = builder.getEventExecutor();
-        this.netconfClientDispatcher = builder.getNetconfClientDispatcher();
-        this.topologyId = builder.getTopologyId();
-        this.schemaResourceDTO = builder.getSchemaResourceDTO();
-        this.idleTimeout = builder.getIdleTimeout();
-        this.privateKeyPath = builder.getPrivateKeyPath();
-        this.privateKeyPassphrase = builder.getPrivateKeyPassphrase();
-        this.encryptionService = builder.getEncryptionService();
-        this.baseSchemas = builder.getBaseSchemas();
+        clusterSingletonServiceProvider = builder.getClusterSingletonServiceProvider();
+        rpcProviderRegistry = builder.getRpcProviderRegistry();
+        actionProviderRegistry = builder.getActionProviderRegistry();
+        dataBroker = builder.getDataBroker();
+        instanceIdentifier = builder.getInstanceIdentifier();
+        node = builder.getNode();
+        keepaliveExecutor = builder.getKeepaliveExecutor();
+        processingExecutor = builder.getProcessingExecutor();
+        actorSystem = builder.getActorSystem();
+        eventExecutor = builder.getEventExecutor();
+        netconfClientDispatcher = builder.getNetconfClientDispatcher();
+        topologyId = builder.getTopologyId();
+        schemaResourceDTO = builder.getSchemaResourceDTO();
+        idleTimeout = builder.getIdleTimeout();
+        encryptionService = builder.getEncryptionService();
+        baseSchemas = builder.getBaseSchemas();
     }
 
     public ClusterSingletonServiceProvider getClusterSingletonServiceProvider() {
@@ -123,14 +119,6 @@ public class NetconfTopologySetup {
         return idleTimeout;
     }
 
-    public String getPrivateKeyPath() {
-        return privateKeyPath;
-    }
-
-    public String getPrivateKeyPassphrase() {
-        return privateKeyPassphrase;
-    }
-
     public AAAEncryptionService getEncryptionService() {
         return encryptionService;
     }
@@ -154,8 +142,6 @@ public class NetconfTopologySetup {
         private NetconfClientDispatcher netconfClientDispatcher;
         private NetconfDevice.SchemaResourcesDTO schemaResourceDTO;
         private Duration idleTimeout;
-        private String privateKeyPath;
-        private String privateKeyPassphrase;
         private AAAEncryptionService encryptionService;
         private BaseNetconfSchemas baseSchemas;
 
@@ -282,7 +268,7 @@ public class NetconfTopologySetup {
         }
 
         public NetconfTopologySetupBuilder setNetconfClientDispatcher(final NetconfClientDispatcher clientDispatcher) {
-            this.netconfClientDispatcher = clientDispatcher;
+            netconfClientDispatcher = clientDispatcher;
             return this;
         }
 
@@ -305,26 +291,8 @@ public class NetconfTopologySetup {
             return idleTimeout;
         }
 
-        public NetconfTopologySetupBuilder setPrivateKeyPath(final String privateKeyPath) {
-            this.privateKeyPath = privateKeyPath;
-            return this;
-        }
-
-        public String getPrivateKeyPath() {
-            return this.privateKeyPath;
-        }
-
-        public NetconfTopologySetupBuilder setPrivateKeyPassphrase(final String privateKeyPassphrase) {
-            this.privateKeyPassphrase = privateKeyPassphrase;
-            return this;
-        }
-
-        public String getPrivateKeyPassphrase() {
-            return this.privateKeyPassphrase;
-        }
-
         AAAEncryptionService getEncryptionService() {
-            return this.encryptionService;
+            return encryptionService;
         }
 
         public NetconfTopologySetupBuilder setEncryptionService(final AAAEncryptionService encryptionService) {
index 4aa47822989fbf3e242592e9a9af8a751fc66502..422465d7a70955b2435347a308fa44dc1a03546d 100644 (file)
@@ -9,7 +9,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
 -->
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
            xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
-           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
            odl:use-default-for-reference-types="true">
 
     <reference id="dataBroker"
@@ -49,21 +48,12 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
             binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.topology.singleton.config.rev170419.Config"
     />
 
-    <cm:property-placeholder persistent-id="org.opendaylight.netconf.topology.sb.keypair" update-strategy="none">
-        <cm:default-properties>
-            <cm:property name="private-key-path" value=""/>
-            <cm:property name="private-key-passphrase" value=""/>
-        </cm:default-properties>
-    </cm:property-placeholder>
-
     <reference id="encryptionService"
                interface="org.opendaylight.aaa.encrypt.AAAEncryptionService" />
 
     <bean id="netconfTopologyManager"
           class="org.opendaylight.netconf.topology.singleton.impl.NetconfTopologyManager"
           init-method="init" destroy-method="close">
-        <cm:managed-properties persistent-id="org.opendaylight.netconf.topology.sb.keypair"
-                               update-strategy="container-managed"/>
         <argument ref="baseSchemas"/>
         <argument ref="dataBroker"/>
         <argument ref="rpcRegistry"/>
@@ -77,8 +67,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
         <argument value="topology-netconf"/>
         <argument ref="singletonConfig"/>
         <argument ref="mountPointService"/>
-        <property name="privateKeyPath" value="${private-key-path}"/>
-        <property name="privateKeyPassphrase" value="${private-key-passphrase}"/>
         <argument ref="encryptionService" />
         <argument ref="rpcProvider" />
         <argument ref="deviceActionFactory"/>
index fcf49fac3060842e45c4a8e1d198e643ca14a8ff..1217f83b3f3117b34f279c029ad99626e1972d70 100644 (file)
@@ -95,8 +95,6 @@ public abstract class AbstractNetconfTopology implements NetconfTopology {
     protected final DataBroker dataBroker;
     protected final DOMMountPointService mountPointService;
     protected final String topologyId;
-    protected String privateKeyPath;
-    protected String privateKeyPassphrase;
     protected final AAAEncryptionService encryptionService;
     protected final HashMap<NodeId, NetconfConnectorDTO> activeConnectors = new HashMap<>();
 
@@ -298,20 +296,6 @@ public abstract class AbstractNetconfTopology implements NetconfTopology {
         return List.of();
     }
 
-    /**
-     * Sets the private key path from location specified in configuration file using blueprint.
-     */
-    public void setPrivateKeyPath(final String privateKeyPath) {
-        this.privateKeyPath = privateKeyPath;
-    }
-
-    /**
-     * Sets the private key passphrase from location specified in configuration file using blueprint.
-     */
-    public void setPrivateKeyPassphrase(final String privateKeyPassphrase) {
-        this.privateKeyPassphrase = privateKeyPassphrase;
-    }
-
     public NetconfReconnectingClientConfiguration getClientConfig(final NetconfClientSessionListener listener,
                                                                   final NetconfNode node, final NodeId nodeId) {
         final ReconnectStrategyFactory sf = new TimedReconnectStrategyFactory(eventExecutor,