Nokia SR OS pySROS Plugins for Nornir
Project description
nornir_nokia
Nokia SR OS pySROS Plugins for Nornir - supports both YANG model-driven and MD-CLI interactions with Nokia BNG devices.
Installation
pip install nornir_nokia
Features
- Connection Plugin: Manages pySROS NETCONF connections to Nokia SR OS devices
- CLI Connection Plugin: Manages Netmiko CLI SSH sessions via Nornir
- YANG Configuration: Configure devices using YANG model-driven paths (
candidate.set) - CLI Configuration: Configure devices using MD-CLI commands via Netmiko
- Get Data: Retrieve operational/configuration data via YANG paths or CLI commands
- Commit Operations: commit, commit confirm (with timer), compare, discard, rollback (cancel), lock/unlock
Usage
Inventory (hosts.yaml)
nokia_bng_01:
hostname: 192.168.1.1
username: admin
password: admin
port: 830
platform: nokia_sros
connection_options:
nornir_nokia:
extras:
yang_directory: ./YANG
hostkey_verify: false
timeout: 300
nornir_nokia_cli:
extras:
cli_port: 22
timeout: 90
fast_cli: false
YANG Configuration
from nornir import InitNornir
from nornir_nokia.tasks import nokia_yang_config, nokia_commit
nr = InitNornir(config_file="config.yaml")
# Set configuration via YANG
result = nr.run(
task=nokia_yang_config,
path='/nokia-conf:configure/system/name',
value='my-router',
commit=False,
)
# Compare candidate vs baseline
result = nr.run(task=nokia_commit, action="compare", output_format="md-cli")
# Commit with confirmation timer
result = nr.run(task=nokia_commit, action="commit", timer=60)
# Confirm commit (accept)
result = nr.run(task=nokia_commit, action="commit")
# Rollback (cancel confirmed commit)
result = nr.run(task=nokia_commit, action="rollback")
CLI Configuration
from nornir_nokia.tasks import nokia_cli_config, nokia_get
# Configure via MD-CLI
result = nr.run(
task=nokia_cli_config,
commands=[
'/configure system name "my-router"',
'/configure router interface "demo1" ipv4 primary address 192.168.1.1 prefix-length 24',
],
mode="commit",
comment="deploy via nornir",
)
# Compare candidate changes without committing
result = nr.run(
task=nokia_cli_config,
config='''
/configure system location "nornir-compare"
''',
mode="compare",
)
# Confirmed commit with timer
result = nr.run(
task=nokia_cli_config,
commands=['/configure system contact "nornir-confirmed"'],
mode="commit",
timer=120,
)
# Get operational data via CLI
result = nr.run(task=nokia_get, command='show version')
# Get data via YANG path
result = nr.run(task=nokia_get, path='/nokia-state:state/system/oper-name')
License
MIT
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
nornir_nokia-0.1.1.tar.gz
(11.5 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 nornir_nokia-0.1.1.tar.gz.
File metadata
- Download URL: nornir_nokia-0.1.1.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed28f6ede92cfad77f7aec691aef89d2f9272e85aecdd0b89271f57049b263a0
|
|
| MD5 |
51a255b9e9c45bf354f2a916edc6dde1
|
|
| BLAKE2b-256 |
fc5a1023945af881d3b2f56db86cb585ee3bbfc9159e9a83abed772f45596978
|
File details
Details for the file nornir_nokia-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nornir_nokia-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea35ed3cb140256b466843580c4a051e2304dcb3d8882f4b5907601ca288b30b
|
|
| MD5 |
942852f42b247383653f520ad6addfdc
|
|
| BLAKE2b-256 |
746c9d189bdd5d4502d51b02eb8729d1ce6fe7696e453da73018b13c98fc1117
|