Refactor Infrahub config and rename schema folder
Move schema files into a dedicated 'schemas' directory and update .infrahub.yml to reference them along with adding sections for schemas, generators, and queries.
This commit is contained in:
197
infrahub/schemas/04_device.yml
Normal file
197
infrahub/schemas/04_device.yml
Normal file
@@ -0,0 +1,197 @@
|
||||
# yaml-language-server: $schema=https://schema.infrahub.app/infrahub/schema/latest.json
|
||||
---
|
||||
version: "1.0"
|
||||
|
||||
nodes:
|
||||
- name: Device
|
||||
namespace: Network
|
||||
label: "Network Device"
|
||||
icon: "mdi:router"
|
||||
include_in_menu: true
|
||||
human_friendly_id: ["hostname__value"]
|
||||
display_label: "hostname__value"
|
||||
order_by:
|
||||
- hostname__value
|
||||
generate_template: false
|
||||
attributes:
|
||||
- name: hostname
|
||||
kind: Text
|
||||
unique: true
|
||||
optional: false
|
||||
description: "Device hostname (e.g., spine1-DC1)"
|
||||
|
||||
- name: description
|
||||
kind: Text
|
||||
optional: true
|
||||
description: "Device description"
|
||||
|
||||
- name: role
|
||||
kind: Dropdown
|
||||
optional: false
|
||||
choices:
|
||||
- name: spine
|
||||
label: Spine
|
||||
description: "Spine switch (L3 core)"
|
||||
color: "#ff6b6b"
|
||||
- name: leaf
|
||||
label: Leaf
|
||||
description: "Leaf switch (ToR/Aggregation)"
|
||||
color: "#4ecdc4"
|
||||
- name: borderleaf
|
||||
label: Border Leaf
|
||||
description: "Border leaf (DCI gateway capable)"
|
||||
color: "#95e1d3"
|
||||
- name: access
|
||||
label: Access
|
||||
description: "Access switch (rack ToR)"
|
||||
color: "#ffe66d"
|
||||
- name: host
|
||||
label: Host
|
||||
description: "Host/Server device"
|
||||
color: "#f1faee"
|
||||
|
||||
- name: platform
|
||||
kind: Text
|
||||
optional: false
|
||||
default_value: "cEOS"
|
||||
description: "Device platform (e.g., cEOS, vEOS, EOS)"
|
||||
|
||||
- name: eos_version
|
||||
kind: Text
|
||||
optional: true
|
||||
description: "EOS software version"
|
||||
|
||||
- name: serial_number
|
||||
kind: Text
|
||||
optional: true
|
||||
unique: true
|
||||
description: "Device serial number"
|
||||
|
||||
- name: model
|
||||
kind: Text
|
||||
optional: true
|
||||
description: "Device model (e.g., DCS-7050SX3-48YC8)"
|
||||
|
||||
- name: management_ip_template
|
||||
kind: Text
|
||||
optional: true
|
||||
description: "Template for generating the management IP address"
|
||||
|
||||
- name: management_ip
|
||||
kind: IPHost
|
||||
optional: true
|
||||
read_only: true
|
||||
description: "Management IP address"
|
||||
|
||||
- name: status
|
||||
kind: Dropdown
|
||||
optional: false
|
||||
default_value: "active"
|
||||
choices:
|
||||
- name: active
|
||||
label: Active
|
||||
color: "#7fbf7f"
|
||||
- name: planned
|
||||
label: Planned
|
||||
color: "#ffd966"
|
||||
- name: maintenance
|
||||
label: Maintenance
|
||||
color: "#ff9999"
|
||||
- name: failed
|
||||
label: Failed
|
||||
color: "#ff0000"
|
||||
- name: decommissioned
|
||||
label: Decommissioned
|
||||
color: "#cccccc"
|
||||
|
||||
# Role-specific attributes
|
||||
- name: spine_id
|
||||
kind: Number
|
||||
optional: true
|
||||
description: "Spine ID (1, 2, 3...)"
|
||||
|
||||
- name: leaf_id
|
||||
kind: Number
|
||||
optional: true
|
||||
description: "Leaf ID (1, 2, 3, 4...)"
|
||||
|
||||
- name: mlag_side
|
||||
kind: Dropdown
|
||||
optional: true
|
||||
choices:
|
||||
- name: left
|
||||
label: Left (Odd)
|
||||
- name: right
|
||||
label: Right (Even)
|
||||
description: "MLAG pairing side (left=odd, right=even)"
|
||||
|
||||
relationships:
|
||||
- name: datacenter
|
||||
peer: InfraDatacenter
|
||||
optional: true
|
||||
cardinality: one
|
||||
kind: Attribute
|
||||
description: "Parent datacenter"
|
||||
|
||||
- name: bay
|
||||
peer: InfraBay
|
||||
optional: true
|
||||
cardinality: one
|
||||
kind: Attribute
|
||||
description: "Bay location (for access/hosts)"
|
||||
|
||||
- name: site
|
||||
peer: LocationSite
|
||||
optional: true
|
||||
cardinality: one
|
||||
kind: Attribute
|
||||
description: "Site location"
|
||||
|
||||
- name: interfaces
|
||||
peer: NetworkInterface
|
||||
optional: true
|
||||
cardinality: many
|
||||
kind: Component
|
||||
description: "Device interfaces"
|
||||
|
||||
- name: bgp_config
|
||||
peer: NetworkBGPConfig
|
||||
optional: true
|
||||
cardinality: one
|
||||
kind: Component
|
||||
description: "BGP configuration"
|
||||
|
||||
- name: ospf_config
|
||||
peer: NetworkOSPFConfig
|
||||
optional: true
|
||||
cardinality: one
|
||||
kind: Component
|
||||
description: "OSPF configuration"
|
||||
|
||||
- name: mlag_domain
|
||||
peer: NetworkMLAGDomain
|
||||
optional: true
|
||||
cardinality: one
|
||||
kind: Attribute
|
||||
description: "MLAG domain membership"
|
||||
|
||||
- name: evpn_config
|
||||
peer: NetworkEVPNConfig
|
||||
optional: true
|
||||
cardinality: one
|
||||
kind: Component
|
||||
description: "EVPN configuration"
|
||||
|
||||
- name: vlans
|
||||
peer: NetworkVLAN
|
||||
optional: true
|
||||
cardinality: many
|
||||
kind: Generic
|
||||
description: "VLANs configured on device"
|
||||
|
||||
- name: vrfs
|
||||
peer: NetworkVRF
|
||||
optional: true
|
||||
cardinality: many
|
||||
kind: Generic
|
||||
description: "VRFs configured on device"
|
||||
Reference in New Issue
Block a user