--- /dev/null
+# https://help.github.com/articles/dealing-with-line-endings/
+
+# Set the default behavior, in case people don't have core.autocrlf set.
+* text=auto
+
+# Explicitly declare text files you want to always be normalized
+# and converted to native line endings on checkout.
+*.css text
+*.htm text diff=html
+*.html text diff=html
+*.java text diff=java
+*.js text
+*.jsp text
+*.less text
+*.properties text
+*.sql text
+*.xml text
+
+# Denote all files that are truly binary and should not be modified.
+*.png binary
+*.jpg binary
--- /dev/null
+# See http://help.github.com/ignore-files/ for more about ignoring files.
+
+/logs
+
+# compiled output
+/dist
+/tmp
+/out-tsc
+
+# dependencies
+/node
+/node_modules
+
+/.classpath
+/.project
+/.settings
+/target/
+/.mvn/wrapper/maven-wrapper.jar
+/.tox
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+/build/
+
+### visual studio ###
+.vs
+**/.vscode
+
+# OSx cruft
+**/.DS_Store
+
+# documentation
+.tox
+docs/_build/*
+
+# JSON internal data
+dashboard/webapp-backend/app-stats.json
--- /dev/null
+---
+# .readthedocs.yml
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+# Required
+version: 2
+
+formats:
+ - htmlzip
+
+build:
+ image: latest
+
+python:
+ version: 3.7
+ install:
+ - requirements: docs/requirements-docs.txt
+
+sphinx:
+ configuration: docs/conf.py
# platform project (RICP).
#==================================================================================
-FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:7-u18.04 as ubuntu-alarmadapter
+FROM nexus3.o-ran-sc.org:10004/o-ran-sc/bldr-ubuntu18-c-go:8-u18.04 as ubuntu-alarmadapter
# Install utilities
RUN apt update && apt install -y iputils-ping net-tools curl sudo
echo "--> build_adapter_ubuntu.sh starts"
# Install RMR from deb packages at packagecloud.io
-rmr=rmr_3.7.2_amd64.deb
-wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/$rmr/download.deb
+rmr=rmr_4.0.2_amd64.deb
+wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/$rmr/download.deb
sudo dpkg -i $rmr
rm $rmr
-rmrdev=rmr-dev_3.7.2_amd64.deb
-wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/$rmrdev/download.deb
+rmrdev=rmr-dev_4.0.2_amd64.deb
+wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/$rmrdev/download.deb
sudo dpkg -i $rmrdev
rm $rmrdev
func (a *AlarmAdapter) HandleAlarms(rp *app.RMRParams) (*alert.PostAlertsOK, error) {
var m alarm.AlarmMessage
+ app.Logger.Info("Received JSON: %s", rp.Payload)
if err := json.Unmarshal(rp.Payload, &m); err != nil {
app.Logger.Error("json.Unmarshal failed: %v", err)
return nil, err
"alertname": alarmDef.AlarmText,
"severity": string(newAlarm.PerceivedSeverity),
"service": fmt.Sprintf("%s:%s", newAlarm.ManagedObjectId, newAlarm.ApplicationId),
- "system_name": "RIC",
+ "system_name": fmt.Sprintf("RIC:%s:%s", newAlarm.ManagedObjectId, newAlarm.ApplicationId),
}
amAnnotations := models.LabelSet{
- "alarm_id": string(alarmDef.AlarmId),
- "description": newAlarm.IdentifyingInfo,
+ "alarm_id": fmt.Sprintf("%d", alarmDef.AlarmId),
+ "description": fmt.Sprintf("%d:%s:%s", newAlarm.SpecificProblem, newAlarm.IdentifyingInfo, newAlarm.AdditionalInfo),
"additional_info": newAlarm.AdditionalInfo,
"summary": alarmDef.EventType,
"instructions": alarmDef.OperationInstructions,
}
alertParams := alert.NewPostAlertsParams().WithAlerts(models.PostableAlerts{pa})
- app.Logger.Info("Posting alerts: labels: %v, annotations: %v", amLabels, amAnnotations)
+ app.Logger.Info("Posting alerts: labels: %+v, annotations: %+v", amLabels, amAnnotations)
ok, err := a.NewAlertmanagerClient().Alert.PostAlerts(alertParams)
if err != nil {
app.Logger.Error("Posting alerts to '%s/%s' failed with error: %v", a.amHost, a.amBaseUrl, err)
# By default this file is in the docker build directory,
# but the location can configured in the JJB template.
---
-tag: 0.4.4
+tag: 0.4.5
--- /dev/null
+{
+ "$schema": "http://json-schema.org/draft-07/schema",
+ "$id": "https://gerrit.o-ran-sc.org/r/admin/repos/ric-plt/alarm-go.json",
+ "type": "object",
+ "title": "Alarm schema",
+ "description": "Schema for RIC alarm messages.",
+ "default": {},
+ "examples": [
+ {
+ "managedObjectId": "my-pod-lib",
+ "applicationId": "my-app",
+ "specificProblem": 1234,
+ "perceivedSeverity": "MAJOR",
+ "additionalInfo": "Some App data",
+ "identifyingInfo": "eth 0 1",
+ "AlarmAction": "RAISE",
+ "AlarmTime": 1591188407505707
+ }
+ ],
+ "required": [
+ "managedObjectId",
+ "applicationId",
+ "specificProblem",
+ "perceivedSeverity",
+ "identifyingInfo",
+ "AlarmAction",
+ "AlarmTime"
+ ],
+ "additionalProperties": true,
+ "properties": {
+ "managedObjectId": {
+ "type": "string",
+ "title": "The managedObjectId schema",
+ "description": "The name of the managed object that is the cause of the fault.",
+ "default": ""
+ },
+ "applicationId": {
+ "type": "string",
+ "title": "The applicationId schema",
+ "description": "The name of the process that raised the alarm.",
+ "default": ""
+ },
+ "specificProblem": {
+ "type": "integer",
+ "title": "The specificProblem schema",
+ "description": "The problem that is the cause of the alarm.",
+ "default": 0
+ },
+ "perceivedSeverity": {
+ "type": "string",
+ "enum": [
+ "UNSPECIFIED",
+ "CRITICAL",
+ "MAJOR",
+ "MINOR",
+ "WARNING",
+ "CLEARED",
+ "DEFAULT"
+ ],
+ "title": "The perceivedSeverity schema",
+ "description": "The severity of the alarm.",
+ "default": ""
+ },
+ "additionalInfo": {
+ "type": "string",
+ "title": "The additionalInfo schema",
+ "description": "Additional information given by the application (optional).",
+ "default": ""
+ },
+ "identifyingInfo": {
+ "type": "string",
+ "title": "The identifyingInfo schema",
+ "description": "Identifying additional information, which is part of alarm identity.",
+ "default": ""
+ },
+ "AlarmAction": {
+ "type": "string",
+ "enum": [
+ "RAISE",
+ "CLEAR",
+ "CLEARALL"
+ ],
+ "title": "The AlarmAction schema",
+ "description": "Action to perform on the alarm.",
+ "default": ""
+ },
+ "AlarmTime": {
+ "type": "integer",
+ "title": "The AlarmTime schema",
+ "description": "Current system time in milliseconds since the Epoch.",
+ "default": 0
+ }
+ }
+}
--- /dev/null
+# Copyright (c) 2020 AT&T Intellectual Property.
+# Copyright (c) 2020 Nokia.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# This source code is part of the near-RT RIC (RAN Intelligent Controller)
+# platform project (RICP).
+#
+# Test the alarm library by issuing this command from the alarm/ subdirectory:
+# docker build -f Dockerfile-Unit-Test .
+
+FROM golang:1.12
+
+# install rmr headers and libraries
+ARG RMRVERSION=4.0.5
+RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb \
+ && dpkg -i rmr_${RMRVERSION}_amd64.deb \
+ && rm -rf rmr_${RMRVERSION}_amd64.deb
+RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMRVERSION}_amd64.deb/download.deb \
+ && dpkg -i rmr-dev_${RMRVERSION}_amd64.deb \
+ && rm -rf rmr-dev_${RMRVERSION}_amd64.deb
+RUN ldconfig
+RUN mkdir -p /tmp/alarm
+COPY . /tmp/alarm
+RUN cd /tmp/alarm && go test . -v
return errors.New("RMR no ready yet!")
}
+ log.Printf("Alarm message: %+v\n", a)
log.Println("Sending alarm: ", r.AlarmString(a))
payload, err := json.Marshal(a)
if err != nil {
return err
}
+ log.Println("JSON payload: ", fmt.Sprintf("%s", payload))
datap := C.CBytes(payload)
defer C.free(datap)
meid := C.CString("ric")
.. limitations under the License.
..
-Welcome to O-RAN Application Manager Documentation
-==================================================
+Alarm Go Library
+================
.. toctree::
:maxdepth: 2
..
-Release-Notes
+Release Notes
=============