Add missing null nlri check on BGPUpdateMessageParser
[bgpcep.git] / bgp / testtool / src / test / java / org / opendaylight / protocol / bgp / testtool / SpeakerSessionListener.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.protocol.bgp.testtool;
9
10 import org.opendaylight.protocol.bgp.rib.spi.BGPSession;
11 import org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener;
12 import org.opendaylight.protocol.bgp.rib.spi.BGPTerminationReason;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
14 import org.opendaylight.yangtools.yang.binding.Notification;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 public class SpeakerSessionListener implements BGPSessionListener {
19     private static final Logger LOG = LoggerFactory.getLogger(SpeakerSessionListener.class);
20
21     @Override
22     public void onSessionUp(final BGPSession session) {
23         LOG.info("Server: Session is up.");
24     }
25
26     @Override
27     public void onSessionTerminated(final BGPSession session, final BGPTerminationReason cause) {
28         LOG.info("Server: Session terminated: {}", cause);
29     }
30
31     @Override
32     public void onSessionDown(final BGPSession session, final Exception e) {
33         LOG.info("Server: Session down.");
34         try {
35             session.close();
36         } catch (Exception ie) {
37             LOG.warn("Error closing session", ie);
38         }
39         // this.d.stop();
40     }
41
42     @Override
43     public void onMessage(final BGPSession session, final Notification message) {
44         LOG.info("Server: Message received: {}", message);
45         // this.d.stop();
46     }
47
48     @Override
49     public void releaseConnection() {
50
51     }
52
53     @Override
54     public boolean isSessionActive() {
55         return true;
56     }
57
58     @Override
59     public void markUptodate(final TablesKey tablesKey) {
60         LOG.debug("Table marked as up-to-date {}", tablesKey);
61     }
62 }