networkmgmt 0.0.2__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- networkmgmt-0.0.4/PKG-INFO +623 -0
- networkmgmt-0.0.4/README.md +586 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/__init__.py +1 -1
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/__main__.py +2 -3
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/discovery/categorize.py +0 -3
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/discovery/cli.py +60 -12
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/discovery/lldp.py +1 -1
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/discovery/scanner.py +5 -3
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/discovery/snmp.py +68 -181
- networkmgmt-0.0.4/networkmgmt/snmp/__init__.py +55 -0
- networkmgmt-0.0.4/networkmgmt/snmp/credentials.py +92 -0
- networkmgmt-0.0.4/networkmgmt/snmp/errors.py +65 -0
- networkmgmt-0.0.4/networkmgmt/snmp/polling.py +39 -0
- networkmgmt-0.0.4/networkmgmt/snmp/portlist.py +51 -0
- networkmgmt-0.0.4/networkmgmt/snmp/session.py +466 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/snmp_vlan_dump/_util.py +36 -0
- networkmgmt-0.0.4/networkmgmt/snmp_vlan_dump/cli.py +152 -0
- networkmgmt-0.0.4/networkmgmt/snmp_vlan_dump/collector.py +218 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/snmp_vlan_dump/formatters.py +11 -1
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/snmp_vlan_dump/models.py +3 -0
- networkmgmt-0.0.4/networkmgmt/snmp_vlan_dump/snmp.py +69 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/__init__.py +0 -1
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/cli.py +153 -55
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/__init__.py +1 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/netgear/__init__.py +1 -1
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/netgear/backend.py +141 -0
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/netgear/client.py +196 -0
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/netgear/models.py +120 -0
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/netgear/oids.py +97 -0
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/netgear/routing.py +391 -0
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/netgear/snmp_managers.py +557 -0
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/netgear/web.py +225 -0
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/netgear_plus/__init__.py +5 -0
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/netgear_plus/client.py +101 -0
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/netgear_plus/managers.py +508 -0
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/netgear_plus/sdk.py +223 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/qnap/client.py +51 -14
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/qnap/rest.py +174 -20
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/qnap/utils.py +117 -0
- networkmgmt-0.0.4/networkmgmt/switchctrl/vendors/qnap/vlan_rest.py +314 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/pyproject.toml +42 -10
- networkmgmt-0.0.2/PKG-INFO +0 -370
- networkmgmt-0.0.2/README.md +0 -340
- networkmgmt-0.0.2/networkmgmt/snmp_vlan_dump/cli.py +0 -92
- networkmgmt-0.0.2/networkmgmt/snmp_vlan_dump/collector.py +0 -191
- networkmgmt-0.0.2/networkmgmt/snmp_vlan_dump/snmp.py +0 -103
- networkmgmt-0.0.2/networkmgmt/switchctrl/vendors/netgear/client.py +0 -47
- networkmgmt-0.0.2/networkmgmt/switchctrl/vendors/qnap/utils.py +0 -21
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/.gitignore +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/LICENSE.md +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/discovery/__init__.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/discovery/_util.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/discovery/mermaid.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/discovery/models.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/discovery/oui.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/snmp_vlan_dump/__init__.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/snmp_vlan_dump/mermaid.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/base/__init__.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/base/client.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/base/managers.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/base/transport.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/exceptions.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/factory.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/models/__init__.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/models/port.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/models/stats.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/models/system.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/models/vlan.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/cisco/__init__.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/cisco/client.py +1 -1
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/cisco/managers.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/common/__init__.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/common/cisco_cli.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/common/cisco_managers.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/mikrotik/__init__.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/mikrotik/client.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/mikrotik/managers.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/mikrotik/rest.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/mikrotik/ssh.py +0 -0
- {networkmgmt-0.0.2 → networkmgmt-0.0.4}/networkmgmt/switchctrl/vendors/qnap/__init__.py +0 -0
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: networkmgmt
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: Multi-vendor network management toolkit — topology discovery, switch control, and VLAN management
|
|
5
|
+
Project-URL: Homepage, https://github.com/vroomfondel/networkmgmt
|
|
6
|
+
Project-URL: Repository, https://github.com/vroomfondel/networkmgmt
|
|
7
|
+
Project-URL: Issues, https://github.com/vroomfondel/networkmgmt
|
|
8
|
+
Author-email: Henning Thieß <ht@xomox.cc>
|
|
9
|
+
License-File: LICENSE.md
|
|
10
|
+
Keywords: ansible,cisco,discovery,lldp,management,mikrotik,netgear,network,qnap,snmp,switch,topology,vlan
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Topic :: System :: Networking
|
|
17
|
+
Classifier: Topic :: System :: Networking :: Monitoring
|
|
18
|
+
Classifier: Topic :: System :: Systems Administration
|
|
19
|
+
Requires-Python: >=3.14
|
|
20
|
+
Requires-Dist: loguru>=0.7.3
|
|
21
|
+
Requires-Dist: paramiko>=5.1.0
|
|
22
|
+
Requires-Dist: pydantic>=2.14.2
|
|
23
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
24
|
+
Requires-Dist: requests>=2.34.2
|
|
25
|
+
Requires-Dist: tabulate>=0.10.0
|
|
26
|
+
Provides-Extra: all
|
|
27
|
+
Requires-Dist: netgear-tool>=0.2.0; extra == 'all'
|
|
28
|
+
Requires-Dist: pysnmp>=7.1.30; extra == 'all'
|
|
29
|
+
Requires-Dist: scapy>=2.8.0; extra == 'all'
|
|
30
|
+
Provides-Extra: discovery
|
|
31
|
+
Requires-Dist: scapy>=2.8.0; extra == 'discovery'
|
|
32
|
+
Provides-Extra: netgear-plus
|
|
33
|
+
Requires-Dist: netgear-tool>=0.2.0; extra == 'netgear-plus'
|
|
34
|
+
Provides-Extra: snmp
|
|
35
|
+
Requires-Dist: pysnmp>=7.1.30; extra == 'snmp'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
[](https://github.com/vroomfondel/networkmgmt/actions/workflows/checkblack.yml)
|
|
39
|
+
[](https://github.com/vroomfondel/networkmgmt/actions/workflows/mypynpytests.yml)
|
|
40
|
+
[](https://github.com/vroomfondel/networkmgmt/actions/workflows/buildmultiarchandpush.yml)
|
|
41
|
+

|
|
42
|
+
[](https://hub.docker.com/r/xomoxcc/networkmgmt/tags)
|
|
43
|
+
[](https://pypi.org/project/networkmgmt/)
|
|
44
|
+
|
|
45
|
+
[](https://hub.docker.com/r/xomoxcc/networkmgmt/tags)
|
|
46
|
+
|
|
47
|
+
# WIP !!!
|
|
48
|
+
|
|
49
|
+
# networkmgmt — Network Management Toolkit
|
|
50
|
+
|
|
51
|
+
CLI tool and Python library for multi-vendor switch management and network topology discovery.
|
|
52
|
+
|
|
53
|
+
Quick links:
|
|
54
|
+
- [Docker Hub](https://hub.docker.com/r/xomoxcc/networkmgmt/tags) — multi-arch image (amd64/arm64)
|
|
55
|
+
- [PyPI](https://pypi.org/project/networkmgmt/) — `pip install networkmgmt`
|
|
56
|
+
- [GitHub](https://github.com/vroomfondel/networkmgmt) — source, issues, CI
|
|
57
|
+
|
|
58
|
+
## Modules
|
|
59
|
+
|
|
60
|
+
| Module | Description |
|
|
61
|
+
|--------------------------------|---------------------------------------------------------------------------|
|
|
62
|
+
| **networkmgmt.switchctrl** | Multi-vendor switch management (Cisco, MikroTik, QNAP, Netgear Pro/Plus) |
|
|
63
|
+
| **networkmgmt.snmp** | Shared SNMPv2c/v3 core (optional `pysnmp`) used by the Netgear Pro vendor |
|
|
64
|
+
| **networkmgmt.discovery** | Network topology discovery (ARP, DNS, SNMP, LLDP, nmap, traceroute) |
|
|
65
|
+
| **networkmgmt.snmp_vlan_dump** | SNMP VLAN-port dump for Netgear switches |
|
|
66
|
+
|
|
67
|
+
## Supported Switch Vendors
|
|
68
|
+
|
|
69
|
+
| Vendor | Model(s) | Transport | Notes |
|
|
70
|
+
|------------------|-------------------------------------------------------|------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
|
|
71
|
+
| **cisco** | Catalyst 1200 (C1200-8T-D) | SSH CLI only | 8 GE ports (`gi1`–`gi8`), no REST API, enable password required |
|
|
72
|
+
| **mikrotik** | RouterOS v7+ switches | REST API + SSH CLI | REST for monitoring, SSH for configuration |
|
|
73
|
+
| **qnap** | QSW-M408 series | REST API + SSH CLI | Monitoring and VLAN via REST (declarative `apply_port_membership`, 0.3 s request delay), port/LACP via Cisco-style SSH CLI; no PVID |
|
|
74
|
+
| **netgear** | Smart Managed Pro: S3300 stack, GS108Tv2, M4300 class | SNMPv3 (v2c fallback), web UI for static routes only | VLAN incl. PVID, port admin, LAG read-only, routing interfaces, management IP, static routes, `save_config()` |
|
|
75
|
+
| **netgear_plus** | Smart Managed Plus: GS105E, GS108E, GS305E | Web UI via optional `netgear-tool` | Declarative 802.1Q incl. removal, PVID, port admin; no LACP, no sensors |
|
|
76
|
+
|
|
77
|
+
## CLI Structure
|
|
78
|
+
|
|
79
|
+
`networkmgmt` is an orchestrator that dispatches to three sub-CLIs. Each sub-CLI can also be invoked directly:
|
|
80
|
+
|
|
81
|
+
| Orchestrator command | Direct script | Description |
|
|
82
|
+
|------------------------------|--------------------------|--------------------------------|
|
|
83
|
+
| `networkmgmt switchctrl ...` | `networkmgmt-switchctrl` | Multi-vendor switch management |
|
|
84
|
+
| `networkmgmt discover ...` | `networkmgmt-discover` | Network topology discovery |
|
|
85
|
+
| `networkmgmt vlan-dump ...` | `networkmgmt-vlan-dump` | SNMP VLAN-port dump |
|
|
86
|
+
|
|
87
|
+
## Installation
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pip install .
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Optional extras:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pip install networkmgmt[snmp] # pysnmp: netgear (Smart Managed Pro) vendor
|
|
97
|
+
pip install networkmgmt[netgear-plus] # netgear-tool: netgear_plus (Smart Managed Plus) vendor
|
|
98
|
+
pip install networkmgmt[discovery] # scapy: ARP scan in networkmgmt-discover
|
|
99
|
+
pip install networkmgmt[all] # everything above
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Network Topology Discovery
|
|
103
|
+
|
|
104
|
+
Discover local network topology via ARP scanning, reverse DNS, MAC vendor lookup, SNMP bridge tables, LLDP, optional nmap service detection, and traceroute. Outputs Mermaid flowcharts or JSON.
|
|
105
|
+
|
|
106
|
+
### CLI
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Basic discovery (auto-detect interface)
|
|
110
|
+
networkmgmt-discover -i eth0
|
|
111
|
+
# or: networkmgmt discover -i eth0
|
|
112
|
+
|
|
113
|
+
# With nmap service detection (requires root for ARP scan)
|
|
114
|
+
sudo networkmgmt-discover -i eth0 --nmap -o topology.md
|
|
115
|
+
|
|
116
|
+
# JSON output
|
|
117
|
+
networkmgmt-discover -i eth0 --format json -o topology.json
|
|
118
|
+
|
|
119
|
+
# Multi-subnet scan
|
|
120
|
+
networkmgmt-discover -i eth0,vlan100 -o multi.md
|
|
121
|
+
|
|
122
|
+
# SNMP L2 topology (query switch MAC tables), SNMPv2c per switch
|
|
123
|
+
networkmgmt-discover -i eth0 --switches 192.0.2.38:public,192.0.2.19
|
|
124
|
+
|
|
125
|
+
# SNMPv3 for every switch without :community (v2c entries can be mixed in)
|
|
126
|
+
networkmgmt-discover -i eth0 --switches 192.0.2.38,192.0.2.150,192.0.2.19:public \
|
|
127
|
+
--snmp-user admin --snmp-auth-key 'AUTHPASS' --snmp-auth-protocol sha512
|
|
128
|
+
|
|
129
|
+
# LLDP-based topology
|
|
130
|
+
networkmgmt-discover -i eth0 --lldp-collect /tmp/lldp
|
|
131
|
+
|
|
132
|
+
# Manual topology + diagram style
|
|
133
|
+
networkmgmt-discover -i eth0 --topology 192.0.2.50:192.0.2.19:g3 -d hierarchical
|
|
134
|
+
|
|
135
|
+
# Traceroute to external targets
|
|
136
|
+
networkmgmt-discover -i eth0 -t 8.8.8.8,1.1.1.1
|
|
137
|
+
sudo networkmgmt-discover -i eth0 -t 192.0.2.0/24
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Discovery Options
|
|
141
|
+
|
|
142
|
+
| Option | Description |
|
|
143
|
+
|--------------------------|--------------------------------------------------------------------------------|
|
|
144
|
+
| `-i` / `--interface` | Network interface(s), comma-separated (default: auto-detect) |
|
|
145
|
+
| `-t` / `--targets` | Traceroute targets: IPs, CIDR (`192.168.1.0/24`), or range (`192.168.1.1-254`) |
|
|
146
|
+
| `--nmap` | Enable nmap service detection |
|
|
147
|
+
| `--top-ports` | nmap top ports to scan (default: 100) |
|
|
148
|
+
| `-o` / `--output` | Output file (default: stdout) |
|
|
149
|
+
| `--format` | `mermaid` (default) or `json` |
|
|
150
|
+
| `--timeout` | Scan timeout in seconds (default: 10) |
|
|
151
|
+
| `--max-hops` | Max traceroute hops (default: 30) |
|
|
152
|
+
| `--trace-local` | Tracepath to all LAN hosts to detect switch hierarchy |
|
|
153
|
+
| `--switches` | SNMP L2 discovery: `IP[:community],...` (default community: `public`) |
|
|
154
|
+
| `--snmp-user` | SNMPv3 user for `--switches` entries without `:community` |
|
|
155
|
+
| `--snmp-auth-key` | SNMPv3 auth passphrase (or `$SNMP_AUTH_KEY`) |
|
|
156
|
+
| `--snmp-auth-protocol` | `md5`, `sha`, `sha256`, `sha512` (default) |
|
|
157
|
+
| `--snmp-priv-key` | SNMPv3 privacy passphrase (or `$SNMP_PRIV_KEY`); unset = authNoPriv |
|
|
158
|
+
| `--snmp-priv-protocol` | `des`, `aes128` (default) |
|
|
159
|
+
| `--snmp-timeout` | SNMP timeout per request in seconds (default: 5) |
|
|
160
|
+
| `--snmp-retries` | SNMP retries per request (default: 1) |
|
|
161
|
+
| `--lldp-collect` | SSH into hosts, collect lldpctl JSON to directory |
|
|
162
|
+
| `--lldp-dir` | Read existing LLDP JSON files from directory |
|
|
163
|
+
| `--topology` | Manual L2 topology: `HOST:SWITCH:PORT,...` |
|
|
164
|
+
| `-d` / `--diagram-style` | `auto` (default), `flat`, `categorized`, `hierarchical` |
|
|
165
|
+
| `--direction` | Mermaid flowchart direction: `LR` or `TD` (default: auto) |
|
|
166
|
+
| `--elk` | Use ELK layout engine for large diagrams |
|
|
167
|
+
| `-v` / `--verbose` | Verbose logging |
|
|
168
|
+
|
|
169
|
+
### Python Library Usage (Discovery)
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
from networkmgmt.discovery import NetworkTopologyScanner, MermaidGenerator
|
|
173
|
+
|
|
174
|
+
scanner = NetworkTopologyScanner(interfaces=["eth0"], use_nmap=True)
|
|
175
|
+
topology = scanner.run_discovery()
|
|
176
|
+
|
|
177
|
+
# Generate Mermaid diagram
|
|
178
|
+
gen = MermaidGenerator(topology, diagram_style="hierarchical")
|
|
179
|
+
print(gen.generate())
|
|
180
|
+
|
|
181
|
+
# Or export as JSON
|
|
182
|
+
print(topology.model_dump_json(indent=2))
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## SNMP VLAN Dump
|
|
186
|
+
|
|
187
|
+
Dumps VLAN membership (tagged/untagged), PVIDs and link state per port from Q-BRIDGE-MIB capable switches (tested on Netgear S3300 stacks and GS108Tv2) as a terminal table, Markdown or Mermaid diagram.
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# SNMPv2c
|
|
191
|
+
networkmgmt vlan-dump 192.0.2.38 public
|
|
192
|
+
networkmgmt vlan-dump 192.0.2.38 public -m -o s3300.md -d trunks
|
|
193
|
+
|
|
194
|
+
# SNMPv3 (defaults sha512/aes128; authNoPriv when --snmp-priv-key is missing)
|
|
195
|
+
networkmgmt vlan-dump 192.0.2.38 --snmp-user admin --snmp-auth-key 'AUTHPASS'
|
|
196
|
+
|
|
197
|
+
# GS108Tv2: the web login is the SNMPv3 user, md5/sha + des only
|
|
198
|
+
networkmgmt vlan-dump 192.0.2.150 --snmp-user admin --snmp-auth-key 'WEBPASS' \
|
|
199
|
+
--snmp-auth-protocol sha --snmp-priv-key 'WEBPASS' --snmp-priv-protocol des
|
|
200
|
+
|
|
201
|
+
SNMP_AUTH_KEY='AUTHPASS' networkmgmt vlan-dump 192.0.2.38 --snmp-user admin --snmp-timeout 10 --snmp-retries 2
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
- Factory VLANs (1, 2 Voice, 3 Auto-Video on the GS108Tv2) are missing from `dot1qVlanStaticTable`; the dump merges them in from `dot1qVlanCurrentTable`, static entries win.
|
|
205
|
+
- Stack links (S3300) show up in the VLAN 1 bitmap but are not bridge ports; they are listed in a note line and left out of tables and diagrams.
|
|
206
|
+
- A wrong user or key is reported as `SNMP authentication failed`. With SNMPv3 this often surfaces only as a timeout, so the message names user, auth and privacy settings as the likely cause.
|
|
207
|
+
|
|
208
|
+
## Switch Management CLI
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
networkmgmt-switchctrl --vendor <VENDOR> --host <IP> --password <PW> [options] <command>
|
|
212
|
+
# or: networkmgmt switchctrl --vendor <VENDOR> --host <IP> --password <PW> [options] <command>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Global Options
|
|
216
|
+
|
|
217
|
+
| Option | Description |
|
|
218
|
+
|---------------------|------------------------------------------------------------------------------------|
|
|
219
|
+
| `--vendor` | Switch vendor (`cisco`, `mikrotik`, `netgear`, `netgear_plus`, `qnap`) |
|
|
220
|
+
| `--host` | Switch IP address or hostname |
|
|
221
|
+
| `--password` | Admin password (required except for `netgear` with `--community` or `--snmp-user`) |
|
|
222
|
+
| `--username` | Username (default: `admin`; `netgear`: alias for `--snmp-user`) |
|
|
223
|
+
| `--enable-password` | Enable password (Cisco: required; QNAP: auto-generated if omitted) |
|
|
224
|
+
| `--ssh-port` | SSH port (default: 22) |
|
|
225
|
+
| `--rest-port` | REST API port (default: 443) |
|
|
226
|
+
| `--ssh-username` | SSH username (vendor-specific default if omitted) |
|
|
227
|
+
| `--ssh-password` | SSH password (vendor-specific default if omitted) |
|
|
228
|
+
| `--verify-ssl` | Verify SSL certificates for REST API |
|
|
229
|
+
| `-v` / `--verbose` | Enable debug logging |
|
|
230
|
+
|
|
231
|
+
### Commands
|
|
232
|
+
|
|
233
|
+
### Vendor Options
|
|
234
|
+
|
|
235
|
+
All options are command-line flags; each is rejected for vendors it does not belong to.
|
|
236
|
+
|
|
237
|
+
| Option | Vendor | Description |
|
|
238
|
+
|-------------------------------------------|--------------|------------------------------------------------------------------------------|
|
|
239
|
+
| `--community` | netgear | SNMPv2c community (fallback when no `--snmp-user` is given) |
|
|
240
|
+
| `--snmp-user` | netgear | SNMPv3 user |
|
|
241
|
+
| `--auth-key` | netgear | SNMPv3 authentication passphrase (default: `--password`) |
|
|
242
|
+
| `--auth-protocol {md5,sha,sha256,sha512}` | netgear | SNMPv3 authentication protocol (default: `sha512`; GS108Tv2: `md5` or `sha`) |
|
|
243
|
+
| `--priv-key` | netgear | SNMPv3 privacy passphrase (omit for authNoPriv) |
|
|
244
|
+
| `--priv-protocol {des,aes128}` | netgear | SNMPv3 privacy protocol (default: `aes128`; GS108Tv2: `des`) |
|
|
245
|
+
| `--web-password` | netgear | Web UI password for static routes (default: `--password`) |
|
|
246
|
+
| `--password` | netgear_plus | Web UI password (the only option this vendor needs) |
|
|
247
|
+
| `--vlan-backend {rest,ssh}` | qnap | VLAN backend (default: `rest`; `ssh` if SSH options are given) |
|
|
248
|
+
| `--rest-delay` | qnap | Seconds between REST requests (default: 0.3) |
|
|
249
|
+
|
|
250
|
+
#### `monitor` — Show system info, sensors, ports, and LACP status
|
|
251
|
+
|
|
252
|
+
Sections a vendor does not implement (Netgear sensors, LACP on `netgear_plus`) are reported as not supported and skipped; the rest is still printed.
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Cisco Catalyst 1200
|
|
256
|
+
networkmgmt-switchctrl --vendor cisco --host 192.168.1.254 \
|
|
257
|
+
--username admin --password <PW> --enable-password <EN> monitor
|
|
258
|
+
|
|
259
|
+
# QNAP QSW
|
|
260
|
+
networkmgmt-switchctrl --vendor qnap --host 192.168.1.1 --password <PW> monitor
|
|
261
|
+
|
|
262
|
+
# Netgear Smart Managed Pro, SNMPv3 (S3300: sha512 + aes128 are the defaults)
|
|
263
|
+
networkmgmt-switchctrl --vendor netgear --host 192.168.1.38 --snmp-user monitor \
|
|
264
|
+
--auth-key <AUTH> --priv-key <PRIV> monitor
|
|
265
|
+
|
|
266
|
+
# Netgear GS108Tv2: web login is the SNMPv3 user, md5/sha + des only
|
|
267
|
+
networkmgmt-switchctrl --vendor netgear --host 192.168.1.150 --snmp-user admin \
|
|
268
|
+
--auth-key <WEBPW> --auth-protocol sha --priv-key <WEBPW> --priv-protocol des monitor
|
|
269
|
+
|
|
270
|
+
# Netgear, SNMPv2c
|
|
271
|
+
networkmgmt-switchctrl --vendor netgear --host 192.168.1.38 --community public vlan list
|
|
272
|
+
|
|
273
|
+
# Netgear Smart Managed Plus
|
|
274
|
+
networkmgmt-switchctrl --vendor netgear_plus --host 192.168.1.5 --password <PW> vlan list
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
#### `vlan` — VLAN management
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# Create VLAN
|
|
281
|
+
networkmgmt-switchctrl --vendor cisco --host 192.168.1.254 \
|
|
282
|
+
--username admin --password <PW> --enable-password <EN> \
|
|
283
|
+
vlan create 100 --name servers
|
|
284
|
+
|
|
285
|
+
# List VLANs
|
|
286
|
+
networkmgmt-switchctrl --vendor cisco ... vlan list
|
|
287
|
+
|
|
288
|
+
# Delete VLAN
|
|
289
|
+
networkmgmt-switchctrl --vendor cisco ... vlan delete 100
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
#### `port` — Port configuration
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
# Configure port (Cisco uses gi1-gi8, QNAP uses GigabitEthernet1/0/1)
|
|
296
|
+
networkmgmt-switchctrl --vendor cisco --host 192.168.1.254 \
|
|
297
|
+
--username admin --password <PW> --enable-password <EN> \
|
|
298
|
+
port config gi1 --speed 1000 --duplex full
|
|
299
|
+
|
|
300
|
+
# Disable a port
|
|
301
|
+
networkmgmt-switchctrl --vendor cisco ... port config gi3 --shutdown
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
#### `example` — Quick connectivity test
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
networkmgmt-switchctrl --vendor cisco --host 192.168.1.254 \
|
|
308
|
+
--username admin --password <PW> --enable-password <EN> example
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Python Library Usage (Switch Management)
|
|
312
|
+
|
|
313
|
+
```python
|
|
314
|
+
from networkmgmt import create_switch
|
|
315
|
+
|
|
316
|
+
# Cisco Catalyst 1200
|
|
317
|
+
with create_switch(
|
|
318
|
+
"cisco",
|
|
319
|
+
host="192.168.1.254",
|
|
320
|
+
username="admin",
|
|
321
|
+
password="mypass",
|
|
322
|
+
enable_password="myenable",
|
|
323
|
+
) as switch:
|
|
324
|
+
switch.enable()
|
|
325
|
+
|
|
326
|
+
# Monitoring
|
|
327
|
+
info = switch.monitoring.get_system_info()
|
|
328
|
+
print(f"{info.model} — FW {info.firmware_version}")
|
|
329
|
+
|
|
330
|
+
sensors = switch.monitoring.get_sensor_data()
|
|
331
|
+
print(f"Temperature: {sensors.temperature}°C")
|
|
332
|
+
|
|
333
|
+
ports = switch.monitoring.get_port_status()
|
|
334
|
+
for p in ports:
|
|
335
|
+
print(f" {p.port}: {'UP' if p.link_up else 'DOWN'}")
|
|
336
|
+
|
|
337
|
+
# VLAN management (uses 'vlan database' mode on C1200)
|
|
338
|
+
switch.vlan.create_vlan(100, "servers")
|
|
339
|
+
switch.vlan.assign_port_to_vlan("gi3", 100)
|
|
340
|
+
|
|
341
|
+
# LACP (uses 'mode auto' on C1200)
|
|
342
|
+
switch.lacp.create_port_channel(1, ["gi5", "gi6"])
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
```python
|
|
346
|
+
# QNAP QSW
|
|
347
|
+
with create_switch("qnap", host="192.168.1.1", password="admin123") as switch:
|
|
348
|
+
switch.enable() # auto-generates enable password from serial
|
|
349
|
+
info = switch.monitoring.get_system_info()
|
|
350
|
+
print(info.model)
|
|
351
|
+
|
|
352
|
+
# QNAP QSW: declarative VLAN reconcile over REST
|
|
353
|
+
from networkmgmt.switchctrl.vendors.qnap.vlan_rest import PortMembership
|
|
354
|
+
|
|
355
|
+
with create_switch("qnap", host="192.168.1.1", password="admin123", rest_delay=0.3) as switch:
|
|
356
|
+
result = switch.rest_vlan.apply_port_membership(
|
|
357
|
+
[1, 100],
|
|
358
|
+
{"3": PortMembership(untagged=100), "4": PortMembership(tagged=[100])},
|
|
359
|
+
protect_ports=["11"],
|
|
360
|
+
)
|
|
361
|
+
print(result)
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
```python
|
|
365
|
+
# Netgear Smart Managed Pro (S3300 stack) over SNMPv3 — needs networkmgmt[snmp]
|
|
366
|
+
with create_switch(
|
|
367
|
+
"netgear",
|
|
368
|
+
host="192.168.1.38",
|
|
369
|
+
snmp_user="monitor",
|
|
370
|
+
auth_key="authpass",
|
|
371
|
+
priv_key="privpass",
|
|
372
|
+
web_password="webpass", # only for static routes
|
|
373
|
+
) as switch:
|
|
374
|
+
print(switch.monitoring.get_system_info().model)
|
|
375
|
+
|
|
376
|
+
switch.vlan.create_vlan(20, "iot")
|
|
377
|
+
switch.vlan.assign_port_to_vlan("1/g5", 20) # untagged; also sets the PVID
|
|
378
|
+
switch.port.disable_port("1/g6")
|
|
379
|
+
|
|
380
|
+
routing = switch.routing
|
|
381
|
+
routing.set_interface(20, "192.168.20.1/24")
|
|
382
|
+
routing.add_static_route("10.9.0.0/16", "192.168.20.254")
|
|
383
|
+
|
|
384
|
+
switch.save_config() # running -> startup, otherwise lost on reboot
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
```python
|
|
388
|
+
# Netgear Smart Managed Plus (GS105E/GS108E/GS305E) — needs networkmgmt[netgear-plus]
|
|
389
|
+
from networkmgmt.switchctrl.vendors.netgear_plus.managers import PortVlanSpec
|
|
390
|
+
|
|
391
|
+
with create_switch("netgear_plus", host="192.168.1.5", password="secret") as switch:
|
|
392
|
+
plan = switch.vlan.reconcile(
|
|
393
|
+
[1, 20, 101],
|
|
394
|
+
{
|
|
395
|
+
1: PortVlanSpec(untagged=1, tagged=[20, 101]),
|
|
396
|
+
2: PortVlanSpec(untagged=20), # untagged also sets the PVID
|
|
397
|
+
},
|
|
398
|
+
purge_vlans=True,
|
|
399
|
+
)
|
|
400
|
+
print(plan.render(), plan.changed)
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
## Vendor-Specific Notes
|
|
404
|
+
|
|
405
|
+
### Cisco Catalyst 1200 (C1200-8T-D)
|
|
406
|
+
|
|
407
|
+
- **SSH only** — no REST API available
|
|
408
|
+
- **Port names**: `gi1` through `gi8` (not `GigabitEthernet1/0/1`)
|
|
409
|
+
- **Enable password required** — no auto-generation, C1200 enforces password change on first login
|
|
410
|
+
- **VLAN creation** uses `vlan database` mode (not `configure terminal` > `vlan {id}`)
|
|
411
|
+
- **LACP** uses `channel-group {id} mode auto` (not `mode active`)
|
|
412
|
+
- **Fanless** — PoE-powered, `get_sensor_data()` always returns `fan_speed=0`
|
|
413
|
+
|
|
414
|
+
### QNAP QSW
|
|
415
|
+
|
|
416
|
+
- **Dual transport** — REST API for monitoring and VLANs, SSH (Cisco-style CLI) for port/LACP configuration
|
|
417
|
+
- **VLAN backend** — REST by default (`vlan_backend="rest"`); SSH if `ssh_username`, `ssh_password` or `enable_password` is given (or `vlan_backend="ssh"`)
|
|
418
|
+
- **Serialised REST** — `rest_delay` (default 0.3 s) between requests
|
|
419
|
+
- **Enable password** can be auto-generated from the switch serial number
|
|
420
|
+
- **Default SSH credentials**: `guest` / `guest123`
|
|
421
|
+
- **No PVID** — the untagged membership is the native/access VLAN, so at most one per port
|
|
422
|
+
|
|
423
|
+
### Netgear Smart Managed Pro (`netgear`)
|
|
424
|
+
|
|
425
|
+
- **SNMP** — SNMPv3 (`snmp_user`, `auth_key`, `priv_key`) preferred, SNMPv2c (`community`) as fallback; needs `pysnmp` (`networkmgmt[snmp]`)
|
|
426
|
+
- **Models** — S3300 stack, GS108Tv2, M4300 class; port names are `<unit>/g<n>`
|
|
427
|
+
- **Managers** — VLAN incl. PVID, port admin state, LAG read-only, stack units/ports; sensors and LAG changes raise `NotImplementedError`
|
|
428
|
+
- **`switch.routing`** — VLAN routing interfaces, management IP/gateway and static routes; static routes need `web_password` (web UI)
|
|
429
|
+
- **`switch.save_config()`** — writes are running-config only until saved
|
|
430
|
+
- **Writes are verified** — every write is polled until the read-back shows it
|
|
431
|
+
|
|
432
|
+
### Netgear Smart Managed Plus (`netgear_plus`)
|
|
433
|
+
|
|
434
|
+
- **Web UI** via the optional `netgear-tool` package (`networkmgmt[netgear-plus]`); single web session, use the client as a context manager
|
|
435
|
+
- **Models** — GS105E, GS108E, GS305E; ports are 1-based numbers
|
|
436
|
+
- **VLAN** — declarative `switch.vlan.reconcile(...)` (create, edit, PVID, delete, read-back check), `ensure_vlan`, `ensure_vlan_absent`, `ensure_port_vlans`
|
|
437
|
+
- **802.1Q mode** must be enabled on the switch; no LACP, no sensors (`NotImplementedError`)
|
|
438
|
+
|
|
439
|
+
### MikroTik
|
|
440
|
+
|
|
441
|
+
- **Dual transport** — REST API (RouterOS v7+) for monitoring, SSH for configuration
|
|
442
|
+
- **No enable mode** — RouterOS uses direct admin access
|
|
443
|
+
|
|
444
|
+
## Hardware quirks
|
|
445
|
+
|
|
446
|
+
- **GS108T SNMPv3** — the user is the web login (`admin`, auth key = web password) and only `md5`/`sha` with `des` work.
|
|
447
|
+
- **Delayed writes** — SNMP and REST writes take effect with delay, so every write is verified by polling the read-back.
|
|
448
|
+
- **One varbind per PDU** — VLAN writes on Netgear Pro are sent as single-varbind SETs; bundled varbinds are rejected with `commitFailed`.
|
|
449
|
+
- **Factory VLANs** — Netgear Pro lists default VLANs only in the Q-BRIDGE current table, not in the static table.
|
|
450
|
+
- **Untagged mask** — patch the Netgear Pro untagged port list bit by bit; clearing the CPU-port bit (13 on the GS108T) blocks every later untagged change of that VLAN, cleared bits of regular ports are harmless.
|
|
451
|
+
- **Stack links** — Netgear Pro stack ports are not bridge ports and are rejected as VLAN members.
|
|
452
|
+
- **Save** — Netgear Pro persists the config via `agentSaveConfig` under `4526.11` (not `4526.10`).
|
|
453
|
+
- **Static routes** — Netgear Pro accepts them only through the web UI (SNMP writes fail with `commitFailed`), which allows at most 4 sessions.
|
|
454
|
+
- **Plus VLANs** — `untagged` also sets the PVID, and 802.1Q mode must be on.
|
|
455
|
+
- **QNAP backend** — bursts of REST requests crash the switch backend (fork ENOMEM), so requests are serialised; avoid `lldp/neighbors/status`; there is no PVID.
|
|
456
|
+
|
|
457
|
+
## Ansible collection
|
|
458
|
+
|
|
459
|
+
The `ansible/` directory is the Ansible collection `vroomfondel.networkmgmt`, with modules for Netgear Smart Managed Plus and Pro switches, QNAP QSW switches and AVM FRITZ!Boxes. They encode the same hardware findings as `networkmgmt.switchctrl`, but target playbooks: declarative, idempotent, with check mode and diff. The collection is not on Ansible Galaxy and not part of the PyPI package; install it from this Git repository.
|
|
460
|
+
|
|
461
|
+
| Module | Device |
|
|
462
|
+
|--------------------------------------------------------------------------------------------------------|-------------------------------------------|
|
|
463
|
+
| `netgear_plus_facts`, `netgear_plus_vlan` | Netgear Smart Managed Plus (GS305E, …) |
|
|
464
|
+
| `netgear_pro_facts`, `netgear_pro_vlan`, `netgear_pro_routing`, `netgear_pro_mgmt`, `netgear_pro_save` | Netgear Smart Managed Pro (S3300, GS108T) |
|
|
465
|
+
| `qnap_qsw_facts`, `qnap_qsw_vlan` | QNAP QSW-M408 series |
|
|
466
|
+
| `fritzbox_facts`, `fritzbox_routes`, `fritzbox_static_leases` | AVM FRITZ!Box |
|
|
467
|
+
|
|
468
|
+
### 1. Python dependencies
|
|
469
|
+
|
|
470
|
+
The modules run on the controller (`connection: local`) and import their libraries from the Python environment that runs `ansible-playbook`. `ansible-galaxy` does not install them:
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
pip install ansible requests 'pysnmp>=7' netgear-tool fritzconnection
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
Only the packages of the families you use are needed; [ansible/requirements.txt](https://github.com/vroomfondel/networkmgmt/blob/main/ansible/requirements.txt) lists which module needs what.
|
|
477
|
+
|
|
478
|
+
### 2. Install the collection
|
|
479
|
+
|
|
480
|
+
Directly:
|
|
481
|
+
|
|
482
|
+
```bash
|
|
483
|
+
ansible-galaxy collection install 'git+https://github.com/vroomfondel/networkmgmt.git#/ansible,main'
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
Or declared in the `requirements.yml` of your playbook repository, which is the usual way to keep it reproducible:
|
|
487
|
+
|
|
488
|
+
```yaml
|
|
489
|
+
collections:
|
|
490
|
+
- name: git+https://github.com/vroomfondel/networkmgmt.git#/ansible
|
|
491
|
+
type: git
|
|
492
|
+
version: main # or a tag / commit hash to pin it
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
```bash
|
|
496
|
+
ansible-galaxy collection install -r requirements.yml
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
The `#/ansible` suffix points `ansible-galaxy` at the collection directory inside the repository. Without `-p`, the collection lands in `~/.ansible/collections`; `-p ./collections` installs it next to your playbooks instead. Re-run with `--force` to pick up a newer `main`.
|
|
500
|
+
|
|
501
|
+
### 3. Develop against a checkout (optional)
|
|
502
|
+
|
|
503
|
+
To edit the modules and test them without reinstalling, link the checkout into a collections path. A `collections/` directory next to the playbooks is searched first:
|
|
504
|
+
|
|
505
|
+
```bash
|
|
506
|
+
mkdir -p collections/ansible_collections/vroomfondel
|
|
507
|
+
ln -s /path/to/networkmgmt/ansible collections/ansible_collections/vroomfondel/networkmgmt
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
`ansible-doc` and ad-hoc `ansible` calls only see that directory if `ansible.cfg` lists it, for example `collections_path = ./collections:~/.ansible/collections`.
|
|
511
|
+
|
|
512
|
+
### 4. Use it
|
|
513
|
+
|
|
514
|
+
Call the modules by their fully qualified name and run them on the controller:
|
|
515
|
+
|
|
516
|
+
```yaml
|
|
517
|
+
- hosts: netgear_pro_switches
|
|
518
|
+
connection: local
|
|
519
|
+
gather_facts: false
|
|
520
|
+
vars:
|
|
521
|
+
ansible_python_interpreter: "{{ ansible_playbook_python }}"
|
|
522
|
+
tasks:
|
|
523
|
+
- vroomfondel.networkmgmt.netgear_pro_facts:
|
|
524
|
+
host: "{{ ansible_host }}"
|
|
525
|
+
snmp_user: "{{ netgear_snmp_user }}"
|
|
526
|
+
auth_key: "{{ netgear_snmp_auth_key }}"
|
|
527
|
+
priv_key: "{{ netgear_snmp_priv_key }}"
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
Check the installation with `ansible-doc -l vroomfondel.networkmgmt`, which lists all twelve modules. Parameters, inventory schema, tags and hardware quirks are documented in [ansible/README.md](https://github.com/vroomfondel/networkmgmt/blob/main/ansible/README.md); example inventory and playbooks are in [ansible/examples/](https://github.com/vroomfondel/networkmgmt/tree/main/ansible/examples).
|
|
531
|
+
|
|
532
|
+
## Architecture
|
|
533
|
+
|
|
534
|
+
```
|
|
535
|
+
networkmgmt/
|
|
536
|
+
├── __init__.py # Public API: create_switch(), list_vendors()
|
|
537
|
+
├── __main__.py # Orchestrator CLI — dispatches to sub-CLIs
|
|
538
|
+
├── snmp/ # Shared SNMP core (optional pysnmp): credentials, session, polling, portlists
|
|
539
|
+
├── switchctrl/ # Multi-vendor switch management
|
|
540
|
+
│ ├── __init__.py # Re-exports: create_switch, list_vendors, SwitchError
|
|
541
|
+
│ ├── cli.py # Switch management CLI (networkmgmt-switchctrl)
|
|
542
|
+
│ ├── factory.py # Vendor registry and factory
|
|
543
|
+
│ ├── exceptions.py # Exception hierarchy
|
|
544
|
+
│ ├── base/ # Abstract base classes
|
|
545
|
+
│ │ ├── client.py # BaseSwitchClient
|
|
546
|
+
│ │ ├── managers.py # BaseMonitoringManager, BaseVLANManager, ...
|
|
547
|
+
│ │ └── transport.py # BaseTransport
|
|
548
|
+
│ ├── models/ # Dataclasses (vendor-agnostic)
|
|
549
|
+
│ │ ├── port.py # PortConfig, PortStatus, PortSpeed, ...
|
|
550
|
+
│ │ ├── vlan.py # VLAN, TrunkConfig
|
|
551
|
+
│ │ ├── stats.py # PortStatistics
|
|
552
|
+
│ │ └── system.py # SystemInfo, SensorData, LACPInfo
|
|
553
|
+
│ └── vendors/
|
|
554
|
+
│ ├── common/ # Shared Cisco-style CLI transport & managers
|
|
555
|
+
│ │ ├── cisco_cli.py # CiscoCLITransport (SSH + paramiko)
|
|
556
|
+
│ │ └── cisco_managers.py CiscoVLANManager, CiscoPortManager, CiscoLACPManager
|
|
557
|
+
│ ├── cisco/ # Cisco Catalyst 1200
|
|
558
|
+
│ │ ├── client.py # CiscoSwitch — SSH only
|
|
559
|
+
│ │ └── managers.py # CiscoCLIMonitoringManager, CiscoCatalyst*Manager
|
|
560
|
+
│ ├── mikrotik/ # MikroTik RouterOS
|
|
561
|
+
│ │ ├── client.py # MikroTikSwitch
|
|
562
|
+
│ │ ├── managers.py # MikroTik*Manager
|
|
563
|
+
│ │ ├── rest.py # MikroTikRESTTransport
|
|
564
|
+
│ │ └── ssh.py # RouterOSTransport
|
|
565
|
+
│ ├── qnap/ # QNAP QSW
|
|
566
|
+
│ │ ├── client.py # QNAPSwitch
|
|
567
|
+
│ │ ├── rest.py # QNAPRESTTransport, QNAPMonitoringManager
|
|
568
|
+
│ │ ├── vlan_rest.py # QNAPRESTVLANManager (apply_port_membership)
|
|
569
|
+
│ │ └── utils.py # generate_enable_password()
|
|
570
|
+
│ ├── netgear/ # Netgear Smart Managed Pro (SNMP)
|
|
571
|
+
│ │ ├── client.py # NetgearSwitch
|
|
572
|
+
│ │ ├── backend.py # SNMP backend (read-back polling, save)
|
|
573
|
+
│ │ ├── snmp_managers.py Netgear*Manager
|
|
574
|
+
│ │ ├── routing.py # NetgearRoutingManager
|
|
575
|
+
│ │ └── web.py # NetgearWeb (static routes)
|
|
576
|
+
│ └── netgear_plus/ # Netgear Smart Managed Plus (web UI)
|
|
577
|
+
│ ├── client.py # NetgearPlusSwitch
|
|
578
|
+
│ ├── managers.py # NetgearPlus*Manager (reconcile)
|
|
579
|
+
│ └── sdk.py # netgear-tool wrapper
|
|
580
|
+
├── discovery/ # Network topology discovery
|
|
581
|
+
│ ├── __init__.py # Public API: NetworkTopologyScanner, MermaidGenerator, ...
|
|
582
|
+
│ ├── cli.py # Discovery CLI (networkmgmt-discover)
|
|
583
|
+
│ ├── models.py # Pydantic models: NetworkTopology, DiscoveredHost, ...
|
|
584
|
+
│ ├── _util.py # Shared helpers: _run_cmd, _validate_*, _strip_hostname
|
|
585
|
+
│ ├── oui.py # IEEE OUI database loading and vendor lookup
|
|
586
|
+
│ ├── categorize.py # Device category classification rules
|
|
587
|
+
│ ├── scanner.py # NetworkTopologyScanner (ARP, ping, nmap, DNS, traceroute)
|
|
588
|
+
│ ├── snmp.py # SnmpBridgeDiscovery (SNMP MAC table queries)
|
|
589
|
+
│ ├── lldp.py # LldpDiscovery (SSH + lldpctl)
|
|
590
|
+
│ └── mermaid.py # MermaidGenerator (flowchart diagram output)
|
|
591
|
+
└── snmp_vlan_dump/ # SNMP VLAN-port dump
|
|
592
|
+
├── __init__.py
|
|
593
|
+
├── cli.py # VLAN dump CLI (networkmgmt-vlan-dump)
|
|
594
|
+
├── collector.py # VlanDataCollector
|
|
595
|
+
├── formatters.py # TerminalFormatter, MarkdownFormatter
|
|
596
|
+
├── mermaid.py # VlanMermaidGenerator
|
|
597
|
+
└── snmp.py # SNMP operations
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
## Adding a New Vendor
|
|
601
|
+
|
|
602
|
+
1. Create `networkmgmt/switchctrl/vendors/<name>/` with `__init__.py`, `client.py`, and optionally `managers.py`
|
|
603
|
+
2. Decorate your client class with `@register_vendor("<name>")`
|
|
604
|
+
3. Add `import networkmgmt.switchctrl.vendors.<name>` to `networkmgmt/switchctrl/vendors/__init__.py`
|
|
605
|
+
4. The CLI picks it up automatically via `list_vendors()`
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
## License
|
|
609
|
+
This project is licensed under the LGPL where applicable/possible — see [LICENSE.md](https://github.com/vroomfondel/networkmgmt/blob/main/LICENSE.md). Some files/parts may use other licenses: [MIT](https://github.com/vroomfondel/networkmgmt/blob/main/LICENSEMIT.md) | [GPL](https://github.com/vroomfondel/networkmgmt/blob/main/LICENSEGPL.md) | [LGPL](https://github.com/vroomfondel/networkmgmt/blob/main/LICENSELGPL.md). Always check per‑file headers/comments.
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
## Authors
|
|
613
|
+
- Repo owner (primary author)
|
|
614
|
+
- Additional attributions are noted inline in code comments
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
## Acknowledgments
|
|
618
|
+
- Inspirations and snippets are referenced in code comments where appropriate.
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
## ⚠️ Note
|
|
622
|
+
|
|
623
|
+
This is a development/experimental project. For production use, review security settings, customize configurations, and test thoroughly in your environment. Provided "as is" without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software. Use at your own risk.
|