Update RMR version v4.4.6 87/5287/2
authorMohamed Abukar <abukar.mohamed@nokia.com>
Wed, 9 Dec 2020 12:16:55 +0000 (14:16 +0200)
committerMohamed Abukar <abukar.mohamed@nokia.com>
Wed, 9 Dec 2020 13:05:53 +0000 (15:05 +0200)
Change-Id: Ib269fd3d336a02b7dd2d757321da46bc5f03222e
Signed-off-by: Mohamed Abukar <abukar.mohamed@nokia.com>
build_vesmgr.sh
cmd/vespamgr/config.go
cmd/vespamgr/types.go
cmd/vespamgr/vespamgr.go
config/config-file-ut.json
config/config-file.json
container-tag.yaml
test/xApp_config_test_output.json

index 6166a6a..a9c03d5 100755 (executable)
 #
 
 # Install RMR from deb packages at packagecloud.io
-rmr=rmr_4.1.2_amd64.deb
+rmr=rmr_4.4.6_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_4.1.2_amd64.deb
+rmrdev=rmr-dev_4.4.6_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 b7779f2..a62b3a4 100755 (executable)
@@ -188,8 +188,8 @@ func (v *VespaMgr) GetRules(vespaconf *VESAgentConfiguration, xAppConfig []byte)
        appMetrics := make(AppMetrics)
        metrics := v.ParseMetricsFromDescriptor(xAppConfig, appMetrics)
 
