Skip to content

Add support for VlanGroup - #619

Open
flynn-nrg wants to merge 25 commits into
netbox-community:mainfrom
flynn-nrg:feat/vlangroup
Open

Add support for VlanGroup#619
flynn-nrg wants to merge 25 commits into
netbox-community:mainfrom
flynn-nrg:feat/vlangroup

Conversation

@flynn-nrg

@flynn-nrg flynn-nrg commented Aug 18, 2026

Copy link
Copy Markdown

Add VlanGroup support

Adds VLAN Group management to the NetBox Operator, stacked on top of the Vlan/VlanClaim support. A VLAN Group is a named container for organizing VLANs, optionally scoped to a Site and constrained to a VID range.

Depends on #618 — this branch is stacked on top of feat/vpn, so the diff currently includes #618's commits too. GitHub doesn't allow setting a fork branch as a PR base against an upstream repo without push access there, so this will show as a clean, VlanGroup-only diff once #618 merges and this branch is rebased onto main.

New CRD

  • VlanGroup — represents a single VLAN Group in NetBox (name, site, tenant, vidRangeStart/vidRangeEnd, description, custom fields, preserveInNetbox).

Only tenant and site references are supported (both reuse the existing lookup helpers already used by Vlan/VlanClaim). NetBox also supports Region/SiteGroup/Location/ClusterGroup/Cluster scopes, but none of those have lookup helpers in this codebase yet, so they're left out to keep this PR scoped.

Controller

  • VlanGroupReconciler — reserves/updates the VLAN Group in NetBox (ReserveOrUpdateVlanGroup), finalizer-based cleanup (vlangroup.netbox.dev/finalizer), reports conditions and events.

NetBox client

New methods on NetboxCompositeClient: ReserveOrUpdateVlanGroup, DeleteVlanGroup, added directly to the existing IpamAPI interface/adapter.

Tests & docs

  • Unit tests for the NetBox client (pkg/netbox/api/vlan_group_test.go) and for the controller (internal/controller/vlangroup_controller_test.go), covering reservation, update, reserve failure, and delete/404/non-404 cases.
  • Chainsaw e2e tests under tests/e2e/vlangroup: create/update (including mutating site, tenant, description, and VID range on an existing group), invalid tenant, and invalid custom field cases.
  • Sample manifest under config/samples/.
  • README/CONTRIBUTING samples-folder listings extended; a short mention of VlanGroup added under the existing "VLAN Management" section.

Behaviour notes

  • name immutability enforced via CEL validation; vidRangeStart/vidRangeEnd must be set together or not at all (also CEL-enforced).

This was done with the help of Claude.

flynn-nrg and others added 25 commits August 17, 2026 14:19
* Return body in the error
* Resolves the site name to its NetBox slog before filtering.
* For an explicit vid claim we make vidRangeStart = vidRangeEnd = vid
  and check if it already exists before assigning.
* Return body in the error
* Resolves the site name to its NetBox slog before filtering.
* For an explicit vid claim we make vidRangeStart = vidRangeEnd = vid
  and check if it already exists before assigning.
* use metadata.Name
* Add workaround for json payload mistmatch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant