feat: switch stacks per member device, optional AP sites with mandatory tenant

- Detect stacks (Aruba CX VSF, ArubaOS-Switch stacking/VSF, Comware IRF) from
  the configuration; new "Stack" tab assigns a NetBox device per member
  (suggested from virtual chassis positions, stored per switch); ports go to
  their member's device, LAGs and VLAN interfaces stay on the switch device
- Access points: site is optional with a default site for new APs; tenant is
  mandatory and can be chosen per Sophos site; new tenant column
- Empty states no longer get squeezed in small cards

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-11-02 13:08:30 +01:00
1 parent f400795cb5
commit 8d2bbafc8d
9 files changed
+469 -91

No files matched your search

+15 -2
View File
@@ -74,7 +74,7 @@ def test_sync_creates_new_aps_with_site_tenant_and_updates_existing():
engine.load_context(7)
aps = parse_csv(CSV)
engine.match(aps)
sites = {ap_key(aps[2]): 21}
sites = {ap_key(aps[2]): {"site": 21}}
preview = engine.sync(aps, sites, role_id=30, dry_run=True)
assert preview["errors"] == [] and preview["devices_created"] == 1 and preview["devices_updated"] == 2
@@ -101,4 +101,17 @@ def test_new_ap_without_site_is_an_error_not_a_guess():
aps = parse_csv(CSV)
engine.match(aps)
report = engine.sync(aps, {}, role_id=30, dry_run=True)
assert report["errors"] == ["Büro ohne Standort: kein NetBox-Standort zugeordnet"]
assert report["errors"][0].startswith("Büro ohne Standort: kein Standort")
def test_site_is_optional_with_default_site_and_tenant_can_be_chosen():
nb = _netbox()
engine = APSyncEngine(nb)
engine.load_context(7)
assert [tenant["name"] for tenant in engine.group_tenants] == ["Kunde Kita", "Kunde RZ"]
aps = parse_csv(CSV)
engine.match(aps)
# No site for the new AP: it goes to the default site, with an own tenant.
engine.sync(aps, {ap_key(aps[2]): {"site": None, "tenant": 8}}, role_id=30, dry_run=False, default_site=21)
created = nb.dcim.devices.created[-1]
assert (created["site"], created["tenant"]) == (21, 8)