Change qp's RMR listen port to 4560 59/3959/5 0.0.2
authorLott, Christopher (cl778h) <cl778h@att.com>
Tue, 2 Jun 2020 18:12:07 +0000 (14:12 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Tue, 2 Jun 2020 23:19:26 +0000 (19:19 -0400)
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

container-tag.yaml
docs/developers-guide.rst
docs/release-notes.rst
qp/main.py
setup.py
tests/fixtures/test_local.rt
tests/test_qp.py
xapp-descriptor/config.json

index 48c5b97..e4b3d71 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.1
+tag: 0.0.2
index e19c0c0..861336a 100755 (executable)
@@ -19,6 +19,7 @@ This project follows semver. When changes are made, update the version strings i
 #. ``container-tag.yaml``
 #. ``docs/release-notes.rst``
 #. ``setup.py``
+#. ``xapp-descriptor/config.json``
 
 
 Testing RMR Healthcheck
@@ -30,7 +31,8 @@ to test that the RMR healthcheck is working.
 
     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
 ------------
index 66e97b9..c0add43 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.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>`_)
index 2074c19..02e493d 100644 (file)
@@ -29,34 +29,45 @@ import os
 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):
+    """
+    Function that runs when xapp initialization is complete
+    """
     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):
+    """
+    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
-    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.warn("predict handler: failed to send message")
+        logger.warning("predict handler: failed to send message")
 
 
 def start(thread=False):
@@ -68,7 +79,7 @@ def start(thread=False):
     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)
 
@@ -78,9 +89,13 @@ def stop():
     can only be called if thread=True when started
     TODO: could we register a signal handler for Docker SIGTERM that calls this?
     """
+    global qp_xapp
     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}
index 8c7d905..eb58e77 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,7 @@ from setuptools import setup, find_packages
 
 setup(
     name="qp",
-    version="0.0.1",
+    version="0.0.2",
     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",
index 5c66798..6fcafb5 100644 (file)
@@ -1,6 +1,6 @@
 # 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
index 69ca8d5..cf3a960 100644 (file)
@@ -52,7 +52,7 @@ def test_rmr_flow(monkeypatch, qpd_to_qp, qp_prediction):
 
     expected_result = {}
 
-    # 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
 
index 157951d..76684ec 100644 (file)
@@ -1,22 +1,22 @@
 {
         "xapp_name": "qp",
-        "version": "0.0.1",
+        "version": "0.0.2",
         "containers": [
             {
                 "name": "qp",
                 "image": {
                     "registry": "nexus3.o-ran-sc.org:10002",
                     "name": "o-ran-sc/ric-app-qp",
-                    "tag": "0.0.1"
+                    "tag": "0.0.2"
                 }
             }
         ],
         "messaging": {
             "ports": [
                 {
-                    "name": "rmr-data-in",
+                    "name": "rmr-data",
                     "container": "qp",
-                    "port": 4562,
+                    "port": 4560,
                     "rxMessages": ["TS_QOE_PRED_REQ"],
                     "txMessages": ["TS_QOE_PREDICTION"],
                     "policies": [],
@@ -31,7 +31,7 @@
             ]
         },
         "rmr": {
-            "protPort": "tcp:4562",
+            "protPort": "tcp:4560",
             "maxSize": 2072,
             "numWorkers": 1,
             "rxMessages": ["TS_QOE_PRED_REQ"],