[Phase 2] Define NetBox ConfigContext schema for fabric intent #5

Open
opened 2025-12-20 15:40:32 +00:00 by Damien · 3 comments
Owner

Description

Define the JSON schema for NetBox ConfigContexts that will represent fabric intent.

Tasks

  • Design schema for device-level intent (per leaf/spine)
  • Design schema for fabric-wide intent (shared config)
  • Include: underlay (ASN, router-id, peers), overlay (VTEP, EVPN peers), MLAG, VLANs, VRFs
  • Create example ConfigContexts in NetBox
  • Document schema in docs/netbox-schema.md

Schema Structure (Draft)

evpn_fabric:
  underlay:
    asn: 65001
    router_id: "10.0.250.11"
    spine_peers:
      - ip: "10.0.1.0"
        asn: 65000
  overlay:
    vtep_ip: "10.0.255.11"
    evpn_peers:
      - "10.0.250.1"
      - "10.0.250.2"
  mlag:
    enabled: true
    domain_id: "leafs"
    peer_ip: "10.0.199.255"
    local_ip: "10.0.199.254"
  vlans:
    - id: 40
      name: "test-l2-vxlan"
      vni: 100040
  vrfs:
    - name: "gold"
      vni: 100001

Output

  • docs/netbox-schema.md with full schema documentation
  • src/netbox/models.py with Pydantic models
## Description Define the JSON schema for NetBox ConfigContexts that will represent fabric intent. ## Tasks - [x] Design schema for device-level intent (per leaf/spine) - [x] Design schema for fabric-wide intent (shared config) - [x] Include: underlay (ASN, router-id, peers), overlay (VTEP, EVPN peers), MLAG, VLANs, VRFs - [x] Create example ConfigContexts in NetBox - [x] Document schema in `docs/netbox-schema.md` ## Schema Structure (Draft) ```yaml evpn_fabric: underlay: asn: 65001 router_id: "10.0.250.11" spine_peers: - ip: "10.0.1.0" asn: 65000 overlay: vtep_ip: "10.0.255.11" evpn_peers: - "10.0.250.1" - "10.0.250.2" mlag: enabled: true domain_id: "leafs" peer_ip: "10.0.199.255" local_ip: "10.0.199.254" vlans: - id: 40 name: "test-l2-vxlan" vni: 100040 vrfs: - name: "gold" vni: 100001 ``` ## Output - `docs/netbox-schema.md` with full schema documentation - `src/netbox/models.py` with Pydantic models
Damien added the documentationphase-2-minimal-reconciler labels 2025-12-20 15:40:40 +00:00
Author
Owner

Updated Approach: Native NetBox Models + BGP Plugin

After review, we'll use NetBox's native models and the BGP plugin (v0.17.x) instead of ConfigContexts for most fabric intent data.

Native NetBox Models (built-in)

Feature NetBox Model API Endpoint
Devices dcim.Device /api/dcim/devices/
Interfaces dcim.Interface /api/dcim/interfaces/
LAGs/Port-Channels dcim.Interface (type=LAG) /api/dcim/interfaces/
VLANs ipam.VLAN /api/ipam/vlans/
VLAN Groups ipam.VLANGroup /api/ipam/vlan-groups/
VRFs ipam.VRF /api/ipam/vrfs/
Route Targets ipam.RouteTarget /api/ipam/route-targets/
IP Addresses ipam.IPAddress /api/ipam/ip-addresses/
Prefixes ipam.Prefix /api/ipam/prefixes/
ASNs ipam.ASN /api/ipam/asns/
L2VPN (EVPN) vpn.L2VPN /api/vpn/l2vpns/
L2VPN Terminations vpn.L2VPNTermination /api/vpn/l2vpn-terminations/

NetBox BGP Plugin Models

Feature Plugin Model API Endpoint
BGP Sessions netbox_bgp.BGPSession /api/plugins/bgp/sessions/
BGP Peer Groups netbox_bgp.PeerGroup /api/plugins/bgp/peer-groups/
BGP Communities netbox_bgp.Community /api/plugins/bgp/communities/
Routing Policies netbox_bgp.RoutingPolicy /api/plugins/bgp/routing-policies/
Prefix Lists netbox_bgp.PrefixList /api/plugins/bgp/prefix-lists/
AS Path Lists netbox_bgp.ASPathList /api/plugins/bgp/as-path-lists/

Mapping to EVPN Fabric Configuration

Fabric Feature NetBox Model(s) Notes
Spine/Leaf devices Device + DeviceRole Role = "spine" or "leaf"
Point-to-point links Interface + Cable + IPAddress /31 p2p links between spine-leaf
Loopback0 (router-id) Interface (type=virtual) + IPAddress Used for BGP router-id
Loopback1 (VTEP) Interface (type=virtual) + IPAddress Shared by MLAG pair
BGP ASN ASN + assignment to Device/Site Native NetBox model
BGP underlay peers BGPSession (plugin) eBGP to spines
BGP iBGP peers BGPSession (plugin) iBGP between MLAG pair
EVPN peer-group PeerGroup (plugin) With send-community extended
EVPN sessions BGPSession (plugin) AF=EVPN, to spine loopbacks
VLANs VLAN With VNI in L2VPN
VNI mappings L2VPN (type=EVPN) + L2VPNTermination VLAN→VNI mapping
VRFs VRF + RouteTarget L3VNI via custom field or L2VPN
MLAG peer-link Interface (LAG) + Cable Port-channel 999
MLAG config Custom Fields or ConfigContext domain-id, peer-ip, local-ip

What still needs Custom Fields?

Feature Approach
MLAG domain-id Custom Field on Device
MLAG peer-address Custom Field on Device (or derive from VLAN 4090 IP)
MLAG peer-link interface Tag or Custom Field
Virtual MAC Custom Field on Device

Revised Deliverables

  • docs/netbox-data-model.md - Full mapping documentation
  • src/netbox/client.py - NetBox API client using pynetbox
  • Custom Field definitions for MLAG configuration
  • Example data population guide
## Updated Approach: Native NetBox Models + BGP Plugin After review, we'll use NetBox's native models and the BGP plugin (v0.17.x) instead of ConfigContexts for most fabric intent data. ### Native NetBox Models (built-in) | Feature | NetBox Model | API Endpoint | |---------|--------------|--------------| | **Devices** | `dcim.Device` | `/api/dcim/devices/` | | **Interfaces** | `dcim.Interface` | `/api/dcim/interfaces/` | | **LAGs/Port-Channels** | `dcim.Interface` (type=LAG) | `/api/dcim/interfaces/` | | **VLANs** | `ipam.VLAN` | `/api/ipam/vlans/` | | **VLAN Groups** | `ipam.VLANGroup` | `/api/ipam/vlan-groups/` | | **VRFs** | `ipam.VRF` | `/api/ipam/vrfs/` | | **Route Targets** | `ipam.RouteTarget` | `/api/ipam/route-targets/` | | **IP Addresses** | `ipam.IPAddress` | `/api/ipam/ip-addresses/` | | **Prefixes** | `ipam.Prefix` | `/api/ipam/prefixes/` | | **ASNs** | `ipam.ASN` | `/api/ipam/asns/` | | **L2VPN (EVPN)** | `vpn.L2VPN` | `/api/vpn/l2vpns/` | | **L2VPN Terminations** | `vpn.L2VPNTermination` | `/api/vpn/l2vpn-terminations/` | ### NetBox BGP Plugin Models | Feature | Plugin Model | API Endpoint | |---------|--------------|--------------| | **BGP Sessions** | `netbox_bgp.BGPSession` | `/api/plugins/bgp/sessions/` | | **BGP Peer Groups** | `netbox_bgp.PeerGroup` | `/api/plugins/bgp/peer-groups/` | | **BGP Communities** | `netbox_bgp.Community` | `/api/plugins/bgp/communities/` | | **Routing Policies** | `netbox_bgp.RoutingPolicy` | `/api/plugins/bgp/routing-policies/` | | **Prefix Lists** | `netbox_bgp.PrefixList` | `/api/plugins/bgp/prefix-lists/` | | **AS Path Lists** | `netbox_bgp.ASPathList` | `/api/plugins/bgp/as-path-lists/` | ### Mapping to EVPN Fabric Configuration | Fabric Feature | NetBox Model(s) | Notes | |----------------|-----------------|-------| | **Spine/Leaf devices** | `Device` + `DeviceRole` | Role = "spine" or "leaf" | | **Point-to-point links** | `Interface` + `Cable` + `IPAddress` | /31 p2p links between spine-leaf | | **Loopback0 (router-id)** | `Interface` (type=virtual) + `IPAddress` | Used for BGP router-id | | **Loopback1 (VTEP)** | `Interface` (type=virtual) + `IPAddress` | Shared by MLAG pair | | **BGP ASN** | `ASN` + assignment to Device/Site | Native NetBox model | | **BGP underlay peers** | `BGPSession` (plugin) | eBGP to spines | | **BGP iBGP peers** | `BGPSession` (plugin) | iBGP between MLAG pair | | **EVPN peer-group** | `PeerGroup` (plugin) | With send-community extended | | **EVPN sessions** | `BGPSession` (plugin) | AF=EVPN, to spine loopbacks | | **VLANs** | `VLAN` | With VNI in L2VPN | | **VNI mappings** | `L2VPN` (type=EVPN) + `L2VPNTermination` | VLAN→VNI mapping | | **VRFs** | `VRF` + `RouteTarget` | L3VNI via custom field or L2VPN | | **MLAG peer-link** | `Interface` (LAG) + `Cable` | Port-channel 999 | | **MLAG config** | Custom Fields or ConfigContext | domain-id, peer-ip, local-ip | ### What still needs Custom Fields? | Feature | Approach | |---------|----------| | **MLAG domain-id** | Custom Field on Device | | **MLAG peer-address** | Custom Field on Device (or derive from VLAN 4090 IP) | | **MLAG peer-link interface** | Tag or Custom Field | | **Virtual MAC** | Custom Field on Device | ### Revised Deliverables - [x] `docs/netbox-data-model.md` - Full mapping documentation - [x] `src/netbox/client.py` - NetBox API client using pynetbox - [x] Custom Field definitions for MLAG configuration - [ ] Example data population guide
Damien added reference feat/netbox-data-model 2026-01-09 12:28:17 +00:00
Damien reopened this issue 2026-01-09 14:28:55 +00:00
Author
Owner

Ajout de la documentation Câblage

La documentation docs/netbox-data-model.md a été mise à jour avec une nouvelle section Cabling qui inclut :

Contenu ajouté

  • Cable Model : Description du modèle dcim.Cable de NetBox
  • Spine-Leaf Cabling Matrix : Matrice complète basée sur arista-evpn-vxlan-clab
    • Spine1 Ethernet1-8 → Leaf1-8 Ethernet11
    • Spine2 Ethernet1-8 → Leaf1-8 Ethernet12
  • MLAG Peer-Link Cabling : Ethernet10 entre chaque paire MLAG
  • Host Dual-Homing : Connexions LACP des 4 hosts vers les paires MLAG
  • Cabling Conventions : Conventions de nommage des interfaces
  • Exemples pynetbox : Code pour récupérer et valider le câblage
  • Topology Visualization : Intégration avec netbox-topology-views

Valeur ajoutée

  1. Visualisation : Le plugin netbox-topology-views génère des diagrammes automatiquement
  2. Validation : L'orchestrateur peut vérifier la cohérence du câblage
  3. Auto-discovery : Possibilité de comparer câblage déclaré vs LLDP
  4. Intent-driven : Les BGP peers peuvent être dérivés des connexions câblées

Next Steps mis à jour

  • Ajout de "Cabling Setup" dans les prochaines étapes
