From ced4e852cebdedf60873b7c1bb4c1201d5909d00 Mon Sep 17 00:00:00 2001 From: Ron Shacham Date: Tue, 8 Dec 2020 12:41:57 -0500 Subject: [PATCH] Generate mock pred message with one cell having better xput Issue-ID: RICAPP-96 Signed-off-by: Ron Shacham Change-Id: I8ea5e94188523494c950b1fd002e8bcc51a42f20 Signed-off-by: Ron Shacham --- container-tag.yaml | 2 +- docs/release-notes.rst | 4 ++++ qp/main.py | 23 +++++++++++++++++------ tests/conftest.py | 6 +++--- xapp-descriptor/config.json | 2 +- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/container-tag.yaml b/container-tag.yaml index e4b3d71..90c44f3 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -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 diff --git a/docs/release-notes.rst b/docs/release-notes.rst index c0add43..8fa56ed 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -10,6 +10,10 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `__ and this project adheres to `Semantic Versioning `__. +[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 `_) diff --git a/qp/main.py b/qp/main.py index 02e493d..188e686 100644 --- a/qp/main.py +++ b/qp/main.py @@ -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: diff --git a/tests/conftest.py b/tests/conftest.py index 78798c8..79f648d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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] } } diff --git a/xapp-descriptor/config.json b/xapp-descriptor/config.json index 76684ec..3a5084d 100644 --- a/xapp-descriptor/config.json +++ b/xapp-descriptor/config.json @@ -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" } } ], -- 2.16.6