feat: network topology diagram with Packet-Tracer-style symbols

- New section "Netzwerk-Topologie": one diagram per site built from
  NetBox cable paths (traced through patch panels), layered top-down by
  cabling (provider > firewall/router > core > access > endpoints),
  barycenter ordering, "2x" for parallel links, provider circuits as
  clouds and devices outside the scope dashed. Labels: management IP,
  model, ports.
- New export format "draw.io": the topology as an editable .drawio file
  (one page per site, symbols embedded).
- 14 built-in symbols drawn with Pillow; automatic mapping from role,
  model and manufacturer, passive gear (patch panels, PDUs, UPS) hidden.
- New TopologySymbol model (migration 0002) with list/edit/delete UI,
  symbol gallery, custom icon upload and a "Topologie-Symbol" button on
  device type and device role pages.

Bump version to 0.4.0 - requires "manage.py migrate".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-23 14:12:55 +02:00
co-authored by Claude Opus 5.5
parent 219a429f3f
commit e477aa9b49
22 changed files with 1147 additions and 17 deletions
+24 -1
View File
@@ -18,4 +18,27 @@ class CustomerExportButton(PluginTemplateExtension):
)
template_extensions = [CustomerExportButton]
class TopologySymbolButton(PluginTemplateExtension):
"""Auf Gerätetyp- und Geräterollen-Seiten: Topologie-Symbol festlegen."""
models = ["dcim.devicetype", "dcim.devicerole"]
def buttons(self):
from .models import TopologySymbol
user = self.context["request"].user
if not user.has_perm("netbox_customer_export.add_topologysymbol"):
return ""
obj = self.context["object"]
field = "device_type" if obj._meta.model_name == "devicetype" else "role"
existing = TopologySymbol.objects.filter(**{field: obj}).first()
if existing:
url = existing.get_absolute_url()
else:
url = f"{reverse('plugins:netbox_customer_export:symbol_add')}?{field}={obj.pk}"
return format_html(
'<a href="{}" class="btn btn-outline-primary"><i class="mdi mdi-shape-outline"></i> Topologie-Symbol</a>', url
)
template_extensions = [CustomerExportButton, TopologySymbolButton]