summaryrefslogtreecommitdiff
path: root/data/templates/frr/ospfd.frr.j2
blob: 0baff2d723b340416148da94399b5daa9fcf8f9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
!
{% if interface is vyos_defined %}
{%     for iface, iface_config in interface.items() %}
interface {{ iface }}
{%         if iface_config.authentication.plaintext_password is vyos_defined %}
 ip ospf authentication-key {{ iface_config.authentication.plaintext_password }}
{%         elif iface_config.authentication.md5 is vyos_defined %}
 ip ospf authentication message-digest
{%             if iface_config.authentication.md5.key_id is vyos_defined %}
{%                 for key, key_config in iface_config.authentication.md5.key_id.items() %}
 ip ospf message-digest-key {{ key }} md5 {{ key_config.md5_key }}
{%                 endfor %}
{%             endif %}
{%         endif %}
{%         if iface_config.area is vyos_defined %}
 ip ospf area {{ iface_config.area }}
{%         endif %}
{%         if iface_config.bandwidth is vyos_defined %}
 bandwidth {{ iface_config.bandwidth }}
{%         endif %}
{%         if iface_config.cost is vyos_defined %}
 ip ospf cost {{ iface_config.cost }}
{%         endif %}
{%         if iface_config.priority is vyos_defined %}
 ip ospf priority {{ iface_config.priority }}
{%         endif %}
{%         if iface_config.hello_interval is vyos_defined %}
 ip ospf hello-interval {{ iface_config.hello_interval }}
{%         endif %}
{%         if iface_config.retransmit_interval is vyos_defined %}
 ip ospf retransmit-interval {{ iface_config.retransmit_interval }}
{%         endif %}
{%         if iface_config.transmit_delay is vyos_defined %}
 ip ospf transmit-delay {{ iface_config.transmit_delay }}
{%         endif %}
{%         if iface_config.dead_interval is vyos_defined %}
 ip ospf dead-interval {{ iface_config.dead_interval }}
{%         elif iface_config.hello_multiplier is vyos_defined %}
 ip ospf dead-interval minimal hello-multiplier {{ iface_config.hello_multiplier }}
{%         endif %}
{%         if iface_config.bfd is vyos_defined %}
 ip ospf bfd
{%         endif %}
{%         if iface_config.bfd.profile is vyos_defined %}
 ip ospf bfd profile {{ iface_config.bfd.profile }}
{%         endif %}
{%         if iface_config.mtu_ignore is vyos_defined %}
 ip ospf mtu-ignore
{%         endif %}
{%         if iface_config.network is vyos_defined %}
 ip ospf network {{ iface_config.network }}
{%         endif %}
{%         if iface_config.passive is vyos_defined %}
 {{ 'no ' if iface_config.passive.disable is vyos_defined }}ip ospf passive
{%         endif %}
exit
!
{%     endfor %}
{% endif %}
!
router ospf {{ 'vrf ' ~ vrf if vrf is vyos_defined }}
{% if access_list is vyos_defined %}
{%     for acl, acl_config in access_list.items() %}
{%         for protocol in acl_config.export if acl_config.export is vyos_defined %}
 distribute-list {{ acl }} out {{ protocol }}
{%         endfor %}
{%     endfor %}
{% endif %}
{% if area is vyos_defined %}
{%     for area_id, area_config in area.items() %}
{%         if area_config.area_type is vyos_defined %}
{%             for type, type_config in area_config.area_type.items() if type != 'normal' %}
 area {{ area_id }} {{ type }} {{ 'no-summary' if type_config.no_summary is vyos_defined }}
{%                 if type_config.default_cost is vyos_defined %}
 area {{ area_id }} default-cost {{ type_config.default_cost }}
{%                 endif %}
{%             endfor %}
{%         endif %}
{%         if area_config.authentication is vyos_defined %}
 area {{ area_id }} authentication {{ 'message-digest' if area_config.authentication is vyos_defined('md5') }}
{%         endif %}
{%         for network in area_config.network if area_config.network is vyos_defined %}
 network {{ network }} area {{ area_id }}
{%         endfor %}
{%         if area_config.range is vyos_defined %}
{%             for range, range_config in area_config.range.items() %}
{%                 if range_config.cost is vyos_defined %}
 area {{ area_id }} range {{ range }} cost {{ range_config.cost }}
{%                 endif %}
{%                 if range_config.not_advertise is vyos_defined %}
 area {{ area_id }} range {{ range }} not-advertise
{%                 endif %}
{%                 if range_config.substitute is vyos_defined %}
 area {{ area_id }} range {{ range }} substitute {{ range_config.substitute }}
{%                 endif %}
{%             endfor %}
{%         endif %}
{%         if area_config.export_list is vyos_defined %}
 area {{ area_id }} export-list {{ area_config.export_list }}
{%         endif %}
{%         if area_config.import_list is vyos_defined %}
 area {{ area_id }} import-list {{ area_config.import_list }}
{%         endif %}
{%         if area_config.shortcut is vyos_defined %}
 area {{ area_id }} shortcut {{ area_config.shortcut }}
{%         endif %}
{%         if area_config.virtual_link is vyos_defined %}
{%             for link, link_config in area_config.virtual_link.items() %}
{%                 if link_config.authentication.plaintext_password is vyos_defined %}
 area {{ area_id }} virtual-link {{ link }} authentication-key {{ link_config.authentication.plaintext_password }}
{%                 elif link_config.authentication.md5.key_id is vyos_defined %}
{%                     for key, key_config in link_config.authentication.md5.key_id.items() %}
 area {{ area_id }} virtual-link {{ link }} message-digest-key {{ key }} md5 {{ key_config.md5_key }}
{%                     endfor %}
{%                 endif %}
{#         The following values are default values #}
 area {{ area_id }} virtual-link {{ link }} hello-interval {{ link_config.hello_interval }} retransmit-interval {{ link_config.retransmit_interval }} transmit-delay {{ link_config.transmit_delay }} dead-interval {{ link_config.dead_interval }}
{%             endfor %}
{%         endif %}
{%     endfor %}
{% endif %}
{% if auto_cost.reference_bandwidth is vyos_defined %}
 auto-cost reference-bandwidth {{ auto_cost.reference_bandwidth }}
{% endif %}
{% if default_information.originate is vyos_defined %}
 default-information originate {{ 'always' if default_information.originate.always is vyos_defined }} {{ 'metric ' + default_information.originate.metric if default_information.originate.metric is vyos_defined }} {{ 'metric-type ' + default_information.originate.metric_type if default_information.originate.metric_type is vyos_defined }} {{ 'route-map ' + default_information.originate.route_map if default_information.originate.route_map is vyos_defined }}
{% endif %}
{% if default_metric is vyos_defined %}
 default-metric {{ default_metric }}
{% endif %}
{% if maximum_paths is vyos_defined %}
 maximum-paths {{ maximum_paths }}
{% endif %}
{% if distance.global is vyos_defined %}
 distance {{ distance.global }}
{% endif %}
{% if distance.ospf is vyos_defined %}
 distance ospf {{ 'intra-area ' + distance.ospf.intra_area if distance.ospf.intra_area is vyos_defined }} {{ 'inter-area ' + distance.ospf.inter_area if distance.ospf.inter_area is vyos_defined }} {{ 'external ' + distance.ospf.external if distance.ospf.external is vyos_defined }}
{% endif %}
{% if log_adjacency_changes is vyos_defined %}
 log-adjacency-changes {{ "detail" if log_adjacency_changes.detail is vyos_defined }}
{% endif %}
{% if max_metric.router_lsa.administrative is vyos_defined %}
 max-metric router-lsa administrative
{% endif %}
{% if max_metric.router_lsa.on_shutdown is vyos_defined %}
 max-metric router-lsa on-shutdown {{ max_metric.router_lsa.on_shutdown }}
{% endif %}
{% if max_metric.router_lsa.on_startup is vyos_defined %}
 max-metric router-lsa on-startup {{ max_metric.router_lsa.on_startup }}
{% endif %}
{% if mpls_te.enable is vyos_defined %}
 mpls-te on
 mpls-te router-address {{ mpls_te.router_address }}
{% endif %}
{% if neighbor is vyos_defined %}
{%     for address, address_config in neighbor.items() %}
 neighbor {{ address }} {{ 'priority ' + address_config.priority if address_config.priority is vyos_defined }} {{ 'poll-interval ' + address_config.poll_interval if address_config.poll_interval is vyos_defined }}
{%     endfor %}
{% endif %}
{% if parameters.abr_type is vyos_defined %}
 ospf abr-type {{ parameters.abr_type }}
{% endif %}
{% if parameters.opaque_lsa is vyos_defined %}
 ospf opaque-lsa
{% endif %}
{% if parameters.rfc1583_compatibility is vyos_defined %}
 ospf rfc1583compatibility
{% endif %}
{% if parameters.router_id is vyos_defined %}
 ospf router-id {{ parameters.router_id }}
{% endif %}
{% if passive_interface is vyos_defined('default') %}
 passive-interface default
{% endif %}
{% if redistribute is vyos_defined %}
{%     for protocol, protocols_options in redistribute.items() %}
{%         if protocol == 'table' %}
{%             for table, table_options in protocols_options.items() %}
 redistribute {{ protocol }} {{ table }} {{ 'metric ' + table_options.metric if table_options.metric is vyos_defined }} {{ 'metric-type ' + table_options.metric_type if table_options.metric_type is vyos_defined }} {{ 'route-map ' + table_options.route_map if table_options.route_map is vyos_defined }}
{%             endfor %}
{%         else %}
 redistribute {{ protocol }} {{ 'metric ' + protocols_options.metric if protocols_options.metric is vyos_defined }} {{ 'metric-type ' + protocols_options.metric_type if protocols_options.metric_type is vyos_defined }} {{ 'route-map ' + protocols_options.route_map if protocols_options.route_map is vyos_defined }}
{%         endif %}
{%     endfor %}
{% endif %}
{% if refresh.timers is vyos_defined %}
 refresh timer {{ refresh.timers }}
{% endif %}
{% if segment_routing is vyos_defined %}
{%     if segment_routing.maximum_label_depth is vyos_defined %}
 segment-routing node-msd {{ segment_routing.maximum_label_depth }}
{%     endif %}
{%     if segment_routing.global_block is vyos_defined %}
{%         if segment_routing.local_block is vyos_defined %}
 segment-routing global-block {{ segment_routing.global_block.low_label_value }} {{ segment_routing.global_block.high_label_value }} local-block {{ segment_routing.local_block.low_label_value }} {{ segment_routing.local_block.high_label_value }}
{%         else %}
 segment-routing global-block {{ segment_routing.global_block.low_label_value }} {{ segment_routing.global_block.high_label_value }}
{%         endif %}
{%     endif %}
{%     if segment_routing.prefix is vyos_defined %}
{%         for prefix, prefix_config in segment_routing.prefix.items() %}
{%             if prefix_config.index is vyos_defined %}
{%                 if prefix_config.index.value is vyos_defined %}
 segment-routing prefix {{ prefix }} index {{ prefix_config.index.value }} {{ 'explicit-null' if prefix_config.index.explicit_null is vyos_defined }} {{ 'no-php-flag' if prefix_config.index.no_php_flag is vyos_defined }}
{%                 endif %}
{%             endif %}
{%         endfor %}
{%     endif %}
 segment-routing on
{% endif %}
{% if timers.throttle.spf.delay is vyos_defined and timers.throttle.spf.initial_holdtime is vyos_defined and timers.throttle.spf.max_holdtime is vyos_defined %}
{#   Timer values have default values #}
 timers throttle spf {{ timers.throttle.spf.delay }} {{ timers.throttle.spf.initial_holdtime }} {{ timers.throttle.spf.max_holdtime }}
{% endif %}
exit
!