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;
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.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
17 import org.opendaylight.yangtools.yang.binding.Notification;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
21 import com.google.common.collect.Lists;
24 * Listener for the BGP Speaker.
26 public class SpeakerSessionListener implements BGPSessionListener {
28 public List<Notification> messages = Lists.newArrayList();
30 public boolean up = false;
32 public Set<BgpTableType> types;
34 private static final Logger logger = LoggerFactory.getLogger(SpeakerSessionListener.class);
36 public SpeakerSessionListener() {
40 public void onMessage(final BGPSession session, final Notification message) {
41 logger.debug("Received message: " + message.getClass() + " " + message);
42 this.messages.add(message);
46 public synchronized void onSessionUp(final BGPSession session) {
47 logger.debug("Session up.");
49 this.types = session.getAdvertisedTableTypes();
54 public void onSessionDown(final BGPSession session, final Exception e) {
55 logger.debug("Session down.");
60 public void onSessionTerminated(final BGPSession session, final BGPTerminationReason cause) {
61 logger.debug("Session terminated. Cause : " + cause.toString());