blob: bb565f256a50425489dc9b655ea0659f58b129fb [file] [log] [blame]
Hesam Rahimi4a409b42016-08-12 18:37:33 -04001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.protocol.restconf;
17
18import org.onosproject.net.DeviceId;
19import org.onosproject.protocol.http.HttpSBController;
20
21/**
22 * Abstraction of a RESTCONF controller. Serves as a one stop shop for obtaining
23 * RESTCONF southbound devices and (un)register listeners.
24 */
25public interface RestConfSBController extends HttpSBController {
26
27 /**
28 * This method is to be called by whoever is interested to receive
29 * Notifications from a specific device. It does a REST GET request
30 * with specified parameters to the device, and calls the provided
31 * callBackListener upon receiving notifications to notify the requester
32 * about notifications.
33 *
Henry Yu05dcc212017-01-05 16:05:26 -050034 * @param device device to make the request to
35 * @param request url of the request
36 * @param mediaType format to retrieve the content in
Hesam Rahimi4a409b42016-08-12 18:37:33 -040037 * @param callBackListener method to call when notifications arrives
38 */
39 void enableNotifications(DeviceId device, String request, String mediaType,
Henry Yu05dcc212017-01-05 16:05:26 -050040 RestconfNotificationEventListener callBackListener);
Hesam Rahimi4a409b42016-08-12 18:37:33 -040041
42 /**
Henry Yu05dcc212017-01-05 16:05:26 -050043 * Registers a listener for notification events that occur to restconf
Hesam Rahimi4a409b42016-08-12 18:37:33 -040044 * devices.
45 *
Henry Yu05dcc212017-01-05 16:05:26 -050046 * @param deviceId identifier of the device to which the listener is attached
Hesam Rahimi4a409b42016-08-12 18:37:33 -040047 * @param listener the listener to notify
48 */
49 void addNotificationListener(DeviceId deviceId,
Henry Yu05dcc212017-01-05 16:05:26 -050050 RestconfNotificationEventListener listener);
Hesam Rahimi4a409b42016-08-12 18:37:33 -040051
52 /**
Henry Yu05dcc212017-01-05 16:05:26 -050053 * Unregisters the listener for the device.
Hesam Rahimi4a409b42016-08-12 18:37:33 -040054 *
Henry Yu05dcc212017-01-05 16:05:26 -050055 * @param deviceId identifier of the device for which the listener
56 * is to be removed
57 * @param listener listener to be removed
Hesam Rahimi4a409b42016-08-12 18:37:33 -040058 */
Henry Yu05dcc212017-01-05 16:05:26 -050059 void removeNotificationListener(DeviceId deviceId,
60 RestconfNotificationEventListener listener);
61
62 /**
63 * Returns true if a listener has been installed to listen to RESTCONF
64 * notifications sent from a particular device.
65 *
66 * @param deviceId identifier of the device from which the notifications
67 * are generated
68 * @return true if listener is installed; false otherwise
69 */
70 boolean isNotificationEnabled(DeviceId deviceId);
Hesam Rahimi4a409b42016-08-12 18:37:33 -040071}