summaryrefslogtreecommitdiff
path: root/data/templates/frr/babeld.frr.j2
diff options
context:
space:
mode:
authorYuxiang Zhu <vfreex@gmail.com>2023-01-09 05:48:50 +0000
committerYuxiang Zhu <vfreex@gmail.com>2023-02-08 21:48:15 +0800
commit4bfe801e7e6c59bdb70500b629fd31bb03598d4b (patch)
treefd51141d8fd1c6c112c7742259f5b97cf88abd17 /data/templates/frr/babeld.frr.j2
parent2622902ac76bc1c3356bb722f63e931119f3eb04 (diff)
downloadvyos-1x-4bfe801e7e6c59bdb70500b629fd31bb03598d4b.tar.gz
vyos-1x-4bfe801e7e6c59bdb70500b629fd31bb03598d4b.zip
T4977: Add Babel routing protocol support
This PR adds basic Babel routing protocol support using the implementation in FRR. Signed-off-by: Yuxiang Zhu <vfreex@gmail.com>
Diffstat (limited to 'data/templates/frr/babeld.frr.j2')
-rw-r--r--data/templates/frr/babeld.frr.j285
1 files changed, 85 insertions, 0 deletions
diff --git a/data/templates/frr/babeld.frr.j2 b/data/templates/frr/babeld.frr.j2
new file mode 100644
index 000000000..344a5f988
--- /dev/null
+++ b/data/templates/frr/babeld.frr.j2
@@ -0,0 +1,85 @@
+{% from 'frr/distribute_list_macro.j2' import render_distribute_list %}
+{% from 'frr/ipv6_distribute_list_macro.j2' import render_ipv6_distribute_list %}
+!
+{# Interface specific configuration #}
+{% if interface is vyos_defined %}
+{% for iface, iface_config in interface.items() %}
+interface {{ iface }}
+{% if iface_config.type is vyos_defined('wired') or iface_config.type is vyos_defined('wireless') %}
+ babel {{ iface_config.type }}
+{% endif %}
+{% if iface_config.split_horizon is vyos_defined("enable") %}
+ babel split-horizon
+{% elif iface_config.split_horizon is vyos_defined("disable") %}
+ no babel split-horizon
+{% endif %}
+{% if iface_config.hello_interval is vyos_defined %}
+ babel hello-interval {{ iface_config.hello_interval }}
+{% endif %}
+{% if iface_config.update_interval is vyos_defined %}
+ babel update-interval {{ iface_config.update_interval }}
+{% endif %}
+{% if iface_config.rxcost is vyos_defined %}
+ babel rxcost {{ iface_config.rxcost }}
+{% endif %}
+{% if iface_config.rtt_decay is vyos_defined %}
+ babel rtt-decay {{ iface_config.rtt_decay }}
+{% endif %}
+{% if iface_config.rtt_min is vyos_defined %}
+ babel rtt-min {{ iface_config.rtt_min }}
+{% endif %}
+{% if iface_config.rtt_max is vyos_defined %}
+ babel rtt-max {{ iface_config.rtt_max }}
+{% endif %}
+{% if iface_config.max_rtt_penalty is vyos_defined %}
+ babel max-rtt-penalty {{ iface_config.max_rtt_penalty }}
+{% endif %}
+{% if iface_config.enable_timestamps is vyos_defined %}
+ babel enable-timestamps
+{% endif %}
+{% if iface_config.channel is vyos_defined %}
+ babel channel {{ iface_config.channel | replace("non-interfering", "noninterfering") }}
+{% endif %}
+exit
+!
+{% endfor %}
+{% endif %}
+!
+{# Babel configuration #}
+router babel
+{% if parameters.diversity is vyos_defined %}
+ babel diversity
+{% endif %}
+{% if parameters.diversity_factor is vyos_defined %}
+ babel diversity-factor {{ parameters.diversity_factor }}
+{% endif %}
+{% if parameters.resend_delay is vyos_defined %}
+ babel resend-delay {{ parameters.resend_delay }}
+{% endif %}
+{% if parameters.smoothing_half_life is vyos_defined %}
+ babel smoothing-half-life {{ parameters.smoothing_half_life }}
+{% endif %}
+{% if interface is vyos_defined %}
+{% for iface, iface_config in interface.items() %}
+ network {{ iface }}
+{% endfor %}
+{% endif %}
+{% if redistribute is vyos_defined %}
+{% for address_family in redistribute %}
+{% for protocol, protocol_config in redistribute[address_family].items() %}
+{% if protocol is vyos_defined('ospfv3') %}
+{% set protocol = 'ospf6' %}
+{% endif %}
+ redistribute {{ address_family }} {{ protocol }}
+{% endfor %}
+{% endfor %}
+{% endif %}
+{% if distribute_list.ipv4 is vyos_defined %}
+{{ render_distribute_list(distribute_list.ipv4) }}
+{% endif %}
+{% if distribute_list.ipv6 is vyos_defined %}
+{{ render_ipv6_distribute_list(distribute_list.ipv6) }}
+{% endif %}
+exit
+!
+end