Skip to main content

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.8 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 py38

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

v14.6.0

There is no 14.5.0 release. The release pipeline had already staged a 14.5.0 artifact built before any of the changes below, and the index it stages to rejects re-uploads of a version that exists, so the version was skipped.

Added

  • Acm class for the CLAMP automation composition management runtime API (commission, prime, instantiate, deploy and the matching teardown calls).
  • Policy.get_policy_status for the PAP policy deployment status endpoint.
  • CLAMP_ACM_URL setting pointing at the in-cluster runtime-acm service.

Changed

  • Every function and method in the package now carries a return annotation, so type checkers no longer skip their bodies. This is an annotation-only change with one exception: OnapService.get_guis is declared as returning GuiList, the type all of its overrides already returned.

Fixed

  • DeletionRequest.send_request and its VfModuleDeletionRequest and NetworkDeletionRequest overrides declared return types that were wrong: Deletion and VfModuleDeletion do not exist at all, and the network variant claimed VnfDeletionRequest. Each now names the class it actually returns. Type hints only; the objects returned are unchanged.
  • 48 docstrings documented a parameter or return type that disagreed with the annotation, including [type] placeholders on the six update_informations_from_sdc* methods and platform/project in onapsdk.so.instantiation, which take a name string rather than the Platform/Project object the docstrings named.
  • onapsdk.so.instantiation could not be imported before another onapsdk module: an import cycle through the eager re-exports in onapsdk.aai.business raised ImportError. The A&AI business re-exports are now resolved lazily; the package exposes the same names as before.

v14.4.0

Added

  • add opentelemetry @tracer decorator to Service.distributions method

Removed

  • remove dependency on cryptography and pyOpenSSL since they are not actually used in the project

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

Metadata

Release files for onapsdk 14.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for onapsdk 14.6.0
File Interpreter ABI Platform
onapsdk-14.6.0-py3-none-any.whl Python 3 none any Details

Release files / onapsdk-14.6.0-py3-none-any.whl

Download URL onapsdk-14.6.0-py3-none-any.whl
Size 300.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c900ca89bdd3e98ad803910a3ff744ee63785b33c175a3d6ab0eebc7a343c8fc
BLAKE2b-256 checksum
How to use checksums
515bb5c9e39c29a9492617ea741311a33d1f39f01613b7496b1ff96b3eb0e4f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.6

Release history Release notifications | RSS feed

This release

14.6.0 This release

1 release file

14.4.0

1 release file

14.3.0

1 release file

14.2.0

1 release file

14.1.0

1 release file

14.0.0

1 release file

13.3.0

1 release file

13.2.0

1 release file

13.1.1

1 release file

13.1.0

1 release file

13.0.8

1 release file

13.0.7

1 release file

13.0.6

1 release file

13.0.5

1 release file

13.0.4

1 release file

13.0.3

1 release file

13.0.2

1 release file

13.0.1

1 release file

13.0.0

1 release file

12.9.0

1 release file

12.8.0

2 release files

12.7.3

1 release file

12.7.2

1 release file

12.7.1

1 release file

12.7.0

1 release file

12.6.1

1 release file

12.6.0

1 release file

12.5.0

1 release file

12.4.0

2 release files

12.3.2

1 release file

12.3.1

2 release files

12.3.0

2 release files

12.2.0

2 release files

12.0.0

2 release files

11.0.0

2 release files

10.7.0

2 release files

10.6.0

2 release files

10.5.0

2 release files

10.4.3

2 release files

10.4.2

2 release files

10.4.1

2 release files

10.3.2

2 release files

10.3.1

2 release files

10.3.0

2 release files

10.2.0

2 release files

10.0.1

2 release files

10.0.0

2 release files

9.6.0

2 release files

9.5.1

2 release files

9.5.0

2 release files

9.4.0

2 release files

9.3.0

2 release files

9.2.2

2 release files

9.2.1

2 release files

9.2.0

2 release files

9.1.1

2 release files

9.1.0

2 release files

9.0.0

2 release files

8.7.0

2 release files

8.6.0

2 release files

8.5.0

2 release files

8.4.2

2 release files

8.4.1

2 release files

8.4.0

2 release files

8.3.1

2 release files

8.3.0

2 release files

8.2.0

2 release files

8.1.2

2 release files

8.1.1

2 release files

8.1.0

2 release files

8.0.0

2 release files

7.13.0

2 release files

7.10.2

2 release files

7.10.1

2 release files

7.10.0

2 release files

7.9.1

2 release files

7.9.0

2 release files

7.8.0

2 release files

7.7.2

2 release files

7.7.1

2 release files

7.7.0

2 release files

7.6.0

2 release files

7.5.1

2 release files

7.5.0

2 release files

7.4.0

2 release files

7.3.0

2 release files

7.2.0

2 release files

7.1.0

2 release files

7.0.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page