feature/52-object-files #53

Merged
Damien merged 29 commits from feature/52-object-files into main 2026-02-20 15:14:03 +00:00
Owner
No description provided.
Damien added 29 commits 2026-02-20 15:13:52 +00:00
All relation values now use the HFID list-of-strings format required
by infrahubctl:
- Cardinality one: device: ["spine1"], platform: ["arista_eos"]
- Cardinality many: devices: - ["leaf1"], networks: - ["10.0.250.1/32"]
- Composite HFIDs unchanged: peer_group: ["10.0.250.1", "evpn"]

Files modified: 02-fabric, 03-devices, 04-interfaces, 06-vlans-vxlan,
07-bgp, 08-vrfs, 09-mlag (05-ipam already correct).
InfraInterfaceEthernet references InfraInterfaceLag (lag field),
so LAG interfaces must be created first within the same file.

New order: Loopback → Lag → Ethernet → Vlan SVI
InfraInterfaceVlan references InfraVLAN objects (06-vlans-vxlan.yml),
so Vlan SVIs must load after VLANs. Similarly, Vlan IP addresses
reference Vlan SVIs.

Changes:
- Extract InfraInterfaceVlan from 04 into 07-interface-vlans.yml
- Extract Vlan SVI IPs from 05 into 08-ipam-vlans.yml
- Rename 07-bgp→09, 08-vrfs→10, 09-mlag→11
- Update .infrahub.yml with new 11-file load order

Load order: foundation → fabric → devices → interfaces (Lo/Lag/Eth)
→ ipam (Lo/Eth) → vlans-vxlan → interface-vlans → ipam-vlans
→ bgp → vrfs → mlag
InfraIPAddress.interface peers with the generic InfraInterface which
has no human_friendly_id defined, so infrahubctl cannot resolve the
HFID lookup. Remove interface references from all IP address objects.

IP-to-interface associations can be established later via the reverse
relationship (ip_addresses on interface objects) or by adding an HFID
to the InfraInterface generic in a future schema update.
IPNetwork with strict=True rejects host addresses like 10.0.1.1/31
(host bits set). Interface IP assignments are host addresses with a
prefix length, which is exactly what IPHost accepts.
InfraBGPSession references InfraBGPPeerGroup via peer_group HFID,
so peer groups must be committed before sessions are created.

Split 09-bgp.yml into:
- 09-bgp.yml: InfraBGPRouterConfig + InfraBGPPeerGroup
- 10-bgp-sessions.yml: InfraBGPSession + InfraBGPAddressFamily

Renamed: 10-vrfs→11, 11-mlag→12. Now 12 object files total.
The SDK cannot resolve deep relation traversals like
bgp_config__router_id__value when loading object files.

Schema changes in bgp.yml:
- InfraBGPPeerGroup HFID: bgp_config__router_id__value → bgp_config__device__name__value
- InfraBGPSession HFID: bgp_config__router_id__value → bgp_config__device__name__value

Object file changes in 10-bgp-sessions.yml:
- peer_group refs: router_id → device_name (e.g. ["10.0.250.1", "evpn"] → ["spine1", "evpn"])
- active_peer_groups refs: same mapping (82 replacements total)
Restore original human_friendly_id fields:
- InfraBGPPeerGroup: bgp_config__router_id__value + name__value
- InfraBGPSession: bgp_config__router_id__value + peer_address__value

Restore router_id values in peer_group and active_peer_groups
references in 10-bgp-sessions.yml (82 replacements).
Infrahub does not support relation traversal in HFID computation.
bgp_config__router_id__value returned only the name, not the full path.

Schema changes:
- InfraBGPPeerGroup HFID: [name__value] (was [bgp_config__router_id__value, name__value])
- InfraBGPSession HFID: [peer_address__value] (was [bgp_config__router_id__value, peer_address__value])
- uniqueness_constraints unchanged (still scoped to bgp_config)

Object file changes (10-bgp-sessions.yml):
- peer_group: ["10.0.250.x", "name"] → peer_group: "name" (56 refs)
- active_peer_groups: - ["10.0.250.x", "name"] → - "name" (26 refs)
Infrahub does not support relation traversal in HFID computation.
Add a local_identifier attribute to PeerGroup, Session, and
AddressFamily that combines device name with the type-specific key.

Schema changes (bgp.yml):
- InfraBGPPeerGroup: HFID=local_identifier__value (e.g. spine1__evpn)
- InfraBGPSession: HFID=local_identifier__value (e.g. spine1__10.0.250.11)
- InfraBGPAddressFamily: HFID=local_identifier__value (e.g. spine1__ipv4_unicast)

Object file changes:
- 09-bgp.yml: added local_identifier to 26 PeerGroup entries
- 10-bgp-sessions.yml: added local_identifier to 72 Session + 20 AF entries,
  updated 56 peer_group + 26 active_peer_groups references
Damien merged commit 21a44db736 into main 2026-02-20 15:14:03 +00:00
Damien deleted branch feature/52-object-files 2026-02-20 15:14:07 +00:00
Sign in to join this conversation.