public final class BGPPeerAcceptorImpl implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(BGPPeerAcceptorImpl.class);
private static final int PRIVILEGED_PORTS = 1024;
- private final BGPPeerRegistry peerRegistry;
private final BGPDispatcher bgpDispatcher;
private final InetSocketAddress address;
private ChannelFuture futureChannel;
private AutoCloseable listenerRegistration;
public BGPPeerAcceptorImpl(final IpAddress bindingAddress, final PortNumber portNumber,
- final BGPPeerRegistry peerRegistry, final BGPDispatcher bgpDispatcher) {
- this.peerRegistry = Preconditions.checkNotNull(peerRegistry);
+ final BGPDispatcher bgpDispatcher) {
this.bgpDispatcher = Preconditions.checkNotNull(bgpDispatcher);
this.address = getAddress(Preconditions.checkNotNull(bindingAddress), Preconditions.checkNotNull(portNumber));
if (!PlatformDependent.isWindows() && !PlatformDependent.isRoot()
public void start() {
LOG.debug("Instantiating BGP Peer Acceptor : {}", this.address);
- this.futureChannel = this.bgpDispatcher.createServer(this.peerRegistry, this.address);
+ this.futureChannel = this.bgpDispatcher.createServer(this.address);
// Validate future success
this.futureChannel.addListener(future -> {
Preconditions.checkArgument(future.isSuccess(), "Unable to start bgp server on %s",
this.address, future.cause());
final Channel channel = this.futureChannel.channel();
if (Epoll.isAvailable()) {
- this.listenerRegistration = this.peerRegistry.registerPeerRegisterListener(
+ this.listenerRegistration = this.bgpDispatcher.getBGPPeerRegistry().registerPeerRegisterListener(
new BGPPeerAcceptorImpl.PeerRegistryListenerImpl(channel.config()));
}
});
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
- <reference id="BGPPeerRegistry" interface="org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry"/>
<reference id="BGPDispatcher" interface="org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher"/>
<odl:clustered-app-config id="bgpPeerAcceptorConfig"
<argument>
<bean factory-ref="bgpPeerAcceptorConfig" factory-method="getBindingPort"/>
</argument>
- <argument ref="BGPPeerRegistry"/>
<argument ref="BGPDispatcher"/>
</bean>
</blueprint>
\ No newline at end of file
this.registry.addPeer(serverIpAddress, this.serverListener, createPreferences(inetServerAddress));
final BGPPeerAcceptorImpl bgpPeerAcceptor = new BGPPeerAcceptorImpl(serverIpAddress, portNumber,
- this.registry, this.serverDispatcher);
+ this.serverDispatcher);
bgpPeerAcceptor.start();
final Future<BGPSessionImpl> futureClient = this.clientDispatcher
- .createClient(this.clientAddress, inetServerAddress, this.registry, 2, true);
+ .createClient(this.clientAddress, inetServerAddress, 2, true);
waitFutureSuccess(futureClient);
final BGPSessionImpl session = futureClient.get();
Assert.assertEquals(State.UP, this.clientListener.getState());
private final BGPHandlerFactory handlerFactory;
private final EventLoopGroup bossGroup;
private final EventLoopGroup workerGroup;
+ private final BGPPeerRegistry bgpPeerRegistry;
- public BGPDispatcherImpl(final MessageRegistry messageRegistry, final EventLoopGroup bossGroup, final EventLoopGroup workerGroup) {
+ public BGPDispatcherImpl(final MessageRegistry messageRegistry, final EventLoopGroup bossGroup,
+ final EventLoopGroup workerGroup, final BGPPeerRegistry bgpPeerRegistry) {
if (Epoll.isAvailable()) {
this.bossGroup = new EpollEventLoopGroup();
this.workerGroup = new EpollEventLoopGroup();
this.bossGroup = Preconditions.checkNotNull(bossGroup);
this.workerGroup = Preconditions.checkNotNull(workerGroup);
}
+ this.bgpPeerRegistry = Preconditions.checkNotNull(bgpPeerRegistry);
this.handlerFactory = new BGPHandlerFactory(messageRegistry);
}
@Override
- public synchronized Future<BGPSessionImpl> createClient(final InetSocketAddress remoteAddress, final BGPPeerRegistry listener, final int retryTimer) {
- return createClient(remoteAddress, listener, retryTimer, createClientBootStrap(Optional.absent(), false));
+ public synchronized Future<BGPSessionImpl> createClient(final InetSocketAddress remoteAddress, final int retryTimer) {
+ return createClient(remoteAddress, retryTimer, createClientBootStrap(Optional.absent(), false));
}
- private synchronized Future<BGPSessionImpl> createClient(final InetSocketAddress remoteAddress, final BGPPeerRegistry listener, final int retryTimer,
- final Bootstrap clientBootStrap) {
- final BGPClientSessionNegotiatorFactory snf = new BGPClientSessionNegotiatorFactory(listener);
+ private synchronized Future<BGPSessionImpl> createClient(final InetSocketAddress remoteAddress,
+ final int retryTimer, final Bootstrap clientBootStrap) {
+ final BGPClientSessionNegotiatorFactory snf = new BGPClientSessionNegotiatorFactory(this.bgpPeerRegistry);
final ChannelPipelineInitializer initializer = BGPChannel.createChannelPipelineInitializer(this.handlerFactory, snf);
- final BGPProtocolSessionPromise sessionPromise = new BGPProtocolSessionPromise(remoteAddress, retryTimer, clientBootStrap, listener);
+ final BGPProtocolSessionPromise sessionPromise = new BGPProtocolSessionPromise(remoteAddress, retryTimer,
+ clientBootStrap, this.bgpPeerRegistry);
clientBootStrap.handler(BGPChannel.createClientChannelHandler(initializer, sessionPromise));
sessionPromise.connect();
LOG.debug("Client created.");
}
@VisibleForTesting
- public synchronized Future<BGPSessionImpl> createClient(final InetSocketAddress localAddress, final InetSocketAddress remoteAddress,
- final BGPPeerRegistry strictBGPPeerRegistry, final int retryTimer, final boolean reuseAddress) {
+ public synchronized Future<BGPSessionImpl> createClient(final InetSocketAddress localAddress,
+ final InetSocketAddress remoteAddress, final int retryTimer, final boolean reuseAddress) {
final Bootstrap clientBootStrap = createClientBootStrap(Optional.absent(), reuseAddress);
clientBootStrap.localAddress(localAddress);
- return createClient(remoteAddress, strictBGPPeerRegistry, retryTimer, clientBootStrap);
+ return createClient(remoteAddress, retryTimer, clientBootStrap);
}
private synchronized Bootstrap createClientBootStrap(final Optional<KeyMapping> keys, final boolean reuseAddress) {
}
@Override
- public synchronized Future<Void> createReconnectingClient(final InetSocketAddress remoteAddress, final BGPPeerRegistry peerRegistry,
+ public synchronized Future<Void> createReconnectingClient(final InetSocketAddress remoteAddress,
final int retryTimer, final Optional<KeyMapping> keys) {
- return createReconnectingClient(remoteAddress, peerRegistry, retryTimer, keys, null, false);
+ return createReconnectingClient(remoteAddress, retryTimer, keys, null, false);
}
@VisibleForTesting
- protected synchronized Future<Void> createReconnectingClient(final InetSocketAddress remoteAddress, final BGPPeerRegistry peerRegistry,
- final int retryTimer, final Optional<KeyMapping> keys, final InetSocketAddress localAddress, final boolean reuseAddress) {
- final BGPClientSessionNegotiatorFactory snf = new BGPClientSessionNegotiatorFactory(peerRegistry);
+ protected synchronized Future<Void> createReconnectingClient(final InetSocketAddress remoteAddress,
+ final int retryTimer, final Optional<KeyMapping> keys, final InetSocketAddress localAddress,
+ final boolean reuseAddress) {
+ final BGPClientSessionNegotiatorFactory snf = new BGPClientSessionNegotiatorFactory(this.bgpPeerRegistry);
final Bootstrap bootstrap = createClientBootStrap(keys, reuseAddress);
bootstrap.localAddress(localAddress);
- final BGPReconnectPromise reconnectPromise = new BGPReconnectPromise(GlobalEventExecutor.INSTANCE, remoteAddress,
- retryTimer, bootstrap, peerRegistry, BGPChannel.createChannelPipelineInitializer(this.handlerFactory, snf));
+ final BGPReconnectPromise reconnectPromise = new BGPReconnectPromise(GlobalEventExecutor.INSTANCE,
+ remoteAddress, retryTimer, bootstrap, this.bgpPeerRegistry,
+ BGPChannel.createChannelPipelineInitializer(this.handlerFactory, snf));
reconnectPromise.connect();
return reconnectPromise;
}
@Override
- public synchronized ChannelFuture createServer(final BGPPeerRegistry registry, final InetSocketAddress serverAddress) {
- final BGPServerSessionNegotiatorFactory snf = new BGPServerSessionNegotiatorFactory(registry);
+ public synchronized ChannelFuture createServer(final InetSocketAddress serverAddress) {
+ final BGPServerSessionNegotiatorFactory snf = new BGPServerSessionNegotiatorFactory(this.bgpPeerRegistry);
final ChannelPipelineInitializer initializer = BGPChannel.createChannelPipelineInitializer(this.handlerFactory, snf);
final ServerBootstrap serverBootstrap = createServerBootstrap(initializer);
final ChannelFuture channelFuture = serverBootstrap.bind(serverAddress);
return channelFuture;
}
+ @Override
+ public BGPPeerRegistry getBGPPeerRegistry() {
+ return this.bgpPeerRegistry;
+ }
+
private synchronized ServerBootstrap createServerBootstrap(final ChannelPipelineInitializer initializer) {
final ServerBootstrap serverBootstrap = new ServerBootstrap();
if (Epoll.isAvailable()) {
private static final Logger LOG = LoggerFactory.getLogger(BgpPeer.class);
private final RpcProviderRegistry rpcRegistry;
- private final BGPPeerRegistry peerRegistry;
private ServiceRegistration<?> serviceRegistration;
private Neighbor currentConfiguration;
private BgpPeerSingletonService bgpPeerSingletonService;
- public BgpPeer(final RpcProviderRegistry rpcRegistry, final BGPPeerRegistry peerRegistry) {
+ public BgpPeer(final RpcProviderRegistry rpcRegistry) {
this.rpcRegistry = rpcRegistry;
- this.peerRegistry = peerRegistry;
}
@Override
}
LOG.info("Peer Singleton Service {} instantiated", getIdentifier().getValue());
this.bgpPeer.instantiateServiceInstance();
- BgpPeer.this.peerRegistry.addPeer(this.neighborAddress, this.bgpPeer, this.prefs);
+ this.dispatcher.getBGPPeerRegistry().addPeer(this.neighborAddress, this.bgpPeer, this.prefs);
if (this.activeConnection) {
- this.connection = this.dispatcher.createReconnectingClient(this.inetAddress, BgpPeer.this.peerRegistry,
- this.retryTimer, this.key);
+ this.connection = this.dispatcher.createReconnectingClient(this.inetAddress, this.retryTimer, this.key);
}
}
}
this.bgpPeer.close();
if(BgpPeer.this.currentConfiguration != null) {
- BgpPeer.this.peerRegistry.removePeer(BgpPeer.this.currentConfiguration.getNeighborAddress());
+ this.dispatcher.getBGPPeerRegistry().removePeer(BgpPeer.this.currentConfiguration.getNeighborAddress());
}
return Futures.immediateFuture(null);
}
* Creates BGP client.
*
* @param remoteAddress remote Peer address
- * @param peerRegistry BGP peer registry
* @param retryTimer Retry timer
* @return Future promising a client session
*/
- Future<? extends BGPSession> createClient(InetSocketAddress remoteAddress, BGPPeerRegistry peerRegistry, int retryTimer);
+ Future<? extends BGPSession> createClient(InetSocketAddress remoteAddress, int retryTimer);
/**
* Creates Reconnecting client.
*
* @param remoteAddress remote Peer Address
- * @param peerRegistry BGP peer registry
* @param retryTimer Retry timer
* @param keys for TCPMD5
* @return Future promising a client session
*/
- Future<Void> createReconnectingClient(InetSocketAddress remoteAddress,
- BGPPeerRegistry peerRegistry, int retryTimer, Optional<KeyMapping> keys);
+ Future<Void> createReconnectingClient(InetSocketAddress remoteAddress, int retryTimer, Optional<KeyMapping> keys);
/**
* Create new BGP server to accept incoming bgp connections (bound to provided socket localAddress).
*
- * @param peerRegistry BGP peer registry
* @param localAddress Peer localAddress
*
* @return ChannelFuture promising a client session
*/
- ChannelFuture createServer(BGPPeerRegistry peerRegistry, InetSocketAddress localAddress);
+ ChannelFuture createServer(InetSocketAddress localAddress);
+
+ /**
+ * Return BGP Peer Registry
+ * @return BGPPeerRegistry
+ */
+ BGPPeerRegistry getBGPPeerRegistry();
}
<reference id="globalWorkerGroup" interface="io.netty.channel.EventLoopGroup" odl:type="global-worker-group"/>
<reference id="clusterSingletonServiceProvider" interface="org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider"/>
+ <bean id="BGPPeerRegistry" class="org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry"
+ factory-method="instance" destroy-method="close"/>
+
+ <service ref="BGPPeerRegistry" interface="org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry"
+ odl:type="default">
+ <!-- The following service properties specify the config system module and instance that correspond to
+ this OSGi service which enables the config system module to be restarted when this blueprint
+ container is restarted. -->
+ <service-properties>
+ <entry key="config-module-namespace" value="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl"/>
+ <entry key="config-module-name" value="strict-bgp-peer-registry"/>
+ <entry key="config-instance-name" value="global-bgp-peer-registry"/>
+ </service-properties>
+ </service>
+
<bean id="BGPDispatcher" class="org.opendaylight.protocol.bgp.rib.impl.BGPDispatcherImpl" destroy-method="close">
<argument>
<bean factory-ref="BGPExtensionContext" factory-method="getMessageRegistry"/>
</argument>
<argument ref="globalBossGroup"/>
<argument ref="globalWorkerGroup"/>
+ <argument ref="BGPPeerRegistry"/>
</bean>
<service ref="BGPDispatcher" interface="org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher">
</service-properties>
</service>
- <bean id="BGPPeerRegistry" class="org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry"
- factory-method="instance" destroy-method="close"/>
-
- <service ref="BGPPeerRegistry" interface="org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry"
- odl:type="default">
- <!-- The following service properties specify the config system module and instance that correspond to
- this OSGi service which enables the config system module to be restarted when this blueprint
- container is restarted. -->
- <service-properties>
- <entry key="config-module-namespace" value="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl"/>
- <entry key="config-module-name" value="strict-bgp-peer-registry"/>
- <entry key="config-instance-name" value="global-bgp-peer-registry"/>
- </service-properties>
- </service>
-
<reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" odl:type="pingpong"/>
<reference id="globalBgpExtensions" interface="org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext"/>
<reference id="codecTreeFactory" interface="org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeFactory"/>
<bean id="bgpPeer" class="org.opendaylight.protocol.bgp.rib.impl.config.BgpPeer" scope="prototype">
<argument ref="rpcRegistry"/>
- <argument ref="BGPPeerRegistry"/>
</bean>
<bean id="appPeer" class="org.opendaylight.protocol.bgp.rib.impl.config.AppPeer" scope="prototype"/>
setupMockService(DOMMountPointService.class, mock(DOMMountPointService.class));
setupMockService(BGPDispatcher.class, this.mockedBGPDispatcher);
- doReturn(new SucceededFuture<>(ImmediateEventExecutor.INSTANCE, null)).when(this.mockedBGPDispatcher).createReconnectingClient(
- any(InetSocketAddress.class), any(BGPPeerRegistry.class), anyInt(), any(Optional.class));
+ doReturn(new SucceededFuture<>(ImmediateEventExecutor.INSTANCE, null)).when(this.mockedBGPDispatcher)
+ .createReconnectingClient(any(InetSocketAddress.class), anyInt(), any(Optional.class));
setupMockService(BgpDeployer.class, this.bgpDeployer);
final Global global = mock(Global.class);
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
-import com.google.common.net.InetAddresses;
import io.netty.channel.epoll.Epoll;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.util.concurrent.Future;
import org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
-import org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
import org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext;
import org.opendaylight.protocol.util.InetSocketAddressUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.BgpRib;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.rib.Peer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
@Mock
protected ClusterSingletonServiceProvider clusterSingletonServiceProvider;
BindingToNormalizedNodeCodec mappingService;
- BGPDispatcherImpl dispatcher;
+ BGPDispatcherImpl serverDispatcher;
RIBExtensionProviderContext ribExtension;
private RIBActivator ribActivator;
private BGPActivator bgpActivator;
private NioEventLoopGroup worker;
private NioEventLoopGroup boss;
private org.opendaylight.protocol.bgp.inet.BGPActivator inetActivator;
+ protected StrictBGPPeerRegistry serverRegistry;
@Before
public void setUp() throws Exception {
this.worker = new NioEventLoopGroup();
this.boss = new NioEventLoopGroup();
}
- this.dispatcher = new BGPDispatcherImpl(this.context.getMessageRegistry(), this.boss, this.worker);
+ this.serverRegistry = new StrictBGPPeerRegistry();
+ this.serverDispatcher = new BGPDispatcherImpl(this.context.getMessageRegistry(), this.boss, this.worker,
+ this.serverRegistry);
doReturn(Mockito.mock(ClusterSingletonServiceRegistration.class)).when(this.clusterSingletonServiceProvider)
.registerClusterSingletonService(any(ClusterSingletonService.class));
}
@After
public void tearDown() throws ExecutionException, InterruptedException {
- this.dispatcher.close();
+ this.serverDispatcher.close();
if (!Epoll.isAvailable()) {
this.worker.shutdownGracefully(0, 0, TimeUnit.SECONDS);
this.boss.shutdownGracefully(0, 0, TimeUnit.SECONDS);
});
}
- BGPSessionImpl createPeerSession(final Ipv4Address peer, final BgpParameters nonAddPathParams,
- final SimpleSessionListener sessionListener) throws InterruptedException, ExecutionException {
- return connectPeer(peer, nonAddPathParams, this.dispatcher, sessionListener);
- }
+ BGPSessionImpl createPeerSession(final Ipv4Address peer, final BgpParameters bgpParameters,
+ final SimpleSessionListener sessionListener) throws InterruptedException {
+ StrictBGPPeerRegistry clientRegistry = new StrictBGPPeerRegistry();
+ BGPDispatcherImpl clientDispatcher = new BGPDispatcherImpl(this.context.getMessageRegistry(), this.boss,
+ this.worker, clientRegistry);
+ clientRegistry.addPeer(new IpAddress(new Ipv4Address(RIB_ID)), sessionListener,
+ new BGPSessionPreferences(AS_NUMBER, HOLDTIMER, new BgpId(peer),
+ AS_NUMBER, Lists.newArrayList(bgpParameters), Optional.absent()));
- private static int getPeerRibOutSize(final Peer peer) {
- return ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.bgp.rib.rib.peer.adj.rib.out.tables.routes.Ipv4RoutesCase) peer.getAdjRibOut().getTables().get(0).getRoutes()).getIpv4Routes().getIpv4Route().size();
+ return connectPeer(peer, clientDispatcher);
}
- protected static BGPPeer configurePeer(final Ipv4Address localAddress, final RIBImpl ribImpl, final BgpParameters bgpParameters, final PeerRole peerRole) {
- final IpAddress ipAddress = new IpAddress(new Ipv4Address(InetAddresses.forString(localAddress.getValue())
- .getHostAddress()));
-
+ protected static BGPPeer configurePeer(final Ipv4Address peerAddress, final RIBImpl ribImpl,
+ final BgpParameters bgpParameters, final PeerRole peerRole, BGPPeerRegistry bgpPeerRegistry) {
+ final IpAddress ipAddress = new IpAddress(peerAddress);
- final BGPPeer bgpPeer = new BGPPeer(localAddress.getValue(), ribImpl, peerRole, null, AFI_SAFIS_ADVERTIZED,
- Collections.emptySet());
+ final BGPPeer bgpPeer = new BGPPeer(peerAddress.getValue(), ribImpl, peerRole, null,
+ AFI_SAFIS_ADVERTIZED, Collections.emptySet());
final List<BgpParameters> tlvs = Lists.newArrayList(bgpParameters);
- StrictBGPPeerRegistry.GLOBAL.addPeer(ipAddress, bgpPeer,
+ bgpPeerRegistry.addPeer(ipAddress, bgpPeer,
new BGPSessionPreferences(AS_NUMBER, HOLDTIMER, new BgpId(RIB_ID), AS_NUMBER, tlvs, Optional.absent()));
bgpPeer.instantiateServiceInstance();
return bgpPeer;
}
- private static BGPSessionImpl connectPeer(final Ipv4Address localAddress, final BgpParameters bgpParameters,
- final BGPDispatcherImpl dispatcherImpl, final BGPSessionListener sessionListener) throws InterruptedException {
- final BGPPeerRegistry peerRegistry = new StrictBGPPeerRegistry();
- peerRegistry.addPeer(new IpAddress(new Ipv4Address(RIB_ID)), sessionListener,
- new BGPSessionPreferences(AS_NUMBER, HOLDTIMER, new BgpId(localAddress),
- AS_NUMBER, Lists.newArrayList(bgpParameters), Optional.absent()));
-
+ private static BGPSessionImpl connectPeer(final Ipv4Address localAddress, final BGPDispatcherImpl dispatcherImpl)
+ throws InterruptedException {
final Future<BGPSessionImpl> future = dispatcherImpl.createClient(new InetSocketAddress(localAddress.getValue(), PORT),
- new InetSocketAddress(RIB_ID, PORT), peerRegistry, RETRY_TIMER, true);
+ new InetSocketAddress(RIB_ID, PORT), RETRY_TIMER, true);
Thread.sleep(200);
waitFutureSuccess(future);
- final BGPSessionImpl client = future.getNow();
- return client;
+ return future.getNow();
}
protected static BgpParameters createParameter(final boolean addPath) {
public class AbstractBGPDispatcherTest {
protected static final AsNumber AS_NUMBER = new AsNumber(30L);
protected static final int RETRY_TIMER = 1;
- protected static final BgpTableType IPV_4_TT = new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
+ protected static final BgpTableType IPV_4_TT = new BgpTableTypeImpl(Ipv4AddressFamily.class,
+ UnicastSubsequentAddressFamily.class);
private static final short HOLD_TIMER = 30;
protected BGPDispatcherImpl clientDispatcher;
protected BGPPeerRegistry registry;
this.clientListener = new SimpleSessionListener();
this.serverListener = new SimpleSessionListener();
final BGPExtensionProviderContext ctx = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance();
- this.serverDispatcher = new BGPDispatcherImpl(ctx.getMessageRegistry(), this.boss, this.worker);
+ this.serverDispatcher = new BGPDispatcherImpl(ctx.getMessageRegistry(), this.boss, this.worker, this.registry);
this.clientAddress = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress();
final IpAddress clientPeerIp = new IpAddress(new Ipv4Address(this.clientAddress.getAddress().getHostAddress()));
this.registry.addPeer(clientPeerIp, this.clientListener, createPreferences(this.clientAddress));
- this.clientDispatcher = new BGPDispatcherImpl(ctx.getMessageRegistry(), this.boss, this.worker);
+ this.clientDispatcher = new BGPDispatcherImpl(ctx.getMessageRegistry(), this.boss, this.worker, this.registry);
}
@After
return new BGPSessionPreferences(AS_NUMBER, HOLD_TIMER, bgpId, AS_NUMBER, tlvs, Optional.absent());
}
- public static void checkIdleState(final SimpleSessionListener listener) {
+ protected static void checkIdleState(final SimpleSessionListener listener) {
final Stopwatch sw = Stopwatch.createStarted();
while (sw.elapsed(TimeUnit.SECONDS) <= 10) {
if (State.IDLE != listener.getState()) {
}
protected Channel createServer(final InetSocketAddress serverAddress) throws InterruptedException {
- this.registry.addPeer(new IpAddress(new Ipv4Address(serverAddress.getAddress().getHostAddress())), this.serverListener, createPreferences(serverAddress));
+ this.registry.addPeer(new IpAddress(new Ipv4Address(serverAddress.getAddress().getHostAddress())),
+ this.serverListener, createPreferences(serverAddress));
LoggerFactory.getLogger(AbstractBGPDispatcherTest.class).info("createServer");
- final ChannelFuture future = this.serverDispatcher.createServer(this.registry, serverAddress);
- future.addListener(future1 -> Preconditions.checkArgument(future1.isSuccess(), "Unable to start bgp server on %s", future1.cause()));
+ final ChannelFuture future = this.serverDispatcher.createServer(serverAddress);
+ future.addListener(future1 -> Preconditions.checkArgument(future1.isSuccess(),
+ "Unable to start bgp server on %s", future1.cause()));
waitFutureSuccess(future);
return future.channel();
}
final Map<TablesKey, PathSelectionMode> pathTables = ImmutableMap.of(TABLES_KEY, new AllPathSelection());
this.ribImpl = new RIBImpl(this.clusterSingletonServiceProvider, new RibId("test-rib"),
- AS_NUMBER, BGP_ID, null, this.ribExtension, this.dispatcher, this.mappingService.getCodecFactory(),
+ AS_NUMBER, BGP_ID, null, this.ribExtension, this.serverDispatcher, this.mappingService.getCodecFactory(),
getDomBroker(), TABLES_TYPE, pathTables, this.ribExtension.getClassLoadingStrategy(), null);
this.ribImpl.instantiateServiceInstance();
this.ribImpl.onGlobalContextUpdated(this.schemaContext);
- final ChannelFuture channelFuture = this.dispatcher.createServer(StrictBGPPeerRegistry.GLOBAL,
- new InetSocketAddress(RIB_ID, PORT));
+ final ChannelFuture channelFuture = this.serverDispatcher.createServer(new InetSocketAddress(RIB_ID, PORT));
waitFutureSuccess(channelFuture);
this.serverChannel = channelFuture.channel();
}
final BgpParameters nonAddPathParams = createParameter(false);
final BgpParameters addPathParams = createParameter(true);
- final BGPPeer peer1 = configurePeer(PEER1, this.ribImpl, nonAddPathParams, PeerRole.Ibgp);
+ final BGPPeer peer1 = configurePeer(PEER1, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
final BGPSessionImpl session1 = createPeerSession(PEER1, nonAddPathParams, new SimpleSessionListener());
- configurePeer(PEER2, this.ribImpl, nonAddPathParams, PeerRole.Ibgp);
+ configurePeer(PEER2, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
final BGPSessionImpl session2 = createPeerSession(PEER2, nonAddPathParams, new SimpleSessionListener());
- configurePeer(PEER3, this.ribImpl, nonAddPathParams, PeerRole.Ibgp);
+ configurePeer(PEER3, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
final BGPSessionImpl session3 = createPeerSession(PEER3, nonAddPathParams, new SimpleSessionListener());
final SimpleSessionListener listener4 = new SimpleSessionListener();
- final BGPPeer peer4 = configurePeer(PEER4, this.ribImpl, nonAddPathParams, PeerRole.RrClient);
+ final BGPPeer peer4 = configurePeer(PEER4, this.ribImpl, nonAddPathParams, PeerRole.RrClient, this.serverRegistry);
BGPPeerState peer4State = peer4.getPeerState();
assertNull(peer4State.getGroupId());
final BGPSessionImpl session4 = createPeerSession(PEER4, nonAddPathParams, listener4);
final SimpleSessionListener listener5 = new SimpleSessionListener();
- configurePeer(PEER5, this.ribImpl, addPathParams, PeerRole.RrClient);
+ configurePeer(PEER5, this.ribImpl, addPathParams, PeerRole.RrClient, this.serverRegistry);
final BGPSessionImpl session5 = createPeerSession(PEER5, addPathParams, listener5);
checkPeersPresentOnDataStore(5);
assertEquals(1L, ribState.getTotalPrefixesCount());
final SimpleSessionListener listener6 = new SimpleSessionListener();
- final BGPPeer peer6 = configurePeer(PEER6, this.ribImpl, nonAddPathParams, PeerRole.RrClient);
+ final BGPPeer peer6 = configurePeer(PEER6, this.ribImpl, nonAddPathParams, PeerRole.RrClient, this.serverRegistry);
final BGPSessionImpl session6 = createPeerSession(PEER6, nonAddPathParams, listener6);
checkPeersPresentOnDataStore(6);
checkReceivedMessages(listener6, 1);
BasePathSelectionModeFactory.createBestPathSelectionStrategy());
this.ribImpl = new RIBImpl(this.clusterSingletonServiceProvider, new RibId("test-rib"),
- AS_NUMBER, new BgpId(RIB_ID), null, this.ribExtension, this.dispatcher,
+ AS_NUMBER, new BgpId(RIB_ID), null, this.ribExtension, this.serverDispatcher,
this.mappingService.getCodecFactory(), getDomBroker(), TABLES_TYPE, pathTables,
this.ribExtension.getClassLoadingStrategy(), null);
this.ribImpl.instantiateServiceInstance();
this.ribImpl.onGlobalContextUpdated(this.schemaContext);
- final ChannelFuture channelFuture = this.dispatcher.createServer(StrictBGPPeerRegistry.GLOBAL,
- new InetSocketAddress(RIB_ID, PORT));
+ final ChannelFuture channelFuture = this.serverDispatcher.createServer(new InetSocketAddress(RIB_ID, PORT));
waitFutureSuccess(channelFuture);
this.serverChannel = channelFuture.channel();
}
public void testUseCase1() throws Exception {
final BgpParameters nonAddPathParams = createParameter(false);
- configurePeer(PEER1, this.ribImpl, nonAddPathParams, PeerRole.Ibgp);
+ configurePeer(PEER1, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
final BGPSessionImpl session1 = createPeerSession(PEER1, nonAddPathParams, new SimpleSessionListener());
- configurePeer(PEER2, this.ribImpl, nonAddPathParams, PeerRole.Ibgp);
+ configurePeer(PEER2, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
final BGPSessionImpl session2 = createPeerSession(PEER2, nonAddPathParams, new SimpleSessionListener());
- configurePeer(PEER3, this.ribImpl, nonAddPathParams, PeerRole.Ibgp);
+ configurePeer(PEER3, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
final BGPSessionImpl session3 = createPeerSession(PEER3,nonAddPathParams, new SimpleSessionListener());
final SimpleSessionListener listener4 = new SimpleSessionListener();
- configurePeer(PEER4, this.ribImpl, nonAddPathParams, PeerRole.RrClient);
+ configurePeer(PEER4, this.ribImpl, nonAddPathParams, PeerRole.RrClient, this.serverRegistry);
final BGPSessionImpl session4 = createPeerSession(PEER4, nonAddPathParams, listener4);
final SimpleSessionListener listener5 = new SimpleSessionListener();
- configurePeer(PEER5, this.ribImpl, nonAddPathParams, PeerRole.Ebgp);
+ configurePeer(PEER5, this.ribImpl, nonAddPathParams, PeerRole.Ebgp, this.serverRegistry);
final BGPSessionImpl session5 = createPeerSession(PEER5, nonAddPathParams, listener5);
checkPeersPresentOnDataStore(5);
assertEquals(UPD_NA_200_EBGP, listener5.getListMsg().get(1));
final SimpleSessionListener listener6 = new SimpleSessionListener();
- configurePeer(PEER6, this.ribImpl, nonAddPathParams, PeerRole.RrClient);
+ configurePeer(PEER6, this.ribImpl, nonAddPathParams, PeerRole.RrClient, this.serverRegistry);
final BGPSessionImpl session6 = createPeerSession(PEER6, nonAddPathParams, listener6);
checkPeersPresentOnDataStore(6);
final Map<TablesKey, PathSelectionMode> pathTables = ImmutableMap.of(tk, new AddPathBestNPathSelection(2L));
this.ribImpl = new RIBImpl(this.clusterSingletonServiceProvider, new RibId("test-rib"),
- AS_NUMBER, new BgpId(RIB_ID), null, this.ribExtension, this.dispatcher,
+ AS_NUMBER, new BgpId(RIB_ID), null, this.ribExtension, this.serverDispatcher,
this.mappingService.getCodecFactory(), getDomBroker(), TABLES_TYPE, pathTables,
this.ribExtension.getClassLoadingStrategy(), null);
this.ribImpl.instantiateServiceInstance();
this.ribImpl.onGlobalContextUpdated(this.schemaContext);
- final ChannelFuture channelFuture = this.dispatcher.createServer(StrictBGPPeerRegistry.GLOBAL,
- new InetSocketAddress(RIB_ID, PORT));
+ final ChannelFuture channelFuture = this.serverDispatcher.createServer(new InetSocketAddress(RIB_ID, PORT));
waitFutureSuccess(channelFuture);
this.serverChannel = channelFuture.channel();
}
final BgpParameters nonAddPathParams = createParameter(false);
final BgpParameters addPathParams = createParameter(true);
- configurePeer(PEER1, this.ribImpl, nonAddPathParams, PeerRole.Ibgp);
+ configurePeer(PEER1, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
final BGPSessionImpl session1 = createPeerSession(PEER1, nonAddPathParams, new SimpleSessionListener());
- configurePeer(PEER2, this.ribImpl, nonAddPathParams, PeerRole.Ibgp);
- final BGPSessionImpl session2 = createPeerSession(PEER2, nonAddPathParams, new SimpleSessionListener());
+ configurePeer(PEER2, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
+ final BGPSessionImpl session2 = createPeerSession(PEER2, nonAddPathParams, new SimpleSessionListener());
- configurePeer(PEER3, this.ribImpl, nonAddPathParams, PeerRole.Ibgp);
+ configurePeer(PEER3, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
final BGPSessionImpl session3 = createPeerSession(PEER3, nonAddPathParams, new SimpleSessionListener());
final SimpleSessionListener listener4 = new SimpleSessionListener();
- configurePeer(PEER4, this.ribImpl, nonAddPathParams, PeerRole.RrClient);
+ configurePeer(PEER4, this.ribImpl, nonAddPathParams, PeerRole.RrClient, this.serverRegistry);
final BGPSessionImpl session4 = createPeerSession(PEER4, nonAddPathParams, listener4);
final SimpleSessionListener listener5 = new SimpleSessionListener();
- configurePeer(PEER5, this.ribImpl, addPathParams, PeerRole.RrClient);
+ configurePeer(PEER5, this.ribImpl, addPathParams, PeerRole.RrClient, this.serverRegistry);
final BGPSessionImpl session5 = createPeerSession(PEER5, addPathParams, listener5);
checkPeersPresentOnDataStore(5);
assertEquals(UPD_100, listener5.getListMsg().get(0));
final SimpleSessionListener listener6 = new SimpleSessionListener();
- configurePeer(PEER6, this.ribImpl, nonAddPathParams, PeerRole.RrClient);
+ configurePeer(PEER6, this.ribImpl, nonAddPathParams, PeerRole.RrClient, this.serverRegistry);
final BGPSessionImpl session6 = createPeerSession(PEER6, nonAddPathParams, listener6);
checkPeersPresentOnDataStore(6);
checkReceivedMessages(listener6, 1);
public void testCreateClient() throws InterruptedException, ExecutionException {
final InetSocketAddress serverAddress = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress();
final Channel serverChannel = createServer(serverAddress);
- final Future<BGPSessionImpl> futureClient = this.clientDispatcher.createClient(this.clientAddress, serverAddress, this.registry, 2, true);
+ final Future<BGPSessionImpl> futureClient = this.clientDispatcher.createClient(this.clientAddress,
+ serverAddress, 2, true);
waitFutureSuccess(futureClient);
final BGPSessionImpl session = futureClient.get();
Assert.assertEquals(State.UP, this.clientListener.getState());
@Test
public void testCreateReconnectingClient() throws Exception {
final InetSocketAddress serverAddress = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress();
- final Future<Void> future = this.clientDispatcher.createReconnectingClient(serverAddress, this.registry, RETRY_TIMER, Optional.absent(),
- this.clientAddress, true);
+ final Future<Void> future = this.clientDispatcher.createReconnectingClient(serverAddress, RETRY_TIMER,
+ Optional.absent(), this.clientAddress, true);
waitFutureSuccess(future);
final Channel serverChannel = createServer(serverAddress);
Assert.assertEquals(State.UP, this.serverListener.getState());
import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
import org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.mock.BGPMock;
import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBExtensionProviderActivator;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
private AbstractRIBExtensionProviderActivator baseact, lsact;
private RIBExtensionProviderContext ext1, ext2;
private String localAddress = "127.0.0.1";
+
@Mock
private BGPDispatcher dispatcher;
@Mock
.getSingletonInstance().getMessageRegistry(), Lists.newArrayList(fixMessages(bgpMessages)));
Mockito.doReturn(GlobalEventExecutor.INSTANCE.newSucceededFuture(null)).when(this.dispatcher)
- .createReconnectingClient(Mockito.any(InetSocketAddress.class), Mockito.any(BGPPeerRegistry.class),
- Mockito.anyInt(), Mockito.any(Optional.class));
+ .createReconnectingClient(Mockito.any(InetSocketAddress.class), Mockito.anyInt(),
+ Mockito.any(Optional.class));
this.ext1 = new SimpleRIBExtensionProviderContext();
this.ext2 = new SimpleRIBExtensionProviderContext();
final Map<TablesKey, PathSelectionMode> pathTables = ImmutableMap.of(TABLES_KEY,
BasePathSelectionModeFactory.createBestPathSelectionStrategy());
final RIBImpl ribImpl = new RIBImpl(this.clusterSingletonServiceProvider, new RibId(RIB_ID), AS_NUMBER,
- new BgpId(RIB_ID), null, this.ribExtension, this.dispatcher, this.mappingService.getCodecFactory(),
+ new BgpId(RIB_ID), null, this.ribExtension, this.serverDispatcher, this.mappingService.getCodecFactory(),
this.domBroker, ImmutableList.of(this.ipv4tt), pathTables, this.ribExtension.getClassLoadingStrategy(),
null);
ribImpl.instantiateServiceInstance();
final Map<TablesKey, PathSelectionMode> pathTables = ImmutableMap.of(TABLES_KEY,
BasePathSelectionModeFactory.createBestPathSelectionStrategy());
final RIBImpl ribImpl = new RIBImpl(this.clusterSingletonServiceProvider, new RibId(RIB_ID), AS_NUMBER,
- new BgpId(RIB_ID), null, this.ribExtension, this.dispatcher, this.mappingService.getCodecFactory(),
+ new BgpId(RIB_ID), null, this.ribExtension, this.serverDispatcher, this.mappingService.getCodecFactory(),
this.domBroker, ImmutableList.of(this.ipv4tt), pathTables, this.ribExtension.getClassLoadingStrategy(),
null);
ribImpl.instantiateServiceInstance();
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), any(BGPPeerRegistry.class), anyInt(), any(Optional.class));
+ .createReconnectingClient(any(InetSocketAddress.class), anyInt(), any(Optional.class));
Mockito.doReturn(this.dispatcher).when(this.rib).getDispatcher();
Mockito.doReturn(java.util.Optional.of(new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class)))
Mockito.doNothing().when(this.bgpPeerRegistry).removePeer(any(IpAddress.class));
Mockito.doReturn("registry").when(this.bgpPeerRegistry).toString();
Mockito.doNothing().when(this.listener).close();
+ Mockito.doReturn(this.bgpPeerRegistry).when(this.dispatcher).getBGPPeerRegistry();
}
}
mock(BGPDispatcher.class), mock(BindingCodecTreeFactory.class), domDataBroker, schemaService);
Mockito.doReturn(ribImpl).when(this.blueprintContainer).getComponentInstance(eq("ribImpl"));
- final BgpPeer bgpPeer = new BgpPeer(mock(RpcProviderRegistry.class), mock(BGPPeerRegistry.class));
+ final BgpPeer bgpPeer = new BgpPeer(mock(RpcProviderRegistry.class));
Mockito.doReturn(bgpPeer).when(this.blueprintContainer).getComponentInstance(eq("bgpPeer"));
this.collection = Collections.singleton(this.modification);
}
@Before
public void setUp() throws Exception {
super.setUp();
- this.bgpPeer = new BgpPeer(Mockito.mock(RpcProviderRegistry.class), this.bgpPeerRegistry);
+ this.bgpPeer = new BgpPeer(Mockito.mock(RpcProviderRegistry.class));
Mockito.doNothing().when(this.serviceRegistration).unregister();
}
@Test
public void testBgpPeer() throws Exception {
- final Neighbor neighbor = new NeighborBuilder().setAfiSafis(createAfiSafi()).setConfig(createConfig()).setNeighborAddress(NEIGHBOR_ADDRESS)
- .setRouteReflector(createRR()).setTimers(createTimers()).setTransport(createTransport()).setAddPaths(createAddPath()).build();
+ final Neighbor neighbor = new NeighborBuilder().setAfiSafis(createAfiSafi()).setConfig(createConfig())
+ .setNeighborAddress(NEIGHBOR_ADDRESS).setRouteReflector(createRR()).setTimers(createTimers())
+ .setTransport(createTransport()).setAddPaths(createAddPath()).build();
this.bgpPeer.start(this.rib, neighbor, this.tableTypeRegistry, this.configurationWriter);
Mockito.verify(this.rib).createPeerChain(any());
Mockito.verify(this.render).getConfiguredPeerCounter();
Mockito.verify(this.configurationWriter).apply();
Mockito.verify(this.bgpPeerRegistry).addPeer(any(), any(), any());
- Mockito.verify(this.dispatcher).createReconnectingClient(any(InetSocketAddress.class), any(BGPPeerRegistry.class), anyInt(), any(Optional.class));
+ Mockito.verify(this.dispatcher).createReconnectingClient(any(InetSocketAddress.class),
+ anyInt(), any(Optional.class));
try {
this.bgpPeer.start(this.rib, neighbor, this.tableTypeRegistry, this.configurationWriter);
import org.opendaylight.protocol.bgp.rib.impl.BGPDispatcherImpl;
import org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher;
+import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
import org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
throw new UnsupportedOperationException();
}
- static void createPeer(final BGPDispatcher dispatcher, final Arguments arguments, final InetSocketAddress localAddress,
- final BGPSessionListener sessionListener, final BgpParameters bgpParameters) {
+ static void createPeer(final BGPDispatcher dispatcher, final Arguments arguments,
+ final InetSocketAddress localAddress, final BGPSessionListener sessionListener,
+ final BgpParameters bgpParameters) {
final AsNumber as = arguments.getAs();
- final BGPSessionPreferences proposal = new BGPSessionPreferences(as, arguments.getHoldTimer(), new BgpId(localAddress.getAddress().getHostAddress()),
- as, Collections.singletonList(bgpParameters), Optional.absent());
- final StrictBGPPeerRegistry strictBGPPeerRegistry = new StrictBGPPeerRegistry();
+ final BGPSessionPreferences proposal = new BGPSessionPreferences(as, arguments.getHoldTimer(),
+ new BgpId(localAddress.getAddress().getHostAddress()), as, Collections.singletonList(bgpParameters),
+ Optional.absent());
+ final BGPPeerRegistry strictBGPPeerRegistry = dispatcher.getBGPPeerRegistry();
if (arguments.getInitiateConnection()) {
for (final InetSocketAddress remoteAddress : arguments.getRemoteAddresses()) {
- strictBGPPeerRegistry.addPeer(StrictBGPPeerRegistry.getIpAddress(remoteAddress), sessionListener, proposal);
- addFutureListener(localAddress, ((BGPDispatcherImpl) dispatcher).createClient(localAddress, remoteAddress, strictBGPPeerRegistry, RETRY_TIMER, true));
+ strictBGPPeerRegistry.addPeer(StrictBGPPeerRegistry.getIpAddress(remoteAddress), sessionListener,
+ proposal);
+ addFutureListener(localAddress, ((BGPDispatcherImpl) dispatcher).createClient(localAddress,
+ remoteAddress, RETRY_TIMER, true));
}
} else {
for (final InetSocketAddress remoteAddress : arguments.getRemoteAddresses()) {
- strictBGPPeerRegistry.addPeer(StrictBGPPeerRegistry.getIpAddress(remoteAddress), sessionListener, proposal);
+ strictBGPPeerRegistry.addPeer(StrictBGPPeerRegistry.getIpAddress(remoteAddress), sessionListener,
+ proposal);
}
- addFutureListener(localAddress, dispatcher.createServer(strictBGPPeerRegistry, localAddress));
+ addFutureListener(localAddress, dispatcher.createServer(localAddress));
}
LOG.debug("{} {}", sessionListener, proposal);
}
private static <T> void addFutureListener(final InetSocketAddress localAddress, final Future<T> future) {
- future.addListener(future1 -> Preconditions.checkArgument(future1.isSuccess(), "Unable to start bgp session on %s", localAddress, future1.cause()));
+ future.addListener(future1 -> Preconditions.checkArgument(future1.isSuccess(),
+ "Unable to start bgp session on %s", localAddress, future1.cause()));
}
}
import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.rib.impl.BGPDispatcherImpl;
+import org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher;
import org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
final org.opendaylight.protocol.bgp.l3vpn.ipv6.BgpIpv6Activator bgpIpv6Activator = new org.opendaylight.protocol.bgp.l3vpn.ipv6.BgpIpv6Activator();
bgpIpv6Activator.start(ctx);
- return new BGPDispatcherImpl(ctx.getMessageRegistry(), new NioEventLoopGroup(), new NioEventLoopGroup());
+ return new BGPDispatcherImpl(ctx.getMessageRegistry(), new NioEventLoopGroup(), new NioEventLoopGroup(),
+ new StrictBGPPeerRegistry());
}
private static OptionalCapabilities createMPCapability(final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {