Correct xApp descriptor tag to be rmr-data
Issue-ID: RICAPP-111, RICAPP-113
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
Change-Id: If069a5250c08bf5c02ffd4fbba24d60d143aef6d
# 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
---
# 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
---
#. ``container-tag.yaml``
#. ``docs/release-notes.rst``
#. ``setup.py``
#. ``container-tag.yaml``
#. ``docs/release-notes.rst``
#. ``setup.py``
+#. ``xapp-descriptor/config.json``
docker build -t qpd:latest -f Dockerfile .
docker run -d --net=host -e USE_FAKE_SDL=1 qpd:latest
docker build -t qpd:latest -f Dockerfile .
docker run -d --net=host -e USE_FAKE_SDL=1 qpd:latest
- docker exec -it CONTAINER_ID /usr/local/bin/rmr_probe -h 127.0.0.1:4562
+ docker exec -it CONTAINER_ID /usr/local/bin/rmr_probe -h 127.0.0.1:4560
+
Unit Testing
------------
Unit Testing
------------
The format is based on `Keep a Changelog <http://keepachangelog.com/>`__
and this project adheres to `Semantic Versioning <http://semver.org/>`__.
The format is based on `Keep a Changelog <http://keepachangelog.com/>`__
and this project adheres to `Semantic Versioning <http://semver.org/>`__.
+[0.0.2] - 2020-06-02
+--------------------
+* Change RMR listen port to 4560 (`RICAPP-111 <https://jira.o-ran-sc.org/browse/RICAPP-111>`_)
+
[0.0.1] - 2020-05-21
--------------------
* Initial mock version (`RICAPP-107 <https://jira.o-ran-sc.org/browse/RICAPP-107>`_)
[0.0.1] - 2020-05-21
--------------------
* Initial mock version (`RICAPP-107 <https://jira.o-ran-sc.org/browse/RICAPP-107>`_)
from mdclogpy import Logger
from ricxappframe.xapp_frame import RMRXapp, rmr
from mdclogpy import Logger
from ricxappframe.xapp_frame import RMRXapp, rmr
+# pylint: disable=invalid-name
qp_xapp = None
logger = Logger(name=__name__)
def post_init(self):
qp_xapp = None
logger = Logger(name=__name__)
def post_init(self):
+ """
+ Function that runs when xapp initialization is complete
+ """
self.predict_requests = 0
logger.debug("QP xApp started")
def qp_default_handler(self, summary, sbuf):
self.predict_requests = 0
logger.debug("QP xApp started")
def qp_default_handler(self, summary, sbuf):
+ """
+ Function that processes messages for which no handler is defined
+ """
logger.debug("default handler received message type {}".format(summary[rmr.RMR_MS_MSG_TYPE]))
# we don't use rts here; free this
self.rmr_free(sbuf)
def qp_predict_handler(self, summary, sbuf):
logger.debug("default handler received message type {}".format(summary[rmr.RMR_MS_MSG_TYPE]))
# we don't use rts here; free this
self.rmr_free(sbuf)
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]))
self.predict_requests += 1
# we don't use rts here; free this
self.rmr_free(sbuf)
# send a mock message
logger.debug("predict handler received message type {}".format(summary[rmr.RMR_MS_MSG_TYPE]))
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 ] } }'
- ok = self.rmr_send(mock_msg.encode(), 30002)
- if ok:
+ 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)
+ if success:
logger.debug("predict handler: sent message successfully")
else:
logger.debug("predict handler: sent message successfully")
else:
- logger.warn("predict handler: failed to send message")
+ logger.warning("predict handler: failed to send message")
logger.debug("QP xApp starting")
global qp_xapp
fake_sdl = os.environ.get("USE_FAKE_SDL", None)
logger.debug("QP xApp starting")
global qp_xapp
fake_sdl = os.environ.get("USE_FAKE_SDL", None)
- qp_xapp = RMRXapp(qp_default_handler, post_init=post_init, use_fake_sdl=True if fake_sdl else False)
+ qp_xapp = RMRXapp(qp_default_handler, rmr_port=4560, post_init=post_init, use_fake_sdl=bool(fake_sdl))
qp_xapp.register_callback(qp_predict_handler, 30001)
qp_xapp.run(thread)
qp_xapp.register_callback(qp_predict_handler, 30001)
qp_xapp.run(thread)
can only be called if thread=True when started
TODO: could we register a signal handler for Docker SIGTERM that calls this?
"""
can only be called if thread=True when started
TODO: could we register a signal handler for Docker SIGTERM that calls this?
"""
qp_xapp.stop()
def get_stats():
qp_xapp.stop()
def get_stats():
- # hacky for now, will evolve
+ """
+ hacky for now, will evolve
+ """
+ global qp_xapp
return {"PredictRequests": qp_xapp.predict_requests}
return {"PredictRequests": qp_xapp.predict_requests}
packages=find_packages(exclude=["tests.*", "tests"]),
description="Quality-of-Service Predictor Xapp for Traffic Steering",
url="https://gerrit.o-ran-sc.org/r/admin/repos/ric-app/qp",
packages=find_packages(exclude=["tests.*", "tests"]),
description="Quality-of-Service Predictor Xapp for Traffic Steering",
url="https://gerrit.o-ran-sc.org/r/admin/repos/ric-app/qp",
# do NOT use localhost, seems unresolved on jenkins VMs
newrt|start
# do NOT use localhost, seems unresolved on jenkins VMs
newrt|start
-mse| 30001 | -1 | 127.0.0.1:4562 # prediction request from QPD to QP
-mse| 60001 | -1 | 127.0.0.1:4562 # other message from QPD to QP
+mse| 30001 | -1 | 127.0.0.1:4560 # prediction request from QPD to QP
+mse| 60001 | -1 | 127.0.0.1:4560 # other message from QPD to QP
mse| 30002 | -1 | 127.0.0.1:4563 # prediction response from QP to TS
newrt|end
mse| 30002 | -1 | 127.0.0.1:4563 # prediction response from QP to TS
newrt|end
- # define a mock traffic steering xapp
+ # define a mock traffic steering xapp that listens on 4563
def mock_ts_default_handler(self, summary, sbuf):
pass
def mock_ts_default_handler(self, summary, sbuf):
pass
"containers": [
{
"name": "qp",
"image": {
"registry": "nexus3.o-ran-sc.org:10002",
"name": "o-ran-sc/ric-app-qp",
"containers": [
{
"name": "qp",
"image": {
"registry": "nexus3.o-ran-sc.org:10002",
"name": "o-ran-sc/ric-app-qp",
}
}
],
"messaging": {
"ports": [
{
}
}
],
"messaging": {
"ports": [
{
"rxMessages": ["TS_QOE_PRED_REQ"],
"txMessages": ["TS_QOE_PREDICTION"],
"policies": [],
"rxMessages": ["TS_QOE_PRED_REQ"],
"txMessages": ["TS_QOE_PREDICTION"],
"policies": [],
- "protPort": "tcp:4562",
+ "protPort": "tcp:4560",
"maxSize": 2072,
"numWorkers": 1,
"rxMessages": ["TS_QOE_PRED_REQ"],
"maxSize": 2072,
"numWorkers": 1,
"rxMessages": ["TS_QOE_PRED_REQ"],