From f628e2b58bde028a9b0bd0ee48168fb773814e69 Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Tue, 2 Jun 2020 14:43:30 -0400 Subject: [PATCH] Change qpd's RMR listen port to 4560 Correct xApp descriptor tag to be rmr-data Issue-ID: RICAPP-112, RICAPP-114 Signed-off-by: Lott, Christopher (cl778h) Change-Id: Ie28b9853a4ea7a4d19ba034ffe61a5aa8d2f8e12 --- container-tag.yaml | 2 +- docs/developers-guide.rst | 4 ++- docs/release-notes.rst | 6 ++++ qpdriver/main.py | 39 +++++++++++++-------- setup.py | 2 +- tests/fixtures/local.rt | 2 +- tests/fixtures/test_local.rt | 4 +-- xapp-descriptor/config.json | 82 ++++++++++++++++++++++---------------------- 8 files changed, 79 insertions(+), 62 deletions(-) diff --git a/container-tag.yaml b/container-tag.yaml index ee6d321..ea2bed4 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: 1.0.8 +tag: 1.0.9 diff --git a/docs/developers-guide.rst b/docs/developers-guide.rst index 26379ff..9330ad4 100755 --- a/docs/developers-guide.rst +++ b/docs/developers-guide.rst @@ -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 ------------ diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 7546efc..024286c 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -10,6 +10,12 @@ 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 `__. + +[1.0.9] - 2020-06-02 +-------------------- +* Change RMR listen port to 4560 (`RICAPP-112 `_) + + [1.0.8] - 2020-05-22 -------------------- * Revise static route table (`RICAPP-108 `_) diff --git a/qpdriver/main.py b/qpdriver/main.py index 1fbf95f..6640e2f 100644 --- a/qpdriver/main.py +++ b/qpdriver/main.py @@ -1,6 +1,3 @@ -""" -qpdriver entrypoint module -""" # ================================================================================== # Copyright (c) 2020 AT&T Intellectual Property. # @@ -16,13 +13,9 @@ qpdriver entrypoint module # See the License for the specific language governing permissions and # limitations under the License. # ================================================================================== -import json -from os import getenv -from ricxappframe.xapp_frame import RMRXapp, rmr -from qpdriver import data -from qpdriver.exceptions import UENotFound - """ +qpdriver entrypoint module + RMR Messages #define TS_UE_LIST 30000 #define TS_QOE_PRED_REQ 30001 @@ -30,18 +23,31 @@ RMR Messages 30000 is the message type QPD receives; sends out type 30001, which should be routed to QP. """ +import json +from os import getenv +from ricxappframe.xapp_frame import RMRXapp, rmr +from qpdriver import data +from qpdriver.exceptions import UENotFound + +# pylint: disable=invalid-name rmr_xapp = None def post_init(self): + """ + Function that runs when xapp initialization is complete + """ self.def_hand_called = 0 self.traffic_steering_requests = 0 def default_handler(self, summary, sbuf): + """ + Function that processes messages for which no handler is defined + """ self.def_hand_called += 1 - self.logger.info("QP Driver received an unexpected message of type: {}, dropping.".format(summary[rmr.RMR_MS_MSG_TYPE])) + self.logger.warning("QP Driver received an unexpected message of type: {}".format(summary[rmr.RMR_MS_MSG_TYPE])) self.rmr_free(sbuf) @@ -71,8 +77,8 @@ def steering_req_handler(self, summary, sbuf): try: to_qpp = data.form_qp_pred_req(self, ueid) payload = json.dumps(to_qpp).encode() - ok = self.rmr_send(payload, 30001) - if not ok: + success = self.rmr_send(payload, 30001) + if not success: self.logger.debug("QP Driver was unable to send to QP!") except UENotFound: self.logger.debug("Received a TS Request for a UE that does not exist!") @@ -86,7 +92,7 @@ def start(thread=False): """ global rmr_xapp fake_sdl = getenv("USE_FAKE_SDL", None) - rmr_xapp = RMRXapp(default_handler, post_init=post_init, use_fake_sdl=True if fake_sdl else False) + rmr_xapp = RMRXapp(default_handler, rmr_port=4560, post_init=post_init, use_fake_sdl=bool(fake_sdl)) rmr_xapp.register_callback(steering_req_handler, 30000) rmr_xapp.run(thread) @@ -100,5 +106,8 @@ def stop(): def get_stats(): - # hacky for now, will evolve - return {"DefCalled": rmr_xapp.def_hand_called, "SteeringRequests": rmr_xapp.traffic_steering_requests} + """ + hacky for now, will evolve + """ + return {"DefCalled": rmr_xapp.def_hand_called, + "SteeringRequests": rmr_xapp.traffic_steering_requests} diff --git a/setup.py b/setup.py index fa52d60..22d3c2f 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ from setuptools import setup, find_packages setup( name="qpdriver", - version="1.0.8", + version="1.0.9", packages=find_packages(exclude=["tests.*", "tests"]), author="Tommy Carpenter", description="QP Driver Xapp for traffic steering", diff --git a/tests/fixtures/local.rt b/tests/fixtures/local.rt index fa06be6..90898ea 100644 --- a/tests/fixtures/local.rt +++ b/tests/fixtures/local.rt @@ -1,3 +1,3 @@ newrt|start -rte|30001|service-ricxapp-qp-rmr.ricxapp.svc.cluster.local:4562 +rte|30001|service-ricxapp-qp-rmr.ricxapp.svc.cluster.local:4560 newrt|end diff --git a/tests/fixtures/test_local.rt b/tests/fixtures/test_local.rt index 0356661..849d90b 100644 --- a/tests/fixtures/test_local.rt +++ b/tests/fixtures/test_local.rt @@ -1,6 +1,6 @@ # do NOT use localhost, seems unresolved on jenkins VMs newrt|start -mse| 30000 | -1 | 127.0.0.1:4562 +mse| 30000 | -1 | 127.0.0.1:4560 mse| 30001 | -1 | 127.0.0.1:4666 -mse| 60001 | -1 | 127.0.0.1:4562 +mse| 60001 | -1 | 127.0.0.1:4560 newrt|end diff --git a/xapp-descriptor/config.json b/xapp-descriptor/config.json index 451e995..9bc76b3 100644 --- a/xapp-descriptor/config.json +++ b/xapp-descriptor/config.json @@ -1,41 +1,41 @@ -{ - "xapp_name": "qpdriver", - "version": "1.0.0", - "containers": [ - { - "name": "qpdriver", - "image": { - "registry": "nexus3.o-ran-sc.org:10002", - "name": "o-ran-sc/ric-app-qp-driver", - "tag": "1.0.8" - } - } - ], - "messaging": { - "ports": [ - { - "name": "rmr-data-in", - "container": "qpdriver", - "port": 4562, - "rxMessages": ["TS_UE_LIST"], - "txMessages": [ "TS_QOE_PRED_REQ" ], - "policies": [], - "description": "rmr receive data port for qpdriver" - }, - { - "name": "rmr-route", - "container": "qpdriver", - "port": 4561, - "description": "rmr route port for qpdriver" - } - ] - }, - "rmr": { - "protPort": "tcp:4562", - "maxSize": 2072, - "numWorkers": 1, - "txMessages": ["TS_QOE_PRED_REQ"], - "rxMessages": ["TS_UE_LIST"], - "policies": [] - } - } +{ + "xapp_name": "qpdriver", + "version": "1.0.9", + "containers": [ + { + "name": "qpdriver", + "image": { + "registry": "nexus3.o-ran-sc.org:10002", + "name": "o-ran-sc/ric-app-qp-driver", + "tag": "1.0.9" + } + } + ], + "messaging": { + "ports": [ + { + "name": "rmr-data", + "container": "qpdriver", + "port": 4560, + "rxMessages": ["TS_UE_LIST"], + "txMessages": ["TS_QOE_PRED_REQ"], + "policies": [], + "description": "rmr receive data port for qpdriver" + }, + { + "name": "rmr-route", + "container": "qpdriver", + "port": 4561, + "description": "rmr route port for qpdriver" + } + ] + }, + "rmr": { + "protPort": "tcp:4560", + "maxSize": 2072, + "numWorkers": 1, + "txMessages": ["TS_QOE_PRED_REQ"], + "rxMessages": ["TS_UE_LIST"], + "policies": [] + } + } -- 2.16.6