feat: Add Infrahub Jinja2 transforms for VLANs, interfaces, and VXLAN (#20) #24
Reference in New Issue
Block a user
Delete Branch "feat/infrahub-transforms-vlan-interfaces-vxlan"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes #20
Adds Infrahub Jinja2 transforms that query device intent from Infrahub via GraphQL and produce structured JSON payloads (YANG-style) suitable for gNMI Set operations on Arista EOS devices.
vlan_intent,interface_intent,vxlan_intent— each parameterized by$device_namevlan_yang.j2,interface_yang.j2,vxlan_yang.j2— producing JSON arrays/objects from the GraphQL responseinput.json,output.json, andtest.yml, using leaf1 from the lab topology as sample device.infrahub.ymlupdated withqueriesandjinja2_transformssectionsFiles added
Transform usage
Test plan
infrahubctl schema load+infrahubctl object load)infrahubctl render vlan_yang_transform device_name=leaf1and verify JSON output matches expected VLANs (40, 4090, 4091)infrahubctl render interface_yang_transform device_name=leaf1and verify all interface types are present with correct attributesinfrahubctl render vxlan_yang_transform device_name=leaf1and verify VTEP source address, UDP port, and VLAN-VNI mapping for VLAN 40 / VNI 110040infrahubctl render vxlan_yang_transform device_name=leaf3and verify VRF gold / L3VNI 100001 appears invrf_vni_mappings[ ] Verifyinfrahubctl testpasses for all three test fixtures🤖 Generated with Claude Code
Move transforms/{queries,templates,tests} under infrahub/transforms/ so all Infrahub-managed content lives under the dedicated infrahub/ directory, consistent with schemas/, objects/, and menus/. Updated paths: - .infrahub.yml: file_path and template_path entries now prefixed with infrahub/transforms/ - infrahub/transforms/tests/*/test.yml: directory references updated from transforms/tests/* to infrahub/transforms/tests/* Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>