Skip to main content

Network Device information Discovery via SNMP

Project description

Netty SNMP

PyPi version Python Versions License Test Ruff

Network Device information Discovery via SNMP

Netty_snmp is a flexible,powerful,high performance tool for network device information collection. It will recognize network device's manufacture and platform(netmiko driver) automatically through SNMP SysObjectId and collect a lot of network basic information with friendly output format and exceptions traceback.

Inspirations of SNMP and why not command line tools(CLI):

CLI output is un-structure data, we need use regex/textfsm liked tools to extract the information from network device output. It's very painful to maintain the string-based regex code and very hard to extend. SNMP is fast, stable to get and all data is structured which is easy to handle by code, also it's much easier to maintain the codebase, some of items is generic for all network manufacturers, such as interface, hostname, lldp neighbors. One time coding and support all vendors, fancy, right? So, personally use snmp to collect basic information of network device is a better choice than CLI.

Installation Guide

support python version: >= py3.11

pip3 install netty-snmp

Examples

  1. scanning a prefix via SNMPv2 and discovery all network device items
from netty_snmp import DispatchSnmpFactory, consts

dis = DispatchSnmpFactory(
    prefix="192.168.0.0/24",
    port=161,
    version=consts.SnmpVersion.v2c, # via snmp v2c
    community="public",
    max_workers=16, # concurrency for collection task, run in 16 threads
)
print(dis.discovery())
  1. scanning a ip address via SNMPv2 and discovery partial items, in this example: only hostname and interfaces will be collected.
dis = DispatchSnmpFactory(
    prefix="192.168.0.0/32",
    port=161,
    version=consts.SnmpVersion.v2c, # via snmp v2c
    community="public",
    max_workers=16, # concurrency for collection task, run in 16 threads
)
print(dis.discovery(["hostname", "interfaces"]))

3. scanning via SNMPv3
```python
DispatchSnmpFactory(
    prefix="192.168.0.0/24",
    port=161,
    version=consts.SnmpVersion.v3,
    v3_params=SnmpV3Params(
        security_username="admin",
        security_level="authNoPriv",
        auth_protocol="md5",
        auth_password="admin",
        context_engine_id="0000000000000000",
        privacy_protocol="des",
        privacy_password="admin",
    ),
    max_workers=16,
)
print(dis.discovery())

Main Support Items

  • Hostname: the hostname of network device

  • System Description: the textual information of the system: include model name, software version, hardware version and etc.

  • Uptime: network device uptime

  • ChassisID: the mac address of chassis, the unique identifier of chassis

  • Interfaces: interface full information

    • Interface Index
    • Interface Name
    • Interface Description
    • Interface Mtu
    • Interface Speed: physical speed
    • Interface High Speed: negotiation speed
    • Interface Type
    • Interface Mac Address
    • Interface Admin status
    • Interface Operational Status
    • Interface IP Addresses: (L3 Interface)
    • Interface Port Mode: access/trunk/hybrid ...
  • LLDP Neighbors: lldp information will local and remote connection info

    • Local Chassis Id: the unique identifier mac address of chassis
    • Local Hostname: the hostname of local device
    • Local Interface Name
    • Local Interface Description
    • Remote Chassis Id: the unique identifier mac address of lldp neighbor chassis
    • Remote Hostname: the hostname of lldp neighbor
    • Remote Interface Name: the interface name of lldp neighbor
    • Remote interface Description: the interface description of lldp neighbor
  • Entities

    • Entity Physical Description: the mode information of entity
    • Entity Physical Name: the name of entity
    • Entity Software revision: software version
    • Entity Serial Number: the serial number of entity

waiting for implement

  • VLANS
  • StackWise
  • Prefixes
  • ARP Table
  • Mac Address Table
  • Routing table

Main support manufactures

well tested

  • Cisco
  • Huawei
  • Aruba

basic tested

  • H3C
  • Ruijie
  • Arista
  • Fortinet
  • PaloAlto
  • Juniper

Development Guide

  1. install rye for python project management
  2. execute rye sync to install dependencies
  3. execute pre-commit install for lint and pytest hooks
  4. perform you code changes and execute pre-commit to do static code check and unit test.
  5. push changes to the codebase.

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

netty_snmp-0.1.3.tar.gz (81.6 kB view details)

Uploaded Source

Built Distribution

netty_snmp-0.1.3-py3-none-any.whl (87.2 kB view details)

Uploaded Python 3

File details

Details for the file netty_snmp-0.1.3.tar.gz.

File metadata

  • Download URL: netty_snmp-0.1.3.tar.gz
  • Upload date:
  • Size: 81.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.2

File hashes

Hashes for netty_snmp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6e78f7b3af49f8d0005d680591b7293b94692c9981783c611fef8629df0a82d4
MD5 5ebcf64909781a27f4a09d3493786a26
BLAKE2b-256 22808c9b6efa4b059507397fdf884fdb33d1d5e4bc1827f6472e17693a51715b

See more details on using hashes here.

File details

Details for the file netty_snmp-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: netty_snmp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 87.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.2

File hashes

Hashes for netty_snmp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bb765371f89f737bc985d05d72ca04d4907bff18d4660918e65ed896bb334e5d
MD5 1ef6be8b47240379ea19b62cb84c1072
BLAKE2b-256 d32f7797474caff933935f25dac7122c8027fbb5304d6489f05607e37943248a

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