X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fosgi%2FNetconfConfigUtil.java;h=35e17a2a3e4564ffceac32158d00e5f7e6faba39;hp=8a0a9cd80e861510980c0fa6f77336c685e0911c;hb=3fb02545b8541925b54932e2d67a6360fe77f134;hpb=25ba6b145406b98f8521bcf510bb85bf0167ef72 diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java index 8a0a9cd80e..35e17a2a3e 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java @@ -35,8 +35,13 @@ public class NetconfConfigUtil { 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 extractTCPNetconfAddress(BundleContext context) { - return extractSomeNetconfAddress(context, InfixProp.tcp); + public static InetSocketAddress extractTCPNetconfAddress(BundleContext context, String exceptionMessageIfNotFound) { + + Optional inetSocketAddressOptional = extractSomeNetconfAddress(context, InfixProp.tcp); + if (inetSocketAddressOptional.isPresent() == false) { + throw new IllegalStateException("Netconf tcp address not found." + exceptionMessageIfNotFound); + } + return inetSocketAddressOptional.get(); } public static Optional extractSSHNetconfAddress(BundleContext context) {