config context input for prefix list #855
-
Could config context be use as input for example generating a prefix list, in a jinja template? like this, direct session config context: If i use this in jinja: it results in the following config output ['5.0.0.0/8', '194.0.0.0/19'] is the some way to make it usable in config like below? Can i iter trough context_get_key('prefixes-inet') ? prefix-list as65001-v4 { This example is a prefix list, could be anything ofcource. Tnx and kind regards, Erik |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
{% for prefix in session | context_get_key('prefixes-inet') %}
{{ prefix }};
{% endfor %} |
Beta Was this translation helpful? Give feedback.
context_get_key
returns whatever type the variable is of. Config contexts are Python dictionaries so by getting a value of a given key you will be able to use it as it is intended to. So, in your case, you can do something like: