sonic-buildimage/dockers/docker-fpm-frr/frr/common/functions.conf.j2

36 lines
948 B
Plaintext
Raw Normal View History

{% 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.iteritems() %}
{% if metadata.has_key("vnet_name") %}
{% set vnet_intfs = vnet_intfs.append(key) %}
{% endif %}
{% endfor %}
{% set L.intfs = vnet_intfs %}
{{ L.intfs }}
{%- endmacro %}