Release 1.0.2 79/12279/2 I-release
authorDeepanshu Karnwal <deepanshu.k@HCL.COM>
Wed, 13 Dec 2023 16:01:49 +0000 (16:01 +0000)
committerTuan Nguyen <hoang.su.tk@gmail.com>
Wed, 13 Dec 2023 18:12:55 +0000 (18:12 +0000)
Change-Id: I9810ccd69a18f5a2710ed3653f8f070febcb157d
Signed-off-by: Deepanshu Karnwal <deepanshu.k@HCL.COM>
Dockerfile
Dockerfile-Unit-Test
docs/release-notes.rst
local.rt
rmr-version.yaml
setup.py
src/ad_config.ini
src/ad_model.py
src/insert.py
xapp-descriptor/config.json

index 8a27f2c..0e9d445 100644 (file)
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 # ==================================================================================
-FROM frolvlad/alpine-miniconda3:python3.7
+#Python 3.11 miniconda
+FROM continuumio/miniconda3:23.10.0-1
+
 # RMR setup
 RUN mkdir -p /opt/route/
 
-# copy rmr files from builder image in lieu of an Alpine package
-COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:4.0.5 /usr/local/lib64/librmr* /usr/local/lib64/
+# sdl uses hiredis which needs gcc
+RUN apt update && apt install -y gcc musl-dev
+
+# copy rmr libraries from builder image in lieu of an Alpine package
+ARG RMRVERSION=4.9.0
+RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr_${RMRVERSION}_amd64.deb
+RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr-dev_${RMRVERSION}_amd64.deb
+RUN rm -f rmr_${RMRVERSION}_amd64.deb rmr-dev_${RMRVERSION}_amd64.deb
 
-COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:4.0.5 /usr/local/bin/rmr* /usr/local/bin/
 ENV LD_LIBRARY_PATH /usr/local/lib/:/usr/local/lib64
+ENV C_INCLUDE_PATH /usr/local/include
 COPY local.rt /opt/route/local.rt
 ENV RMR_SEED_RT /opt/route/local.rt
 
-RUN apk update && apk add gcc musl-dev
-
 # Install
 COPY setup.py /tmp
 COPY LICENSE.txt /tmp/
 # RUN mkdir -p /tmp/ad/
 RUN pip install /tmp
 RUN pip install ricxappframe
-RUN pip install --force-reinstall redis==3.0.1
 ENV PYTHONUNBUFFERED 1
+ENV CONFIG_FILE /opt/ric/config/config-file.json
 COPY src/ /src
-CMD PYTHONPATH=/src:/usr/lib/python3.7/site-packages/:$PYTHONPATH run-src.py
+CMD PYTHONPATH=/src:/usr/lib/python3.11/site-packages/:$PYTHONPATH run-src.py
index e54eecb..89223f3 100644 (file)
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 # ==================================================================================
-
-FROM frolvlad/alpine-miniconda3:python3.7
-# FROM python:3.8-alpine
+#Python 3.11 miniconda
+FROM continuumio/miniconda3:23.10.0-1
 
 # RMR setup
 RUN mkdir -p /opt/route/
 
 # sdl uses hiredis which needs gcc
-RUN apk update && apk add gcc musl-dev
+RUN apt update && apt install -y gcc musl-dev
 
 # copy rmr libraries from builder image in lieu of an Alpine package
-COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:4.0.5 /usr/local/lib64/librmr* /usr/local/lib64/
+ARG RMRVERSION=4.9.0
+RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr_${RMRVERSION}_amd64.deb
+RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr-dev_${RMRVERSION}_amd64.deb
+RUN rm -f rmr_${RMRVERSION}_amd64.deb rmr-dev_${RMRVERSION}_amd64.deb
 
 # Upgrade pip, install tox
 RUN pip install --upgrade pip && pip install tox
-RUN apk update && apk add gcc musl-dev
 
 # copies
 COPY setup.py tox.ini LICENSE.txt /tmp/
@@ -36,5 +37,5 @@ RUN pip install /tmp
 COPY src/ /tmp/src
 COPY tests/ /tmp/tests
 # Run the unit tests
-WORKDIR /tmp 
-RUN PYTHONPATH=/tmp/src:/usr/lib/python3.7/site-packages/:$PYTHONPATH tox -e code,flake8
+WORKDIR /tmp
+RUN PYTHONPATH=/tmp/src:/usr/lib/python3.11/site-packages/:$PYTHONPATH tox -e code,flake8
index 2dde1d2..b6ea1b7 100644 (file)
@@ -22,6 +22,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/>`__.
 
+[1.0.2] - 2023-12-12
+--------------------
+* Release version 1.0.2 (`RICAPP-229 <https://jira.o-ran-sc.org/browse/RICAPP-229>`_)
+
 [1.0.1] - 2023-06-28
 --------------------
 * Release version 1.0.1 (`RICAPP-215 <https://jira.o-ran-sc.org/browse/RICAPP-215>`_)
