Revise static route table to support testing 00/3800/2
authorLott, Christopher (cl778h) <cl778h@att.com>
Fri, 22 May 2020 19:35:14 +0000 (15:35 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Fri, 22 May 2020 19:39:43 +0000 (15:39 -0400)
Correct typo in xapp descriptor for txMessages

Issue-ID: RICAPP-108
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
Change-Id: I75af5a2cff460d5f6d29efb8fbc41820051bff03

.gitattributes [new file with mode: 0644]
.gitreview
container-tag.yaml
docs/release-notes.rst
qpdriver/exceptions.py
qpdriver/main.py
setup.py
tests/fixtures/local.rt
tests/test_qpd.py
xapp-descriptor/config.json

diff --git a/.gitattributes b/.gitattributes
new file mode 100644 (file)
index 0000000..38b6a85
--- /dev/null
@@ -0,0 +1,21 @@
+# https://help.github.com/articles/dealing-with-line-endings/
+
+# Set the default behavior, in case people don't have core.autocrlf set.
+*        text=auto
+
+# Explicitly declare text files you want to always be normalized
+# and converted to native line endings on checkout.
+*.css    text
+*.htm    text diff=html
+*.html   text diff=html
+*.java   text diff=java
+*.js     text
+*.jsp    text
+*.less   text
+*.properties text
+*.sql    text
+*.xml    text
+
+# Denote all files that are truly binary and should not be modified.
+*.png binary
+*.jpg binary
index ae4f061..52c3add 100644 (file)
@@ -1,7 +1,6 @@
-
-        [gerrit]
-        host=gerrit.o-ran-sc.org
-        port=29418
-        project=ric-app/qp-driver
-        defaultbranch=master
-        
\ No newline at end of file
+[gerrit]
+host=gerrit.o-ran-sc.org
+port=29418
+project=ric-app/qp-driver
+defaultbranch=master
+defaultremote=origin
index de4adea..ee6d321 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: 1.0.7
+tag: 1.0.8
index 323ab37..7546efc 100644 (file)
@@ -10,6 +10,11 @@ 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/>`__.
 
+[1.0.8] - 2020-05-22
+--------------------
+* Revise static route table (`RICAPP-108 <https://jira.o-ran-sc.org/browse/RICAPP-108>`_)
+
+
 [1.0.7] - 2020-05-15
 --------------------
 * Include xapp descriptor json in repo (`RICAPP-97 <https://jira.o-ran-sc.org/browse/RICAPP-97>`_)
index 8184cc5..9c83d3e 100644 (file)
@@ -1,6 +1,3 @@
-"""
-custom logic exceptions
-"""
 # ==================================================================================
 #       Copyright (c) 2020 AT&T Intellectual Property.
 #
@@ -16,6 +13,9 @@ custom logic exceptions
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 # ==================================================================================
+"""
+custom logic exceptions
+"""
 
 
 class UENotFound(BaseException):
index 000d3a5..1fbf95f 100644 (file)
@@ -26,7 +26,8 @@ from qpdriver.exceptions import UENotFound
 RMR Messages
  #define TS_UE_LIST 30000
  #define TS_QOE_PRED_REQ 30001
-30000 is the message QPD receives, sends out 30001 to QP
+ #define TS_QOE_PREDICTION 30002
+30000 is the message type QPD receives; sends out type 30001, which should be routed to QP.
 """
 
 
@@ -46,9 +47,10 @@ def default_handler(self, summary, sbuf):
 
 def steering_req_handler(self, summary, sbuf):
     """
-    This is the main handler for this xapp, which handles the traffic steering requests.
+    This is the main handler for this xapp, which handles traffic steering requests.
     Traffic steering requests predictions on a set of UEs.
-    QP Driver (this) fetches a set of data, merges it together in a deterministic way, then sends a new message out to the QP predictor Xapp.
+    This app fetches a set of data, merges it together in a deterministic way,
+    then sends a new message out to the QP predictor Xapp.
 
     The incoming message that this function handles looks like:
         {“UEPredictionSet” : [“UEId1”,”UEId2”,”UEId3”]}
@@ -64,23 +66,23 @@ def steering_req_handler(self, summary, sbuf):
     # we don't use rts here; free this
     self.rmr_free(sbuf)
 
-    # iterate over the ues and send a request each, if it is a valid UE, to QPP
+    # iterate over the UEs and send a request for each, if it is a valid UE, to QP
     for ueid in ue_list:
         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:
-                self.logger.debug("QP Driver was unable to send to QP Predictor!")
+                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!")
 
 
 def start(thread=False):
     """
-    this is a convienence function that allows this xapp to run in Docker for "real" (no thread, real SDL)
-    but also easily modified for unit testing (e.g., use_fake_sdl)
-    the defaults for this function are for the Dockerized xapp.
+    This is a convenience function that allows this xapp to run in Docker
+    for "real" (no thread, real SDL), but also easily modified for unit testing
+    (e.g., use_fake_sdl). The defaults for this function are for the Dockerized xapp.
     """
     global rmr_xapp
     fake_sdl = getenv("USE_FAKE_SDL", None)
index 423a37a..fa52d60 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,7 @@ from setuptools import setup, find_packages
 
 setup(
     name="qpdriver",
-    version="1.0.7",
+    version="1.0.8",
     packages=find_packages(exclude=["tests.*", "tests"]),
     author="Tommy Carpenter",
     description="QP Driver Xapp for traffic steering",
index 70046b3..fa06be6 100644 (file)
@@ -1,2 +1,3 @@
 newrt|start
+rte|30001|service-ricxapp-qp-rmr.ricxapp.svc.cluster.local:4562
 newrt|end
index ebd90cb..ac72c2c 100644 (file)
@@ -19,8 +19,8 @@ from contextlib import suppress
 from qpdriver import main, data
 from ricxappframe.xapp_frame import Xapp, RMRXapp
 
-mock_traffic_steering = None
-mock_qp_predictor = None
+mock_ts_xapp = None
+mock_qp_xapp = None
 
 """
  these tests are not currently parallelizable (do not use this tox flag)
@@ -52,31 +52,30 @@ def test_init_xapp(monkeypatch, ue_metrics, cell_metrics_1, cell_metrics_2, cell
 def test_rmr_flow(monkeypatch, qpd_to_qp, qpd_to_qp_bad_cell):
     """
     this flow mocks out the xapps on both sides of QP driver.
-    It first stands up a mock qp predictor, then it starts up a
-    mock traffic steering which will immediately send requests
-    to the running qp driver]
+    It first stands up a mock qp, then it starts up a mock ts
+    which will immediately send requests to the running qp driver.
     """
 
     expected_result = {}
 
     # define a mock qp predictor
-    def default_handler(self, summary, sbuf):
+    def mock_qp_default_handler(self, summary, sbuf):
         pass
 
-    def qp_driver_handler(self, summary, sbuf):
+    def mock_qp_predict_handler(self, summary, sbuf):
         nonlocal expected_result  # closures ftw
         pay = json.loads(summary["payload"])
         expected_result[pay["PredictionUE"]] = pay
 
-    global mock_qp_predictor
-    mock_qp_predictor = RMRXapp(default_handler, rmr_port=4666, use_fake_sdl=True)
-    mock_qp_predictor.register_callback(qp_driver_handler, 30001)
-    mock_qp_predictor.run(thread=True)
+    global mock_qp_xapp
+    mock_qp_xapp = RMRXapp(mock_qp_default_handler, rmr_port=4666, use_fake_sdl=True)
+    mock_qp_xapp.register_callback(mock_qp_predict_handler, 30001)
+    mock_qp_xapp.run(thread=True)
 
     time.sleep(1)
 
     # define a mock traffic steering xapp
-    def entry(self):
+    def mock_ts_entry(self):
 
         # make sure a bad steering request doesn't blow up in qpd
         val = "notevenjson".encode()
@@ -96,9 +95,9 @@ def test_rmr_flow(monkeypatch, qpd_to_qp, qpd_to_qp_bad_cell):
         val = json.dumps({"test send 60001": 2}).encode()
         self.rmr_send(val, 60001)
 
-    global mock_traffic_steering
-    mock_traffic_steering = Xapp(entrypoint=entry, rmr_port=4564, use_fake_sdl=True)
-    mock_traffic_steering.run()  # this will return since entry isn't a loop
+    global mock_ts_xapp
+    mock_ts_xapp = Xapp(entrypoint=mock_ts_entry, rmr_port=4564, use_fake_sdl=True)
+    mock_ts_xapp.run()  # this will return since entry isn't a loop
 
     time.sleep(1)
 
@@ -110,11 +109,12 @@ def teardown_module():
     """
     this is like a "finally"; the name of this function is pytest magic
     safer to put down here since certain failures above can lead to pytest never returning
-    for example if an exception gets raised before stop is called in any test function above, pytest will hang forever
+    for example if an exception gets raised before stop is called in any test function above,
+    pytest will hang forever
     """
     with suppress(Exception):
-        mock_traffic_steering.stop()
+        mock_ts_xapp.stop()
     with suppress(Exception):
-        mock_qp_predictor.stop()
+        mock_qp_xapp.stop()
     with suppress(Exception):
         main.stop()
index 9458208..451e995 100644 (file)
@@ -7,7 +7,7 @@
                 "image": {\r
                     "registry": "nexus3.o-ran-sc.org:10002",\r
                     "name": "o-ran-sc/ric-app-qp-driver",\r
-                    "tag": "1.0.7"\r
+                    "tag": "1.0.8"\r
                 }\r
             }\r
         ],\r
@@ -18,7 +18,7 @@
                     "container": "qpdriver",\r
                     "port": 4562,\r
                     "rxMessages": ["TS_UE_LIST"],\r
-                    "txMessages": [ "TS_QUE_PRED_REQ" ],\r
+                    "txMessages": [ "TS_QOE_PRED_REQ" ],\r
                     "policies": [],\r
                     "description": "rmr receive data port for qpdriver"\r
                 },\r
@@ -34,7 +34,7 @@
             "protPort": "tcp:4562",\r
             "maxSize": 2072,\r
             "numWorkers": 1,\r
-            "txMessages": ["TS_QUE_PRED_REQ"],\r
+            "txMessages": ["TS_QOE_PRED_REQ"],\r
             "rxMessages": ["TS_UE_LIST"],\r
             "policies": []\r
         }\r