Changes to SDL read to support new keys used by KPIMON 80/5280/1 1.0.13
authorRon Shacham <rshacham@research.att.com>
Tue, 8 Dec 2020 18:20:20 +0000 (13:20 -0500)
committerRon Shacham <rshacham@research.att.com>
Tue, 8 Dec 2020 18:20:20 +0000 (13:20 -0500)
Issue-ID: RICAPP-96

Signed-off-by: Ron Shacham <rshacham@research.att.com>
Change-Id: Ie27af412756b0aa813dfbb89c59c8c7981ae381a

container-tag.yaml
docs/rel-notes.rst
src/ts_xapp/ts_xapp.cpp
xapp-descriptor/config.json

index eece839..ff04743 100644 (file)
@@ -1,3 +1,3 @@
 # this is used by CI jobs to apply a tag when it builds the image
 ---
-tag: '1.0.12'
+tag: '1.0.13'
index 26bd814..f8c430b 100644 (file)
@@ -9,6 +9,15 @@
 Traffic Steering xAPP
 =====================
 
+2020 Dec 8 Version 1.0.13
+-------------------------
+        Small changes to integrate with RAN data written by KPIMON xApp
+
+2020 Dec 7 Version 1.0.12
+-------------------------
+        Change by HCL to support AD xapp
+
+
 2020 June 11 Version 1.0.11
 ----------------------------
         Removed extraneous logging messages
