From f82f9d22a14ac14d5ac176b2e93163498972ae06 Mon Sep 17 00:00:00 2001 From: Damien Date: Fri, 20 Mar 2026 19:58:34 +0100 Subject: [PATCH] Add IPAM foundation objects and schemas Add device model, supernet prefixes, and ASN number pool for IPAM foundation Add IP prefix and address schemas with resource manager support Add device model schema with port specifications Add site IP prefix relationships and fabric device model relationships --- .infrahub.yml | 1 + infrahub/objects/00-ipam-foundation.yml | 53 +++++++++++++++++++++++++ infrahub/schemas/base.yml | 17 ++++++++ infrahub/schemas/device_model.yml | 34 ++++++++++++++++ infrahub/schemas/extensions.yml | 21 ++++++++++ infrahub/schemas/ipam.yml | 29 ++++++++++++++ 6 files changed, 155 insertions(+) create mode 100644 infrahub/objects/00-ipam-foundation.yml create mode 100644 infrahub/schemas/device_model.yml create mode 100644 infrahub/schemas/ipam.yml diff --git a/.infrahub.yml b/.infrahub.yml index e02b890..f222f11 100644 --- a/.infrahub.yml +++ b/.infrahub.yml @@ -4,6 +4,7 @@ schemas: menus: - infrahub/menus objects: + - infrahub/objects/00-ipam-foundation.yml - infrahub/objects/01-foundation.yml - infrahub/objects/02-fabric.yml - infrahub/objects/03-devices.yml diff --git a/infrahub/objects/00-ipam-foundation.yml b/infrahub/objects/00-ipam-foundation.yml new file mode 100644 index 0000000..8165601 --- /dev/null +++ b/infrahub/objects/00-ipam-foundation.yml @@ -0,0 +1,53 @@ +# IPAM Foundation Objects +# Must be loaded BEFORE 01-foundation.yml +# Contains: device model, supernet prefixes, ASN number pool +--- + +# ================================================================ +# Device Model +# ================================================================ +- kind: InfraDeviceModel + data: + name: + value: "7050SX3-48YC12" + description: + value: "Arista 7050SX3-48YC12 — 48x 25G SFP28 + 12x 100G QSFP100" + manufacturer: + value: "Arista" + host_port_count: + value: 48 + fabric_port_count: + value: 12 + +# ================================================================ +# Supernet Prefixes +# ================================================================ +- kind: IpamIPPrefix + data: + prefix: + value: "10.0.0.0/8" + description: + value: "Infrastructure supernet — loopbacks, underlay, MLAG" + +- kind: IpamIPPrefix + data: + prefix: + value: "172.16.0.0/12" + description: + value: "Services supernet — L2/L3 VXLAN user subnets" + +# ================================================================ +# ASN Number Pool +# ================================================================ +- kind: CoreNumberPool + data: + name: + value: "leaf-asn-pool" + description: + value: "ASN pool for leaf MLAG pairs (65001-65099)" + start_range: + value: 65001 + end_range: + value: 65099 + node: InfraAutonomousSystem + node_attribute: asn diff --git a/infrahub/schemas/base.yml b/infrahub/schemas/base.yml index 8b13f74..23ebc43 100644 --- a/infrahub/schemas/base.yml +++ b/infrahub/schemas/base.yml @@ -75,6 +75,18 @@ nodes: cardinality: many kind: Generic description: Fabrics deployed at this site + - name: infra_prefix + peer: IpamIPPrefix + identifier: site__infra_prefix + cardinality: one + optional: true + description: "Infrastructure IP prefix for this site" + - name: services_prefix + peer: IpamIPPrefix + identifier: site__services_prefix + cardinality: one + optional: true + description: "Services IP prefix for this site" # ================================================================ # Platform @@ -184,6 +196,11 @@ nodes: cardinality: one optional: true description: Fabric this device belongs to + - name: model + peer: InfraDeviceModel + cardinality: one + optional: true + description: Hardware device model # ================================================================ # Interface Types (inherit from InfraInterface generic) diff --git a/infrahub/schemas/device_model.yml b/infrahub/schemas/device_model.yml new file mode 100644 index 0000000..ddd9780 --- /dev/null +++ b/infrahub/schemas/device_model.yml @@ -0,0 +1,34 @@ +# Device Model Schema for EVPN-VXLAN Fabric +# Hardware platform definitions with port specifications +--- +version: "1.0" +nodes: + # ================================================================ + # Device Model + # ================================================================ + - name: DeviceModel + namespace: Infra + description: Hardware device model with port specifications + label: Device Model + icon: mdi--chip + include_in_menu: false + human_friendly_id: + - name__value + display_label: "{{ name__value }}" + attributes: + - name: name + kind: Text + unique: true + description: "Model name (e.g., 7050SX3-48YC12)" + - name: description + kind: Text + optional: true + - name: manufacturer + kind: Text + description: "Manufacturer name (e.g., Arista)" + - name: host_port_count + kind: Number + description: "Number of host-facing ports (e.g., 48 for 25G SFP28 bank)" + - name: fabric_port_count + kind: Number + description: "Number of fabric ports (e.g., 12 for 100G QSFP100 bank)" diff --git a/infrahub/schemas/extensions.yml b/infrahub/schemas/extensions.yml index ebe647d..f42b8b7 100644 --- a/infrahub/schemas/extensions.yml +++ b/infrahub/schemas/extensions.yml @@ -47,6 +47,17 @@ nodes: kind: Text optional: true description: "Shared MAC for anycast gateway (format: xxxx.xxxx.xxxx)" + - name: spine_count + kind: Number + optional: true + description: "Number of spines (2-4)" + - name: leaf_pair_count + kind: Number + optional: true + description: "Number of MLAG leaf pairs" + - name: mtu + kind: Number + default_value: 9214 relationships: - name: spine_asn peer: InfraAutonomousSystem @@ -58,6 +69,16 @@ nodes: identifier: fabric__sites cardinality: many optional: true + - name: spine_model + peer: InfraDeviceModel + cardinality: one + optional: true + description: Hardware model used for spines + - name: leaf_model + peer: InfraDeviceModel + cardinality: one + optional: true + description: Hardware model used for leafs - name: devices peer: InfraDevice identifier: fabric__devices diff --git a/infrahub/schemas/ipam.yml b/infrahub/schemas/ipam.yml new file mode 100644 index 0000000..1a65c6b --- /dev/null +++ b/infrahub/schemas/ipam.yml @@ -0,0 +1,29 @@ +# IPAM Schema for EVPN-VXLAN Fabric +# IP Prefix and Address types inheriting from Infrahub builtins +# to enable the resource manager +--- +version: "1.0" +nodes: + # ================================================================ + # IP Prefix (inherits BuiltinIPPrefix for resource manager support) + # ================================================================ + - name: IPPrefix + namespace: Ipam + inherit_from: + - "BuiltinIPPrefix" + description: "IP Prefix for hierarchical IPAM (supernets, site prefixes, pool parents)" + label: IP Prefix + icon: mdi--ip-network-outline + include_in_menu: false + + # ================================================================ + # IP Address (inherits BuiltinIPAddress for resource manager support) + # ================================================================ + - name: IPAddress + namespace: Ipam + inherit_from: + - "BuiltinIPAddress" + description: "IP Address managed by resource pools" + label: IP Address + icon: mdi--ip-network + include_in_menu: false