fix: technician topology for all sites, per location and combined

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-11-27 09:58:58 +01:00
1 parent 677590f52c
commit daf8bc671b
9 files changed
+51 -7

No files matched your search

+1 -1
View File
@@ -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. - **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 **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 **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. - 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). - 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. - **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.
+1 -1
View File
@@ -6,7 +6,7 @@ class CustomerExportConfig(PluginConfig):
name = "netbox_customer_export" name = "netbox_customer_export"
verbose_name = _("Customer Export") verbose_name = _("Customer Export")
description = _("Export customer documentation as PDF or Word") description = _("Export customer documentation as PDF or Word")
version = "0.20.0" version = "0.20.1"
author = "Claude" author = "Claude"
base_url = "customer-export" base_url = "customer-export"
min_version = "4.6.8" min_version = "4.6.8"
+11
View File
@@ -89,6 +89,17 @@ class ExportForm(forms.Form):
widget=forms.CheckboxSelectMultiple, widget=forms.CheckboxSelectMultiple,
label=_("Scope"), 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( topo_external = forms.BooleanField(
required=False, initial=True, label=_("Show provider circuits and devices outside the scope") required=False, initial=True, label=_("Show provider circuits and devices outside the scope")
) )
@@ -1584,3 +1584,18 @@ msgstr "Über (Patchpanel)"
msgid "Circuit" msgid "Circuit"
msgstr "Leitung" 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."
+5 -1
View File
@@ -628,7 +628,11 @@ def topology(scope, opts):
if "technician" in scopes: if "technician" in scopes:
from .topology import number_connections 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) rows = number_connections(g)
head = ([H(2, _("Technician version"))] if i == 0 else []) + [H(3, g.title)] head = ([H(2, _("Technician version"))] if i == 0 else []) + [H(3, g.title)]
tech.append((head, g, rows)) tech.append((head, g, rows))
@@ -177,6 +177,9 @@
<div class="ce-label mt-0">{{ form.topo_scope.label }}</div> <div class="ce-label mt-0">{{ form.topo_scope.label }}</div>
{% include 'netbox_customer_export/_pills.html' with field=form.topo_scope %} {% include 'netbox_customer_export/_pills.html' with field=form.topo_scope %}
<div class="form-text mb-2">{% 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." %}</div> <div class="form-text mb-2">{% 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." %}</div>
<div class="ce-label">{{ form.topo_tech_per.label }}</div>
{% include 'netbox_customer_export/_pills.html' with field=form.topo_tech_per %}
<div class="form-text mb-2">{% trans "Only used if “Technician version” is selected above. Each connection is numbered and listed with exact ports in a table." %}</div>
<div class="ce-label">{{ form.topo_details.label }}</div> <div class="ce-label">{{ form.topo_details.label }}</div>
{% include 'netbox_customer_export/_pills.html' with field=form.topo_details %} {% include 'netbox_customer_export/_pills.html' with field=form.topo_details %}
<div class="ce-label">{% trans "More" %}</div> <div class="ce-label">{% trans "More" %}</div>
+14 -3
View File
@@ -85,7 +85,7 @@ def _device_sub(device, opts):
def build_graphs(scope, opts, per="site"): 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 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. 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() groups = OrderedDict()
for pk in drawn: for pk in drawn:
d = by_pk[pk] 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: if key is not None:
groups.setdefault(key, []).append(pk) groups.setdefault(key, []).append(pk)
if per == "rack": if per == "rack":
@@ -110,6 +115,8 @@ def build_graphs(scope, opts, per="site"):
"""Untertitel eines externen Geräts: wo es steht.""" """Untertitel eines externen Geräts: wo es steht."""
if per == "rack": if per == "rack":
return [_("Rack %(name)s") % {"name": d.rack} if d.rack else str(d.site)] 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)] return [str(d.site)]
graphs = [] 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) nodes = OrderedDict((k, v) for k, v in nodes.items() if k in linked)
if nodes: if nodes:
_layout(nodes, edges) _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} title = _("Site %(name)s") % {"name": group}
elif per == "location":
title = _("Location %(name)s (%(site)s)") % {"name": group, "site": group.site}
else: else:
where = " / ".join(str(x) for x in (group.site, group.location) if x) where = " / ".join(str(x) for x in (group.site, group.location) if x)
title = _("Rack %(name)s (%(where)s)") % {"name": group.name, "where": where} title = _("Rack %(name)s (%(where)s)") % {"name": group.name, "where": where}
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "netbox-customer-export" 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" description = "NetBox plugin: customer documentation (PDF/Word) for sites, locations, tenants and tenant groups"
readme = "README.md" readme = "README.md"
requires-python = ">=3.10" requires-python = ">=3.10"