blob: 772aaeae27efc3dd8768f656904d082eff499f45 [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 *
Ray Milkey92a99a02017-01-30 18:12:56 +000034 *
35 * @param device device to make the request to
36 * @param request url of the request
37 * @param mediaType format to retrieve the content in
Hesam Rahimi4a409b42016-08-12 18:37:33 -040038 * @param callBackListener method to call when notifications arrives
39 */
40 void enableNotifications(DeviceId device, String request, String mediaType,
Ray Milkey92a99a02017-01-30 18:12:56 +000041 RestConfNotificationEventListener callBackListener);
Hesam Rahimi4a409b42016-08-12 18:37:33 -040042
43 /**
Ray Milkey92a99a02017-01-30 18:12:56 +000044 * Register a listener for notification events that occur to restconf
Hesam Rahimi4a409b42016-08-12 18:37:33 -040045 * devices.
46 *
Ray Milkey92a99a02017-01-30 18:12:56 +000047 * @param deviceId the deviceId
Hesam Rahimi4a409b42016-08-12 18:37:33 -040048 * @param listener the listener to notify
49 */
50 void addNotificationListener(DeviceId deviceId,
Ray Milkey92a99a02017-01-30 18:12:56 +000051 RestConfNotificationEventListener listener);
Hesam Rahimi4a409b42016-08-12 18:37:33 -040052
53 /**
Ray Milkey92a99a02017-01-30 18:12:56 +000054 * Unregister the listener for the device.
Hesam Rahimi4a409b42016-08-12 18:37:33 -040055 *
Ray Milkey92a99a02017-01-30 18:12:56 +000056 * @param deviceId the deviceId
Hesam Rahimi4a409b42016-08-12 18:37:33 -040057 */
Ray Milkey92a99a02017-01-30 18:12:56 +000058 void removeNotificationListener(DeviceId deviceId);
Hesam Rahimi4a409b42016-08-12 18:37:33 -040059}