2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.bgp.rib.impl;
10 import com.google.common.collect.Lists;
11 import java.util.List;
12 import org.opendaylight.protocol.bgp.rib.impl.spi.ReusableBGPPeer;
13 import org.opendaylight.protocol.bgp.rib.spi.BGPSession;
14 import org.opendaylight.protocol.bgp.rib.spi.BGPTerminationReason;
15 import org.opendaylight.yangtools.yang.binding.Notification;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * Listener for the client.
22 public class SimpleSessionListener implements ReusableBGPPeer {
24 private final List<Notification> listMsg = Lists.newArrayList();
26 public boolean up = false;
28 private static final Logger LOG = LoggerFactory.getLogger(SimpleSessionListener.class);
30 public boolean down = false;
32 public List<Notification> getListMsg() {
37 public void onMessage(final BGPSession session, final Notification message) {
38 this.listMsg.add(message);
39 LOG.debug("Message received: {}", message);
43 public void onSessionUp(final BGPSession session) {
44 LOG.debug("Session Up");
49 public void onSessionDown(final BGPSession session, final Exception e) {
50 LOG.debug("Session Down", e);
55 public void onSessionTerminated(final BGPSession session, final BGPTerminationReason cause) {
56 LOG.debug("Session terminated. Cause : {}", cause.toString());
60 public void releaseConnection() {
61 LOG.debug("Releasing connection");
65 public boolean isSessionActive() {