aiognmi 0.1.1

Creator: codyrutscher

Last updated:

Add to Cart

Description:

aiognmi 0.1.1

aiogNMI
About
This Python library provides an efficient and lightweight gNMI client implementation that leverages asynchronous approach.
Supported RPCs:

Capabilities
Get
Set
Subscribe (under development)

Tested on:

Arista EOS
Nokia SR OS

Repository contains protobuf files from gNMI repo and based on gNMI release v0.10.0.
Early gNMI version should work too, I've tested with 0.7.0 and it works well.

NOTE: At this moment supporting of the secure connections (with encryption or certificate) is in alpha version. You can use them, but I don't guarantee stable work.

Install
Install with pip:
pip install aiognmi

Examples
Capabilities RPC
import asyncio

from aiognmi import AsyncgNMIClient


async def main():
async with AsyncgNMIClient(host="test-1", port=6030, username="admin", password="admin", insecure=True) as client:
resp = await client.get_capabilities()

print(resp.result)


if __name__ == "__main__":
asyncio.run(main())

Get RPC
import asyncio

from aiognmi import AsyncgNMIClient


async def main():
async with AsyncgNMIClient(host="test-1", port=6030, username="admin", password="admin", insecure=True) as client:
resp = await client.get(
paths=[
"/interfaces/interface[name=Management0]",
]
)

print(resp.result)


if __name__ == "__main__":
asyncio.run(main())

Set RPC
import asyncio

from aiognmi import AsyncgNMIClient


async def main():
async with AsyncgNMIClient(host="test-1", port=6030, username="admin", password="admin", insecure=True) as client:
resp = await client.set(
update=[
{"path": "/interfaces/interface[name=Management0]/config", "data": {"description": "gnmi update test"}}
]
)

print(resp.result)


if __name__ == "__main__":
asyncio.run(main())

Credits
My work is inspired by these people:

Anton Karneliuk and his pyGNMI library
Carl Montanari and his scrapli library

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.