From daf8bc671b21183c972c34beb8c97a8bc7ab511c Mon Sep 17 00:00:00 2001 From: Louis Date: Fri, 27 Nov 2026 09:58:58 +0100 Subject: [PATCH] fix: technician topology for all sites, per location and combined Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- netbox_customer_export/__init__.py | 2 +- netbox_customer_export/forms.py | 11 +++++++++++ .../locale/de/LC_MESSAGES/django.mo | Bin 22789 -> 23286 bytes .../locale/de/LC_MESSAGES/django.po | 15 +++++++++++++++ netbox_customer_export/sections.py | 6 +++++- .../netbox_customer_export/export.html | 3 +++ netbox_customer_export/topology.py | 17 ++++++++++++++--- pyproject.toml | 2 +- 9 files changed, 51 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a4570c5..46783a3 100644 --- a/README.md +++ b/README.md @@ -260,7 +260,7 @@ style of Cisco Packet Tracer: - **Scope**: *entire network* (one page per site), *location overview* 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. - The **location overview** draws one diagram per site with the **locations as nodes** (server room, halls, sub-distributions …). Lines are the physical cables between locations, labelled with count and cable type (e.g. `2× SMF, 4× CAT6a`), so you can follow the cabling from the server room to the last sub-distribution. Locations containing firewalls, routers or core switches are placed at the top; each node shows its parent location and the number of racks and devices. Devices without a location (e.g. radio bridges on the roof) are grouped in a node for their site ("without location"). - The **cross-site location overview** puts all locations of all sites in scope into **one diagram**; each node shows its site (and parent location), so you can see how buildings and their locations are connected to each other. -- The **technician version** is meant for third parties (other IT companies, electricians): one diagram per site in which every link is labelled with connection numbers (`#1`, `#2–4`), followed by a table listing **every single connection** with number, device A / port A, cable (label, type, colour, length), patch panels on the way, and device B / port B. +- The **technician version** is meant for third parties (other IT companies, electricians): selectable as *all in one diagram* (across all sites in scope, e.g. for a tenant), *per site* and/or *per location*. In each diagram every link is labelled with connection numbers (`#1`, `#2–4`), followed by a table listing **every single connection** with number, device A / port A, cable (label, type, colour, length), patch panels on the way, and device B / port B. - 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). - **Wireless links** (NetBox *Wireless links*, e.g. point-to-point radio bridges) appear as blue dotted lines labelled "Wireless", in the network view as well as in the location overviews. diff --git a/netbox_customer_export/__init__.py b/netbox_customer_export/__init__.py index da9644b..810fbb2 100644 --- a/netbox_customer_export/__init__.py +++ b/netbox_customer_export/__init__.py @@ -6,7 +6,7 @@ class CustomerExportConfig(PluginConfig): name = "netbox_customer_export" verbose_name = _("Customer Export") description = _("Export customer documentation as PDF or Word") - version = "0.20.0" + version = "0.20.1" 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 06e7054..fdf930a 100644 --- a/netbox_customer_export/forms.py +++ b/netbox_customer_export/forms.py @@ -89,6 +89,17 @@ class ExportForm(forms.Form): widget=forms.CheckboxSelectMultiple, label=_("Scope"), ) + topo_tech_per = forms.MultipleChoiceField( + choices=( + ("all", _("All in one diagram")), + ("site", _("Per site")), + ("location", _("Per location")), + ), + initial=["all", "site"], + required=False, + widget=forms.CheckboxSelectMultiple, + label=_("Technician version"), + ) topo_external = forms.BooleanField( required=False, initial=True, label=_("Show provider circuits and devices outside the scope") ) diff --git a/netbox_customer_export/locale/de/LC_MESSAGES/django.mo b/netbox_customer_export/locale/de/LC_MESSAGES/django.mo index 9527bdf817656a042cb73b05d5191cd00e9558a1..8508620012e2b4d502b136ab2bfdacd2f6d38e70 100644 GIT binary patch delta 6530 zcmZwLdsJ3c8prX2pdcc0(G)^CA~zB7LU=7q6DYh9AX?ew1rG8mytrOo)Ji*Aqhp1Q z8P?e7IF*&GZWdmeSx#k^O*cndnwFC}7L~2BMk}?}MDzW5c5D8b{`u^^&pCTP&$IVA zFShEXu=6{^+!F~A8!Y}?5@uN`c(|8(metz-e`e5JOFtPqFdYxzW%wONV)Ov-`2^JX z2rR^6yc}2IJNOu8VMCH-O|mT4YNOGEfy3Avk7Ep;Hsj|poc_-ki(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1r*-dEaXJJ!ZfGJpuX?Q=H>F==#t_=OF(J$ej zusLo+*L$U$`g=GI(J=~-VJ|GEaWme4F3^CM?(NY294+M7{^Jq@!k5$->P2DlO(_aqwVy3oG`9lrzpQoa$| zjhIdQD>RU^=seA?IrsNMBFf@o5*=m854z}S^wc(@6E?k;KNc_tE$Mye1k2I;k6{aZ z2J>+TcE?7%1XC*Fv(pc)WF=aOYE1Y2zl{q^IUlXWLiD{|f-dwF`rx0jC2kJ)Uq#37 zN1y)~9shao8}wJNljs@B8W+E|UC=|@7ti}iw@ki0|$I%L$MHkGf3a=mbrCo#`-f300#-*Q2hYu`6OZHS4uoYc! z7aG_*=(xS1|48s_^e~=5zijCf`134@&o0)`UOlnyfwr5Q)Q!0yHKT5J_rEu-d!uJ{ oQu3TBQ)kqb6n1Y}ch|rZ8Fh=xCMVb3K6+tN@;GngjQuS0f2;U`4*&oF diff --git a/netbox_customer_export/locale/de/LC_MESSAGES/django.po b/netbox_customer_export/locale/de/LC_MESSAGES/django.po index 678aa35..3930c36 100644 --- a/netbox_customer_export/locale/de/LC_MESSAGES/django.po +++ b/netbox_customer_export/locale/de/LC_MESSAGES/django.po @@ -1584,3 +1584,18 @@ msgstr "Über (Patchpanel)" msgid "Circuit" msgstr "Leitung" + +msgid "All in one diagram" +msgstr "Alles in einem Diagramm" + +msgid "Per site" +msgstr "Je Standort" + +msgid "Per location" +msgstr "Je Lokation" + +msgid "Location %(name)s (%(site)s)" +msgstr "Lokation %(name)s (%(site)s)" + +msgid "Only used if “Technician version” is selected above. Each connection is numbered and listed with exact ports in a table." +msgstr "Nur wirksam, wenn oben „Techniker-Version“ gewählt ist. Jede Verbindung wird nummeriert und mit genauen Ports in einer Tabelle aufgeführt." diff --git a/netbox_customer_export/sections.py b/netbox_customer_export/sections.py index d451f4d..ed9faf3 100644 --- a/netbox_customer_export/sections.py +++ b/netbox_customer_export/sections.py @@ -628,7 +628,11 @@ def topology(scope, opts): if "technician" in scopes: from .topology import number_connections - for i, g in enumerate(build_graphs(scope, opts, per="site")): + graphs = [] + for per in ("all", "site", "location"): + if per in (opts.get("topo_tech_per") or ["all", "site"]): + graphs += build_graphs(scope, opts, per=per) + for i, g in enumerate(graphs): rows = number_connections(g) head = ([H(2, _("Technician version"))] if i == 0 else []) + [H(3, g.title)] tech.append((head, g, rows)) diff --git a/netbox_customer_export/templates/netbox_customer_export/export.html b/netbox_customer_export/templates/netbox_customer_export/export.html index 3bd3979..12d8ebf 100644 --- a/netbox_customer_export/templates/netbox_customer_export/export.html +++ b/netbox_customer_export/templates/netbox_customer_export/export.html @@ -177,6 +177,9 @@
{{ form.topo_scope.label }}
{% include 'netbox_customer_export/_pills.html' with field=form.topo_scope %}
{% trans "“Location overview” shows all locations of a site and the cables between them, from the server room to the last sub-distribution. “Cross-site” combines all sites in one diagram to show how buildings and their locations are connected. “Per rack” shows each rack separately. Connected devices outside appear dashed." %}
+
{{ form.topo_tech_per.label }}
+ {% include 'netbox_customer_export/_pills.html' with field=form.topo_tech_per %} +
{% trans "Only used if “Technician version” is selected above. Each connection is numbered and listed with exact ports in a table." %}
{{ form.topo_details.label }}
{% include 'netbox_customer_export/_pills.html' with field=form.topo_details %}
{% trans "More" %}
diff --git a/netbox_customer_export/topology.py b/netbox_customer_export/topology.py index 65397f5..7a11758 100644 --- a/netbox_customer_export/topology.py +++ b/netbox_customer_export/topology.py @@ -85,7 +85,7 @@ def _device_sub(device, opts): def build_graphs(scope, opts, per="site"): - """Ein Graph je Standort (per="site") oder je Rack (per="rack"). + """Ein Graph je Standort (per="site"), Lokation (per="location"), Rack (per="rack") oder einer für alles (per="all"). Verbundene Geräte außerhalb der Gruppe (anderer Standort/anderes Rack) und Provider-Leitungen erscheinen als externe, gestrichelte Knoten – so sieht man auch in der Rack-Ansicht, wohin die Uplinks gehen. @@ -98,7 +98,12 @@ def build_graphs(scope, opts, per="site"): groups = OrderedDict() for pk in drawn: d = by_pk[pk] - key = d.site if per == "site" else d.rack + if per == "all": + key = "all" + elif per == "location": + key = d.location or d.site + else: + key = d.site if per == "site" else d.rack if key is not None: groups.setdefault(key, []).append(pk) if per == "rack": @@ -110,6 +115,8 @@ def build_graphs(scope, opts, per="site"): """Untertitel eines externen Geräts: wo es steht.""" if per == "rack": return [_("Rack %(name)s") % {"name": d.rack} if d.rack else str(d.site)] + if per == "location" and d.location: + return [f"{d.site} / {d.location}"] return [str(d.site)] graphs = [] @@ -139,8 +146,12 @@ def build_graphs(scope, opts, per="site"): nodes = OrderedDict((k, v) for k, v in nodes.items() if k in linked) if nodes: _layout(nodes, edges) - if per == "site": + if per == "all": + title = _("All sites") + elif per == "site" or (per == "location" and not hasattr(group, "site")): title = _("Site %(name)s") % {"name": group} + elif per == "location": + title = _("Location %(name)s (%(site)s)") % {"name": group, "site": group.site} else: where = " / ".join(str(x) for x in (group.site, group.location) if x) title = _("Rack %(name)s (%(where)s)") % {"name": group.name, "where": where} diff --git a/pyproject.toml b/pyproject.toml index 4a23c99..170bf85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "netbox-customer-export" -version = "0.20.0" +version = "0.20.1" description = "NetBox plugin: customer documentation (PDF/Word) for sites, locations, tenants and tenant groups" readme = "README.md" requires-python = ">=3.10"