Component
API Server / GraphQL
Infrahub version
1.9.3
Current Behavior
When an IpamIPPrefix reports non-zero utilization on main, creating a new branch from main causes the same prefix to report utilization: 0 on the branch — even though no data has been modified.
The effect shows up on every prefix that had non-zero utilization on main: a fully populated /32 sub-prefix (with its host IpamIPAddress assigned) and its /24 parent both flip to 0 on the branch. The exact percentages aren't the point — utilization values are not preserved on branch creation.
Expected Behavior
A freshly created branch should report the same utilization as main until data on the branch is modified.
Steps to Reproduce
-
Load the models/base/ipam.yml schema, which provides IpamIPPrefix and IpamIPAddress (inheriting from BuiltinIPPrefix / BuiltinIPAddress):
infrahubctl schema load models/base/ipam.yml
-
Load the following objects on main:
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: IpamIPPrefix
data:
- prefix: 10.100.0.0/24
description: "Parent /24 — container for /32 sub-prefixes"
member_type: prefix
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: IpamIPPrefix
data:
- prefix: 10.100.0.1/32
member_type: address
- prefix: 10.100.0.2/32
member_type: address
- prefix: 10.100.0.3/32
member_type: address
- prefix: 10.100.0.4/32
member_type: address
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: IpamIPAddress
data:
- address: 10.100.0.1/32
- address: 10.100.0.2/32
- address: 10.100.0.3/32
- address: 10.100.0.4/32
infrahubctl object load ipam_utilization_bug_repro.yml
-
Open the IPAM view at http://localhost:8000/ipam on main — the /24 and each /32 sub-prefix show non-zero utilization.
-
Create a new branch:
infrahubctl branch create test-1
-
In the same IPAM view, switch the branch selector to test-1. Every prefix that reported non-zero utilization on main now reports 0 on test-1, while main is unchanged.
Additional Information
IPPrefix.utilization, IPPrefix.ip_addresses, and IPAddress.ip_prefix are all declared read_only=True with allow_override=NONE in backend/infrahub/core/schema/definitions/core/ipam.py (lines 116-122, 166-175, 219-228). The hierarchical prefix→address association is computed, not stored.
- The sub-prefix and address objects themselves remain visible on the branch — only the
utilization value is affected.
Component
API Server / GraphQL
Infrahub version
1.9.3
Current Behavior
When an
IpamIPPrefixreports non-zeroutilizationonmain, creating a new branch frommaincauses the same prefix to reportutilization: 0on the branch — even though no data has been modified.The effect shows up on every prefix that had non-zero utilization on main: a fully populated
/32sub-prefix (with its hostIpamIPAddressassigned) and its/24parent both flip to0on the branch. The exact percentages aren't the point — utilization values are not preserved on branch creation.Expected Behavior
A freshly created branch should report the same
utilizationasmainuntil data on the branch is modified.Steps to Reproduce
Load the
models/base/ipam.ymlschema, which providesIpamIPPrefixandIpamIPAddress(inheriting fromBuiltinIPPrefix/BuiltinIPAddress):Load the following objects on
main:Open the IPAM view at http://localhost:8000/ipam on
main— the/24and each/32sub-prefix show non-zero utilization.Create a new branch:
In the same IPAM view, switch the branch selector to
test-1. Every prefix that reported non-zero utilization onmainnow reports0ontest-1, whilemainis unchanged.Additional Information
IPPrefix.utilization,IPPrefix.ip_addresses, andIPAddress.ip_prefixare all declaredread_only=Truewithallow_override=NONEinbackend/infrahub/core/schema/definitions/core/ipam.py(lines 116-122, 166-175, 219-228). The hierarchical prefix→address association is computed, not stored.utilizationvalue is affected.