blob: d31b3f42b950f8911582d9b422955b24eb010566 [file] [log] [blame]
kmcpeake4fe18c82015-11-17 20:07:39 +00001/*
2 * Copyright 2014-2015 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.incubator.net.faultmanagement.alarm;
17
18import com.google.common.annotations.Beta;
kmcpeakeb172d5f2015-12-10 11:30:43 +000019import java.util.Map;
kmcpeake4fe18c82015-11-17 20:07:39 +000020
21import java.util.Set;
22import org.onosproject.net.ConnectPoint;
23import org.onosproject.net.DeviceId;
24
25/**
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 */
29@Beta
30public interface AlarmService {
kmcpeake4fe18c82015-11-17 20:07:39 +000031
32 /**
kmcpeakeb172d5f2015-12-10 11:30:43 +000033 * Update book-keeping (ie administrative) fields for the alarm matching the specified identifier.
kmcpeake4fe18c82015-11-17 20:07:39 +000034 *
kmcpeakeb172d5f2015-12-10 11:30:43 +000035 * @param id alarm identifier
36 * @param isAcknowledged new acknowledged state
37 * @param assignedUser new assigned user, null clear
38 * @return updated alarm (including any recent device-derived changes)
39 *
kmcpeake4fe18c82015-11-17 20:07:39 +000040 */
kmcpeakeb172d5f2015-12-10 11:30:43 +000041 Alarm updateBookkeepingFields(AlarmId id, boolean isAcknowledged, String assignedUser);
kmcpeake4fe18c82015-11-17 20:07:39 +000042
43 /**
kmcpeakeb172d5f2015-12-10 11:30:43 +000044 * Returns summary of alarms on a given device.
kmcpeake4fe18c82015-11-17 20:07:39 +000045 *
46 * @param deviceId the device
kmcpeakeb172d5f2015-12-10 11:30:43 +000047 * @return map of severity (if applicable) vs alarm counts; empty map if either the device has no alarms or
48 * identified device is not managed.
kmcpeake4fe18c82015-11-17 20:07:39 +000049 */
kmcpeakeb172d5f2015-12-10 11:30:43 +000050 Map<Alarm.SeverityLevel, Long> getAlarmCounts(DeviceId deviceId);
51
52 /**
53 * Returns summary of alarms on all devices.
54 *
55 * @return map of severity (if applicable) vs alarm counts; empty map if no alarms.
56 */
57 Map<Alarm.SeverityLevel, Long> getAlarmCounts();
kmcpeake4fe18c82015-11-17 20:07:39 +000058
59 /**
60 * Returns the alarm with the specified identifier.
61 *
62 * @param alarmId alarm identifier
kmcpeakeb172d5f2015-12-10 11:30:43 +000063 * @return alarm matching id; null if no alarm matches the identifier.
kmcpeake4fe18c82015-11-17 20:07:39 +000064 */
65 Alarm getAlarm(AlarmId alarmId);
66
67 /**
68 * Returns all of the alarms.
69 *
kmcpeakeb172d5f2015-12-10 11:30:43 +000070 * @return set of alarms; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +000071 */
72 Set<Alarm> getAlarms();
73
74 /**
75 * Returns all of the ACTIVE alarms. Recently cleared alarms excluded.
76 *
kmcpeakeb172d5f2015-12-10 11:30:43 +000077 * @return set of alarms; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +000078 */
79 Set<Alarm> getActiveAlarms();
80
81 /**
82 * Returns the alarms with the specified severity.
83 *
84 * @param severity the alarm severity
kmcpeakeb172d5f2015-12-10 11:30:43 +000085 * @return set of alarms with a particular severity; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +000086 */
87 Set<Alarm> getAlarms(Alarm.SeverityLevel severity);
88
89 /**
kmcpeakeb172d5f2015-12-10 11:30:43 +000090 * Returns the alarm matching a given device, regardless of source within that device.
kmcpeake4fe18c82015-11-17 20:07:39 +000091 *
kmcpeakeb172d5f2015-12-10 11:30:43 +000092 * @param deviceId the device to use when searching alarms.
93 * @return set of alarms; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +000094 */
95 Set<Alarm> getAlarms(DeviceId deviceId);
96
97 /**
98 * Returns the alarm for a given device and source.
99 *
100 * @param deviceId the device
101 * @param source the source within the device
kmcpeakeb172d5f2015-12-10 11:30:43 +0000102 * @return set of alarms; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +0000103 */
104 Set<Alarm> getAlarms(DeviceId deviceId, AlarmEntityId source);
105
106 /**
107 * Returns the alarm affecting a given link.
108 *
109 * @param src one end of the link
110 * @param dst one end of the link
kmcpeakeb172d5f2015-12-10 11:30:43 +0000111 * @return set of alarms; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +0000112 */
113 Set<Alarm> getAlarmsForLink(ConnectPoint src, ConnectPoint dst);
114
115 /**
116 * Returns the alarm affecting a given flow.
117 *
118 * @param deviceId the device
119 * @param flowId the flow
kmcpeakeb172d5f2015-12-10 11:30:43 +0000120 * @return set of alarms; empty set if no alarms
kmcpeake4fe18c82015-11-17 20:07:39 +0000121 */
122 Set<Alarm> getAlarmsForFlow(DeviceId deviceId, long flowId);
123
kmcpeakeb172d5f2015-12-10 11:30:43 +0000124 // TODO Support retrieving alarms affecting other entity types may be added in future release
kmcpeake4fe18c82015-11-17 20:07:39 +0000125}