bird: param bird__bgp_sessions is now a dict

This commit is contained in:
jeltz 2023-07-05 01:20:47 +02:00
parent 9de88d0a28
commit 75f0ee785b
Signed by: jeltz
GPG key ID: 800882B66C0C3326

View file

@ -125,10 +125,10 @@ bgp_local_pref = {{ filter.local_pref }};
{% endmacro %}
{# FIXME: massive cleanup required #}
{% for session in bird__bgp_sessions %}
{% for name, session in bird__bgp_sessions.items() %}
{% for version in [4, 6] %}
{% for direction in ["import", "export"] %}
filter bgp{{ version }}_{{ direction }}_{{ session.name }} {
filter bgp{{ version }}_{{ direction }}_{{ name }} {
{% for filter in session[direction] %}
{% set negate = filter.negate | default(False) %}
{% set networks =
@ -165,7 +165,7 @@ filter bgp{{ version }}_{{ direction }}_{{ session.name }} {
{% endfor %}
{% endfor %}
{% for session in bird__bgp_sessions %}
{% for name, session in bird__bgp_sessions.items() %}
{% for local_address in session.local.address %}
{% set version =
local_address
@ -174,7 +174,7 @@ filter bgp{{ version }}_{{ direction }}_{{ session.name }} {
session.remote.address
| ansible.utils.ipaddr(version=version)
| first %}
protocol bgp bgp{{ version }}_{{ session.name }} {
protocol bgp bgp{{ version }}_{{ name }} {
local {{ local_address }} as {{ session.local.as }};
neighbor {{ remote_address }} as {{ session.remote.as }};
{{ "ipv4" if version == 4 else "ipv6" }} {
@ -184,8 +184,8 @@ protocol bgp bgp{{ version }}_{{ session.name }} {
{% if session.direct | default(False) %}
direct;
{% endif %}
import filter bgp{{ version }}_import_{{ session.name }};
export filter bgp{{ version }}_export_{{ session.name }};
import filter bgp{{ version }}_import_{{ name }};
export filter bgp{{ version }}_export_{{ name }};
};
}
{% endfor %}