kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 52f2cd1 | 2018-11-08 21:20:04 -0800 | [diff] [blame] | 2 | * Copyright 2018-present Open Networking Foundation |
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 | */ |
Thomas Vachuska | 52f2cd1 | 2018-11-08 21:20:04 -0800 | [diff] [blame] | 16 | package org.onosproject.alarm; |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 17 | |
| 18 | import org.onosproject.net.DeviceId; |
| 19 | |
| 20 | /** |
| 21 | * Representation of an Alarm. At a given instant there can be only one alarm |
| 22 | * with the same deviceId + description + source combination. |
| 23 | */ |
| 24 | public interface Alarm { |
| 25 | |
| 26 | /** |
| 27 | * Returns the unique alarm id within this ONOS instance. |
| 28 | * |
| 29 | * @return alarm identifier |
| 30 | */ |
| 31 | AlarmId id(); |
| 32 | |
| 33 | /** |
| 34 | * The device to which this alarm is related. |
| 35 | * |
| 36 | * @return a device id |
| 37 | */ |
| 38 | DeviceId deviceId(); |
| 39 | |
| 40 | /** |
| 41 | * Returns a description of alarm. |
| 42 | * <p> |
| 43 | * It may encapsulate Event Type as described by ITU Recommendation X.736 |
| 44 | * ITU, Quoting https://tools.ietf.org/html/rfc3877 these include: other, |
| 45 | * communicationsAlarm, qualityOfServiceAlarm, processingErrorAlarm, |
| 46 | * equipmentAlarm, environmentalAlarm, integrityViolation, |
| 47 | * operationalViolation, physicalViolation, |
| 48 | * securityServiceOrMechanismViolation, timeDomainViolation |
| 49 | * <p> |
| 50 | * It may encapsulate Probable Cause as described by ITU Recommendation |
| 51 | * X.736 ITU, Quoting |
| 52 | * https://www.iana.org/assignments/ianaitualarmtc-mib/ianaitualarmtc-mib |
| 53 | * these include : aIS, callSetUpFailure, degradedSignal, |
| 54 | * farEndReceiverFailure, framingError, and hundreds more constants. |
| 55 | * <p> |
| 56 | * It may encapsulate a vendor-specific description of the underlying fault. |
| 57 | * |
| 58 | * @return description of alarm |
| 59 | */ |
| 60 | String description(); |
| 61 | |
| 62 | /** |
| 63 | * Returns an entity within the context of this alarm's device. It may be |
| 64 | * null if deviceId sufficiently identifies the location. As an example, the |
| 65 | * source may indicate a port number |
| 66 | * |
| 67 | * @return source of alarm within the alarm's referenced Device. |
| 68 | */ |
| 69 | AlarmEntityId source(); |
| 70 | |
| 71 | /** |
| 72 | * Returns the time when raised. |
| 73 | * |
| 74 | * @return time when raised, in milliseconds since start of epoch |
| 75 | */ |
| 76 | long timeRaised(); |
| 77 | |
| 78 | /** |
| 79 | * Returns time at which the alarm was updated most recently, due to some |
| 80 | * change in the device, or ONOS. If the alarm has been cleared, this is the |
| 81 | * time at which the alarm was cleared. |
| 82 | * |
| 83 | * @return time when last updated, in milliseconds since start of epoch |
| 84 | */ |
| 85 | long timeUpdated(); |
| 86 | |
| 87 | /** |
| 88 | * Returns the time when cleared. Null indicated no clear time, i.e. the |
| 89 | * alarm is still active. |
| 90 | * |
| 91 | * @return time when cleared, in milliseconds since start of epoch or null |
| 92 | * if uncleared. |
| 93 | */ |
| 94 | Long timeCleared(); |
| 95 | |
| 96 | /** |
| 97 | * Returns the severity. Note, that cleared alarms may have EITHER |
| 98 | * SeverityLevel = CLEARED, or may be not present; both scenarios should be |
| 99 | * handled. |
| 100 | * |
| 101 | * @return severity of the alarm |
| 102 | */ |
| 103 | SeverityLevel severity(); |
| 104 | |
| 105 | /** |
| 106 | * Returns true if alarm is service affecting Note: Whilst X.733 combines |
| 107 | * service-affecting state with severity (where severities of critical and |
| 108 | * major are deemed service-affecting) ONOS keeps these attributes separate. |
| 109 | * |
| 110 | * @return whether service affecting (true indicates it is) |
| 111 | */ |
| 112 | boolean serviceAffecting(); |
| 113 | |
| 114 | /** |
| 115 | * Returns a flag to indicate if this alarm has been acknowledged. All |
| 116 | * alarms are unacknowledged until and unless an ONOS user takes action to |
| 117 | * indicate so. |
| 118 | * |
| 119 | * @return whether alarm is currently acknowledged (true indicates it is) |
| 120 | */ |
| 121 | boolean acknowledged(); |
| 122 | |
| 123 | /** |
Andrea Campanella | 65f9eb9 | 2017-05-02 11:36:14 -0700 | [diff] [blame] | 124 | * Returns a flag to indicate if this alarm has been cleared. All |
| 125 | * alarms are not cleared until and unless an ONOS user or app takes action to |
| 126 | * indicate so. |
| 127 | * |
| 128 | * @return whether alarm is currently cleared (true indicates it is) |
| 129 | */ |
| 130 | default boolean cleared() { |
| 131 | return false; |
| 132 | } |
| 133 | |
| 134 | /** |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 135 | * Returns a flag to indicate if this alarm is manually-cleared by a user action within ONOS. Some stateless events |
| 136 | * e.g. backup-failure or upgrade-failure, may be mapped by ONOS to alarms, and these may be deemed manually- |
| 137 | * clearable. The more typical case is that an alarm represents a persistent fault on or related to a device and |
| 138 | * such alarms are never manually clearable, i.e. a configuration or operational state must occur for the alarm to |
| 139 | * clear. |
| 140 | * |
| 141 | * @return whether it may be cleared by a user action (true indicates it is) |
| 142 | */ |
| 143 | boolean manuallyClearable(); |
| 144 | |
| 145 | /** |
| 146 | * Returns the user to whom this alarm is assigned; this is for future use |
| 147 | * and always returns null in this release. It is anticipated that in future ONOS |
| 148 | * releases, the existing JAAS user/key/role configuration will be extended |
| 149 | * to include a mechanism whereby some groups of users may allocate alarms |
| 150 | * to other users for bookkeeping and administrative purposes, and that ONOS |
| 151 | * will additionally provide a REST based mechanism, to retrieve from JAAS, |
| 152 | * the set of users to whom alarm assignment is possible for the current |
| 153 | * user. |
| 154 | * |
| 155 | * @return the assigned user; always null in this release. |
| 156 | */ |
| 157 | String assignedUser(); |
| 158 | |
| 159 | /** |
| 160 | * Represents the severity level on an alarm, as per ITU-T X.733 |
| 161 | * specifications. |
| 162 | * <p> |
| 163 | * The precedence is as follows for : Critical > Major > Minor > Warning. |
| 164 | */ |
| 165 | enum SeverityLevel { |
| 166 | |
| 167 | /** |
| 168 | * From X.733: This indicates the clearing of one or more previously |
| 169 | * reported alarms. This alarm clears all alarms for this managed object |
| 170 | * that have the same Alarm type, Probable cause and Specific problems |
| 171 | * (if given). Multiple associated notifications may be cleared by using |
| 172 | * the Correlated notifications parameter (defined below). This |
| 173 | * Recommendation | International Standard does not require that the |
| 174 | * clearing of previously reported alarms be reported. Therefore, a |
| 175 | * managing system cannot assume that the absence of an alarm with the |
| 176 | * Cleared severity level means that the condition that caused the |
| 177 | * generation of previous alarms is still present. Managed object |
| 178 | * definers shall state if, and under which conditions, the Cleared |
| 179 | * severity level is used. |
| 180 | */ |
| 181 | CLEARED, |
| 182 | /** |
| 183 | * From X.733: This indicates that the severity level cannot be |
| 184 | * determined. |
| 185 | */ |
| 186 | INDETERMINATE, |
| 187 | /** |
| 188 | * From X.733: This indicates that a service affecting condition has |
| 189 | * occurred and an immediate corrective action is required. Such a |
| 190 | * severity can be reported, for example, when a managed object becomes |
| 191 | * totally out of service and its capability must be restored. |
| 192 | */ |
| 193 | CRITICAL, |
| 194 | /** |
| 195 | * X.733 definition: This indicates that a service affecting condition |
| 196 | * has developed and an urgent corrective action is required. Such a |
| 197 | * severity can be reported, for example, when there is a severe |
| 198 | * degradation in the capability of the managed object and its full |
| 199 | * capability must be restored. |
| 200 | */ |
| 201 | MAJOR, |
| 202 | /** |
| 203 | * From X.733: This indicates the existence of a non-service affecting |
| 204 | * fault condition and that corrective action should be taken in order |
| 205 | * to prevent a more serious (for example, service affecting) fault. |
| 206 | * Such a severity can be reported, for example, when the detected alarm |
| 207 | * condition is not currently degrading the capacity of the managed |
| 208 | * object. |
| 209 | */ |
| 210 | MINOR, |
| 211 | /** |
| 212 | * From X.733: This indicates the detection of a potential or impending |
| 213 | * service affecting fault, before any significant effects have been |
| 214 | * felt. Action should be taken to further diagnose (if necessary) and |
| 215 | * correct the problem in order to prevent it from becoming a more |
| 216 | * serious service affecting fault. |
| 217 | */ |
Jon Hall | 8c7b06a | 2017-02-22 13:37:33 -0800 | [diff] [blame] | 218 | WARNING |
kmcpeake | 4fe18c8 | 2015-11-17 20:07:39 +0000 | [diff] [blame] | 219 | |
| 220 | } |
| 221 | |
| 222 | } |