netty-snmp


Namenetty-snmp JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryNetwork Device information Discovery via SNMP
upload_time2024-10-11 08:57:12
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords lldp netmiko network-automation network-device network-discovery snmp textfsm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Netty SNMP

[![PyPi version](https://img.shields.io/pypi/v/netty_snmp.svg)](https://pypi.python.org/pypi/netty-snmp/)
![Python Versions](https://img.shields.io/pypi/pyversions/netty-snmp)
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
![Test](https://img.shields.io/github/actions/workflow/status/netty-community/netty-snmp/test-suite.yaml)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json)](https://github.com/charliermarsh/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
```python
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())
```
2. scanning a ip address via SNMPv2 and discovery partial items, in this example: only hostname and interfaces will be collected.
```python
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](https://rye.astral.sh/guide/installation/) 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.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "netty-snmp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "lldp, netmiko, network-automation, network-device, network-discovery, snmp, textfsm",
    "author": null,
    "author_email": "jeffry <wangxin.jeffry@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/22/80/8c9b6efa4b059507397fdf884fdb33d1d5e4bc1827f6472e17693a51715b/netty_snmp-0.1.3.tar.gz",
    "platform": null,
    "description": "# Netty SNMP\n\n[![PyPi version](https://img.shields.io/pypi/v/netty_snmp.svg)](https://pypi.python.org/pypi/netty-snmp/)\n![Python Versions](https://img.shields.io/pypi/pyversions/netty-snmp)\n[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n![Test](https://img.shields.io/github/actions/workflow/status/netty-community/netty-snmp/test-suite.yaml)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json)](https://github.com/charliermarsh/ruff)\n\n# Network Device information Discovery via SNMP\n\nNetty_snmp is a flexible,powerful,high performance tool for network device information collection.\nIt will recognize network device's manufacture and platform(netmiko driver) automatically through\nSNMP `SysObjectId` and collect a lot of network basic information with friendly output format and\nexceptions traceback.\n\nInspirations of SNMP and why not command line tools(CLI):\n\nCLI output is un-structure data, we need use regex/textfsm liked tools to extract the information\nfrom network device output. It's very painful to maintain the string-based regex code and very hard to\nextend. SNMP is fast, stable to get and all data is structured which is easy to handle by code, also it's\nmuch easier to maintain the codebase, some of items is generic for all network manufacturers, such\nas interface, hostname, lldp neighbors. One time coding and support all vendors, fancy, right?\nSo, personally use snmp to collect basic information of network device is a better choice than CLI.\n\n\n## Installation Guide\nsupport python version: >= py3.11\n```\npip3 install netty-snmp\n```\n\n## Examples\n1. scanning a prefix via SNMPv2 and discovery all network device items\n```python\nfrom netty_snmp import DispatchSnmpFactory, consts\n\ndis = DispatchSnmpFactory(\n    prefix=\"192.168.0.0/24\",\n    port=161,\n    version=consts.SnmpVersion.v2c, # via snmp v2c\n    community=\"public\",\n    max_workers=16, # concurrency for collection task, run in 16 threads\n)\nprint(dis.discovery())\n```\n2. scanning a ip address via SNMPv2 and discovery partial items, in this example: only hostname and interfaces will be collected.\n```python\ndis = DispatchSnmpFactory(\n    prefix=\"192.168.0.0/32\",\n    port=161,\n    version=consts.SnmpVersion.v2c, # via snmp v2c\n    community=\"public\",\n    max_workers=16, # concurrency for collection task, run in 16 threads\n)\nprint(dis.discovery([\"hostname\", \"interfaces\"]))\n\n3. scanning via SNMPv3\n```python\nDispatchSnmpFactory(\n    prefix=\"192.168.0.0/24\",\n    port=161,\n    version=consts.SnmpVersion.v3,\n    v3_params=SnmpV3Params(\n        security_username=\"admin\",\n        security_level=\"authNoPriv\",\n        auth_protocol=\"md5\",\n        auth_password=\"admin\",\n        context_engine_id=\"0000000000000000\",\n        privacy_protocol=\"des\",\n        privacy_password=\"admin\",\n    ),\n    max_workers=16,\n)\nprint(dis.discovery())\n```\n---\n## Main Support Items\n- **Hostname**: the hostname of network device\n- **System Description**: the textual information of the system: include model name, software version, hardware version and etc.\n- **Uptime**: network device uptime\n- **ChassisID**: the mac address of chassis, the unique identifier of chassis\n- **Interfaces**: interface full information\n  - Interface Index\n  - Interface Name\n  - Interface Description\n  - Interface Mtu\n  - Interface Speed: physical speed\n  - Interface High Speed: negotiation speed\n  - Interface Type\n  - Interface Mac Address\n  - Interface Admin status\n  - Interface Operational Status\n  - Interface IP Addresses: (L3 Interface)\n  - Interface Port Mode: access/trunk/hybrid ...\n- **LLDP Neighbors**: lldp information will local and remote connection info\n  - Local Chassis Id: the unique identifier mac address of chassis\n  - Local Hostname: the hostname of local device\n  - Local Interface Name\n  - Local Interface Description\n  - Remote Chassis Id: the unique identifier mac address of lldp neighbor chassis\n  - Remote Hostname: the hostname of lldp neighbor\n  - Remote Interface Name: the interface name of lldp neighbor\n  - Remote interface Description: the interface description of lldp neighbor\n\n- **Entities**\n  - Entity Physical Description: the mode information of entity\n  - Entity Physical Name: the name of entity\n  - Entity Software revision: software version\n  - Entity Serial Number: the serial number of entity\n---\n> waiting for implement\n- **VLANS**\n- **StackWise**\n- **Prefixes**\n- **ARP Table**\n- **Mac Address Table**\n- **Routing table**\n\n---\n## Main support manufactures\n### well tested\n- Cisco\n- Huawei\n- Aruba\n### basic tested\n- H3C\n- Ruijie\n- Arista\n- Fortinet\n- PaloAlto\n- Juniper\n\n\n## Development Guide\n1. install [rye](https://rye.astral.sh/guide/installation/) for python project management\n2. execute `rye sync` to install dependencies\n3. execute `pre-commit install` for lint and pytest hooks\n4. perform you code changes and execute `pre-commit` to do static code check and unit test.\n5. push changes to the codebase.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Network Device information Discovery via SNMP",
    "version": "0.1.3",
    "project_urls": null,
    "split_keywords": [
        "lldp",
        " netmiko",
        " network-automation",
        " network-device",
        " network-discovery",
        " snmp",
        " textfsm"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d32f7797474caff933935f25dac7122c8027fbb5304d6489f05607e37943248a",
                "md5": "1ef6be8b47240379ea19b62cb84c1072",
                "sha256": "bb765371f89f737bc985d05d72ca04d4907bff18d4660918e65ed896bb334e5d"
            },
            "downloads": -1,
            "filename": "netty_snmp-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1ef6be8b47240379ea19b62cb84c1072",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 87239,
            "upload_time": "2024-10-11T08:57:13",
            "upload_time_iso_8601": "2024-10-11T08:57:13.525848Z",
            "url": "https://files.pythonhosted.org/packages/d3/2f/7797474caff933935f25dac7122c8027fbb5304d6489f05607e37943248a/netty_snmp-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "22808c9b6efa4b059507397fdf884fdb33d1d5e4bc1827f6472e17693a51715b",
                "md5": "5ebcf64909781a27f4a09d3493786a26",
                "sha256": "6e78f7b3af49f8d0005d680591b7293b94692c9981783c611fef8629df0a82d4"
            },
            "downloads": -1,
            "filename": "netty_snmp-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "5ebcf64909781a27f4a09d3493786a26",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 81608,
            "upload_time": "2024-10-11T08:57:12",
            "upload_time_iso_8601": "2024-10-11T08:57:12.287235Z",
            "url": "https://files.pythonhosted.org/packages/22/80/8c9b6efa4b059507397fdf884fdb33d1d5e4bc1827f6472e17693a51715b/netty_snmp-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-11 08:57:12",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "netty-snmp"
}
        
Elapsed time: 0.78521s