feat: add Infrahub schema for EVPN-VXLAN fabric topology

This commit is contained in:
2026-02-13 14:33:15 +00:00
parent f0e7bd7135
commit c7d5294e59

277
schemas/evpn_fabric.yml Normal file
View File

@@ -0,0 +1,277 @@
# yaml-language-server: $schema=https://schema.infrahub.app/infrahub/schema/latest.json
---
version: "1.0"
generics:
- name: Generic
namespace: Location
include_in_menu: false
hierarchical: true
attributes:
- name: name
kind: Text
unique: true
- name: description
kind: Text
optional: true
nodes:
# -------------------- Location Hierarchy --------------------
- name: Datacenter
namespace: Location
label: "Datacenter"
icon: "mdi:server-network"
inherit_from:
- LocationGeneric
parent: ""
children: LocationRoom
display_label: "{{ name__value }}"
- name: Room
namespace: Location
label: "Room"
icon: "mdi:door"
inherit_from:
- LocationGeneric
parent: LocationDatacenter
children: LocationRack
- name: Rack
namespace: Location
label: "Rack"
icon: "clarity:rack-server-solid"
inherit_from:
- LocationGeneric
parent: LocationRoom
children: ""
relationships:
- name: devices
peer: InfraDevice
kind: Generic
cardinality: many
optional: true
# -------------------- Platform & Role --------------------
- name: Platform
namespace: Infra
label: "Platform"
icon: "mdi:application-cog-outline"
default_filter: name__value
display_label: "{{ name__value }}"
attributes:
- name: name
kind: Text
unique: true
- name: naplam_driver
label: "NAPALM Driver"
kind: Text
optional: true
- name: netmiko_device_type
label: "Netmiko Device Type"
kind: Text
optional: true
- name: containerlab_kind
label: "Containerlab Kind"
kind: Text
optional: true
# -------------------- ASN --------------------
- name: AutonomousSystem
namespace: Infra
label: "Autonomous System"
icon: "mdi:bank-circle-outline"
default_filter: name__value
human_friendly_id: ["name__value", "asn__value"]
order_by: ["asn__value"]
display_label: "{{ name__value }} (AS{{ asn__value }})"
attributes:
- name: name
kind: Text
unique: true
- name: asn
kind: Number
unique: true
- name: description
kind: Text
optional: true
# -------------------- VRF --------------------
- name: VRF
namespace: Infra
label: "VRF"
icon: "mdi:router"
default_filter: name__value
display_label: "{{ name__value }}"
attributes:
- name: name
kind: Text
unique: true
- name: vni
label: "L3 VNI"
kind: Number
optional: true
- name: description
kind: Text
optional: true
# -------------------- VLAN --------------------
- name: VLAN
namespace: Infra
label: "VLAN"
icon: "mdi:lan"
default_filter: name__value
display_label: "VLAN {{ vlan_id__value }} - {{ name__value }}"
order_by: ["vlan_id__value"]
attributes:
- name: name
kind: Text
- name: vlan_id
label: "VLAN ID"
kind: Number
- name: vni
label: "VNI"
kind: Number
optional: true
- name: description
kind: Text
optional: true
relationships:
- name: vrf
peer: InfraVRF
kind: Attribute
cardinality: one
optional: true
# -------------------- Device --------------------
- name: Device
namespace: Infra
label: "Device"
icon: "mdi:router"
default_filter: name__value
human_friendly_id: ["name__value"]
display_label: "{{ name__value }}"
order_by: ["name__value"]
attributes:
- name: name
kind: Text
unique: true
- name: role
kind: Dropdown
choices:
- name: spine
label: Spine
color: "#2196F3"
- name: leaf
label: Leaf
color: "#4CAF50"
- name: host
label: Host
color: "#FF9800"
- name: status
kind: Dropdown
choices:
- name: active
label: Active
color: "#009933"
- name: planned
label: Planned
color: "#cc66ff"
- name: maintenance
label: Maintenance
color: "#ffcc00"
default_value: "active"
- name: router_id
label: "Router ID"
kind: IPHost
optional: true
- name: mgmt_ip
label: "Management IP"
kind: IPHost
optional: true
relationships:
- name: platform
peer: InfraPlatform
kind: Attribute
cardinality: one
optional: true
- name: asn
label: "Autonomous System"
peer: InfraAutonomousSystem
kind: Attribute
cardinality: one
optional: true
- name: location
peer: LocationRack
kind: Attribute
cardinality: one
optional: true
- name: interfaces
peer: InfraInterface
kind: Component
cardinality: many
optional: true
- name: mlag_peer
label: "MLAG Peer"
peer: InfraDevice
kind: Generic
cardinality: one
optional: true
# -------------------- Interface --------------------
- name: Interface
namespace: Infra
label: "Interface"
icon: "mdi:ethernet"
display_label: "{{ name__value }}"
order_by: ["name__value"]
attributes:
- name: name
kind: Text
- name: description
kind: Text
optional: true
- name: interface_type
label: "Type"
kind: Dropdown
choices:
- name: ethernet
label: Ethernet
- name: loopback
label: Loopback
- name: vlan_svi
label: VLAN SVI
- name: port_channel
label: Port-Channel
- name: vxlan
label: VXLAN
- name: management
label: Management
default_value: "ethernet"
- name: mtu
kind: Number
optional: true
- name: enabled
kind: Boolean
default_value: true
- name: ip_address
label: "IP Address"
kind: IPHost
optional: true
relationships:
- name: device
peer: InfraDevice
kind: Parent
cardinality: one
optional: false
- name: connected_interface
label: "Connected To"
peer: InfraInterface
kind: Generic
cardinality: one
optional: true
- name: vlans
label: "Allowed VLANs"
peer: InfraVLAN
kind: Generic
cardinality: many
optional: true