Files
Damien Arnodo 12d927d460 fix: add human_friendly_id to 4 schemas for idempotent Repository sync (#29)
## Summary

- Add `local_identifier` attribute + `uniqueness_constraints` + `human_friendly_id` to **InfraVlanVniMapping**, **InfraEVPNInstance**, **InfraMlagInterface**, and **InfraUnderlayLink**, following the same pattern already used for `InfraBGPPeerGroup` and `InfraBGPSession`
- Populate `local_identifier` in all corresponding object YAML files with deterministic composite keys so Infrahub can upsert objects during Repository backend sync instead of creating duplicates

## Schema changes

| Schema file | Model | human_friendly_id |
|---|---|---|
| `infrahub/schemas/vlan_vxlan.yml` | `InfraVlanVniMapping` | `local_identifier__value` |
| `infrahub/schemas/vlan_vxlan.yml` | `InfraEVPNInstance` | `local_identifier__value` |
| `infrahub/schemas/mlag.yml` | `InfraMlagInterface` | `local_identifier__value` |
| `infrahub/schemas/extensions.yml` | `InfraUnderlayLink` | `local_identifier__value` |

## Object file changes

| Object file | Kind | Key format | Example |
|---|---|---|---|
| `infrahub/objects/06-vlans-vxlan.yml` | `InfraVlanVniMapping` | `{device}__vlan{vlan_id}__vni{vni_id}` | `leaf1__vlan40__vni110040` |
| `infrahub/objects/06-vlans-vxlan.yml` | `InfraEVPNInstance` | `{device}__vlan{vlan_id}` | `leaf1__vlan40` |
| `infrahub/objects/12-mlag.yml` | `InfraMlagInterface` | `mlag{id}__{device1}-{device2}` | `mlag1__leaf1-leaf2` |
| `infrahub/objects/14-fabric-links.yml` | `InfraUnderlayLink` | `{local_dev}-{local_intf}__{remote_dev}-{remote_intf}` | `spine1-eth1__leaf1-eth11` |

Note: `InfraMlagInterface` objects (4 entries, one per MLAG pair) and `InfraUnderlayLink` objects (16 entries, all spine↔leaf P2P links) are new additions to their respective files.

## Test plan

- [x] `infrahubctl schema load infrahub/schemas/*.yml` succeeds without errors
- [x] `infrahubctl object load infrahub/objects/06-vlans-vxlan.yml` succeeds
- [x] `infrahubctl object load infrahub/objects/12-mlag.yml` succeeds
- [x] `infrahubctl object load infrahub/objects/14-fabric-links.yml` succeeds
- [x] Re-running the same load is idempotent (no duplicate objects created)
- [x] Gitea Repository backend sync completes without import errors
2026-03-03 16:26:46 +00:00

181 lines
5.9 KiB
YAML

# MLAG: Domains and Peer Configs
# Depends on: 02-devices, 03-interfaces (Vlan4090, Port-Channel999), 05-vlans-vxlan (VLAN 4090/4091)
#
# All 4 MLAG pairs share domain-id "leafs" and virtual-mac c001.cafe.babe
# but each is a separate MlagDomain object linking two devices.
# MLAG peer VLAN: 4090, MLAG iBGP VLAN: 4091
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: InfraMlagDomain
data:
# MLAG pair 1: leaf1 + leaf2
- domain_id: leafs-1-2
description: MLAG domain for leaf1/leaf2 pair
virtual_mac: "c001.cafe.babe"
heartbeat_vrf: mgmt
dual_primary_detection: true
dual_primary_delay: 10
dual_primary_action: errdisable
devices:
- ["leaf1"]
- ["leaf2"]
peer_vlan: ["4090"]
ibgp_vlan: ["4091"]
# MLAG pair 2: leaf3 + leaf4
- domain_id: leafs-3-4
description: MLAG domain for leaf3/leaf4 pair
virtual_mac: "c001.cafe.babe"
heartbeat_vrf: mgmt
dual_primary_detection: true
dual_primary_delay: 10
dual_primary_action: errdisable
devices:
- ["leaf3"]
- ["leaf4"]
peer_vlan: ["4090"]
ibgp_vlan: ["4091"]
# MLAG pair 3: leaf5 + leaf6
- domain_id: leafs-5-6
description: MLAG domain for leaf5/leaf6 pair
virtual_mac: "c001.cafe.babe"
heartbeat_vrf: mgmt
dual_primary_detection: true
dual_primary_delay: 10
dual_primary_action: errdisable
devices:
- ["leaf5"]
- ["leaf6"]
peer_vlan: ["4090"]
ibgp_vlan: ["4091"]
# MLAG pair 4: leaf7 + leaf8
- domain_id: leafs-7-8
description: MLAG domain for leaf7/leaf8 pair
virtual_mac: "c001.cafe.babe"
heartbeat_vrf: mgmt
dual_primary_detection: true
dual_primary_delay: 10
dual_primary_action: errdisable
devices:
- ["leaf7"]
- ["leaf8"]
peer_vlan: ["4090"]
ibgp_vlan: ["4091"]
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: InfraMlagPeerConfig
data:
# Leaf1 MLAG peer config
- device: ["leaf1"]
mlag_domain: ["leafs-1-2"]
local_interface_ip: "10.0.199.254/31"
peer_address: "10.0.199.255"
heartbeat_peer_ip: "172.16.0.50"
local_interface: ["leaf1", "Vlan4090"]
peer_link: ["leaf1", "Port-Channel999"]
# Leaf2 MLAG peer config
- device: ["leaf2"]
mlag_domain: ["leafs-1-2"]
local_interface_ip: "10.0.199.255/31"
peer_address: "10.0.199.254"
heartbeat_peer_ip: "172.16.0.25"
local_interface: ["leaf2", "Vlan4090"]
peer_link: ["leaf2", "Port-Channel999"]
# Leaf3 MLAG peer config
- device: ["leaf3"]
mlag_domain: ["leafs-3-4"]
local_interface_ip: "10.0.199.252/31"
peer_address: "10.0.199.253"
heartbeat_peer_ip: "172.16.0.28"
local_interface: ["leaf3", "Vlan4090"]
peer_link: ["leaf3", "Port-Channel999"]
# Leaf4 MLAG peer config
- device: ["leaf4"]
mlag_domain: ["leafs-3-4"]
local_interface_ip: "10.0.199.253/31"
peer_address: "10.0.199.252"
heartbeat_peer_ip: "172.16.0.27"
local_interface: ["leaf4", "Vlan4090"]
peer_link: ["leaf4", "Port-Channel999"]
# Leaf5 MLAG peer config
- device: ["leaf5"]
mlag_domain: ["leafs-5-6"]
local_interface_ip: "10.0.199.250/31"
peer_address: "10.0.199.251"
heartbeat_peer_ip: "172.16.0.30"
local_interface: ["leaf5", "Vlan4090"]
peer_link: ["leaf5", "Port-Channel999"]
# Leaf6 MLAG peer config
- device: ["leaf6"]
mlag_domain: ["leafs-5-6"]
local_interface_ip: "10.0.199.251/31"
peer_address: "10.0.199.250"
heartbeat_peer_ip: "172.16.0.29"
local_interface: ["leaf6", "Vlan4090"]
peer_link: ["leaf6", "Port-Channel999"]
# Leaf7 MLAG peer config
- device: ["leaf7"]
mlag_domain: ["leafs-7-8"]
local_interface_ip: "10.0.199.248/31"
peer_address: "10.0.199.249"
heartbeat_peer_ip: "172.16.0.32"
local_interface: ["leaf7", "Vlan4090"]
peer_link: ["leaf7", "Port-Channel999"]
# Leaf8 MLAG peer config
- device: ["leaf8"]
mlag_domain: ["leafs-7-8"]
local_interface_ip: "10.0.199.249/31"
peer_address: "10.0.199.248"
heartbeat_peer_ip: "172.16.0.31"
local_interface: ["leaf8", "Vlan4090"]
peer_link: ["leaf8", "Port-Channel999"]
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: InfraMlagInterface
data:
# MLAG interface 1 on leaf1/leaf2 pair (Port-Channel1 → host1)
- local_identifier: mlag1__leaf1-leaf2
mlag_id: 1
description: "MLAG interface 1 for leaf1/leaf2 pair (host1)"
lacp_fallback_timeout: 5
lacp_fallback_individual: true
mlag_domain: ["leafs-1-2"]
lag_interfaces:
- ["leaf1", "Port-Channel1"]
- ["leaf2", "Port-Channel1"]
# MLAG interface 1 on leaf3/leaf4 pair (Port-Channel1 → host2)
- local_identifier: mlag1__leaf3-leaf4
mlag_id: 1
description: "MLAG interface 1 for leaf3/leaf4 pair (host2)"
lacp_fallback_timeout: 5
lacp_fallback_individual: true
mlag_domain: ["leafs-3-4"]
lag_interfaces:
- ["leaf3", "Port-Channel1"]
- ["leaf4", "Port-Channel1"]
# MLAG interface 1 on leaf5/leaf6 pair (Port-Channel1 → host3)
- local_identifier: mlag1__leaf5-leaf6
mlag_id: 1
description: "MLAG interface 1 for leaf5/leaf6 pair (host3)"
lacp_fallback_timeout: 5
lacp_fallback_individual: true
mlag_domain: ["leafs-5-6"]
lag_interfaces:
- ["leaf5", "Port-Channel1"]
- ["leaf6", "Port-Channel1"]
# MLAG interface 1 on leaf7/leaf8 pair (Port-Channel1 → host4)
- local_identifier: mlag1__leaf7-leaf8
mlag_id: 1
description: "MLAG interface 1 for leaf7/leaf8 pair (host4)"
lacp_fallback_timeout: 5
lacp_fallback_individual: true
mlag_domain: ["leafs-7-8"]
lag_interfaces:
- ["leaf7", "Port-Channel1"]
- ["leaf8", "Port-Channel1"]