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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
!
{% if interface is vyos_defined %}
{% for iface, iface_config in interface.items() %}
interface {{ iface }}
ip router isis VyOS
ipv6 router isis VyOS
{% if iface_config.bfd is vyos_defined %}
isis bfd
{% if iface_config.bfd.profile is vyos_defined %}
isis bfd profile {{ iface_config.bfd.profile }}
{% endif %}
{% endif %}
{% if iface_config.network.point_to_point is vyos_defined %}
isis network point-to-point
{% endif %}
{% if iface_config.circuit_type is vyos_defined %}
isis circuit-type {{ iface_config.circuit_type }}
{% endif %}
{% if iface_config.hello_interval is vyos_defined %}
isis hello-interval {{ iface_config.hello_interval }}
{% endif %}
{% if iface_config.hello_multiplier is vyos_defined %}
isis hello-multiplier {{ iface_config.hello_multiplier }}
{% endif %}
{% if iface_config.hello_padding is vyos_defined %}
isis hello padding
{% endif %}
{% if iface_config.ldp_sync.disable is vyos_defined %}
no isis mpls ldp-sync
{% elif iface_config.ldp_sync.holddown is vyos_defined %}
isis mpls ldp-sync
isis mpls ldp-sync holddown {{ iface_config.ldp_sync.holddown }}
{% endif %}
{% if iface_config.metric is vyos_defined %}
isis metric {{ iface_config.metric }}
{% endif %}
{% if iface_config.passive is vyos_defined %}
isis passive
{% endif %}
{% if iface_config.password.md5 is vyos_defined %}
isis password md5 {{ iface_config.password.md5 }}
{% elif iface_config.password.plaintext_password is vyos_defined %}
isis password clear {{ iface_config.password.plaintext_password }}
{% endif %}
{% if iface_config.priority is vyos_defined %}
isis priority {{ iface_config.priority }}
{% endif %}
{% if iface_config.psnp_interval is vyos_defined %}
isis psnp-interval {{ iface_config.psnp_interval }}
{% endif %}
{% if iface_config.no_three_way_handshake is vyos_defined %}
no isis three-way-handshake
{% endif %}
exit
!
{% endfor %}
{% endif %}
!
router isis VyOS {{ 'vrf ' + vrf if vrf is vyos_defined }}
net {{ net }}
{% if advertise_high_metrics is vyos_defined %}
advertise-high-metrics
{% endif %}
{% if advertise_passive_only is vyos_defined %}
advertise-passive-only
{% endif %}
{% if dynamic_hostname is vyos_defined %}
hostname dynamic
{% endif %}
{% if purge_originator is vyos_defined %}
purge-originator
{% endif %}
{% if set_attached_bit is vyos_defined %}
set-attached-bit
{% endif %}
{% if set_overload_bit is vyos_defined %}
set-overload-bit
{% endif %}
{% if domain_password.md5 is vyos_defined %}
domain-password md5 {{ domain_password.plaintext_password }}
{% elif domain_password.plaintext_password is vyos_defined %}
domain-password clear {{ domain_password.plaintext_password }}
{% endif %}
{% if log_adjacency_changes is vyos_defined %}
log-adjacency-changes
{% endif %}
{% if lsp_gen_interval is vyos_defined %}
lsp-gen-interval {{ lsp_gen_interval }}
{% endif %}
{% if lsp_mtu is vyos_defined %}
lsp-mtu {{ lsp_mtu }}
{% endif %}
{% if lsp_refresh_interval is vyos_defined %}
lsp-refresh-interval {{ lsp_refresh_interval }}
{% endif %}
{% if max_lsp_lifetime is vyos_defined %}
max-lsp-lifetime {{ max_lsp_lifetime }}
{% endif %}
{% if ldp_sync.holddown is vyos_defined %}
mpls ldp-sync holddown {{ ldp_sync.holddown }}
{% elif ldp_sync is vyos_defined %}
mpls ldp-sync
{% endif %}
{% if spf_interval is vyos_defined %}
spf-interval {{ spf_interval }}
{% endif %}
{% if traffic_engineering.enable is vyos_defined %}
mpls-te on
{% endif %}
{% if traffic_engineering.address is vyos_defined %}
mpls-te router-address {{ traffic_engineering.address }}
{% endif %}
{% if traffic_engineering.inter_as is vyos_defined %}
{% set level = '' %}
{% if traffic_engineering.inter_as.level_1 is vyos_defined %}
{% set level = ' level-1' %}
{% endif %}
{% if traffic_engineering.inter_as.level_1_2 is vyos_defined %}
{% set level = ' level-1-2' %}
{% endif %}
{% if traffic_engineering.inter_as.level_2 is vyos_defined %}
{% set level = ' level-2-only' %}
{% endif %}
mpls-te inter-as{{ level }}
{% 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.absolute is vyos_defined %}
{% if prefix_config.absolute.value is vyos_defined %}
segment-routing prefix {{ prefix }} absolute {{ prefix_config.absolute.value }} {{ 'explicit-null' if prefix_config.absolute.explicit_null is vyos_defined }} {{ 'no-php-flag' if prefix_config.absolute.no_php_flag is vyos_defined }}
{% endif %}
{% endif %}
{% 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 spf_delay_ietf.init_delay is vyos_defined %}
spf-delay-ietf init-delay {{ spf_delay_ietf.init_delay }} short-delay {{ spf_delay_ietf.short_delay }} long-delay {{ spf_delay_ietf.long_delay }} holddown {{ spf_delay_ietf.holddown }} time-to-learn {{ spf_delay_ietf.time_to_learn }}
{% endif %}
{% if area_password.md5 is vyos_defined %}
area-password md5 {{ area_password.md5 }}
{% elif area_password.plaintext_password is vyos_defined %}
area-password clear {{ area_password.plaintext_password }}
{% endif %}
{% if default_information.originate is vyos_defined %}
{% for afi, afi_config in default_information.originate.items() %}
{% for level, level_config in afi_config.items() %}
default-information originate {{ afi }} {{ level | replace('_', '-') }} {{ 'always' if level_config.always is vyos_defined }} {{ 'route-map ' ~ level_config.route_map if level_config.route_map is vyos_defined }} {{ 'metric ' ~ level_config.metric if level_config.metric is vyos_defined }}
{% endfor %}
{% endfor %}
{% endif %}
{% if fast_reroute.lfa is vyos_defined %}
{% if fast_reroute.lfa.local is vyos_defined %}
{% if fast_reroute.lfa.local.load_sharing.disable.level_1 is vyos_defined %}
fast-reroute load-sharing disable level-1
{% elif fast_reroute.lfa.local.load_sharing.disable.level_2 is vyos_defined %}
fast-reroute load-sharing disable level-2
{% elif fast_reroute.lfa.local.load_sharing.disable is vyos_defined %}
fast-reroute load-sharing disable
{% endif %}
{% if fast_reroute.lfa.local.priority_limit is vyos_defined %}
{% for priority, priority_limit_options in fast_reroute.lfa.local.priority_limit.items() %}
{% for level in priority_limit_options %}
fast-reroute priority-limit {{ priority }} {{ level | replace('_', '-') }}
{% endfor %}
{% endfor %}
{% endif %}
{% if fast_reroute.lfa.local.tiebreaker is vyos_defined %}
{% for tiebreaker, tiebreaker_options in fast_reroute.lfa.local.tiebreaker.items() %}
{% for index, index_options in tiebreaker_options.items() %}
{% for index_value, index_value_options in index_options.items() %}
{% for level in index_value_options %}
fast-reroute lfa tiebreaker {{ tiebreaker | replace('_', '-') }} index {{ index_value }} {{ level | replace('_', '-') }}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endif %}
{% endif %}
{% if fast_reroute.lfa.remote.prefix_list is vyos_defined %}
{% for prefix_list, prefix_list_options in fast_reroute.lfa.remote.prefix_list.items() %}
{% if prefix_list_options.level_1 is vyos_defined %}
fast-reroute remote-lfa prefix-list {{ prefix_list }} level-1
{% endif %}
{% if prefix_list_options.level_2 is vyos_defined %}
fast-reroute remote-lfa prefix-list {{ prefix_list }} level-2
{% endif %}
{% if prefix_list is vyos_defined and prefix_list_options.level_1 is not vyos_defined and prefix_list_options.level_2 is not vyos_defined %}
fast-reroute remote-lfa prefix-list {{ prefix_list }}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% if redistribute.ipv4 is vyos_defined %}
{% for protocol, protocol_options in redistribute.ipv4.items() %}
{% for level, level_config in protocol_options.items() %}
{% if level_config.metric is vyos_defined %}
redistribute ipv4 {{ protocol }} {{ level | replace('_', '-') }} metric {{ level_config.metric }}
{% elif level_config.route_map is vyos_defined %}
redistribute ipv4 {{ protocol }} {{ level | replace('_', '-') }} route-map {{ level_config.route_map }}
{% else %}
redistribute ipv4 {{ protocol }} {{ level | replace('_', '-') }}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% if redistribute.ipv6 is vyos_defined %}
{% for protocol, protocol_options in redistribute.ipv6.items() %}
{% for level, level_config in protocol_options.items() %}
{% if level_config.metric is vyos_defined %}
redistribute ipv6 {{ protocol }} {{ level | replace('_', '-') }} metric {{ level_config.metric }}
{% elif level_config.route_map is vyos_defined %}
redistribute ipv6 {{ protocol }} {{ level | replace('_', '-') }} route-map {{ level_config.route_map }}
{% else %}
redistribute ipv6 {{ protocol }} {{ level | replace('_', '-') }}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% if topology is vyos_defined %}
topology {{ topology }}
{% endif %}
{% if level is vyos_defined('level-2') %}
is-type level-2-only
{% elif level is vyos_defined %}
is-type {{ level }}
{% endif %}
exit
!
|