Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Resources in Jinja

SUMMARY This topic provides information about how Jinja uses and interacts with Apstra Freeform resources. Use Jinja with Freeform to create, edit, and update custom Config Templates in real time.

Examine Resources in Jinja

The Config Template editor features a three-pane interface for interacting with generated resources. Apstra Freeform utitlizes the Jinja code to find and include designated resources from the resource tree.

Configuration management interface with three sections: Template Text with Jinja2 code, Preview showing rendered configuration for Bond-Street, and Device Context with variables. Update button applies changes.

Use a Resource in Jinja

After you create Resources in the Blueprint, these resources can be accessed via the Device Context.

The following example shows how to use Jinja to include a function to get the resource value for a resource called 'ipv4_loopback' inside the resource group structure called 'underlay':

JSON-like structure of a Device Context with resources and groups. Resource 1: loopback_generator, IP 10.0.0.0/32. Resource 2: asn_generator, ASN 420000002. Group: system-instance.

Use the Built-In Function for Resources

Apstra includes useful built-in functions that we recommend you use in Jinja creation. These functions are documented inside the user interface. To access the function documentation, use the built-in editor in Jinja to access the documentation page via the UI. The link to the documentation is the Apstra server UI: https://<apstra_ip>/static/jinja_docs/ for reference.

Update Config Template interface with required Name field interfaces.jinja, Device Context button, Jinja function reference link, and Template Text field.

Apstra Jinja helper functions reference page with navigation menu, Jinja filters, functions, tests, and search link.

Create a Resource Generator

Follow these high-level steps to create and use a Resource Generator:

  1. Crete a Resourde Pool

  2. Create an Allocation Group

  3. Create a Resource Group under the default "root" Group

  4. Create a Resource Generator

  5. Use Resource in Jinja