Training
Bootcamp
Courses
Tech Sessions
Resources
Blog
Tips
GitHub
YouTube
Newsletter
Playgrounds
Pricing
Sign In
Become Member
Jinja2 Renderer
Validate and test the rendering of your Jinja templates
Tools
J2 Renderer
TTP Parser
TextFSM Parser
XPath Tester
Members Only
JMESPath Validator
JSON Schema Validator
Data Format Converter
Help Us Improve
Jinja Template
hostname {{ hostname }} ip domain-name {{ domain_name }} ip domain-lookup {% if 'rtr' in hostname %} ip name-server 1.1.1.1 {% elif 'sw' in hostname %} ip name-server 2.2.2.2 {% else %} ip name-server 3.3.3.3 {% endif %} {# elif condition #} {% if ospf_enabled == True %} feature ospf {% elif ospf_enabled == False %} no feature ospf {% else %} ! OSPF setting not found {% endif %} {% if ospf_enabled == True %} router ospf 1 router-id {{ router_id }} {% endif %} {% for i in interfaces %} interface {{ i }} ip address {{ interfaces[i].ip_addr }} {{ interfaces[i].admin }} {% endfor %} no logging console
Jinja Data
{ "hostname": "rtr-001", "domain_name": "packetcoders.lab", "ospf_enabled": true, "router-id": "11.11.11.11", "interfaces": { "gi1/1": {"ip_addr": "10.1.1.1/24", "admin": "no shut"}, "gi1/2": {"ip_addr": "10.1.1.2/24", "admin": "no shut"}, "gi1/3": {"ip_addr": "10.1.1.3/24", "admin": "no shut"}, } }
Result
hostname rtr-001 ip domain-name packetcoders.lab ip domain-lookup ip name-server 1.1.1.1 feature ospf router ospf 1 router-id interface gi1/1 ip address 10.1.1.1/24 no shut interface gi1/2 ip address 10.1.1.2/24 no shut interface gi1/3 ip address 10.1.1.3/24 no shut no logging console
Show whitespace
Trim blocks
Lstrip blocks
Render
Share
Auto-Sync