feat: Add Infrahub Jinja2 transform for VRF/L3VNI configuration (#21)
- Add GraphQL query vrf_intent.gql: queries InfraVRFDeviceAssignment by device name, returning device-specific RD, VRF attributes (name, description, l3vni), and both device-level and VRF-level import/export route targets for fallback logic - Add Jinja2 template vrf_yang.j2: renders a JSON array of VRF config objects with RD fallback (device → VRF-level) and RT merge logic (device-level if present, otherwise VRF-level); all optional relationships guarded with 'is defined and is not none' checks - Update .infrahub.yml: register vrf_intent query and vrf_yang_transform - Add unit test fixtures for leaf3: input.json (mock GraphQL response) and output.json (expected rendered JSON array) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,8 @@ queries:
|
||||
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
|
||||
|
||||
jinja2_transforms:
|
||||
- name: vlan_yang_transform
|
||||
@@ -38,3 +40,7 @@ jinja2_transforms:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user