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 java.util.List;
12 import org.opendaylight.protocol.bgp.parser.BGPMessage;
13 import org.opendaylight.protocol.bgp.parser.BGPSession;
14 import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
15 import org.opendaylight.protocol.bgp.parser.BGPTerminationReason;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
19 import com.google.common.collect.Lists;
22 * Listener for the client.
24 public class SimpleSessionListener implements BGPSessionListener {
26 private final List<BGPMessage> listMsg = Lists.newArrayList();
28 public boolean up = false;
30 private static final Logger logger = LoggerFactory.getLogger(SimpleSessionListener.class);
32 public boolean down = false;
34 public List<BGPMessage> getListMsg() {
39 public void onMessage(final BGPSession session, final BGPMessage message) {
40 this.listMsg.add(message);
41 logger.debug("Message received:" + message);
45 public void onSessionUp(final BGPSession session) {
46 logger.debug("Session Up");
51 public void onSessionDown(final BGPSession session, final Exception e) {
52 logger.debug("Session Down", e);
57 public void onSessionTerminated(final BGPSession session, final BGPTerminationReason cause) {
58 logger.debug("Session terminated. Cause : " + cause.toString());