Create Infrahub Transforms - VLANs, Interfaces, VXLAN #20
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Description
Create Infrahub Transforms that generate YANG-structured payloads suitable for gNMI Set operations from Infrahub intent data, starting with VLANs and basic interfaces.
Context
With Infrahub as Source of Truth, we leverage its native Transform system (Jinja2 or Python) instead of custom Python mappers. Transforms query data via GraphQL and output structured YANG payloads ready for gNMI operations.
Architecture Decision
Option A: Jinja2 Transforms (Recommended for config generation)
infrahubctl renderOption B: Python Transforms (For complex logic)
Tasks
vlan_intent.gql- Fetch VLANs with VNI mappingsinterface_intent.gql- Fetch interfaces with IP addressesvxlan_intent.gql- Fetch L2VPN/VNI configurationsvlan_yang.j2- VLAN → YANG configinterface_yang.j2- Interface → YANG configvxlan_yang.j2- VXLAN → YANG config.infrahub.ymlwith transform definitionsinfrahub-testsExample Implementation
GraphQL Query (
vlan_intent.gql)Jinja2 Transform (
vlan_yang.j2).infrahub.ymlConfigurationAPI Usage
Output Files
Acceptance Criteria
Migration Notes (from NetBox)
YangMapperclassto_yang()methodfrom_yang()reverse mappingRelated
src/yang/paths.py(documented YANG paths)Branch
feat/infrahub-transforms-vlan-interfaces-vxlancreated frommainfor this issue.