BUG-7706: Fix ServiceUnavailableException
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / spi / BGPDispatcher.java
old mode 100644 (file)
new mode 100755 (executable)
index f474def..18e40f9
@@ -7,32 +7,49 @@
  */
 package org.opendaylight.protocol.bgp.rib.impl.spi;
 
+import com.google.common.base.Optional;
+import io.netty.channel.ChannelFuture;
 import io.netty.util.concurrent.Future;
-
 import java.net.InetSocketAddress;
-
-import org.opendaylight.protocol.bgp.parser.BGPSession;
-import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
-import org.opendaylight.protocol.framework.ReconnectStrategy;
-import org.opendaylight.protocol.framework.ReconnectStrategyFactory;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
+import org.opendaylight.protocol.bgp.rib.spi.BGPSession;
+import org.opendaylight.protocol.concepts.KeyMapping;
 
 /**
  * Dispatcher class for creating BGP clients.
  */
-public interface BGPDispatcher {
+public interface BGPDispatcher{
+
+    /**
+     * Creates BGP client.
+     *
+     * @param remoteAddress remote Peer address
+     * @param retryTimer Retry timer
+     * @return Future promising a client session
+     */
+    Future<? extends BGPSession> createClient(InetSocketAddress remoteAddress, int retryTimer);
+
+    /**
+     * 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, Optional<KeyMapping> keys);
 
-       /**
-        * Creates BGP client.
-        * 
-        * @param address Peer address
-        * @param preferences connection attributes required for connection
-        * @param listener BGP message listener
-        * @return Future promising a client session
-        */
-       Future<? extends BGPSession> createClient(InetSocketAddress address, BGPSessionPreferences preferences, AsNumber remoteAs,
-                       BGPSessionListener listener, ReconnectStrategy strategy);
+    /**
+     * Create new BGP server to accept incoming bgp connections (bound to provided socket localAddress).
+     *
+     * @param localAddress Peer localAddress
+     *
+     * @return ChannelFuture promising a client session
+     */
+    ChannelFuture createServer(InetSocketAddress localAddress);
 
-       Future<Void> createReconnectingClient(InetSocketAddress address, BGPSessionPreferences preferences, AsNumber remoteAs,
-                       BGPSessionListener listener, ReconnectStrategyFactory connectStrategyFactory, ReconnectStrategy reestablishStrategy);
+    /**
+     * Return BGP Peer Registry
+     * @return BGPPeerRegistry
+     */
+    BGPPeerRegistry getBGPPeerRegistry();
 }