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.2.tar.gz
(11.6 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.2.tar.gz.
File metadata
- Download URL: nornir_nokia-0.1.2.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44d6282966ea592cd3981535154eea7ecce0b2e1676db5f789d37e1178bd3a5c
|
|
| MD5 |
aea918aa2dc46774be1a84912e272ed3
|
|
| BLAKE2b-256 |
951ac2e3d9c70edc14c9dbf920ea14ec52711f51e92d2668eb03a0fcd79e2873
|
File details
Details for the file nornir_nokia-0.1.2-py3-none-any.whl.
File metadata
- Download URL: nornir_nokia-0.1.2-py3-none-any.whl
- Upload date:
- Size: 12.4 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 |
f50d8e2f06598f1fb4a7876ac234d766fc64fc4f30df3c8b4f8cdecb0053f103
|
|
| MD5 |
0e1e96ed43387454032e48ef8d96cc56
|
|
| BLAKE2b-256 |
1f2ab3dc5a618cc21601236e16f6ef9c8bf0b7656cbae0f28464e47987ba39d4
|