a74b3a1eb7
In Jinja2, '|' cannot be treated directly as piping operator. The operator precedence of '|' is higher than '*'. The filter only applies to the value just before it. Group the expression to make sure that the filter is applied to the outcome of the expression. Update the unit test to add such case.
22 lines
535 B
Django/Jinja
22 lines
535 B
Django/Jinja
{
|
|
"device": "{{ pc }}",
|
|
"hwaddr": "{{ hwaddr }}",
|
|
"runner": {
|
|
"name": "lacp",
|
|
"active": true,
|
|
{# Use 75% links upperbound as min-links #}
|
|
"min_ports": {{ (minigraph_portchannels[pc]['members'] | length * 0.75) | round(0, 'ceil') | int }},
|
|
"tx_hash": ["eth", "ipv4", "ipv6"]
|
|
},
|
|
"link_watch": {
|
|
"name": "ethtool"
|
|
},
|
|
"ports": {
|
|
{% for member in minigraph_portchannels[pc]['members'] %}
|
|
"{{ member }}": {}{% if not loop.last %},{% endif %}
|
|
|
|
{% endfor %}
|
|
}
|
|
}
|
|
|