}
final RIB rib = getRibDependency();
- return rib.getDispatcher().createReconnectingClient(address, remoteAs, registry, rib.getTcpStrategyFactory(), keys);
+ return rib.getDispatcher().createReconnectingClient(address, registry, rib.getTcpStrategyFactory(), keys);
}
private BGPPeerRegistry getPeerRegistryBackwards() {
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.spi.BGPSessionNegotiatorFactory;
import org.opendaylight.protocol.bgp.rib.spi.SessionNegotiator;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
public final class BGPClientSessionNegotiatorFactory implements BGPSessionNegotiatorFactory<BGPSessionImpl> {
private final BGPPeerRegistry peerRegistry;
- public BGPClientSessionNegotiatorFactory(final AsNumber remoteAs, final BGPPeerRegistry peerRegistry) {
+ public BGPClientSessionNegotiatorFactory(final BGPPeerRegistry peerRegistry) {
this.peerRegistry = peerRegistry;
}
import org.opendaylight.tcpmd5.netty.MD5ChannelFactory;
import org.opendaylight.tcpmd5.netty.MD5ChannelOption;
import org.opendaylight.tcpmd5.netty.MD5ServerChannelFactory;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
@Override
- public synchronized Future<BGPSessionImpl> createClient(final InetSocketAddress address,
- final AsNumber remoteAs, final BGPPeerRegistry listener, final ReconnectStrategy strategy) {
- final BGPClientSessionNegotiatorFactory snf = new BGPClientSessionNegotiatorFactory(remoteAs, listener);
+ public synchronized Future<BGPSessionImpl> createClient(final InetSocketAddress address, final BGPPeerRegistry listener, final ReconnectStrategy strategy) {
+ final BGPClientSessionNegotiatorFactory snf = new BGPClientSessionNegotiatorFactory(listener);
final ChannelPipelineInitializer initializer = BGPChannel.createChannelPipelineInitializer
(BGPDispatcherImpl.this.hf.getDecoders(), snf, BGPDispatcherImpl.this.hf.getEncoders());
}
@Override
- public synchronized Future<Void> createReconnectingClient(final InetSocketAddress address,
- final AsNumber remoteAs, final BGPPeerRegistry peerRegistry, final ReconnectStrategyFactory connectStrategyFactory,
- final KeyMapping keys) {
- final BGPClientSessionNegotiatorFactory snf = new BGPClientSessionNegotiatorFactory(remoteAs, peerRegistry);
+ public synchronized Future<Void> createReconnectingClient(final InetSocketAddress address, final BGPPeerRegistry peerRegistry,
+ final ReconnectStrategyFactory connectStrategyFactory, final KeyMapping keys) {
+ final BGPClientSessionNegotiatorFactory snf = new BGPClientSessionNegotiatorFactory(peerRegistry);
this.keys = keys;
final Bootstrap b = new Bootstrap();
import org.opendaylight.protocol.framework.ReconnectStrategy;
import org.opendaylight.protocol.framework.ReconnectStrategyFactory;
import org.opendaylight.tcpmd5.api.KeyMapping;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
/**
* Dispatcher class for creating BGP clients.
* Creates BGP client.
*
* @param address Peer address
- * @param remoteAs remote AS
* @param peerRegistry BGP peer registry
* @param strategy reconnection strategy
* @return Future promising a client session
*/
- Future<? extends BGPSession> createClient(InetSocketAddress address, AsNumber remoteAs,
- BGPPeerRegistry peerRegistry, ReconnectStrategy strategy);
+ Future<? extends BGPSession> createClient(InetSocketAddress address, BGPPeerRegistry peerRegistry, ReconnectStrategy strategy);
/**
* Creates Reconnecting client.
*
* @param address Peer address
- * @param remoteAs remote AS
* @param peerRegistry BGP peer registry
* @param connectStrategyFactory reconnection strategy
* @param keys for TCPMD5
* @return Future promising a client session
*/
- Future<Void> createReconnectingClient(InetSocketAddress address, AsNumber remoteAs,
- BGPPeerRegistry peerRegistry, ReconnectStrategyFactory connectStrategyFactory, KeyMapping keys);
+ Future<Void> createReconnectingClient(InetSocketAddress address,
+ BGPPeerRegistry peerRegistry, ReconnectStrategyFactory connectStrategyFactory, KeyMapping keys);
/**
* Create new BGP server to accept incoming bgp connections (bound to provided socket address).
@Test
public void testCreateClient() throws InterruptedException, ExecutionException {
- final BGPSessionImpl session = this.clientDispatcher.createClient(ADDRESS, AS_NUMBER, this.registry,
+ final BGPSessionImpl session = this.clientDispatcher.createClient(ADDRESS, this.registry,
new NeverReconnectStrategy(GlobalEventExecutor.INSTANCE, TIMEOUT), Optional.<InetSocketAddress>absent()).get();
Assert.assertEquals(BGPSessionImpl.State.UP, session.getState());
Assert.assertEquals(AS_NUMBER, session.getAsNumber());
public void testCreateReconnectingClient() throws InterruptedException, ExecutionException {
final SimpleSessionListener listener = new SimpleSessionListener();
this.registry.addPeer(new IpAddress(new Ipv4Address(CLIENT_ADDRESS2.getAddress().getHostAddress())), listener, createPreferences(CLIENT_ADDRESS2));
- final Future<Void> cf = this.clientDispatcher.createReconnectingClient(CLIENT_ADDRESS2, AS_NUMBER, this.registry,
+ final Future<Void> cf = this.clientDispatcher.createReconnectingClient(CLIENT_ADDRESS2, this.registry,
new ReconnectStrategyFctImpl(), Optional.<InetSocketAddress>absent());
final Channel channel2 = this.dispatcher.createServer(this.registry, CLIENT_ADDRESS2).channel();
Thread.sleep(1000);
this.mock = new BGPMock(new EventBus("test"), ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getMessageRegistry(), Lists.newArrayList(fixMessages(bgpMessages)));
Mockito.doReturn(GlobalEventExecutor.INSTANCE.newSucceededFuture(null)).when(this.dispatcher).createReconnectingClient(
- Mockito.any(InetSocketAddress.class), Mockito.any(AsNumber.class),
- Mockito.any(BGPPeerRegistry.class), Mockito.eq(this.tcpStrategyFactory), Mockito.any(KeyMapping.class));
+ Mockito.any(InetSocketAddress.class), Mockito.any(BGPPeerRegistry.class), Mockito.eq(this.tcpStrategyFactory), Mockito.any(KeyMapping.class));
this.ext1 = new SimpleRIBExtensionProviderContext();
this.ext2 = new SimpleRIBExtensionProviderContext();
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
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;
public class TestClientDispatcher {
protected TestClientDispatcher(final EventLoopGroup bossGroup, final EventLoopGroup workerGroup, final MessageRegistry messageRegistry,
final InetSocketAddress locaAddress) {
- disp = new BGPDispatcherImpl(messageRegistry, bossGroup, workerGroup) {
+ this.disp = new BGPDispatcherImpl(messageRegistry, bossGroup, workerGroup) {
@Override
protected void customizeBootstrap(final Bootstrap b) {
b.localAddress(locaAddress);
}
public synchronized Future<BGPSessionImpl> createClient(final InetSocketAddress remoteAddress,
- final AsNumber remoteAs, final BGPPeerRegistry listener, final ReconnectStrategy strategy, final Optional<InetSocketAddress> localAddress) {
+ final BGPPeerRegistry listener, final ReconnectStrategy strategy, final Optional<InetSocketAddress> localAddress) {
setLocalAddress(localAddress);
- return disp.createClient(remoteAddress, remoteAs, listener, strategy);
+ return this.disp.createClient(remoteAddress, listener, strategy);
}
- public synchronized Future<Void> createReconnectingClient(final InetSocketAddress address,
- final AsNumber remoteAs, final BGPPeerRegistry peerRegistry, final ReconnectStrategyFactory reconnectStrategyFactory,
- final Optional<InetSocketAddress> localAddress) {
+ public synchronized Future<Void> createReconnectingClient(final InetSocketAddress address, final BGPPeerRegistry peerRegistry,
+ final ReconnectStrategyFactory reconnectStrategyFactory, final Optional<InetSocketAddress> localAddress) {
setLocalAddress(localAddress);
- return disp.createReconnectingClient(address, remoteAs, peerRegistry, reconnectStrategyFactory, null);
+ return this.disp.createReconnectingClient(address, peerRegistry, reconnectStrategyFactory, null);
}
private synchronized void setLocalAddress(final Optional<InetSocketAddress> localAddress) {
if (localAddress.isPresent()) {
this.localAddress = localAddress.get();
} else {
- this.localAddress = defaulAddress;
+ this.localAddress = this.defaulAddress;
}
}
}
final StrictBGPPeerRegistry strictBGPPeerRegistry = new StrictBGPPeerRegistry();
strictBGPPeerRegistry.addPeer(StrictBGPPeerRegistry.getIpAddress(address), sessionListener, proposal);
- m.dispatcher.createClient(addr, as, strictBGPPeerRegistry,
+ m.dispatcher.createClient(addr, strictBGPPeerRegistry,
new NeverReconnectStrategy(GlobalEventExecutor.INSTANCE, RECONNECT_MILLIS));
}
}