Hesam Rahimi | 4a409b4 | 2016-08-12 18:37:33 -0400 | [diff] [blame^] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.protocol.restconf; |
| 17 | |
| 18 | import org.onosproject.net.DeviceId; |
| 19 | import 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 | */ |
| 25 | public 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 | * |
| 34 | * |
| 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 |
| 38 | * @param callBackListener method to call when notifications arrives |
| 39 | */ |
| 40 | void enableNotifications(DeviceId device, String request, String mediaType, |
| 41 | RestConfNotificationEventListener callBackListener); |
| 42 | |
| 43 | /** |
| 44 | * Register a listener for notification events that occur to restconf |
| 45 | * devices. |
| 46 | * |
| 47 | * @param deviceId the deviceId |
| 48 | * @param listener the listener to notify |
| 49 | */ |
| 50 | void addNotificationListener(DeviceId deviceId, |
| 51 | RestConfNotificationEventListener listener); |
| 52 | |
| 53 | /** |
| 54 | * Unregister the listener for the device. |
| 55 | * |
| 56 | * @param deviceId the deviceId |
| 57 | */ |
| 58 | void removeNotificationListener(DeviceId deviceId); |
| 59 | } |