import java.net.UnknownHostException;
import java.security.AccessControlException;
import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.protocol.bgp.rib.impl.BGPServerSessionValidator;
/**
* BGP peer acceptor that handles incoming bgp connections.
@Override
public java.lang.AutoCloseable createInstance() {
- final ChannelFuture future = getAcceptingBgpDispatcherDependency().createServer(getAcceptingPeerRegistryDependency(), getAddress(), new BGPServerSessionValidator());
+ final ChannelFuture future = getAcceptingBgpDispatcherDependency().createServer(getAcceptingPeerRegistryDependency(), getAddress());
// Validate future success
future.addListener(new GenericFutureListener<Future<Void>>() {
import io.netty.util.concurrent.Promise;
import java.util.concurrent.TimeUnit;
import javax.annotation.concurrent.GuardedBy;
+import org.opendaylight.protocol.bgp.parser.AsNumberUtil;
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.parser.BGPError;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionValidator;
import org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener;
import org.opendaylight.protocol.bgp.rib.spi.SessionNegotiator;
import org.opendaylight.protocol.util.Values;
private static final Logger LOG = LoggerFactory.getLogger(AbstractBGPSessionNegotiator.class);
private final BGPPeerRegistry registry;
- private final BGPSessionValidator sessionValidator;
private final Promise<BGPSessionImpl> promise;
private final Channel channel;
@GuardedBy("this")
private BGPSessionImpl session;
public AbstractBGPSessionNegotiator(final Promise<BGPSessionImpl> promise, final Channel channel,
- final BGPPeerRegistry registry, final BGPSessionValidator sessionValidator) {
+ final BGPPeerRegistry registry) {
this.promise = Preconditions.checkNotNull(promise);
this.channel = Preconditions.checkNotNull(channel);
this.registry = registry;
- this.sessionValidator = sessionValidator;
}
private synchronized void startNegotiation() {
}
private void handleOpen(final Open openObj) {
- try {
- this.sessionValidator.validate(openObj, getPreferences());
- } catch (final BGPDocumentedException e) {
- negotiationFailed(e);
- return;
- }
-
try {
final BGPSessionListener peer = this.registry.getPeer(getRemoteIp(), getSourceId(openObj, getPreferences()), getDestinationId(openObj, getPreferences()), getAsNumber(openObj, getPreferences()), openObj);
sendMessage(new KeepaliveBuilder().build());
* @param preferences Local BGP speaker preferences
* @return AS Number of device that initiate connection
*/
- protected abstract AsNumber getAsNumber(final Open openMsg, final BGPSessionPreferences preferences);
+ protected AsNumber getAsNumber(final Open openMsg, final BGPSessionPreferences preferences) {
+ return AsNumberUtil.advertizedAsNumber(openMsg);
+ }
public synchronized State getState() {
return this.state;
import io.netty.channel.Channel;
import io.netty.util.concurrent.Promise;
-import org.opendaylight.protocol.bgp.parser.AsNumberUtil;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionValidator;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Open;
public final class BGPClientSessionNegotiator extends AbstractBGPSessionNegotiator {
public BGPClientSessionNegotiator(final Promise<BGPSessionImpl> promise, final Channel channel,
- final BGPPeerRegistry registry, final BGPSessionValidator sessionValidator) {
- super(promise, channel, registry, sessionValidator);
+ final BGPPeerRegistry registry) {
+ super(promise, channel, registry);
}
@Override
protected Ipv4Address getSourceId(final Open openMsg, final BGPSessionPreferences preferences) {
return openMsg.getBgpIdentifier();
}
-
- @Override
- protected AsNumber getAsNumber(final Open openMsg, final BGPSessionPreferences preferences) {
- return AsNumberUtil.advertizedAsNumber(openMsg);
- }
}
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 BGPClientSessionValidator validator;
private final BGPPeerRegistry peerRegistry;
public BGPClientSessionNegotiatorFactory(final AsNumber remoteAs, final BGPPeerRegistry peerRegistry) {
this.peerRegistry = peerRegistry;
- this.validator = new BGPClientSessionValidator(remoteAs);
}
@Override
public SessionNegotiator getSessionNegotiator(final Channel channel, final Promise<BGPSessionImpl> promise) {
- return new BGPClientSessionNegotiator(promise, channel, peerRegistry, validator);
+ return new BGPClientSessionNegotiator(promise, channel, this.peerRegistry);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.protocol.bgp.rib.impl;
-
-import com.google.common.base.Optional;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import java.util.List;
-import org.opendaylight.protocol.bgp.parser.AsNumberUtil;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPError;
-import org.opendaylight.protocol.bgp.parser.impl.message.open.As4CapabilityHandler;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionValidator;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Open;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.BgpParameters;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.bgp.parameters.OptionalCapabilities;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.bgp.parameters.optional.capabilities.CParameters;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.bgp.parameters.optional.capabilities.CParametersBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.bgp.parameters.optional.capabilities.c.parameters.As4BytesCapability;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Validates Bgp sessions established from current device to remote.
- */
-public class BGPClientSessionValidator implements BGPSessionValidator {
-
- private static final Logger LOG = LoggerFactory.getLogger(BGPClientSessionValidator.class);
-
- private final AsNumber remoteAs;
-
- public BGPClientSessionValidator(final AsNumber remoteAs) {
- this.remoteAs = remoteAs;
- }
-
- /**
- * Validates with exception:
- * <ul>
- * <li>correct remote AS attribute</li>
- * <li>non empty BgpParameters collection</li>
- * </ul>
- *
- * Validates with log message:
- * <ul>
- * <li>local BgpParameters are superset of remote BgpParameters</li>
- * </ul>
- */
- @Override
- public void validate(final Open openObj, final BGPSessionPreferences localPref) throws BGPDocumentedException {
- final AsNumber as = AsNumberUtil.advertizedAsNumber(openObj);
- if (!this.remoteAs.equals(as)) {
- LOG.warn("Unexpected remote AS number. Expecting {}, got {}", this.remoteAs, as);
- throw new BGPDocumentedException("Peer AS number mismatch", BGPError.BAD_PEER_AS);
- }
- //https://tools.ietf.org/html/rfc6286#section-2.2
- if (openObj.getBgpIdentifier() != null && openObj.getBgpIdentifier().equals(localPref.getBgpId())) {
- LOG.warn("Remote and local BGP Identifiers are the same: {}", openObj.getBgpIdentifier());
- throw new BGPDocumentedException("Remote and local BGP Identifiers are the same.", BGPError.BAD_BGP_ID);
- }
-
- final List<BgpParameters> prefs = openObj.getBgpParameters();
- if (prefs != null) {
- if(getAs4BytesCapability(localPref.getParams()).isPresent() && !getAs4BytesCapability(prefs).isPresent()) {
- throw new BGPDocumentedException("The peer must advertise AS4Bytes capability.", BGPError.UNSUPPORTED_CAPABILITY,
- serializeAs4BytesCapability(getAs4BytesCapability(localPref.getParams()).get()));
- }
- if (!prefs.containsAll(localPref.getParams())) {
- LOG.info("BGP Open message session parameters differ, session still accepted.");
- }
- } else {
- throw new BGPDocumentedException("Open message unacceptable. Check the configuration of BGP speaker.", BGPError.UNSPECIFIC_OPEN_ERROR);
- }
- }
-
- private static Optional<As4BytesCapability> getAs4BytesCapability(final List<BgpParameters> prefs) {
- for(final BgpParameters param : prefs) {
- for (final OptionalCapabilities capa : param.getOptionalCapabilities()) {
- final CParameters cParam = capa.getCParameters();
- if(cParam.getAs4BytesCapability() !=null) {
- return Optional.of(cParam.getAs4BytesCapability());
- }
- }
- }
- return Optional.absent();
- }
-
- private static byte[] serializeAs4BytesCapability(final As4BytesCapability as4Capability) {
- final ByteBuf buffer = Unpooled.buffer(1 /*CODE*/ + 1 /*LENGTH*/ + Integer.SIZE / Byte.SIZE /*4 byte value*/);
- final As4CapabilityHandler serializer = new As4CapabilityHandler();
- serializer.serializeCapability(new CParametersBuilder().setAs4BytesCapability(as4Capability).build(), buffer);
- return buffer.array();
- }
-}
import org.opendaylight.protocol.bgp.rib.impl.protocol.BGPReconnectPromise;
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.BGPSessionValidator;
import org.opendaylight.protocol.bgp.rib.impl.spi.ChannelPipelineInitializer;
import org.opendaylight.protocol.bgp.rib.spi.BGPSession;
import org.opendaylight.protocol.bgp.rib.spi.BGPSessionNegotiatorFactory;
}
@Override
- public ChannelFuture createServer(final BGPPeerRegistry registry, final InetSocketAddress address, final BGPSessionValidator sessionValidator) {
- final BGPServerSessionNegotiatorFactory snf = new BGPServerSessionNegotiatorFactory(sessionValidator, registry);
+ public ChannelFuture createServer(final BGPPeerRegistry registry, final InetSocketAddress address) {
+ final BGPServerSessionNegotiatorFactory snf = new BGPServerSessionNegotiatorFactory(registry);
final ChannelPipelineInitializer initializer = BGPChannel.createChannelPipelineInitializer
(BGPDispatcherImpl.this.hf.getDecoders(), snf, BGPDispatcherImpl.this.hf.getEncoders());
final ServerBootstrap b = new ServerBootstrap();
import io.netty.channel.Channel;
import io.netty.util.concurrent.Promise;
-import org.opendaylight.protocol.bgp.parser.AsNumberUtil;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionValidator;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Open;
public final class BGPServerSessionNegotiator extends AbstractBGPSessionNegotiator {
public BGPServerSessionNegotiator(final Promise<BGPSessionImpl> promise, final Channel channel,
- final BGPPeerRegistry registry, final BGPSessionValidator sessionValidator) {
- super(promise, channel, registry, sessionValidator);
+ final BGPPeerRegistry registry) {
+ super(promise, channel, registry);
}
@Override
protected Ipv4Address getDestinationId(final Open openMsg, final BGPSessionPreferences preferences) {
return openMsg.getBgpIdentifier();
}
-
- @Override
- protected AsNumber getAsNumber(final Open openMsg, final BGPSessionPreferences preferences) {
- return AsNumberUtil.advertizedAsNumber(openMsg);
- }
}
*/
package org.opendaylight.protocol.bgp.rib.impl;
-import com.google.common.base.Preconditions;
import io.netty.channel.Channel;
import io.netty.util.concurrent.Promise;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionValidator;
import org.opendaylight.protocol.bgp.rib.spi.BGPSessionNegotiatorFactory;
import org.opendaylight.protocol.bgp.rib.spi.SessionNegotiator;
public final class BGPServerSessionNegotiatorFactory implements BGPSessionNegotiatorFactory<BGPSessionImpl> {
- private final BGPSessionValidator validator;
private final BGPPeerRegistry registry;
- public BGPServerSessionNegotiatorFactory(final BGPSessionValidator sessionValidator, final BGPPeerRegistry registry) {
+ public BGPServerSessionNegotiatorFactory(final BGPPeerRegistry registry) {
this.registry = registry;
- this.validator = Preconditions.checkNotNull(sessionValidator);
}
@Override
public SessionNegotiator getSessionNegotiator(final Channel channel, final Promise<BGPSessionImpl> promise) {
- return new BGPServerSessionNegotiator(promise, channel, registry, validator);
+ return new BGPServerSessionNegotiator(promise, channel, this.registry);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.protocol.bgp.rib.impl;
-
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionValidator;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Open;
-
-/**
- * Validates Bgp sessions established from remote devices.
- */
-public final class BGPServerSessionValidator implements BGPSessionValidator {
-
- @Override
- public void validate(final Open openObj, final BGPSessionPreferences localPref) throws BGPDocumentedException {
- // No validation performed, org.opendaylight.protocol.bgp.rib.impl.AbstractBGPSessionNegotiator checks if peer is configured
- }
-}
*
* @param peerRegistry BGP peer registry
* @param address Peer address
- * @param sessionValidator BGPSessionValidator
*
* @return ChannelFuture promising a client session
*/
- ChannelFuture createServer(BGPPeerRegistry peerRegistry, InetSocketAddress address, BGPSessionValidator sessionValidator);
+ ChannelFuture createServer(BGPPeerRegistry peerRegistry, InetSocketAddress address);
}
*
* @param peerRegistry BGP peer registry
* @param address server address
- * @param sessionValidator BGPSessionValidator
* @return ChannelFuture promising a server session
*/
- ChannelFuture createServer(BGPPeerRegistry peerRegistry, InetSocketAddress address, BGPSessionValidator sessionValidator);
+ ChannelFuture createServer(BGPPeerRegistry peerRegistry, InetSocketAddress address);
/**
* Create new BGP server to accept incoming bgp connections (bound to provided socket address).
*
* @param peerRegistry BGP peer registry
* @param address server address
- * @param sessionValidator BGPSessionValidator
* @param keys KeyMapping
* @return ChannelFuture promising a server session
*/
- ChannelFuture createServer(BGPPeerRegistry peerRegistry, InetSocketAddress address, BGPSessionValidator sessionValidator, KeyMapping keys);
+ ChannelFuture createServer(BGPPeerRegistry peerRegistry, InetSocketAddress address, KeyMapping keys);
}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.protocol.bgp.rib.impl.spi;
-
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Open;
-
-/**
- * BGP Session validator. Validates established sessions with bgp peers after OPEN message is received
- */
-public interface BGPSessionValidator {
-
- void validate(final Open openObj, final BGPSessionPreferences localPref) throws BGPDocumentedException;
-}
import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory;
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.BGPSessionValidator;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
final CommitStatus status = createRegistryInstance(Optional.<String>absent(), Optional.<Integer>absent(), true, true);
assertBeanCount(1, FACTORY_NAME);
assertStatus(status, 3, 0, 0);
- verify(dispatcher).createServer(any(BGPPeerRegistry.class), any(InetSocketAddress.class), any(BGPSessionValidator.class));
- } catch (ValidationException e) {
+ verify(dispatcher).createServer(any(BGPPeerRegistry.class), any(InetSocketAddress.class));
+ } catch (final ValidationException e) {
if(!PlatformDependent.isWindows() && !PlatformDependent.isRoot()) {
Assert.assertTrue(e.getMessage().contains("Unable to bind port"));
} else {
final CommitStatus status = createRegistryInstance(Optional.of("127.0.0.1"), Optional.of(1790), true, true);
assertBeanCount(1, FACTORY_NAME);
assertStatus(status, 3, 0, 0);
- verify(dispatcher).createServer(any(BGPPeerRegistry.class), any(InetSocketAddress.class), any(BGPSessionValidator.class));
+ verify(dispatcher).createServer(any(BGPPeerRegistry.class), any(InetSocketAddress.class));
}
private CommitStatus createRegistryInstance(final Optional<String> address, final Optional<Integer> port, final boolean addRegistry, final boolean addDispatcher ) throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException {
doReturn(mock(ChannelFuture.class)).when(channel).close();
doReturn(channel).when(future).channel();
doReturn(mock(ChannelFuture.class)).when(future).addListener(any(GenericFutureListener.class));
- doReturn(future).when(dispatcher).createServer(any(BGPPeerRegistry.class), any(InetSocketAddress.class), any(BGPSessionValidator.class));
+ doReturn(future).when(dispatcher).createServer(any(BGPPeerRegistry.class), any(InetSocketAddress.class));
doNothing().when(dispatcher).close();
}
this.clientDispatcher = new TestClientDispatcher(group, group, ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getMessageRegistry(),
CLIENT_ADDRESS);
- final ChannelFuture future = this.dispatcher.createServer(this.registry, ADDRESS, new BGPServerSessionValidator());
+ final ChannelFuture future = this.dispatcher.createServer(this.registry, ADDRESS);
future.addListener(new GenericFutureListener<Future<Void>>() {
@Override
public void operationComplete(final Future<Void> future) {
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,
new ReconnectStrategyFctImpl(), Optional.<InetSocketAddress>absent());
- final Channel channel2 = this.dispatcher.createServer(this.registry, CLIENT_ADDRESS2, new BGPServerSessionValidator()).channel();
+ final Channel channel2 = this.dispatcher.createServer(this.registry, CLIENT_ADDRESS2).channel();
Thread.sleep(1000);
Assert.assertTrue(listener.up);
Assert.assertTrue(channel2.isActive());
final BGPPeerRegistry peerRegistry = new StrictBGPPeerRegistry();
peerRegistry.addPeer(new IpAddress(new Ipv4Address(peerAddress.getHostAddress())), new SimpleSessionListener(), prefs);
- this.clientSession = new BGPClientSessionNegotiator(new DefaultPromise<BGPSessionImpl>(GlobalEventExecutor.INSTANCE), this.speakerListener, peerRegistry, new BGPClientSessionValidator(new AsNumber(30L)));
+ this.clientSession = new BGPClientSessionNegotiator(new DefaultPromise<BGPSessionImpl>(GlobalEventExecutor.INSTANCE), this.speakerListener, peerRegistry);
doAnswer(new Answer<Object>() {
@Override
public Object answer(final InvocationOnMock invocation) {
@Test
public void testDenyPeer() {
- this.clientSession = new BGPClientSessionNegotiator(new DefaultPromise<BGPSessionImpl>(GlobalEventExecutor.INSTANCE), this.speakerListener, new StrictBGPPeerRegistry(), new BGPClientSessionValidator(new AsNumber(30L)));
+ this.clientSession = new BGPClientSessionNegotiator(new DefaultPromise<BGPSessionImpl>(GlobalEventExecutor.INSTANCE), this.speakerListener, new StrictBGPPeerRegistry());
this.clientSession.channelActive(null);
assertEquals(1, this.receivedMsgs.size());
assertTrue(this.receivedMsgs.get(0) instanceof Notify);
this.clientSession.channelActive(null);
assertEquals(1, this.receivedMsgs.size());
assertTrue(this.receivedMsgs.get(0) instanceof Open);
- this.clientSession.handleMessage(new OpenBuilder().setMyAsNumber(30).setHoldTimer(1).setVersion(new ProtocolVersion((short) 4)).build());
+ this.clientSession.handleMessage(new OpenBuilder().setMyAsNumber(30).setHoldTimer(1).setBgpIdentifier(new Ipv4Address("127.0.0.1")).setVersion(new ProtocolVersion((short) 4)).build());
assertEquals(2, this.receivedMsgs.size());
assertTrue(this.receivedMsgs.get(1) instanceof Notify);
final Notification m = this.receivedMsgs.get(this.receivedMsgs.size() - 1);
import org.opendaylight.protocol.bgp.rib.impl.BGPSessionProposalImpl;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
-import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionValidator;
import org.opendaylight.protocol.bgp.rib.impl.spi.ReusableBGPPeer;
import org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
public void main(final String[] args) {
- final BGPServerSessionNegotiatorFactory snf = new BGPServerSessionNegotiatorFactory(new BGPSessionValidator() {
- @Override
- public void validate(final Open openObj, final BGPSessionPreferences prefs) throws BGPDocumentedException {
- // NOOP
- }
- }, this.peerRegistry);
+ final BGPServerSessionNegotiatorFactory snf = new BGPServerSessionNegotiatorFactory(this.peerRegistry);
final BGPSpeakerMock mock = new BGPSpeakerMock(snf, new BGPHandlerFactory(ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getMessageRegistry()), new DefaultPromise<BGPSessionImpl>(GlobalEventExecutor.INSTANCE));
}
private void createServer(final InetSocketAddress address) {
- this.disp.createServer(this.peerRegistry,address, new BGPSessionValidator() {
- @Override
- public void validate(final Open openObj, final BGPSessionPreferences prefs) throws BGPDocumentedException {
- // NOOP
- }
- });
+ this.disp.createServer(this.peerRegistry,address);
}
}