A Python client library for interacting with the Cisco NSO RESTCONF API
Project description
cisco-nso-restconf
Overview
This Python library provides an interface for interacting with the Cisco Network Services Orchestrator (NSO) RESTCONF API.
Features
- RESTCONF API Access: Use the NSORestconfClient class to make raw GET, POST, & DELETE requests to any RESTCONF
/dataresource. - Utility Classes: Use pre-built helper classes, such as the Devices class, or Query class, to simplify common operations, like fetching all device NED ID's.
Requirements
- NSO RESTCONF Configuration
- To use this library, RESTCONF must be enabled in NSO. Please refer to the documentation specific to the NSO version being used to determine how to enable RESTCONF in NSO.
Installation
You can install the library using pip:
pip install cisco-nso-restconf
Client Class
Use the NSORestconfClient class to interact with the NSO RESTCONF API /data resource
Methods Supported
- GET, POST, DELETE
Utility Classes
To make the process easier, the library also provides utility classes for specific tasks. For example, the Devices class simplifies interaction with tailf-ncs:devices RESTCONF resources.
Available Utility Classes
| Class | Description |
|---|---|
| Devices | Interact with the NSO tailf-ncs:devices resource |
| Query | Interact with the NSO tailf-ncs:query resource |
Closing Sessions
When using the NSORestconfClient, it’s important to close the session when you’re done to free up resources. You can do this using the close() method, as shown in the examples above.
Examples
There are a number of examples provided for utilizing the Client classes and various Helper classes, such as the Devices class. The examples are intended to showcase basic use cases/workflows for achieving a specific function in NSO, such as retrieving NED ID's, device groups, life cycle of a VLAN resource, life cycle of a service, and so on.
Running Examples
To run the examples, you'll need to install the development dependencies which include the rich library for enhanced terminal output. Use UV to install these dependencies:
uv sync
This will install all required dependencies, including those needed for the examples. Without installing the development dependencies, the examples that use the rich library for output formatting will not work.
Contributing
We welcome contributions! Feel free to open issues or submit pull requests. For development, we recommend using UV to manage dependencies and packaging.
uv sync
License
This project is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cisco_nso_restconf-1.0.5.tar.gz.
File metadata
- Download URL: cisco_nso_restconf-1.0.5.tar.gz
- Upload date:
- Size: 57.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.26
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8603780c0a729282a50aa40419bc7c27b3bb3a8f85e7a512723d63ede8bd5d8
|
|
| MD5 |
488721450b00b1efa1fcd4cfcc3c1c4f
|
|
| BLAKE2b-256 |
40481250b98e2c81f10c3e72a438d7e91e5c2af5b45128ec5a48593a8d3e14d5
|
File details
Details for the file cisco_nso_restconf-1.0.5-py3-none-any.whl.
File metadata
- Download URL: cisco_nso_restconf-1.0.5-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.26
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f36c97ca8b8f542f2aeda58459fdb49e37ee73d3b2a223ad1f8c4e6d8d1df87
|
|
| MD5 |
cfca002a890b318ebeb5daced205237f
|
|
| BLAKE2b-256 |
cf7d5297266fb2eee76c4797d27cfc5d59f74dd7e98ae2b55da4e44f0ae46cef
|