This Python library provides an interface for interacting with the Cisco Network Services Orchestrator (NSO) RESTCONF API.
- 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.
- 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.
You can install the library using pip:
pip install cisco-nso-restconfUse the NSORestconfClient class to interact with the NSO RESTCONF API /data resource
- GET, POST, DELETE
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.
| Class | Description |
|---|---|
| Devices | Interact with the NSO tailf-ncs:devices resource |
| Query | Interact with the NSO tailf-ncs:query resource |
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.
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.
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 syncThis 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.
We welcome contributions! Feel free to open issues or submit pull requests. For development, we recommend using UV to manage dependencies and packaging.
uv syncThis project is licensed under the MIT License.