summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-02-11 20:00:14 +0100
committerChristian Poessinger <christian@poessinger.com>2021-02-11 20:00:14 +0100
commit66282cc8a5c8ced4dee8414e5fcb5cbaa457781f (patch)
tree1c801d92ac2d0e7ac63cb03d83117eb6510a45ed /data
parentbd3ed52d07929c644ca5c5180689f503c349b5ba (diff)
downloadvyos-1x-66282cc8a5c8ced4dee8414e5fcb5cbaa457781f.tar.gz
vyos-1x-66282cc8a5c8ced4dee8414e5fcb5cbaa457781f.zip
ripng: T3281: move common parts into Jinja2 include
Diffstat (limited to 'data')
-rw-r--r--data/templates/frr/rip.frr.tmpl34
-rw-r--r--data/templates/frr/rip_ripng.frr.j236
-rw-r--r--data/templates/frr/ripng.frr.tmpl50
3 files changed, 51 insertions, 69 deletions
diff --git a/data/templates/frr/rip.frr.tmpl b/data/templates/frr/rip.frr.tmpl
index 50db2e9de..bc92bddf9 100644
--- a/data/templates/frr/rip.frr.tmpl
+++ b/data/templates/frr/rip.frr.tmpl
@@ -35,12 +35,6 @@ interface {{ iface }}
{% endif %}
!
router rip
-{% if default_information is defined and default_information.originate is defined %}
- default-information originate
-{% endif %}
-{% if default_metric is defined and default_metric is not none %}
- default-metric {{ default_metric }}
-{% endif %}
{% if default_distance is defined and default_distance is not none %}
distance {{ default_distance }}
{% endif %}
@@ -56,33 +50,6 @@ router rip
neighbor {{ address }}
{% endfor %}
{% endif %}
-{% if network is defined and network is not none %}
-{% for prefix in network %}
- network {{ prefix }}
-{% endfor %}
-{% endif %}
-{% if interface is defined and interface is not none %}
-{% for ifname in interface %}
- network {{ ifname }}
-{% endfor %}
-{% endif %}
-{% if passive_interface is defined and passive_interface is not none %}
-{% for ifname in passive_interface %}
- passive-interface {{ ifname }}
-{% endfor %}
-{% endif %}
-{% if redistribute is defined and redistribute is not none %}
-{% for protocol, protocol_config in redistribute.items() %}
- redistribute {{ protocol }} {{ 'metric ' + protocol_config.metric if protocol_config.metric is defined }} {{ 'route-map ' + protocol_config.route_map if protocol_config.route_map is defined }}
-{% endfor %}
-{% endif %}
-{% if route is defined and route is not none %}
-{% for prefix in route %}
- route {{ prefix }}
-{% endfor %}
-{% endif %}
-{# timers have default values #}
- timers basic {{ timers['update'] }} {{ timers.timeout }} {{ timers.garbage_collection }}
{% if distribute_list is defined and distribute_list is not none %}
{% if distribute_list.access_list is defined and distribute_list.access_list is not none %}
{% if distribute_list.access_list.in is defined and distribute_list.access_list.in is not none %}
@@ -121,4 +88,5 @@ router rip
{% endif %}
{% endif %}
{% endif %}
+{% include 'frr/rip_ripng.frr.j2' %}
!
diff --git a/data/templates/frr/rip_ripng.frr.j2 b/data/templates/frr/rip_ripng.frr.j2
new file mode 100644
index 000000000..de180ee6b
--- /dev/null
+++ b/data/templates/frr/rip_ripng.frr.j2
@@ -0,0 +1,36 @@
+{% if default_information is defined and default_information.originate is defined %}
+ default-information originate
+{% endif %}
+{% if default_metric is defined and default_metric is not none %}
+ default-metric {{ default_metric }}
+{% endif %}
+{% if passive_interface is defined and passive_interface is not none %}
+{% for interface in passive_interface %}
+ passive-interface {{ interface }}
+{% endfor %}
+{% endif %}
+{% if network is defined and network is not none %}
+{% for prefix in network %}
+ network {{ prefix }}
+{% endfor %}
+{% endif %}
+{% if interface is defined and interface is not none %}
+{% for ifname in interface %}
+ network {{ ifname }}
+{% endfor %}
+{% endif %}
+{% if route is defined and route is not none %}
+{% for prefix in route %}
+ route {{ prefix }}
+{% endfor %}
+{% endif %}
+{# timers have default values #}
+ timers basic {{ timers['update'] }} {{ timers.timeout }} {{ timers.garbage_collection }}
+{% if redistribute is defined and redistribute is not none %}
+{% for protocol, protocol_config in redistribute.items() %}
+{% if protocol == 'ospfv3' %}
+{% set protocol = 'ospf6' %}
+{% endif %}
+ redistribute {{ protocol }} {{ 'metric ' + protocol_config.metric if protocol_config.metric is defined }} {{ 'route-map ' + protocol_config.route_map if protocol_config.route_map is defined }}
+{% endfor %}
+{% endif %}
diff --git a/data/templates/frr/ripng.frr.tmpl b/data/templates/frr/ripng.frr.tmpl
index ac14dfd3f..25df15121 100644
--- a/data/templates/frr/ripng.frr.tmpl
+++ b/data/templates/frr/ripng.frr.tmpl
@@ -1,46 +1,23 @@
!
-router ripng
-{% if default_information is defined and default_information.originate is defined %}
- default-information originate
-{% endif %}
-{% if default_metric is defined and default_metric is not none %}
- default-metric {{ default_metric }}
+{# Interface specific configuration #}
+{% if interface is defined and interface is not none %}
+{% for iface, iface_config in interface.items() %}
+interface {{ iface }}
+{% if iface_config.split_horizon is defined and iface_config.split_horizon.disable is defined %}
+ no ipv6 rip split-horizon
+{% endif %}
+{% if iface_config.split_horizon is defined and iface_config.split_horizon.poison_reverse is defined %}
+ ipv6 rip split-horizon poisoned-reverse
+{% endif %}
+{% endfor %}
{% endif %}
+!
+router ripng
{% if aggregate_address is defined and aggregate_address is not none %}
{% for prefix in aggregate_address %}
aggregate-address {{ prefix }}
{% endfor %}
{% endif %}
-{% if passive_interface is defined and passive_interface is not none %}
-{% for ifname in passive_interface %}
- passive-interface {{ ifname }}
-{% endfor %}
-{% endif %}
-{% if interface is defined and interface is not none %}
-{% for ifname in interface %}
- network {{ ifname }}
-{% endfor %}
-{% endif %}
-{% if network is defined and network is not none %}
-{% for net in network %}
- network {{ net }}
-{% endfor %}
-{% endif %}
-{% if route is defined and route is not none %}
-{% for prefix in route %}
- route {{ prefix }}
-{% endfor %}
-{% endif %}
-{% if redistribute is defined and redistribute is not none %}
-{% for protocol, protocol_config in redistribute.items() %}
-{% if protocol == 'ospfv3' %}
-{% set protocol = 'ospf6' %}
-{% endif %}
- redistribute {{ protocol }} {{ 'metric ' + protocol_config.metric if protocol_config.metric is defined }} {{ 'route-map ' + protocol_config.route_map if protocol_config.route_map is defined }}
-{% endfor %}
-{% endif %}
-{# timers have default values #}
- timers basic {{ timers['update'] }} {{ timers.timeout }} {{ timers.garbage_collection }}
{% if distribute_list is defined and distribute_list is not none %}
{% if distribute_list.access_list is defined and distribute_list.access_list is not none %}
{% if distribute_list.access_list.in is defined and distribute_list.access_list.in is not none %}
@@ -79,4 +56,5 @@ router ripng
{% endif %}
{% endif %}
{% endif %}
+{% include 'frr/rip_ripng.frr.j2' %}
!