Single unified bgp_yang_transform covering the full BGP router stanza
(process config, peer groups, neighbors, address families) for all
10 fabric devices in a single query+template pass.
- Add GraphQL query bgp_intent.gql: queries InfraBGPRouterConfig by
device name, traversing local_asn, peer_groups (with remote_asn),
and sessions (with peer_group, remote_asn, vrf, peer_device);
separately queries InfraBGPAddressFamily for the same device,
including active_peer_groups, active_sessions, networks, and optional
vrf relationship
- Add Jinja2 template bgp_yang.j2: renders a JSON object with bgp.global
(ASN, router-id, distances, ECMP), bgp.peer_groups, bgp.neighbors,
bgp.address_families for global sessions, plus bgp.vrf_neighbors and
bgp.vrf_address_families for VRF-scoped entries (e.g. leaf7 VRF gold
border peering); returns [] for devices with no BGP config; all
optional relationships guarded with 'is defined and is not none' checks;
send_community "none" normalised to null in output
- Update .infrahub.yml: register bgp_intent query and bgp_yang_transform
- Add unit test fixtures for three representative devices:
leaf1 — 3 peer-groups, 5 global neighbors, 2 global AFs
spine1 — 1 peer-group (evpn/next-hop-unchanged), 16 neighbors
(8 direct underlay with remote_asn, 8 EVPN via peer-group),
IPv4 AF activates individual sessions
leaf7 — leaf1 pattern + VRF gold border session (AS 64999) and
VRF-scoped IPv4 unicast AF
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
59 lines
2.2 KiB
YAML
59 lines
2.2 KiB
YAML
---
|
|
schemas:
|
|
- infrahub/schemas
|
|
menus:
|
|
- infrahub/menus
|
|
objects:
|
|
- infrahub/objects/01-foundation.yml
|
|
- infrahub/objects/02-fabric.yml
|
|
- infrahub/objects/03-devices.yml
|
|
- infrahub/objects/04-interfaces.yml
|
|
- infrahub/objects/05-ipam.yml
|
|
- infrahub/objects/06-vlans-vxlan.yml
|
|
- infrahub/objects/07-interface-vlans.yml
|
|
- infrahub/objects/08-ipam-vlans.yml
|
|
- infrahub/objects/09-bgp.yml
|
|
- infrahub/objects/10-bgp-sessions.yml
|
|
- infrahub/objects/11-vrfs.yml
|
|
- infrahub/objects/12-mlag.yml
|
|
|
|
queries:
|
|
- name: vlan_intent
|
|
file_path: infrahub/transforms/queries/vlan_intent.gql
|
|
- name: interface_intent
|
|
file_path: infrahub/transforms/queries/interface_intent.gql
|
|
- name: vxlan_intent
|
|
file_path: infrahub/transforms/queries/vxlan_intent.gql
|
|
- name: vrf_intent
|
|
file_path: infrahub/transforms/queries/vrf_intent.gql
|
|
- name: mlag_intent
|
|
file_path: infrahub/transforms/queries/mlag_intent.gql
|
|
- name: bgp_intent
|
|
file_path: infrahub/transforms/queries/bgp_intent.gql
|
|
|
|
jinja2_transforms:
|
|
- name: vlan_yang_transform
|
|
description: "Generate VLAN configuration payload from Infrahub intent"
|
|
query: vlan_intent
|
|
template_path: infrahub/transforms/templates/vlan_yang.j2
|
|
- name: interface_yang_transform
|
|
description: "Generate interface configuration payload from Infrahub intent"
|
|
query: interface_intent
|
|
template_path: infrahub/transforms/templates/interface_yang.j2
|
|
- name: vxlan_yang_transform
|
|
description: "Generate VXLAN/VTEP configuration payload from Infrahub intent"
|
|
query: vxlan_intent
|
|
template_path: infrahub/transforms/templates/vxlan_yang.j2
|
|
- name: vrf_yang_transform
|
|
description: "Generate VRF/L3VNI configuration payload from Infrahub intent"
|
|
query: vrf_intent
|
|
template_path: infrahub/transforms/templates/vrf_yang.j2
|
|
- name: mlag_yang_transform
|
|
description: "Generate MLAG configuration payload from Infrahub intent"
|
|
query: mlag_intent
|
|
template_path: infrahub/transforms/templates/mlag_yang.j2
|
|
- name: bgp_yang_transform
|
|
description: "Generate BGP configuration payload from Infrahub intent"
|
|
query: bgp_intent
|
|
template_path: infrahub/transforms/templates/bgp_yang.j2
|