Files
arista-evpn-vxlan-clab/infrahub/objects/06-vlans-vxlan.yml
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

176 lines
4.9 KiB
YAML

# VLANs, VNIs, VTEPs, VLAN-VNI mappings, EVPN instances
# Depends on: 02-devices, 03-interfaces
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: InfraVLAN
data:
- vlan_id: 34
name: vrf-gold-subnet
description: VRF gold L3 subnet (leaf3/leaf4)
status: active
vlan_type: standard
- vlan_id: 40
name: test-l2-vxlan
description: L2 VXLAN test VLAN
status: active
vlan_type: standard
- vlan_id: 78
name: vrf-gold-subnet
description: VRF gold L3 subnet (leaf7/leaf8)
status: active
vlan_type: standard
- vlan_id: 900
name: bgp-border
description: BGP border peering VLAN
status: active
vlan_type: standard
- vlan_id: 4090
name: mlag-peer
description: MLAG peer-link control
status: active
vlan_type: mlag_peer
trunk_groups:
- mlag-peer
stp_enabled: false
- vlan_id: 4091
name: mlag-ibgp
description: MLAG iBGP peering
status: active
vlan_type: mlag_ibgp
trunk_groups:
- mlag-peer
stp_enabled: false
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: InfraVNI
data:
- vni: 110040
description: L2VNI for VLAN 40 (test-l2-vxlan)
vni_type: l2vni
vlan: ["40"]
- vni: 100001
description: L3VNI for VRF gold
vni_type: l3vni
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: InfraVTEP
data:
# VTEP on leaf1 (shared VTEP1 IP 10.0.255.11)
- device: ["leaf1"]
source_address: "10.0.255.11"
udp_port: 4789
learn_restrict: any
source_interface: ["leaf1", "Loopback1"]
# VTEP on leaf2 (shared VTEP1 IP 10.0.255.11)
- device: ["leaf2"]
source_address: "10.0.255.11"
udp_port: 4789
learn_restrict: any
source_interface: ["leaf2", "Loopback1"]
# VTEP on leaf3 (shared VTEP2 IP 10.0.255.12)
- device: ["leaf3"]
source_address: "10.0.255.12"
udp_port: 4789
learn_restrict: any
source_interface: ["leaf3", "Loopback1"]
# VTEP on leaf4 (shared VTEP2 IP 10.0.255.12)
- device: ["leaf4"]
source_address: "10.0.255.12"
udp_port: 4789
learn_restrict: any
source_interface: ["leaf4", "Loopback1"]
# VTEP on leaf5 (shared VTEP3 IP 10.0.255.13)
- device: ["leaf5"]
source_address: "10.0.255.13"
udp_port: 4789
learn_restrict: any
source_interface: ["leaf5", "Loopback1"]
# VTEP on leaf6 (shared VTEP3 IP 10.0.255.13)
- device: ["leaf6"]
source_address: "10.0.255.13"
udp_port: 4789
learn_restrict: any
source_interface: ["leaf6", "Loopback1"]
# VTEP on leaf7 (shared VTEP4 IP 10.0.255.14)
- device: ["leaf7"]
source_address: "10.0.255.14"
udp_port: 4789
learn_restrict: any
source_interface: ["leaf7", "Loopback1"]
# VTEP on leaf8 (shared VTEP4 IP 10.0.255.14)
- device: ["leaf8"]
source_address: "10.0.255.14"
udp_port: 4789
learn_restrict: any
source_interface: ["leaf8", "Loopback1"]
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: InfraVlanVniMapping
data:
# VLAN 40 <-> VNI 110040 on leaf1/2/5/6 (L2 VXLAN leafs)
- local_identifier: leaf1__vlan40__vni110040
vtep: ["leaf1"]
vlan: ["40"]
vni: ["110040"]
description: "VLAN 40 <-> VNI 110040"
- local_identifier: leaf2__vlan40__vni110040
vtep: ["leaf2"]
vlan: ["40"]
vni: ["110040"]
description: "VLAN 40 <-> VNI 110040"
- local_identifier: leaf5__vlan40__vni110040
vtep: ["leaf5"]
vlan: ["40"]
vni: ["110040"]
description: "VLAN 40 <-> VNI 110040"
- local_identifier: leaf6__vlan40__vni110040
vtep: ["leaf6"]
vlan: ["40"]
vni: ["110040"]
description: "VLAN 40 <-> VNI 110040"
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: InfraEVPNInstance
data:
# EVPN instance for VLAN 40 on L2 VXLAN leafs
# leaf1: rd 65001:110040, rt both 40:110040
- local_identifier: leaf1__vlan40
device: ["leaf1"]
vlan: ["40"]
route_distinguisher: "65001:110040"
route_target_import: "40:110040"
route_target_export: "40:110040"
redistribute_learned: true
- local_identifier: leaf2__vlan40
device: ["leaf2"]
vlan: ["40"]
route_distinguisher: "65001:110040"
route_target_import: "40:110040"
route_target_export: "40:110040"
redistribute_learned: true
# leaf5/6: rd 65003:110040, rt both 40:110040
- local_identifier: leaf5__vlan40
device: ["leaf5"]
vlan: ["40"]
route_distinguisher: "65003:110040"
route_target_import: "40:110040"
route_target_export: "40:110040"
redistribute_learned: true
- local_identifier: leaf6__vlan40
device: ["leaf6"]
vlan: ["40"]
route_distinguisher: "65003:110040"
route_target_import: "40:110040"
route_target_export: "40:110040"
redistribute_learned: true