sonic-buildimage/dockers/docker-router-advertiser/radvd.conf.j2
kellyyeh adaec6337f
[radv] Support multiple ipv6 prefixes per vlan interface (#9934) (#10253)
Why I did it
Radvd.conf.j2 template creates two copies of the vlan interface when there are more than one ipv6 address assigned to a single vlan interface. Changed the format to add prefixes under the same vlan interface block.

How I did it
Modifies radvd.conf.j2 and added unit tests

How to verify it
Configure multiple ipv6 address to the same vlan, start radvd
Unit test will check if radvd.conf with multiple ipv6 addresses is formed correctly
2022-03-20 17:17:59 -07:00

50 lines
1.4 KiB
Django/Jinja

{% block banner %}
# =========== Managed by sonic-cfggen -- DO NOT edit manually! ====================
# Generated by /usr/share/sonic/templates/radvd.conf.j2 using config DB data
# File: /etc/radvd.conf
#
{% endblock banner %}
# Config file for radvd, the router advertisement daemon
# See man page for radvd.conf for descriptions of all available options
#
{# If our configuration has VLAN interfaces... #}
{% if VLAN_INTERFACE %}
{% set vlan_list = dict() %}
{% for (name,prefix) in VLAN_INTERFACE|pfx_filter %}
{% if name is not in vlan_list and prefix | ipv6 %}
{% set prefix_list = [] %}
{% set _ = vlan_list.update({name: prefix_list}) %}
{% endif %}
{% if prefix | ipv6 %}
{# If our configuration has VLAN interfaces... #}
{% set prefix_list = vlan_list.get(name) %}
{% set _ = prefix_list.append(prefix) %}
{% set _ = vlan_list.update({name: prefix_list}) %}
{% endif %}
{% endfor %}
{% endif %}
{% for name, prefixes in vlan_list.items() %}
interface {{ name }}
{
IgnoreIfMissing on;
AdvSendAdvert on;
MinRtrAdvInterval 60;
MaxRtrAdvInterval 180;
AdvManagedFlag on;
AdvOtherConfigFlag off;
AdvLinkMTU 9100;
AdvHomeAgentFlag off;
{% for prefix in prefixes %}
prefix {{ prefix | network }}/{{ prefix | prefixlen }} {
AdvOnLink on;
AdvAutonomous off;
AdvRouterAddr off;
AdvValidLifetime infinity;
AdvPreferredLifetime infinity;
};
{% endfor %}
};
{% endfor %}