https://github.com/nokia/network-as-code-py
https://github.com/nokia/network-as-code-py
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nokia/network-as-code-py
- Owner: nokia
- License: apache-2.0
- Created: 2024-04-03T15:01:36.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-11T17:54:18.000Z (over 1 year ago)
- Last Synced: 2024-11-11T18:38:27.573Z (over 1 year ago)
- Language: Python
- Size: 32.7 MB
- Stars: 4
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# NaC-py - Python SDK for controlling 5G network through code
This repository contains the Python library for Nokia's Network as Code platform,
allowing Python programs to easily call network APIs to query information or to
manage mobile network elements.
## What is Network as Code?
Network as Code is a network API aggregator platform developed by Nokia to expose
network capabilities of mobile networks to applications. It provides numerous
capabilities ranging from quality-of-service to network-based location services
and analytics.
You can find more information over [at the Nokia home page](https://www.nokia.com/networks/network-as-code/)
or by going directly to the developer portal: https://developer.networkascode.nokia.io/
## Getting started
You can find a full Getting Started guide on the developer portal: https://developer.networkascode.nokia.io/docs/getting-started
If you just want to install the Python library, you can install it with Pip:
```bash
pip install network_as_code
```
Do note that use of Network as Code capabilities requires an API token to be provided:
```python
import network_as_code as nac
client = nac.NetworkAsCodeClient(
token="",
)
```
You can get your API tokens by registering on the developer portal and accessing them on
the developer dashboard.
## Documentation and Examples
Full documentation is available on the developer portal: https://developer.networkascode.nokia.io/docs
We also provide some basic usage examples in the [examples](./examples) directory.
## License
The Network as Code Python SDK is open-source software available under the Apache 2.0 license.
## Development
### Commands
- `uv sync` - install project dependencies
- `uv run pytest` - run unit tests against mocks
- `uv run pytest integration_tests` - run integration tests against development APIs
### Architecture
This project is structured into `models`, `api` and `namespaces`
modules. The `models` and `namespaces` modules represent the public
API of the SDK and provide abstractions that allow data to be queried
and modified on the Network as Code platform. The `api` module implements
the communication layer that will actually talk to the NaC web APIs and
handle transmission and receipt of data to and from the platform.
The basic design principle is that functionality should be discoverable
and logically organized. To achieve that, most actions are carried out
through the `NetworkAsCodeClient` object, which provides access to the
namespaces in the `namespaces` module. These namespaces typically provide
ways to query and create different types of data objects in the NaC
platform. The data objects themselves have representations in the `models`
module, and are enriched with methods that operate on the individual
data object.
New features typically require modifications to at least the `models`
and `api` modules. New namespaces are introduced as required, typically
when a new API product is launched. However, the namespaces are intended
to be an organizational tool and as such should be used whenever a concept
falls into a new kind of category and to avoid clutter.
### Development process
This project is developed using principles from Test-Driven Development.
This means that for new bugs fixed and features implemented, there should
be matching test cases written.
Main chunk of tests are located under `tests` and are run against
mocks and intended to work offline and without need to actually
connect to an external system. We also have `integration-tests` which
use a development version of the APIs to track compatibility. Both
test suites are run in CI/CD and failures are considered blocking.
Test cases should be added to as part of regular development activity and
old test cases should be kept up-to-date.
New features and changes to old ones should also be documented as soon
as possible. This means that developers ought to be in contact with the
technical writers whenever a change is introduced. It is also recommended
to add an example or update old examples in the `examples` folder to help
communicate functionality and changes to the documentation writers. If
no technical writer is present then the responsibility of writing documentation
falls on the developers. Developers also need to be able to provide input
to the technical writers to ensure accurate and high-quality documentation.