package org.opendaylight.controller.config.yang.bgp.rib.impl;
import com.google.common.base.Objects;
-
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
@Override
public BGPSessionPreferences getPeerPreferences(final IpAddress ip) {
- return global.getPeerPreferences(ip);
+ return this.global.getPeerPreferences(ip);
}
@Override
public BGPSessionListener getPeer(final IpAddress ip, final Ipv4Address sourceId, final Ipv4Address remoteId) throws BGPDocumentedException {
- return global.getPeer(ip, sourceId, remoteId);
+ return this.global.getPeer(ip, sourceId, remoteId);
}
@Override
public boolean isPeerConfigured(final IpAddress ip) {
- return global.isPeerConfigured(ip);
+ return this.global.isPeerConfigured(ip);
}
@Override
public void removePeer(final IpAddress ip) {
- global.removePeer(ip);
+ this.global.removePeer(ip);
+ }
+
+ @Override
+ public void removePeerSession(final IpAddress ip) {
+ this.global.removePeerSession(ip);
}
@Override
public void addPeer(final IpAddress ip, final ReusableBGPPeer peer, final BGPSessionPreferences preferences) {
- global.addPeer(ip, peer, preferences);
+ this.global.addPeer(ip, peer, preferences);
}
@Override
@Override
public String toString() {
return Objects.toStringHelper(this)
- .add("peers", global)
+ .add("peers", this.global)
.toString();
}
}
-
}
// deliver the message, this method gets called with different exception (definitely not with BGPDocumentedException).
this.sendMessage(buildErrorNotify(((BGPDocumentedException)e).getError()));
}
+ this.registry.removePeerSession(getRemoteIp());
super.negotiationFailed(e);
this.state = State.Finished;
}
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
-
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Map;
-
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
-
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.parser.BGPError;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
this.peers.remove(ip);
}
+ public synchronized void removePeerSession(final IpAddress ip) {
+ Preconditions.checkNotNull(ip);
+ this.sessionIds.remove(ip);
+ }
+
@Override
public boolean isPeerConfigured(final IpAddress ip) {
Preconditions.checkNotNull(ip);
*/
void removePeer(IpAddress ip);
+ /**
+ * Remove peer session from registry.
+ *
+ * @param ip address of remote peer
+ */
+ void removePeerSession(IpAddress ip);
+
/**
* Check whether peer on provided IP address is present in this registry.
*
package org.opendaylight.protocol.bgp.testtool;
import com.google.common.base.Preconditions;
-
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.util.concurrent.DefaultPromise;
import io.netty.util.concurrent.GlobalEventExecutor;
import io.netty.util.concurrent.Promise;
-
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.Map;
-
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.rib.impl.BGPHandlerFactory;
public void close() throws Exception {
}
+
+ @Override
+ public void removePeerSession(final IpAddress ip) {}
};
final SessionNegotiatorFactory<Notification, BGPSessionImpl, BGPSessionListener> snf = new BGPServerSessionNegotiatorFactory(new BGPSessionValidator() {