Merge "RIC:1060: Change in PTL"
[ric-plt/alarm-go.git] / README.md
1 RIC Alarm Adapter and Library Interface
2 =======================================
3
4 This repository containts Golang implementation of Alarm Adapter and related application library interface.
5
6 Architecture
7 ------------
8
9 ![Architecture](assets/alarm-adapter.png)
10
11 The **Alarm Library** provides a simple interface for RIC applications (both platform application and xApps) to raise, clear and re-raise. The **Alarm Library** interacts with the **Alarm Adapter** via RMR interface.
12
13 The **Alarm Adapter** is responsible for managing alarm situations in RIC cluster and interfacing with **Northboubd** applications such as **Prometheus AlertManager** to post the alarms as alerts. AlertManager takes care of deduplicating, silencing and inhibition (suppressing) of alerts, and routing them to the VESAgent, which, in turn, takes care of converting alerts to fault and send to ONAP as VES events.
14
15 Overview for Alarm Adapter
16 --------------------------
17
18 ### TBD
19
20 Overview for Alarm Library
21 --------------------------
22
23 ## Initialization
24
25 A new alarm instance is created with InitAlarm function. MO and application identities are given as a parameter.
26
27 ## Alarm Context and Format
28
29 The Alarm object contains following parameters:
30  * *SpecificProblem*: problem that is the cause of the alarm
31  * *PerceivedSeverity*: The severity of the alarm, see above for possible values
32  * *ManagedObjectId*: The name of the managed object that is the cause of the fault
33  * *ApplicationId*: The name of the process raised the alarm
34  * *AdditionalInfo*: Additional information given by the application
35  * *IdentifyingInfo*: Identifying additional information, which is part of alarm identity
36
37  *ManagedObjectId* (mo), *SpecificProblem* (sp), *ApplicationId* (ap) and *IdentifyingInfo* (IdentifyingInfo) make up the identity of the alarm. All parameters must be according to the alarm definition, i.e. all mandatory parameters should be present, and parameters should have correct value type or be from some predefined range. Addressing the same alarm instance in a clear() or reraise() call is done by making sure that all four values are the same is in the original raise / reraise call. 
38
39 ## Alarm APIs
40 * *Raise*: Raises the alarm instance given as a parameter
41 * *Clear*: Clears the alarm instance given as a parameter, if it the alarm active
42 * *Reraise*: Attempts to re-raise the alarm instance given as a parameter
43 * *ClearAll*: Clears all alarms matching moId and appId given as parameters
44
45 ## Aux. Alarm APIs
46 * *SetManagedObjectId*: Sets the default MOId
47 * *SetApplicationId*: Sets the default AppId
48
49
50 ## Example
51 -------
52
53 ```go
54 package main
55
56 import (
57         alarm "gerrit.o-ran-sc.org/r/ric-plt/alarm-go/alarm"
58 )
59
60 func main() {
61         // Initialize the alarm component
62         alarmer, err := alarm.InitAlarm("my-pod", "my-app")
63
64         // Create a new Alarm object
65         alarm := alarmer.NewAlarm(1234, alarm.SeverityMajor, "Some App data", "eth 0 1")
66
67         // Raise an alarm (SP=1234, etc)
68         err := alarmer.Raise(alarm)
69
70         // Clear an alarm (SP=1234)
71         err := alarmer.Clear(alarm)
72
73         // Re-raise an alarm (SP=1234)
74         err := alarmer.Reraise(alarm)
75
76         // Clear all alarms raised by the application
77         err := alarmer.ClearAll()
78 }
79 ```
80
81 CI
82 --
83
84 The Dockerfile in the `ci` directory _only_ runs, when build, the library unit tests for the repository.
85
86 License
87 -------
88  Copyright (c) 2020 AT&T Intellectual Property.
89  Copyright (c) 2020 Nokia.
90
91  Licensed under the Apache License, Version 2.0 (the "License");
92  you may not use this file except in compliance with the License.
93  You may obtain a copy of the License at
94
95      http://www.apache.org/licenses/LICENSE-2.0
96
97  Unless required by applicable law or agreed to in writing, software
98  distributed under the License is distributed on an "AS IS" BASIS,
99  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
100  See the License for the specific language governing permissions and
101  limitations under the License.
102
103  This source code is part of the near-RT RIC (RAN Intelligent Controller)
104  platform project (RICP).
105
106
107