blob: 03c0c7b1df324d6869bb07d7bc2cdabb8fc4391b [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;
19//import org.onosproject.event.ListenerService;
20
21import java.util.Set;
22import org.onosproject.net.ConnectPoint;
23import org.onosproject.net.DeviceId;
24
25/**
26 * Service for interacting with the alarm handling of devices. Unless stated
27 * otherwise method return active AND recently-cleared alarms.
28 */
29@Beta
30public interface AlarmService {
31// extends ListenerService<AlarmEvent, AlarmListener> {
32
33 /**
34 * Alarm should be updated in ONOS's internal representation; only
35 * administration/book-keeping fields may be updated. Attempting to update
36 * fields which are mapped directly from device is prohibited.
37 *
38 * @param replacement alarm with updated book-keeping fields
39 * @return updated alarm (including any recent device derived changes)
40
41 * @throws java.lang.IllegalStateException if attempt to update not allowed
42 * fields.
43 */
44 Alarm update(Alarm replacement);
45
46 /**
47 * Returns the number of ACTIVE alarms on a device.
48 *
49 * @param deviceId the device
50 * @return number of alarms
51 */
52 int getActiveAlarmCount(DeviceId deviceId);
53
54 /**
55 * Returns the alarm with the specified identifier.
56 *
57 * @param alarmId alarm identifier
58 * @return alarm or null if one with the given identifier is not known
59 */
60 Alarm getAlarm(AlarmId alarmId);
61
62 /**
63 * Returns all of the alarms.
64 *
65 * @return the alarms
66 */
67 Set<Alarm> getAlarms();
68
69 /**
70 * Returns all of the ACTIVE alarms. Recently cleared alarms excluded.
71 *
72 * @return the alarms
73 */
74 Set<Alarm> getActiveAlarms();
75
76 /**
77 * Returns the alarms with the specified severity.
78 *
79 * @param severity the alarm severity
80 * @return the active alarms with a particular severity
81 */
82 Set<Alarm> getAlarms(Alarm.SeverityLevel severity);
83
84 /**
85 * Returns the alarm for a given device, regardless of source within that
86 * device.
87 *
88 * @param deviceId the device
89 * @return the alarms
90 */
91 Set<Alarm> getAlarms(DeviceId deviceId);
92
93 /**
94 * Returns the alarm for a given device and source.
95 *
96 * @param deviceId the device
97 * @param source the source within the device
98 * @return the alarms
99 */
100 Set<Alarm> getAlarms(DeviceId deviceId, AlarmEntityId source);
101
102 /**
103 * Returns the alarm affecting a given link.
104 *
105 * @param src one end of the link
106 * @param dst one end of the link
107 * @return the alarms
108 */
109 Set<Alarm> getAlarmsForLink(ConnectPoint src, ConnectPoint dst);
110
111 /**
112 * Returns the alarm affecting a given flow.
113 *
114 * @param deviceId the device
115 * @param flowId the flow
116 * @return the alarms
117 */
118 Set<Alarm> getAlarmsForFlow(DeviceId deviceId, long flowId);
119
120// Support retrieving alarms affecting other ONOS entity types may be added in future release
121}