RICAPP-233: Missing Readiness and Liveness Probes in kpimon-go xApp Deployment Config... 56/12856/3 J-release j-release k-release master
authorTuan Nguyen <hoang.su.tk@gmail.com>
Wed, 22 May 2024 09:57:31 +0000 (09:57 +0000)
committerTuan Nguyen <hoang.su.tk@gmail.com>
Wed, 22 May 2024 13:49:53 +0000 (13:49 +0000)
Change-Id: I5ed314b37bbc9021efa7cd217a74e8350580a66a
Signed-off-by: Tuan Nguyen <hoang.su.tk@gmail.com>
control/control.go
deploy/config.json

index 10e6e99..92b2098 100644 (file)
@@ -17,6 +17,7 @@ import (
        "strconv"\r
        "time"\r
        "unsafe"\r
        "strconv"\r
        "time"\r
        "unsafe"\r
+       "strings"\r
 \r
        "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel"\r
        "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"\r
 \r
        "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel"\r
        "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"\r
@@ -67,9 +68,9 @@ func (c Control) Consume(msg *xapp.RMRParams) error {
 }\r
 \r
 func NewControl() Control {\r
 }\r
 \r
 func NewControl() Control {\r
-       xapp.Logger.Info("In new control\n")\r
+       xapp.Logger.Info("In new control")\r
        create_db()\r
        create_db()\r
-       xapp.Logger.Info("returning control\n")\r
+       xapp.Logger.Info("returning control")\r
        return Control{\r
                make(chan *xapp.RMRParams),\r
                influxdb2.NewClient("http://ricplt-influxdb.ricplt:8086", "client"),\r
        return Control{\r
                make(chan *xapp.RMRParams),\r
                influxdb2.NewClient("http://ricplt-influxdb.ricplt:8086", "client"),\r
@@ -77,12 +78,12 @@ func NewControl() Control {
 }\r
 func create_db() {\r
        //Create a database named kpimon in influxDB\r
 }\r
 func create_db() {\r
        //Create a database named kpimon in influxDB\r
-       xapp.Logger.Info("In create_db\n")\r
+       xapp.Logger.Info("In create_db")\r
        _, err := http.Post("http://ricplt-influxdb.ricplt:8086/query?q=create%20database%20kpimon", "", nil)\r
        if err != nil {\r
                xapp.Logger.Error("Create database failed!")\r
        }\r
        _, err := http.Post("http://ricplt-influxdb.ricplt:8086/query?q=create%20database%20kpimon", "", nil)\r
        if err != nil {\r
                xapp.Logger.Error("Create database failed!")\r
        }\r
-       xapp.Logger.Info("exiting create_db\n")\r
+       xapp.Logger.Info("exiting create_db")\r
 }\r
 \r
 func (c Control) getEnbList() ([]*xapp.RNIBNbIdentity, error) {\r
 }\r
 \r
 func (c Control) getEnbList() ([]*xapp.RNIBNbIdentity, error) {\r
@@ -92,10 +93,12 @@ func (c Control) getEnbList() ([]*xapp.RNIBNbIdentity, error) {
                return nil, err\r
        }\r
 \r
                return nil, err\r
        }\r
 \r
-       xapp.Logger.Info("List for connected eNBs :")\r
-       for index, enb := range enbs {\r
-               xapp.Logger.Info("%d. enbid: %s", index+1, enb.InventoryName)\r
+       var connected_enb_names []string\r
+       for _, enb := range enbs {\r
+               connected_enb_names = append(connected_enb_names, enb.InventoryName)\r
        }\r
        }\r
+       xapp.Logger.Info("List for connected eNBs: [%s]", strings.Join(connected_enb_names, ", "))\r
+       \r
        return enbs, nil\r
 }\r
 \r
        return enbs, nil\r
 }\r
 \r
@@ -106,10 +109,13 @@ func (c *Control) getGnbList() ([]*xapp.RNIBNbIdentity, error) {
                xapp.Logger.Error("err: %s", err)\r
                return nil, err\r
        }\r
                xapp.Logger.Error("err: %s", err)\r
                return nil, err\r
        }\r
-       xapp.Logger.Info("List of connected gNBs :")\r
-       for index, gnb := range gnbs {\r
-               xapp.Logger.Info("%d. gnbid : %s", index+1, gnb.InventoryName)\r
+\r
+       var connected_gnb_names []string\r
+       for _, gnb := range gnbs {\r
+               connected_gnb_names = append(connected_gnb_names, gnb.InventoryName)\r
        }\r
        }\r
+       xapp.Logger.Info("List for connected gNBs: [%s]", strings.Join(connected_gnb_names, ", "))\r
+\r
        return gnbs, nil\r
 }\r
 \r
        return gnbs, nil\r
 }\r
 \r
index 553c786..6563e7c 100644 (file)
@@ -1,6 +1,6 @@
 {\r
   "xapp_name": "kpimon-go",\r
 {\r
   "xapp_name": "kpimon-go",\r
-  "version": "2.0.1",\r
+  "version": "2.0.2-alpha",\r
   "containers": [\r
     {\r
       "name": "kpimon-go",\r
   "containers": [\r
     {\r
       "name": "kpimon-go",\r
       }\r
     }\r
   ],\r
       }\r
     }\r
   ],\r
+  "livenessProbe": {\r
+    "httpGet": {\r
+        "path": "ric/v1/health/alive",\r
+        "port": 8080\r
+    },\r
+    "initialDelaySeconds": 5,\r
+    "periodSeconds": 15\r
+  },\r
+  "readinessProbe": {\r
+      "httpGet": {\r
+          "path": "ric/v1/health/ready",\r
+          "port": 8080\r
+      },\r
+      "initialDelaySeconds": 5,\r
+      "periodSeconds": 15\r
+  },\r
   "messaging": {\r
     "ports": [\r
       {\r
   "messaging": {\r
     "ports": [\r
       {\r