ONOS-6020 RolledBack and deprecated a method in NetconfDeviceInfo to not break backwards compatibility
Change-Id: Ie029f6b1d3688d428130b76ed2e06c760d9a390a
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java
index 451a2a1..26ded2f 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java
@@ -118,7 +118,13 @@
}
boolean isAuthenticated;
try {
- if (deviceInfo.getKey() != null) {
+ if (deviceInfo.getKeyFile() != null && deviceInfo.getKeyFile().canRead()) {
+ log.debug("Authenticating with key file to device {} with username {}",
+ deviceInfo.getDeviceId(), deviceInfo.name());
+ isAuthenticated = netconfConnection.authenticateWithPublicKey(
+ deviceInfo.name(), deviceInfo.getKeyFile(),
+ deviceInfo.password().equals("") ? null : deviceInfo.password());
+ } else if (deviceInfo.getKey() != null) {
log.debug("Authenticating with key to device {} with username {}",
deviceInfo.getDeviceId(), deviceInfo.name());
isAuthenticated = netconfConnection.authenticateWithPublicKey(