diff options
Diffstat (limited to 'infra/northbound/netconf')
2 files changed, 4 insertions, 16 deletions
diff --git a/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfSshServerProvider.java b/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfSshServerProvider.java index d44b4f221..02847d733 100644 --- a/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfSshServerProvider.java +++ b/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfSshServerProvider.java @@ -16,6 +16,7 @@ package io.fd.honeycomb.northbound.netconf; +import com.google.common.net.InetAddresses; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.inject.Inject; import io.fd.honeycomb.binding.init.ProviderTrait; @@ -30,7 +31,6 @@ import io.netty.util.concurrent.GlobalEventExecutor; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; -import java.net.UnknownHostException; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import org.apache.sshd.server.keyprovider.PEMGeneratorHostKeyProvider; @@ -74,13 +74,7 @@ public final class NetconfSshServerProvider extends ProviderTrait<NetconfSshServ // TODO(HONEYCOMB-414): the logic below is very similar to // org.opendaylight.netconf.ssh.NetconfNorthboundSshServer (introduced in Carbon), so consider reusing it // (requires fixing hardcoded private key path). - InetAddress sshBindingAddress = null; - try { - sshBindingAddress = InetAddress.getByName(cfgAttributes.netconfSshBindingAddress.get()); - } catch (UnknownHostException e) { - throw new IllegalArgumentException("Illegal binding address", e); - } - + final InetAddress sshBindingAddress = InetAddresses.forString(cfgAttributes.netconfSshBindingAddress.get()); final InetSocketAddress bindingAddress = new InetSocketAddress(sshBindingAddress, cfgAttributes.netconfSshBindingPort.get()); diff --git a/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfTcpServerProvider.java b/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfTcpServerProvider.java index c1fc0a594..031f0f9d9 100644 --- a/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfTcpServerProvider.java +++ b/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfTcpServerProvider.java @@ -16,6 +16,7 @@ package io.fd.honeycomb.northbound.netconf; +import com.google.common.net.InetAddresses; import com.google.inject.Inject; import io.fd.honeycomb.binding.init.ProviderTrait; import io.fd.honeycomb.infra.distro.InitializationException; @@ -24,7 +25,6 @@ import io.netty.channel.ChannelFuture; import io.netty.util.concurrent.GenericFutureListener; import java.net.InetAddress; import java.net.InetSocketAddress; -import java.net.UnknownHostException; import org.opendaylight.netconf.api.NetconfServerDispatcher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,13 +45,7 @@ public final class NetconfTcpServerProvider extends ProviderTrait<NetconfTcpServ return null; } LOG.info("Starting NETCONF TCP"); - InetAddress name = null; - try { - name = InetAddress.getByName(cfgAttributes.netconfTcpBindingAddress.get()); - } catch (UnknownHostException e) { - throw new IllegalArgumentException("Illegal binding address", e); - } - + final InetAddress name = InetAddresses.forString(cfgAttributes.netconfTcpBindingAddress.get()); final InetSocketAddress unresolved = new InetSocketAddress(name, cfgAttributes.netconfTcpBindingPort.get()); ChannelFuture tcpServer = dispatcher.createServer(unresolved); |