Add your description here
Project description
Python NSO Library
Thin wrapper around RestConf designed to interact with NSO.
Key Features:
- Detect errors raising meaningful exceptions
- Parameter support in URL to avoid URL Encoding mistakes
- Support for generating and executing YANG Patches
- Handling of dry-run responses
Usage
Installing
uv add python-nso-client
Writing code with nso_client
from nso_client import NSOClient
from httpx2 import BasicAuth
nso = NSOClient(
"https://localhost",
auth=BasicAuth("acct", "secret")
)
# Fetching data
resp = nso.get("/tailf-ncs:services/bb:backbone", content="config")
for bb in resp["bb:backbone"]:
print(bb)
# Create objects
resp = nso.put(
"/tailf-ncs:services/bb:backbone={}",
"my-bb-1",
payload={
"bb:backbone": [
{
"name": "my-bb-1",
"links": [
{"device": "xr0", "interface": "TenGigE0/0/0"},
{"device": "xr1", "interface": "TenGigE0/0/1"},
],
"metric": 500,
"admin-state": "in-service",
}
]
},
)
# Using yang-patch to modify multiple areas in the same transaction
patch = nso.yang_patch("/tailf-ncs:services")
patch.merge("/bb:backbone={}", "my-bb-1", value=...)
patch.merge("/bb:backbone={}", "my-bb-2", value=...)
patch.delete("/bb:backbone={}", "my-bb-3")
resp = patch.commit(dry_run="cli")
print(resp.changes)
patch.commit()
# Error handling
try:
nso.delete("/tailf-ncs:services/bb:backbone={}", "does-not-exist")
except NotFoundError as exc:
print("Backbone already deleted", exc)
# Fetching results in a None, not an exception
resp = nso.get("/tailf-ncs:services/bb:backbone={}", "does-not-exist")
assert resp is None
Developing
# Build
uv build
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
python_nso_client-0.2.0.tar.gz
(35.9 kB
view details)
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 python_nso_client-0.2.0.tar.gz.
File metadata
- Download URL: python_nso_client-0.2.0.tar.gz
- Upload date:
- Size: 35.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.5","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b59c28b2965dc2b1e623a6a7521a6bde8d1a20122e7d6fa50f7fbf098bbb1c70
|
|
| MD5 |
056a65dc5680c6d9c55567ece7b0af59
|
|
| BLAKE2b-256 |
3b2c7254357a0d55a231ce37780f4ad911eaf433d52021b19a500c110184d9ae
|
File details
Details for the file python_nso_client-0.2.0-py3-none-any.whl.
File metadata
- Download URL: python_nso_client-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.5","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fbb0b4092dd552bce5787bcba0a7567ec2e08a6e8ac5b5c6892b57006fe8d16
|
|
| MD5 |
29a08f61534d1a5eba7069e66f168cb1
|
|
| BLAKE2b-256 |
cc50974b286e1c5a0f687dbddf4bcd03914e1c62b660d7870c41367d6e8e973d
|