Reduce NETCONF device disconnect warnings
[netconf.git] / netconf / netconf-api / src / main / java / org / opendaylight / netconf / api / NetconfSessionListener.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.netconf.api;
9
10 import java.io.EOFException;
11
12 // FIXME: NETCONF-554: rework this interface
13 public interface NetconfSessionListener<S extends NetconfSession> {
14     /**
15      * Fired when the session was established successfully.
16      *
17      * @param session New session
18      */
19     void onSessionUp(S session);
20
21     /**
22      * Fired when the session went down because of an IO error. Implementation should take care of closing underlying
23      * session.
24      *
25      * @param session that went down
26      * @param cause Exception that was thrown as the cause of session being down. A common cause is
27      *              {@link EOFException}, which indicates the remote end has shut down the communication channel.
28      */
29     void onSessionDown(S session, Exception cause);
30
31     /**
32      * Fired when the session is terminated locally. The session has already been closed and transitioned to IDLE state.
33      * Any outstanding queued messages were not sent. The user should not attempt to make any use of the session.
34      *
35      * @param reason the cause why the session went down
36      */
37     void onSessionTerminated(S session, NetconfTerminationReason reason);
38
39     /**
40      * Fired when a normal protocol message is received.
41      *
42      * @param message Protocol message
43      */
44     void onMessage(S session, NetconfMessage message);
45 }