netbox-cable-canvas 0.10.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.
Files changed (29) hide show
  1. netbox_cable_canvas-0.10.0/CHANGELOG.md +72 -0
  2. netbox_cable_canvas-0.10.0/LICENSE +201 -0
  3. netbox_cable_canvas-0.10.0/MANIFEST.in +5 -0
  4. netbox_cable_canvas-0.10.0/PKG-INFO +142 -0
  5. netbox_cable_canvas-0.10.0/README.md +120 -0
  6. netbox_cable_canvas-0.10.0/netbox_cable_canvas/__init__.py +22 -0
  7. netbox_cable_canvas-0.10.0/netbox_cable_canvas/forms.py +44 -0
  8. netbox_cable_canvas-0.10.0/netbox_cable_canvas/navigation.py +30 -0
  9. netbox_cable_canvas-0.10.0/netbox_cable_canvas/static/netbox_cable_canvas/canvas.css +171 -0
  10. netbox_cable_canvas-0.10.0/netbox_cable_canvas/static/netbox_cable_canvas/canvas.js +2181 -0
  11. netbox_cable_canvas-0.10.0/netbox_cable_canvas/static/netbox_cable_canvas/common.js +515 -0
  12. netbox_cable_canvas-0.10.0/netbox_cable_canvas/static/netbox_cable_canvas/health.css +21 -0
  13. netbox_cable_canvas-0.10.0/netbox_cable_canvas/static/netbox_cable_canvas/health.js +348 -0
  14. netbox_cable_canvas-0.10.0/netbox_cable_canvas/static/netbox_cable_canvas/tracemap.css +83 -0
  15. netbox_cable_canvas-0.10.0/netbox_cable_canvas/static/netbox_cable_canvas/tracemap.js +997 -0
  16. netbox_cable_canvas-0.10.0/netbox_cable_canvas/template_content.py +24 -0
  17. netbox_cable_canvas-0.10.0/netbox_cable_canvas/templates/netbox_cable_canvas/canvas.html +267 -0
  18. netbox_cable_canvas-0.10.0/netbox_cable_canvas/templates/netbox_cable_canvas/health.html +67 -0
  19. netbox_cable_canvas-0.10.0/netbox_cable_canvas/templates/netbox_cable_canvas/tracemap.html +134 -0
  20. netbox_cable_canvas-0.10.0/netbox_cable_canvas/urls.py +9 -0
  21. netbox_cable_canvas-0.10.0/netbox_cable_canvas/version.py +1 -0
  22. netbox_cable_canvas-0.10.0/netbox_cable_canvas/views.py +200 -0
  23. netbox_cable_canvas-0.10.0/netbox_cable_canvas.egg-info/PKG-INFO +142 -0
  24. netbox_cable_canvas-0.10.0/netbox_cable_canvas.egg-info/SOURCES.txt +27 -0
  25. netbox_cable_canvas-0.10.0/netbox_cable_canvas.egg-info/dependency_links.txt +1 -0
  26. netbox_cable_canvas-0.10.0/netbox_cable_canvas.egg-info/entry_points.txt +2 -0
  27. netbox_cable_canvas-0.10.0/netbox_cable_canvas.egg-info/top_level.txt +1 -0
  28. netbox_cable_canvas-0.10.0/pyproject.toml +44 -0
  29. netbox_cable_canvas-0.10.0/setup.cfg +4 -0
@@ -0,0 +1,72 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.10.0] - 2026-12-01
11
+
12
+ First release on PyPI.
13
+
14
+ ### Changed
15
+
16
+ - Packaging prepared for PyPI: project metadata, `netbox.plugins` entry point, LICENSE, single
17
+ version source in `netbox_cable_canvas/version.py`, GitHub release workflow.
18
+ - Supported NetBox versions are now declared as 4.7.0 to 4.7.99 (was 4.2.0 and later, untested).
19
+ Python 3.12 or later.
20
+ - The three pages now require the same permissions as their menu entries (`dcim.view_device`,
21
+ plus `dcim.view_cable` for Trace Map and Health). A logged-in user without them gets 403.
22
+ - The Health scan runs at most six API requests at a time and says when the findings table is
23
+ cut at 1000 rows.
24
+ - `{seq}` only counts existing labels of the same shape and reads just `id` and `label`.
25
+ - Demo seed script: neutral names, refuses to add ports or cables to objects that are not demo
26
+ data, `--delete` asks for confirmation (`--yes` to skip) and also removes its helper tags.
27
+
28
+ ### Fixed
29
+
30
+ - Trace Map lost the label, type and colour of every cable when one path was incomplete.
31
+ - Trace Map could show the paths of a previously selected device.
32
+ - Bulk labelling wrote labels without the site for cable ends outside the scanned scope, and
33
+ applied a stale preview when the template was invalid.
34
+ - `{seq}` restarted at 1 when the lookup of existing labels failed.
35
+ - Cable Canvas went blank when a single port type could not be loaded (HTTP 403).
36
+ - A failed circuit rollback reported "Nothing was created" while objects were left behind.
37
+ - Undo lost its newest entry when pressed during another operation, and a restored cable lost
38
+ its tenant, owner, profile and custom fields.
39
+ - CSV exports wrote cells starting with `=`, `+`, `-` or `@` as they were, so a spreadsheet
40
+ would run them as formulas.
41
+ - Links ignored `BASE_PATH`.
42
+ - Demo seed script failed when a device type already existed under another slug.
43
+
44
+ ### Added
45
+
46
+ - Tests for the label templates (`node --test`) and a CI job that runs them.
47
+
48
+ ## [0.9.0] - 2026-11-22
49
+
50
+ ### Added
51
+
52
+ - draw.io export of the canvas and the trace map.
53
+ - Inventory coverage overlay on the rack elevation (needs the inventory-monitor plugin).
54
+
55
+ ## [0.7.0] - 2026-11-22
56
+
57
+ ### Added
58
+
59
+ - Cable label templates, Cabling Health page, rack elevation, trace map export and site / rack
60
+ topology, demo data script.
61
+
62
+ ## [0.6.0] - 2026-11-22
63
+
64
+ ### Added
65
+
66
+ - Cable Trace Map page, circuit creation in Cable Canvas.
67
+
68
+ ## [0.5.0] - 2026-11-22
69
+
70
+ ### Added
71
+
72
+ - Trace, bulk, breakout, drafts, warnings, rack / circuit / power views, exports.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 CESNET
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ recursive-include netbox_cable_canvas/templates *
5
+ recursive-include netbox_cable_canvas/static *
@@ -0,0 +1,142 @@
1
+ Metadata-Version: 2.4
2
+ Name: netbox-cable-canvas
3
+ Version: 0.10.0
4
+ Summary: Visual cable editor for NetBox: pick two devices, click two ports, get a cable.
5
+ Author: Jan Krupa
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/CESNET/netbox-cable-manager
8
+ Project-URL: Source, https://github.com/CESNET/netbox-cable-manager
9
+ Project-URL: Issues, https://github.com/CESNET/netbox-cable-manager/issues
10
+ Keywords: netbox,netbox-plugin,cabling
11
+ Classifier: Intended Audience :: System Administrators
12
+ Classifier: Framework :: Django
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Python: >=3.12
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Dynamic: license-file
22
+
23
+ # NetBox Cable Canvas
24
+
25
+ A visual cable editor for NetBox 4.7: pick two devices, see their ports, click two ports to create a cable.
26
+
27
+ ## Features
28
+
29
+ **Choosing what to see**
30
+ - Its own **Cabling** section in the left menu (Cable Canvas, Cable Trace Map, Cabling Health), plus Cable Canvas and Trace Map buttons on every device page.
31
+ - **Filters** (Site, Location, Rack, Role, Manufacturer, Tenant) using NetBox's own dropdowns.
32
+ - **Two ends** view: Device A plus a device, **circuit** (carrier hand-off) or **power panel** (power feeds) as B.
33
+ - **Rack** view: every device in a rack, either as a real **rack elevation** (devices at their U positions and heights, ports in the device face, cables routed through a cable manager, front/rear filter) or stacked.
34
+ - **Side by side** or **Stacked** layout, **odd/even rows** like real switch faceplates, ports **grouped by module/line card**.
35
+ - **Per-device port-type toggles**: interfaces, front, rear, console, power…
36
+
37
+ **Cabling**
38
+ - **Single**: click or **drag** a free port onto a compatible port.
39
+ - **Bulk**: Shift-click ranges on both sides; map them in order, reversed, or odd ports first; preview, then create them all at once.
40
+ - **Breakout / trunk**: one cable with several ends per side (40G→4×10G, MPO trunks).
41
+ - **Draft mode**: collect cables as drafts, review them, then create or discard them together.
42
+ - **Warnings before creating** (never blocking): RJ45↔SFP, speed mismatch, disabled or management-only interface, copper↔fiber connectors, cable type vs port medium, rear-port position count mismatch.
43
+ - **Undo** (button or Ctrl/Cmd+Z) for creates, bulk batches and deletes.
44
+ - New cable fields: status, type, tags, label, color, length + unit, description, **change reference** (saved in comments).
45
+
46
+ **Understanding what's there**
47
+ - **Trace**: click a cabled port → Trace; shows every hop (through patch panels) and highlights the path on the canvas.
48
+ - Tooltips: speed, enabled, LAG, module, cable type/length/color, link peer and **far end**.
49
+ - Hover a front port to see its rear port (and position), and the other way round.
50
+ - **Find port** by name or description.
51
+
52
+ **Cable labels from your own template**
53
+ - Tick **Auto** next to Label and every new cable (single, bulk, breakout, drafts, circuits) gets a label from your template, for example `{site|upper}-{a_rack}-{seq:04}`.
54
+ - Tokens: `{site}` `{location}` `{rack}` `{a_device}` `{b_device}` `{a_port}` `{b_port}` `{a_rack}` `{b_rack}` `{a_u}` `{b_u}` `{type}` `{color}` `{date}` `{seq}` (`{seq:04}` pads). Filters: `|upper` `|lower` `|slug` `|short` (Gi1/0/1) `|nospace`.
55
+ - `{seq}` continues from the highest number already used in NetBox for that prefix.
56
+ - Edit with live preview from the ⚙ button. Your template is saved in your NetBox user preferences. Admins can set the default in `PLUGINS_CONFIG`:
57
+ ```python
58
+ PLUGINS_CONFIG = {"netbox_cable_canvas": {"label_template": "{site|upper}-{seq:05}"}}
59
+ ```
60
+
61
+ **Circuits**
62
+ - Switch *Create* from **Cable** to **Circuit**, click a port on each device, and fill in provider, type and circuit ID. This creates the circuit, its A/Z terminations (at each device's site or location) and the two cables in one step. If any step fails, everything already created is removed again, and Undo removes the whole circuit.
63
+
64
+ **Cable Trace Map** (Cabling → Cable Trace Map, or the *Trace Map* button on a device)
65
+ - Pick a device and every cabled port on it is traced end to end.
66
+ - **Map**: the device and everything its cables reach, laid out left to right by hop count, with patch panels (dashed purple), circuits (orange) and power panels in between. Click a device or link to filter the list; double-click to open it.
67
+ - **Paths**: one row per path, hop by hop. Each stop shows the ports in and out (e.g. *front 5 ⇢ R1*), and each wire shows the cable's color, label, type and length. Planned cables are dashed.
68
+ - Filter by port type, complete/incomplete, or text (device, port, cable label). Export to CSV, or jump to Cable Canvas for any path.
69
+
70
+ **Cabling Health** (Cabling → Cabling Health)
71
+ - Choose a scope (site, location, rack, role, manufacturer, tenant) and scan. It finds incomplete paths, patch panel ports cabled on only one side, mismatched cables (speed, connector, media, disabled or management-only ports, also checking far ends outside the scope), duplicate labels, cables without a label or type, and ports marked connected with no cable.
72
+ - Click a card to filter. Every finding links to the cable, to Cable Canvas with both devices loaded, and to the Trace Map. Export to CSV.
73
+ - **Label all unlabeled cables** from your template in one go, with a preview first.
74
+
75
+ **Support coverage on the rack elevation**
76
+ - If the CESNET inventory-monitor plugin is installed, a **Coverage** button in the rack elevation colors every device by its main asset's warranty / service contract status (covered, expiring within 60 days, expired, no record). Inventory Insights links straight to it.
77
+
78
+ **Trace Map extras**
79
+ - **Export** the map as SVG or PNG, open a printable page (map + paths) to save as PDF, or download an editable **draw.io** file. In device mode it has two pages: *Map*, and *Paths* with one row per path, hop by hop. In site/rack mode it has the topology, with nodes where you dragged them.
80
+ - **Site / rack topology**: every device matching the filters, laid out automatically (grouped by rack), coloured by device role, with patch panels, circuits and outside devices marked. Choose **Physical cables** (every cable, panels as nodes) or **End to end** (device to device straight through panels). Drag nodes, zoom, pan, click for details, double-click a device for its own Trace Map.
81
+
82
+ **Output**
83
+ - **draw.io** export of exactly what's on screen (stacked, side by side, or rack elevation). Devices are containers with their ports inside, cables are real connectors in their NetBox colour (dashed if planned), and every device and cable links back to NetBox. Open it in diagrams.net or the draw.io desktop app and edit it freely.
84
+ - **CSV** of the cables shown, a printable **patch schedule** (with a tick column and change ref), and printable **cable labels** (one per cable end).
85
+
86
+ Colors: green = free, blue = cabled here, amber = cabled elsewhere, purple = draft, grey = marked connected or virtual.
87
+
88
+ Everything goes through NetBox's REST API with your logged-in session, so NetBox permissions and validation apply. Users who can't add or delete cables don't see those controls.
89
+
90
+ ## Requirements
91
+
92
+ NetBox 4.7.
93
+
94
+ ## Install
95
+
96
+ ```bash
97
+ pip install netbox-cable-canvas
98
+ ```
99
+
100
+ Then add `"netbox_cable_canvas"` to `PLUGINS` in your NetBox configuration and run `manage.py collectstatic`. The plugin has no models, so there are no migrations.
101
+
102
+ ## Install with netbox-docker
103
+
104
+ **From PyPI.** Add this to `plugin_requirements.txt`:
105
+
106
+ ```
107
+ netbox-cable-canvas==0.10.0
108
+ ```
109
+
110
+ **From a local folder** (for development). In `Dockerfile-Plugins`, after the `plugin_requirements.txt` install:
111
+
112
+ ```dockerfile
113
+ COPY ./plugins /opt/netbox/custom-plugins
114
+ RUN /usr/local/bin/uv pip install /opt/netbox/custom-plugins/netbox-cable-canvas
115
+ ```
116
+
117
+ In both cases, add the plugin to `configuration/plugins.py`:
118
+
119
+ ```python
120
+ PLUGINS = ["netbox_cable_canvas"]
121
+ ```
122
+
123
+ Then run `docker compose build --no-cache && docker compose up -d`.
124
+
125
+ ## Demo data
126
+
127
+ `scripts/seed_cable_canvas_demo.py` fills a (test!) NetBox with two sites, three racks, switches, servers, copper and fiber patch panels with an MPO trunk, PDUs, power feeds, a carrier circuit and about 60 cables, including a few deliberate mistakes for the Cabling Health page. It uses only the Python standard library.
128
+
129
+ ```bash
130
+ python3 scripts/seed_cable_canvas_demo.py --url http://localhost:8000 --token <API token>
131
+ python3 scripts/seed_cable_canvas_demo.py --url http://localhost:8000 --token <API token> --delete # remove it again
132
+ ```
133
+
134
+ Everything it creates is tagged `cc-demo`; `--delete` removes those objects and any cables on the demo devices. Running it twice creates nothing new.
135
+
136
+ ## Releasing
137
+
138
+ 1. Bump the version in `netbox_cable_canvas/version.py` (the only place) and add a section to `CHANGELOG.md`.
139
+ 2. Commit, then tag: `git tag v0.10.1 && git push --tags`. The GitLab pipeline checks that the tag matches the version, builds the package and publishes it to this project's GitLab package registry.
140
+ 3. For PyPI, either build and upload locally (`python -m build && twine upload dist/*`), or push the tag to GitHub and publish a GitHub release for it. `.github/workflows/release.yml` builds the package and uploads it with PyPI trusted publishing (no token).
141
+
142
+ One-time PyPI setup: on pypi.org, add a pending trusted publisher for project `netbox-cable-canvas` with owner `CESNET`, repository `netbox-cable-manager`, workflow `release.yml`, environment `pypi`; and create the `pypi` environment in the GitHub repository settings.
@@ -0,0 +1,120 @@
1
+ # NetBox Cable Canvas
2
+
3
+ A visual cable editor for NetBox 4.7: pick two devices, see their ports, click two ports to create a cable.
4
+
5
+ ## Features
6
+
7
+ **Choosing what to see**
8
+ - Its own **Cabling** section in the left menu (Cable Canvas, Cable Trace Map, Cabling Health), plus Cable Canvas and Trace Map buttons on every device page.
9
+ - **Filters** (Site, Location, Rack, Role, Manufacturer, Tenant) using NetBox's own dropdowns.
10
+ - **Two ends** view: Device A plus a device, **circuit** (carrier hand-off) or **power panel** (power feeds) as B.
11
+ - **Rack** view: every device in a rack, either as a real **rack elevation** (devices at their U positions and heights, ports in the device face, cables routed through a cable manager, front/rear filter) or stacked.
12
+ - **Side by side** or **Stacked** layout, **odd/even rows** like real switch faceplates, ports **grouped by module/line card**.
13
+ - **Per-device port-type toggles**: interfaces, front, rear, console, power…
14
+
15
+ **Cabling**
16
+ - **Single**: click or **drag** a free port onto a compatible port.
17
+ - **Bulk**: Shift-click ranges on both sides; map them in order, reversed, or odd ports first; preview, then create them all at once.
18
+ - **Breakout / trunk**: one cable with several ends per side (40G→4×10G, MPO trunks).
19
+ - **Draft mode**: collect cables as drafts, review them, then create or discard them together.
20
+ - **Warnings before creating** (never blocking): RJ45↔SFP, speed mismatch, disabled or management-only interface, copper↔fiber connectors, cable type vs port medium, rear-port position count mismatch.
21
+ - **Undo** (button or Ctrl/Cmd+Z) for creates, bulk batches and deletes.
22
+ - New cable fields: status, type, tags, label, color, length + unit, description, **change reference** (saved in comments).
23
+
24
+ **Understanding what's there**
25
+ - **Trace**: click a cabled port → Trace; shows every hop (through patch panels) and highlights the path on the canvas.
26
+ - Tooltips: speed, enabled, LAG, module, cable type/length/color, link peer and **far end**.
27
+ - Hover a front port to see its rear port (and position), and the other way round.
28
+ - **Find port** by name or description.
29
+
30
+ **Cable labels from your own template**
31
+ - Tick **Auto** next to Label and every new cable (single, bulk, breakout, drafts, circuits) gets a label from your template, for example `{site|upper}-{a_rack}-{seq:04}`.
32
+ - Tokens: `{site}` `{location}` `{rack}` `{a_device}` `{b_device}` `{a_port}` `{b_port}` `{a_rack}` `{b_rack}` `{a_u}` `{b_u}` `{type}` `{color}` `{date}` `{seq}` (`{seq:04}` pads). Filters: `|upper` `|lower` `|slug` `|short` (Gi1/0/1) `|nospace`.
33
+ - `{seq}` continues from the highest number already used in NetBox for that prefix.
34
+ - Edit with live preview from the ⚙ button. Your template is saved in your NetBox user preferences. Admins can set the default in `PLUGINS_CONFIG`:
35
+ ```python
36
+ PLUGINS_CONFIG = {"netbox_cable_canvas": {"label_template": "{site|upper}-{seq:05}"}}
37
+ ```
38
+
39
+ **Circuits**
40
+ - Switch *Create* from **Cable** to **Circuit**, click a port on each device, and fill in provider, type and circuit ID. This creates the circuit, its A/Z terminations (at each device's site or location) and the two cables in one step. If any step fails, everything already created is removed again, and Undo removes the whole circuit.
41
+
42
+ **Cable Trace Map** (Cabling → Cable Trace Map, or the *Trace Map* button on a device)
43
+ - Pick a device and every cabled port on it is traced end to end.
44
+ - **Map**: the device and everything its cables reach, laid out left to right by hop count, with patch panels (dashed purple), circuits (orange) and power panels in between. Click a device or link to filter the list; double-click to open it.
45
+ - **Paths**: one row per path, hop by hop. Each stop shows the ports in and out (e.g. *front 5 ⇢ R1*), and each wire shows the cable's color, label, type and length. Planned cables are dashed.
46
+ - Filter by port type, complete/incomplete, or text (device, port, cable label). Export to CSV, or jump to Cable Canvas for any path.
47
+
48
+ **Cabling Health** (Cabling → Cabling Health)
49
+ - Choose a scope (site, location, rack, role, manufacturer, tenant) and scan. It finds incomplete paths, patch panel ports cabled on only one side, mismatched cables (speed, connector, media, disabled or management-only ports, also checking far ends outside the scope), duplicate labels, cables without a label or type, and ports marked connected with no cable.
50
+ - Click a card to filter. Every finding links to the cable, to Cable Canvas with both devices loaded, and to the Trace Map. Export to CSV.
51
+ - **Label all unlabeled cables** from your template in one go, with a preview first.
52
+
53
+ **Support coverage on the rack elevation**
54
+ - If the CESNET inventory-monitor plugin is installed, a **Coverage** button in the rack elevation colors every device by its main asset's warranty / service contract status (covered, expiring within 60 days, expired, no record). Inventory Insights links straight to it.
55
+
56
+ **Trace Map extras**
57
+ - **Export** the map as SVG or PNG, open a printable page (map + paths) to save as PDF, or download an editable **draw.io** file. In device mode it has two pages: *Map*, and *Paths* with one row per path, hop by hop. In site/rack mode it has the topology, with nodes where you dragged them.
58
+ - **Site / rack topology**: every device matching the filters, laid out automatically (grouped by rack), coloured by device role, with patch panels, circuits and outside devices marked. Choose **Physical cables** (every cable, panels as nodes) or **End to end** (device to device straight through panels). Drag nodes, zoom, pan, click for details, double-click a device for its own Trace Map.
59
+
60
+ **Output**
61
+ - **draw.io** export of exactly what's on screen (stacked, side by side, or rack elevation). Devices are containers with their ports inside, cables are real connectors in their NetBox colour (dashed if planned), and every device and cable links back to NetBox. Open it in diagrams.net or the draw.io desktop app and edit it freely.
62
+ - **CSV** of the cables shown, a printable **patch schedule** (with a tick column and change ref), and printable **cable labels** (one per cable end).
63
+
64
+ Colors: green = free, blue = cabled here, amber = cabled elsewhere, purple = draft, grey = marked connected or virtual.
65
+
66
+ Everything goes through NetBox's REST API with your logged-in session, so NetBox permissions and validation apply. Users who can't add or delete cables don't see those controls.
67
+
68
+ ## Requirements
69
+
70
+ NetBox 4.7.
71
+
72
+ ## Install
73
+
74
+ ```bash
75
+ pip install netbox-cable-canvas
76
+ ```
77
+
78
+ Then add `"netbox_cable_canvas"` to `PLUGINS` in your NetBox configuration and run `manage.py collectstatic`. The plugin has no models, so there are no migrations.
79
+
80
+ ## Install with netbox-docker
81
+
82
+ **From PyPI.** Add this to `plugin_requirements.txt`:
83
+
84
+ ```
85
+ netbox-cable-canvas==0.10.0
86
+ ```
87
+
88
+ **From a local folder** (for development). In `Dockerfile-Plugins`, after the `plugin_requirements.txt` install:
89
+
90
+ ```dockerfile
91
+ COPY ./plugins /opt/netbox/custom-plugins
92
+ RUN /usr/local/bin/uv pip install /opt/netbox/custom-plugins/netbox-cable-canvas
93
+ ```
94
+
95
+ In both cases, add the plugin to `configuration/plugins.py`:
96
+
97
+ ```python
98
+ PLUGINS = ["netbox_cable_canvas"]
99
+ ```
100
+
101
+ Then run `docker compose build --no-cache && docker compose up -d`.
102
+
103
+ ## Demo data
104
+
105
+ `scripts/seed_cable_canvas_demo.py` fills a (test!) NetBox with two sites, three racks, switches, servers, copper and fiber patch panels with an MPO trunk, PDUs, power feeds, a carrier circuit and about 60 cables, including a few deliberate mistakes for the Cabling Health page. It uses only the Python standard library.
106
+
107
+ ```bash
108
+ python3 scripts/seed_cable_canvas_demo.py --url http://localhost:8000 --token <API token>
109
+ python3 scripts/seed_cable_canvas_demo.py --url http://localhost:8000 --token <API token> --delete # remove it again
110
+ ```
111
+
112
+ Everything it creates is tagged `cc-demo`; `--delete` removes those objects and any cables on the demo devices. Running it twice creates nothing new.
113
+
114
+ ## Releasing
115
+
116
+ 1. Bump the version in `netbox_cable_canvas/version.py` (the only place) and add a section to `CHANGELOG.md`.
117
+ 2. Commit, then tag: `git tag v0.10.1 && git push --tags`. The GitLab pipeline checks that the tag matches the version, builds the package and publishes it to this project's GitLab package registry.
118
+ 3. For PyPI, either build and upload locally (`python -m build && twine upload dist/*`), or push the tag to GitHub and publish a GitHub release for it. `.github/workflows/release.yml` builds the package and uploads it with PyPI trusted publishing (no token).
119
+
120
+ One-time PyPI setup: on pypi.org, add a pending trusted publisher for project `netbox-cable-canvas` with owner `CESNET`, repository `netbox-cable-manager`, workflow `release.yml`, environment `pypi`; and create the `pypi` environment in the GitHub repository settings.
@@ -0,0 +1,22 @@
1
+ from netbox.plugins import PluginConfig
2
+
3
+ from .version import __version__
4
+
5
+
6
+ class CableCanvasConfig(PluginConfig):
7
+ name = "netbox_cable_canvas"
8
+ verbose_name = "Cable Canvas"
9
+ description = "Visualize two devices' ports and create cables between them with the mouse"
10
+ version = __version__
11
+ author = "Jan Krupa"
12
+ base_url = "cable-canvas"
13
+ min_version = "4.7.0"
14
+ # Developed and tested against 4.7; raise this only after testing a newer release.
15
+ max_version = "4.7.99"
16
+ default_settings = {
17
+ # Default cable label template; users can save their own in the Cable Canvas.
18
+ "label_template": "{site|upper}-{seq:05}",
19
+ }
20
+
21
+
22
+ config = CableCanvasConfig
@@ -0,0 +1,44 @@
1
+ """
2
+ Device filters rendered with NetBox's own dynamic select widget (the same
3
+ searchable dropdown used for "Site" on the device creation form).
4
+ """
5
+ from django import forms
6
+
7
+ from dcim.models import DeviceRole, Location, Manufacturer, Rack, Site
8
+ from tenancy.models import Tenant
9
+ from utilities.forms.fields import DynamicModelChoiceField
10
+
11
+
12
+ class DeviceFilterForm(forms.Form):
13
+ site = DynamicModelChoiceField(
14
+ queryset=Site.objects.all(),
15
+ required=False,
16
+ label="Site",
17
+ )
18
+ location = DynamicModelChoiceField(
19
+ queryset=Location.objects.all(),
20
+ required=False,
21
+ label="Location",
22
+ query_params={"site_id": "$site"},
23
+ )
24
+ rack = DynamicModelChoiceField(
25
+ queryset=Rack.objects.all(),
26
+ required=False,
27
+ label="Rack",
28
+ query_params={"site_id": "$site", "location_id": "$location"},
29
+ )
30
+ role = DynamicModelChoiceField(
31
+ queryset=DeviceRole.objects.all(),
32
+ required=False,
33
+ label="Role",
34
+ )
35
+ manufacturer = DynamicModelChoiceField(
36
+ queryset=Manufacturer.objects.all(),
37
+ required=False,
38
+ label="Manufacturer",
39
+ )
40
+ tenant = DynamicModelChoiceField(
41
+ queryset=Tenant.objects.all(),
42
+ required=False,
43
+ label="Tenant",
44
+ )
@@ -0,0 +1,30 @@
1
+ from netbox.plugins import PluginMenu, PluginMenuItem
2
+
3
+ # A `menu` makes the plugin its own top-level section in the left navigation,
4
+ # instead of an entry under the shared "Plugins" menu.
5
+ menu = PluginMenu(
6
+ label="Cabling",
7
+ icon_class="mdi mdi-cable-data",
8
+ groups=(
9
+ (
10
+ "Cabling",
11
+ (
12
+ PluginMenuItem(
13
+ link="plugins:netbox_cable_canvas:canvas",
14
+ link_text="Cable Canvas",
15
+ permissions=["dcim.view_device"],
16
+ ),
17
+ PluginMenuItem(
18
+ link="plugins:netbox_cable_canvas:tracemap",
19
+ link_text="Cable Trace Map",
20
+ permissions=["dcim.view_device", "dcim.view_cable"],
21
+ ),
22
+ PluginMenuItem(
23
+ link="plugins:netbox_cable_canvas:health",
24
+ link_text="Cabling Health",
25
+ permissions=["dcim.view_device", "dcim.view_cable"],
26
+ ),
27
+ ),
28
+ ),
29
+ ),
30
+ )