private static final String PREFIX_PROP = "netconf.";
private enum InfixProp {
- tcp, tls
+ tcp, tls, ssh
}
private static final String PORT_SUFFIX_PROP = ".port";
private static final String NETCONF_TLS_KEYSTORE_PROP = PREFIX_PROP + InfixProp.tls + ".keystore";
private static final String NETCONF_TLS_KEYSTORE_PASSWORD_PROP = NETCONF_TLS_KEYSTORE_PROP + ".password";
- public static Optional<InetSocketAddress> extractTCPNetconfAddress(BundleContext context) {
- return extractSomeNetconfAddress(context, InfixProp.tcp);
+ public static InetSocketAddress extractTCPNetconfAddress(BundleContext context, String exceptionMessageIfNotFound) {
+
+ Optional<InetSocketAddress> inetSocketAddressOptional = extractSomeNetconfAddress(context, InfixProp.tcp);
+ if (inetSocketAddressOptional.isPresent() == false) {
+ throw new IllegalStateException("Netconf tcp address not found." + exceptionMessageIfNotFound);
+ }
+ return inetSocketAddressOptional.get();
}
+ public static Optional<InetSocketAddress> extractSSHNetconfAddress(BundleContext context) {
+ return extractSomeNetconfAddress(context, InfixProp.ssh);
+ }
+
+
public static Optional<TLSConfiguration> extractTLSConfiguration(BundleContext context) {
Optional<InetSocketAddress> address = extractSomeNetconfAddress(context, InfixProp.tls);
if (address.isPresent()) {