From aeff88d0650ca210ba1afa2c202be2129f7a3faf Mon Sep 17 00:00:00 2001 From: Tommy Carpenter Date: Wed, 25 Mar 2020 15:11:39 -0400 Subject: [PATCH] Changes: * Move to SI95 * Move to Xapp frame 0.6.0 * Move to py38 * Remove unneeded stuff from setup.py since this is a docker component and not a pypi library * Add some mock data for future development Issue-ID: RICAPP-92 Change-Id: Idadde588e85c1362c2bd3a9c724a5f62a312f76b Signed-off-by: Tommy Carpenter --- Dockerfile | 7 ++- docs/release-notes.rst | 10 ++++ rmr-version.yaml | 2 +- setup.py | 31 +----------- tests/conftest.py | 131 +++++++++++++++++++++++++++++++++++++++++++++++++ tox.ini | 8 +-- 6 files changed, 151 insertions(+), 38 deletions(-) create mode 100644 tests/conftest.py diff --git a/Dockerfile b/Dockerfile index d7fd8ae..e34ba41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,16 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. # ================================================================================== -FROM python:3.7-alpine +FROM python:3.8-alpine # RMR setup RUN mkdir -p /opt/route/ -COPY --from=nexus3.o-ran-sc.org:10004/bldr-alpine3-go:1-rmr1.13.1 /usr/local/lib64/libnng.so /usr/local/lib64/libnng.so -COPY --from=nexus3.o-ran-sc.org:10004/bldr-alpine3-go:1-rmr1.13.1 /usr/local/lib64/librmr_nng.so /usr/local/lib64/librmr_nng.so +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 ENV LD_LIBRARY_PATH /usr/local/lib/:/usr/local/lib64 # sdl needs gcc -RUN apk update && apk add gcc musl-dev bash +RUN apk update && apk add gcc musl-dev # Install COPY setup.py /tmp diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 585465d..9d95fe2 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -14,6 +14,16 @@ and this project adheres to `Semantic Versioning `__. :depth: 3 :local: +[0.0.2] - 3/25/2020 +------------------- +:: + + * Move to SI95 + * Move to Xapp frame 0.6.0 + * Move to py38 + * Remove unneeded stuff from setup.py since this is a docker component and not a pypi library + * Add some mock data for future development + [0.0.1] - 3/17/2020 ------------------- :: diff --git a/rmr-version.yaml b/rmr-version.yaml index 5808bc4..07573f1 100644 --- a/rmr-version.yaml +++ b/rmr-version.yaml @@ -1,3 +1,3 @@ # CI script installs RMR from PackageCloud using this version --- -version: 1.13.1 +version: 3.6.1 diff --git a/setup.py b/setup.py index 8ad0259..e96f2c6 100644 --- a/setup.py +++ b/setup.py @@ -13,44 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. # ================================================================================== -from os.path import dirname, abspath, join as path_join from setuptools import setup, find_packages -SETUP_DIR = abspath(dirname(__file__)) - - -def _long_descr(): - """Yields the content of documentation files for the long description""" - try: - doc_path = path_join(SETUP_DIR, "docs/overview.rst") - with open(doc_path) as f: - return f.read() - except FileNotFoundError: # this happens during unit testing, we don't need it - return "" - - setup( name="qpdriver", - version="0.0.1", + version="0.0.2", packages=find_packages(exclude=["tests.*", "tests"]), author="Tommy Carpenter", description="QP Driver Xapp for traffic steering", url="https://gerrit.o-ran-sc.org/r/admin/repos/ric-app/qp-driver", - install_requires=["ricxappframe>=0.4.0"], + install_requires=["ricxappframe>=0.6.0"], entry_points={"console_scripts": ["start.py=qpdriver.main:start"]}, # adds a magical entrypoint for Docker - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Telecommunications Industry", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "License :: OSI Approved :: Apache Software License", - "Operating System :: POSIX :: Linux", - "Topic :: Communications", - ], - python_requires=">=3.7", - keywords="RIC xapp", license="Apache 2.0", data_files=[("", ["LICENSE.txt"])], - long_description=_long_descr(), - long_description_content_type="text/x-rst", ) diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..4861ff0 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,131 @@ +import pytest + + +@pytest.fixture +def ue_metrics(): + return { + "UEID": 12345, + "ServingCellID": "310-680-200-555002", + "MeasTimestampUEPDCPBytes": "2020-03-18 02:23:18.220", + "MeasPeriodUEPDCPBytes": 20, + "UEPDCPBytesDL": 250000, + "UEPDCPBytesUL": 100000, + "MeasTimestampUEPRBUsage": "2020-03-18 02:23:18.220", + "MeasPeriodUEPRBUsage": 20, + "UEPRBUsageDL": 10, + "UEPRBUsageUL": 30, + "MeasTimestampRF": "2020-03-18 02:23:18.210", + "MeasPeriodRF": 40, + "ServingCellRF": {"RSRP": -115, "RSRQ": -16, "RSSINR": -5}, + "NeighborCellRF": [ + {"CID": "310-680-200-555001", "CellRF": {"RSRP": -90, "RSRQ": -13, "RSSINR": -2.5}}, + {"CID": "310-680-200-555003", "CellRF": {"RSRP": -140, "RSRQ": -17, "RSSINR": -6}}, + ], + } + + +@pytest.fixture +def cell_metrics_1(): + return { + "CellID": "310-680-200-555001", + "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220", + "MeasPeriodPDCPBytes": 20, + "PDCPBytesDL": 2000000, + "PDCPBytesUL": 1200000, + "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220", + "MeasPeriodAvailPRB": 20, + "AvailPRBDL": 30, + "AvailPRBUL": 50, + } + + +@pytest.fixture +def cell_metrics_2(): + return { + "CellID": "310-680-200-555002", + "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220", + "MeasPeriodPDCPBytes": 20, + "PDCPBytesDL": 800000, + "PDCPBytesUL": 400000, + "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220", + "MeasPeriodAvailPRB": 20, + "AvailPRBDL": 30, + "AvailPRBUL": 45, + } + + +@pytest.fixture +def cell_metrics_3(): + return { + "CellID": "310-680-200-555003", + "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220", + "MeasPeriodPDCPBytes": 20, + "PDCPBytesDL": 1900000, + "PDCPBytesUL": 1000000, + "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220", + "MeasPeriodAvailPRB": 20, + "AvailPRBDL": 60, + "AvailPRBUL": 80, + } + + +@pytest.fixture +def qpd_to_qp(): + return { + "PredictionUE": 12345, + "UEMeasurements": { + "ServingCellID": "310-680-200-555002", + "MeasTimestampUEPDCPBytes": "2020-03-18 02:23:18.220", + "MeasPeriodUEPDCPBytes": 20, + "UEPDCPBytesDL": 250000, + "UEPDCPBytesUL": 100000, + "MeasTimestampUEPRBUsage": "2020-03-18 02:23:18.220", + "MeasPeriodUEPRBUsage": 20, + "UEPRBUsageDL": 10, + "UEPRBUsageUL": 30, + }, + "CellMeasurements": [ + { + "CellID": "310-680-200-555001", + "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220", + "MeasPeriodPDCPBytes": 20, + "PDCPBytesDL": 2000000, + "PDCPBytesUL": 1200000, + "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220", + "MeasPeriodAvailPRB": 20, + "AvailPRBDL": 30, + "AvailPRBUL": 50, + "MeasTimestampRF": "2020-03-18 02:23:18.210", + "MeasPeriodRF": 40, + "RFMeasurements": {"RSRP": -90, "RSRQ": -13, "RSSINR": -2.5}, + }, + { + "CellID": "310-680-200-555002", + "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220", + "MeasPeriodPDCPBytes": 20, + "PDCPBytesDL": 800000, + "PDCPBytesUL": 400000, + "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220", + "MeasPeriodAvailPRB": 20, + "AvailPRBDL": 30, + "AvailPRBUL": 45, + "MeasTimestampRF": "2020-03-18 02:23:18.210", + "MeasPeriodRF": 40, + "RFMeasurements": {"RSRP": -115, "RSRQ": -16, "RSSINR": -5}, + }, + { + "CellID": "310-680-200-555003", + "MeasTimestampPDCPBytes": "2020-03-18 02:23:18.220", + "MeasPeriodPDCPBytes": 20, + "PDCPBytesDL": 1900000, + "PDCPBytesUL": 1000000, + "MeasTimestampAvailPRB": "2020-03-18 02:23:18.220", + "MeasPeriodAvailPRB": 20, + "AvailPRBDL": 60, + "AvailPRBUL": 80, + "MeasTimestampRF": "2020-03-18 02:23:18.210", + "MeasPeriodRF": 40, + "RFMeasurements": {"RSRP": -140, "RSRQ": -17, "RSSINR": -6}, + }, + ], + } diff --git a/tox.ini b/tox.ini index 122ac82..fde992f 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ envlist = code,flake8,docs,docs-linkcheck minversion = 2.0 [testenv:code] -basepython = python3.7 +basepython = python3.8 deps= pytest coverage @@ -34,7 +34,7 @@ commands = coverage xml -i [testenv:flake8] -basepython = python3.7 +basepython = python3.8 skip_install = true deps = flake8 commands = flake8 setup.py qpdriver tests @@ -46,7 +46,7 @@ extend-ignore = E501,E741,E731 [testenv:docs] whitelist_externals = echo skipsdist = true -basepython = python3.7 +basepython = python3.8 deps = sphinx sphinx-rtd-theme @@ -59,7 +59,7 @@ commands = [testenv:docs-linkcheck] skipsdist = true -basepython = python3.7 +basepython = python3.8 deps = sphinx sphinx-rtd-theme sphinxcontrib-httpdomain -- 2.16.6