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:
216
infrahub/schemas/05_interfaces.yml
Normal file
216
infrahub/schemas/05_interfaces.yml
Normal file
@@ -0,0 +1,216 @@
|
||||
# yaml-language-server: $schema=https://schema.infrahub.app/infrahub/schema/latest.json
|
||||
---
|
||||
version: "1.0"
|
||||
|
||||
nodes:
|
||||
- name: Interface
|
||||
namespace: Network
|
||||
label: "Interface"
|
||||
icon: "mdi:ethernet"
|
||||
include_in_menu: true
|
||||
menu_placement: "NetworkDevice"
|
||||
human_friendly_id: ["device__hostname__value", "name__value"]
|
||||
display_label: "name__value"
|
||||
order_by:
|
||||
- device__hostname__value
|
||||
- name__value
|
||||
uniqueness_constraints:
|
||||
- ["device", "name__value"]
|
||||
attributes:
|
||||
- name: name
|
||||
kind: Text
|
||||
optional: false
|
||||
description: "Interface name (e.g., Ethernet1, Loopback0)"
|
||||
|
||||
- name: description
|
||||
kind: Text
|
||||
optional: true
|
||||
description: "Interface description"
|
||||
|
||||
- name: interface_type
|
||||
kind: Dropdown
|
||||
optional: false
|
||||
default_value: "ethernet"
|
||||
choices:
|
||||
- name: ethernet
|
||||
label: Ethernet
|
||||
description: "Physical Ethernet interface"
|
||||
- name: loopback
|
||||
label: Loopback
|
||||
description: "Loopback interface"
|
||||
- name: port_channel
|
||||
label: Port-Channel
|
||||
description: "Link aggregation group"
|
||||
- name: vlan
|
||||
label: VLAN (SVI)
|
||||
description: "VLAN interface"
|
||||
- name: vxlan
|
||||
label: VXLAN
|
||||
description: "VXLAN tunnel interface"
|
||||
- name: management
|
||||
label: Management
|
||||
description: "Management interface"
|
||||
|
||||
- name: enabled
|
||||
kind: Boolean
|
||||
optional: false
|
||||
default_value: true
|
||||
description: "Interface administrative status"
|
||||
|
||||
- name: mtu
|
||||
kind: Number
|
||||
optional: true
|
||||
default_value: 9214
|
||||
description: "Interface MTU"
|
||||
|
||||
- name: speed
|
||||
kind: Dropdown
|
||||
optional: true
|
||||
choices:
|
||||
- name: 1g
|
||||
label: 1 Gbps
|
||||
- name: 10g
|
||||
label: 10 Gbps
|
||||
- name: 25g
|
||||
label: 25 Gbps
|
||||
- name: 40g
|
||||
label: 40 Gbps
|
||||
- name: 100g
|
||||
label: 100 Gbps
|
||||
description: "Interface speed"
|
||||
|
||||
# Layer 2 Attributes
|
||||
- name: switchport_mode
|
||||
kind: Dropdown
|
||||
optional: true
|
||||
choices:
|
||||
- name: access
|
||||
label: Access
|
||||
- name: trunk
|
||||
label: Trunk
|
||||
- name: routed
|
||||
label: Routed (no switchport)
|
||||
description: "Switchport mode"
|
||||
|
||||
- name: trunk_groups
|
||||
kind: Text
|
||||
optional: true
|
||||
description: "Trunk groups (comma-separated)"
|
||||
|
||||
# Layer 3 Attributes
|
||||
- name: ip_unnumbered
|
||||
kind: Boolean
|
||||
optional: false
|
||||
default_value: false
|
||||
description: "Use IP unnumbered"
|
||||
|
||||
# Port-Channel Attributes
|
||||
- name: channel_id
|
||||
kind: Number
|
||||
optional: true
|
||||
description: "Port-channel ID"
|
||||
|
||||
- name: lacp_mode
|
||||
kind: Dropdown
|
||||
optional: true
|
||||
choices:
|
||||
- name: active
|
||||
label: Active
|
||||
- name: passive
|
||||
label: Passive
|
||||
- name: "on"
|
||||
label: On (no LACP)
|
||||
description: "LACP mode for port-channel"
|
||||
|
||||
# Loopback Attributes
|
||||
- name: loopback_id
|
||||
kind: Number
|
||||
optional: true
|
||||
description: "Loopback interface ID (0, 1, etc.)"
|
||||
|
||||
- name: loopback_purpose
|
||||
kind: Dropdown
|
||||
optional: true
|
||||
choices:
|
||||
- name: router_id
|
||||
label: Router ID (Loopback0)
|
||||
- name: vtep
|
||||
label: VTEP (Loopback1)
|
||||
- name: other
|
||||
label: Other
|
||||
description: "Loopback purpose"
|
||||
|
||||
relationships:
|
||||
- name: device
|
||||
peer: NetworkDevice
|
||||
optional: false
|
||||
cardinality: one
|
||||
kind: Parent
|
||||
description: "Parent device"
|
||||
|
||||
- name: ip_addresses
|
||||
peer: IpamIPAddress
|
||||
optional: true
|
||||
cardinality: many
|
||||
kind: Generic
|
||||
description: "IP addresses assigned to interface"
|
||||
|
||||
- name: unnumbered_source
|
||||
peer: NetworkInterface
|
||||
identifier: interface__unnumbered_source
|
||||
optional: true
|
||||
cardinality: one
|
||||
kind: Attribute
|
||||
description: "Source interface for IP unnumbered"
|
||||
|
||||
- name: allowed_vlans
|
||||
peer: NetworkVLAN
|
||||
optional: true
|
||||
cardinality: many
|
||||
kind: Generic
|
||||
description: "VLANs allowed on trunk"
|
||||
|
||||
- name: port_channel
|
||||
peer: NetworkInterface
|
||||
identifier: interface__port_channel
|
||||
optional: true
|
||||
cardinality: one
|
||||
kind: Attribute
|
||||
description: "Parent port-channel"
|
||||
|
||||
- name: member_interfaces
|
||||
peer: NetworkInterface
|
||||
identifier: interface__member_interfaces
|
||||
optional: true
|
||||
cardinality: many
|
||||
kind: Generic
|
||||
description: "Member interfaces (for port-channel)"
|
||||
|
||||
- name: connected_to
|
||||
peer: NetworkInterface
|
||||
identifier: interface__connected_to
|
||||
optional: true
|
||||
cardinality: one
|
||||
kind: Attribute
|
||||
description: "Remote interface connection"
|
||||
|
||||
- name: mlag_config
|
||||
peer: NetworkMLAGInterface
|
||||
optional: true
|
||||
cardinality: one
|
||||
kind: Component
|
||||
description: "MLAG interface configuration"
|
||||
|
||||
- name: bgp_sessions
|
||||
peer: NetworkBGPNeighbor
|
||||
optional: true
|
||||
cardinality: many
|
||||
kind: Generic
|
||||
description: "BGP sessions on this interface"
|
||||
|
||||
- name: ospf_config
|
||||
peer: NetworkOSPFInterface
|
||||
optional: true
|
||||
cardinality: one
|
||||
kind: Component
|
||||
description: "OSPF interface configuration"
|
||||
Reference in New Issue
Block a user