KeyMapping rework 59/57959/13
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Mon, 29 May 2017 09:44:01 +0000 (11:44 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 20 Jun 2017 09:22:37 +0000 (09:22 +0000)
Change-Id: I76a1a1c0353219d453963422b64cd7bcf86bb523
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
25 files changed:
bgp/bmp-impl/src/main/java/org/opendaylight/controller/config/yang/bmp/impl/BmpMonitorImplModule.java
bgp/bmp-impl/src/main/java/org/opendaylight/protocol/bmp/impl/BmpDispatcherImpl.java
bgp/bmp-impl/src/main/java/org/opendaylight/protocol/bmp/impl/app/BmpMonitoringStationImpl.java
bgp/bmp-impl/src/test/java/org/opendaylight/protocol/bmp/impl/app/BmpMonitorImplTest.java
bgp/bmp-spi/src/main/java/org/opendaylight/protocol/bmp/api/BmpDispatcher.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPDispatcherImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/spi/BGPDispatcher.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/BGPDispatcherImplTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ParserToSalTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/AbstractConfig.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpPeerTest.java
concepts/src/main/java/org/opendaylight/protocol/concepts/KeyMapping.java
pcep/api/src/main/java/org/opendaylight/protocol/pcep/PCEPDispatcher.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPDispatcherImpl.java
pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/protocol/PCCDispatcherImpl.java
pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCDispatcherImplTest.java
pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCMockCommon.java
pcep/testtool/src/test/java/org/opendaylight/protocol/pcep/testtool/PCCMock.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/PCEPTopologyProvider.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/config/PCEPTopologyConfigDependencies.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/config/PCEPTopologyDeployer.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/config/PCEPTopologyDeployerImpl.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/config/PCEPTopologyProviderUtil.java
pcep/topology-provider/src/main/java/org/opendaylight/controller/config/yang/pcep/topology/provider/PCEPTopologyProviderModule.java

index 242b72769b6ee8021e6595d12a3b3995e008eeb6..831246812eb17c116f6206c02f3dec9f265596b2 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.controller.config.yang.bmp.impl;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.net.InetAddresses;
 import io.netty.util.internal.PlatformDependent;
@@ -53,7 +52,7 @@ public class BmpMonitorImplModule extends org.opendaylight.controller.config.yan
         return address.getIpv6Address().getValue();
     }
 