index 8194b15..ca0cd6c 100644 (file)
@@ -210,33 +210,36 @@ struct UEDataHandler : public BaseReaderHandler<UTF8<>, UEDataHandler> {
   bool in_serving_array = false;
   int rf_meas_index = 0;
 
+  bool in_serving_report_object = false;  
+
   string curr_key = "";
   string curr_value = "";
   bool Null() { return true; }
   bool Bool(bool b) { return true; }
   bool Int(int i) {
 
-    if (in_serving_array) {
+    return true;
+  }
+  
+  bool Uint(unsigned i) {
 
-      switch(rf_meas_index) {
-      case 0:
+    if (in_serving_report_object) {
+      if (curr_key.compare("rsrp") == 0) {
        serving_cell_rsrp = i;
-       break;
-      case 1:
+      } else if (curr_key.compare("rsrq") == 0) {
        serving_cell_rsrq = i;
-       break;
-      case 2:
+      } else if (curr_key.compare("rssinr") == 0) {
        serving_cell_sinr = i;
-       break;
       }
-      rf_meas_index++;
-    }
-    return true;
-  }
-  bool Uint(unsigned u) {
+    }          
+    
+    return true; }
+  bool Int64(int64_t i) {
+
+    return true; }
+  bool Uint64(uint64_t i) {
+
     return true; }
-  bool Int64(int64_t i) { return true; }
-  bool Uint64(uint64_t u) { return true; }
   bool Double(double d) { return true; }
   bool String(const char* str, SizeType length, bool copy) {
     
@@ -246,13 +249,22 @@ struct UEDataHandler : public BaseReaderHandler<UTF8<>, UEDataHandler> {
 
     return true;
   }
-  bool StartObject() { return true; }
+  bool StartObject() {
+    if (curr_key.compare("ServingCellRF") == 0) {
+      in_serving_report_object = true;
+    }
+
+    return true; }
   bool Key(const char* str, SizeType length, bool copy) {
     
     curr_key = str;
     return true;
   }
-  bool EndObject(SizeType memberCount) { return true; }
+  bool EndObject(SizeType memberCount) {
+    if (curr_key.compare("ServingCellRF") == 0) {
+      in_serving_report_object = false;
+    }
+    return true; }
   bool StartArray() {
 
     if (curr_key.compare("ServingCellRF") == 0) {
@@ -280,7 +292,7 @@ unordered_map<string, UEData> get_sdl_ue_data() {
 
   unordered_map<string, UEData> return_ue_data_map;
     
-  std::string prefix3="12";
+  std::string prefix3="";
   Keys K2 = sdl->findKeys(nsu, prefix3);
   DataMap Dk2 = sdl->get(nsu, K2);
   
@@ -323,12 +335,12 @@ void policy_callback( Message& mbuf, int mtype, int subid, int len, Msg_componen
   int rmtype;          // received message type
 
   
-  cout <<  "Policy Callback got a message, type=" << mtype << " , length=" << len << endl;
-  cout <<  "payload is " << payload.get() << endl;
-  
+  fprintf(stderr, "Policy Callback got a message, type=%d, length=%d\n", mtype, len);
 
   const char *arg = (const char*)payload.get();
 
+  fprintf(stderr, "payload is %s\n", payload.get());
+
   PolicyHandler handler;
   Reader reader;
   StringStream ss(arg);
@@ -337,7 +349,7 @@ void policy_callback( Message& mbuf, int mtype, int subid, int len, Msg_componen
   //Set the threshold value
 
   if (handler.found_threshold) {
-    cout << "Setting RSRP Threshold to A1-P value: " << handler.threshold << endl;
+    fprintf(stderr, "Setting RSRP Threshold to A1-P value: %d\n", handler.threshold);
     rsrp_threshold = handler.threshold;
   }
 
@@ -371,7 +383,7 @@ void send_prediction_request(vector<string> ues_to_predict) {
 
   for (int i = 0; i < ues_to_predict.size(); i++) {
     if (i == ues_to_predict.size() - 1) {
-      ues_list = ues_list + " \"" + ues_to_predict.at(i) + "\"";
+      ues_list = ues_list + " \"" + ues_to_predict.at(i) + "\"]";
     } else {
       ues_list = ues_list + " \"" + ues_to_predict.at(i) + "\"" + ",";
     }
@@ -385,8 +397,8 @@ void send_prediction_request(vector<string> ues_to_predict) {
   
   send_payload = msg->Get_payload(); // direct access to payload
   //  snprintf( (char *) send_payload.get(), 2048, '{"UEPredictionSet" : ["12345"]}', 1 );
-  //  snprintf( (char *) send_payload.get(), 2048, body);
-  snprintf( (char *) send_payload.get(), 2048, "{\"UEPredictionSet\": [\"12345\"]}");
+  snprintf( (char *) send_payload.get(), 2048, body);
+  //snprintf( (char *) send_payload.get(), 2048, "{\"UEPredictionSet\": [\"12345\"]}");
 
   fprintf(stderr, "message body %s\n", send_payload.get());  
   fprintf(stderr, "payload length %d\n", strlen( (char *) send_payload.get() ));
@@ -510,20 +522,29 @@ void run_loop() {
 
   unordered_map<string, UEData> uemap;
 
-  vector<string> prediction_ues;
-
   while (1) {
 
     uemap = get_sdl_ue_data();
 
+    vector<string> prediction_ues;
+
     for (auto map_iter = uemap.begin(); map_iter != uemap.end(); map_iter++) {
       string ueid = map_iter->first;
+      fprintf(stderr,"found a ueid %s\n", ueid.c_str());
       UEData data = map_iter->second;
+
+      fprintf(stderr, "current rsrp is %d\n", data.serving_cell_rsrp);
+
       if (data.serving_cell_rsrp < rsrp_threshold) {
+       fprintf(stderr,"it is less than the rsrp threshold\n");
        prediction_ues.push_back(ueid);
+      } else {
+       fprintf(stderr,"it is not less than the rsrp threshold\n");
       }
     }
 
+    fprintf(stderr, "the size of pred ues is %d\n", prediction_ues.size());
+
     if (prediction_ues.size() > 0) {
       send_prediction_request(prediction_ues);
     }
index 218cf5f..a00dd37 100644 (file)
@@ -7,7 +7,7 @@
                 "image": {\r
                     "registry": "nexus3.o-ran-sc.org:10002",\r
                     "name": "o-ran-sc/ric-app-ts",\r
-                    "tag": "1.0.12"\r
+                    "tag": "1.0.13"\r
                 }\r
             }\r
         ],\r