From 2c1c4e9dd207289bbdc3453bfdb3e2dad68df8a8 Mon Sep 17 00:00:00 2001 From: Tommy Carpenter Date: Tue, 7 Apr 2020 08:36:42 -0400 Subject: [PATCH] Move to ricxappframe rmr, rmr3.6.3 Issue-ID: RIC-228 Change-Id: I879d93e111d04e8a382fa0428e3d8b652e57f3a4 Signed-off-by: Tommy Carpenter --- Dockerfile | 2 +- Dockerfile-Unit-Test | 2 +- a1/a1rmr.py | 4 +++- container-tag.yaml | 2 +- docs/developer-guide.rst | 7 +------ docs/release-notes.rst | 7 +++++++ integration_tests/a1mediator/Chart.yaml | 2 +- integration_tests/install_rmr.sh | 2 +- integration_tests/testxappcode/Dockerfile-delay-receiver | 2 +- integration_tests/testxappcode/Dockerfile-query-receiver | 2 +- integration_tests/testxappcode/Dockerfile-test-receiver | 4 +--- rmr-version.yaml | 2 +- setup.py | 12 ++---------- tests/test_controller.py | 4 ++-- 14 files changed, 24 insertions(+), 30 deletions(-) diff --git a/Dockerfile b/Dockerfile index d18d7d1..d749e4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,7 @@ RUN mkdir -p /opt/route/ # python copy; this basically makes the 2 stage python build work COPY --from=compile-image /home/a1user/.local /home/a1user/.local # copy rmr .so from the builder image -COPY --from=nexus3.o-ran-sc.org:10004/bldr-alpine3-go:3-rmr-si95-nng-3.6.1 /usr/local/lib64/librmr_si.so /usr/local/lib64/librmr_si.so +COPY --from=nexus3.o-ran-sc.org:10004/bldr-alpine3-go:5-a3.11-nng-rmr3 /usr/local/lib64/librmr_si.so /usr/local/lib64/librmr_si.so # Switch to a non-root user for security reasons. a1 does not currently write into any dirs so no chowns are needed at this time. RUN addgroup -S a1user && adduser -S -G a1user a1user USER a1user diff --git a/Dockerfile-Unit-Test b/Dockerfile-Unit-Test index a0a9a02..943a98e 100644 --- a/Dockerfile-Unit-Test +++ b/Dockerfile-Unit-Test @@ -17,7 +17,7 @@ FROM python:3.8-alpine # copy rmr .so from the builder image -COPY --from=nexus3.o-ran-sc.org:10004/bldr-alpine3-go:3-rmr-si95-nng-3.6.1 /usr/local/lib64/librmr_si.so /usr/local/lib64/librmr_si.so +COPY --from=nexus3.o-ran-sc.org:10004/bldr-alpine3-go:5-a3.11-nng-rmr3 /usr/local/lib64/librmr_si.so /usr/local/lib64/librmr_si.so # dir that rmr routing file temp goes into RUN mkdir -p /opt/route/ diff --git a/a1/a1rmr.py b/a1/a1rmr.py index 771842a..3d0ff95 100644 --- a/a1/a1rmr.py +++ b/a1/a1rmr.py @@ -22,7 +22,7 @@ import queue import time import json from threading import Thread -from rmr import rmr, helpers +from ricxappframe.rmr import rmr, helpers from mdclogpy import Logger from a1 import data, messages from a1.exceptions import PolicyTypeNotFound, PolicyInstanceNotFound @@ -45,6 +45,8 @@ class _RmrLoop: """ class represents an rmr loop that constantly reads from rmr and performs operations based on waiting messages this launches a thread, it should probably only be called once; the public facing method to access these ensures this + + TODO: the xapp frame has a version of this looping structure. See if A1 can switch to that. """ def __init__(self, init_func_override=None, rcv_func_override=None): diff --git a/container-tag.yaml b/container-tag.yaml index c05d3bf..094961d 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: 2.1.5 +tag: 2.1.6 diff --git a/docs/developer-guide.rst b/docs/developer-guide.rst index 6ef21f9..63ddde3 100644 --- a/docs/developer-guide.rst +++ b/docs/developer-guide.rst @@ -42,11 +42,6 @@ When version changes are made in that image, rebuilding those 5 containers in th However, there are two items in this repo that must be kept in sync: ``rmr-version.yaml``, which controls what rmr gets installed for unit testing in Jenkins, and ``integration_tests/install_rmr.sh`` which is a useful script for a variety of local testing. -Version bumping pyrmr ---------------------- -rmr-python is the python binding to rmr . Installing rmr per the above does not install it. -Bumping the rmr python version is done via ``setup.py`` - Version bumping python itself ----------------------------- If you want to update the version of python itself (ie just done from 37 to 38): @@ -91,7 +86,7 @@ Then, run all the tests from the root (this requires the python packages ``tox`` tox -c tox-integration.ini This script: -1. Deploys 2 helm charts (4 containers) into a local kubernetes installation +1. Deploys 3 helm charts (5 containers) into a local kubernetes installation 2. Port forwards a pod ClusterIP to localhost 3. Uses “tavern” to run some tests against the server 4. Barrages the server with apache bench diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 439937c..c153413 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -14,6 +14,13 @@ and this project adheres to `Semantic Versioning `__. :depth: 3 :local: +[2.1.6] - 4/7/2020 +------------------- +:: + + * Switch to rmr 3.6.3 + * Switch to using rmr in the ricxappframe + [2.1.5] - 3/19/2020 ------------------- diff --git a/integration_tests/a1mediator/Chart.yaml b/integration_tests/a1mediator/Chart.yaml index 3432ee7..ed7135f 100644 --- a/integration_tests/a1mediator/Chart.yaml +++ b/integration_tests/a1mediator/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v1 description: A1 Helm chart for Kubernetes name: a1mediator -version: 2.1.5 +version: 2.1.6 diff --git a/integration_tests/install_rmr.sh b/integration_tests/install_rmr.sh index 5ddc168..1d26594 100755 --- a/integration_tests/install_rmr.sh +++ b/integration_tests/install_rmr.sh @@ -1,5 +1,5 @@ #!/bin/sh -git clone --branch 3.6.1 https://gerrit.oran-osc.org/r/ric-plt/lib/rmr \ +git clone --branch 3.6.3 https://gerrit.oran-osc.org/r/ric-plt/lib/rmr \ && cd rmr \ && mkdir .build; cd .build \ && echo "<<>>" \ diff --git a/integration_tests/testxappcode/Dockerfile-delay-receiver b/integration_tests/testxappcode/Dockerfile-delay-receiver index 2398424..03725a1 100644 --- a/integration_tests/testxappcode/Dockerfile-delay-receiver +++ b/integration_tests/testxappcode/Dockerfile-delay-receiver @@ -16,7 +16,7 @@ # ================================================================================== # This Dockerfile uses a two stage Docker build -FROM nexus3.o-ran-sc.org:10004/bldr-alpine3-go:3-rmr-si95-nng-3.6.1 +FROM nexus3.o-ran-sc.org:10004/bldr-alpine3-go:5-a3.11-nng-rmr3 # go will complain if there is a go.mod at the root of the GOPATH so we can't. RUN mkdir myxapp diff --git a/integration_tests/testxappcode/Dockerfile-query-receiver b/integration_tests/testxappcode/Dockerfile-query-receiver index 9b83c9b..e45b15a 100644 --- a/integration_tests/testxappcode/Dockerfile-query-receiver +++ b/integration_tests/testxappcode/Dockerfile-query-receiver @@ -16,7 +16,7 @@ # ================================================================================== # This Dockerfile uses a two stage Docker build -FROM nexus3.o-ran-sc.org:10004/bldr-alpine3-go:3-rmr-si95-nng-3.6.1 +FROM nexus3.o-ran-sc.org:10004/bldr-alpine3-go:5-a3.11-nng-rmr3 # go will complain if there is a go.mod at the root of the GOPATH so we can't. RUN mkdir myxapp diff --git a/integration_tests/testxappcode/Dockerfile-test-receiver b/integration_tests/testxappcode/Dockerfile-test-receiver index bf9323a..3b9cc3d 100644 --- a/integration_tests/testxappcode/Dockerfile-test-receiver +++ b/integration_tests/testxappcode/Dockerfile-test-receiver @@ -16,9 +16,7 @@ # ================================================================================== # This Dockerfile uses a two stage Docker build - -# The first stage is defined here: https://gerrit.o-ran-sc.org/r/gitweb?p=ci-management.git;a=blob;f=docker/bldr-alpine3-go/Dockerfile;h=a1e31f07e6113d4a02202793ace6ebc780d71583;hb=3711ffcbfe06f6c872bf4a0871eb5f2a2fcd83ae -FROM nexus3.o-ran-sc.org:10004/bldr-alpine3-go:3-rmr-si95-nng-3.6.1 +FROM nexus3.o-ran-sc.org:10004/bldr-alpine3-go:5-a3.11-nng-rmr3 # go will complain if there is a go.mod at the root of the GOPATH so we can't. RUN mkdir myxapp diff --git a/rmr-version.yaml b/rmr-version.yaml index 07573f1..2d82c45 100644 --- a/rmr-version.yaml +++ b/rmr-version.yaml @@ -1,3 +1,3 @@ # CI script installs RMR from PackageCloud using this version --- -version: 3.6.1 +version: 3.6.3 diff --git a/setup.py b/setup.py index 1179239..67e2765 100644 --- a/setup.py +++ b/setup.py @@ -18,21 +18,13 @@ from setuptools import setup, find_packages setup( name="a1", - version="2.1.5", + version="2.1.6", packages=find_packages(exclude=["tests.*", "tests"]), author="Tommy Carpenter", description="RIC A1 Mediator for policy/intent changes", url="https://gerrit.o-ran-sc.org/r/admin/repos/ric-plt/a1", entry_points={"console_scripts": ["run.py=a1.run:main"]}, # we require jsonschema, should be in that list, but connexion already requires a specific version of it - install_requires=[ - "requests", - "Flask", - "connexion[swagger-ui]", - "gevent", - "rmr>=4.0.0,<5.0.0", - "mdclogpy", - "ricxappframe>=0.4.0", - ], + install_requires=["requests", "Flask", "connexion[swagger-ui]", "gevent", "mdclogpy", "ricxappframe>=1.0.0,<2.0.0"], package_data={"a1": ["openapi.yaml"]}, ) diff --git a/tests/test_controller.py b/tests/test_controller.py index 0601bbc..2aac5a9 100644 --- a/tests/test_controller.py +++ b/tests/test_controller.py @@ -19,7 +19,7 @@ tests for controller # ================================================================================== import time import json -from rmr.rmr_mocks import rmr_mocks +from ricxappframe.rmr.rmr_mocks import rmr_mocks from ricxappframe.xapp_sdl import SDLWrapper from ricsdl.exceptions import RejectedByBackend, NotConnected, BackendError from a1 import a1rmr, data @@ -89,7 +89,7 @@ def _fake_dequeue_deleted(): def _test_put_patch(monkeypatch): rmr_mocks.patch_rmr(monkeypatch) # assert that rmr bad states don't cause problems - monkeypatch.setattr("rmr.rmr.rmr_send_msg", rmr_mocks.send_mock_generator(10)) + monkeypatch.setattr("ricxappframe.rmr.rmr.rmr_send_msg", rmr_mocks.send_mock_generator(10)) def _no_ac(client): -- 2.16.6