Skip to main content

Tutorials

📄️Build a Jinja2 Transformation

By the end of this tutorial you will have built a working Jinja2 Transformation end-to-end: loaded a small network-device schema, created a few sample devices, written a GraphQL query that filters by device name, written a Jinja template that renders a configuration snippet from the result, registered it in .infrahub.yml, tested it locally with infrahubctl render, added the repository to Infrahub, and called the render API. You'll leave with a deviceconfigtransform you can call against any device by name.

📄️Build a Python Transformation

By the end of this tutorial you will have built a working Python Transformation end-to-end: loaded a small network-device schema, created a few sample devices, written a GraphQL query that filters by device name, implemented a DeviceConfigTransform Python class that returns a JSON object derived from the response, registered it in .infrahub.yml, tested it locally with infrahubctl transform, and called the Transformation via the REST API. You'll leave with both the raw-dictionary and SDK-converted patterns side by side so you can pick the one that fits the next Transformation you write.

📄️Build chained generators

By the end of this tutorial you will have wired two layers of modular Generators together — fabric → pod → rack — using a checksum attribute and Infrahub's event framework. You will have added a GeneratorTarget generic with a checksum attribute to your downstream node kinds, implemented a GeneratorMixin that writes the checksum to downstream targets as the last step of generate(), built downstream Generators that validate upstream completeness before doing any work, and created CoreGeneratorAction and CoreNodeTriggerRule objects so the chain runs automatically when an upstream layer finishes. You will leave with a concrete model of how a checksum makes Generator chaining idempotent — re-runs that produce the same output do not re-trigger the next layer.