networkmgmt 0.0.1__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.1/.gitignore +149 -0
- networkmgmt-0.0.1/LICENSE.md +163 -0
- networkmgmt-0.0.1/PKG-INFO +367 -0
- networkmgmt-0.0.1/README.md +339 -0
- networkmgmt-0.0.1/networkmgmt/__init__.py +65 -0
- networkmgmt-0.0.1/networkmgmt/__main__.py +93 -0
- networkmgmt-0.0.1/networkmgmt/discovery/__init__.py +38 -0
- networkmgmt-0.0.1/networkmgmt/discovery/_util.py +45 -0
- networkmgmt-0.0.1/networkmgmt/discovery/categorize.py +154 -0
- networkmgmt-0.0.1/networkmgmt/discovery/cli.py +235 -0
- networkmgmt-0.0.1/networkmgmt/discovery/lldp.py +240 -0
- networkmgmt-0.0.1/networkmgmt/discovery/mermaid.py +980 -0
- networkmgmt-0.0.1/networkmgmt/discovery/models.py +85 -0
- networkmgmt-0.0.1/networkmgmt/discovery/oui.py +99 -0
- networkmgmt-0.0.1/networkmgmt/discovery/scanner.py +826 -0
- networkmgmt-0.0.1/networkmgmt/discovery/snmp.py +372 -0
- networkmgmt-0.0.1/networkmgmt/snmp_vlan_dump/__init__.py +16 -0
- networkmgmt-0.0.1/networkmgmt/snmp_vlan_dump/_util.py +124 -0
- networkmgmt-0.0.1/networkmgmt/snmp_vlan_dump/cli.py +92 -0
- networkmgmt-0.0.1/networkmgmt/snmp_vlan_dump/collector.py +191 -0
- networkmgmt-0.0.1/networkmgmt/snmp_vlan_dump/formatters.py +162 -0
- networkmgmt-0.0.1/networkmgmt/snmp_vlan_dump/mermaid.py +331 -0
- networkmgmt-0.0.1/networkmgmt/snmp_vlan_dump/models.py +43 -0
- networkmgmt-0.0.1/networkmgmt/snmp_vlan_dump/snmp.py +103 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/__init__.py +30 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/base/__init__.py +19 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/base/client.py +61 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/base/managers.py +94 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/base/transport.py +38 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/cli.py +269 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/exceptions.py +33 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/factory.py +54 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/models/__init__.py +20 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/models/port.py +56 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/models/stats.py +20 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/models/system.py +38 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/models/vlan.py +24 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/__init__.py +9 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/cisco/__init__.py +5 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/cisco/client.py +130 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/cisco/managers.py +421 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/common/__init__.py +15 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/common/cisco_cli.py +194 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/common/cisco_managers.py +392 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/mikrotik/__init__.py +5 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/mikrotik/client.py +129 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/mikrotik/managers.py +373 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/mikrotik/rest.py +129 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/mikrotik/ssh.py +136 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/netgear/__init__.py +5 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/netgear/client.py +47 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/qnap/__init__.py +5 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/qnap/client.py +168 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/qnap/rest.py +240 -0
- networkmgmt-0.0.1/networkmgmt/switchctrl/vendors/qnap/utils.py +21 -0
- networkmgmt-0.0.1/pyproject.toml +65 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
.claude
|
|
2
|
+
|
|
3
|
+
/docker-config
|
|
4
|
+
|
|
5
|
+
*.local.*
|
|
6
|
+
|
|
7
|
+
.idea/
|
|
8
|
+
|
|
9
|
+
# Byte-compiled / optimized / DLL files
|
|
10
|
+
__pycache__/
|
|
11
|
+
*.py[cod]
|
|
12
|
+
*$py.class
|
|
13
|
+
|
|
14
|
+
# C extensions
|
|
15
|
+
*.so
|
|
16
|
+
|
|
17
|
+
# Distribution / packaging
|
|
18
|
+
.Python
|
|
19
|
+
build/
|
|
20
|
+
develop-eggs/
|
|
21
|
+
dist/
|
|
22
|
+
downloads/
|
|
23
|
+
eggs/
|
|
24
|
+
.eggs/
|
|
25
|
+
lib/
|
|
26
|
+
lib64/
|
|
27
|
+
parts/
|
|
28
|
+
sdist/
|
|
29
|
+
var/
|
|
30
|
+
wheels/
|
|
31
|
+
share/python-wheels/
|
|
32
|
+
*.egg-info/
|
|
33
|
+
.installed.cfg
|
|
34
|
+
*.egg
|
|
35
|
+
MANIFEST
|
|
36
|
+
|
|
37
|
+
# PyInstaller
|
|
38
|
+
# Usually these files are written by a python script from a template
|
|
39
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
40
|
+
*.manifest
|
|
41
|
+
*.spec
|
|
42
|
+
|
|
43
|
+
# Installer logs
|
|
44
|
+
pip-log.txt
|
|
45
|
+
pip-delete-this-directory.txt
|
|
46
|
+
|
|
47
|
+
# Unit test / coverage reports
|
|
48
|
+
htmlcov/
|
|
49
|
+
.tox/
|
|
50
|
+
.nox/
|
|
51
|
+
.coverage
|
|
52
|
+
.coverage.*
|
|
53
|
+
.cache
|
|
54
|
+
nosetests.xml
|
|
55
|
+
coverage.xml
|
|
56
|
+
*.cover
|
|
57
|
+
*.py,cover
|
|
58
|
+
.hypothesis/
|
|
59
|
+
.pytest_cache/
|
|
60
|
+
cover/
|
|
61
|
+
|
|
62
|
+
# Translations
|
|
63
|
+
*.mo
|
|
64
|
+
*.pot
|
|
65
|
+
|
|
66
|
+
# Django stuff:
|
|
67
|
+
*.log
|
|
68
|
+
local_settings.py
|
|
69
|
+
db.sqlite3
|
|
70
|
+
db.sqlite3-journal
|
|
71
|
+
|
|
72
|
+
# Flask stuff:
|
|
73
|
+
instance/
|
|
74
|
+
.webassets-cache
|
|
75
|
+
|
|
76
|
+
# Scrapy stuff:
|
|
77
|
+
.scrapy
|
|
78
|
+
|
|
79
|
+
# Sphinx documentation
|
|
80
|
+
docs/_build/
|
|
81
|
+
|
|
82
|
+
# PyBuilder
|
|
83
|
+
.pybuilder/
|
|
84
|
+
target/
|
|
85
|
+
|
|
86
|
+
# Jupyter Notebook
|
|
87
|
+
.ipynb_checkpoints
|
|
88
|
+
|
|
89
|
+
# IPython
|
|
90
|
+
profile_default/
|
|
91
|
+
ipython_config.py
|
|
92
|
+
|
|
93
|
+
# pyenv
|
|
94
|
+
# .python-version
|
|
95
|
+
|
|
96
|
+
# pipenv
|
|
97
|
+
#Pipfile.lock
|
|
98
|
+
|
|
99
|
+
# poetry
|
|
100
|
+
#poetry.lock
|
|
101
|
+
|
|
102
|
+
# pdm
|
|
103
|
+
.pdm.toml
|
|
104
|
+
|
|
105
|
+
# PEP 582
|
|
106
|
+
__pypackages__/
|
|
107
|
+
|
|
108
|
+
# Celery stuff
|
|
109
|
+
celerybeat-schedule
|
|
110
|
+
celerybeat.pid
|
|
111
|
+
|
|
112
|
+
# SageMath parsed files
|
|
113
|
+
*.sage.py
|
|
114
|
+
|
|
115
|
+
# Environments
|
|
116
|
+
.env
|
|
117
|
+
.venv
|
|
118
|
+
env/
|
|
119
|
+
venv/
|
|
120
|
+
ENV/
|
|
121
|
+
env.bak/
|
|
122
|
+
venv.bak/
|
|
123
|
+
|
|
124
|
+
# Spyder project settings
|
|
125
|
+
.spyderproject
|
|
126
|
+
.spyproject
|
|
127
|
+
|
|
128
|
+
# Rope project settings
|
|
129
|
+
.ropeproject
|
|
130
|
+
|
|
131
|
+
# mkdocs documentation
|
|
132
|
+
/site
|
|
133
|
+
|
|
134
|
+
# mypy
|
|
135
|
+
.mypy_cache/
|
|
136
|
+
.dmypy.json
|
|
137
|
+
dmypy.json
|
|
138
|
+
|
|
139
|
+
# Pyre type checker
|
|
140
|
+
.pyre/
|
|
141
|
+
|
|
142
|
+
# pytype static type analyzer
|
|
143
|
+
.pytype/
|
|
144
|
+
|
|
145
|
+
# Cython debug symbols
|
|
146
|
+
cython_debug/
|
|
147
|
+
|
|
148
|
+
# Local overrides
|
|
149
|
+
*.local.*
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
GNU Lesser General Public License
|
|
2
|
+
=================================
|
|
3
|
+
|
|
4
|
+
_Version 3, 29 June 2007_
|
|
5
|
+
_Copyright © 2007 Free Software Foundation, Inc. <<http://fsf.org/>>_
|
|
6
|
+
|
|
7
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
8
|
+
of this license document, but changing it is not allowed.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
This version of the GNU Lesser General Public License incorporates
|
|
12
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
13
|
+
License, supplemented by the additional permissions listed below.
|
|
14
|
+
|
|
15
|
+
### 0. Additional Definitions
|
|
16
|
+
|
|
17
|
+
As used herein, “this License” refers to version 3 of the GNU Lesser
|
|
18
|
+
General Public License, and the “GNU GPL” refers to version 3 of the GNU
|
|
19
|
+
General Public License.
|
|
20
|
+
|
|
21
|
+
“The Library” refers to a covered work governed by this License,
|
|
22
|
+
other than an Application or a Combined Work as defined below.
|
|
23
|
+
|
|
24
|
+
An “Application” is any work that makes use of an interface provided
|
|
25
|
+
by the Library, but which is not otherwise based on the Library.
|
|
26
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
27
|
+
of using an interface provided by the Library.
|
|
28
|
+
|
|
29
|
+
A “Combined Work” is a work produced by combining or linking an
|
|
30
|
+
Application with the Library. The particular version of the Library
|
|
31
|
+
with which the Combined Work was made is also called the “Linked
|
|
32
|
+
Version”.
|
|
33
|
+
|
|
34
|
+
The “Minimal Corresponding Source” for a Combined Work means the
|
|
35
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
36
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
37
|
+
based on the Application, and not on the Linked Version.
|
|
38
|
+
|
|
39
|
+
The “Corresponding Application Code” for a Combined Work means the
|
|
40
|
+
object code and/or source code for the Application, including any data
|
|
41
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
42
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
43
|
+
|
|
44
|
+
### 1. Exception to Section 3 of the GNU GPL
|
|
45
|
+
|
|
46
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
47
|
+
without being bound by section 3 of the GNU GPL.
|
|
48
|
+
|
|
49
|
+
### 2. Conveying Modified Versions
|
|
50
|
+
|
|
51
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
52
|
+
facility refers to a function or data to be supplied by an Application
|
|
53
|
+
that uses the facility (other than as an argument passed when the
|
|
54
|
+
facility is invoked), then you may convey a copy of the modified
|
|
55
|
+
version:
|
|
56
|
+
|
|
57
|
+
* **a)** under this License, provided that you make a good faith effort to
|
|
58
|
+
ensure that, in the event an Application does not supply the
|
|
59
|
+
function or data, the facility still operates, and performs
|
|
60
|
+
whatever part of its purpose remains meaningful, or
|
|
61
|
+
|
|
62
|
+
* **b)** under the GNU GPL, with none of the additional permissions of
|
|
63
|
+
this License applicable to that copy.
|
|
64
|
+
|
|
65
|
+
### 3. Object Code Incorporating Material from Library Header Files
|
|
66
|
+
|
|
67
|
+
The object code form of an Application may incorporate material from
|
|
68
|
+
a header file that is part of the Library. You may convey such object
|
|
69
|
+
code under terms of your choice, provided that, if the incorporated
|
|
70
|
+
material is not limited to numerical parameters, data structure
|
|
71
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
72
|
+
(ten or fewer lines in length), you do both of the following:
|
|
73
|
+
|
|
74
|
+
* **a)** Give prominent notice with each copy of the object code that the
|
|
75
|
+
Library is used in it and that the Library and its use are
|
|
76
|
+
covered by this License.
|
|
77
|
+
* **b)** Accompany the object code with a copy of the GNU GPL and this license
|
|
78
|
+
document.
|
|
79
|
+
|
|
80
|
+
### 4. Combined Works
|
|
81
|
+
|
|
82
|
+
You may convey a Combined Work under terms of your choice that,
|
|
83
|
+
taken together, effectively do not restrict modification of the
|
|
84
|
+
portions of the Library contained in the Combined Work and reverse
|
|
85
|
+
engineering for debugging such modifications, if you also do each of
|
|
86
|
+
the following:
|
|
87
|
+
|
|
88
|
+
* **a)** Give prominent notice with each copy of the Combined Work that
|
|
89
|
+
the Library is used in it and that the Library and its use are
|
|
90
|
+
covered by this License.
|
|
91
|
+
|
|
92
|
+
* **b)** Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
93
|
+
document.
|
|
94
|
+
|
|
95
|
+
* **c)** For a Combined Work that displays copyright notices during
|
|
96
|
+
execution, include the copyright notice for the Library among
|
|
97
|
+
these notices, as well as a reference directing the user to the
|
|
98
|
+
copies of the GNU GPL and this license document.
|
|
99
|
+
|
|
100
|
+
* **d)** Do one of the following:
|
|
101
|
+
- **0)** Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
- **1)** Use a suitable shared library mechanism for linking with the
|
|
109
|
+
Library. A suitable mechanism is one that **(a)** uses at run time
|
|
110
|
+
a copy of the Library already present on the user's computer
|
|
111
|
+
system, and **(b)** will operate properly with a modified version
|
|
112
|
+
of the Library that is interface-compatible with the Linked
|
|
113
|
+
Version.
|
|
114
|
+
|
|
115
|
+
* **e)** Provide Installation Information, but only if you would otherwise
|
|
116
|
+
be required to provide such information under section 6 of the
|
|
117
|
+
GNU GPL, and only to the extent that such information is
|
|
118
|
+
necessary to install and execute a modified version of the
|
|
119
|
+
Combined Work produced by recombining or relinking the
|
|
120
|
+
Application with a modified version of the Linked Version. (If
|
|
121
|
+
you use option **4d0**, the Installation Information must accompany
|
|
122
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
123
|
+
Code. If you use option **4d1**, you must provide the Installation
|
|
124
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
125
|
+
for conveying Corresponding Source.)
|
|
126
|
+
|
|
127
|
+
### 5. Combined Libraries
|
|
128
|
+
|
|
129
|
+
You may place library facilities that are a work based on the
|
|
130
|
+
Library side by side in a single library together with other library
|
|
131
|
+
facilities that are not Applications and are not covered by this
|
|
132
|
+
License, and convey such a combined library under terms of your
|
|
133
|
+
choice, if you do both of the following:
|
|
134
|
+
|
|
135
|
+
* **a)** Accompany the combined library with a copy of the same work based
|
|
136
|
+
on the Library, uncombined with any other library facilities,
|
|
137
|
+
conveyed under the terms of this License.
|
|
138
|
+
* **b)** Give prominent notice with the combined library that part of it
|
|
139
|
+
is a work based on the Library, and explaining where to find the
|
|
140
|
+
accompanying uncombined form of the same work.
|
|
141
|
+
|
|
142
|
+
### 6. Revised Versions of the GNU Lesser General Public License
|
|
143
|
+
|
|
144
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
145
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
146
|
+
versions will be similar in spirit to the present version, but may
|
|
147
|
+
differ in detail to address new problems or concerns.
|
|
148
|
+
|
|
149
|
+
Each version is given a distinguishing version number. If the
|
|
150
|
+
Library as you received it specifies that a certain numbered version
|
|
151
|
+
of the GNU Lesser General Public License “or any later version”
|
|
152
|
+
applies to it, you have the option of following the terms and
|
|
153
|
+
conditions either of that published version or of any later version
|
|
154
|
+
published by the Free Software Foundation. If the Library as you
|
|
155
|
+
received it does not specify a version number of the GNU Lesser
|
|
156
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
157
|
+
General Public License ever published by the Free Software Foundation.
|
|
158
|
+
|
|
159
|
+
If the Library as you received it specifies that a proxy can decide
|
|
160
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
161
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
162
|
+
permanent authorization for you to choose that version for the
|
|
163
|
+
Library.
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: networkmgmt
|
|
3
|
+
Version: 0.0.1
|
|
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: cisco,discovery,lldp,management,mikrotik,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: fastapi>=0.128.6
|
|
21
|
+
Requires-Dist: kubernetes>=32.0.0
|
|
22
|
+
Requires-Dist: loguru>=0.7.0
|
|
23
|
+
Requires-Dist: pydantic>=2.10.0
|
|
24
|
+
Requires-Dist: pyyaml>=6.0
|
|
25
|
+
Requires-Dist: tabulate>=0.9.0
|
|
26
|
+
Requires-Dist: uvicorn[standard]>=0.34.0
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
[](https://github.com/vroomfondel/networkmgmt/actions/workflows/checkblack.yml)
|
|
30
|
+
[](https://github.com/vroomfondel/networkmgmt/actions/workflows/mypynpytests.yml)
|
|
31
|
+
[](https://github.com/vroomfondel/networkmgmt/actions/workflows/buildmultiarchandpush.yml)
|
|
32
|
+

|
|
33
|
+
[](https://hub.docker.com/r/xomoxcc/networkmgmt/tags)
|
|
34
|
+
[](https://pypi.org/project/networkmgmt/)
|
|
35
|
+
|
|
36
|
+
# WIP !!!
|
|
37
|
+
|
|
38
|
+
# networkmgmt — Network Management Toolkit
|
|
39
|
+
|
|
40
|
+
CLI tool and Python library for multi-vendor switch management and network topology discovery.
|
|
41
|
+
|
|
42
|
+
Quick links:
|
|
43
|
+
- [Docker Hub](https://hub.docker.com/r/xomoxcc/networkmgmt/tags) — multi-arch image (amd64/arm64)
|
|
44
|
+
- [PyPI](https://pypi.org/project/networkmgmt/) — `pip install networkmgmt`
|
|
45
|
+
- [GitHub](https://github.com/vroomfondel/networkmgmt) — source, issues, CI
|
|
46
|
+
|
|
47
|
+
## Modules
|
|
48
|
+
|
|
49
|
+
| Module | Description |
|
|
50
|
+
|--------|-------------|
|
|
51
|
+
| **networkmgmt.switchctrl** | Multi-vendor switch management (Cisco, MikroTik, QNAP, Netgear) |
|
|
52
|
+
| **networkmgmt.discovery** | Network topology discovery (ARP, DNS, SNMP, LLDP, nmap, traceroute) |
|
|
53
|
+
| **networkmgmt.snmp_vlan_dump** | SNMP VLAN-port dump for Netgear switches |
|
|
54
|
+
|
|
55
|
+
## Supported Switch Vendors
|
|
56
|
+
|
|
57
|
+
| Vendor | Model(s) | Transport | Notes |
|
|
58
|
+
|--------|----------|-----------|-------|
|
|
59
|
+
| **cisco** | Catalyst 1200 (C1200-8T-D) | SSH CLI only | 8 GE ports (`gi1`–`gi8`), no REST API, enable password required |
|
|
60
|
+
| **mikrotik** | RouterOS v7+ switches | REST API + SSH CLI | REST for monitoring, SSH for configuration |
|
|
61
|
+
| **qnap** | QSW-M408 series | REST API + SSH CLI | Cisco-style CLI, enable password auto-generated from serial |
|
|
62
|
+
| **netgear** | Managed switches | — | Stub (not yet implemented) |
|
|
63
|
+
|
|
64
|
+
## CLI Structure
|
|
65
|
+
|
|
66
|
+
`networkmgmt` is an orchestrator that dispatches to three sub-CLIs. Each sub-CLI can also be invoked directly:
|
|
67
|
+
|
|
68
|
+
| Orchestrator command | Direct script | Description |
|
|
69
|
+
|---|---|---|
|
|
70
|
+
| `networkmgmt switchctrl ...` | `networkmgmt-switchctrl` | Multi-vendor switch management |
|
|
71
|
+
| `networkmgmt discover ...` | `networkmgmt-discover` | Network topology discovery |
|
|
72
|
+
| `networkmgmt vlan-dump ...` | `networkmgmt-vlan-dump` | SNMP VLAN-port dump |
|
|
73
|
+
|
|
74
|
+
## Installation
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install .
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Network Topology Discovery
|
|
81
|
+
|
|
82
|
+
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.
|
|
83
|
+
|
|
84
|
+
### CLI
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Basic discovery (auto-detect interface)
|
|
88
|
+
networkmgmt-discover -i eth0
|
|
89
|
+
# or: networkmgmt discover -i eth0
|
|
90
|
+
|
|
91
|
+
# With nmap service detection (requires root for ARP scan)
|
|
92
|
+
sudo networkmgmt-discover -i eth0 --nmap -o topology.md
|
|
93
|
+
|
|
94
|
+
# JSON output
|
|
95
|
+
networkmgmt-discover -i eth0 --format json -o topology.json
|
|
96
|
+
|
|
97
|
+
# Multi-subnet scan
|
|
98
|
+
networkmgmt-discover -i eth0,vlan100 -o multi.md
|
|
99
|
+
|
|
100
|
+
# SNMP L2 topology (query switch MAC tables)
|
|
101
|
+
networkmgmt-discover -i eth0 --switches 192.168.1.38:public,192.168.1.19
|
|
102
|
+
|
|
103
|
+
# LLDP-based topology
|
|
104
|
+
networkmgmt-discover -i eth0 --lldp-collect /tmp/lldp
|
|
105
|
+
|
|
106
|
+
# Manual topology + diagram style
|
|
107
|
+
networkmgmt-discover -i eth0 --topology 192.168.1.50:192.168.1.19:g3 -d hierarchical
|
|
108
|
+
|
|
109
|
+
# Traceroute to external targets
|
|
110
|
+
networkmgmt-discover -i eth0 -t 8.8.8.8,1.1.1.1
|
|
111
|
+
sudo networkmgmt-discover -i eth0 -t 192.168.1.0/24
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Discovery Options
|
|
115
|
+
|
|
116
|
+
| Option | Description |
|
|
117
|
+
|--------|-------------|
|
|
118
|
+
| `-i` / `--interface` | Network interface(s), comma-separated (default: auto-detect) |
|
|
119
|
+
| `-t` / `--targets` | Traceroute targets: IPs, CIDR (`192.168.1.0/24`), or range (`192.168.1.1-254`) |
|
|
120
|
+
| `--nmap` | Enable nmap service detection |
|
|
121
|
+
| `--top-ports` | nmap top ports to scan (default: 100) |
|
|
122
|
+
| `-o` / `--output` | Output file (default: stdout) |
|
|
123
|
+
| `--format` | `mermaid` (default) or `json` |
|
|
124
|
+
| `--timeout` | Scan timeout in seconds (default: 10) |
|
|
125
|
+
| `--max-hops` | Max traceroute hops (default: 30) |
|
|
126
|
+
| `--trace-local` | Tracepath to all LAN hosts to detect switch hierarchy |
|
|
127
|
+
| `--switches` | SNMP L2 discovery: `IP[:community],...` (default community: `public`) |
|
|
128
|
+
| `--lldp-collect` | SSH into hosts, collect lldpctl JSON to directory |
|
|
129
|
+
| `--lldp-dir` | Read existing LLDP JSON files from directory |
|
|
130
|
+
| `--topology` | Manual L2 topology: `HOST:SWITCH:PORT,...` |
|
|
131
|
+
| `-d` / `--diagram-style` | `auto` (default), `flat`, `categorized`, `hierarchical` |
|
|
132
|
+
| `--direction` | Mermaid flowchart direction: `LR` or `TD` (default: auto) |
|
|
133
|
+
| `--elk` | Use ELK layout engine for large diagrams |
|
|
134
|
+
| `-v` / `--verbose` | Verbose logging |
|
|
135
|
+
|
|
136
|
+
### Python Library Usage (Discovery)
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from networkmgmt.discovery import NetworkTopologyScanner, MermaidGenerator
|
|
140
|
+
|
|
141
|
+
scanner = NetworkTopologyScanner(interfaces=["eth0"], use_nmap=True)
|
|
142
|
+
topology = scanner.run_discovery()
|
|
143
|
+
|
|
144
|
+
# Generate Mermaid diagram
|
|
145
|
+
gen = MermaidGenerator(topology, diagram_style="hierarchical")
|
|
146
|
+
print(gen.generate())
|
|
147
|
+
|
|
148
|
+
# Or export as JSON
|
|
149
|
+
print(topology.model_dump_json(indent=2))
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Switch Management CLI
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
networkmgmt-switchctrl --vendor <VENDOR> --host <IP> --password <PW> [options] <command>
|
|
156
|
+
# or: networkmgmt switchctrl --vendor <VENDOR> --host <IP> --password <PW> [options] <command>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Global Options
|
|
160
|
+
|
|
161
|
+
| Option | Description |
|
|
162
|
+
|--------|-------------|
|
|
163
|
+
| `--vendor` | Switch vendor (`cisco`, `mikrotik`, `netgear`, `qnap`) |
|
|
164
|
+
| `--host` | Switch IP address or hostname |
|
|
165
|
+
| `--password` | Admin password |
|
|
166
|
+
| `--username` | Username (default: `admin`) |
|
|
167
|
+
| `--enable-password` | Enable password (Cisco: required; QNAP: auto-generated if omitted) |
|
|
168
|
+
| `--ssh-port` | SSH port (default: 22) |
|
|
169
|
+
| `--rest-port` | REST API port (default: 443) |
|
|
170
|
+
| `--ssh-username` | SSH username (vendor-specific default if omitted) |
|
|
171
|
+
| `--ssh-password` | SSH password (vendor-specific default if omitted) |
|
|
172
|
+
| `--verify-ssl` | Verify SSL certificates for REST API |
|
|
173
|
+
| `-v` / `--verbose` | Enable debug logging |
|
|
174
|
+
|
|
175
|
+
### Commands
|
|
176
|
+
|
|
177
|
+
#### `monitor` — Show system info, sensors, ports, and LACP status
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Cisco Catalyst 1200
|
|
181
|
+
networkmgmt-switchctrl --vendor cisco --host 192.168.1.254 \
|
|
182
|
+
--username admin --password <PW> --enable-password <EN> monitor
|
|
183
|
+
|
|
184
|
+
# QNAP QSW
|
|
185
|
+
networkmgmt-switchctrl --vendor qnap --host 192.168.1.1 --password <PW> monitor
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### `vlan` — VLAN management
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Create VLAN
|
|
192
|
+
networkmgmt-switchctrl --vendor cisco --host 192.168.1.254 \
|
|
193
|
+
--username admin --password <PW> --enable-password <EN> \
|
|
194
|
+
vlan create 100 --name servers
|
|
195
|
+
|
|
196
|
+
# List VLANs
|
|
197
|
+
networkmgmt-switchctrl --vendor cisco ... vlan list
|
|
198
|
+
|
|
199
|
+
# Delete VLAN
|
|
200
|
+
networkmgmt-switchctrl --vendor cisco ... vlan delete 100
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### `port` — Port configuration
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Configure port (Cisco uses gi1-gi8, QNAP uses GigabitEthernet1/0/1)
|
|
207
|
+
networkmgmt-switchctrl --vendor cisco --host 192.168.1.254 \
|
|
208
|
+
--username admin --password <PW> --enable-password <EN> \
|
|
209
|
+
port config gi1 --speed 1000 --duplex full
|
|
210
|
+
|
|
211
|
+
# Disable a port
|
|
212
|
+
networkmgmt-switchctrl --vendor cisco ... port config gi3 --shutdown
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
#### `example` — Quick connectivity test
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
networkmgmt-switchctrl --vendor cisco --host 192.168.1.254 \
|
|
219
|
+
--username admin --password <PW> --enable-password <EN> example
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Python Library Usage (Switch Management)
|
|
223
|
+
|
|
224
|
+
```python
|
|
225
|
+
from networkmgmt import create_switch
|
|
226
|
+
|
|
227
|
+
# Cisco Catalyst 1200
|
|
228
|
+
with create_switch(
|
|
229
|
+
"cisco",
|
|
230
|
+
host="192.168.1.254",
|
|
231
|
+
username="admin",
|
|
232
|
+
password="mypass",
|
|
233
|
+
enable_password="myenable",
|
|
234
|
+
) as switch:
|
|
235
|
+
switch.enable()
|
|
236
|
+
|
|
237
|
+
# Monitoring
|
|
238
|
+
info = switch.monitoring.get_system_info()
|
|
239
|
+
print(f"{info.model} — FW {info.firmware_version}")
|
|
240
|
+
|
|
241
|
+
sensors = switch.monitoring.get_sensor_data()
|
|
242
|
+
print(f"Temperature: {sensors.temperature}°C")
|
|
243
|
+
|
|
244
|
+
ports = switch.monitoring.get_port_status()
|
|
245
|
+
for p in ports:
|
|
246
|
+
print(f" {p.port}: {'UP' if p.link_up else 'DOWN'}")
|
|
247
|
+
|
|
248
|
+
# VLAN management (uses 'vlan database' mode on C1200)
|
|
249
|
+
switch.vlan.create_vlan(100, "servers")
|
|
250
|
+
switch.vlan.assign_port_to_vlan("gi3", 100)
|
|
251
|
+
|
|
252
|
+
# LACP (uses 'mode auto' on C1200)
|
|
253
|
+
switch.lacp.create_port_channel(1, ["gi5", "gi6"])
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
```python
|
|
257
|
+
# QNAP QSW
|
|
258
|
+
with create_switch("qnap", host="192.168.1.1", password="admin123") as switch:
|
|
259
|
+
switch.enable() # auto-generates enable password from serial
|
|
260
|
+
info = switch.monitoring.get_system_info()
|
|
261
|
+
print(info.model)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Vendor-Specific Notes
|
|
265
|
+
|
|
266
|
+
### Cisco Catalyst 1200 (C1200-8T-D)
|
|
267
|
+
|
|
268
|
+
- **SSH only** — no REST API available
|
|
269
|
+
- **Port names**: `gi1` through `gi8` (not `GigabitEthernet1/0/1`)
|
|
270
|
+
- **Enable password required** — no auto-generation, C1200 enforces password change on first login
|
|
271
|
+
- **VLAN creation** uses `vlan database` mode (not `configure terminal` > `vlan {id}`)
|
|
272
|
+
- **LACP** uses `channel-group {id} mode auto` (not `mode active`)
|
|
273
|
+
- **Fanless** — PoE-powered, `get_sensor_data()` always returns `fan_speed=0`
|
|
274
|
+
|
|
275
|
+
### QNAP QSW
|
|
276
|
+
|
|
277
|
+
- **Dual transport** — REST API for monitoring, SSH (Cisco-style CLI) for configuration
|
|
278
|
+
- **Enable password** can be auto-generated from the switch serial number
|
|
279
|
+
- **Default SSH credentials**: `guest` / `guest123`
|
|
280
|
+
|
|
281
|
+
### MikroTik
|
|
282
|
+
|
|
283
|
+
- **Dual transport** — REST API (RouterOS v7+) for monitoring, SSH for configuration
|
|
284
|
+
- **No enable mode** — RouterOS uses direct admin access
|
|
285
|
+
|
|
286
|
+
## Architecture
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
networkmgmt/
|
|
290
|
+
├── __init__.py # Public API: create_switch(), list_vendors()
|
|
291
|
+
├── __main__.py # Orchestrator CLI — dispatches to sub-CLIs
|
|
292
|
+
├── switchctrl/ # Multi-vendor switch management
|
|
293
|
+
│ ├── __init__.py # Re-exports: create_switch, list_vendors, SwitchError
|
|
294
|
+
│ ├── cli.py # Switch management CLI (networkmgmt-switchctrl)
|
|
295
|
+
│ ├── factory.py # Vendor registry and factory
|
|
296
|
+
│ ├── exceptions.py # Exception hierarchy
|
|
297
|
+
│ ├── base/ # Abstract base classes
|
|
298
|
+
│ │ ├── client.py # BaseSwitchClient
|
|
299
|
+
│ │ ├── managers.py # BaseMonitoringManager, BaseVLANManager, ...
|
|
300
|
+
│ │ └── transport.py # BaseTransport
|
|
301
|
+
│ ├── models/ # Dataclasses (vendor-agnostic)
|
|
302
|
+
│ │ ├── port.py # PortConfig, PortStatus, PortSpeed, ...
|
|
303
|
+
│ │ ├── vlan.py # VLAN, TrunkConfig
|
|
304
|
+
│ │ ├── stats.py # PortStatistics
|
|
305
|
+
│ │ └── system.py # SystemInfo, SensorData, LACPInfo
|
|
306
|
+
│ └── vendors/
|
|
307
|
+
│ ├── common/ # Shared Cisco-style CLI transport & managers
|
|
308
|
+
│ │ ├── cisco_cli.py # CiscoCLITransport (SSH + paramiko)
|
|
309
|
+
│ │ └── cisco_managers.py CiscoVLANManager, CiscoPortManager, CiscoLACPManager
|
|
310
|
+
│ ├── cisco/ # Cisco Catalyst 1200
|
|
311
|
+
│ │ ├── client.py # CiscoSwitch — SSH only
|
|
312
|
+
│ │ └── managers.py # CiscoCLIMonitoringManager, CiscoCatalyst*Manager
|
|
313
|
+
│ ├── mikrotik/ # MikroTik RouterOS
|
|
314
|
+
│ │ ├── client.py # MikroTikSwitch
|
|
315
|
+
│ │ ├── managers.py # MikroTik*Manager
|
|
316
|
+
│ │ ├── rest.py # MikroTikRESTTransport
|
|
317
|
+
│ │ └── ssh.py # RouterOSTransport
|
|
318
|
+
│ ├── qnap/ # QNAP QSW
|
|
319
|
+
│ │ ├── client.py # QNAPSwitch
|
|
320
|
+
│ │ ├── rest.py # QNAPRESTTransport, QNAPMonitoringManager
|
|
321
|
+
│ │ └── utils.py # generate_enable_password()
|
|
322
|
+
│ └── netgear/ # Netgear (stub)
|
|
323
|
+
│ └── client.py # NetgearSwitch (NotImplementedError)
|
|
324
|
+
├── discovery/ # Network topology discovery
|
|
325
|
+
│ ├── __init__.py # Public API: NetworkTopologyScanner, MermaidGenerator, ...
|
|
326
|
+
│ ├── cli.py # Discovery CLI (networkmgmt-discover)
|
|
327
|
+
│ ├── models.py # Pydantic models: NetworkTopology, DiscoveredHost, ...
|
|
328
|
+
│ ├── _util.py # Shared helpers: _run_cmd, _validate_*, _strip_hostname
|
|
329
|
+
│ ├── oui.py # IEEE OUI database loading and vendor lookup
|
|
330
|
+
│ ├── categorize.py # Device category classification rules
|
|
331
|
+
│ ├── scanner.py # NetworkTopologyScanner (ARP, ping, nmap, DNS, traceroute)
|
|
332
|
+
│ ├── snmp.py # SnmpBridgeDiscovery (SNMP MAC table queries)
|
|
333
|
+
│ ├── lldp.py # LldpDiscovery (SSH + lldpctl)
|
|
334
|
+
│ └── mermaid.py # MermaidGenerator (flowchart diagram output)
|
|
335
|
+
└── snmp_vlan_dump/ # SNMP VLAN-port dump
|
|
336
|
+
├── __init__.py
|
|
337
|
+
├── cli.py # VLAN dump CLI (networkmgmt-vlan-dump)
|
|
338
|
+
├── collector.py # VlanDataCollector
|
|
339
|
+
├── formatters.py # TerminalFormatter, MarkdownFormatter
|
|
340
|
+
├── mermaid.py # VlanMermaidGenerator
|
|
341
|
+
└── snmp.py # SNMP operations
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## Adding a New Vendor
|
|
345
|
+
|
|
346
|
+
1. Create `networkmgmt/switchctrl/vendors/<name>/` with `__init__.py`, `client.py`, and optionally `managers.py`
|
|
347
|
+
2. Decorate your client class with `@register_vendor("<name>")`
|
|
348
|
+
3. Add `import networkmgmt.switchctrl.vendors.<name>` to `networkmgmt/switchctrl/vendors/__init__.py`
|
|
349
|
+
4. The CLI picks it up automatically via `list_vendors()`
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
## License
|
|
353
|
+
This project is licensed under the LGPL where applicable/possible — see [LICENSE.md](LICENSE.md). Some files/parts may use other licenses: [MIT](LICENSEMIT.md) | [GPL](LICENSEGPL.md) | [LGPL](LICENSELGPL.md). Always check per‑file headers/comments.
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
## Authors
|
|
357
|
+
- Repo owner (primary author)
|
|
358
|
+
- Additional attributions are noted inline in code comments
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
## Acknowledgments
|
|
362
|
+
- Inspirations and snippets are referenced in code comments where appropriate.
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
## ⚠️ Note
|
|
366
|
+
|
|
367
|
+
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.
|