Skip to main content

SDK to use ONAP Programatically

Project description

Python ONAP SDK

an SDK to use ONAP programmatically with Python code

Maintainability Code Coverage Documentation Status

Description

ONAP SDK is a client library written in Python for building applications to work with ONAP. The project aims to provide a consistent and complete set of interactions with ONAP’s many services, along with complete documentation, examples, and tools.

Using few python commands, you should be able to onboard, distribute models, instantiate xNFs and many others. Check doc site to find out all the features.

Installation

You can install it using pip tool

$ pip install onapsdk

Development

Before you start, ensure you have Python installation in version 3.7 or higher. Please see the official Python documentation in case you have to upgrade or install certain Python version.

Setting up development environment

Clone the project. Inside the project folder create a new virtual environment and activate it:

$ python -m venv env
$ source env/bin/activate

On Windows, activate by executing the following:

$ .\env\Scripts\activate

When your virtual environment is ready, install required dependencies:

$ pip install -r requirements.txt

Developing

To use library functions directly from the source code, execute the following to point to the source folder in PYTHONPATH variable and run the interpreter:

$ PYTHONPATH=$PYTHONPATH:src/ python

On Windows:

$ $env:PYTHONPATH='src\';python

Verify that packages are accessible:

>>> import onapsdk

You can then start working with library functions as needed.

Testing

Install tox:

$ pip install tox

To run all unit test, lint and docstyle checks, inside the project folder simply execute tox:

$ tox

Please note that the above runs unit tests on all major versions of Python available on your OS (3.7, 3.8, 3.9). To limit execution to only specific version of Python interpreter, use the following example:

$ tox -e py37

Integration testing

It is possible to run integration tests using mock-servers project. Make sure Docker Compose is available on your system. Install required dependencies:

$ pip install pytest mock

Go to integration_tests/ directory and execute:

$ docker-compose up

Please note that docker-compose attempts to create subnet 172.20.0.0/24, so it can not be run if the scope is already allocated. Also, containers are not reachable by their IP addresses on Windows host since Docker for Windows does not support bridged network interface for Linux containers.

Once containers are running, execute the following in the project's directory:

$ PYTHONPATH=$PYTHONPATH:integration_tests/:src/ ONAP_PYTHON_SDK_SETTINGS="local_urls" pytest -c /dev/null --verbose --junitxml=pytest-integration.xml integration_tests

Please make sure all the test are passing before creating merge request.

Python ONAP SDK Changelog

v1.0

Documentation

Main new features:

  • Onboard a simple service via SDC
  • Instantiate a simple service via SO using GR API
  • Instantiate a simple service via NBI
  • create business objects in AAI

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onapsdk-10.0.1.tar.gz (121.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onapsdk-10.0.1-py3-none-any.whl (187.2 kB view details)

Uploaded Python 3

File details

Details for the file onapsdk-10.0.1.tar.gz.

File metadata

  • Download URL: onapsdk-10.0.1.tar.gz
  • Upload date:
  • Size: 121.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.8.3 requests/2.28.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.8.13

File hashes

Hashes for onapsdk-10.0.1.tar.gz
Algorithm Hash digest
SHA256 14011f29b8f14b1c24d4cf5c525fbe714bc1ed750959144f88423dcb774d1e16
MD5 edc71c529e3eb08d91fdd36f066ca696
BLAKE2b-256 12c3945633d174c77059dc2f14ed9c8ac85365d94fd83743c8d99e36280aa6b0

See more details on using hashes here.

File details

Details for the file onapsdk-10.0.1-py3-none-any.whl.

File metadata

  • Download URL: onapsdk-10.0.1-py3-none-any.whl
  • Upload date:
  • Size: 187.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.8.3 requests/2.28.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.8.13

File hashes

Hashes for onapsdk-10.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11fdebdec2af0f7b2d2e78bc582557d5a5f11098aaed7810d02caadd35d7b6c9
MD5 8621b6d09763b84b9e9d3673b48e627a
BLAKE2b-256 b43118253c36279212e514bc5d4bc4eecfa8eef0c8e42ed63e9cfdaaef62f6ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page