From 9a0b6dd1e625c318a948300989fe1a073f1fbe75 Mon Sep 17 00:00:00 2001 From: Damien Date: Sat, 21 Feb 2026 20:59:10 +0100 Subject: [PATCH 1/2] feat(schema): add bidirectional relationship identifiers and fabric-device links - LocationSite: add devices (device__site) and fabrics (fabric__sites) reverse relationships - InfraDevice.site: add identifier device__site - InfraDevice: add fabric relationship (fabric__devices) - InfraFabric.sites: add identifier fabric__sites; add devices reverse relationship (fabric__devices) - InfraInterfaceVlan.vlan: add identifier vlan__svi - InfraVLAN: add svi_interfaces reverse relationship (vlan__svi) - Add 14-fabric-links.yml to assign all 10 devices to the evpn-lab fabric Co-Authored-By: Claude Sonnet 4.6 --- infrahub/objects/14-fabric-links.yml | 28 ++++++++++++++++++++++++++++ infrahub/schemas/base.yml | 21 +++++++++++++++++++++ infrahub/schemas/extensions.yml | 7 +++++++ infrahub/schemas/vlan_vxlan.yml | 6 ++++++ 4 files changed, 62 insertions(+) create mode 100644 infrahub/objects/14-fabric-links.yml diff --git a/infrahub/objects/14-fabric-links.yml b/infrahub/objects/14-fabric-links.yml new file mode 100644 index 0000000..999022b --- /dev/null +++ b/infrahub/objects/14-fabric-links.yml @@ -0,0 +1,28 @@ +# Fabric-to-Device links +# Depends on: 02-devices, 03-fabric +--- +apiVersion: infrahub.app/v1 +kind: Object +spec: + kind: InfraDevice + data: + - name: spine1 + fabric: "evpn-lab" + - name: spine2 + fabric: "evpn-lab" + - name: leaf1 + fabric: "evpn-lab" + - name: leaf2 + fabric: "evpn-lab" + - name: leaf3 + fabric: "evpn-lab" + - name: leaf4 + fabric: "evpn-lab" + - name: leaf5 + fabric: "evpn-lab" + - name: leaf6 + fabric: "evpn-lab" + - name: leaf7 + fabric: "evpn-lab" + - name: leaf8 + fabric: "evpn-lab" diff --git a/infrahub/schemas/base.yml b/infrahub/schemas/base.yml index 7bd5aa9..8b13f74 100644 --- a/infrahub/schemas/base.yml +++ b/infrahub/schemas/base.yml @@ -62,6 +62,19 @@ nodes: kind: Text optional: true description: Facility identifier or code + relationships: + - name: devices + peer: InfraDevice + identifier: device__site + cardinality: many + kind: Generic + description: Devices at this site + - name: fabrics + peer: InfraFabric + identifier: fabric__sites + cardinality: many + kind: Generic + description: Fabrics deployed at this site # ================================================================ # Platform @@ -145,6 +158,7 @@ nodes: relationships: - name: site peer: LocationSite + identifier: device__site cardinality: one optional: true - name: platform @@ -164,6 +178,12 @@ nodes: peer: InfraMlagDomain cardinality: one optional: true + - name: fabric + peer: InfraFabric + identifier: fabric__devices + cardinality: one + optional: true + description: Fabric this device belongs to # ================================================================ # Interface Types (inherit from InfraInterface generic) @@ -263,6 +283,7 @@ nodes: relationships: - name: vlan peer: InfraVLAN + identifier: vlan__svi cardinality: one optional: true diff --git a/infrahub/schemas/extensions.yml b/infrahub/schemas/extensions.yml index d2d8c9e..fb5517d 100644 --- a/infrahub/schemas/extensions.yml +++ b/infrahub/schemas/extensions.yml @@ -55,8 +55,15 @@ nodes: description: AS used by spine layer - name: sites peer: LocationSite + identifier: fabric__sites cardinality: many optional: true + - name: devices + peer: InfraDevice + identifier: fabric__devices + cardinality: many + kind: Generic + description: Devices in this fabric # ================================================================ # Underlay P2P Link diff --git a/infrahub/schemas/vlan_vxlan.yml b/infrahub/schemas/vlan_vxlan.yml index b17cf82..a8d28a0 100644 --- a/infrahub/schemas/vlan_vxlan.yml +++ b/infrahub/schemas/vlan_vxlan.yml @@ -70,6 +70,12 @@ nodes: peer: LocationSite cardinality: one optional: true + - name: svi_interfaces + peer: InfraInterfaceVlan + identifier: vlan__svi + cardinality: many + kind: Generic + description: SVI interfaces for this VLAN # ================================================================ # VNI (VXLAN Network Identifier) From ac1634b561e752e84c348889ff41166376fe9117 Mon Sep 17 00:00:00 2001 From: Damien Date: Sun, 22 Feb 2026 10:07:27 +0100 Subject: [PATCH 2/2] Add device roles to fabric links --- infrahub/objects/14-fabric-links.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/infrahub/objects/14-fabric-links.yml b/infrahub/objects/14-fabric-links.yml index 999022b..175bb7c 100644 --- a/infrahub/objects/14-fabric-links.yml +++ b/infrahub/objects/14-fabric-links.yml @@ -7,22 +7,32 @@ spec: kind: InfraDevice data: - name: spine1 + role: spine fabric: "evpn-lab" - name: spine2 + role: spine fabric: "evpn-lab" - name: leaf1 + role: leaf fabric: "evpn-lab" - name: leaf2 + role: leaf fabric: "evpn-lab" - name: leaf3 + role: leaf fabric: "evpn-lab" - name: leaf4 + role: leaf fabric: "evpn-lab" - name: leaf5 + role: leaf fabric: "evpn-lab" - name: leaf6 + role: leaf fabric: "evpn-lab" - name: leaf7 + role: leaf fabric: "evpn-lab" - name: leaf8 + role: leaf fabric: "evpn-lab"