cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1831
Views
0
Helpful
6
Replies

Loop over access interfaces in template?

misch1942
Level 1
Level 1

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?

2 Accepted Solutions

Accepted Solutions

@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!

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

View solution in original post

6 Replies 6

@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
Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

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)?

@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!

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Thanks. Will try that.

misch1942
Level 1
Level 1

@misch1942 good stuff, my Google-Fu is strong! Hopefully, this thread helps others too.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io