--- /dev/null
+/*
+ * Copyright (c) 2013 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.parser;
+
+import java.util.List;
+
+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.BgpParameters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.bgp.parameters.CParameters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.bgp.parameters.c.parameters.As4BytesCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.bgp.parameters.c.parameters.as4.bytes._case.As4BytesCapability;
+
+public final class AsNumberUtil {
+ private AsNumberUtil() {
+ throw new UnsupportedOperationException("Utility class should never be instantiated");
+ }
+
+ public static AsNumber advertizedAsNumber(final Open open) {
+ // Look for AS4 capability very defensively
+ final List<BgpParameters> params = open.getBgpParameters();
+ if (params != null) {
+ for (BgpParameters p : params) {
+ final CParameters cp = p.getCParameters();
+ if (cp != null && cp instanceof As4BytesCase) {
+ final As4BytesCapability capa = ((As4BytesCase)cp).getAs4BytesCapability();
+ if (capa != null) {
+ return capa.getAsNumber();
+ }
+ }
+ }
+ }
+
+ // Fallback to whatever is in the header
+ return new AsNumber(open.getMyAsNumber().longValue());
+ }
+}
import java.util.Set;
import org.opendaylight.protocol.framework.ProtocolSession;
+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.multiprotocol.rev130919.BgpTableType;
import org.opendaylight.yangtools.yang.binding.Notification;
* @return Peer's BGP Router ID.
*/
byte[] getBgpId();
+
+ /**
+ * Return the AS number which the peer advertizes.
+ *
+ * @return Peer's AS Number
+ */
+ AsNumber getAsNumber();
}
import org.opendaylight.protocol.bgp.rib.impl.BGPPeer;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
+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.IpAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.BgpParameters;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.BgpParametersBuilder;
new MultiprotocolCapabilityBuilder(t).build()).build()).build());
}
+ // Remote AS number defaults to our local AS
+ final AsNumber remoteAs;
+ if (getRemoteAs() != null) {
+ remoteAs = new AsNumber(getRemoteAs());
+ } else {
+ remoteAs = r.getLocalAs();
+ }
+
return new BGPPeer(peerName(getHost()), createAddress(),
- new BGPSessionPreferences(r.getLocalAs(), getHoldtimer(), r.getBgpIdentifier(), tlvs), r);
+ new BGPSessionPreferences(r.getLocalAs(), getHoldtimer(), r.getBgpIdentifier(), tlvs), remoteAs, r);
}
}
}
}
+ leaf remote-as {
+ description
+ "Expected remote AS number. If not present, it is assumed
+ to be the same as our local AS number.";
+ type uint32;
+ }
+
container rib {
uses config:service-ref {
refine type {
}
leaf local-as {
- description "Our local AS number. Needed by best selection path attribute.";
+ description "Our local AS number. Needed by best selection path attribute.";
type uint32;
mandatory true;
}
leaf bgp-id {
- description "Our local BGP identifier. Needed by best selection path attribute.";
+ description "Our local BGP identifier. Needed by best selection path attribute.";
mandatory true;
type inet:ipv4-address;
}
import org.opendaylight.protocol.framework.ReconnectStrategy;
import org.opendaylight.protocol.framework.ReconnectStrategyFactory;
import org.opendaylight.protocol.framework.SessionListenerFactory;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
/**
* Implementation of BGPDispatcher.
@Override
public Future<BGPSessionImpl> createClient(final InetSocketAddress address, final BGPSessionPreferences preferences,
- final BGPSessionListener listener, final ReconnectStrategy strategy) {
- final BGPSessionNegotiatorFactory snf = new BGPSessionNegotiatorFactory(this.timer, preferences);
+ final AsNumber remoteAs, final BGPSessionListener listener, final ReconnectStrategy strategy) {
+ final BGPSessionNegotiatorFactory snf = new BGPSessionNegotiatorFactory(this.timer, preferences, remoteAs);
final SessionListenerFactory<BGPSessionListener> slf = new SessionListenerFactory<BGPSessionListener>() {
@Override
public BGPSessionListener getSessionListener() {
@Override
public Future<Void> createReconnectingClient(final InetSocketAddress address,
- final BGPSessionPreferences preferences, final BGPSessionListener listener,
- final ReconnectStrategyFactory connectStrategyFactory,
+ final BGPSessionPreferences preferences, final AsNumber remoteAs,
+ final BGPSessionListener listener, final ReconnectStrategyFactory connectStrategyFactory,
final ReconnectStrategy reestablishStrategy) {
- final BGPSessionNegotiatorFactory snf = new BGPSessionNegotiatorFactory(this.timer, preferences);
+ final BGPSessionNegotiatorFactory snf = new BGPSessionNegotiatorFactory(this.timer, preferences, remoteAs);
final SessionListenerFactory<BGPSessionListener> slf = new SessionListenerFactory<BGPSessionListener>() {
@Override
public BGPSessionListener getSessionListener() {
* @param <T> Actual object state reference
*/
final class BGPObjectComparator implements Comparator<PathAttributes> {
-
+ private final byte[] localId, remoteId;
private final AsNumber ourAS;
- private final byte[] id1;
-
- private final byte[] id2;
-
public BGPObjectComparator(final AsNumber ourAs, final Ipv4Address localId, final byte[] remoteId) {
- this.ourAS = ourAs;
- this.id1 = InetAddresses.forString(localId.getValue()).getAddress();
- this.id2 = Preconditions.checkNotNull(remoteId);
+ this.ourAS = Preconditions.checkNotNull(ourAs);
+ this.localId = InetAddresses.forString(localId.getValue()).getAddress();
+ this.remoteId = Preconditions.checkNotNull(remoteId);
}
@Override
if (o2 == null) {
return -1;
}
- if (o1.equals(o2) && Arrays.equals(this.id1, this.id2)) {
+ if (o1.equals(o2) && Arrays.equals(this.localId, this.remoteId)) {
return 0;
}
// 1. prefer path with accessible nexthop
// The router ID is the highest IP address on the router, with preference given to loopback addresses.
// If a path contains route reflector (RR) attributes, the originator ID is substituted for the router ID in the
// path selection process.
- byte[] oid1 = this.id1;
- byte[] oid2 = this.id2;
+ byte[] oid1 = this.localId;
+ byte[] oid2 = this.remoteId;
if (o1.getOriginatorId() != null) {
oid1 = InetAddresses.forString(o1.getOriginatorId().getValue()).getAddress();
}
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
import org.opendaylight.protocol.bgp.rib.spi.Peer;
+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.PathAttributes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Update;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
private BGPSession session;
public BGPPeer(final String name, final InetSocketAddress address, final BGPSessionPreferences prefs,
- final RIB rib) {
+ final AsNumber remoteAs, final RIB rib) {
this.rib = Preconditions.checkNotNull(rib);
this.name = Preconditions.checkNotNull(name);
- cf = rib.getDispatcher().createReconnectingClient(address, prefs, this, rib.getTcpStrategyFactory(), rib.getSessionStrategy());
+ cf = rib.getDispatcher().createReconnectingClient(address, prefs, remoteAs, this, rib.getTcpStrategyFactory(), rib.getSessionStrategy());
}
@Override
import javax.annotation.concurrent.GuardedBy;
+import org.opendaylight.protocol.bgp.parser.AsNumberUtil;
import org.opendaylight.protocol.bgp.parser.BGPError;
import org.opendaylight.protocol.bgp.parser.BGPSession;
import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
import org.opendaylight.protocol.bgp.parser.BGPTerminationReason;
import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
import org.opendaylight.protocol.framework.AbstractProtocolSession;
+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.Keepalive;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.KeepaliveBuilder;
private static final Notification KEEP_ALIVE = new KeepaliveBuilder().build();
- private static int holdTimerValue = DEFAULT_HOLD_TIMER_VALUE;
-
/**
* Internal session state.
*/
@GuardedBy("this")
private State state = State.OpenConfirm;
- private final int keepAlive;
private final Set<BgpTableType> tableTypes;
-
+ private final int holdTimerValue;
+ private final int keepAlive;
+ private final AsNumber asNumber;
private final Ipv4Address bgpId;
BGPSessionImpl(final Timer timer, final BGPSessionListener listener, final Channel channel, final Open remoteOpen) {
this.stateTimer = Preconditions.checkNotNull(timer);
this.channel = Preconditions.checkNotNull(channel);
this.keepAlive = remoteOpen.getHoldTimer() / 3;
- holdTimerValue = remoteOpen.getHoldTimer();
+ this.holdTimerValue = remoteOpen.getHoldTimer();
+ this.asNumber = AsNumberUtil.advertizedAsNumber(remoteOpen);
final Set<TablesKey> tts = Sets.newHashSet();
final Set<BgpTableType> tats = Sets.newHashSet();
return this.state;
}
- public byte[] getBgpId() {
+ @Override
+ public final byte[] getBgpId() {
return this.bgpId.getValue().getBytes();
}
+
+ @Override
+ public final AsNumber getAsNumber() {
+ return this.asNumber;
+ }
}
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.parser.BGPSessionListener;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
import org.opendaylight.protocol.framework.AbstractSessionNegotiator;
+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.Keepalive;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.KeepaliveBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Notify;
}
private static final Logger LOG = LoggerFactory.getLogger(BGPSessionNegotiator.class);
+ private final BGPSessionPreferences localPref;
private final BGPSessionListener listener;
+ private final AsNumber remoteAs;
private final Timer timer;
- private final BGPSessionPreferences localPref;
-
- @GuardedBy("this")
- private Open remotePref;
@GuardedBy("this")
private State state = State.Idle;
private BGPSessionImpl session;
public BGPSessionNegotiator(final Timer timer, final Promise<BGPSessionImpl> promise, final Channel channel,
- final BGPSessionPreferences initialPrefs, final BGPSessionListener listener) {
+ final BGPSessionPreferences initialPrefs, final AsNumber remoteAs, final BGPSessionListener listener) {
super(promise, channel);
this.listener = Preconditions.checkNotNull(listener);
this.localPref = Preconditions.checkNotNull(initialPrefs);
+ this.remoteAs = Preconditions.checkNotNull(remoteAs);
this.timer = Preconditions.checkNotNull(timer);
}
public void run(final Timeout timeout) throws Exception {
synchronized (lock) {
if (BGPSessionNegotiator.this.state != State.Finished) {
- BGPSessionNegotiator.this.sendMessage(new NotifyBuilder().setErrorCode(BGPError.HOLD_TIMER_EXPIRED.getCode()).setErrorSubcode(
- BGPError.HOLD_TIMER_EXPIRED.getSubcode()).build());
+ BGPSessionNegotiator.this.sendMessage(buildErrorNotify(BGPError.HOLD_TIMER_EXPIRED));
negotiationFailed(new BGPDocumentedException("HoldTimer expired", BGPError.FSM_ERROR));
BGPSessionNegotiator.this.state = State.Finished;
}
switch (this.state) {
case Finished:
case Idle:
- final Notify fsmError = new NotifyBuilder().setErrorCode(BGPError.FSM_ERROR.getCode()).setErrorSubcode(
- BGPError.FSM_ERROR.getSubcode()).build();
- this.sendMessage(fsmError);
+ this.sendMessage(buildErrorNotify(BGPError.FSM_ERROR));
+ // FIXME: is something missing here? (at least an explanation why fall-through is okay
case OpenConfirm:
if (msg instanceof Keepalive) {
negotiationSuccessful(this.session);
// Catch-all for unexpected message
LOG.warn("Channel {} state {} unexpected message {}", this.channel, this.state, msg);
- this.sendMessage(new NotifyBuilder().setErrorCode(BGPError.FSM_ERROR.getCode()).setErrorSubcode(BGPError.FSM_ERROR.getSubcode()).build());
+ this.sendMessage(buildErrorNotify(BGPError.FSM_ERROR));
negotiationFailed(new BGPDocumentedException("Unexpected message", BGPError.FSM_ERROR));
this.state = State.Finished;
}
+ private static Notify buildErrorNotify(final BGPError err) {
+ return new NotifyBuilder().setErrorCode(err.getCode()).setErrorSubcode(err.getSubcode()).build();
+ }
+
private void handleOpen(final Open openObj) {
+ final AsNumber as = AsNumberUtil.advertizedAsNumber(openObj);
+ if (!remoteAs.equals(as)) {
+ LOG.info("Unexpected remote AS number. Expecting {}, got {}", remoteAs, as);
+ this.sendMessage(buildErrorNotify(BGPError.BAD_PEER_AS));
+ negotiationFailed(new BGPDocumentedException("Peer AS number mismatch", BGPError.BAD_PEER_AS));
+ this.state = State.Finished;
+ return;
+ }
+
final List<BgpParameters> prefs = openObj.getBgpParameters();
if (prefs != null && !prefs.isEmpty()) {
if (!prefs.containsAll(this.localPref.getParams())) {
LOG.info("Open message unacceptable. Check the configuration of BGP speaker.");
}
- this.remotePref = openObj;
this.sendMessage(new KeepaliveBuilder().build());
- this.session = new BGPSessionImpl(this.timer, this.listener, this.channel, this.remotePref);
+ this.session = new BGPSessionImpl(this.timer, this.listener, this.channel, openObj);
this.state = State.OpenConfirm;
- LOG.debug("Channel {} moved to OpenConfirm state with remote proposal {}", this.channel, this.remotePref);
+ LOG.debug("Channel {} moved to OpenConfirm state with remote proposal {}", this.channel, openObj);
return;
}
- final Notify ntf = new NotifyBuilder().setErrorCode(BGPError.UNSPECIFIC_OPEN_ERROR.getCode()).setErrorSubcode(
- BGPError.UNSPECIFIC_OPEN_ERROR.getSubcode()).build();
- this.sendMessage(ntf);
- negotiationFailed(new BGPDocumentedException("Open message unacceptable. Check the configuration of BGP speaker.", BGPError.forValue(
- ntf.getErrorCode(), ntf.getErrorSubcode())));
+
+ this.sendMessage(buildErrorNotify(BGPError.UNSPECIFIC_OPEN_ERROR));
+ negotiationFailed(new BGPDocumentedException("Open message unacceptable. Check the configuration of BGP speaker.", BGPError.UNSPECIFIC_OPEN_ERROR));
this.state = State.Finished;
}
import org.opendaylight.protocol.framework.SessionListenerFactory;
import org.opendaylight.protocol.framework.SessionNegotiator;
import org.opendaylight.protocol.framework.SessionNegotiatorFactory;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
import org.opendaylight.yangtools.yang.binding.Notification;
import com.google.common.base.Preconditions;
public final class BGPSessionNegotiatorFactory implements SessionNegotiatorFactory<Notification, BGPSessionImpl, BGPSessionListener> {
private final BGPSessionPreferences initialPrefs;
+ private final AsNumber remoteAs;
private final Timer timer;
- public BGPSessionNegotiatorFactory(final Timer timer, final BGPSessionPreferences initialPrefs) {
+ public BGPSessionNegotiatorFactory(final Timer timer, final BGPSessionPreferences initialPrefs, final AsNumber remoteAs) {
this.timer = Preconditions.checkNotNull(timer);
this.initialPrefs = Preconditions.checkNotNull(initialPrefs);
+ this.remoteAs = Preconditions.checkNotNull(remoteAs);
}
@Override
public SessionNegotiator<BGPSessionImpl> getSessionNegotiator(final SessionListenerFactory<BGPSessionListener> factory,
final Channel channel, final Promise<BGPSessionImpl> promise) {
- return new BGPSessionNegotiator(this.timer, promise, channel, this.initialPrefs, factory.getSessionListener());
+ return new BGPSessionNegotiator(this.timer, promise, channel, this.initialPrefs, remoteAs, factory.getSessionListener());
}
}
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;
/**
* Dispatcher class for creating BGP clients.
* @param listener BGP message listener
* @return Future promising a client session
*/
- Future<? extends BGPSession> createClient(InetSocketAddress address, BGPSessionPreferences preferences, BGPSessionListener listener,
- final ReconnectStrategy strategy);
+ Future<? extends BGPSession> createClient(InetSocketAddress address, BGPSessionPreferences preferences, AsNumber remoteAs,
+ BGPSessionListener listener, ReconnectStrategy strategy);
- Future<Void> createReconnectingClient(InetSocketAddress address, BGPSessionPreferences preferences, BGPSessionListener listener,
- ReconnectStrategyFactory connectStrategyFactory, final ReconnectStrategy reestablishStrategy);
+ Future<Void> createReconnectingClient(InetSocketAddress address, BGPSessionPreferences preferences, AsNumber remoteAs,
+ BGPSessionListener listener, ReconnectStrategyFactory connectStrategyFactory, ReconnectStrategy reestablishStrategy);
}
final ChannelFuture f = mock(ChannelFuture.class);
doReturn(null).when(f).addListener(any(GenericFutureListener.class));
- this.clientSession = new BGPSessionNegotiator(new HashedWheelTimer(), new DefaultPromise<BGPSessionImpl>(GlobalEventExecutor.INSTANCE), this.speakerListener, prefs, new SimpleSessionListener());
+ this.clientSession = new BGPSessionNegotiator(new HashedWheelTimer(), new DefaultPromise<BGPSessionImpl>(GlobalEventExecutor.INSTANCE),
+ this.speakerListener, prefs, new AsNumber(30L), new SimpleSessionListener());
doAnswer(new Answer<Object>() {
@Override
public Object answer(final InvocationOnMock invocation) {
import org.junit.Test;
import org.opendaylight.protocol.bgp.parser.BGPSession;
import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
+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.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev131125.LinkstateAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev131125.LinkstateSubsequentAddressFamily;
public byte[] getBgpId() {
return new byte[] { (byte) 127, 0, 0, 1 };
}
+
+ @Override
+ public AsNumber getAsNumber() {
+ return new AsNumber(30L);
+ }
}, this.listener, types);
}
import org.opendaylight.protocol.bgp.parser.BGPSession;
import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
+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.Keepalive;
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.BgpParameters;
public byte[] getBgpId() {
return new byte[] { (byte) 127, 0, 0, 1 };
}
+
+ @Override
+ public AsNumber getAsNumber() {
+ return new AsNumber(30L);
+ }
});
} else if (!(message instanceof Keepalive)) {
listener.onMessage(null, message);
LOG.debug("{} {} {}", address, sessionListener, proposal);
final InetSocketAddress addr = address;
- m.dispatcher.createClient(addr, proposal, sessionListener,
+ m.dispatcher.createClient(addr, proposal, as, sessionListener,
new NeverReconnectStrategy(GlobalEventExecutor.INSTANCE, RECONNECT_MILLIS));
}
}
final BGPSessionPreferences prefs = new BGPSessionProposalImpl((short) 90, new AsNumber(72L), new Ipv4Address("127.0.0.2"), tables).getProposal();
- final SessionNegotiatorFactory<Notification, BGPSessionImpl, BGPSessionListener> snf = new BGPSessionNegotiatorFactory(new HashedWheelTimer(), prefs);
+ final SessionNegotiatorFactory<Notification, BGPSessionImpl, BGPSessionListener> snf = new BGPSessionNegotiatorFactory(new HashedWheelTimer(), prefs, new AsNumber(72L));
final BGPSpeakerMock<Notification, BGPSessionImpl, BGPSessionListener> mock = new BGPSpeakerMock<>(snf, new BGPHandlerFactory(ServiceLoaderBGPExtensionProviderContext.createConsumerContext().getMessageRegistry()), new DefaultPromise<BGPSessionImpl>(GlobalEventExecutor.INSTANCE));
}).when(this.mockedTransaction).readOperationalData(Matchers.any(InstanceIdentifier.class));
Mockito.doReturn(GlobalEventExecutor.INSTANCE.newSucceededFuture(null)).when(dispatcher).
- createReconnectingClient(Mockito.any(InetSocketAddress.class), Mockito.any(BGPSessionPreferences.class),
+ createReconnectingClient(Mockito.any(InetSocketAddress.class), Mockito.any(BGPSessionPreferences.class), Mockito.any(AsNumber.class),
Mockito.any(BGPSessionListener.class), Mockito.eq(tcpStrategyFactory), Mockito.eq(sessionStrategy));
ext = new SimpleRIBExtensionProviderContext();
private void runTestWithTables(final List<BgpTableType> tables) {
final RIBImpl rib = new RIBImpl(new RibId("testRib"), new AsNumber(72L), new Ipv4Address("127.0.0.1"), ext,
this.dispatcher, this.tcpStrategyFactory, this.sessionStrategy, this.providerService, tables);
- final BGPPeer peer = new BGPPeer("peer-" + this.mock.toString(), null, null, rib);
+ final BGPPeer peer = new BGPPeer("peer-" + this.mock.toString(), null, null, rib.getLocalAs(), rib);
ListenerRegistration<?> reg = this.mock.registerUpdateListener(peer);
reg.close();