:warning: This repo is not maintained. If you want to fork it, check the security warnings for the dependencies. :warning:
MSO-LO is a REST API application to provide an ETSI SOL 005 v2.6.1 compliant interface towards various NFV orchestrators.
OpenAPI specification is provided on Swagger Hub or in openapi directory.
The software is developed under the 5G EVE project.
List of authors/contributors:
Software is distributed under Apache License, Version 2.0
If iwf-repository is available in your environment, edit docker-compose.yaml and change the relevant environment variables:
x-environment: &environment
IWFREPO: 'true'
IWFREPO_HTTPS: 'false'
IWFREPO_HOST: '192.168.18.14'
IWFREPO_PORT: '8087'
IWFREPO_INTERVAL: '300'
Then, deploy with:
docker-compose up
Edit docker-compose.yaml and disable iwf repository support.
x-environment: &environment
IWFREPO: 'false'
Deploy with:
docker-compose up
In the following table we report all the Redis database indexes used in MSO-LO application and the relative purpose.
Index | Purpose |
---|---|
0 | Celery Background Task |
1 | NS last operationState |
2 | OSM token cache |
You can test the app with:
curl --request GET --url http://127.0.0.1:80/nfvo
To remove the containers and volumes, use:
docker-compose down --remove-orphans --volumes
There are two main branches:
master
: used for software releases, push not alloweddevelopment
: used for daily work on codeTo add a new feature, we follow this pattern:
git checkout development
git checkout -b onap_driver
git checkout development; git merge --no-ff onap_driver;
Note: The --no-ff
option is useful to create a commit dedicated to the merge
and record the existence of the feature branch.
To add it to your git configuration so it is used by default (locally for this
repo), use:
git config --add merge.ff false
For dependencies we use Pipenv.
Copy the mock files (needed for a correct build):
cd adaptation-layer/seed
cp nfvo_mock.json nfvo.json
cp nfvo_credentials_mock.json nfvo_credentials.json
cp rano_mock.json rano.json
cp rano_credentials_mock.json rano_credentials.json
To setup the environment use:
git checkout development
cd adaptation_layer
pipenv install --dev
# Create database with mock data
export FLASK_APP=.
export FLASK_ENV=development
pipenv run flask db upgrade
pipenv run flask seed
# Run the flask app
pipenv run flask run
Some features like notifications need celery and redis. Simply setup a docker container with redis and run a celery worker.
docker run -p 6379:6379 --name some-redis -d redis
export REDIS_HOST=localhost
celery -A tasks worker -B --loglevel=info
A docker-compose.dev.yml is also available. Remember to copy the mock files as said above for a correct build. Deploy with:
docker-compose -f docker-compose.dev.yml up --build
Please, always use pipenv
to add/remove dependencies:
pipenv install <package-name>
pipenv uninstall <package-name>
If everything works with the new dependencies, run pipenv lock
and commit
both Pipfile
and Pipfile.lock
.
To create a new NFVO/RANO driver, it is enough to create a new python module
extending the Driver
interface.
For example, let's create adaptation_layer/driver/onap.py
:
from .interface import Driver
class ONAP(Driver):
pass
Now you can start implementing the methods contained in the Driver interface. Your IDE should suggest you to create stubs for methods to be overriden.
To enable a newly created driver, edit manager.py.
The get_driver()
method is simply a switch that returns an instance of the
proper driver.
In order to test our software against an NBI, we need to mock it.
For this purpose, we use Prism.
You can control the kind of HTTP response returned by Prism by modifying the request URL.
Example: /nfvo/nfvo_osm1/ns?__code=200
To add unit tests for a driver, create a new python file in adaptation_layer/tests
.
Please refer to test_osm.py for examples.
When throwing exceptions, please use the ones defined in error_handler.py. This allows the application to correctly create the corresponding response and status code.
Unit tests can be executed by using Docker Compose files. The following unit tests are currently available:
Example:
docker-compose --file docker-compose.test-osm.yml --project-name test-osm build
docker-compose --file docker-compose.test-osm.yml --project-name test-osm up --abort-on-container-exit --exit-code-from test-osm
Note: the --project-name
parameter is necessary to distinguish test executions.
The file will run two containers:
Unit tests execution for a new driver can be added by copying and modifying docker-compose.test-osm.yml.
Integration tests are run with Robot Framework. Please refer to the specific README.