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 9527bdf..8508620 100644 Binary files a/netbox_customer_export/locale/de/LC_MESSAGES/django.mo and b/netbox_customer_export/locale/de/LC_MESSAGES/django.mo differ 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"