sonic-buildimage/dockers/docker-orchagent/ports.json.j2
Tamer Ahmed 6754635010 [cfggen] Make Jinja2 Template Python 3 Compatible
Jinja2 templates rendered using Python 3 interpreter, are required
to conform with Python 3 new semantics.

singed-off-by: Tamer Ahmed <tamer.ahmed@microsoft.com>
2020-09-30 07:07:43 -07:00

21 lines
483 B
Django/Jinja

[
{% set ports_with_speed_set=[] %}
{% if PORT %}
{% for port in PORT %}
{% if 'speed' in PORT[port] %}
{%- if ports_with_speed_set.append(port) -%}{%- endif -%}
{%- endif -%}
{% endfor %}
{% for port in ports_with_speed_set %}
{
"PORT_TABLE:{{ port }}": {
"speed": "{{ PORT[port]['speed'] }}",
"description": "{{ PORT[port]['description'] }}"
},
"OP": "SET"
}{% if not loop.last %},{% endif %}
{% endfor %}
{% endif %}
]