6754635010
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>
36 lines
938 B
Django/Jinja
36 lines
938 B
Django/Jinja
{% macro get_ipv4_loopback_address(interfaces, loopbackname) -%}
|
|
{% set L = namespace(ip=None) %}
|
|
{% for name, prefix in interfaces|pfx_filter %}
|
|
{% if name == loopbackname %}
|
|
{% if prefix | ipv4 %}
|
|
{% set L.ip = prefix %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{{ L.ip }}
|
|
{%- endmacro %}
|
|
|
|
{% macro get_ipv6_loopback_address(interfaces, loopbackname) -%}
|
|
{% set L = namespace(ip=None) %}
|
|
{% for name, prefix in interfaces|pfx_filter %}
|
|
{% if name == loopbackname %}
|
|
{% if prefix | ipv6 %}
|
|
{% set L.ip = prefix %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{{ L.ip }}
|
|
{%- endmacro %}
|
|
|
|
{% macro get_vnet_interfaces(interfaces) -%}
|
|
{% set L = namespace(intfs=[]) %}
|
|
{% set vnet_intfs = [] %}
|
|
{% for (key, metadata) in interfaces.items() %}
|
|
{% if "vnet_name" in metadata %}
|
|
{% set vnet_intfs = vnet_intfs.append(key) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% set L.intfs = vnet_intfs %}
|
|
{{ L.intfs }}
|
|
{%- endmacro %}
|