Skip to main content

Async, efficient and lightweight gNMI client written in Python.

Project description

Ruff License: MIT CI

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:

  1. Anton Karneliuk and his pyGNMI library
  2. Carl Montanari and his scrapli library

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiognmi-0.1.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

aiognmi-0.1.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file aiognmi-0.1.1.tar.gz.

File metadata

  • Download URL: aiognmi-0.1.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.14

File hashes

Hashes for aiognmi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 080a3b8f8072688c8499d639a9302500a741fd78418385f9bb35e6f8858b26d1
MD5 d847da9c3ef2a176e7937e353ddeb5fb
BLAKE2b-256 b32c46212b7b64eece8c58419c83453139e175ae974fc7dcc87c948c367dd788

See more details on using hashes here.

File details

Details for the file aiognmi-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: aiognmi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.14

File hashes

Hashes for aiognmi-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 be6bc87d20f607f80a69d3616f346d903e45199f538d1273700fb5ddef810977
MD5 b41c03d615d1992a4981a6790f6fca4d
BLAKE2b-256 09fbf7e32c0140c3a5f3420f7fede984e00c83ef80455f50088b9887740a8247

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page