Move netconf.api.monitoring
[netconf.git] / protocol / netconf-server / src / main / java / org / opendaylight / netconf / server / 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.server.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 import org.opendaylight.yangtools.concepts.Registration;
17
18 public interface NetconfMonitoringService {
19
20     Sessions getSessions();
21
22     /**
23      * Returns session monitoring service session listener, which is used to notify monitoring service about state of
24      * session.
25      *
26      * @return session listener
27      */
28     SessionListener getSessionListener();
29
30     Schemas getSchemas();
31
32     String getSchemaForCapability(String moduleName, Optional<String> revision);
33
34     Capabilities getCapabilities();
35
36     /**
37      * Allows push based capabilities information transfer. After the listener is registered, current state is pushed
38      * to the listener.
39      *
40      * @param listener Monitoring listener
41      * @return listener registration
42      */
43     Registration registerCapabilitiesListener(CapabilitiesListener listener);
44
45     /**
46      * Allows push based sessions information transfer.
47      *
48      * @param listener Monitoring listener
49      * @return listener registration
50      */
51     Registration registerSessionsListener(SessionsListener listener);
52
53     interface CapabilitiesListener {
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 }