feat(IFC-1869): custom prefix length for from-pool IP allocation
Merged
SA
3mo ago+2216+2216+0123456789012345678901234567890123456789-139-139-012345678901234567890123456789
What
Adds an optional prefix-length override to the from-pool allocation flow for both IP address pools and IP prefix pools. When a user allocates from a pool (e.g. a device's Primary IP Address, or a subnet carved from a prefix pool), they can now request a specific prefix length instead of always getting the pool default. The pool's default is surfaced as the input placeholder.
๐ Try it live: /objects/InfraDevice in the preview environment โ open a device, edit its Primary IP Address, allocate from a pool, and set a custom prefix length.
Screenshots
Idempotency & the conflict error (FR-014)
Allocation stays idempotent โ the reserved resource never changes by re-allocating:
- Re-selecting a pool that already holds a reservation for the object reuses it.
- Supplying an explicit prefix length that conflicts with an existing reservation is now rejected with a clear inline error (
its prefix length cannot be changed, only /<n> can be used) instead of being silently ignored. The guard (validate_reserved_prefix_length) is shared betweenCoreIPAddressPoolandCoreIPPrefixPool. No GraphQL schema change.
Scope
- Both IP address and IP prefix pools. Address pools take
prefixlen(the new address's mask) and prefix pools takesize(the carved-out subnet's prefix length) on their inlinefrom_poolinput โ both fields already exist in the schema, so no GraphQL input change was needed. - The IPAM create form (which allocates via the dedicated
GetResourcemutation rather than the genericfrom_poolpath) threads the prefix length through as well.
Deferred / alternatives considered (FR-014)
- Releasing the reservation on relationship re-point (too broad a behavior change, idempotency risk) and a read-only reserved-resource lookup endpoint (cleaner, larger โ good follow-up).
Testing
- Backend:
test_ipaddress_poolandtest_prefix_poolโ a conflicting prefix length raises the anchored error; absent/matching stays idempotent. - Frontend: unit tests for the mutation builders (prefix length emitted only when set, mapped to
prefixlen/sizeper pool kind),PoolPrefixLengthInput(incl. placeholder),updateFormFieldValue, andfindErrorMessage. - E2E (pytest-playwright): custom-prefix-length allocation covered for both an IP address pool and an IP prefix pool โ asserting the pool default appears as the placeholder and the typed length is honoured. A shared
select_poolhelper de-duplicates the from-pool flow across the suite. - Manual: verified end-to-end in the live preview (conflict error, zero-effort reuse, fresh custom allocation for both pool kinds).
Spec
See dev/specs/ifc-1869-from-pool-prefix-mask/ โ reconciled to as-built.
Jira: IFC-1869
๐ค Generated with Claude Code