Create Infrahub Transforms for complete BGP configuration including process, neighbors, peer groups, and EVPN address-family.
Context
BGP is the control plane for the EVPN-VXLAN fabric. The transforms need to handle both underlay eBGP (spine-leaf) and overlay EVPN (loopback-to-loopback) sessions, querying BGP data from Infrahub's schema.
Tasks
Define Infrahub schema for BGP objects (or use schema-library)
{% for session in data.InfraBGPSession.edges %}
{% set s = session.node %}
{
"path": "/network-instances/network-instance[name=default]/protocols/protocol[identifier=BGP][name=BGP]/bgp/neighbors/neighbor[neighbor-address={{ s.peer_address.value }}]",
"value": {
"config": {
"neighbor-address": "{{ s.peer_address.value }}",
"peer-as": {{ s.peer_asn.value }},
{% if s.peer_group %}"peer-group": "{{ s.peer_group.node.name.value }}",{% endif %}
{% if s.description %}"description": "{{ s.description.value }}",{% endif %}
"enabled": true
}{% if s.update_source or s.ebgp_multihop %},
"transport": {
"config": {
{% if s.update_source %}"local-address": "{{ s.update_source.node.name.value }}"{% endif %}
}
}{% endif %}{% if s.ebgp_multihop %},
"ebgp-multihop": {
"config": { "multihop-ttl": {{ s.ebgp_multihop.value }} }
}{% endif %}
}
}{% if not loop.last %},{% endif %}
{% endfor %}
.infrahub.yml Addition
jinja2_transforms:- name:bgp_global_yang_transformdescription:"Generate YANG payload for BGP process"query:bgp_process_intenttemplate_path:transforms/bgp_global_yang.j2- name:bgp_peer_groups_yang_transformdescription:"Generate YANG payload for BGP peer groups"query:bgp_peer_groups_intenttemplate_path:transforms/bgp_peer_groups_yang.j2- name:bgp_neighbors_yang_transformdescription:"Generate YANG payload for BGP neighbors"query:bgp_neighbors_intenttemplate_path:transforms/bgp_neighbors_yang.j2- name:bgp_evpn_yang_transformdescription:"Generate YANG payload for EVPN address-family"query:bgp_evpn_intenttemplate_path:transforms/bgp_evpn_yang.j2queries:- name:bgp_process_intentfile_path:queries/bgp_process_intent.gql- name:bgp_peer_groups_intentfile_path:queries/bgp_peer_groups_intent.gql- name:bgp_neighbors_intentfile_path:queries/bgp_neighbors_intent.gql- name:bgp_evpn_intentfile_path:queries/bgp_evpn_intent.gql
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Description
Create Infrahub Transforms for complete BGP configuration including process, neighbors, peer groups, and EVPN address-family.
Context
BGP is the control plane for the EVPN-VXLAN fabric. The transforms need to handle both underlay eBGP (spine-leaf) and overlay EVPN (loopback-to-loopback) sessions, querying BGP data from Infrahub's schema.
Tasks
bgp_process_intent.gql- ASN, router-id, ECMP settingsbgp_neighbors_intent.gql- All neighbor sessionsbgp_evpn_intent.gql- EVPN overlay configurationbgp_global_yang.j2- BGP process configbgp_peer_groups_yang.j2- Peer group definitionsbgp_neighbors_yang.j2- Neighbor configurationsbgp_evpn_yang.j2- EVPN address-familyebgp-multihopfor EVPN overlaynext-hop-unchangedfor spine EVPN reflectorsBGP Configuration Scope
Based on the reference topology:
Underlay BGP
EVPN Overlay
Example Implementation
GraphQL Query (
bgp_neighbors_intent.gql)Jinja2 Transform (
bgp_neighbors_yang.j2).infrahub.ymlAdditionOutput Files
Acceptance Criteria
Migration Notes (from NetBox)
BgpProcessMapperclassbgp_global_yang_transformBgpNeighborMapperclassbgp_neighbors_yang_transformBgpEvpnMapperclassbgp_evpn_yang_transformRelated