Files
arista-evpn-vxlan-clab/infrahub/transforms/queries/bgp_intent.gql
Damien c3587a1c9c fix: Add direct device relationship to BGPAddressFamily for query filtering (#23)
InfraHub does not support multi-hop relationship traversal in GraphQL
filters, so `bgp_config__device__name__value` fails at query time.
Fix follows the same pattern used for InfraMlagPeerConfig (#22):
add a denormalized direct device relationship to the schema node and
use it in the query filter.

Changes:
- infrahub/schemas/bgp.yml: add `device` relationship (kind: Attribute,
  cardinality: one, optional: false) to BGPAddressFamily as the first
  relationship, before bgp_config
- infrahub/objects/11-bgp-sessions.yml: add `device: ["<device>"]` to
  all 22 InfraBGPAddressFamily entries (spine1×2, spine2×2, leaf1–8×2
  each, plus leaf7 and leaf8 VRF gold AF)
- infrahub/transforms/queries/bgp_intent.gql: change filter from
  `bgp_config__device__name__value` to `device__name__value`

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 13:05:37 +01:00

106 lines
2.3 KiB
GraphQL

query BgpIntent($device_name: String!) {
InfraBGPRouterConfig(device__name__value: $device_name) {
edges {
node {
router_id { value }
default_ipv4_unicast { value }
log_neighbor_changes { value }
ecmp_max_paths { value }
ecmp_max_ecmp { value }
ebgp_distance { value }
ibgp_distance { value }
local_distance { value }
local_asn {
node {
asn { value }
}
}
peer_groups {
edges {
node {
name { value }
peer_group_type { value }
update_source { value }
ebgp_multihop { value }
send_community { value }
next_hop_self { value }
next_hop_unchanged { value }
maximum_routes { value }
maximum_routes_warning_only { value }
remote_asn {
node {
asn { value }
}
}
}
}
}
sessions {
edges {
node {
peer_address { value }
description { value }
enabled { value }
peer_group {
node {
name { value }
local_identifier { value }
}
}
remote_asn {
node {
asn { value }
}
}
vrf {
node {
name { value }
}
}
peer_device {
node {
name { value }
}
}
}
}
}
}
}
}
InfraBGPAddressFamily(device__name__value: $device_name) {
edges {
node {
afi { value }
safi { value }
vrf {
node {
name { value }
}
}
active_peer_groups {
edges {
node {
name { value }
}
}
}
active_sessions {
edges {
node {
peer_address { value }
}
}
}
networks {
edges {
node {
address { value }
}
}
}
}
}
}
}