diff --git a/README.md b/README.md index ebd76c7..0dbb829 100644 --- a/README.md +++ b/README.md @@ -255,7 +255,8 @@ style of Cisco Packet Tracer: - Links come from NetBox **cable paths**; paths through patch panels are traced to the end device. - The top-to-bottom layout follows the cabling: provider → firewall/router → core → access → end devices, with ordering optimised for as few crossings as possible. - Lines are routed **orthogonally** on bus bars, coloured per upstream device. Port names sit at the target device; multiple uplinks are drawn thicker and marked "2×". -- **Scope**: *entire network* (one page per site) and/or *per rack* (one page per rack). In the rack view, directly connected devices outside the rack appear faded and dashed, with their rack. +- **Scope**: *entire network* (one page per site), *per location* and/or *per rack* (one page per rack). In the rack view, directly connected devices outside the rack appear faded and dashed, with their rack. +- **Per location** shows the **physical cabling hop by hop** instead of end-to-end paths: every cable is a line and patch panels appear as their own nodes, so you see switch → patch panel → trunk → patch panel of the sub-distribution → switch. One diagram per top-level location includes its child locations; each device shows its sub-location and rack. - Each topology gets its **own landscape page** (PDF and Word) and is scaled as large as possible. - Provider circuits appear as a cloud, devices of other sites dashed (can be disabled). - Selectable labels: management IP, model, ports on links. @@ -269,12 +270,12 @@ button on device type and device role pages): 3. otherwise **automatic**, first by role, then by model and manufacturer Built-in symbols: internet/provider, modem/NTU, firewall, router, layer-3 -switch, switch, radio link, WLAN controller, PoE injector, access point, server, +switch, switch, radio link, patch panel, WLAN controller, PoE injector, access point, server, storage/SAN, NAS, tape library, UPS/ATS, PBX, IP phone, PC/client, printer, camera and "other". Patch panels, power strips, PDUs, cable management and rooms are hidden -automatically; further device types or roles can be hidden via "Hide in +automatically (in the per-location view, devices with front/rear ports are drawn as patch panels); further device types or roles can be hidden via "Hide in topology". Custom icons are stored under `MEDIA_ROOT/customer-export/symbols/`. Permissions: object type *Customer Export | Topology symbol*, analogous to branding profiles. diff --git a/netbox_customer_export/__init__.py b/netbox_customer_export/__init__.py index 6edb000..20e2c4e 100644 --- a/netbox_customer_export/__init__.py +++ b/netbox_customer_export/__init__.py @@ -5,7 +5,7 @@ class CustomerExportConfig(PluginConfig): name = "netbox_customer_export" verbose_name = "Kunden-Export" description = "Kundendokumentation als PDF oder Word exportieren" - version = "0.12.1" + version = "0.13.0" author = "Claude" base_url = "customer-export" min_version = "4.6.8" diff --git a/netbox_customer_export/forms.py b/netbox_customer_export/forms.py index 8d55d8a..5bd93db 100644 --- a/netbox_customer_export/forms.py +++ b/netbox_customer_export/forms.py @@ -76,7 +76,11 @@ class ExportForm(forms.Form): label="Beschriftung", ) topo_scope = forms.MultipleChoiceField( - choices=(("site", "Gesamtes Netzwerk (je Standort)"), ("rack", "Je Rack")), + choices=( + ("site", "Gesamtes Netzwerk (je Standort)"), + ("location", "Je Lokation (Verkabelung inkl. Patchfelder)"), + ("rack", "Je Rack"), + ), initial=["site"], required=False, widget=forms.CheckboxSelectMultiple, diff --git a/netbox_customer_export/sections.py b/netbox_customer_export/sections.py index 612b55a..ce37284 100644 --- a/netbox_customer_export/sections.py +++ b/netbox_customer_export/sections.py @@ -554,7 +554,7 @@ def licenses(scope, opts): @section("topology", "Netzwerk-Topologie", "Netzwerk", default=False, hint="Diagramm mit Symbolen, wie Packet Tracer") def topology(scope, opts): - from .topology import build_graphs, render_png + from .topology import build_graphs, build_location_graphs, render_png title = H(1, "Netzwerk-Topologie") scopes = opts.get("topo_scope") or ["site"] @@ -562,6 +562,9 @@ def topology(scope, opts): pages = [] # (Überschriften, Graph) – je eine Querformat-Seite if "site" in scopes: pages += [([H(2, g.title)], g) for g in build_graphs(scope, opts, per="site")] + if "location" in scopes: + locs = build_location_graphs(scope, opts) + pages += [(([H(2, "Verkabelung je Lokation")] if i == 0 else []) + [H(3, g.title)], g) for i, g in enumerate(locs)] if "rack" in scopes: racks = build_graphs(scope, opts, per="rack") # Rack-Seiten unter einer gemeinsamen Zwischenüberschrift, Racks selbst eine Ebene tiefer (kürzeres Inhaltsverzeichnis) diff --git a/netbox_customer_export/symbols.py b/netbox_customer_export/symbols.py index 41e1c06..8571d7a 100644 --- a/netbox_customer_export/symbols.py +++ b/netbox_customer_export/symbols.py @@ -14,6 +14,7 @@ KINDS = OrderedDict( ("l3switch", ("Layer-3-Switch / Core", 2)), ("switch", ("Switch", 3)), ("radio", ("Funkstrecke / Richtfunk", 3)), + ("patchpanel", ("Patchfeld / Rangierverteiler", 3)), ("wlc", ("WLAN-Controller", 3)), ("poe", ("PoE-Injektor", 4)), ("ap", ("Access Point", 4)), @@ -286,6 +287,14 @@ def _draw_ups(d): d.polygon([(62, 70), (50, 88), (58, 88), (54, 102), (70, 82), (62, 82), (68, 70)], fill=(250, 200, 40)) +def _draw_patchpanel(d): + # flaches 19"-Feld mit zwei Portreihen, bewusst nüchtern (passives Element) + _iso_box(d, 8, 58, 104, 92, 14, (96, 104, 114), (150, 158, 168), (74, 82, 92)) + for row in (64, 78): + for i in range(12): + d.rectangle([14 + i * 7.5, row, 19 + i * 7.5, row + 7], fill=(40, 46, 54)) + + def _draw_pbx(d): # Anlage (Box) mit Hörer-Symbol _iso_box(d, 12, 50, 104, 104, 12, (62, 70, 80), (126, 136, 148), (44, 52, 60)) @@ -319,6 +328,7 @@ _DRAWERS = { "tape": _draw_tape, "ups": _draw_ups, "pbx": _draw_pbx, + "patchpanel": _draw_patchpanel, } @@ -366,6 +376,11 @@ class SymbolResolver: pass self._icons = {} + def is_hidden(self, device): + """Per Symbolzuordnung ausdrücklich ausgeblendet?""" + sym = self.by_type.get(device.device_type_id) or self.by_role.get(device.role_id) + return bool(sym and sym.kind == HIDDEN) + def resolve(self, device): """(kind, icon_png_bytes) oder (None, None), wenn das Gerät nicht gezeichnet wird.""" sym = self.by_type.get(device.device_type_id) or self.by_role.get(device.role_id) diff --git a/netbox_customer_export/templates/netbox_customer_export/export.html b/netbox_customer_export/templates/netbox_customer_export/export.html index 99c7dcb..cc3053f 100644 --- a/netbox_customer_export/templates/netbox_customer_export/export.html +++ b/netbox_customer_export/templates/netbox_customer_export/export.html @@ -175,7 +175,7 @@