kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [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 | package org.onosproject.incubator.net.faultmanagement.alarm; |
| 17 | |
Andrea Campanella | 8e94b0c | 2016-04-12 13:58:07 -0700 | [diff] [blame] | 18 | import org.onosproject.event.ListenerService; |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 19 | import org.onosproject.net.ConnectPoint; |
| 20 | import org.onosproject.net.DeviceId; |
| 21 | |
Andrea Campanella | 8e94b0c | 2016-04-12 13:58:07 -0700 | [diff] [blame] | 22 | import java.util.Map; |
| 23 | import java.util.Set; |
| 24 | |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 25 | /** |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 26 | * Service for interacting with the alarm handling of devices. Unless stated otherwise, getter methods |
| 27 | * return active AND recently-cleared alarms. |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 28 | */ |
Andrea Campanella | 8e94b0c | 2016-04-12 13:58:07 -0700 | [diff] [blame] | 29 | public interface AlarmService extends ListenerService<AlarmEvent, AlarmListener> { |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 30 | |
| 31 | /** |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 32 | * Update book-keeping (ie administrative) fields for the alarm matching the specified identifier. |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 33 | * |
Andrea Campanella | 8e94b0c | 2016-04-12 13:58:07 -0700 | [diff] [blame] | 34 | * @param id alarm identifier |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 35 | * @param isAcknowledged new acknowledged state |
Andrea Campanella | 8e94b0c | 2016-04-12 13:58:07 -0700 | [diff] [blame] | 36 | * @param assignedUser new assigned user, null clear |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 37 | * @return updated alarm (including any recent device-derived changes) |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 38 | */ |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 39 | Alarm updateBookkeepingFields(AlarmId id, boolean isAcknowledged, String assignedUser); |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 40 | |
| 41 | /** |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 42 | * Returns summary of alarms on a given device. |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 43 | * |
| 44 | * @param deviceId the device |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 45 | * @return map of severity (if applicable) vs alarm counts; empty map if either the device has no alarms or |
| 46 | * identified device is not managed. |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 47 | */ |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 48 | Map<Alarm.SeverityLevel, Long> getAlarmCounts(DeviceId deviceId); |
| 49 | |
| 50 | /** |
| 51 | * Returns summary of alarms on all devices. |
| 52 | * |
| 53 | * @return map of severity (if applicable) vs alarm counts; empty map if no alarms. |
| 54 | */ |
| 55 | Map<Alarm.SeverityLevel, Long> getAlarmCounts(); |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 56 | |
| 57 | /** |
| 58 | * Returns the alarm with the specified identifier. |
| 59 | * |
| 60 | * @param alarmId alarm identifier |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 61 | * @return alarm matching id; null if no alarm matches the identifier. |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 62 | */ |
| 63 | Alarm getAlarm(AlarmId alarmId); |
| 64 | |
| 65 | /** |
| 66 | * Returns all of the alarms. |
| 67 | * |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 68 | * @return set of alarms; empty set if no alarms |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 69 | */ |
| 70 | Set<Alarm> getAlarms(); |
| 71 | |
| 72 | /** |
| 73 | * Returns all of the ACTIVE alarms. Recently cleared alarms excluded. |
| 74 | * |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 75 | * @return set of alarms; empty set if no alarms |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 76 | */ |
| 77 | Set<Alarm> getActiveAlarms(); |
| 78 | |
| 79 | /** |
| 80 | * Returns the alarms with the specified severity. |
| 81 | * |
| 82 | * @param severity the alarm severity |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 83 | * @return set of alarms with a particular severity; empty set if no alarms |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 84 | */ |
| 85 | Set<Alarm> getAlarms(Alarm.SeverityLevel severity); |
| 86 | |
| 87 | /** |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 88 | * Returns the alarm matching a given device, regardless of source within that device. |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 89 | * |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 90 | * @param deviceId the device to use when searching alarms. |
| 91 | * @return set of alarms; empty set if no alarms |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 92 | */ |
| 93 | Set<Alarm> getAlarms(DeviceId deviceId); |
| 94 | |
| 95 | /** |
| 96 | * Returns the alarm for a given device and source. |
| 97 | * |
| 98 | * @param deviceId the device |
Andrea Campanella | 8e94b0c | 2016-04-12 13:58:07 -0700 | [diff] [blame] | 99 | * @param source the source within the device |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 100 | * @return set of alarms; empty set if no alarms |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 101 | */ |
| 102 | Set<Alarm> getAlarms(DeviceId deviceId, AlarmEntityId source); |
| 103 | |
| 104 | /** |
| 105 | * Returns the alarm affecting a given link. |
| 106 | * |
| 107 | * @param src one end of the link |
| 108 | * @param dst one end of the link |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 109 | * @return set of alarms; empty set if no alarms |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 110 | */ |
| 111 | Set<Alarm> getAlarmsForLink(ConnectPoint src, ConnectPoint dst); |
| 112 | |
| 113 | /** |
| 114 | * Returns the alarm affecting a given flow. |
| 115 | * |
| 116 | * @param deviceId the device |
Andrea Campanella | 8e94b0c | 2016-04-12 13:58:07 -0700 | [diff] [blame] | 117 | * @param flowId the flow |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 118 | * @return set of alarms; empty set if no alarms |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 119 | */ |
| 120 | Set<Alarm> getAlarmsForFlow(DeviceId deviceId, long flowId); |
| 121 | |
kmcpeake | b172d5f | 2015-12-10 11:30:43 +0000 | [diff] [blame] | 122 | // TODO Support retrieving alarms affecting other entity types may be added in future release |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 123 | } |