Files
arista-evpn-vxlan-clab/infrahub/schemas/mlag.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

149 lines
4.5 KiB
YAML

# MLAG Schema for EVPN-VXLAN Fabric
# Defines MLAG domain and peer configuration
---
version: "1.0"
nodes:
# ================================================================
# MLAG Domain
# ================================================================
- name: MlagDomain
namespace: Infra
description: MLAG domain configuration for leaf pair
label: MLAG Domain
icon: mdi--link-variant
include_in_menu: false
human_friendly_id:
- domain_id__value
display_label: "{{ domain_id__value }}"
attributes:
- name: domain_id
kind: Text
description: MLAG domain identifier (e.g., leafs)
- name: description
kind: Text
optional: true
- name: virtual_mac
kind: Text
description: "Shared virtual MAC (format: xxxx.xxxx.xxxx)"
- name: heartbeat_vrf
kind: Text
default_value: mgmt
description: VRF for heartbeat (typically mgmt)
- name: dual_primary_detection
kind: Boolean
default_value: true
- name: dual_primary_delay
kind: Number
default_value: 10
description: Delay in seconds before dual-primary action
- name: dual_primary_action
kind: Dropdown
default_value: errdisable
choices:
- name: errdisable
label: Error Disable Interfaces
- name: none
label: No Action
relationships:
- name: devices
peer: InfraDevice
cardinality: many
min_count: 2
max_count: 2
description: MLAG peer devices
- name: peer_vlan
peer: InfraVLAN
identifier: mlag_domain_peer_vlan
cardinality: one
direction: outbound
description: VLAN for MLAG peer-link control traffic
- name: ibgp_vlan
peer: InfraVLAN
identifier: mlag_domain_ibgp_vlan
cardinality: one
direction: outbound
optional: true
description: VLAN for iBGP peering between MLAG peers
# ================================================================
# MLAG Peer Configuration (per device)
# ================================================================
- name: MlagPeerConfig
namespace: Infra
description: MLAG configuration on a specific device
label: MLAG Peer Config
icon: mdi--server-network
include_in_menu: false
human_friendly_id:
- device__name__value
display_label: "{{ local_interface_ip__value }}"
attributes:
- name: local_interface_ip
kind: IPHost
description: IP on MLAG peer VLAN SVI
- name: peer_address
kind: IPHost
description: Peer's MLAG SVI IP address
- name: heartbeat_peer_ip
kind: IPHost
description: Peer's management IP for heartbeat
relationships:
- name: device
peer: InfraDevice
cardinality: one
kind: Parent
optional: false
- name: mlag_domain
peer: InfraMlagDomain
cardinality: one
- name: local_interface
peer: InfraInterfaceVlan
cardinality: one
description: Local MLAG SVI
- name: peer_link
peer: InfraInterfaceLag
cardinality: one
description: Peer-link port-channel
# ================================================================
# MLAG Interface (MLAG-enabled LAG)
# ================================================================
- name: MlagInterface
namespace: Infra
description: MLAG interface configuration
label: MLAG Interface
icon: mdi--ethernet-cable
include_in_menu: false
uniqueness_constraints:
- ["local_identifier__value"]
human_friendly_id:
- local_identifier__value
display_label: "{{ mlag_id__value }}"
attributes:
- name: local_identifier
kind: Text
description: "Unique identifier combining mlag_id and peer devices (e.g. mlag1__leaf1-leaf2)"
- name: mlag_id
kind: Number
description: MLAG interface ID
- name: description
kind: Text
optional: true
- name: lacp_fallback_timeout
kind: Number
default_value: 5
description: LACP fallback timeout in seconds
- name: lacp_fallback_individual
kind: Boolean
default_value: true
relationships:
- name: mlag_domain
peer: InfraMlagDomain
cardinality: one
- name: lag_interfaces
peer: InfraInterfaceLag
cardinality: many
min_count: 1
max_count: 2
description: LAG interfaces on each MLAG peer