Generate mock pred message with one cell having better xput 79/5279/5 0.0.3
authorRon Shacham <rshacham@research.att.com>
Tue, 8 Dec 2020 17:41:57 +0000 (12:41 -0500)
committerRon Shacham <rshacham@research.att.com>
Tue, 8 Dec 2020 23:07:18 +0000 (18:07 -0500)
Issue-ID: RICAPP-96

Signed-off-by: Ron Shacham <rshacham@research.att.com>
Change-Id: I8ea5e94188523494c950b1fd002e8bcc51a42f20
Signed-off-by: Ron Shacham <rshacham@research.att.com>
container-tag.yaml
docs/release-notes.rst
qp/main.py
tests/conftest.py
xapp-descriptor/config.json

index e4b3d71..90c44f3 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:my-tag
 ---
-tag: 0.0.2
+tag: 0.0.3
index c0add43..8fa56ed 100644 (file)
@@ -10,6 +10,10 @@ All notable changes to this project will be documented in this file.
 The format is based on `Keep a Changelog <http://keepachangelog.com/>`__
 and this project adheres to `Semantic Versioning <http://semver.org/>`__.
 
+[0.0.3] - 2020-12-08
+--------------------
+* Process incoming message from QP Driver and generate a dynamic mock Prediction message with one cell having better xput
+
 [0.0.2] - 2020-06-02
 --------------------
 * Change RMR listen port to 4560 (`RICAPP-111 <https://jira.o-ran-sc.org/browse/RICAPP-111>`_)
index 02e493d..188e686 100644 (file)
@@ -24,7 +24,7 @@ sends out type 30002 which should be routed to TS.
 
 """
 
-
+import json
 import os
 from mdclogpy import Logger
 from ricxappframe.xapp_frame import RMRXapp, rmr
@@ -56,14 +56,25 @@ def qp_predict_handler(self, summary, sbuf):
     Function that processes messages for type 30001
     """
     logger.debug("predict handler received message type {}".format(summary[rmr.RMR_MS_MSG_TYPE]))
+    logger.debug("adding somethign")
+    logger.debug("message is " + summary[rmr.RMR_MS_PAYLOAD].decode())
+    pred_req_msg = json.loads(summary[rmr.RMR_MS_PAYLOAD].decode())
+    all_cells = {}
+    ind = 0
+    for ncell in pred_req_msg["CellMeasurements"]:
+        if (ind == 0):
+            all_cells[ncell["CellID"]] = [50000, 20000]
+        else:
+            all_cells[ncell["CellID"]] = [20000, 10000]
+        ind += 1
+
+    pred_msg = {}
+    pred_msg[pred_req_msg["PredictionUE"]] = all_cells
     self.predict_requests += 1
     # we don't use rts here; free this
     self.rmr_free(sbuf)
-    # send a mock message
-    mock_msg = '{ "12345" : { "310-680-200-555001" : [ 2000000 , 1200000 ], '\
-               '              "310-680-200-555002" : [  800000 , 400000  ], '\
-               '              "310-680-200-555003" : [  800000 , 400000  ] } }'
-    success = self.rmr_send(mock_msg.encode(), 30002)
+    # send a mock message based on input
+    success = self.rmr_send(json.dumps(pred_msg).encode(), 30002)
     if success:
         logger.debug("predict handler: sent message successfully")
     else:
index 78798c8..79f648d 100644 (file)
@@ -22,9 +22,9 @@ import pytest
 def qp_prediction():
     return {
         "12345": {
-            "310-680-200-555001": [2000000, 1200000],
-            "310-680-200-555002": [800000, 400000],
-            "310-680-200-555003": [800000, 400000]
+            "310-680-200-555001": [50000, 20000],
+            "310-680-200-555003": [20000, 10000],
+            "310-680-200-555002": [20000, 10000]
         }
     }
 
index 76684ec..3a5084d 100644 (file)
@@ -7,7 +7,7 @@
                 "image": {
                     "registry": "nexus3.o-ran-sc.org:10002",
                     "name": "o-ran-sc/ric-app-qp",
-                    "tag": "0.0.2"
+                    "tag": "0.0.3"
                 }
             }
         ],