unifi-network-maps 1.2.0__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.
- unifi_network_maps-1.2.0/CHANGELOG.md +26 -0
- unifi_network_maps-1.2.0/CONTRIBUTING.md +25 -0
- unifi_network_maps-1.2.0/LICENSE +21 -0
- unifi_network_maps-1.2.0/LICENSES.md +10 -0
- unifi_network_maps-1.2.0/MANIFEST.in +9 -0
- unifi_network_maps-1.2.0/PKG-INFO +160 -0
- unifi_network_maps-1.2.0/README.md +125 -0
- unifi_network_maps-1.2.0/RELEASING.md +28 -0
- unifi_network_maps-1.2.0/SECURITY.md +8 -0
- unifi_network_maps-1.2.0/pyproject.toml +81 -0
- unifi_network_maps-1.2.0/setup.cfg +4 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/__init__.py +1 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/__init__.py +0 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/__init__.py +0 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/access-point.svg +1 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/ISOPACKS_LICENSE +7 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/block.svg +23 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/cache.svg +48 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/cardterminal.svg +316 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/cloud.svg +89 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/cronjob.svg +409 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/cube.svg +24 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/desktop.svg +107 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/diamond.svg +23 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/dns.svg +46 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/document.svg +62 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/firewall.svg +200 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/function-module.svg +215 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/image.svg +65 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/laptop.svg +37 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/loadbalancer.svg +65 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/lock.svg +155 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/mail.svg +35 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/mailmultiple.svg +91 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/mobiledevice.svg +66 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/office.svg +136 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/package-module.svg +39 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/paymentcard.svg +92 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/plane.svg +1 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/printer.svg +122 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/pyramid.svg +28 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/queue.svg +38 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/router.svg +39 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/server.svg +112 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/speech.svg +70 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/sphere.svg +15 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/storage.svg +92 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/switch-module.svg +45 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/tower.svg +50 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/truck-2.svg +1 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/truck.svg +1 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/user.svg +231 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/isometric/vm.svg +50 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/laptop.svg +1 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/router-network.svg +1 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/server-network.svg +1 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/assets/icons/server.svg +1 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/cli.py +197 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/config.py +43 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/debug.py +50 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/export.py +13 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/labels.py +15 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/lldp.py +99 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/mermaid.py +161 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/svg.py +836 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/topology.py +540 -0
- unifi_network_maps-1.2.0/src/unifi_mermaid/unifi.py +134 -0
- unifi_network_maps-1.2.0/src/unifi_network_maps.egg-info/PKG-INFO +160 -0
- unifi_network_maps-1.2.0/src/unifi_network_maps.egg-info/SOURCES.txt +84 -0
- unifi_network_maps-1.2.0/src/unifi_network_maps.egg-info/dependency_links.txt +1 -0
- unifi_network_maps-1.2.0/src/unifi_network_maps.egg-info/entry_points.txt +2 -0
- unifi_network_maps-1.2.0/src/unifi_network_maps.egg-info/requires.txt +8 -0
- unifi_network_maps-1.2.0/src/unifi_network_maps.egg-info/top_level.txt +1 -0
- unifi_network_maps-1.2.0/tests/test_cli.py +193 -0
- unifi_network_maps-1.2.0/tests/test_clients.py +50 -0
- unifi_network_maps-1.2.0/tests/test_config.py +52 -0
- unifi_network_maps-1.2.0/tests/test_debug.py +46 -0
- unifi_network_maps-1.2.0/tests/test_export.py +12 -0
- unifi_network_maps-1.2.0/tests/test_groups.py +32 -0
- unifi_network_maps-1.2.0/tests/test_labels.py +21 -0
- unifi_network_maps-1.2.0/tests/test_lldp.py +21 -0
- unifi_network_maps-1.2.0/tests/test_mermaid.py +78 -0
- unifi_network_maps-1.2.0/tests/test_svg.py +235 -0
- unifi_network_maps-1.2.0/tests/test_svg_iso.py +67 -0
- unifi_network_maps-1.2.0/tests/test_topology.py +453 -0
- unifi_network_maps-1.2.0/tests/test_unifi.py +153 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## Unreleased
|
|
6
|
+
- TBD.
|
|
7
|
+
|
|
8
|
+
## v1.1.0
|
|
9
|
+
- Added isometric SVG output with grid-aligned links and isometric icon set.
|
|
10
|
+
- Improved port label placement and client labeling in SVG outputs.
|
|
11
|
+
- Added smoketest target with multiple outputs (ports/clients/legend).
|
|
12
|
+
- Added UniFi API response caching with TTL.
|
|
13
|
+
- Fixed Mermaid legend/grouped output parsing errors.
|
|
14
|
+
- Refined visuals: link gradients, tile gradients, icon placement tweaks.
|
|
15
|
+
|
|
16
|
+
## v1.0.0
|
|
17
|
+
- Mermaid legend can render as a separate graph.
|
|
18
|
+
- Straight Mermaid links with node type coloring.
|
|
19
|
+
- Added wired client leaf nodes and uplink port labels.
|
|
20
|
+
- Expanded PoE detection tests and LLDP helpers.
|
|
21
|
+
- CLI loads `.env` automatically.
|
|
22
|
+
|
|
23
|
+
## v0.2.0
|
|
24
|
+
- Added versioning workflow and bump tooling.
|
|
25
|
+
- Introduced SVG renderer and tree layout fixes.
|
|
26
|
+
- Increased test coverage and added coverage tooling.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for considering a contribution!
|
|
4
|
+
|
|
5
|
+
## Development setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
python -m venv .venv
|
|
9
|
+
source .venv/bin/activate
|
|
10
|
+
pip install -e ".[dev]"
|
|
11
|
+
pre-commit install
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Running checks
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
ruff check .
|
|
18
|
+
pytest
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Guidelines
|
|
22
|
+
|
|
23
|
+
- Keep changes focused and small.
|
|
24
|
+
- Add or update tests where behavior changes.
|
|
25
|
+
- Run `ruff` and `pytest` before opening a PR.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Merlijn Tishauser
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include CHANGELOG.md
|
|
4
|
+
include SECURITY.md
|
|
5
|
+
include CONTRIBUTING.md
|
|
6
|
+
include LICENSES.md
|
|
7
|
+
include RELEASING.md
|
|
8
|
+
recursive-include src/unifi_mermaid/assets/icons *.svg
|
|
9
|
+
recursive-include src/unifi_mermaid/assets/icons/isometric ISOPACKS_LICENSE
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unifi-network-maps
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Dynamic UniFi -> Mermaid network maps
|
|
5
|
+
Author: Merlijn
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/merlijntishauser/unifi-network-maps
|
|
8
|
+
Project-URL: Repository, https://github.com/merlijntishauser/unifi-network-maps
|
|
9
|
+
Project-URL: Issues, https://github.com/merlijntishauser/unifi-network-maps/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/merlijntishauser/unifi-network-maps/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: unifi,mermaid,network,topology,diagram,svg
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Documentation
|
|
22
|
+
Classifier: Topic :: System :: Networking
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
License-File: LICENSES.md
|
|
27
|
+
Requires-Dist: unifi-controller-api
|
|
28
|
+
Requires-Dist: python-dotenv
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# unifi-network-maps
|
|
37
|
+
|
|
38
|
+
Dynamic UniFi -> Mermaid network maps generated from LLDP topology.
|
|
39
|
+
|
|
40
|
+
## Setup
|
|
41
|
+
|
|
42
|
+
- Python >= 3.10
|
|
43
|
+
- Virtualenv required
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
python -m venv .venv
|
|
47
|
+
source .venv/bin/activate
|
|
48
|
+
pip install -e .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Local install (non-editable):
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
Set environment variables (no secrets in code). The CLI loads `.env` automatically if present:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
export UNIFI_URL=https://192.168.1.1
|
|
63
|
+
export UNIFI_SITE=default
|
|
64
|
+
export UNIFI_USER=local_admin
|
|
65
|
+
export UNIFI_PASS=********
|
|
66
|
+
export UNIFI_VERIFY_SSL=false
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
Basic map (tree layout by LLDP hops):
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
unifi-network-maps --stdout
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Write Markdown for notes tools:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
unifi-network-maps --markdown --output ./network.md
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Show ports + clients:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
unifi-network-maps --include-ports --include-clients --stdout
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
SVG output (orthogonal layout + icons):
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
unifi-network-maps --format svg --output ./network.svg
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Isometric SVG output:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
unifi-network-maps --format svg-iso --output ./network.svg
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
SVG size overrides:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
unifi-network-maps --format svg --svg-width 1400 --svg-height 900 --output ./network.svg
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Legend only:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
unifi-network-maps --legend-only --stdout
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Local install check
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
pip install .
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Release
|
|
120
|
+
|
|
121
|
+
Build and upload to PyPI:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
python -m pip install build twine
|
|
125
|
+
python -m build
|
|
126
|
+
twine upload dist/*
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Tagging is recommended before release:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git tag -a vX.Y.Z -m "vX.Y.Z"
|
|
133
|
+
git push origin vX.Y.Z
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
See `LICENSES.md` for third-party license info.
|
|
137
|
+
|
|
138
|
+
## Options
|
|
139
|
+
|
|
140
|
+
- `--format mermaid|svg|svg-iso`: output format (default mermaid).
|
|
141
|
+
- `--include-ports`: show port labels (Mermaid shows both ends; SVG shows compact labels).
|
|
142
|
+
- `--only-unifi`: only include neighbors that are UniFi devices.
|
|
143
|
+
- `--direction LR|TB`: diagram direction for Mermaid (default TB).
|
|
144
|
+
- `--stdout`: write output to stdout.
|
|
145
|
+
- `--markdown`: wrap Mermaid output in a code fence.
|
|
146
|
+
- `--group-by-type`: group nodes by gateway/switch/AP in Mermaid subgraphs.
|
|
147
|
+
- `--include-clients`: add active wired clients as leaf nodes.
|
|
148
|
+
- `--legend-only`: render just the legend as a separate Mermaid graph (Mermaid only).
|
|
149
|
+
- `--debug-dump`: dump gateway + sample devices to stderr for debugging.
|
|
150
|
+
- `--debug-sample N`: number of non-gateway devices in debug dump (default 2).
|
|
151
|
+
- `--svg-width/--svg-height`: override SVG output dimensions.
|
|
152
|
+
|
|
153
|
+
## Notes
|
|
154
|
+
|
|
155
|
+
- Default output is top-to-bottom (TB) and rendered as a hop-based tree from the gateway(s).
|
|
156
|
+
- Nodes are color-coded by type (gateway/switch/AP/client) with a sensible default palette.
|
|
157
|
+
- PoE links are highlighted in blue and annotated with a power icon when detected from `port_table`.
|
|
158
|
+
- SVG output uses vendored device glyphs from `src/unifi_mermaid/assets/icons`.
|
|
159
|
+
- Isometric SVG output uses MIT-licensed icons from `markmanx/isopacks`.
|
|
160
|
+
- SVG port labels render inside child nodes for readability.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# unifi-network-maps
|
|
2
|
+
|
|
3
|
+
Dynamic UniFi -> Mermaid network maps generated from LLDP topology.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
- Python >= 3.10
|
|
8
|
+
- Virtualenv required
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
python -m venv .venv
|
|
12
|
+
source .venv/bin/activate
|
|
13
|
+
pip install -e .
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Local install (non-editable):
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install .
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Configuration
|
|
23
|
+
|
|
24
|
+
Set environment variables (no secrets in code). The CLI loads `.env` automatically if present:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
export UNIFI_URL=https://192.168.1.1
|
|
28
|
+
export UNIFI_SITE=default
|
|
29
|
+
export UNIFI_USER=local_admin
|
|
30
|
+
export UNIFI_PASS=********
|
|
31
|
+
export UNIFI_VERIFY_SSL=false
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
Basic map (tree layout by LLDP hops):
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
unifi-network-maps --stdout
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Write Markdown for notes tools:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
unifi-network-maps --markdown --output ./network.md
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Show ports + clients:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
unifi-network-maps --include-ports --include-clients --stdout
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
SVG output (orthogonal layout + icons):
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
unifi-network-maps --format svg --output ./network.svg
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Isometric SVG output:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
unifi-network-maps --format svg-iso --output ./network.svg
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
SVG size overrides:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
unifi-network-maps --format svg --svg-width 1400 --svg-height 900 --output ./network.svg
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Legend only:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
unifi-network-maps --legend-only --stdout
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Local install check
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install .
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Release
|
|
85
|
+
|
|
86
|
+
Build and upload to PyPI:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
python -m pip install build twine
|
|
90
|
+
python -m build
|
|
91
|
+
twine upload dist/*
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Tagging is recommended before release:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
git tag -a vX.Y.Z -m "vX.Y.Z"
|
|
98
|
+
git push origin vX.Y.Z
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
See `LICENSES.md` for third-party license info.
|
|
102
|
+
|
|
103
|
+
## Options
|
|
104
|
+
|
|
105
|
+
- `--format mermaid|svg|svg-iso`: output format (default mermaid).
|
|
106
|
+
- `--include-ports`: show port labels (Mermaid shows both ends; SVG shows compact labels).
|
|
107
|
+
- `--only-unifi`: only include neighbors that are UniFi devices.
|
|
108
|
+
- `--direction LR|TB`: diagram direction for Mermaid (default TB).
|
|
109
|
+
- `--stdout`: write output to stdout.
|
|
110
|
+
- `--markdown`: wrap Mermaid output in a code fence.
|
|
111
|
+
- `--group-by-type`: group nodes by gateway/switch/AP in Mermaid subgraphs.
|
|
112
|
+
- `--include-clients`: add active wired clients as leaf nodes.
|
|
113
|
+
- `--legend-only`: render just the legend as a separate Mermaid graph (Mermaid only).
|
|
114
|
+
- `--debug-dump`: dump gateway + sample devices to stderr for debugging.
|
|
115
|
+
- `--debug-sample N`: number of non-gateway devices in debug dump (default 2).
|
|
116
|
+
- `--svg-width/--svg-height`: override SVG output dimensions.
|
|
117
|
+
|
|
118
|
+
## Notes
|
|
119
|
+
|
|
120
|
+
- Default output is top-to-bottom (TB) and rendered as a hop-based tree from the gateway(s).
|
|
121
|
+
- Nodes are color-coded by type (gateway/switch/AP/client) with a sensible default palette.
|
|
122
|
+
- PoE links are highlighted in blue and annotated with a power icon when detected from `port_table`.
|
|
123
|
+
- SVG output uses vendored device glyphs from `src/unifi_mermaid/assets/icons`.
|
|
124
|
+
- Isometric SVG output uses MIT-licensed icons from `markmanx/isopacks`.
|
|
125
|
+
- SVG port labels render inside child nodes for readability.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Releasing
|
|
2
|
+
|
|
3
|
+
## Checklist
|
|
4
|
+
|
|
5
|
+
1) Ensure `README.md`, `CHANGELOG.md`, and `VERSION` are up to date.
|
|
6
|
+
2) Run tests and lint locally:
|
|
7
|
+
```bash
|
|
8
|
+
ruff check .
|
|
9
|
+
pytest
|
|
10
|
+
```
|
|
11
|
+
3) Build the package:
|
|
12
|
+
```bash
|
|
13
|
+
python -m pip install build twine
|
|
14
|
+
python -m build
|
|
15
|
+
```
|
|
16
|
+
4) Inspect the artifacts:
|
|
17
|
+
```bash
|
|
18
|
+
python -m twine check dist/*
|
|
19
|
+
```
|
|
20
|
+
5) Tag the release:
|
|
21
|
+
```bash
|
|
22
|
+
git tag -a vX.Y.Z -m "vX.Y.Z"
|
|
23
|
+
git push origin vX.Y.Z
|
|
24
|
+
```
|
|
25
|
+
6) Upload to PyPI:
|
|
26
|
+
```bash
|
|
27
|
+
twine upload dist/*
|
|
28
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting a Vulnerability
|
|
4
|
+
|
|
5
|
+
Please report security issues by opening a private advisory or emailing the maintainer.
|
|
6
|
+
If you are unsure, open a GitHub issue and note that you can provide details privately.
|
|
7
|
+
|
|
8
|
+
We aim to respond within 7 days.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "unifi-network-maps"
|
|
7
|
+
version = "1.2.0"
|
|
8
|
+
description = "Dynamic UniFi -> Mermaid network maps"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Merlijn" }]
|
|
13
|
+
keywords = ["unifi", "mermaid", "network", "topology", "diagram", "svg"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: System Administrators",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Topic :: Documentation",
|
|
25
|
+
"Topic :: System :: Networking",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"unifi-controller-api",
|
|
29
|
+
"python-dotenv",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://github.com/merlijntishauser/unifi-network-maps"
|
|
34
|
+
Repository = "https://github.com/merlijntishauser/unifi-network-maps"
|
|
35
|
+
Issues = "https://github.com/merlijntishauser/unifi-network-maps/issues"
|
|
36
|
+
Changelog = "https://github.com/merlijntishauser/unifi-network-maps/blob/main/CHANGELOG.md"
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
dev = [
|
|
40
|
+
"pre-commit",
|
|
41
|
+
"pytest",
|
|
42
|
+
"pytest-cov",
|
|
43
|
+
"ruff",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
unifi-network-maps = "unifi_mermaid.cli:main"
|
|
48
|
+
|
|
49
|
+
[tool.ruff]
|
|
50
|
+
line-length = 100
|
|
51
|
+
target-version = "py310"
|
|
52
|
+
|
|
53
|
+
[tool.ruff.lint]
|
|
54
|
+
select = ["E", "F", "I", "B", "UP"]
|
|
55
|
+
ignore = ["E501"]
|
|
56
|
+
|
|
57
|
+
[tool.ruff.format]
|
|
58
|
+
line-ending = "lf"
|
|
59
|
+
|
|
60
|
+
[tool.pytest.ini_options]
|
|
61
|
+
testpaths = ["tests"]
|
|
62
|
+
|
|
63
|
+
[tool.coverage.run]
|
|
64
|
+
branch = true
|
|
65
|
+
source = ["unifi_mermaid"]
|
|
66
|
+
|
|
67
|
+
[tool.coverage.report]
|
|
68
|
+
show_missing = true
|
|
69
|
+
|
|
70
|
+
[tool.setuptools]
|
|
71
|
+
package-dir = {"" = "src"}
|
|
72
|
+
|
|
73
|
+
[tool.setuptools.package-data]
|
|
74
|
+
"unifi_mermaid" = [
|
|
75
|
+
"assets/icons/*.svg",
|
|
76
|
+
"assets/icons/isometric/*.svg",
|
|
77
|
+
"assets/icons/isometric/ISOPACKS_LICENSE",
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[tool.setuptools.packages.find]
|
|
81
|
+
where = ["src"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.2.0"
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" id="mdi-access-point" viewBox="0 0 24 24"><path d="M4.93,4.93C3.12,6.74 2,9.24 2,12C2,14.76 3.12,17.26 4.93,19.07L6.34,17.66C4.89,16.22 4,14.22 4,12C4,9.79 4.89,7.78 6.34,6.34L4.93,4.93M19.07,4.93L17.66,6.34C19.11,7.78 20,9.79 20,12C20,14.22 19.11,16.22 17.66,17.66L19.07,19.07C20.88,17.26 22,14.76 22,12C22,9.24 20.88,6.74 19.07,4.93M7.76,7.76C6.67,8.85 6,10.35 6,12C6,13.65 6.67,15.15 7.76,16.24L9.17,14.83C8.45,14.11 8,13.11 8,12C8,10.89 8.45,9.89 9.17,9.17L7.76,7.76M16.24,7.76L14.83,9.17C15.55,9.89 16,10.89 16,12C16,13.11 15.55,14.11 14.83,14.83L16.24,16.24C17.33,15.15 18,13.65 18,12C18,10.35 17.33,8.85 16.24,7.76M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10Z" /></svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2023 Mark Mankarious
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS 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.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
3
|
+
width="551.59998px" height="343.79999px" viewBox="0 0 551.59998 343.79999"
|
|
4
|
+
style="enable-background:new 0 0 551.59998 343.79999;" xml:space="preserve">
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
.st0{opacity:0.4;enable-background:new ;}
|
|
7
|
+
.st1{fill:#CDD9EE;}
|
|
8
|
+
.st2{fill:#B5C5DC;}
|
|
9
|
+
.st3{fill:#FFFFFF;}
|
|
10
|
+
.st4{fill:#6885A9;}
|
|
11
|
+
.st5{fill:#231F20;}
|
|
12
|
+
</style>
|
|
13
|
+
<g>
|
|
14
|
+
<polygon class="st0" points="309.29999,322.89999 274.60001,316.10001 274,16.2 551.59998,180 "/>
|
|
15
|
+
<polygon class="st1" points="274.60001,228.8 92.2,119.2 274,9.7 457,119.2 "/>
|
|
16
|
+
<polygon class="st2" points="90.2,195 274.60001,305.79999 274.60001,305.79999 274.60001,231.3 90.2,120.4 "/>
|
|
17
|
+
<polygon class="st3" points="288.29999,220.60001 135.7,127.7 303,27 274,9.7 92.2,119.2 274.60001,228.8 "/>
|
|
18
|
+
<polygon class="st4" points="459,195 274.60001,305.79999 274.60001,305.79999 274.60001,231.3 459,120.4 "/>
|
|
19
|
+
<path class="st5" d="M467.20001,115.6L467.20001,115.6L274,0L83.00002,115.1l-1,0.6v83.7l192.59998,115.80002L466.20001,200
|
|
20
|
+
l1-0.60001V115.6z M274,9.7l183,109.5L274.60001,228.8L92.20001,119.2L274,9.7z M457,124.1v69.69999L276.70001,302.20001V232.5
|
|
21
|
+
L457,124.1z M272.60001,232.39999v69.69998L92.30001,193.8v-69.7L272.60001,232.39999z"/>
|
|
22
|
+
</g>
|
|
23
|
+
</svg>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 25.3.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
width="55.1px" height="57.3px" viewBox="0 0 55.1 57.3" enable-background="new 0 0 55.1 57.3" xml:space="preserve">
|
|
5
|
+
<g id="Layer_3">
|
|
6
|
+
</g>
|
|
7
|
+
<g id="Layer_4">
|
|
8
|
+
</g>
|
|
9
|
+
<g id="Layer_10">
|
|
10
|
+
<g opacity="0.4" fill="#000000">
|
|
11
|
+
<polygon points="35.6,46 38.3,48.1 25.6,52.1 21.2,53 32,38.9 41.4,44.8 "/>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
<g id="Layer_7">
|
|
15
|
+
</g>
|
|
16
|
+
<g id="Layer_6">
|
|
17
|
+
<polygon fill="#F2C256" points="31.6,19 18.4,11.1 18.4,33.9 21.2,35.5 21.2,52.1 31.6,31.5 26,28.1 "/>
|
|
18
|
+
<polygon fill="#FFE4AE" points="18.4,33.9 18.5,33.9 25.6,15.4 18.4,11.1 "/>
|
|
19
|
+
<polygon fill="none" stroke="#010202" stroke-width="0.5" stroke-linejoin="round" stroke-miterlimit="10" points="31.6,19
|
|
20
|
+
18.4,11.1 18.4,33.9 21.2,35.5 21.2,52.1 31.6,31.5 26,28.1 "/>
|
|
21
|
+
</g>
|
|
22
|
+
<g id="Layer_5">
|
|
23
|
+
<polygon fill="#F7C56B" stroke="#010202" stroke-width="0.4" stroke-linejoin="round" stroke-miterlimit="10" points="18.4,11.1
|
|
24
|
+
24.5,7.4 37.6,15.3 32,24.3 37.6,27.7 27.2,48.3 21.2,52.1 31.6,31.5 26,28.1 31.6,19 "/>
|
|
25
|
+
<polygon fill="#754F0C" stroke="#010202" stroke-width="0.4" stroke-miterlimit="10" points="37.6,15.3 31.6,19 26,28.1 31.6,31.5
|
|
26
|
+
21.2,52.1 27.2,48.3 37.6,27.7 32,24.3 "/>
|
|
27
|
+
<g id="Layer_12">
|
|
28
|
+
</g>
|
|
29
|
+
<polygon fill="none" stroke="#010202" stroke-width="0.4" stroke-linejoin="round" stroke-miterlimit="10" points="18.4,11.1
|
|
30
|
+
24.5,7.4 37.6,15.3 32,24.3 37.6,27.7 27.2,48.3 21.2,52.1 31.6,31.5 26,28.1 31.6,19 "/>
|
|
31
|
+
</g>
|
|
32
|
+
<g id="Layer_8">
|
|
33
|
+
<polygon fill="#AF7A2E" stroke="#010202" stroke-width="0.4" stroke-linejoin="round" stroke-miterlimit="10" points="31.6,31.5
|
|
34
|
+
37.6,27.7 32,24.3 26,28.1 "/>
|
|
35
|
+
</g>
|
|
36
|
+
<g id="Layer_11">
|
|
37
|
+
<polyline fill="none" stroke="#010202" stroke-width="0.4" stroke-linejoin="round" stroke-miterlimit="10" points="37.6,15.3
|
|
38
|
+
31.6,19 26,28.1 32,24.3 37.6,15.3 "/>
|
|
39
|
+
</g>
|
|
40
|
+
<g id="Layer_9">
|
|
41
|
+
<g>
|
|
42
|
+
<path fill="#010202" d="M24.5,7.4l13.2,7.9l-5.7,9l5.6,3.4L27.2,48.3l-6,3.7V35.5l-2.7-1.6V11.1L24.5,7.4 M24.5,6.6
|
|
43
|
+
c-0.1,0-0.3,0-0.4,0.1l-6,3.7c-0.2,0.1-0.4,0.4-0.4,0.7v22.8c0,0.3,0.1,0.5,0.4,0.7l2.3,1.4v16.1c0,0.3,0.2,0.6,0.4,0.7
|
|
44
|
+
c0.1,0.1,0.3,0.1,0.4,0.1s0.3,0,0.4-0.1l6-3.7c0.1-0.1,0.2-0.2,0.3-0.3l10.4-20.6c0.2-0.4,0.1-0.8-0.3-1l-4.9-3l5.2-8.4
|
|
45
|
+
c0.1-0.2,0.1-0.4,0.1-0.6c-0.1-0.2-0.2-0.4-0.4-0.5l-13.1-8C24.7,6.6,24.6,6.6,24.5,6.6L24.5,6.6z"/>
|
|
46
|
+
</g>
|
|
47
|
+
</g>
|
|
48
|
+
</svg>
|