X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-topology%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Ftopology%2FAbstractNetconfTopology.java;h=a1b89a850a4627633ead36e2bb99984042216ea5;hb=7d5a5e624a2acdf98565738a36248389907d1ab3;hp=ad4bfa9029425205ccab65efdf3bc4600395a493;hpb=3a96a8000706c99343a6126dfdbdb0c46729377e;p=netconf.git diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java index ad4bfa9029..a1b89a850a 100644 --- a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java +++ b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java @@ -35,7 +35,7 @@ import org.opendaylight.netconf.client.conf.NetconfClientConfiguration; import org.opendaylight.netconf.client.conf.NetconfReconnectingClientConfiguration; import org.opendaylight.netconf.client.conf.NetconfReconnectingClientConfigurationBuilder; import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.AuthenticationHandler; -import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.LoginPassword; +import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.PublicKeyAuth; import org.opendaylight.netconf.sal.connect.api.RemoteDevice; import org.opendaylight.netconf.sal.connect.api.RemoteDeviceHandler; import org.opendaylight.netconf.sal.connect.netconf.LibraryModulesSchemas; @@ -164,6 +164,8 @@ public abstract class AbstractNetconfTopology implements NetconfTopology { protected SchemaSourceRegistry schemaRegistry = DEFAULT_SCHEMA_REPOSITORY; protected SchemaRepository schemaRepository = DEFAULT_SCHEMA_REPOSITORY; protected SchemaContextFactory schemaContextFactory = DEFAULT_SCHEMA_CONTEXT_FACTORY; + protected String privateKeyPath; + protected String privateKeyPassphrase; protected final HashMap activeConnectors = new HashMap<>(); @@ -397,6 +399,20 @@ public abstract class AbstractNetconfTopology implements NetconfTopology { new File(relativeSchemaCacheDirectory)); } + /** + * Sets the private key path from location specified in configuration file using blueprint. + */ + public void setPrivateKeyPath(String privateKeyPath) { + this.privateKeyPath = privateKeyPath; + } + + /** + * Sets the private key passphrase from location specified in configuration file using blueprint. + */ + public void setPrivateKeyPassphrase(String privateKeyPassphrase) { + this.privateKeyPassphrase = privateKeyPassphrase; + } + public NetconfReconnectingClientConfiguration getClientConfig(final NetconfClientSessionListener listener, final NetconfNode node) { @@ -419,11 +435,12 @@ public abstract class AbstractNetconfTopology implements NetconfTopology { final Credentials credentials = node.getCredentials(); if (credentials instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114 .netconf.node.credentials.credentials.LoginPassword) { - authHandler = new LoginPassword( + authHandler = new PublicKeyAuth( ((org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114 .netconf.node.credentials.credentials.LoginPassword) credentials).getUsername(), ((org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114 - .netconf.node.credentials.credentials.LoginPassword) credentials).getPassword()); + .netconf.node.credentials.credentials.LoginPassword) credentials).getPassword(), + privateKeyPath, privateKeyPassphrase); } else { throw new IllegalStateException("Only login/password authentification is supported"); }