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