Migrate NetconfHelloMessage's use of Optional
[netconf.git] / netconf / netconf-api / src / main / java / org / opendaylight / netconf / api / monitoring / NetconfMonitoringService.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.monitoring;
9
10 import java.util.Collection;
11 import java.util.Optional;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Schemas;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Sessions;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.sessions.Session;
16
17 public interface NetconfMonitoringService {
18
19     Sessions getSessions();
20
21     /**
22      * Returns session monitoring service session listener, which is used to notify monitoring service about state of
23      * session.
24      *
25      * @return session listener
26      */
27     SessionListener getSessionListener();
28
29     Schemas getSchemas();
30
31     String getSchemaForCapability(String moduleName, Optional<String> revision);
32
33     Capabilities getCapabilities();
34
35     /**
36      * Allows push based capabilities information transfer. After the listener is registered, current state is pushed
37      * to the listener.
38      *
39      * @param listener Monitoring listener
40      * @return listener registration
41      */
42     AutoCloseable registerCapabilitiesListener(CapabilitiesListener listener);
43
44     /**
45      * Allows push based sessions information transfer.
46      *
47      * @param listener Monitoring listener
48      * @return listener registration
49      */
50     AutoCloseable registerSessionsListener(SessionsListener listener);
51
52     interface CapabilitiesListener {
53
54         /**
55          * Callback used to notify about a change in used capabilities.
56          *
57          * @param capabilities resulting capabilities
58          */
59         void onCapabilitiesChanged(Capabilities capabilities);
60
61         /**
62          * Callback used to notify about a change in used schemas.
63          *
64          * @param schemas resulting schemas
65          */
66         void onSchemasChanged(Schemas schemas);
67     }
68
69     interface SessionsListener {
70         /**
71          * Callback used to notify about netconf session start.
72          *
73          * @param session started session
74          */
75         void onSessionStarted(Session session);
76
77         /**
78          * Callback used to notify about netconf session end.
79          *
80          * @param session ended session
81          */
82         void onSessionEnded(Session session);
83
84         /**
85          * Callback used to notify about activity in netconf session, like
86          * rpc or notification. It is triggered at regular time interval. Session parameter
87          * contains only sessions which state was changed.
88          *
89          * @param sessions updated sessions
90          */
91         void onSessionsUpdated(Collection<Session> sessions);
92
93     }
94 }