index e084807..0044b24 100644 (file)
--- a/local.rt
+++ b/local.rt
@@ -1,5 +1,5 @@
 newrt|start
-rte|30003|service-ricxapp-trafficxapp-rmr:4560
+rte|30003|service-ricxapp-trafficxapp-rmr.ricxapp:4560
 rte|20011|service-ricplt-a1mediator-rmr.ricplt:4560
 newrt|end
 
index d7b94dd..b50bbea 100644 (file)
@@ -1,3 +1,3 @@
 # CI script installs RMR from PackageCloud using this version
 ---
-version: 4.0.5
+version: 4.9.0
index 671b008..ebcb13b 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ setup(
     packages=find_packages(exclude=["tests.*", "tests"]),
     description="Anomaly Detection xApp that integrates with Traffic Steering",
     url="https://gerrit.o-ran-sc.org/r/admin/repos/ric-app/ad",
-    install_requires=["ricxappframe>=1.1.1,<2.0.0", "pandas>=1.1.3", "joblib>=0.3.2", "Scikit-learn>=0.18", "mdclogpy<=1.1.1", "schedule>=0.0.0", "influxdb"],
+    install_requires=["ricxappframe==3.2.2", "pandas>=1.1.3", "joblib>=0.3.2", "Scikit-learn>=0.18", "mdclogpy<=1.1.1", "schedule>=0.0.0", "influxdb"],
     entry_points={"console_scripts": ["run-src.py=src.main:start"]},  # adds a magical entrypoint for Docker
     license="Apache 2.0",
     data_files=[("", ["LICENSE.txt"])],
index cc7a8c4..3028a4e 100644 (file)
@@ -15,7 +15,7 @@
 # ==================================================================================
 
 [influxdb]
-host = ricplt-influxdb.ricplt 
+host = ricplt-influxdb.ricplt
 port = 8086
 user = admin
 password = 
index 4bac6e0..14c4dcf 100644 (file)
@@ -108,6 +108,8 @@ class CAUSE(object):
                         sample.loc[i, 'Degradation'] = deg
                         if 'Throughput' in deg and ('RSRP' in deg or 'RSRQ' in deg):
                             sample.loc[i, 'Anomaly'] = 2
+                        else:
+                            sample.loc[i, 'Anomaly'] = 1
                     else:
                         sample.loc[i, 'Anomaly'] = 0
         return sample[['Anomaly', 'Degradation']].values.tolist()
index d485b7b..a5c3a5b 100644 (file)
@@ -32,7 +32,7 @@ class INSERTDATA(DATABASE):
         self.config()
         self.connect()
 #        self.dropdb('RIC-Test')
-#        self.createdb('RIC-Test')
+        self.createdb('RIC-Test')
 
     def config(self):
         cfg = ConfigParser()
@@ -49,13 +49,15 @@ class INSERTDATA(DATABASE):
                 self.meas = cfg.get(section, "measurement")
 
     def createdb(self, dbname):
-        print("Create database: " + dbname)
-        self.client.create_database(dbname)
-        self.client.switch_database(dbname)
+        if dbname not in self.client.get_list_database():
+            print("Create database: " + dbname)
+            self.client.create_database(dbname)
+            self.client.switch_database(dbname)
 
     def dropdb(self, dbname):
-        print("DROP database: " + dbname)
-        self.client.drop_database(dbname)
+        if next((item for item in self.client.get_list_database() if item.get("name") == dbname), None) is not None:
+            print("DROP database: " + dbname)
+            self.client.drop_database(dbname)
 
     def dropmeas(self, measname):
         print("DROP MEASUREMENT: " + measname)
index 13f333e..f77a394 100644 (file)
@@ -1,6 +1,6 @@
 {
-        "xapp_name": "ad",
-        "version": "1.0.1",
+        "name": "ad",
+        "version": "1.0.2",
         "containers": [
             {
                 "name": "ad",
         ],
         "messaging": {
             "ports": [
+                {
+                    "name": "http",
+                    "container": "ad",
+                    "port": 8080,
+                    "description": "http service"
+                },
                 {
                     "name": "rmr-data",
                     "container": "ad",