-    private Optional<KeyMapping> constructKeys() {
+    private KeyMapping constructKeys() {
         final KeyMapping ret = KeyMapping.getKeyMapping();
         if (getMonitoredRouter() != null) {
             for (final MonitoredRouter mr : getMonitoredRouter()) {
@@ -69,7 +68,7 @@ public class BmpMonitorImplModule extends org.opendaylight.controller.config.yan
             }
         }
 
-        return ret.isEmpty() ? Optional.absent() : Optional.of(ret);
+        return ret;
     }
 
     @Override
index 4fa2b04d5f5cd0696cbc88ab00f851f27f863ccf..eade9264ad3ccc11a39fca7d8ca9afa81ea61dd2 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.protocol.bmp.impl;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.bootstrap.ServerBootstrap;
@@ -68,7 +67,7 @@ public class BmpDispatcherImpl implements BmpDispatcher {
     }
 
     @Override
-    public ChannelFuture createClient(final InetSocketAddress address, final BmpSessionListenerFactory slf, final Optional<KeyMapping> keys) {
+    public ChannelFuture createClient(final InetSocketAddress address, final BmpSessionListenerFactory slf, final KeyMapping keys) {
 
         final Bootstrap b = new Bootstrap();
 
@@ -79,9 +78,9 @@ public class BmpDispatcherImpl implements BmpDispatcher {
         } else {
             b.channel(NioSocketChannel.class);
         }
-        if (keys.isPresent()) {
+        if (!keys.isEmpty()) {
             if (Epoll.isAvailable()) {
-                b.option(EpollChannelOption.TCP_MD5SIG, keys.get());
+                b.option(EpollChannelOption.TCP_MD5SIG, keys);
             } else {
                 throw new UnsupportedOperationException (Epoll.unavailabilityCause().getCause());
             }
@@ -105,7 +104,7 @@ public class BmpDispatcherImpl implements BmpDispatcher {
     }
 
     @Override
-    public ChannelFuture createServer(final InetSocketAddress address, final BmpSessionListenerFactory slf, final Optional<KeyMapping> keys) {
+    public ChannelFuture createServer(final InetSocketAddress address, final BmpSessionListenerFactory slf, final KeyMapping keys) {
         Preconditions.checkNotNull(address);
         Preconditions.checkNotNull(slf);
 
@@ -127,9 +126,9 @@ public class BmpDispatcherImpl implements BmpDispatcher {
             b.channel(NioServerSocketChannel.class);
         }
 
-        if (keys.isPresent()) {
+        if (!keys.isEmpty()) {
             if (Epoll.isAvailable()) {
-                b.option(EpollChannelOption.TCP_MD5SIG, keys.get());
+                b.option(EpollChannelOption.TCP_MD5SIG, keys);
             } else {
                 throw new UnsupportedOperationException (Epoll.unavailabilityCause().getCause());
             }
index 950804496f90971b1664370d660dd8a630b5b7af..08ba8bfa1c5a56ab1665e653fb8e2a66e74f98d3 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.protocol.bmp.impl.app;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.net.InetAddresses;
 import io.netty.channel.Channel;
@@ -88,7 +87,7 @@ public final class BmpMonitoringStationImpl implements BmpMonitoringStation {
                     ret = KeyMapping.getKeyMapping(addr, rfc2385KeyPassword.getValue());
                     dispatcher.createClient(
                         Ipv4Util.toInetSocketAddress(mr.getAddress(), mr.getPort()),
-                        this.sessionManager, Optional.fromNullable(ret));
+                        this.sessionManager, ret);
                 }
             }
         }
@@ -96,7 +95,7 @@ public final class BmpMonitoringStationImpl implements BmpMonitoringStation {
 
     public static BmpMonitoringStation createBmpMonitorInstance(final RIBExtensionConsumerContext ribExtensions, final BmpDispatcher dispatcher,
             final DOMDataBroker domDataBroker, final MonitorId monitorId, final InetSocketAddress address,
-            final Optional<KeyMapping> keys, final BindingCodecTreeFactory codecFactory, final SchemaContext schemaContext,
+            final KeyMapping keys, final BindingCodecTreeFactory codecFactory, final SchemaContext schemaContext,
             final List<MonitoredRouter> mrs ) throws InterruptedException {
         Preconditions.checkNotNull(ribExtensions);
         Preconditions.checkNotNull(dispatcher);
index 2660d7752b7db0318907661e7eb7aefc62b8a462..b161978d92e03e9b581d2dd05df5c2c30b972013 100644 (file)
@@ -17,7 +17,6 @@ import static org.junit.Assert.fail;
 import static org.opendaylight.protocol.util.CheckUtil.readDataOperational;
 import static org.opendaylight.protocol.util.CheckUtil.waitFutureSuccess;
 
-import com.google.common.base.Optional;
 import com.google.common.net.InetAddresses;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.channel.Channel;
@@ -159,7 +158,7 @@ public class BmpMonitorImplTest extends AbstractConcurrentDataBrokerTest {
                 ctx.getBmpMessageRegistry(), new DefaultBmpSessionFactory());
 
         this.bmpApp = BmpMonitoringStationImpl.createBmpMonitorInstance(ribExtension, this.dispatcher, getDomBroker(),
-                MONITOR_ID, new InetSocketAddress(InetAddresses.forString(MONITOR_LOCAL_ADDRESS), MONITOR_LOCAL_PORT), Optional.of(keys),
+                MONITOR_ID, new InetSocketAddress(InetAddresses.forString(MONITOR_LOCAL_ADDRESS), MONITOR_LOCAL_PORT), keys,
                 this.mappingService.getCodecFactory(), this.moduleInfoBackedContext.getSchemaContext(), null);
 
         readDataOperational(getDataBroker(), BMP_II, monitor -> {
@@ -402,7 +401,7 @@ public class BmpMonitorImplTest extends AbstractConcurrentDataBrokerTest {
     @Test
     public void deploySecondInstance() throws Exception {
         final BmpMonitoringStation monitoringStation2 = BmpMonitoringStationImpl.createBmpMonitorInstance(new SimpleRIBExtensionProviderContext(), this.dispatcher, getDomBroker(),
-                new MonitorId("monitor2"), new InetSocketAddress(InetAddresses.forString(MONITOR_LOCAL_ADDRESS_2), MONITOR_LOCAL_PORT), Optional.of(KeyMapping.getKeyMapping()),
+                new MonitorId("monitor2"), new InetSocketAddress(InetAddresses.forString(MONITOR_LOCAL_ADDRESS_2), MONITOR_LOCAL_PORT), KeyMapping.getKeyMapping(),
                 this.mappingService.getCodecFactory(), this.moduleInfoBackedContext.getSchemaContext(), null);
 
         readDataOperational(getDataBroker(), BMP_II, monitor -> {
index b13d0f6dae4e52ca6243bb4afa2805ab9af585dd..fe004daea9090b60066d3eca3b6121fbcc770703 100644 (file)
@@ -26,7 +26,13 @@ public interface BmpDispatcher extends AutoCloseable {
      * @param keys    RFC2385 key mapping
      * @return instance of BmpServer
      */
-    ChannelFuture createServer(InetSocketAddress address, BmpSessionListenerFactory slf, Optional<KeyMapping> keys);
+    @Deprecated
+    default ChannelFuture createServer(InetSocketAddress address, BmpSessionListenerFactory slf, Optional<KeyMapping> keys) {
+        if(keys.isPresent()) {
+            return createServer(address, slf, keys.get());
+        }
+        return createServer(address, slf, KeyMapping.getKeyMapping());
+    }
 
      /**
      * Creates reconnect clients. Make connection to all active monitored-routers.
@@ -36,5 +42,31 @@ public interface BmpDispatcher extends AutoCloseable {
      * @param keys    RFC2385 key mapping
      * @return        void
      */
-    ChannelFuture createClient(InetSocketAddress address, BmpSessionListenerFactory slf, Optional<KeyMapping> keys) ;
+     @Deprecated
+     default ChannelFuture createClient(InetSocketAddress address, BmpSessionListenerFactory slf, Optional<KeyMapping> keys) {
+         if(keys.isPresent()) {
+             return createClient(address, slf, keys.get());
+         }
+         return createClient(address, slf, KeyMapping.getKeyMapping());
+     }
+
+    /**
+     * Creates server. Each server needs three factories to pass their instances to client sessions.
+     *
+     * @param address to be bound with the server
+     * @param slf     bmp session listener factory
+     * @param keys    RFC2385 key mapping
+     * @return instance of BmpServer
+     */
+    ChannelFuture createServer(InetSocketAddress address, BmpSessionListenerFactory slf, KeyMapping keys);
+
+    /**
+     * Creates reconnect clients. Make connection to all active monitored-routers.
+     *
+     * @param address bmp client to connect to
+     * @param slf     bmp session listener factory
+     * @param keys    RFC2385 key mapping
+     * @return        void
+     */
+    ChannelFuture createClient(InetSocketAddress address, BmpSessionListenerFactory slf, KeyMapping keys) ;
 }
index 077fa1b117cea880e41e3ae2ec8942fea688b1eb..5515633d6df63b206b694172e183dcf09dcc2410 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.protocol.bgp.rib.impl;
 
+import static org.opendaylight.protocol.concepts.KeyMapping.getKeyMapping;
+
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.bootstrap.ServerBootstrap;
@@ -75,7 +76,7 @@ public class BGPDispatcherImpl implements BGPDispatcher, AutoCloseable {
 
     @Override
     public synchronized Future<BGPSessionImpl> createClient(final InetSocketAddress remoteAddress, final int retryTimer) {
-        return createClient(remoteAddress, retryTimer, createClientBootStrap(Optional.absent(), false));
+        return createClient(remoteAddress, retryTimer, createClientBootStrap(getKeyMapping(), false));
     }
 
     private synchronized Future<BGPSessionImpl> createClient(final InetSocketAddress remoteAddress,
@@ -94,12 +95,12 @@ public class BGPDispatcherImpl implements BGPDispatcher, AutoCloseable {
     @VisibleForTesting
     public synchronized Future<BGPSessionImpl> createClient(final InetSocketAddress localAddress,
         final InetSocketAddress remoteAddress, final int retryTimer, final boolean reuseAddress) {
-        final Bootstrap clientBootStrap = createClientBootStrap(Optional.absent(), reuseAddress);
+        final Bootstrap clientBootStrap = createClientBootStrap(getKeyMapping(), reuseAddress);
         clientBootStrap.localAddress(localAddress);
         return createClient(remoteAddress, retryTimer, clientBootStrap);
     }
 
-    private synchronized Bootstrap createClientBootStrap(final Optional<KeyMapping> keys, final boolean reuseAddress) {
+    private synchronized Bootstrap createClientBootStrap(final KeyMapping keys, final boolean reuseAddress) {
         final Bootstrap bootstrap = new Bootstrap();
         if (Epoll.isAvailable()) {
             bootstrap.channel(EpollSocketChannel.class);
@@ -107,9 +108,9 @@ public class BGPDispatcherImpl implements BGPDispatcher, AutoCloseable {
         } else {
             bootstrap.channel(NioSocketChannel.class);
         }
-        if (keys.isPresent()) {
+        if (!keys.isEmpty()) {
             if (Epoll.isAvailable()) {
-                bootstrap.option(EpollChannelOption.TCP_MD5SIG, keys.get());
+                bootstrap.option(EpollChannelOption.TCP_MD5SIG, keys);
             } else {
                 throw new UnsupportedOperationException(Epoll.unavailabilityCause().getCause());
             }
@@ -140,13 +141,13 @@ public class BGPDispatcherImpl implements BGPDispatcher, AutoCloseable {
 
     @Override
     public synchronized Future<Void> createReconnectingClient(final InetSocketAddress remoteAddress,
-            final int retryTimer, final Optional<KeyMapping> keys) {
+            final int retryTimer, final KeyMapping keys) {
         return createReconnectingClient(remoteAddress, retryTimer, keys, null, false);
     }
 
     @VisibleForTesting
     protected synchronized Future<Void> createReconnectingClient(final InetSocketAddress remoteAddress,
-        final int retryTimer, final Optional<KeyMapping> keys, final InetSocketAddress localAddress,
+        final int retryTimer, final KeyMapping keys, final InetSocketAddress localAddress,
         final boolean reuseAddress) {
         final BGPClientSessionNegotiatorFactory snf = new BGPClientSessionNegotiatorFactory(this.bgpPeerRegistry);
         final Bootstrap bootstrap = createClientBootStrap(keys, reuseAddress);
index d3de0299d078284866938d3027c00d474c81b8a4..369bc13b886f010242ac4a30d5fecea16b131d77 100644 (file)
@@ -220,7 +220,7 @@ public final class BgpPeer implements PeerBean, BGPPeerStateConsumer, BGPPeerRun
         private final BGPDispatcher dispatcher;
         private final InetSocketAddress inetAddress;
         private final int retryTimer;
-        private final Optional<KeyMapping> key;
+        private final KeyMapping keys;
         private final WriteConfiguration configurationWriter;
         private ClusterSingletonServiceRegistration registration;
         private final BGPPeer bgpPeer;
@@ -247,7 +247,7 @@ public final class BgpPeer implements PeerBean, BGPPeerStateConsumer, BGPPeerRun
             this.dispatcher = rib.getDispatcher();
             this.inetAddress = Ipv4Util.toInetSocketAddress(this.neighborAddress, OpenConfigMappingUtil.getPort(neighbor));
             this.retryTimer = OpenConfigMappingUtil.getRetryTimer(neighbor);
-            this.key = Optional.fromNullable(keyMapping);
+            this.keys = keyMapping;
             this.configurationWriter = configurationWriter;
             this.serviceGroupIdentifier = rib.getRibIServiceGroupIdentifier();
             LOG.info("Peer Singleton Service {} registered", this.serviceGroupIdentifier.getValue());
@@ -273,7 +273,7 @@ public final class BgpPeer implements PeerBean, BGPPeerStateConsumer, BGPPeerRun
             this.bgpPeer.instantiateServiceInstance();
             this.dispatcher.getBGPPeerRegistry().addPeer(this.neighborAddress, this.bgpPeer, this.prefs);
             if (this.activeConnection) {
-                this.connection = this.dispatcher.createReconnectingClient(this.inetAddress, this.retryTimer, this.key);
+                this.connection = this.dispatcher.createReconnectingClient(this.inetAddress, this.retryTimer, this.keys);
             }
         }
 
index 18e40f9559558391885a131099a079cb6da06e5c..376a2ce0003d445565b0da206959a19012fdc7aa 100755 (executable)
@@ -36,7 +36,23 @@ public interface BGPDispatcher{
      * @param keys for TCPMD5
      * @return Future promising a client session
      */
-    Future<Void> createReconnectingClient(InetSocketAddress remoteAddress, int retryTimer, Optional<KeyMapping> keys);
+    @Deprecated
+    default Future<Void> createReconnectingClient(InetSocketAddress remoteAddress, int retryTimer, Optional<KeyMapping> keys) {
+        if(keys.isPresent()) {
+            return createReconnectingClient(remoteAddress, retryTimer, keys.get());
+        }
+        return createReconnectingClient(remoteAddress, retryTimer, KeyMapping.getKeyMapping());
+    }
+
+    /**
+     * Creates Reconnecting client.
+     *
+     * @param remoteAddress remote Peer Address
+     * @param retryTimer Retry timer
+     * @param keys for TCPMD5
+     * @return Future promising a client session
+     */
+    Future<Void> createReconnectingClient(InetSocketAddress remoteAddress, int retryTimer, KeyMapping keys);
 
     /**
      * Create new BGP server to accept incoming bgp connections (bound to provided socket localAddress).
index d1b8a28bdcd850d13103967e30a7b89748b8f335..7731862a507475b1f8481b45e5ccf28493995f60 100755 (executable)
@@ -11,7 +11,6 @@ package org.opendaylight.protocol.bgp.rib.impl;
 import static org.opendaylight.protocol.bgp.rib.impl.CheckUtil.checkIdleState;
 import static org.opendaylight.protocol.util.CheckUtil.waitFutureSuccess;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.Sets;
 import io.netty.channel.Channel;
 import io.netty.util.concurrent.Future;
@@ -20,6 +19,7 @@ import java.util.concurrent.ExecutionException;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.State;
+import org.opendaylight.protocol.concepts.KeyMapping;
 import org.opendaylight.protocol.util.InetSocketAddressUtil;
 
 public class BGPDispatcherImplTest extends AbstractBGPDispatcherTest {
@@ -46,7 +46,7 @@ public class BGPDispatcherImplTest extends AbstractBGPDispatcherTest {
     public void testCreateReconnectingClient() throws Exception {
         final InetSocketAddress serverAddress = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress();
         final Future<Void> future = this.clientDispatcher.createReconnectingClient(serverAddress, RETRY_TIMER,
-            Optional.absent(), this.clientAddress, true);
+            KeyMapping.getKeyMapping(), this.clientAddress, true);
         final Channel serverChannel = createServer(serverAddress);
         Assert.assertEquals(State.UP, this.serverListener.getState());
         Assert.assertTrue(serverChannel.isWritable());
index 437dbe211dec5022ea33132e5c256f566e84fbcd..33839dd9f717b756eb1a4cd31f50a5d3ecaf9d61 100755 (executable)
@@ -15,7 +15,6 @@ import static org.opendaylight.protocol.bgp.rib.impl.AbstractAddPathTest.AS_NUMB
 import static org.opendaylight.protocol.bgp.rib.impl.AbstractAddPathTest.BGP_ID;
 import static org.opendaylight.protocol.util.CheckUtil.readDataOperational;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Throwables;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableList;
@@ -53,6 +52,7 @@ import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBExtensionProviderActivat
 import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
 import org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext;
 import org.opendaylight.protocol.bgp.util.HexDumpBGPFileParser;
+import org.opendaylight.protocol.concepts.KeyMapping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.ipv4.routes.Ipv4Route;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.routes.ipv6.routes.Ipv6Route;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.LinkstateAddressFamily;
@@ -106,7 +106,7 @@ public class ParserToSalTest extends AbstractConcurrentDataBrokerTest {
 
         Mockito.doReturn(GlobalEventExecutor.INSTANCE.newSucceededFuture(null)).when(this.dispatcher)
             .createReconnectingClient(Mockito.any(InetSocketAddress.class), Mockito.anyInt(),
-                Mockito.any(Optional.class));
+                Mockito.any(KeyMapping.class));
 
         this.ext1 = new SimpleRIBExtensionProviderContext();
         this.ext2 = new SimpleRIBExtensionProviderContext();
index 34b11b6e0483ae94a3bb9426c81ae50f1c56a209..348b232d797f839ce819aefb921840270157fa74 100644 (file)
@@ -13,7 +13,6 @@ import static org.mockito.Matchers.anyInt;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 
-import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 import io.netty.util.concurrent.Future;
 import java.net.InetSocketAddress;
@@ -44,6 +43,7 @@ import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
 import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContextRegistry;
 import org.opendaylight.protocol.bgp.rib.impl.stats.rib.impl.BGPRenderStats;
 import org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener;
+import org.opendaylight.protocol.concepts.KeyMapping;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.BgpRib;
@@ -142,7 +142,7 @@ class AbstractConfig {
         Mockito.doReturn(new BgpId("127.0.0.1")).when(this.rib).getBgpIdentifier();
         Mockito.doReturn(true).when(this.future).cancel(true);
         Mockito.doReturn(this.future).when(this.dispatcher)
-            .createReconnectingClient(any(InetSocketAddress.class), anyInt(), any(Optional.class));
+            .createReconnectingClient(any(InetSocketAddress.class), anyInt(), any(KeyMapping.class));
         Mockito.doReturn(this.dispatcher).when(this.rib).getDispatcher();
 
         Mockito.doReturn(java.util.Optional.of(new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class)))
index a46ab18f5f9036018d68017ede13bcd31a743a23..23b0ecf595a6580adca7db93314e7035601d8311 100644 (file)
@@ -17,7 +17,6 @@ import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyInt;
 import static org.mockito.Mockito.times;
 
-import com.google.common.base.Optional;
 import java.math.BigDecimal;
 import java.net.InetSocketAddress;
 import java.util.Collections;
@@ -27,6 +26,7 @@ import org.junit.Test;
 import org.mockito.Mockito;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
+import org.opendaylight.protocol.concepts.KeyMapping;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AddPaths;
@@ -92,7 +92,7 @@ public class BgpPeerTest extends AbstractConfig {
         Mockito.verify(this.configurationWriter).apply();
         Mockito.verify(this.bgpPeerRegistry).addPeer(any(), any(), any());
         Mockito.verify(this.dispatcher).createReconnectingClient(any(InetSocketAddress.class),
-            anyInt(), any(Optional.class));
+            anyInt(), any(KeyMapping.class));
 
         try {
             this.bgpPeer.start(this.rib, neighbor, this.tableTypeRegistry, this.configurationWriter);
index f2db5a5b545f31b7657f323b657d214311dd0bde..e24957b8528573365be02eff579c7194b62b7126 100644 (file)
@@ -23,16 +23,14 @@ public final class KeyMapping extends HashMap<InetAddress, byte[]> {
     }
 
     public static KeyMapping getKeyMapping(@Nonnull final InetAddress inetAddress, @Nullable final String password){
+        final KeyMapping keyMapping = new KeyMapping();
         if (!isNullOrEmpty(password)) {
-            final KeyMapping keyMapping = new KeyMapping();
             keyMapping.put(inetAddress, password.getBytes(StandardCharsets.US_ASCII));
-            return keyMapping;
         }
-        return null;
+        return keyMapping;
     }
 
     public static KeyMapping getKeyMapping(){
-        final KeyMapping keyMapping = new KeyMapping();
-        return keyMapping;
+        return new KeyMapping();
     }
 }
index 1191afa881f74ab4e065b1c7e4f175f88abd4664..2c19298bbc6e4d9d3bdb6a64c15dc30f1a99e1ac 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.protocol.pcep;
 
-import com.google.common.base.Optional;
 import io.netty.channel.ChannelFuture;
 import java.net.InetSocketAddress;
+import java.util.Optional;
 import org.opendaylight.protocol.concepts.KeyMapping;
 
 /**
@@ -24,7 +24,8 @@ public interface PCEPDispatcher {
      * @param peerProposal information used in our Open message
      * @return instance of PCEPServer
      */
-    ChannelFuture createServer(InetSocketAddress address, PCEPSessionListenerFactory listenerFactory, final PCEPPeerProposal peerProposal);
+    ChannelFuture createServer(InetSocketAddress address, PCEPSessionListenerFactory listenerFactory,
+        PCEPPeerProposal peerProposal);
 
     /**
      * Creates server. Each server needs three factories to pass their instances to client sessions.
@@ -35,7 +36,26 @@ public interface PCEPDispatcher {
      * @param peerProposal information used in our Open message
      * @return instance of PCEPServer
      */
-    ChannelFuture createServer(InetSocketAddress address, Optional<KeyMapping> keys, PCEPSessionListenerFactory listenerFactory, PCEPPeerProposal peerProposal);
+    @Deprecated
+    default ChannelFuture createServer(InetSocketAddress address, Optional<KeyMapping> keys,
+        PCEPSessionListenerFactory listenerFactory, PCEPPeerProposal peerProposal) {
+        if(keys.isPresent()) {
+            return createServer(address, keys.get(), listenerFactory, peerProposal);
+        }
+        return createServer(address, KeyMapping.getKeyMapping(), listenerFactory, peerProposal);
+    }
+
+    /**
+     * Creates server. Each server needs three factories to pass their instances to client sessions.
+     *
+     * @param address to be bound with the server
+     * @param keys RFC2385 key mapping
+     * @param listenerFactory to create listeners for clients
+     * @param peerProposal information used in our Open message
+     * @return instance of PCEPServer
+     */
+    ChannelFuture createServer(InetSocketAddress address, KeyMapping keys, PCEPSessionListenerFactory listenerFactory,
+        PCEPPeerProposal peerProposal);
 
     PCEPSessionNegotiatorFactory getPCEPSessionNegotiatorFactory();
 }
index 5924e0a61ef962e43a0588c167e5997dfef168bb..674c308a7bbd100366d36597b2f8ed4dedea4544 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.protocol.pcep.impl;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.buffer.PooledByteBufAllocator;
@@ -53,7 +52,7 @@ public class PCEPDispatcherImpl implements PCEPDispatcher, Closeable {
     private final EventLoopGroup workerGroup;
     private final EventExecutor executor;
     @GuardedBy("this")
-    private Optional<KeyMapping> keys;
+    private KeyMapping keys;
 
     /**
      * Creates an instance of PCEPDispatcherImpl, gets the default selector and opens it.
@@ -81,11 +80,11 @@ public class PCEPDispatcherImpl implements PCEPDispatcher, Closeable {
     @Override
     public final synchronized ChannelFuture createServer(final InetSocketAddress address,
         final PCEPSessionListenerFactory listenerFactory, final PCEPPeerProposal peerProposal) {
-        return createServer(address, Optional.absent(), listenerFactory, peerProposal);
+        return createServer(address, KeyMapping.getKeyMapping(), listenerFactory, peerProposal);
     }
 
     @Override
-    public final synchronized ChannelFuture createServer(final InetSocketAddress address, final Optional<KeyMapping> keys,
+    public final synchronized ChannelFuture createServer(final InetSocketAddress address, final KeyMapping keys,
         final PCEPSessionListenerFactory listenerFactory, final PCEPPeerProposal peerProposal) {
         this.keys = keys;
 
@@ -99,7 +98,7 @@ public class PCEPDispatcherImpl implements PCEPDispatcher, Closeable {
         final ChannelFuture f = b.bind(address);
         LOG.debug("Initiated server {} at {}.", f, address);
 
-        this.keys = Optional.absent();
+        this.keys = KeyMapping.getKeyMapping();
         return f;
     }
 
@@ -121,9 +120,9 @@ public class PCEPDispatcherImpl implements PCEPDispatcher, Closeable {
         } else {
             b.channel(NioServerSocketChannel.class);
         }
-        if (this.keys.isPresent()) {
+        if (!this.keys.isEmpty()) {
             if (Epoll.isAvailable()) {
-                b.option(EpollChannelOption.TCP_MD5SIG, this.keys.get());
+                b.option(EpollChannelOption.TCP_MD5SIG, this.keys);
             } else {
                 throw new UnsupportedOperationException(Epoll.unavailabilityCause().getCause());
             }
index 787d59e934ea4e2621595b81be858b9849cfd526..b6b7e86df464f4474926df83fe8f0c8366ddb3ef 100755 (executable)
@@ -67,11 +67,11 @@ public final class PCCDispatcherImpl implements PCCDispatcher, AutoCloseable {
     @Override
     public Future<PCEPSession> createClient(@Nonnull final InetSocketAddress remoteAddress, final long reconnectTime,
         @Nonnull final PCEPSessionListenerFactory listenerFactory, @Nonnull final PCEPSessionNegotiatorFactory negotiatorFactory,
-        @Nullable final KeyMapping keys, @Nonnull final InetSocketAddress localAddress, @Nonnull final BigInteger dbVersion) {
+        @Nonnull final KeyMapping keys, @Nonnull final InetSocketAddress localAddress, @Nonnull final BigInteger dbVersion) {
         final Bootstrap b = new Bootstrap();
         b.group(this.workerGroup);
         b.localAddress(localAddress);
-        final Optional<KeyMapping> optionalKey = Optional.fromNullable(keys);
+        final KeyMapping optionalKey = keys;
         setChannelFactory(b, optionalKey);
         b.option(ChannelOption.SO_KEEPALIVE, true);
         b.option(ChannelOption.SO_REUSEADDR, true);
@@ -107,16 +107,16 @@ public final class PCCDispatcherImpl implements PCCDispatcher, AutoCloseable {
         return promise;
     }
 
-    private static void setChannelFactory(final Bootstrap bootstrap, final Optional<KeyMapping> keys) {
+    private static void setChannelFactory(final Bootstrap bootstrap, final KeyMapping keys) {
         if (Epoll.isAvailable()) {
             bootstrap.channel(EpollSocketChannel.class);
             bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED);
         } else {
             bootstrap.channel(NioSocketChannel.class);
         }
-        if (keys.isPresent()) {
+        if (!keys.isEmpty()) {
             if (Epoll.isAvailable()) {
-                bootstrap.option(EpollChannelOption.TCP_MD5SIG, keys.get());
+                bootstrap.option(EpollChannelOption.TCP_MD5SIG, keys);
             } else {
                 throw new UnsupportedOperationException(Epoll.unavailabilityCause().getCause());
             }
index 55718ac9bea02b7e78604c2c41e63b0bb65d4742..ebd315a87655380a2a7a21d3a563afe3ee2bf776 100644 (file)
@@ -25,6 +25,7 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
+import org.opendaylight.protocol.concepts.KeyMapping;
 import org.opendaylight.protocol.pcep.PCEPCapability;
 import org.opendaylight.protocol.pcep.PCEPDispatcher;
 import org.opendaylight.protocol.pcep.PCEPSession;
@@ -73,7 +74,7 @@ public class PCCDispatcherImplTest {
     @Test
     public void testClientReconnect() throws Exception {
         final Future<PCEPSession> futureSession = this.dispatcher.createClient(this.serverAddress, 1, new TestingSessionListenerFactory(),
-            this.nf, null, this.clientAddress);
+            this.nf, KeyMapping.getKeyMapping(), this.clientAddress);
         final TestingSessionListenerFactory slf = new TestingSessionListenerFactory();
         final ChannelFuture futureServer = this.pcepDispatcher.createServer(this.serverAddress, slf, null);
         waitFutureSuccess(futureServer);
index 603be76f74995f10df801c436c425745b5592b9b..3ca2ec8abbd91f3d55f15049ef41f8ac04ef0b2c 100644 (file)
@@ -31,6 +31,7 @@ import java.net.InetSocketAddress;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 import org.junit.Before;
+import org.opendaylight.protocol.concepts.KeyMapping;
 import org.opendaylight.protocol.pcep.PCEPCapability;
 import org.opendaylight.protocol.pcep.PCEPDispatcher;
 import org.opendaylight.protocol.pcep.PCEPPeerProposal;
@@ -212,7 +213,7 @@ public abstract class PCCMockCommon {
             () -> {
                 this.pccSessionListener = new PCCSessionListener(1, tunnelManager, false);
                 return this.pccSessionListener;
-            }, snf, null, this.localAddress, dbVersion);
+            }, snf, KeyMapping.getKeyMapping(), this.localAddress, dbVersion);
     }
 
     private PCEPSessionNegotiatorFactory<PCEPSessionImpl> getSessionNegotiatorFactory() {
index 211c7bb07318aac016c441e696970cadbd27d482..d456b48f1c7309f25ee106c54bb24daed6220665 100644 (file)
@@ -13,6 +13,7 @@ import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
+import org.opendaylight.protocol.concepts.KeyMapping;
 import org.opendaylight.protocol.pcep.PCEPCapability;
 import org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactory;
 import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
@@ -34,8 +35,10 @@ public class PCCMock {
             .getPortOrDefault(12345));
         final InetSocketAddress clientAddr = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress(0);
 
-        try (final PCCDispatcherImpl pccDispatcher = new PCCDispatcherImpl(ServiceLoaderPCEPExtensionProviderContext.getSingletonInstance().getMessageHandlerRegistry())) {
-            pccDispatcher.createClient(serverAddr, -1, SimpleSessionListener::new, snf, null, clientAddr).get();
+        try (final PCCDispatcherImpl pccDispatcher = new PCCDispatcherImpl(ServiceLoaderPCEPExtensionProviderContext
+            .getSingletonInstance().getMessageHandlerRegistry())) {
+            pccDispatcher.createClient(serverAddr, -1, SimpleSessionListener::new, snf,
+                KeyMapping.getKeyMapping(), clientAddr).get();
         }
     }
 }
index 8a2045bb697182dcb9aed11f8ada87aaa5999640..5e7b0843de10f5fed2efc9007cda1a26f89ef883 100755 (executable)
@@ -44,7 +44,7 @@ public final class PCEPTopologyProvider extends DefaultTopologyReference {
     private final InstanceIdentifier<Topology> topology;
     private final ServerSessionManager manager;
     private final InetSocketAddress address;
-    private final Optional<KeyMapping> keys;
+    private final KeyMapping keys;
     private final InstructionScheduler scheduler;
     private final PCEPTopologyProviderDependenciesProvider dependenciesProvider;
     private RoutedRpcRegistration<NetworkTopologyPcepProgrammingService> network;
@@ -81,7 +81,7 @@ public final class PCEPTopologyProvider extends DefaultTopologyReference {
             dependenciesProvider, topology, manager,  configDependencies.getSchedulerDependency());
     }
 
-    private PCEPTopologyProvider(final InetSocketAddress address, final Optional<KeyMapping> keys,
+    private PCEPTopologyProvider(final InetSocketAddress address, final KeyMapping keys,
         final PCEPTopologyProviderDependenciesProvider dependenciesProvider,
         final InstanceIdentifier<Topology> topology, final ServerSessionManager manager,
         final InstructionScheduler scheduler) {
index daf54ecf1708fa692a140f9e78977ae45cd25f7a..9c1a55d6de1128c82b89f2ba4ee6e8c7a3d4f7ae 100644 (file)
@@ -18,13 +18,13 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 
 public final class PCEPTopologyConfigDependencies {
     private final InetSocketAddress address;
-    private final Optional<KeyMapping> keys;
+    private final KeyMapping keys;
     private final InstructionScheduler scheduler;
     private final TopologyId topologyId;
     private final Optional<PCEPTopologyProviderRuntimeRegistrator> runtime;
     private final short rpcTimeout;
 
-    public PCEPTopologyConfigDependencies(final InetSocketAddress address, final Optional<KeyMapping> keys,
+    public PCEPTopologyConfigDependencies(final InetSocketAddress address, final KeyMapping keys,
         final InstructionScheduler scheduler, final TopologyId topologyId,
         final Optional<PCEPTopologyProviderRuntimeRegistrator> runtime, final short rpcTimeout) {
         this.address = checkNotNull(address);
@@ -55,7 +55,7 @@ public final class PCEPTopologyConfigDependencies {
         return this.address;
     }
 
-    public Optional<KeyMapping> getKeys() {
+    public KeyMapping getKeys() {
         return this.keys;
     }
 }
index 6ad5771ae3ee49f0b2452e53cf8ce6cf69b259d8..e9cf0bbd68e29689ade1bc58be484ae31fe595f5 100644 (file)
@@ -20,6 +20,25 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
  * The PCEPTopologyDeployer service is managing PcepTopologyProvider
  */
 public interface PCEPTopologyDeployer {
+    /**
+     * Creates and register topology provider instance
+     *  @param topologyId topology ID
+     * @param inetSocketAddress inetSocketAddress
+     * @param rpcTimeout rpc Timeout
+     * @param keys List of clients password configuration
+     * @param scheduler  Instruction Scheduler
+     */
+    @Deprecated
+    default void createTopologyProvider(@Nonnull TopologyId topologyId, @Nonnull InetSocketAddress inetSocketAddress,
+        short rpcTimeout, @Nullable Optional<KeyMapping> keys, @Nonnull InstructionScheduler scheduler,
+        Optional<PCEPTopologyProviderRuntimeRegistrator> runtime) {
+        if(keys.isPresent()) {
+            createTopologyProvider(topologyId, inetSocketAddress, rpcTimeout, keys.get(), scheduler, runtime);
+        }
+        createTopologyProvider(topologyId, inetSocketAddress, rpcTimeout, KeyMapping.getKeyMapping(),
+            scheduler, runtime);
+    }
+
     /**
      * Creates and register topology provider instance
      *  @param topologyId topology ID
@@ -29,7 +48,7 @@ public interface PCEPTopologyDeployer {
      * @param scheduler  Instruction Scheduler
      */
     void createTopologyProvider(@Nonnull TopologyId topologyId, @Nonnull InetSocketAddress inetSocketAddress,
-        short rpcTimeout, @Nullable Optional<KeyMapping> client, @Nonnull InstructionScheduler scheduler,
+        short rpcTimeout, @Nonnull KeyMapping client, @Nonnull InstructionScheduler scheduler,
         Optional<PCEPTopologyProviderRuntimeRegistrator> runtime);
 
     /**
index bb0a9066d4952228f8bc17143721eaef03eeee63..b7575cd6cb839b1abbf700a18787c7ea2ff95923 100644 (file)
@@ -38,7 +38,7 @@ public class PCEPTopologyDeployerImpl implements PCEPTopologyDeployer, AutoClose
 
     @Override
     public synchronized void createTopologyProvider(final TopologyId topologyId,
-        final InetSocketAddress inetSocketAddress, final short rpcTimeout, final Optional<KeyMapping> keys,
+        final InetSocketAddress inetSocketAddress, final short rpcTimeout, final KeyMapping keys,
         final InstructionScheduler schedulerDependency,
         final Optional<PCEPTopologyProviderRuntimeRegistrator> runtime) {
         if (this.pcepTopologyServices.containsKey(topologyId)) {
index f8b705e93161a9e28393f10cb069e0fa8317d5d2..456333f9ff957e536a8b96ebc19f0e32c79985b8 100644 (file)
@@ -7,41 +7,30 @@
  */
 package org.opendaylight.bgpcep.pcep.topology.provider.config;
 
-import com.google.common.base.Optional;
-import com.google.common.net.InetAddresses;
 import java.nio.charset.StandardCharsets;
 import java.util.List;
 import org.opendaylight.controller.config.yang.pcep.topology.provider.Client;
 import org.opendaylight.protocol.concepts.KeyMapping;
-import org.opendaylight.protocol.util.Ipv4Util;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public final class PCEPTopologyProviderUtil {
-    private static final Logger LOG = LoggerFactory.getLogger(PCEPTopologyProviderUtil.class);
-
     private PCEPTopologyProviderUtil() {
         throw new UnsupportedOperationException();
     }
 
-    public static Optional<KeyMapping> contructKeys(final List<Client> clients) {
-        KeyMapping ret = null;
+    public static KeyMapping contructKeys(final List<Client> clients) {
+        final KeyMapping ret = KeyMapping.getKeyMapping();
 
-        if (clients != null && !clients.isEmpty()) {
-            ret = KeyMapping.getKeyMapping();
-            for (final Client c : clients) {
-                if (c.getAddress() == null) {
-                    LOG.warn("Client {} does not have an address skipping it", c);
-                    continue;
-                }
-                final Rfc2385Key rfc2385KeyPassword = c.getPassword();
-                if (rfc2385KeyPassword != null && !rfc2385KeyPassword.getValue().isEmpty()) {
-                    final String s = Ipv4Util.toStringIP(c.getAddress());
-                    ret.put(InetAddresses.forString(s), rfc2385KeyPassword.getValue().getBytes(StandardCharsets.US_ASCII));
-                }
-            }
+        if (clients != null) {
+            clients.stream().filter(client -> client != null && client.getPassword() != null &&
+                !client.getPassword().getValue().isEmpty())
+                .forEach(mr -> {
+                    final Rfc2385Key rfc2385KeyPassword = mr.getPassword();
+                    ret.put(IetfInetUtil.INSTANCE.inetAddressFor(mr.getAddress()),
+                        rfc2385KeyPassword.getValue().getBytes(StandardCharsets.US_ASCII));
+                });
         }
-        return Optional.fromNullable(ret);
+        return ret;
     }
 }
index 150163cb0df5c268ab97362ee3ec960d8030209a..95fdb21e50da8f003b1f1df233264421c7df803e 100755 (executable)
@@ -68,8 +68,8 @@ public final class PCEPTopologyProviderModule extends
         JmxAttributeValidationException.checkNotNull(getStatefulPlugin(), IS_NOT_SET, statefulPluginJmxAttribute);
         JmxAttributeValidationException.checkNotNull(getRpcTimeout(), IS_NOT_SET, rpcTimeoutJmxAttribute);
 
-        final Optional<KeyMapping> keys = contructKeys(getClient());
-        if (keys.isPresent()) {
+        final KeyMapping keys = contructKeys(getClient());
+        if (!keys.isEmpty()) {
             JmxAttributeValidationException.checkCondition(Epoll.isAvailable(), NATIVE_TRANSPORT_NOT_AVAILABLE,
                 clientJmxAttribute);
         }
@@ -93,7 +93,7 @@ public final class PCEPTopologyProviderModule extends
             .waitForService(WaitingServiceTracker.FIVE_MINUTES);
 
         final TopologyId topologyID = getTopologyId();
-        final com.google.common.base.Optional<KeyMapping> keys = contructKeys(getClient());
+        final KeyMapping keys = contructKeys(getClient());
 
         final InetSocketAddress inetSocketAddress = new InetSocketAddress(listenAddress(), getListenPort().getValue());