be65fb4e24e60cb3fb08dc8673b6b6ec6f722396
[bgpcep.git] / bgp / rib-spi / src / main / java / org / opendaylight / protocol / bgp / rib / spi / BGPSessionListener.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.rib.spi;
9
10 import java.util.EventListener;
11 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
13 import org.opendaylight.yangtools.yang.binding.Notification;
14
15 /**
16  * Listener that receives session informations from the session.
17  */
18 public interface BGPSessionListener extends EventListener {
19
20     /**
21      * Marks synchronization finished for given Table key
22      *
23      * @param tablesKey of the table where synchronization finished
24      */
25     void markUptodate(final TablesKey tablesKey);
26
27     /**
28      * Fired when the session was established successfully.
29      *
30      * @param session Peer address families which we accepted
31      */
32     void onSessionUp(BGPSession session);
33     /**
34      * Fired when the session went down because of an IO error. Implementation should take care of closing underlying
35      * session.
36      *
37      * @param session that went down
38      * @param e Exception that was thrown as the cause of session being down
39      */
40
41     void onSessionDown(BGPSession session, Exception e);
42     /**
43      * Fired when the session is terminated locally. The session has already been closed and transitioned to IDLE state.
44      * Any outstanding queued messages were not sent. The user should not attempt to make any use of the session.
45      *
46      * @param reason the cause why the session went down
47      */
48     void onSessionTerminated(BGPSession session, BGPTerminationReason reason);
49
50     /**
51      * Fired when a normal protocol message is received.
52      *
53      * @param notification Protocol message
54      */
55     void onMessage(BGPSession session, Notification notification) throws BGPDocumentedException;
56
57     void releaseConnection();
58 }