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>
This commit is contained in:
@@ -264,6 +264,12 @@ nodes:
|
||||
label: Multicast
|
||||
description: Sub Address Family Identifier
|
||||
relationships:
|
||||
- name: device
|
||||
peer: InfraDevice
|
||||
cardinality: one
|
||||
kind: Attribute
|
||||
optional: false
|
||||
description: Device this address family belongs to (denormalized for query filtering)
|
||||
- name: bgp_config
|
||||
peer: InfraBGPRouterConfig
|
||||
cardinality: one
|
||||
|
||||
Reference in New Issue
Block a user