01-17-2022 02:27 AM
Hi,
in a template I want to interate over all access interfaces (Gi...) but not over the uplink unterfaces (Te...). In the samples I found the following:
{% for interface in __interface %}
{% if interface.portType == 'Ethernet Port' %}
(...)
Is the any list of values that the key "interface.portType" can be? Is there any other solution to loop only over access ports?
Solved! Go to Solution.
01-17-2022 06:12 AM
@misch1942 the only thing i could find was https://developer.cisco.com/codeexchange/github/repo/kebaldwi/DNAC-TEMPLATES/ there is also docs here --> https://developer.cisco.com/dnacenter/ if nothing is found, i would also ask in the DNA Centre community here --> https://community.cisco.com/t5/cisco-digital-network/bd-p/discussions-dna
Hope this helps!
01-19-2022 01:19 AM
In the docs given, the link https://github.com/kebaldwi/DNAC-TEMPLATES/tree/master/LABS/LAB7-Advanced-Automation/ helps. Thanks.
01-17-2022 05:11 AM
@misch1942 you could use conditionals, these render content based on when a condition is either True or False like here
{% if stuff in things %} {{ stuff }} {% endif %} # note: if statements need to be ended {% if stuff not in things %} no stuff here {% endif %} # note: if statements need to be ended
01-17-2022 05:56 AM
Well, I am quite familiar with conditionals in jinja. My question was related to the values that the key interface.portType of the Template System Variables of DNAC can become. Is the any documentation of these variables (keys and values)?
01-17-2022 06:12 AM
@misch1942 the only thing i could find was https://developer.cisco.com/codeexchange/github/repo/kebaldwi/DNAC-TEMPLATES/ there is also docs here --> https://developer.cisco.com/dnacenter/ if nothing is found, i would also ask in the DNA Centre community here --> https://community.cisco.com/t5/cisco-digital-network/bd-p/discussions-dna
Hope this helps!
01-17-2022 06:58 AM
Thanks. Will try that.
01-19-2022 01:19 AM
In the docs given, the link https://github.com/kebaldwi/DNAC-TEMPLATES/tree/master/LABS/LAB7-Advanced-Automation/ helps. Thanks.
01-19-2022 01:25 AM
@misch1942 good stuff, my Google-Fu is strong! Hopefully, this thread helps others too.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide