Merge "Add license file" 0.4.5 0.5.9
authorAbukar Mohamed <abukar.mohamed@nokia.com>
Thu, 18 Jun 2020 10:12:24 +0000 (10:12 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Thu, 18 Jun 2020 10:12:24 +0000 (10:12 +0000)
20 files changed:
.gitattributes [new file with mode: 0644]
.gitignore [new file with mode: 0644]
.readthedocs.yaml [new file with mode: 0644]
README.md [changed mode: 0755->0644]
adapter/Dockerfile [changed mode: 0755->0644]
adapter/build_adapter_ubuntu.sh
adapter/cmd/adapter.go
adapter/container-tag.yaml
alarm-schema.json [new file with mode: 0644]
alarm/Dockerfile-Unit-Test [new file with mode: 0644]
alarm/alarm.go [changed mode: 0755->0644]
alarm/alarm_test.go [changed mode: 0755->0644]
alarm/types.go [changed mode: 0755->0644]
alarm/utils.c [changed mode: 0755->0644]
alarm/utils.h [changed mode: 0755->0644]
assets/alarm-adapter.png [changed mode: 0755->0644]
config/config-file.json [changed mode: 0755->0644]
config/uta_rtg.rt [changed mode: 0755->0644]
docs/index.rst
docs/release-notes.rst

diff --git a/.gitattributes b/.gitattributes
new file mode 100644 (file)
index 0000000..38b6a85
--- /dev/null
@@ -0,0 +1,21 @@
+# 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
diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..5cd11dc
--- /dev/null
@@ -0,0 +1,56 @@
+# 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
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
new file mode 100644 (file)
index 0000000..3797dc8
--- /dev/null
@@ -0,0 +1,20 @@
+---
+# .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
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 87851a5..65d94d0
@@ -18,7 +18,7 @@
 #   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
index 8f0aaf4..3bb4703 100755 (executable)
@@ -22,12 +22,12 @@ set -eux
 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
 
index 7fa1f3b..76112f9 100755 (executable)
@@ -126,6 +126,7 @@ func (a *AlarmAdapter) Consume(rp *app.RMRParams) (err error) {
 
 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
@@ -200,11 +201,11 @@ func (a *AlarmAdapter) GenerateAlertLabels(newAlarm alarm.Alarm, status AlertSta
                "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,
@@ -228,7 +229,7 @@ func (a *AlarmAdapter) PostAlert(amLabels, amAnnotations models.LabelSet) (*aler
        }
        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)
index cfdbfb8..a89789a 100644 (file)
@@ -2,4 +2,4 @@
 # 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
diff --git a/alarm-schema.json b/alarm-schema.json
new file mode 100644 (file)
index 0000000..5e999ad
--- /dev/null
@@ -0,0 +1,94 @@
+{
+  "$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
+    }
+  }
+}
diff --git a/alarm/Dockerfile-Unit-Test b/alarm/Dockerfile-Unit-Test
new file mode 100644 (file)
index 0000000..a530771
--- /dev/null
@@ -0,0 +1,35 @@
+# 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
old mode 100755 (executable)
new mode 100644 (file)
index dddccb1..38e2134
@@ -130,12 +130,14 @@ func (r *RICAlarm) sendAlarmUpdateReq(a AlarmMessage) error {
                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")
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 81be866..70333ae 100644 (file)
@@ -16,8 +16,8 @@
 ..  limitations under the License.
 ..
 
-Welcome to O-RAN Application Manager Documentation
-==================================================
+Alarm Go Library
+================
 
 .. toctree::
    :maxdepth: 2
index 1e827ce..0f7be8e 100644 (file)
@@ -17,7 +17,7 @@
 ..
 
 
-Release-Notes
+Release Notes
 =============