Laszlo Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 52f2cd1 | 2018-11-08 21:20:04 -0800 | [diff] [blame] | 2 | * Copyright 2018-present Open Networking Foundation |
Laszlo Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 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 | |
Thomas Vachuska | 52f2cd1 | 2018-11-08 21:20:04 -0800 | [diff] [blame] | 17 | package org.onosproject.alarm; |
Laszlo Papp | 9655b18 | 2017-01-31 13:01:45 -0800 | [diff] [blame] | 18 | |
| 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onosproject.net.driver.HandlerBehaviour; |
| 21 | |
| 22 | import java.util.List; |
| 23 | import java.util.Set; |
| 24 | |
| 25 | /** |
| 26 | * Abstraction of a device behaviour capable of translating a list of |
| 27 | * alarms from a device. Also provides a method to configure the address where to |
| 28 | * send the alarms/traps/notifications. |
| 29 | */ |
| 30 | public interface DeviceAlarmConfig extends HandlerBehaviour { |
| 31 | |
| 32 | /** |
| 33 | * Configures the device to send alarms to a particular Ip and port combination. |
| 34 | * |
| 35 | * @param address address to wich the device should send alarms |
| 36 | * @param port port on which the controller is listening |
| 37 | * @param protocol tcp or udp |
| 38 | * @return boolean true if the device was properly configured |
| 39 | */ |
| 40 | boolean configureDevice(IpAddress address, int port, String protocol); |
| 41 | |
| 42 | /** |
| 43 | * Returns the list of translated alarms from device-specific representation |
| 44 | * to ONOS alarms. |
| 45 | * |
| 46 | * @param unparsedAlarms alarms arrived from the device depending on protocol |
| 47 | * @param <T> type of object given from the device |
| 48 | * @return list of alarms consumed from the device |
| 49 | */ |
| 50 | <T> Set<Alarm> translateAlarms(List<T> unparsedAlarms); |
| 51 | |
| 52 | } |