feat: offline mode with JSON export/import

Collect VMs and switch data without NetBox, export them to a
credential-free .nbsync.json file and import it later where NetBox is
reachable. Toggled by a global sidebar checkbox.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-10-21 09:16:01 +02:00
1 parent c3b5fb547e
commit 52f1e4b5f1
14 files changed
+437 -33

No files matched your search

+11
View File
@@ -52,3 +52,14 @@ def test_sync_matches_short_names_and_keeps_existing_types():
nb.dcim.interfaces.get(1).cable = True
again = sync_snapshot_to_netbox(nb, switch, snapshot, create_cables=True, dry_run=True)
assert again["changes"] == []
def test_offline_switch_is_resolved_by_name():
nb, _switch, snapshot = _setup()
report = sync_snapshot_to_netbox(nb, {"id": "s", "name": "access-01", "device_id": None}, snapshot,
create_cables=False, dry_run=True)
assert report["errors"] == []
assert report["interfaces_unchanged"] == 1
missing = sync_snapshot_to_netbox(nb, {"id": "s", "name": "unbekannt"}, snapshot, dry_run=True)
assert missing["errors"] == ["NetBox-Gerät „unbekannt“ nicht gefunden"]