## Ajout de la documentation Câblage La documentation `docs/netbox-data-model.md` a été mise à jour avec une nouvelle section **Cabling** qui inclut : ### Contenu ajouté - **Cable Model** : Description du modèle `dcim.Cable` de NetBox - **Spine-Leaf Cabling Matrix** : Matrice complète basée sur [arista-evpn-vxlan-clab](https://gitea.arnodo.fr/Damien/arista-evpn-vxlan-clab) - Spine1 Ethernet1-8 → Leaf1-8 Ethernet11 - Spine2 Ethernet1-8 → Leaf1-8 Ethernet12 - **MLAG Peer-Link Cabling** : Ethernet10 entre chaque paire MLAG - **Host Dual-Homing** : Connexions LACP des 4 hosts vers les paires MLAG - **Cabling Conventions** : Conventions de nommage des interfaces - **Exemples pynetbox** : Code pour récupérer et valider le câblage - **Topology Visualization** : Intégration avec `netbox-topology-views` ### Valeur ajoutée 1. **Visualisation** : Le plugin `netbox-topology-views` génère des diagrammes automatiquement 2. **Validation** : L'orchestrateur peut vérifier la cohérence du câblage 3. **Auto-discovery** : Possibilité de comparer câblage déclaré vs LLDP 4. **Intent-driven** : Les BGP peers peuvent être dérivés des connexions câblées ### Next Steps mis à jour - Ajout de "Cabling Setup" dans les prochaines étapes
Author
Owner

Script de provisioning NetBox créé

Une branche feat/netbox-provisioning a été créée dans arista-evpn-vxlan-clab avec :

Fichiers ajoutés

  • netbox/provision_fabric.py - Script principal de provisioning
  • netbox/requirements.txt - Dépendances (pynetbox)
  • netbox/README.md - Documentation d'utilisation

Ce que le script crée

Catégorie Objets
Custom Fields asn, mlag_*, l3vni, vrf_vlan, virtual_ip
Organisation Site, Manufacturer (Arista), DeviceType (cEOS-lab), DeviceRoles
Devices 2 spines, 8 leafs, 4 hosts
Interfaces Ethernet, Loopbacks, LAGs, Vxlan1
Câbles Spine-Leaf, MLAG peer-links, Host dual-homing
IP Addresses Loopbacks, P2P links
VLANs 34, 40, 78, 4090, 4091
VRF gold (avec L3VNI 100001)
Prefixes Tous les réseaux de la fabric

Utilisation

export NETBOX_URL="http://netbox.example.com"
export NETBOX_TOKEN="your-token"
python netbox/provision_fabric.py

Points à valider

  1. DeviceType : J'ai créé un type générique cEOS-lab. On peut importer un type depuis devicetype-library si tu préfères un modèle Arista spécifique (ex: DCS-7050TX).
  2. Organisation : Site unique evpn-lab. À adapter si besoin (Tenant, Region, etc.)
  3. BGP Sessions : Non incluses car nécessite le plugin netbox-bgp. À ajouter si souhaité.
## Script de provisioning NetBox créé Une branche `feat/netbox-provisioning` a été créée dans [arista-evpn-vxlan-clab](https://gitea.arnodo.fr/Damien/arista-evpn-vxlan-clab/src/branch/feat/netbox-provisioning) avec : ### Fichiers ajoutés - `netbox/provision_fabric.py` - Script principal de provisioning - `netbox/requirements.txt` - Dépendances (pynetbox) - `netbox/README.md` - Documentation d'utilisation ### Ce que le script crée | Catégorie | Objets | |-----------|--------| | **Custom Fields** | asn, mlag_*, l3vni, vrf_vlan, virtual_ip | | **Organisation** | Site, Manufacturer (Arista), DeviceType (cEOS-lab), DeviceRoles | | **Devices** | 2 spines, 8 leafs, 4 hosts | | **Interfaces** | Ethernet, Loopbacks, LAGs, Vxlan1 | | **Câbles** | Spine-Leaf, MLAG peer-links, Host dual-homing | | **IP Addresses** | Loopbacks, P2P links | | **VLANs** | 34, 40, 78, 4090, 4091 | | **VRF** | gold (avec L3VNI 100001) | | **Prefixes** | Tous les réseaux de la fabric | ### Utilisation ```bash export NETBOX_URL="http://netbox.example.com" export NETBOX_TOKEN="your-token" python netbox/provision_fabric.py ``` ### Points à valider 1. **DeviceType** : J'ai créé un type générique `cEOS-lab`. On peut importer un type depuis [devicetype-library](https://github.com/netbox-community/devicetype-library) si tu préfères un modèle Arista spécifique (ex: DCS-7050TX). 2. **Organisation** : Site unique `evpn-lab`. À adapter si besoin (Tenant, Region, etc.) 3. **BGP Sessions** : Non incluses car nécessite le plugin netbox-bgp. À ajouter si souhaité.
Sign in to join this conversation.