import com.google.common.collect.Lists;
import java.util.List;
-import org.opendaylight.protocol.bgp.parser.BGPSession;
-import org.opendaylight.protocol.bgp.parser.BGPTerminationReason;
-import org.opendaylight.protocol.bgp.rib.impl.spi.ReusableBGPPeer;
+import org.opendaylight.protocol.bgp.rib.spi.BGPSession;
+import org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener;
+import org.opendaylight.protocol.bgp.rib.spi.BGPTerminationReason;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
import org.opendaylight.yangtools.yang.binding.Notification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Listener for the client.
*/
-public class SimpleSessionListener implements ReusableBGPPeer {
+public class SimpleSessionListener implements BGPSessionListener {
private final List<Notification> listMsg = Lists.newArrayList();
public boolean down = false;
+ private BGPSession session;
+
+ public SimpleSessionListener() {
+ }
+
public List<Notification> getListMsg() {
return this.listMsg;
}
@Override
public void onSessionUp(final BGPSession session) {
LOG.debug("Session Up");
+ this.session = session;
this.up = true;
}
@Override
public void releaseConnection() {
LOG.debug("Releasing connection");
+ if (this.session != null) {
+ try {
+ this.session.close();
+ } catch (final Exception e) {
+ LOG.warn("Error closing session", e);
+ }
+ this.session = null;
+ }
+ }
+
+ @Override
+ public boolean isSessionActive() {
+ return true;
+ }
+
+ @Override
+ public void markUptodate(final TablesKey tablesKey) {
+ LOG.debug("Table marked as up-to-date {}", tablesKey);
}
}