blob: d233e34af7ecb21bf1b1d660cea42ea225bb2b04 [file] [log] [blame]
kmcpeake4fe18c82015-11-17 20:07:39 +00001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
kmcpeake4fe18c82015-11-17 20:07:39 +00003 *
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.incubator.net.faultmanagement.alarm;
17
Andrea Campanella8e94b0c2016-04-12 13:58:07 -070018import org.onosproject.event.ListenerService;
kmcpeake4fe18c82015-11-17 20:07:39 +000019import org.onosproject.net.ConnectPoint;
20import org.onosproject.net.DeviceId;
21
Andrea Campanella8e94b0c2016-04-12 13:58:07 -070022import java.util.Map;
23import java.util.Set;
24
kmcpeake4fe18c82015-11-17 20:07:39 +000025/**
kmcpeakeb172d5f2015-12-10 11:30:43 +000026 * Service for interacting with the alarm handling of devices. Unless stated otherwise, getter methods
27 * return active AND recently-cleared alarms.
kmcpeake4fe18c82015-11-17 20:07:39 +000028 */
Andrea Campanella8e94b0c2016-04-12 13:58:07 -070029public interface AlarmService extends ListenerService<AlarmEvent, AlarmListener> {
kmcpeake4fe18c82015-11-17 20:07:39 +000030
31 /**
kmcpeakeb172d5f2015-12-10 11:30:43 +000032 * Update book-keeping (ie administrative) fields for the alarm matching the specified identifier.
kmcpeake4fe18c82015-11-17 20:07:39 +000033 *
Andrea Campanella8e94b0c2016-04-12 13:58:07 -070034 * @param id alarm identifier
kmcpeakeb172d5f2015-12-10 11:30:43 +000035 * @param isAcknowledged new acknowledged state
Andrea Campanella8e94b0c2016-04-12 13:58:07 -070036 * @param assignedUser new assigned user, null clear
kmcpeakeb172d5f2015-12-10 11:30:43 +000037 * @return updated alarm (including any recent device-derived changes)
kmcpeake4fe18c82015-11-17 20:07:39 +000038 */
kmcpeakeb172d5f2015-12-10 11:30:43 +000039 Alarm updateBookkeepingFields(AlarmId id, boolean isAcknowledged, String assignedUser);
kmcpeake4fe18c82015-11-17 20:07:39 +000040
41 /**
kmcpeakeb172d5f2015-12-10 11:30:43 +000042 * Returns summary of alarms on a given device.
kmcpeake4fe18c82015-11-17 20:07:39 +000043 *
44 * @param deviceId the device
kmcpeakeb172d5f2015-12-10 11:30:43 +000045 * @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.
kmcpeake4fe18c82015-11-17 20:07:39 +000047 */
kmcpeakeb172d5f2015-12-10 11:30:43 +000048 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();
kmcpeake4fe18c82015-11-17 20:07:39 +000056
57 /**
58 * Returns the alarm with the specified identifier.
59 *
60 * @param alarmId alarm identifier
kmcpeakeb172d5f2015-12-10 11:30:43 +000061 * @return alarm matching id; null if no alarm matches the identifier.
kmcpeake4fe18c82015-11-17 20:07:39 +000062 */
63 Alarm getAlarm(AlarmId alarmId);
64
65 /**
66 * Returns all of the alarms.
67 *
kmcpeakeb172d5f2015-12-10 11:30:43 +000068 * @return set of alarms; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +000069 */
70 Set<Alarm> getAlarms();
71
72 /**
73 * Returns all of the ACTIVE alarms. Recently cleared alarms excluded.
74 *
kmcpeakeb172d5f2015-12-10 11:30:43 +000075 * @return set of alarms; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +000076 */
77 Set<Alarm> getActiveAlarms();
78
79 /**
80 * Returns the alarms with the specified severity.
81 *
82 * @param severity the alarm severity
kmcpeakeb172d5f2015-12-10 11:30:43 +000083 * @return set of alarms with a particular severity; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +000084 */
85 Set<Alarm> getAlarms(Alarm.SeverityLevel severity);
86
87 /**
kmcpeakeb172d5f2015-12-10 11:30:43 +000088 * Returns the alarm matching a given device, regardless of source within that device.
kmcpeake4fe18c82015-11-17 20:07:39 +000089 *
kmcpeakeb172d5f2015-12-10 11:30:43 +000090 * @param deviceId the device to use when searching alarms.
91 * @return set of alarms; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +000092 */
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 Campanella8e94b0c2016-04-12 13:58:07 -070099 * @param source the source within the device
kmcpeakeb172d5f2015-12-10 11:30:43 +0000100 * @return set of alarms; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +0000101 */
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
kmcpeakeb172d5f2015-12-10 11:30:43 +0000109 * @return set of alarms; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +0000110 */
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 Campanella8e94b0c2016-04-12 13:58:07 -0700117 * @param flowId the flow
kmcpeakeb172d5f2015-12-10 11:30:43 +0000118 * @return set of alarms; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +0000119 */
120 Set<Alarm> getAlarmsForFlow(DeviceId deviceId, long flowId);
121
kmcpeakeb172d5f2015-12-10 11:30:43 +0000122 // TODO Support retrieving alarms affecting other entity types may be added in future release
kmcpeake4fe18c82015-11-17 20:07:39 +0000123}