-       if pltFile := os.Getenv("VESMGR_PLT_CFG_FILE"); pltFile != "" {
-               pltConfig, err := ioutil.ReadFile(pltFile)
+       if v.pltFileCreated {
+               pltConfig, err := ioutil.ReadFile(app.Config.GetString("controls.pltFile"))
                if err != nil {
                        app.Logger.Error("Unable to read platform config file: %v", err)
                } else {
@@ -221,9 +221,7 @@ func (v *VespaMgr) GetCollectorConfiguration(vespaconf *VESAgentConfiguration) {
 
 func (v *VespaMgr) CreateConfig(writer io.Writer, xAppStatus []byte) {
        vespaconf := v.BasicVespaConf()
-
        v.GetRules(&vespaconf, xAppStatus)
-
        v.GetCollectorConfiguration(&vespaconf)
 
        err := yaml.NewEncoder(writer).Encode(vespaconf)
index c364196..88b675f 100755 (executable)
@@ -39,6 +39,7 @@ type VespaMgr struct {
        prometheusAddr       string
        alertManagerBindAddr string
        subscriptionId       string
+       pltFileCreated       bool
 }
 
 // Structs are copied from https://github.com/nokia/ONAP-VESPA/tree/master/ves-agent/config
index 1a5246f..4cc6c8e 100755 (executable)
@@ -144,9 +144,11 @@ func (v *VespaMgr) HandleSupervision(w http.ResponseWriter, r *http.Request) {
 }
 
 func (v *VespaMgr) HandleMeasurements(w http.ResponseWriter, r *http.Request) {
-       app.Logger.Info("HandleMeasurements called!")
        if appConfig, err := v.ReadPayload(w, r); err == nil {
-               v.CreateConf(app.Config.GetString("controls.vesagent.configFile"), appConfig)
+               filePath := app.Config.GetString("controls.pltFile")
+               if err := ioutil.WriteFile(filePath, appConfig, 0666); err == nil {
+                       v.pltFileCreated = true
+               }
        }
 }
 
@@ -190,9 +192,8 @@ func (v *VespaMgr) SubscribeXappNotif(appmgrUrl string) {
        targetUrl := fmt.Sprintf("%s%s", app.Config.GetString("controls.host"), v.appmgrNotifUrl)
        subscriptionData := []byte(fmt.Sprintf(`{"Data": {"maxRetries": 5, "retryTimer": 5, "eventType":"all", "targetUrl": "%v"}}`, targetUrl))
 
-       for {
+       for i := 0; i < v.appmgrRetry; i++ {
                app.Logger.Info("Subscribing xApp notification from: %v", appmgrUrl)
-
                if id := v.DoSubscribe(appmgrUrl, subscriptionData); id != "" {
                        app.Logger.Info("Subscription done, id=%s", id)
                        break
index 497242f..e13f086 100755 (executable)
@@ -54,6 +54,7 @@
         },
         "host": "localhost:8080",
         "measurementUrl": "/ric/v1/measurements",
+        "pltFile": "/tmp/vespa-plt-meas.json",
         "appManager": {
             "host": "http://localhost:8080",
             "path": "/ric/v1/config",
index eead269..455cf8f 100755 (executable)
         },
         "host": "http://service-ricplt-vespamgr-http.ricplt.svc.cluster.local:8080",
         "measurementUrl": "/ric/v1/measurements",
+        "pltFile": "/tmp/vespa-plt-meas.json",
         "appManager": {
             "host": "http://service-ricplt-appmgr-http.ricplt.svc.cluster.local:8080",
             "path": "/ric/v1/config",
             "notificationUrl": "/ric/v1/xappnotif",
             "subscriptionUrl": "/ric/v1/subscriptions",
-            "appmgrRetry": 2
+            "appmgrRetry": 100
         },
         "vesagent": {
             "configFile": "/etc/ves-agent/ves-agent.yaml",
index 31badd2..2576d0b 100644 (file)
@@ -1,4 +1,4 @@
 # The Jenkins job uses this string for the tag in the image name
 # for example nexus3.o-ran-sc.org:10004/my-image-name:0.0.1
 ---
-tag: 0.7.0
+tag: 0.7.1
index 204398b..663e7b3 100755 (executable)
@@ -1,122 +1,7 @@
 [
     {
-        "metadata": {
-            "name": "xApp1",
-            "configName": "xApp1-appconfig",
-            "namespace": "default"
-        },
-        "descriptor": {
-            "$id": "http://example.com/root.json",
-            "$schema": "http://json-schema.org/draft-07/schema#",
-            "definitions": {
-
-            },
-            "properties": {
-                "local": {
-                    "$id": "#/properties/local",
-                    "properties": {
-                        "host": {
-                            "$id": "#/properties/local/properties/host",
-                            "default": "",
-                            "examples": [
-                                ":8080"
-                            ],
-                            "pattern": "^(.*)$",
-                            "title": "The Host Schema",
-                            "type": "string"
-                        }
-                    },
-                    "required": [
-                        "host"
-                    ],
-                    "title": "The Local Schema",
-                    "type": "object"
-                },
-                "logger": {
-                    "$id": "#/properties/logger",
-                    "properties": {
-                        "level": {
-                            "$id": "#/properties/logger/properties/level",
-                            "default": 0,
-                            "examples": [
-                                3
-                            ],
-                            "title": "The Level Schema",
-                            "type": "integer"
-                        }
-                    },
-                    "required": [
-                        "level"
-                    ],
-                    "title": "The Logger Schema",
-                    "type": "object"
-                },
-                "metrics": {
-                    "$id": "#/properties/metrics",
-                    "items": {
-                        "$id": "#/properties/metrics/items",
-                        "properties": {
-                            "description": {
-                                "$id": "#/properties/metrics/items/properties/description",
-                                "default": "",
-                                "examples": [
-                                    "Example counter 1"
-                                ],
-                                "pattern": "^(.*)$",
-                                "title": "The Description Schema",
-                                "type": "string"
-                            },
-                            "enabled": {
-                                "$id": "#/properties/metrics/items/properties/enabled",
-                                "default": false,
-                                "examples": [
-                                    true
-                                ],
-                                "title": "The Enabled Schema",
-                                "type": "boolean"
-                            },
-                            "name": {
-                                "$id": "#/properties/metrics/items/properties/name",
-                                "default": "",
-                                "examples": [
-                                    "App1ExampleCounterOne"
-                                ],
-                                "pattern": "^(.*)$",
-                                "title": "The Name Schema",
-                                "type": "string"
-                            },
-                            "type": {
-                                "$id": "#/properties/metrics/items/properties/type",
-                                "default": "",
-                                "examples": [
-                                    "counter"
-                                ],
-                                "pattern": "^(.*)$",
-                                "title": "The Type Schema",
-                                "type": "string"
-                            }
-                        },
-                        "required": [
-                            "name",
-                            "type",
-                            "enabled",
-                            "description"
-                        ],
-                        "title": "The Items Schema",
-                        "type": "object"
-                    },
-                    "title": "The Metrics Schema",
-                    "type": "array"
-                }
-            },
-            "required": [
-                "local",
-                "logger",
-                "metrics"
-            ],
-            "title": "ANR Descriptor Schema",
-            "type": "object"
-        },
+        "metadata": { },
+        "descriptor": { },
         "config": {
             "local": {
                 "host": ":8080"
         }
     },
     {
-        "metadata": {
-            "name": "xApp2",
-            "configName": "xApp2-appconfig",
-            "namespace": "default"
-        },
-        "descriptor": {
-            "$id": "http://example.com/root.json",
-            "$schema": "http://json-schema.org/draft-07/schema#",
-            "definitions": {
-
-            },
-            "properties": {
-                "local": {
-                    "$id": "#/properties/local",
-                    "properties": {
-                        "host": {
-                            "$id": "#/properties/local/properties/host",
-                            "default": "",
-                            "examples": [
-                                ":8080"
-                            ],
-                            "pattern": "^(.*)$",
-                            "title": "The Host Schema",
-                            "type": "string"
-                        }
-                    },
-                    "required": [
-                        "host"
-                    ],
-                    "title": "The Local Schema",
-                    "type": "object"
-                },
-                "logger": {
-                    "$id": "#/properties/logger",
-                    "properties": {
-                        "level": {
-                            "$id": "#/properties/logger/properties/level",
-                            "default": 0,
-                            "examples": [
-                                3
-                            ],
-                            "title": "The Level Schema",
-                            "type": "integer"
-                        }
-                    },
-                    "required": [
-                        "level"
-                    ],
-                    "title": "The Logger Schema",
-                    "type": "object"
-                },
-                "metrics": {
-                    "$id": "#/properties/metrics",
-                    "items": {
-                        "$id": "#/properties/metrics/items",
-                        "properties": {
-                            "description": {
-                                "$id": "#/properties/metrics/items/properties/description",
-                                "default": "",
-                                "examples": [
-                                    ""
-                                ],
-                                "pattern": "^(.*)$",
-                                "title": "The Description Schema",
-                                "type": "string"
-                            },
-                            "enabled": {
-                                "$id": "#/properties/metrics/items/properties/enabled",
-                                "default": false,
-                                "examples": [
-                                    true
-                                ],
-                                "title": "The Enabled Schema",
-                                "type": "boolean"
-                            },
-                            "name": {
-                                "$id": "#/properties/metrics/items/properties/name",
-                                "default": "",
-                                "examples": [
-                                    "UEContextCreated"
-                                ],
-                                "pattern": "^(.*)$",
-                                "title": "The Name Schema",
-                                "type": "string"
-                            },
-                            "type": {
-                                "$id": "#/properties/metrics/items/properties/type",
-                                "default": "",
-                                "examples": [
-                                    "counter"
-                                ],
-                                "pattern": "^(.*)$",
-                                "title": "The Type Schema",
-                                "type": "string"
-                            }
-                        },
-                        "required": [
-                            "name",
-                            "type",
-                            "enabled",
-                            "description"
-                        ],
-                        "title": "The Items Schema",
-                        "type": "object"
-                    },
-                    "title": "The Metrics Schema",
-                    "type": "array"
-                }
-            },
-            "required": [
-                "local",
-                "logger",
-                "metrics"
-            ],
-            "title": "The Root Schema",
-            "type": "object"
-        },
+        "metadata": {},
+        "descriptor": {},
         "config": {
             "local": {
                 "host": ":8080"