and update README.md. Run & fix the result of local Sonarcube scan.
Issue-ID: NONRTRIC-817
Change-Id: If1695c7d3ada11420d3efbbfc844a485776db90f
Signed-off-by: halil.cakal <halil.cakal@est.tech>
# Python virtual env
venv/
+
+# Local Sonarqube scan folder
+.scannerwork/
+
| Dir | Description |
| ---------------- | ----------- |
-|. |Dockerfile, container-tag.yaml, nginx.conf, pyproject.toml, tox.ini and README.md |
+|. |Dockerfile, container-tag.yaml, nginx.conf, pyproject.toml, tox.ini, setup.py, and README.md |
|api |The OpenApi yaml rapp-catalogue-enhanced.yaml |
|src |Python source codes includes sub-directories repository, configuration, and start.sh |
|certificate |A self-signed certificate and a key |
Note that test can be performed both using the nonsecure HTTP port and the secure HTTPS port.
+# Building the rApp Catalogue Enhanced
+
Build and start the rApp catalogue enhanced containers:
./build_and_start.sh
This will build and start the container in interactive mode. The built container only resides in the local docker repository. When running the rApp Catalogue Enhanced as a container, the defualt ports can be re-mapped to any port on the localhost.
-In a second terminal, go to the same folder and run the basic test script, basic_test.sh nonsecure|secure.
+# API Testing of rApp Catalogue Enhanced
+
+In a second terminal, go to the same folder and run the basic test script:
+ basic_test.sh nonsecure|secure.
+
+This script runs a number of API tests towards the rApp Catalogue Enhanced to make sure it works properply.
+
+# Unit Testing of rApp Catalogue Enhanced
+
+In order to run unit test cases, there is no need to build, and start any container. However, Python's venv must exist. You can follow the below steps to create a venv:
+ 1- Change current directory to project's root directory that is rappcatalogue.
+ 2- Run the commands consecutively:
+ python3 -m venv venv --prompt="rappcatalogue"
+ source venv/bin/activate
+ pip install connexion
+ 3- Change current directory to 'catalogue-enhanced/tests/'
+ 4- Run the command below:
+ python suite.py
+The suite.py will detect existing unit test cases, and run them all.
+
+# Installing the pip distribution of rApp Catalogue Enhanced
+
+It is also possible to have a pip distro of rApp catalogue. In order to install in your venv, you have to first install a venv mentioned in Unit Testing of rApp.
+
+Then, you can follow the below steps:
+ 1- Change current directory to 'rappcatalogue/catalogue-enhanced' where you can find setup.py
+ 2- Run the command:
+ pip install .
+
+This will build the rApp catalogue on your local.
+
-This script runs a number of tests towards the rApp Catalogue Enhanced to make sure it works properply.
--- /dev/null
+#!/usr/bin/env python
+
+# ============LICENSE_START===============================================
+# Copyright (C) 2023 Nordix Foundation. All rights reserved.
+# ========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=================================================
+#
+
+from setuptools import setup
+
+setup(name='rappcatalogue-enhanced',
+ version='1.0.0',
+ description='The O-RAN Non-RT RIC rApp Catalogue Enhanced provides an OpenApi 3.0 REST API for rApp services to register/unregister themselves and discover other services',
+ maintainer='Halil Cakal',
+ maintainer_email='halil.cakal@est.tech',
+ url='https://gerrit.o-ran-sc.org/r/admin/repos/nonrtric/plt/rappcatalogue,general',
+ license='Apache License, Version 2.0',
+ platforms='any',
+ packages=[
+ 'src',
+ 'src.configuration',
+ 'src.repository',
+ 'api',
+ 'certificate',
+ 'config',
+ 'csar',
+ 'tests'
+ ],
+ zip_safe=False,
+ include_package_data=True,
+ install_requires=[
+ 'connexion[swagger-ui]',
+ ],
+)
arr_api_list = rapp_definition['apiList']
arr_filtered_api_list = [arr_item for arr_item in arr_api_list if arr_item['serviceType'] == service_type]
return (arr_filtered_api_list, 200)
- except Exception as err:
+ except Exception:
pjson=create_problem_json(None, "The rapp definition is corrupt or missing.", 400, None, rapp_id)
return Response(json.dumps(pjson), 400, mimetype=APPL_PROB_JSON)
for file_name in file_names:
if file_name.endswith('TOSCA.meta'):
return TextIOWrapper(zip_object.open(file_name)) # TextIOWrapper: provides buffered text stream
- except Exception as err:
+ except Exception:
pjson=create_problem_json(None, "The CSAR zip content is corrupt or missing.", 400, None, rapp_id)
return Response(json.dumps(pjson), 400, mimetype=APPL_PROB_JSON)
finally:
# add to the dict
self.synch_registry.set_rapp(i, 'rapp'+str(i))
- def tearDown(self):
- pass
-
def test_synch_registry_setup_size(self):
self.assertEqual(100, len(self.synch_registry._rapps))