Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "BUG 652 leafref CCE & BUG 720 colons problem"
[controller.git]
/
opendaylight
/
netconf
/
netconf-ssh
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
netconf
/
ssh
/
osgi
/
NetconfSSHActivator.java
diff --git
a/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java
b/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java
index 112bf67f69b48d869fede643308dca962c317819..5b8803001ca9a33f71d2cacab990f03891a6891e 100644
(file)
--- a/
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java
+++ b/
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java
@@
-45,7
+45,7
@@
public class NetconfSSHActivator implements BundleActivator{
private IUserManager iUserManager;
private BundleContext context = null;
private IUserManager iUserManager;
private BundleContext context = null;
- ServiceTrackerCustomizer<IUserManager, IUserManager> customizer = new ServiceTrackerCustomizer<IUserManager, IUserManager>(){
+
private
ServiceTrackerCustomizer<IUserManager, IUserManager> customizer = new ServiceTrackerCustomizer<IUserManager, IUserManager>(){
@Override
public IUserManager addingService(ServiceReference<IUserManager> reference) {
logger.trace("Service {} added, let there be SSH bridge.", reference);
@Override
public IUserManager addingService(ServiceReference<IUserManager> reference) {
logger.trace("Service {} added, let there be SSH bridge.", reference);
@@
-72,19
+72,19
@@
public class NetconfSSHActivator implements BundleActivator{
@Override
@Override
- public void start(BundleContext context)
throws Exception
{
+ public void start(BundleContext context) {
this.context = context;
listenForManagerService();
}
@Override
this.context = context;
listenForManagerService();
}
@Override
- public void stop(BundleContext context) throws Exception {
+ public void stop(BundleContext context) throws
IO
Exception {
if (server != null){
server.stop();
logger.trace("Netconf SSH bridge is down ...");
}
}
if (server != null){
server.stop();
logger.trace("Netconf SSH bridge is down ...");
}
}
- private void startSSHServer() throws Exception {
+ private void startSSHServer() throws
IllegalStateException, IO
Exception {
logger.trace("Starting netconf SSH bridge.");
Optional<InetSocketAddress> sshSocketAddressOptional = NetconfConfigUtil.extractSSHNetconfAddress(context, EXCEPTION_MESSAGE);
InetSocketAddress tcpSocketAddress = NetconfConfigUtil.extractTCPNetconfAddress(context,
logger.trace("Starting netconf SSH bridge.");
Optional<InetSocketAddress> sshSocketAddressOptional = NetconfConfigUtil.extractSSHNetconfAddress(context, EXCEPTION_MESSAGE);
InetSocketAddress tcpSocketAddress = NetconfConfigUtil.extractTCPNetconfAddress(context,
@@
-94,14
+94,18
@@
public class NetconfSSHActivator implements BundleActivator{
String path = NetconfConfigUtil.getPrivateKeyPath(context);
path = path.replace("\\", "/"); // FIXME: shouldn't this convert lines to system dependent path separator?
if (path.equals("")){
String path = NetconfConfigUtil.getPrivateKeyPath(context);
path = path.replace("\\", "/"); // FIXME: shouldn't this convert lines to system dependent path separator?
if (path.equals("")){
- throw new Exception("Missing netconf.ssh.pk.path key in configuration file.");
+ throw new
IllegalState
Exception("Missing netconf.ssh.pk.path key in configuration file.");
}
File privateKeyFile = new File(path);
}
File privateKeyFile = new File(path);
- String privateKeyPEMString;
+ String privateKeyPEMString
= null
;
if (privateKeyFile.exists() == false) {
// generate & save to file
if (privateKeyFile.exists() == false) {
// generate & save to file
- privateKeyPEMString = PEMGenerator.generateTo(privateKeyFile);
+ try {
+ privateKeyPEMString = PEMGenerator.generateTo(privateKeyFile);
+ } catch (Exception e) {
+ logger.error("Exception occured while generating PEM string {}",e);
+ }
} else {
// read from file
try (FileInputStream fis = new FileInputStream(path)) {
} else {
// read from file
try (FileInputStream fis = new FileInputStream(path)) {
@@
-111,7
+115,12
@@
public class NetconfSSHActivator implements BundleActivator{
throw new IllegalStateException("Error reading RSA key from file " + path);
}
}
throw new IllegalStateException("Error reading RSA key from file " + path);
}
}
- AuthProvider authProvider = new AuthProvider(iUserManager, privateKeyPEMString);
+ AuthProvider authProvider = null;
+ try {
+ authProvider = new AuthProvider(iUserManager, privateKeyPEMString);
+ } catch (Exception e) {
+ logger.error("Error instantiating AuthProvider {}",e);
+ }
this.server = NetconfSSHServer.start(sshSocketAddressOptional.get().getPort(),tcpSocketAddress,authProvider);
Thread serverThread = new Thread(server,"netconf SSH server thread");
this.server = NetconfSSHServer.start(sshSocketAddressOptional.get().getPort(),tcpSocketAddress,authProvider);
Thread serverThread = new Thread(server,"netconf SSH server thread");
@@
-120,10
+129,10
@@
public class NetconfSSHActivator implements BundleActivator{
logger.trace("Netconf SSH bridge up and running.");
} else {
logger.trace("No valid connection configuration for SSH bridge found.");
logger.trace("Netconf SSH bridge up and running.");
} else {
logger.trace("No valid connection configuration for SSH bridge found.");
- throw new Exception("No valid connection configuration for SSH bridge found.");
+ throw new
IllegalState
Exception("No valid connection configuration for SSH bridge found.");
}
}
}
}
- private void onUserManagerFound(IUserManager userManager) throws
Exception
{
+ private void onUserManagerFound(IUserManager userManager) throws
IOException
{
if (server!=null && server.isUp()){
server.addUserManagerService(userManager);
} else {
if (server!=null && server.isUp()){
server.addUserManagerService(userManager);
} else {