]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
20bd27e2 EDP |
2 | /* |
3 | * Copyright (C) 2001,2002 Sampo Saaristo | |
4 | * Tampere University of Technology | |
5 | * Institute of Communications Engineering | |
6 | * Copyright (C) 2018 Volta Networks | |
7 | * Emanuele Di Pascale | |
20bd27e2 EDP |
8 | */ |
9 | ||
10 | #include <zebra.h> | |
11 | ||
12 | #include "if.h" | |
13 | #include "vrf.h" | |
14 | #include "log.h" | |
15 | #include "prefix.h" | |
16 | #include "command.h" | |
17 | #include "northbound_cli.h" | |
18 | #include "libfrr.h" | |
19 | #include "yang.h" | |
20 | #include "lib/linklist.h" | |
21 | #include "isisd/isisd.h" | |
2a1c520e | 22 | #include "isisd/isis_nb.h" |
20bd27e2 EDP |
23 | #include "isisd/isis_misc.h" |
24 | #include "isisd/isis_circuit.h" | |
25 | #include "isisd/isis_csm.h" | |
26 | ||
20bd27e2 | 27 | #include "isisd/isis_cli_clippy.c" |
20bd27e2 EDP |
28 | |
29 | #ifndef FABRICD | |
30 | ||
aaf2fd21 EDP |
31 | /* |
32 | * XPath: /frr-isisd:isis/instance | |
33 | */ | |
65251ce8 | 34 | DEFPY_YANG_NOSH(router_isis, router_isis_cmd, |
35 | "router isis WORD$tag [vrf NAME$vrf_name]", | |
36 | ROUTER_STR | |
37 | "ISO IS-IS\n" | |
38 | "ISO Routing area tag\n" VRF_CMD_HELP_STR) | |
aaf2fd21 EDP |
39 | { |
40 | int ret; | |
41 | char base_xpath[XPATH_MAXLEN]; | |
42 | ||
65251ce8 | 43 | if (!vrf_name) |
44 | vrf_name = VRF_DEFAULT_NAME; | |
45 | ||
aaf2fd21 | 46 | snprintf(base_xpath, XPATH_MAXLEN, |
65251ce8 | 47 | "/frr-isisd:isis/instance[area-tag='%s'][vrf='%s']", tag, |
48 | vrf_name); | |
aaf2fd21 | 49 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); |
eab88f36 | 50 | |
ae08de9f | 51 | ret = nb_cli_apply_changes(vty, "%s", base_xpath); |
aaf2fd21 EDP |
52 | if (ret == CMD_SUCCESS) |
53 | VTY_PUSH_XPATH(ISIS_NODE, base_xpath); | |
54 | ||
55 | return ret; | |
56 | } | |
57 | ||
65251ce8 | 58 | DEFPY_YANG(no_router_isis, no_router_isis_cmd, |
59 | "no router isis WORD$tag [vrf NAME$vrf_name]", | |
60 | NO_STR ROUTER_STR | |
61 | "ISO IS-IS\n" | |
62 | "ISO Routing area tag\n" VRF_CMD_HELP_STR) | |
aaf2fd21 | 63 | { |
65251ce8 | 64 | if (!vrf_name) |
65 | vrf_name = VRF_DEFAULT_NAME; | |
66 | ||
3bb513c3 | 67 | if (!yang_dnode_existsf( |
65251ce8 | 68 | vty->candidate_config->dnode, |
69 | "/frr-isisd:isis/instance[area-tag='%s'][vrf='%s']", tag, | |
70 | vrf_name)) { | |
aaf2fd21 EDP |
71 | vty_out(vty, "ISIS area %s not found.\n", tag); |
72 | return CMD_ERR_NOTHING_TODO; | |
73 | } | |
74 | ||
95ce849b | 75 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
aaf2fd21 | 76 | |
fd396924 | 77 | return nb_cli_apply_changes_clear_pending( |
65251ce8 | 78 | vty, "/frr-isisd:isis/instance[area-tag='%s'][vrf='%s']", tag, |
79 | vrf_name); | |
aaf2fd21 EDP |
80 | } |
81 | ||
25605051 | 82 | void cli_show_router_isis(struct vty *vty, const struct lyd_node *dnode, |
aaf2fd21 EDP |
83 | bool show_defaults) |
84 | { | |
65251ce8 | 85 | const char *vrf = NULL; |
86 | ||
87 | vrf = yang_dnode_get_string(dnode, "./vrf"); | |
88 | ||
aaf2fd21 | 89 | vty_out(vty, "!\n"); |
31200a29 | 90 | vty_out(vty, "router isis %s", |
aaf2fd21 | 91 | yang_dnode_get_string(dnode, "./area-tag")); |
65251ce8 | 92 | if (!strmatch(vrf, VRF_DEFAULT_NAME)) |
31200a29 | 93 | vty_out(vty, " vrf %s", yang_dnode_get_string(dnode, "./vrf")); |
65251ce8 | 94 | vty_out(vty, "\n"); |
aaf2fd21 EDP |
95 | } |
96 | ||
25605051 | 97 | void cli_show_router_isis_end(struct vty *vty, const struct lyd_node *dnode) |
07679ad9 IR |
98 | { |
99 | vty_out(vty, "exit\n"); | |
100 | } | |
101 | ||
aaf2fd21 EDP |
102 | /* |
103 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/ | |
104 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing | |
105 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing | |
106 | * XPath: /frr-isisd:isis/instance | |
107 | */ | |
65251ce8 | 108 | DEFPY_YANG(ip_router_isis, ip_router_isis_cmd, |
1457b1d5 | 109 | "ip router isis WORD$tag", |
65251ce8 | 110 | "Interface Internet Protocol config commands\n" |
111 | "IP router interface commands\n" | |
112 | "IS-IS routing protocol\n" | |
1457b1d5 | 113 | "Routing process tag\n") |
aaf2fd21 | 114 | { |
aaf8e809 IR |
115 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE, NULL); |
116 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag", NB_OP_MODIFY, | |
117 | tag); | |
aaf8e809 IR |
118 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv4-routing", |
119 | NB_OP_MODIFY, "true"); | |
aaf2fd21 EDP |
120 | |
121 | return nb_cli_apply_changes(vty, NULL); | |
122 | } | |
123 | ||
1457b1d5 IR |
124 | ALIAS_HIDDEN(ip_router_isis, ip_router_isis_vrf_cmd, |
125 | "ip router isis WORD$tag vrf NAME$vrf_name", | |
126 | "Interface Internet Protocol config commands\n" | |
127 | "IP router interface commands\n" | |
128 | "IS-IS routing protocol\n" | |
129 | "Routing process tag\n" VRF_CMD_HELP_STR) | |
130 | ||
65251ce8 | 131 | DEFPY_YANG(ip6_router_isis, ip6_router_isis_cmd, |
1457b1d5 | 132 | "ipv6 router isis WORD$tag", |
65251ce8 | 133 | "Interface Internet Protocol config commands\n" |
134 | "IP router interface commands\n" | |
135 | "IS-IS routing protocol\n" | |
1457b1d5 | 136 | "Routing process tag\n") |
aaf2fd21 | 137 | { |
aaf8e809 IR |
138 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE, NULL); |
139 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag", NB_OP_MODIFY, | |
140 | tag); | |
aaf8e809 IR |
141 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv6-routing", |
142 | NB_OP_MODIFY, "true"); | |
aaf2fd21 EDP |
143 | |
144 | return nb_cli_apply_changes(vty, NULL); | |
145 | } | |
146 | ||
1457b1d5 IR |
147 | ALIAS_HIDDEN(ip6_router_isis, ip6_router_isis_vrf_cmd, |
148 | "ipv6 router isis WORD$tag vrf NAME$vrf_name", | |
149 | "Interface Internet Protocol config commands\n" | |
150 | "IP router interface commands\n" | |
151 | "IS-IS routing protocol\n" | |
152 | "Routing process tag\n" VRF_CMD_HELP_STR) | |
153 | ||
ca77b518 | 154 | DEFPY_YANG(no_ip_router_isis, no_ip_router_isis_cmd, |
1457b1d5 | 155 | "no <ip|ipv6>$ip router isis [WORD]$tag", |
65251ce8 | 156 | NO_STR |
157 | "Interface Internet Protocol config commands\n" | |
158 | "IP router interface commands\n" | |
159 | "IP router interface commands\n" | |
160 | "IS-IS routing protocol\n" | |
1457b1d5 | 161 | "Routing process tag\n") |
aaf2fd21 | 162 | { |
472c3dae | 163 | const struct lyd_node *dnode; |
aaf2fd21 | 164 | |
3bb513c3 CH |
165 | dnode = yang_dnode_getf(vty->candidate_config->dnode, |
166 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
472c3dae RW |
167 | if (!dnode) |
168 | return CMD_SUCCESS; | |
169 | ||
170 | /* | |
171 | * If both ipv4 and ipv6 are off delete the interface isis container. | |
aaf2fd21 | 172 | */ |
472c3dae RW |
173 | if (strmatch(ip, "ipv6")) { |
174 | if (!yang_dnode_get_bool(dnode, "./ipv4-routing")) | |
aaf2fd21 | 175 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", |
95ce849b | 176 | NB_OP_DESTROY, NULL); |
aaf2fd21 EDP |
177 | else |
178 | nb_cli_enqueue_change(vty, | |
179 | "./frr-isisd:isis/ipv6-routing", | |
5f1e5e3f | 180 | NB_OP_MODIFY, "false"); |
472c3dae RW |
181 | } else { |
182 | if (!yang_dnode_get_bool(dnode, "./ipv6-routing")) | |
aaf2fd21 | 183 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", |
95ce849b | 184 | NB_OP_DESTROY, NULL); |
aaf2fd21 EDP |
185 | else |
186 | nb_cli_enqueue_change(vty, | |
187 | "./frr-isisd:isis/ipv4-routing", | |
5f1e5e3f | 188 | NB_OP_MODIFY, "false"); |
aaf2fd21 EDP |
189 | } |
190 | ||
191 | return nb_cli_apply_changes(vty, NULL); | |
192 | } | |
193 | ||
1457b1d5 IR |
194 | ALIAS_HIDDEN(no_ip_router_isis, no_ip_router_isis_vrf_cmd, |
195 | "no <ip|ipv6>$ip router isis WORD$tag vrf NAME$vrf_name", | |
196 | NO_STR | |
197 | "Interface Internet Protocol config commands\n" | |
198 | "IP router interface commands\n" | |
199 | "IP router interface commands\n" | |
200 | "IS-IS routing protocol\n" | |
201 | "Routing process tag\n" | |
202 | VRF_CMD_HELP_STR) | |
203 | ||
25605051 | 204 | void cli_show_ip_isis_ipv4(struct vty *vty, const struct lyd_node *dnode, |
aaf2fd21 EDP |
205 | bool show_defaults) |
206 | { | |
5f1e5e3f EDP |
207 | if (!yang_dnode_get_bool(dnode, NULL)) |
208 | vty_out(vty, " no"); | |
1457b1d5 | 209 | vty_out(vty, " ip router isis %s\n", |
aaf2fd21 EDP |
210 | yang_dnode_get_string(dnode, "../area-tag")); |
211 | } | |
212 | ||
25605051 | 213 | void cli_show_ip_isis_ipv6(struct vty *vty, const struct lyd_node *dnode, |
aaf2fd21 EDP |
214 | bool show_defaults) |
215 | { | |
5f1e5e3f EDP |
216 | if (!yang_dnode_get_bool(dnode, NULL)) |
217 | vty_out(vty, " no"); | |
1457b1d5 | 218 | vty_out(vty, " ipv6 router isis %s\n", |
aaf2fd21 EDP |
219 | yang_dnode_get_string(dnode, "../area-tag")); |
220 | } | |
221 | ||
c3e6ac0b RZ |
222 | /* |
223 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring | |
224 | */ | |
ca77b518 | 225 | DEFPY_YANG(isis_bfd, |
c3e6ac0b RZ |
226 | isis_bfd_cmd, |
227 | "[no] isis bfd", | |
4affdba7 | 228 | NO_STR PROTO_HELP |
c3e6ac0b RZ |
229 | "Enable BFD support\n") |
230 | { | |
231 | const struct lyd_node *dnode; | |
232 | ||
3bb513c3 CH |
233 | dnode = yang_dnode_getf(vty->candidate_config->dnode, |
234 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
8222b997 RZ |
235 | if (dnode == NULL) { |
236 | vty_out(vty, "ISIS is not enabled on this circuit\n"); | |
c3e6ac0b | 237 | return CMD_SUCCESS; |
8222b997 | 238 | } |
c3e6ac0b | 239 | |
4affdba7 | 240 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/bfd-monitoring/enabled", |
c3e6ac0b RZ |
241 | NB_OP_MODIFY, no ? "false" : "true"); |
242 | ||
243 | return nb_cli_apply_changes(vty, NULL); | |
244 | } | |
245 | ||
4affdba7 G |
246 | /* |
247 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/profile | |
248 | */ | |
ca77b518 | 249 | DEFPY_YANG(isis_bfd_profile, |
4affdba7 | 250 | isis_bfd_profile_cmd, |
c022a581 | 251 | "[no] isis bfd profile BFDPROF$profile", |
4affdba7 G |
252 | NO_STR PROTO_HELP |
253 | "Enable BFD support\n" | |
254 | "Use a pre-configured profile\n" | |
255 | "Profile name\n") | |
256 | { | |
257 | const struct lyd_node *dnode; | |
258 | ||
3bb513c3 CH |
259 | dnode = yang_dnode_getf(vty->candidate_config->dnode, |
260 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
4affdba7 G |
261 | if (dnode == NULL) { |
262 | vty_out(vty, "ISIS is not enabled on this circuit\n"); | |
263 | return CMD_SUCCESS; | |
264 | } | |
265 | ||
bb28b985 IR |
266 | if (no) |
267 | nb_cli_enqueue_change(vty, | |
268 | "./frr-isisd:isis/bfd-monitoring/profile", | |
269 | NB_OP_DESTROY, NULL); | |
270 | else | |
271 | nb_cli_enqueue_change(vty, | |
272 | "./frr-isisd:isis/bfd-monitoring/profile", | |
273 | NB_OP_MODIFY, profile); | |
4affdba7 G |
274 | |
275 | return nb_cli_apply_changes(vty, NULL); | |
276 | } | |
277 | ||
25605051 IR |
278 | void cli_show_ip_isis_bfd_monitoring(struct vty *vty, |
279 | const struct lyd_node *dnode, | |
c3e6ac0b RZ |
280 | bool show_defaults) |
281 | { | |
081f9b29 IR |
282 | if (!yang_dnode_get_bool(dnode, "./enabled")) { |
283 | if (show_defaults) | |
284 | vty_out(vty, " no isis bfd\n"); | |
285 | } else { | |
286 | vty_out(vty, " isis bfd\n"); | |
287 | } | |
4affdba7 | 288 | |
bb28b985 IR |
289 | if (yang_dnode_exists(dnode, "./profile")) |
290 | vty_out(vty, " isis bfd profile %s\n", | |
291 | yang_dnode_get_string(dnode, "./profile")); | |
c3e6ac0b RZ |
292 | } |
293 | ||
f084ea55 EDP |
294 | /* |
295 | * XPath: /frr-isisd:isis/instance/area-address | |
296 | */ | |
ca77b518 | 297 | DEFPY_YANG(net, net_cmd, "[no] net WORD", |
f084ea55 EDP |
298 | "Remove an existing Network Entity Title for this process\n" |
299 | "A Network Entity Title for this process (OSI only)\n" | |
300 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") | |
301 | { | |
302 | nb_cli_enqueue_change(vty, "./area-address", | |
95ce849b | 303 | no ? NB_OP_DESTROY : NB_OP_CREATE, net); |
f084ea55 EDP |
304 | |
305 | return nb_cli_apply_changes(vty, NULL); | |
306 | } | |
307 | ||
25605051 | 308 | void cli_show_isis_area_address(struct vty *vty, const struct lyd_node *dnode, |
f084ea55 EDP |
309 | bool show_defaults) |
310 | { | |
311 | vty_out(vty, " net %s\n", yang_dnode_get_string(dnode, NULL)); | |
312 | } | |
313 | ||
e6bdae69 EDP |
314 | /* |
315 | * XPath: /frr-isisd:isis/instance/is-type | |
316 | */ | |
ca77b518 | 317 | DEFPY_YANG(is_type, is_type_cmd, "is-type <level-1|level-1-2|level-2-only>$level", |
e6bdae69 EDP |
318 | "IS Level for this routing process (OSI only)\n" |
319 | "Act as a station router only\n" | |
320 | "Act as both a station router and an area router\n" | |
321 | "Act as an area router only\n") | |
322 | { | |
323 | nb_cli_enqueue_change(vty, "./is-type", NB_OP_MODIFY, | |
324 | strmatch(level, "level-2-only") ? "level-2" | |
325 | : level); | |
326 | ||
327 | return nb_cli_apply_changes(vty, NULL); | |
328 | } | |
329 | ||
ca77b518 | 330 | DEFPY_YANG(no_is_type, no_is_type_cmd, |
e6bdae69 EDP |
331 | "no is-type [<level-1|level-1-2|level-2-only>]", |
332 | NO_STR | |
333 | "IS Level for this routing process (OSI only)\n" | |
334 | "Act as a station router only\n" | |
335 | "Act as both a station router and an area router\n" | |
336 | "Act as an area router only\n") | |
337 | { | |
fd506bbb | 338 | nb_cli_enqueue_change(vty, "./is-type", NB_OP_MODIFY, NULL); |
e6bdae69 EDP |
339 | |
340 | return nb_cli_apply_changes(vty, NULL); | |
341 | } | |
342 | ||
25605051 | 343 | void cli_show_isis_is_type(struct vty *vty, const struct lyd_node *dnode, |
e6bdae69 EDP |
344 | bool show_defaults) |
345 | { | |
346 | int is_type = yang_dnode_get_enum(dnode, NULL); | |
347 | ||
348 | switch (is_type) { | |
349 | case IS_LEVEL_1: | |
350 | vty_out(vty, " is-type level-1\n"); | |
351 | break; | |
352 | case IS_LEVEL_2: | |
353 | vty_out(vty, " is-type level-2-only\n"); | |
354 | break; | |
355 | case IS_LEVEL_1_AND_2: | |
356 | vty_out(vty, " is-type level-1-2\n"); | |
357 | break; | |
358 | } | |
359 | } | |
360 | ||
6bb043cd EDP |
361 | /* |
362 | * XPath: /frr-isisd:isis/instance/dynamic-hostname | |
363 | */ | |
ca77b518 | 364 | DEFPY_YANG(dynamic_hostname, dynamic_hostname_cmd, "[no] hostname dynamic", |
6bb043cd EDP |
365 | NO_STR |
366 | "Dynamic hostname for IS-IS\n" | |
367 | "Dynamic hostname\n") | |
368 | { | |
369 | nb_cli_enqueue_change(vty, "./dynamic-hostname", NB_OP_MODIFY, | |
370 | no ? "false" : "true"); | |
371 | ||
372 | return nb_cli_apply_changes(vty, NULL); | |
373 | } | |
374 | ||
25605051 IR |
375 | void cli_show_isis_dynamic_hostname(struct vty *vty, |
376 | const struct lyd_node *dnode, | |
6bb043cd EDP |
377 | bool show_defaults) |
378 | { | |
379 | if (!yang_dnode_get_bool(dnode, NULL)) | |
380 | vty_out(vty, " no"); | |
381 | ||
382 | vty_out(vty, " hostname dynamic\n"); | |
383 | } | |
384 | ||
05a3f9f0 EDP |
385 | /* |
386 | * XPath: /frr-isisd:isis/instance/overload | |
387 | */ | |
ca77b518 | 388 | DEFPY_YANG(set_overload_bit, set_overload_bit_cmd, "[no] set-overload-bit", |
05a3f9f0 EDP |
389 | "Reset overload bit to accept transit traffic\n" |
390 | "Set overload bit to avoid any transit traffic\n") | |
391 | { | |
01ea9b03 | 392 | nb_cli_enqueue_change(vty, "./overload/enabled", NB_OP_MODIFY, |
5f1e5e3f | 393 | no ? "false" : "true"); |
05a3f9f0 EDP |
394 | |
395 | return nb_cli_apply_changes(vty, NULL); | |
396 | } | |
397 | ||
25605051 | 398 | void cli_show_isis_overload(struct vty *vty, const struct lyd_node *dnode, |
05a3f9f0 EDP |
399 | bool show_defaults) |
400 | { | |
5f1e5e3f EDP |
401 | if (!yang_dnode_get_bool(dnode, NULL)) |
402 | vty_out(vty, " no"); | |
05a3f9f0 EDP |
403 | vty_out(vty, " set-overload-bit\n"); |
404 | } | |
405 | ||
01ea9b03 IL |
406 | /* |
407 | * XPath: /frr-isisd:isis/instance/overload/on-startup | |
408 | */ | |
409 | DEFPY_YANG(set_overload_bit_on_startup, set_overload_bit_on_startup_cmd, | |
410 | "set-overload-bit on-startup (0-86400)$val", | |
411 | "Set overload bit to avoid any transit traffic\n" | |
412 | "Set overload bit on startup\n" | |
413 | "Set overload time in seconds\n") | |
414 | { | |
415 | nb_cli_enqueue_change(vty, "./overload/on-startup", NB_OP_MODIFY, | |
416 | val_str); | |
417 | ||
418 | return nb_cli_apply_changes(vty, NULL); | |
419 | } | |
420 | ||
421 | DEFPY_YANG(no_set_overload_bit_on_startup, no_set_overload_bit_on_startup_cmd, | |
422 | "no set-overload-bit on-startup [(0-86400)$val]", | |
423 | NO_STR | |
424 | "Reset overload bit to accept transit traffic\n" | |
425 | "Set overload bit on startup\n" | |
426 | "Set overload time in seconds\n") | |
427 | { | |
428 | nb_cli_enqueue_change(vty, "./overload/on-startup", NB_OP_DESTROY, | |
429 | NULL); | |
430 | ||
431 | return nb_cli_apply_changes(vty, NULL); | |
432 | } | |
433 | ||
434 | void cli_show_isis_overload_on_startup(struct vty *vty, | |
435 | const struct lyd_node *dnode, | |
436 | bool show_defaults) | |
437 | { | |
438 | vty_out(vty, " set-overload-bit on-startup %s\n", | |
439 | yang_dnode_get_string(dnode, NULL)); | |
440 | } | |
441 | ||
d74f913c IL |
442 | /* |
443 | * XPath: /frr-isisd:isis/instance/advertise-high-metrics | |
444 | */ | |
445 | DEFPY_YANG(advertise_high_metrics, advertise_high_metrics_cmd, | |
446 | "[no] advertise-high-metrics", | |
447 | NO_STR "Advertise high metric value on all interfaces\n") | |
448 | { | |
449 | nb_cli_enqueue_change(vty, "./advertise-high-metrics", NB_OP_MODIFY, | |
450 | no ? "false" : "true"); | |
451 | ||
452 | return nb_cli_apply_changes(vty, NULL); | |
453 | } | |
454 | ||
455 | void cli_show_advertise_high_metrics(struct vty *vty, | |
456 | const struct lyd_node *dnode, | |
457 | bool show_defaults) | |
458 | { | |
459 | if (yang_dnode_get_bool(dnode, NULL)) | |
460 | vty_out(vty, " advertise-high-metrics\n"); | |
461 | else if (show_defaults) | |
462 | vty_out(vty, " no advertise-high-metrics\n"); | |
463 | } | |
464 | ||
f3abc412 | 465 | /* |
466 | * XPath: /frr-isisd:isis/instance/attach-send | |
467 | */ | |
468 | DEFPY_YANG(attached_bit_send, attached_bit_send_cmd, "[no] attached-bit send", | |
469 | "Reset attached bit\n" | |
470 | "Set attached bit for inter-area traffic\n" | |
471 | "Set attached bit in LSP sent to L1 router\n") | |
472 | { | |
473 | nb_cli_enqueue_change(vty, "./attach-send", NB_OP_MODIFY, | |
5f1e5e3f | 474 | no ? "false" : "true"); |
05a3f9f0 EDP |
475 | |
476 | return nb_cli_apply_changes(vty, NULL); | |
477 | } | |
478 | ||
25605051 | 479 | void cli_show_isis_attached_send(struct vty *vty, const struct lyd_node *dnode, |
f3abc412 | 480 | bool show_defaults) |
481 | { | |
482 | if (!yang_dnode_get_bool(dnode, NULL)) | |
483 | vty_out(vty, " no"); | |
484 | vty_out(vty, " attached-bit send\n"); | |
485 | } | |
486 | ||
487 | /* | |
488 | * XPath: /frr-isisd:isis/instance/attach-receive-ignore | |
489 | */ | |
490 | DEFPY_YANG( | |
491 | attached_bit_receive_ignore, attached_bit_receive_ignore_cmd, | |
492 | "[no] attached-bit receive ignore", | |
493 | "Reset attached bit\n" | |
494 | "Set attach bit for inter-area traffic\n" | |
495 | "If LSP received with attached bit set, create default route to neighbor\n" | |
496 | "Do not process attached bit\n") | |
497 | { | |
498 | nb_cli_enqueue_change(vty, "./attach-receive-ignore", NB_OP_MODIFY, | |
499 | no ? "false" : "true"); | |
500 | ||
501 | return nb_cli_apply_changes(vty, NULL); | |
502 | } | |
503 | ||
25605051 IR |
504 | void cli_show_isis_attached_receive(struct vty *vty, |
505 | const struct lyd_node *dnode, | |
f3abc412 | 506 | bool show_defaults) |
05a3f9f0 | 507 | { |
5f1e5e3f EDP |
508 | if (!yang_dnode_get_bool(dnode, NULL)) |
509 | vty_out(vty, " no"); | |
f3abc412 | 510 | vty_out(vty, " attached-bit receive ignore\n"); |
05a3f9f0 EDP |
511 | } |
512 | ||
e0df3206 EDP |
513 | /* |
514 | * XPath: /frr-isisd:isis/instance/metric-style | |
515 | */ | |
ca77b518 | 516 | DEFPY_YANG(metric_style, metric_style_cmd, |
f34ab52d | 517 | "metric-style <narrow|transition|wide>$style", |
e0df3206 EDP |
518 | "Use old-style (ISO 10589) or new-style packet formats\n" |
519 | "Use old style of TLVs with narrow metric\n" | |
520 | "Send and accept both styles of TLVs during transition\n" | |
521 | "Use new style of TLVs to carry wider metric\n") | |
522 | { | |
523 | nb_cli_enqueue_change(vty, "./metric-style", NB_OP_MODIFY, style); | |
524 | ||
525 | return nb_cli_apply_changes(vty, NULL); | |
526 | } | |
527 | ||
ca77b518 | 528 | DEFPY_YANG(no_metric_style, no_metric_style_cmd, |
f34ab52d EDP |
529 | "no metric-style [narrow|transition|wide]", |
530 | NO_STR | |
531 | "Use old-style (ISO 10589) or new-style packet formats\n" | |
e0df3206 EDP |
532 | "Use old style of TLVs with narrow metric\n" |
533 | "Send and accept both styles of TLVs during transition\n" | |
534 | "Use new style of TLVs to carry wider metric\n") | |
535 | { | |
fd506bbb | 536 | nb_cli_enqueue_change(vty, "./metric-style", NB_OP_MODIFY, NULL); |
e0df3206 EDP |
537 | |
538 | return nb_cli_apply_changes(vty, NULL); | |
539 | } | |
540 | ||
25605051 | 541 | void cli_show_isis_metric_style(struct vty *vty, const struct lyd_node *dnode, |
e0df3206 EDP |
542 | bool show_defaults) |
543 | { | |
544 | int metric = yang_dnode_get_enum(dnode, NULL); | |
545 | ||
546 | switch (metric) { | |
547 | case ISIS_NARROW_METRIC: | |
548 | vty_out(vty, " metric-style narrow\n"); | |
549 | break; | |
550 | case ISIS_WIDE_METRIC: | |
551 | vty_out(vty, " metric-style wide\n"); | |
552 | break; | |
553 | case ISIS_TRANSITION_METRIC: | |
554 | vty_out(vty, " metric-style transition\n"); | |
555 | break; | |
556 | } | |
557 | } | |
558 | ||
933536e3 EDP |
559 | /* |
560 | * XPath: /frr-isisd:isis/instance/area-password | |
561 | */ | |
ca77b518 | 562 | DEFPY_YANG(area_passwd, area_passwd_cmd, |
933536e3 EDP |
563 | "area-password <clear|md5>$pwd_type WORD$pwd [authenticate snp <send-only|validate>$snp]", |
564 | "Configure the authentication password for an area\n" | |
565 | "Clear-text authentication type\n" | |
566 | "MD5 authentication type\n" | |
567 | "Level-wide password\n" | |
568 | "Authentication\n" | |
569 | "SNP PDUs\n" | |
570 | "Send but do not check PDUs on receiving\n" | |
571 | "Send and check PDUs on receiving\n") | |
572 | { | |
573 | nb_cli_enqueue_change(vty, "./area-password", NB_OP_CREATE, NULL); | |
574 | nb_cli_enqueue_change(vty, "./area-password/password", NB_OP_MODIFY, | |
575 | pwd); | |
576 | nb_cli_enqueue_change(vty, "./area-password/password-type", | |
577 | NB_OP_MODIFY, pwd_type); | |
578 | nb_cli_enqueue_change(vty, "./area-password/authenticate-snp", | |
579 | NB_OP_MODIFY, snp ? snp : "none"); | |
580 | ||
581 | return nb_cli_apply_changes(vty, NULL); | |
582 | } | |
583 | ||
25605051 | 584 | void cli_show_isis_area_pwd(struct vty *vty, const struct lyd_node *dnode, |
933536e3 EDP |
585 | bool show_defaults) |
586 | { | |
587 | const char *snp; | |
588 | ||
589 | vty_out(vty, " area-password %s %s", | |
590 | yang_dnode_get_string(dnode, "./password-type"), | |
591 | yang_dnode_get_string(dnode, "./password")); | |
592 | snp = yang_dnode_get_string(dnode, "./authenticate-snp"); | |
593 | if (!strmatch("none", snp)) | |
594 | vty_out(vty, " authenticate snp %s", snp); | |
595 | vty_out(vty, "\n"); | |
596 | } | |
597 | ||
598 | /* | |
599 | * XPath: /frr-isisd:isis/instance/domain-password | |
600 | */ | |
ca77b518 | 601 | DEFPY_YANG(domain_passwd, domain_passwd_cmd, |
933536e3 EDP |
602 | "domain-password <clear|md5>$pwd_type WORD$pwd [authenticate snp <send-only|validate>$snp]", |
603 | "Set the authentication password for a routing domain\n" | |
604 | "Clear-text authentication type\n" | |
605 | "MD5 authentication type\n" | |
606 | "Level-wide password\n" | |
607 | "Authentication\n" | |
608 | "SNP PDUs\n" | |
609 | "Send but do not check PDUs on receiving\n" | |
610 | "Send and check PDUs on receiving\n") | |
611 | { | |
612 | nb_cli_enqueue_change(vty, "./domain-password", NB_OP_CREATE, NULL); | |
613 | nb_cli_enqueue_change(vty, "./domain-password/password", NB_OP_MODIFY, | |
614 | pwd); | |
615 | nb_cli_enqueue_change(vty, "./domain-password/password-type", | |
616 | NB_OP_MODIFY, pwd_type); | |
617 | nb_cli_enqueue_change(vty, "./domain-password/authenticate-snp", | |
618 | NB_OP_MODIFY, snp ? snp : "none"); | |
619 | ||
620 | return nb_cli_apply_changes(vty, NULL); | |
621 | } | |
622 | ||
ca77b518 | 623 | DEFPY_YANG(no_area_passwd, no_area_passwd_cmd, |
933536e3 EDP |
624 | "no <area-password|domain-password>$cmd", |
625 | NO_STR | |
626 | "Configure the authentication password for an area\n" | |
627 | "Set the authentication password for a routing domain\n") | |
628 | { | |
95ce849b | 629 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
933536e3 EDP |
630 | |
631 | return nb_cli_apply_changes(vty, "./%s", cmd); | |
632 | } | |
633 | ||
25605051 | 634 | void cli_show_isis_domain_pwd(struct vty *vty, const struct lyd_node *dnode, |
933536e3 EDP |
635 | bool show_defaults) |
636 | { | |
637 | const char *snp; | |
638 | ||
639 | vty_out(vty, " domain-password %s %s", | |
640 | yang_dnode_get_string(dnode, "./password-type"), | |
641 | yang_dnode_get_string(dnode, "./password")); | |
642 | snp = yang_dnode_get_string(dnode, "./authenticate-snp"); | |
643 | if (!strmatch("none", snp)) | |
644 | vty_out(vty, " authenticate snp %s", snp); | |
645 | vty_out(vty, "\n"); | |
646 | } | |
647 | ||
1d6fe72e | 648 | /* |
d2c970ff EDP |
649 | * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/generation-interval |
650 | * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/generation-interval | |
1d6fe72e | 651 | */ |
ca77b518 | 652 | DEFPY_YANG(lsp_gen_interval, lsp_gen_interval_cmd, |
1d6fe72e EDP |
653 | "lsp-gen-interval [level-1|level-2]$level (1-120)$val", |
654 | "Minimum interval between regenerating same LSP\n" | |
655 | "Set interval for level 1 only\n" | |
656 | "Set interval for level 2 only\n" | |
657 | "Minimum interval in seconds\n") | |
658 | { | |
659 | if (!level || strmatch(level, "level-1")) | |
d2c970ff EDP |
660 | nb_cli_enqueue_change( |
661 | vty, "./lsp/timers/level-1/generation-interval", | |
662 | NB_OP_MODIFY, val_str); | |
1d6fe72e | 663 | if (!level || strmatch(level, "level-2")) |
d2c970ff EDP |
664 | nb_cli_enqueue_change( |
665 | vty, "./lsp/timers/level-2/generation-interval", | |
666 | NB_OP_MODIFY, val_str); | |
1d6fe72e EDP |
667 | |
668 | return nb_cli_apply_changes(vty, NULL); | |
669 | } | |
670 | ||
ca77b518 | 671 | DEFPY_YANG(no_lsp_gen_interval, no_lsp_gen_interval_cmd, |
1d6fe72e EDP |
672 | "no lsp-gen-interval [level-1|level-2]$level [(1-120)]", |
673 | NO_STR | |
674 | "Minimum interval between regenerating same LSP\n" | |
675 | "Set interval for level 1 only\n" | |
676 | "Set interval for level 2 only\n" | |
677 | "Minimum interval in seconds\n") | |
678 | { | |
679 | if (!level || strmatch(level, "level-1")) | |
d2c970ff EDP |
680 | nb_cli_enqueue_change( |
681 | vty, "./lsp/timers/level-1/generation-interval", | |
682 | NB_OP_MODIFY, NULL); | |
1d6fe72e | 683 | if (!level || strmatch(level, "level-2")) |
d2c970ff EDP |
684 | nb_cli_enqueue_change( |
685 | vty, "./lsp/timers/level-2/generation-interval", | |
686 | NB_OP_MODIFY, NULL); | |
1d6fe72e EDP |
687 | |
688 | return nb_cli_apply_changes(vty, NULL); | |
689 | } | |
690 | ||
7e869004 | 691 | /* |
d2c970ff EDP |
692 | * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval |
693 | * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval | |
7e869004 | 694 | */ |
ca77b518 | 695 | DEFPY_YANG(lsp_refresh_interval, lsp_refresh_interval_cmd, |
7e869004 EDP |
696 | "lsp-refresh-interval [level-1|level-2]$level (1-65235)$val", |
697 | "LSP refresh interval\n" | |
698 | "LSP refresh interval for Level 1 only\n" | |
699 | "LSP refresh interval for Level 2 only\n" | |
700 | "LSP refresh interval in seconds\n") | |
701 | { | |
702 | if (!level || strmatch(level, "level-1")) | |
d2c970ff EDP |
703 | nb_cli_enqueue_change(vty, |
704 | "./lsp/timers/level-1/refresh-interval", | |
7e869004 EDP |
705 | NB_OP_MODIFY, val_str); |
706 | if (!level || strmatch(level, "level-2")) | |
d2c970ff EDP |
707 | nb_cli_enqueue_change(vty, |
708 | "./lsp/timers/level-2/refresh-interval", | |
7e869004 EDP |
709 | NB_OP_MODIFY, val_str); |
710 | ||
711 | return nb_cli_apply_changes(vty, NULL); | |
712 | } | |
713 | ||
ca77b518 | 714 | DEFPY_YANG(no_lsp_refresh_interval, no_lsp_refresh_interval_cmd, |
7e869004 EDP |
715 | "no lsp-refresh-interval [level-1|level-2]$level [(1-65235)]", |
716 | NO_STR | |
717 | "LSP refresh interval\n" | |
718 | "LSP refresh interval for Level 1 only\n" | |
719 | "LSP refresh interval for Level 2 only\n" | |
720 | "LSP refresh interval in seconds\n") | |
721 | { | |
722 | if (!level || strmatch(level, "level-1")) | |
d2c970ff EDP |
723 | nb_cli_enqueue_change(vty, |
724 | "./lsp/timers/level-1/refresh-interval", | |
7e869004 EDP |
725 | NB_OP_MODIFY, NULL); |
726 | if (!level || strmatch(level, "level-2")) | |
d2c970ff EDP |
727 | nb_cli_enqueue_change(vty, |
728 | "./lsp/timers/level-2/refresh-interval", | |
7e869004 EDP |
729 | NB_OP_MODIFY, NULL); |
730 | ||
731 | return nb_cli_apply_changes(vty, NULL); | |
732 | } | |
733 | ||
ea120aa0 | 734 | /* |
d2c970ff EDP |
735 | * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime |
736 | * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime | |
ea120aa0 | 737 | */ |
d2c970ff | 738 | |
ca77b518 | 739 | DEFPY_YANG(max_lsp_lifetime, max_lsp_lifetime_cmd, |
ea120aa0 EDP |
740 | "max-lsp-lifetime [level-1|level-2]$level (350-65535)$val", |
741 | "Maximum LSP lifetime\n" | |
742 | "Maximum LSP lifetime for Level 1 only\n" | |
743 | "Maximum LSP lifetime for Level 2 only\n" | |
744 | "LSP lifetime in seconds\n") | |
745 | { | |
746 | if (!level || strmatch(level, "level-1")) | |
d2c970ff EDP |
747 | nb_cli_enqueue_change(vty, |
748 | "./lsp/timers/level-1/maximum-lifetime", | |
ea120aa0 EDP |
749 | NB_OP_MODIFY, val_str); |
750 | if (!level || strmatch(level, "level-2")) | |
d2c970ff EDP |
751 | nb_cli_enqueue_change(vty, |
752 | "./lsp/timers/level-2/maximum-lifetime", | |
ea120aa0 EDP |
753 | NB_OP_MODIFY, val_str); |
754 | ||
755 | return nb_cli_apply_changes(vty, NULL); | |
756 | } | |
757 | ||
ca77b518 | 758 | DEFPY_YANG(no_max_lsp_lifetime, no_max_lsp_lifetime_cmd, |
ea120aa0 EDP |
759 | "no max-lsp-lifetime [level-1|level-2]$level [(350-65535)]", |
760 | NO_STR | |
761 | "Maximum LSP lifetime\n" | |
762 | "Maximum LSP lifetime for Level 1 only\n" | |
763 | "Maximum LSP lifetime for Level 2 only\n" | |
764 | "LSP lifetime in seconds\n") | |
765 | { | |
766 | if (!level || strmatch(level, "level-1")) | |
d2c970ff EDP |
767 | nb_cli_enqueue_change(vty, |
768 | "./lsp/timers/level-1/maximum-lifetime", | |
ea120aa0 EDP |
769 | NB_OP_MODIFY, NULL); |
770 | if (!level || strmatch(level, "level-2")) | |
d2c970ff EDP |
771 | nb_cli_enqueue_change(vty, |
772 | "./lsp/timers/level-2/maximum-lifetime", | |
ea120aa0 EDP |
773 | NB_OP_MODIFY, NULL); |
774 | ||
775 | return nb_cli_apply_changes(vty, NULL); | |
776 | } | |
777 | ||
d2c970ff EDP |
778 | /* unified LSP timers command |
779 | * XPath: /frr-isisd:isis/instance/lsp/timers | |
780 | */ | |
781 | ||
ca77b518 | 782 | DEFPY_YANG(lsp_timers, lsp_timers_cmd, |
d2c970ff EDP |
783 | "lsp-timers [level-1|level-2]$level gen-interval (1-120)$gen refresh-interval (1-65235)$refresh max-lifetime (350-65535)$lifetime", |
784 | "LSP-related timers\n" | |
785 | "LSP-related timers for Level 1 only\n" | |
786 | "LSP-related timers for Level 2 only\n" | |
787 | "Minimum interval between regenerating same LSP\n" | |
788 | "Generation interval in seconds\n" | |
789 | "LSP refresh interval\n" | |
790 | "LSP refresh interval in seconds\n" | |
791 | "Maximum LSP lifetime\n" | |
792 | "Maximum LSP lifetime in seconds\n") | |
ea120aa0 | 793 | { |
d2c970ff EDP |
794 | if (!level || strmatch(level, "level-1")) { |
795 | nb_cli_enqueue_change( | |
796 | vty, "./lsp/timers/level-1/generation-interval", | |
797 | NB_OP_MODIFY, gen_str); | |
798 | nb_cli_enqueue_change(vty, | |
799 | "./lsp/timers/level-1/refresh-interval", | |
800 | NB_OP_MODIFY, refresh_str); | |
801 | nb_cli_enqueue_change(vty, | |
802 | "./lsp/timers/level-1/maximum-lifetime", | |
803 | NB_OP_MODIFY, lifetime_str); | |
804 | } | |
805 | if (!level || strmatch(level, "level-2")) { | |
806 | nb_cli_enqueue_change( | |
807 | vty, "./lsp/timers/level-2/generation-interval", | |
808 | NB_OP_MODIFY, gen_str); | |
809 | nb_cli_enqueue_change(vty, | |
810 | "./lsp/timers/level-2/refresh-interval", | |
811 | NB_OP_MODIFY, refresh_str); | |
812 | nb_cli_enqueue_change(vty, | |
813 | "./lsp/timers/level-2/maximum-lifetime", | |
814 | NB_OP_MODIFY, lifetime_str); | |
815 | } | |
ea120aa0 | 816 | |
d2c970ff EDP |
817 | return nb_cli_apply_changes(vty, NULL); |
818 | } | |
819 | ||
ca77b518 | 820 | DEFPY_YANG(no_lsp_timers, no_lsp_timers_cmd, |
d2c970ff EDP |
821 | "no lsp-timers [level-1|level-2]$level [gen-interval (1-120) refresh-interval (1-65235) max-lifetime (350-65535)]", |
822 | NO_STR | |
823 | "LSP-related timers\n" | |
824 | "LSP-related timers for Level 1 only\n" | |
825 | "LSP-related timers for Level 2 only\n" | |
826 | "Minimum interval between regenerating same LSP\n" | |
827 | "Generation interval in seconds\n" | |
828 | "LSP refresh interval\n" | |
829 | "LSP refresh interval in seconds\n" | |
830 | "Maximum LSP lifetime\n" | |
831 | "Maximum LSP lifetime in seconds\n") | |
832 | { | |
833 | if (!level || strmatch(level, "level-1")) { | |
834 | nb_cli_enqueue_change( | |
835 | vty, "./lsp/timers/level-1/generation-interval", | |
836 | NB_OP_MODIFY, NULL); | |
837 | nb_cli_enqueue_change(vty, | |
838 | "./lsp/timers/level-1/refresh-interval", | |
839 | NB_OP_MODIFY, NULL); | |
840 | nb_cli_enqueue_change(vty, | |
841 | "./lsp/timers/level-1/maximum-lifetime", | |
842 | NB_OP_MODIFY, NULL); | |
843 | } | |
844 | if (!level || strmatch(level, "level-2")) { | |
845 | nb_cli_enqueue_change( | |
846 | vty, "./lsp/timers/level-2/generation-interval", | |
847 | NB_OP_MODIFY, NULL); | |
848 | nb_cli_enqueue_change(vty, | |
849 | "./lsp/timers/level-2/refresh-interval", | |
850 | NB_OP_MODIFY, NULL); | |
851 | nb_cli_enqueue_change(vty, | |
852 | "./lsp/timers/level-2/maximum-lifetime", | |
853 | NB_OP_MODIFY, NULL); | |
854 | } | |
855 | ||
856 | return nb_cli_apply_changes(vty, NULL); | |
857 | } | |
858 | ||
25605051 | 859 | void cli_show_isis_lsp_timers(struct vty *vty, const struct lyd_node *dnode, |
d2c970ff EDP |
860 | bool show_defaults) |
861 | { | |
862 | const char *l1_refresh = | |
863 | yang_dnode_get_string(dnode, "./level-1/refresh-interval"); | |
864 | const char *l2_refresh = | |
865 | yang_dnode_get_string(dnode, "./level-2/refresh-interval"); | |
866 | const char *l1_lifetime = | |
867 | yang_dnode_get_string(dnode, "./level-1/maximum-lifetime"); | |
868 | const char *l2_lifetime = | |
869 | yang_dnode_get_string(dnode, "./level-2/maximum-lifetime"); | |
870 | const char *l1_gen = | |
871 | yang_dnode_get_string(dnode, "./level-1/generation-interval"); | |
872 | const char *l2_gen = | |
873 | yang_dnode_get_string(dnode, "./level-2/generation-interval"); | |
874 | if (strmatch(l1_refresh, l2_refresh) | |
875 | && strmatch(l1_lifetime, l2_lifetime) && strmatch(l1_gen, l2_gen)) | |
876 | vty_out(vty, | |
877 | " lsp-timers gen-interval %s refresh-interval %s max-lifetime %s\n", | |
878 | l1_gen, l1_refresh, l1_lifetime); | |
ea120aa0 | 879 | else { |
d2c970ff EDP |
880 | vty_out(vty, |
881 | " lsp-timers level-1 gen-interval %s refresh-interval %s max-lifetime %s\n", | |
882 | l1_gen, l1_refresh, l1_lifetime); | |
883 | vty_out(vty, | |
884 | " lsp-timers level-2 gen-interval %s refresh-interval %s max-lifetime %s\n", | |
885 | l2_gen, l2_refresh, l2_lifetime); | |
ea120aa0 EDP |
886 | } |
887 | } | |
888 | ||
27a45d16 EDP |
889 | /* |
890 | * XPath: /frr-isisd:isis/instance/lsp/mtu | |
891 | */ | |
ca77b518 | 892 | DEFPY_YANG(area_lsp_mtu, area_lsp_mtu_cmd, "lsp-mtu (128-4352)$val", |
27a45d16 EDP |
893 | "Configure the maximum size of generated LSPs\n" |
894 | "Maximum size of generated LSPs\n") | |
895 | { | |
896 | nb_cli_enqueue_change(vty, "./lsp/mtu", NB_OP_MODIFY, val_str); | |
897 | ||
898 | return nb_cli_apply_changes(vty, NULL); | |
899 | } | |
900 | ||
ca77b518 | 901 | DEFPY_YANG(no_area_lsp_mtu, no_area_lsp_mtu_cmd, "no lsp-mtu [(128-4352)]", |
27a45d16 EDP |
902 | NO_STR |
903 | "Configure the maximum size of generated LSPs\n" | |
904 | "Maximum size of generated LSPs\n") | |
905 | { | |
906 | nb_cli_enqueue_change(vty, "./lsp/mtu", NB_OP_MODIFY, NULL); | |
907 | ||
908 | return nb_cli_apply_changes(vty, NULL); | |
909 | } | |
910 | ||
25605051 | 911 | void cli_show_isis_lsp_mtu(struct vty *vty, const struct lyd_node *dnode, |
27a45d16 EDP |
912 | bool show_defaults) |
913 | { | |
914 | vty_out(vty, " lsp-mtu %s\n", yang_dnode_get_string(dnode, NULL)); | |
915 | } | |
916 | ||
3f3608d8 DO |
917 | /* |
918 | * XPath: /frr-isisd:isis/instance/advertise-passive-only | |
919 | */ | |
920 | DEFPY_YANG(advertise_passive_only, advertise_passive_only_cmd, | |
921 | "[no] advertise-passive-only", | |
922 | NO_STR "Advertise prefixes of passive interfaces only\n") | |
923 | { | |
924 | nb_cli_enqueue_change(vty, "./advertise-passive-only", NB_OP_MODIFY, | |
925 | no ? "false" : "true"); | |
926 | ||
927 | return nb_cli_apply_changes(vty, NULL); | |
928 | } | |
929 | ||
930 | void cli_show_advertise_passive_only(struct vty *vty, | |
931 | const struct lyd_node *dnode, | |
932 | bool show_defaults) | |
933 | { | |
934 | if (!yang_dnode_get_bool(dnode, NULL)) | |
935 | vty_out(vty, " no"); | |
936 | ||
937 | vty_out(vty, " advertise-passive-only\n"); | |
938 | } | |
939 | ||
dcb1dcd6 EDP |
940 | /* |
941 | * XPath: /frr-isisd:isis/instance/spf/minimum-interval | |
942 | */ | |
ca77b518 | 943 | DEFPY_YANG(spf_interval, spf_interval_cmd, |
dcb1dcd6 EDP |
944 | "spf-interval [level-1|level-2]$level (1-120)$val", |
945 | "Minimum interval between SPF calculations\n" | |
946 | "Set interval for level 1 only\n" | |
947 | "Set interval for level 2 only\n" | |
948 | "Minimum interval between consecutive SPFs in seconds\n") | |
949 | { | |
950 | if (!level || strmatch(level, "level-1")) | |
951 | nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-1", | |
952 | NB_OP_MODIFY, val_str); | |
953 | if (!level || strmatch(level, "level-2")) | |
954 | nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-2", | |
955 | NB_OP_MODIFY, val_str); | |
956 | ||
957 | return nb_cli_apply_changes(vty, NULL); | |
958 | } | |
959 | ||
ca77b518 | 960 | DEFPY_YANG(no_spf_interval, no_spf_interval_cmd, |
dcb1dcd6 EDP |
961 | "no spf-interval [level-1|level-2]$level [(1-120)]", |
962 | NO_STR | |
963 | "Minimum interval between SPF calculations\n" | |
964 | "Set interval for level 1 only\n" | |
965 | "Set interval for level 2 only\n" | |
966 | "Minimum interval between consecutive SPFs in seconds\n") | |
967 | { | |
968 | if (!level || strmatch(level, "level-1")) | |
969 | nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-1", | |
970 | NB_OP_MODIFY, NULL); | |
971 | if (!level || strmatch(level, "level-2")) | |
972 | nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-2", | |
973 | NB_OP_MODIFY, NULL); | |
974 | ||
975 | return nb_cli_apply_changes(vty, NULL); | |
976 | } | |
977 | ||
25605051 IR |
978 | void cli_show_isis_spf_min_interval(struct vty *vty, |
979 | const struct lyd_node *dnode, | |
dcb1dcd6 EDP |
980 | bool show_defaults) |
981 | { | |
982 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
983 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
984 | ||
985 | if (strmatch(l1, l2)) | |
986 | vty_out(vty, " spf-interval %s\n", l1); | |
987 | else { | |
988 | vty_out(vty, " spf-interval level-1 %s\n", l1); | |
989 | vty_out(vty, " spf-interval level-2 %s\n", l2); | |
990 | } | |
991 | } | |
992 | ||
5336ba30 EDP |
993 | /* |
994 | * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay | |
995 | */ | |
ca77b518 | 996 | DEFPY_YANG(spf_delay_ietf, spf_delay_ietf_cmd, |
5336ba30 EDP |
997 | "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)", |
998 | "IETF SPF delay algorithm\n" | |
999 | "Delay used while in QUIET state\n" | |
1000 | "Delay used while in QUIET state in milliseconds\n" | |
1001 | "Delay used while in SHORT_WAIT state\n" | |
1002 | "Delay used while in SHORT_WAIT state in milliseconds\n" | |
1003 | "Delay used while in LONG_WAIT\n" | |
1004 | "Delay used while in LONG_WAIT state in milliseconds\n" | |
1005 | "Time with no received IGP events before considering IGP stable\n" | |
1006 | "Time with no received IGP events before considering IGP stable (in milliseconds)\n" | |
1007 | "Maximum duration needed to learn all the events related to a single failure\n" | |
1008 | "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n") | |
1009 | { | |
1010 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay", NB_OP_CREATE, | |
1011 | NULL); | |
1012 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/init-delay", | |
1013 | NB_OP_MODIFY, init_delay_str); | |
1014 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/short-delay", | |
1015 | NB_OP_MODIFY, short_delay_str); | |
1016 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/long-delay", | |
1017 | NB_OP_MODIFY, long_delay_str); | |
1018 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/hold-down", | |
1019 | NB_OP_MODIFY, holddown_str); | |
1020 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/time-to-learn", | |
1021 | NB_OP_MODIFY, time_to_learn_str); | |
1022 | ||
1023 | return nb_cli_apply_changes(vty, NULL); | |
1024 | } | |
1025 | ||
ca77b518 | 1026 | DEFPY_YANG(no_spf_delay_ietf, no_spf_delay_ietf_cmd, |
5336ba30 EDP |
1027 | "no spf-delay-ietf [init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)]", |
1028 | NO_STR | |
f34ab52d | 1029 | "IETF SPF delay algorithm\n" |
5336ba30 EDP |
1030 | "Delay used while in QUIET state\n" |
1031 | "Delay used while in QUIET state in milliseconds\n" | |
1032 | "Delay used while in SHORT_WAIT state\n" | |
1033 | "Delay used while in SHORT_WAIT state in milliseconds\n" | |
1034 | "Delay used while in LONG_WAIT\n" | |
1035 | "Delay used while in LONG_WAIT state in milliseconds\n" | |
1036 | "Time with no received IGP events before considering IGP stable\n" | |
1037 | "Time with no received IGP events before considering IGP stable (in milliseconds)\n" | |
1038 | "Maximum duration needed to learn all the events related to a single failure\n" | |
1039 | "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n") | |
1040 | { | |
95ce849b | 1041 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay", NB_OP_DESTROY, |
5336ba30 EDP |
1042 | NULL); |
1043 | ||
1044 | return nb_cli_apply_changes(vty, NULL); | |
1045 | } | |
1046 | ||
25605051 IR |
1047 | void cli_show_isis_spf_ietf_backoff(struct vty *vty, |
1048 | const struct lyd_node *dnode, | |
5336ba30 EDP |
1049 | bool show_defaults) |
1050 | { | |
1051 | vty_out(vty, | |
1052 | " spf-delay-ietf init-delay %s short-delay %s long-delay %s holddown %s time-to-learn %s\n", | |
1053 | yang_dnode_get_string(dnode, "./init-delay"), | |
1054 | yang_dnode_get_string(dnode, "./short-delay"), | |
1055 | yang_dnode_get_string(dnode, "./long-delay"), | |
1056 | yang_dnode_get_string(dnode, "./hold-down"), | |
1057 | yang_dnode_get_string(dnode, "./time-to-learn")); | |
1058 | } | |
1059 | ||
d20b14bc RW |
1060 | /* |
1061 | * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/medium/access-list-name | |
1062 | */ | |
1063 | DEFPY_YANG(spf_prefix_priority, spf_prefix_priority_cmd, | |
c60dec36 | 1064 | "spf prefix-priority <critical|high|medium>$priority ACCESSLIST_NAME$acl_name", |
d20b14bc RW |
1065 | "SPF configuration\n" |
1066 | "Configure a prefix priority list\n" | |
1067 | "Specify critical priority prefixes\n" | |
1068 | "Specify high priority prefixes\n" | |
1069 | "Specify medium priority prefixes\n" | |
1070 | "Access-list name\n") | |
1071 | { | |
1072 | char xpath[XPATH_MAXLEN]; | |
1073 | ||
1074 | snprintf(xpath, XPATH_MAXLEN, | |
1075 | "./spf/prefix-priorities/%s/access-list-name", priority); | |
1076 | nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, acl_name); | |
1077 | ||
1078 | return nb_cli_apply_changes(vty, NULL); | |
1079 | } | |
1080 | ||
1081 | DEFPY_YANG(no_spf_prefix_priority, no_spf_prefix_priority_cmd, | |
c60dec36 | 1082 | "no spf prefix-priority <critical|high|medium>$priority [ACCESSLIST_NAME]", |
d20b14bc RW |
1083 | NO_STR |
1084 | "SPF configuration\n" | |
1085 | "Configure a prefix priority list\n" | |
1086 | "Specify critical priority prefixes\n" | |
1087 | "Specify high priority prefixes\n" | |
1088 | "Specify medium priority prefixes\n" | |
1089 | "Access-list name\n") | |
1090 | { | |
1091 | char xpath[XPATH_MAXLEN]; | |
1092 | ||
1093 | snprintf(xpath, XPATH_MAXLEN, | |
1094 | "./spf/prefix-priorities/%s/access-list-name", priority); | |
1095 | nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); | |
1096 | ||
1097 | return nb_cli_apply_changes(vty, NULL); | |
1098 | } | |
1099 | ||
25605051 IR |
1100 | void cli_show_isis_spf_prefix_priority(struct vty *vty, |
1101 | const struct lyd_node *dnode, | |
d20b14bc RW |
1102 | bool show_defaults) |
1103 | { | |
1104 | vty_out(vty, " spf prefix-priority %s %s\n", | |
1105 | dnode->parent->schema->name, | |
1106 | yang_dnode_get_string(dnode, NULL)); | |
1107 | } | |
1108 | ||
66e45e10 EDP |
1109 | /* |
1110 | * XPath: /frr-isisd:isis/instance/purge-originator | |
1111 | */ | |
ca77b518 | 1112 | DEFPY_YANG(area_purge_originator, area_purge_originator_cmd, "[no] purge-originator", |
66e45e10 EDP |
1113 | NO_STR "Use the RFC 6232 purge-originator\n") |
1114 | { | |
5f1e5e3f EDP |
1115 | nb_cli_enqueue_change(vty, "./purge-originator", NB_OP_MODIFY, |
1116 | no ? "false" : "true"); | |
66e45e10 EDP |
1117 | |
1118 | return nb_cli_apply_changes(vty, NULL); | |
1119 | } | |
1120 | ||
25605051 | 1121 | void cli_show_isis_purge_origin(struct vty *vty, const struct lyd_node *dnode, |
66e45e10 EDP |
1122 | bool show_defaults) |
1123 | { | |
5f1e5e3f EDP |
1124 | if (!yang_dnode_get_bool(dnode, NULL)) |
1125 | vty_out(vty, " no"); | |
66e45e10 EDP |
1126 | vty_out(vty, " purge-originator\n"); |
1127 | } | |
1128 | ||
d1a80ef6 | 1129 | /* |
2e2a8b91 | 1130 | * XPath: /frr-isisd:isis/instance/mpls-te |
d1a80ef6 | 1131 | */ |
ca77b518 | 1132 | DEFPY_YANG(isis_mpls_te_on, isis_mpls_te_on_cmd, "mpls-te on", |
d1a80ef6 EDP |
1133 | MPLS_TE_STR "Enable the MPLS-TE functionality\n") |
1134 | { | |
2e2a8b91 | 1135 | nb_cli_enqueue_change(vty, "./mpls-te", NB_OP_CREATE, |
d1a80ef6 EDP |
1136 | NULL); |
1137 | ||
1138 | return nb_cli_apply_changes(vty, NULL); | |
1139 | } | |
1140 | ||
ca77b518 | 1141 | DEFPY_YANG(no_isis_mpls_te_on, no_isis_mpls_te_on_cmd, "no mpls-te [on]", |
d1a80ef6 EDP |
1142 | NO_STR |
1143 | "Disable the MPLS-TE functionality\n" | |
2e2a8b91 | 1144 | "Disable the MPLS-TE functionality\n") |
d1a80ef6 | 1145 | { |
2e2a8b91 | 1146 | nb_cli_enqueue_change(vty, "./mpls-te", NB_OP_DESTROY, |
d1a80ef6 EDP |
1147 | NULL); |
1148 | ||
1149 | return nb_cli_apply_changes(vty, NULL); | |
1150 | } | |
1151 | ||
25605051 | 1152 | void cli_show_isis_mpls_te(struct vty *vty, const struct lyd_node *dnode, |
d1a80ef6 EDP |
1153 | bool show_defaults) |
1154 | { | |
dab1fb8d | 1155 | vty_out(vty, " mpls-te on\n"); |
d1a80ef6 EDP |
1156 | } |
1157 | ||
1158 | /* | |
2e2a8b91 | 1159 | * XPath: /frr-isisd:isis/instance/mpls-te/router-address |
d1a80ef6 | 1160 | */ |
ca77b518 | 1161 | DEFPY_YANG(isis_mpls_te_router_addr, isis_mpls_te_router_addr_cmd, |
d1a80ef6 EDP |
1162 | "mpls-te router-address A.B.C.D", |
1163 | MPLS_TE_STR | |
1164 | "Stable IP address of the advertising router\n" | |
1165 | "MPLS-TE router address in IPv4 address format\n") | |
1166 | { | |
2e2a8b91 | 1167 | nb_cli_enqueue_change(vty, "./mpls-te/router-address", |
d1a80ef6 EDP |
1168 | NB_OP_MODIFY, router_address_str); |
1169 | ||
1170 | return nb_cli_apply_changes(vty, NULL); | |
1171 | } | |
1172 | ||
ca77b518 | 1173 | DEFPY_YANG(no_isis_mpls_te_router_addr, no_isis_mpls_te_router_addr_cmd, |
2e2a8b91 OD |
1174 | "no mpls-te router-address [A.B.C.D]", |
1175 | NO_STR MPLS_TE_STR | |
1176 | "Delete IP address of the advertising router\n" | |
1177 | "MPLS-TE router address in IPv4 address format\n") | |
1178 | { | |
1179 | nb_cli_enqueue_change(vty, "./mpls-te/router-address", | |
1180 | NB_OP_DESTROY, NULL); | |
1181 | ||
1182 | return nb_cli_apply_changes(vty, NULL); | |
1183 | } | |
1184 | ||
25605051 IR |
1185 | void cli_show_isis_mpls_te_router_addr(struct vty *vty, |
1186 | const struct lyd_node *dnode, | |
d1a80ef6 EDP |
1187 | bool show_defaults) |
1188 | { | |
dab1fb8d | 1189 | vty_out(vty, " mpls-te router-address %s\n", |
d1a80ef6 EDP |
1190 | yang_dnode_get_string(dnode, NULL)); |
1191 | } | |
1192 | ||
173f8887 OD |
1193 | /* |
1194 | * XPath: /frr-isisd:isis/instance/mpls-te/router-address-v6 | |
1195 | */ | |
1196 | DEFPY_YANG(isis_mpls_te_router_addr_v6, isis_mpls_te_router_addr_v6_cmd, | |
1197 | "mpls-te router-address ipv6 X:X::X:X", | |
1198 | MPLS_TE_STR | |
1199 | "Stable IP address of the advertising router\n" | |
1200 | "IPv6 address\n" | |
1201 | "MPLS-TE router address in IPv6 address format\n") | |
1202 | { | |
1203 | nb_cli_enqueue_change(vty, "./mpls-te/router-address-v6", NB_OP_MODIFY, | |
1204 | ipv6_str); | |
1205 | ||
1206 | return nb_cli_apply_changes(vty, NULL); | |
1207 | } | |
1208 | ||
1209 | DEFPY_YANG(no_isis_mpls_te_router_addr_v6, no_isis_mpls_te_router_addr_v6_cmd, | |
1210 | "no mpls-te router-address ipv6 [X:X::X:X]", | |
1211 | NO_STR MPLS_TE_STR | |
1212 | "Delete IP address of the advertising router\n" | |
1213 | "IPv6 address\n" | |
1214 | "MPLS-TE router address in IPv6 address format\n") | |
1215 | { | |
1216 | nb_cli_enqueue_change(vty, "./mpls-te/router-address-v6", NB_OP_DESTROY, | |
1217 | NULL); | |
1218 | ||
1219 | return nb_cli_apply_changes(vty, NULL); | |
1220 | } | |
1221 | ||
1222 | void cli_show_isis_mpls_te_router_addr_ipv6(struct vty *vty, | |
1223 | const struct lyd_node *dnode, | |
1224 | bool show_defaults) | |
1225 | { | |
1226 | vty_out(vty, " mpls-te router-address ipv6 %s\n", | |
1227 | yang_dnode_get_string(dnode, NULL)); | |
1228 | } | |
1229 | ||
ca77b518 | 1230 | DEFPY_YANG(isis_mpls_te_inter_as, isis_mpls_te_inter_as_cmd, |
d1a80ef6 EDP |
1231 | "[no] mpls-te inter-as [level-1|level-1-2|level-2-only]", |
1232 | NO_STR MPLS_TE_STR | |
1233 | "Configure MPLS-TE Inter-AS support\n" | |
1234 | "AREA native mode self originate INTER-AS LSP with L1 only flooding scope\n" | |
1235 | "AREA native mode self originate INTER-AS LSP with L1 and L2 flooding scope\n" | |
1236 | "AS native mode self originate INTER-AS LSP with L2 only flooding scope\n") | |
1237 | { | |
2e2a8b91 | 1238 | vty_out(vty, "MPLS-TE Inter-AS is not yet supported\n"); |
d1a80ef6 EDP |
1239 | return CMD_SUCCESS; |
1240 | } | |
1241 | ||
ed6189a9 OD |
1242 | /* |
1243 | * XPath: /frr-isisd:isis/instance/mpls-te/export | |
1244 | */ | |
1245 | DEFPY_YANG(isis_mpls_te_export, isis_mpls_te_export_cmd, "mpls-te export", | |
1246 | MPLS_TE_STR "Enable export of MPLS-TE Link State information\n") | |
1247 | { | |
1248 | nb_cli_enqueue_change(vty, "./mpls-te/export", NB_OP_MODIFY, "true"); | |
1249 | ||
1250 | return nb_cli_apply_changes(vty, NULL); | |
1251 | } | |
1252 | ||
1253 | DEFPY_YANG(no_isis_mpls_te_export, no_isis_mpls_te_export_cmd, | |
1254 | "no mpls-te export", | |
1255 | NO_STR MPLS_TE_STR | |
1256 | "Disable export of MPLS-TE Link State information\n") | |
1257 | { | |
1258 | nb_cli_enqueue_change(vty, "./mpls-te/export", NB_OP_MODIFY, "false"); | |
1259 | ||
1260 | return nb_cli_apply_changes(vty, NULL); | |
1261 | } | |
1262 | ||
1263 | void cli_show_isis_mpls_te_export(struct vty *vty, const struct lyd_node *dnode, | |
1264 | bool show_defaults) | |
1265 | { | |
1266 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1267 | vty_out(vty, " no"); | |
1268 | ||
1269 | vty_out(vty, " mpls-te export\n"); | |
1270 | } | |
1271 | ||
8b104c10 EDP |
1272 | /* |
1273 | * XPath: /frr-isisd:isis/instance/default-information-originate | |
1274 | */ | |
ca77b518 | 1275 | DEFPY_YANG(isis_default_originate, isis_default_originate_cmd, |
70dd370f | 1276 | "[no] default-information originate <ipv4|ipv6>$ip <level-1|level-2>$level [always]$always [{metric (0-16777215)$metric|route-map RMAP_NAME$rmap}]", |
8b104c10 EDP |
1277 | NO_STR |
1278 | "Control distribution of default information\n" | |
1279 | "Distribute a default route\n" | |
1280 | "Distribute default route for IPv4\n" | |
1281 | "Distribute default route for IPv6\n" | |
1282 | "Distribute default route into level-1\n" | |
1283 | "Distribute default route into level-2\n" | |
1284 | "Always advertise default route\n" | |
1285 | "Metric for default route\n" | |
6aa15aeb | 1286 | "IS-IS default metric\n" |
8b104c10 EDP |
1287 | "Route map reference\n" |
1288 | "Pointer to route-map entries\n") | |
1289 | { | |
1290 | if (no) | |
95ce849b | 1291 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
8b104c10 EDP |
1292 | else { |
1293 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
5f1e5e3f EDP |
1294 | nb_cli_enqueue_change(vty, "./always", NB_OP_MODIFY, |
1295 | always ? "true" : "false"); | |
8b104c10 | 1296 | nb_cli_enqueue_change(vty, "./route-map", |
95ce849b | 1297 | rmap ? NB_OP_MODIFY : NB_OP_DESTROY, |
8b104c10 | 1298 | rmap ? rmap : NULL); |
82c25998 DT |
1299 | nb_cli_enqueue_change(vty, "./metric", NB_OP_MODIFY, |
1300 | metric_str ? metric_str : NULL); | |
8b104c10 EDP |
1301 | if (strmatch(ip, "ipv6") && !always) { |
1302 | vty_out(vty, | |
1303 | "Zebra doesn't implement default-originate for IPv6 yet\n"); | |
1304 | vty_out(vty, | |
1305 | "so use with care or use default-originate always.\n"); | |
1306 | } | |
1307 | } | |
1308 | ||
1309 | return nb_cli_apply_changes( | |
1310 | vty, "./default-information-originate/%s[level='%s']", ip, | |
1311 | level); | |
1312 | } | |
1313 | ||
25605051 | 1314 | static void vty_print_def_origin(struct vty *vty, const struct lyd_node *dnode, |
f34ab52d EDP |
1315 | const char *family, const char *level, |
1316 | bool show_defaults) | |
8b104c10 | 1317 | { |
8b104c10 | 1318 | vty_out(vty, " default-information originate %s %s", family, level); |
5f1e5e3f | 1319 | if (yang_dnode_get_bool(dnode, "./always")) |
8b104c10 EDP |
1320 | vty_out(vty, " always"); |
1321 | ||
1322 | if (yang_dnode_exists(dnode, "./route-map")) | |
1323 | vty_out(vty, " route-map %s", | |
1324 | yang_dnode_get_string(dnode, "./route-map")); | |
82c25998 DT |
1325 | if (show_defaults || !yang_dnode_is_default(dnode, "./metric")) |
1326 | vty_out(vty, " metric %s", | |
1327 | yang_dnode_get_string(dnode, "./metric")); | |
1328 | ||
8b104c10 EDP |
1329 | vty_out(vty, "\n"); |
1330 | } | |
1331 | ||
25605051 IR |
1332 | void cli_show_isis_def_origin_ipv4(struct vty *vty, |
1333 | const struct lyd_node *dnode, | |
8b104c10 EDP |
1334 | bool show_defaults) |
1335 | { | |
1336 | const char *level = yang_dnode_get_string(dnode, "./level"); | |
1337 | ||
1338 | vty_print_def_origin(vty, dnode, "ipv4", level, show_defaults); | |
1339 | } | |
1340 | ||
25605051 IR |
1341 | void cli_show_isis_def_origin_ipv6(struct vty *vty, |
1342 | const struct lyd_node *dnode, | |
8b104c10 EDP |
1343 | bool show_defaults) |
1344 | { | |
1345 | const char *level = yang_dnode_get_string(dnode, "./level"); | |
1346 | ||
1347 | vty_print_def_origin(vty, dnode, "ipv6", level, show_defaults); | |
1348 | } | |
1349 | ||
a041ac8e EDP |
1350 | /* |
1351 | * XPath: /frr-isisd:isis/instance/redistribute | |
1352 | */ | |
ca77b518 | 1353 | DEFPY_YANG(isis_redistribute, isis_redistribute_cmd, |
1bfee936 IR |
1354 | "[no] redistribute <ipv4$ip " PROTO_IP_REDIST_STR "$proto|ipv6$ip " |
1355 | PROTO_IP6_REDIST_STR "$proto> <level-1|level-2>$level" | |
70dd370f | 1356 | "[{metric (0-16777215)|route-map RMAP_NAME$route_map}]", |
a041ac8e EDP |
1357 | NO_STR REDIST_STR |
1358 | "Redistribute IPv4 routes\n" | |
1bfee936 IR |
1359 | PROTO_IP_REDIST_HELP |
1360 | "Redistribute IPv6 routes\n" | |
1361 | PROTO_IP6_REDIST_HELP | |
a041ac8e EDP |
1362 | "Redistribute into level-1\n" |
1363 | "Redistribute into level-2\n" | |
1364 | "Metric for redistributed routes\n" | |
6aa15aeb | 1365 | "IS-IS default metric\n" |
a041ac8e EDP |
1366 | "Route map reference\n" |
1367 | "Pointer to route-map entries\n") | |
1368 | { | |
1369 | if (no) | |
95ce849b | 1370 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
a041ac8e EDP |
1371 | else { |
1372 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
1373 | nb_cli_enqueue_change(vty, "./route-map", | |
95ce849b | 1374 | route_map ? NB_OP_MODIFY : NB_OP_DESTROY, |
a041ac8e | 1375 | route_map ? route_map : NULL); |
82c25998 DT |
1376 | nb_cli_enqueue_change(vty, "./metric", NB_OP_MODIFY, |
1377 | metric_str ? metric_str : NULL); | |
a041ac8e EDP |
1378 | } |
1379 | ||
1380 | return nb_cli_apply_changes( | |
1381 | vty, "./redistribute/%s[protocol='%s'][level='%s']", ip, proto, | |
1382 | level); | |
1383 | } | |
1384 | ||
25605051 IR |
1385 | static void vty_print_redistribute(struct vty *vty, |
1386 | const struct lyd_node *dnode, | |
82c25998 | 1387 | bool show_defaults, const char *family) |
a041ac8e EDP |
1388 | { |
1389 | const char *level = yang_dnode_get_string(dnode, "./level"); | |
1390 | const char *protocol = yang_dnode_get_string(dnode, "./protocol"); | |
1391 | ||
1392 | vty_out(vty, " redistribute %s %s %s", family, protocol, level); | |
82c25998 | 1393 | if (show_defaults || !yang_dnode_is_default(dnode, "./metric")) |
a041ac8e EDP |
1394 | vty_out(vty, " metric %s", |
1395 | yang_dnode_get_string(dnode, "./metric")); | |
82c25998 | 1396 | if (yang_dnode_exists(dnode, "./route-map")) |
a041ac8e EDP |
1397 | vty_out(vty, " route-map %s", |
1398 | yang_dnode_get_string(dnode, "./route-map")); | |
1399 | vty_out(vty, "\n"); | |
1400 | } | |
1401 | ||
25605051 IR |
1402 | void cli_show_isis_redistribute_ipv4(struct vty *vty, |
1403 | const struct lyd_node *dnode, | |
a041ac8e EDP |
1404 | bool show_defaults) |
1405 | { | |
82c25998 | 1406 | vty_print_redistribute(vty, dnode, show_defaults, "ipv4"); |
a041ac8e | 1407 | } |
25605051 IR |
1408 | void cli_show_isis_redistribute_ipv6(struct vty *vty, |
1409 | const struct lyd_node *dnode, | |
a041ac8e EDP |
1410 | bool show_defaults) |
1411 | { | |
82c25998 | 1412 | vty_print_redistribute(vty, dnode, show_defaults, "ipv6"); |
a041ac8e EDP |
1413 | } |
1414 | ||
22af6a80 EDP |
1415 | /* |
1416 | * XPath: /frr-isisd:isis/instance/multi-topology | |
1417 | */ | |
a15014f3 PG |
1418 | DEFPY_YANG( |
1419 | isis_topology, isis_topology_cmd, | |
1420 | "[no] topology <standard|ipv4-unicast|ipv4-mgmt|ipv6-unicast|ipv4-multicast|ipv6-multicast|ipv6-mgmt|ipv6-dstsrc>$topology [overload]$overload", | |
1421 | NO_STR | |
1422 | "Configure IS-IS topologies\n" | |
1423 | "standard topology\n" | |
1424 | "IPv4 unicast topology\n" | |
1425 | "IPv4 management topology\n" | |
1426 | "IPv6 unicast topology\n" | |
1427 | "IPv4 multicast topology\n" | |
1428 | "IPv6 multicast topology\n" | |
1429 | "IPv6 management topology\n" | |
1430 | "IPv6 dst-src topology\n" | |
1431 | "Set overload bit for topology\n") | |
22af6a80 EDP |
1432 | { |
1433 | char base_xpath[XPATH_MAXLEN]; | |
1434 | ||
a15014f3 | 1435 | /* Since standard is not configurable it is not present in the |
22af6a80 EDP |
1436 | * YANG model, so we need to validate it here |
1437 | */ | |
a15014f3 PG |
1438 | if (strmatch(topology, "standard") || |
1439 | strmatch(topology, "ipv4-unicast")) { | |
1440 | vty_out(vty, | |
1441 | "Cannot configure IPv4 unicast (Standard) topology\n"); | |
22af6a80 EDP |
1442 | return CMD_WARNING_CONFIG_FAILED; |
1443 | } | |
1444 | ||
1445 | if (strmatch(topology, "ipv4-mgmt")) | |
1446 | snprintf(base_xpath, XPATH_MAXLEN, | |
1447 | "./multi-topology/ipv4-management"); | |
1448 | else if (strmatch(topology, "ipv6-mgmt")) | |
1449 | snprintf(base_xpath, XPATH_MAXLEN, | |
1450 | "./multi-topology/ipv6-management"); | |
1451 | else | |
1452 | snprintf(base_xpath, XPATH_MAXLEN, "./multi-topology/%s", | |
1453 | topology); | |
1454 | ||
1455 | if (no) | |
95ce849b | 1456 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
22af6a80 EDP |
1457 | else { |
1458 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
5f1e5e3f EDP |
1459 | nb_cli_enqueue_change(vty, "./overload", NB_OP_MODIFY, |
1460 | overload ? "true" : "false"); | |
22af6a80 EDP |
1461 | } |
1462 | ||
ae08de9f | 1463 | return nb_cli_apply_changes(vty, "%s", base_xpath); |
22af6a80 EDP |
1464 | } |
1465 | ||
25605051 IR |
1466 | void cli_show_isis_mt_ipv4_multicast(struct vty *vty, |
1467 | const struct lyd_node *dnode, | |
22af6a80 EDP |
1468 | bool show_defaults) |
1469 | { | |
1470 | vty_out(vty, " topology ipv4-multicast"); | |
5f1e5e3f | 1471 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1472 | vty_out(vty, " overload"); |
1473 | vty_out(vty, "\n"); | |
1474 | } | |
1475 | ||
25605051 | 1476 | void cli_show_isis_mt_ipv4_mgmt(struct vty *vty, const struct lyd_node *dnode, |
22af6a80 EDP |
1477 | bool show_defaults) |
1478 | { | |
1479 | vty_out(vty, " topology ipv4-mgmt"); | |
5f1e5e3f | 1480 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1481 | vty_out(vty, " overload"); |
1482 | vty_out(vty, "\n"); | |
1483 | } | |
1484 | ||
25605051 IR |
1485 | void cli_show_isis_mt_ipv6_unicast(struct vty *vty, |
1486 | const struct lyd_node *dnode, | |
22af6a80 EDP |
1487 | bool show_defaults) |
1488 | { | |
1489 | vty_out(vty, " topology ipv6-unicast"); | |
5f1e5e3f | 1490 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1491 | vty_out(vty, " overload"); |
1492 | vty_out(vty, "\n"); | |
1493 | } | |
1494 | ||
25605051 IR |
1495 | void cli_show_isis_mt_ipv6_multicast(struct vty *vty, |
1496 | const struct lyd_node *dnode, | |
22af6a80 EDP |
1497 | bool show_defaults) |
1498 | { | |
1499 | vty_out(vty, " topology ipv6-multicast"); | |
5f1e5e3f | 1500 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1501 | vty_out(vty, " overload"); |
1502 | vty_out(vty, "\n"); | |
1503 | } | |
1504 | ||
25605051 | 1505 | void cli_show_isis_mt_ipv6_mgmt(struct vty *vty, const struct lyd_node *dnode, |
22af6a80 EDP |
1506 | bool show_defaults) |
1507 | { | |
1508 | vty_out(vty, " topology ipv6-mgmt"); | |
5f1e5e3f | 1509 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1510 | vty_out(vty, " overload"); |
1511 | vty_out(vty, "\n"); | |
1512 | } | |
1513 | ||
25605051 | 1514 | void cli_show_isis_mt_ipv6_dstsrc(struct vty *vty, const struct lyd_node *dnode, |
22af6a80 EDP |
1515 | bool show_defaults) |
1516 | { | |
1517 | vty_out(vty, " topology ipv6-dstsrc"); | |
5f1e5e3f | 1518 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1519 | vty_out(vty, " overload"); |
1520 | vty_out(vty, "\n"); | |
1521 | } | |
1522 | ||
8f6c8936 RW |
1523 | /* |
1524 | * XPath: /frr-isisd:isis/instance/segment-routing/enabled | |
1525 | */ | |
ca77b518 | 1526 | DEFPY_YANG (isis_sr_enable, |
8f6c8936 RW |
1527 | isis_sr_enable_cmd, |
1528 | "segment-routing on", | |
1529 | SR_STR | |
1530 | "Enable Segment Routing\n") | |
1531 | { | |
1532 | nb_cli_enqueue_change(vty, "./segment-routing/enabled", NB_OP_MODIFY, | |
1533 | "true"); | |
1534 | ||
1535 | return nb_cli_apply_changes(vty, NULL); | |
1536 | } | |
1537 | ||
ca77b518 | 1538 | DEFPY_YANG (no_isis_sr_enable, |
8f6c8936 RW |
1539 | no_isis_sr_enable_cmd, |
1540 | "no segment-routing [on]", | |
1541 | NO_STR | |
1542 | SR_STR | |
1543 | "Disable Segment Routing\n") | |
1544 | { | |
1545 | nb_cli_enqueue_change(vty, "./segment-routing/enabled", NB_OP_MODIFY, | |
1546 | "false"); | |
1547 | ||
1548 | return nb_cli_apply_changes(vty, NULL); | |
1549 | } | |
1550 | ||
25605051 | 1551 | void cli_show_isis_sr_enabled(struct vty *vty, const struct lyd_node *dnode, |
8f6c8936 RW |
1552 | bool show_defaults) |
1553 | { | |
1554 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1555 | vty_out(vty, " no"); | |
1556 | ||
1557 | vty_out(vty, " segment-routing on\n"); | |
1558 | } | |
1559 | ||
1560 | /* | |
01d43141 | 1561 | * XPath: /frr-isisd:isis/instance/segment-routing/label-block |
8f6c8936 | 1562 | */ |
01d43141 EDP |
1563 | |
1564 | DEFPY_YANG( | |
1565 | isis_sr_global_block_label_range, isis_sr_global_block_label_range_cmd, | |
1566 | "segment-routing global-block (16-1048575)$gb_lower_bound (16-1048575)$gb_upper_bound [local-block (16-1048575)$lb_lower_bound (16-1048575)$lb_upper_bound]", | |
1567 | SR_STR | |
1568 | "Segment Routing Global Block label range\n" | |
1569 | "The lower bound of the global block\n" | |
1570 | "The upper bound of the global block (block size may not exceed 65535)\n" | |
1571 | "Segment Routing Local Block label range\n" | |
1572 | "The lower bound of the local block\n" | |
1573 | "The upper bound of the local block (block size may not exceed 65535)\n") | |
1574 | { | |
1575 | nb_cli_enqueue_change(vty, | |
1576 | "./segment-routing/label-blocks/srgb/lower-bound", | |
1577 | NB_OP_MODIFY, gb_lower_bound_str); | |
1578 | nb_cli_enqueue_change(vty, | |
1579 | "./segment-routing/label-blocks/srgb/upper-bound", | |
1580 | NB_OP_MODIFY, gb_upper_bound_str); | |
1581 | ||
1582 | nb_cli_enqueue_change( | |
1583 | vty, "./segment-routing/label-blocks/srlb/lower-bound", | |
1584 | NB_OP_MODIFY, lb_lower_bound ? lb_lower_bound_str : NULL); | |
1585 | nb_cli_enqueue_change( | |
1586 | vty, "./segment-routing/label-blocks/srlb/upper-bound", | |
1587 | NB_OP_MODIFY, lb_upper_bound ? lb_upper_bound_str : NULL); | |
8f6c8936 RW |
1588 | |
1589 | return nb_cli_apply_changes(vty, NULL); | |
1590 | } | |
1591 | ||
01d43141 EDP |
1592 | DEFPY_YANG(no_isis_sr_global_block_label_range, |
1593 | no_isis_sr_global_block_label_range_cmd, | |
1594 | "no segment-routing global-block [(16-1048575) (16-1048575) local-block (16-1048575) (16-1048575)]", | |
1595 | NO_STR SR_STR | |
1596 | "Segment Routing Global Block label range\n" | |
1597 | "The lower bound of the global block\n" | |
1598 | "The upper bound of the global block (block size may not exceed 65535)\n" | |
1599 | "Segment Routing Local Block label range\n" | |
1600 | "The lower bound of the local block\n" | |
1601 | "The upper bound of the local block (block size may not exceed 65535)\n") | |
8f6c8936 | 1602 | { |
01d43141 EDP |
1603 | nb_cli_enqueue_change(vty, |
1604 | "./segment-routing/label-blocks/srgb/lower-bound", | |
1605 | NB_OP_MODIFY, NULL); | |
1606 | nb_cli_enqueue_change(vty, | |
1607 | "./segment-routing/label-blocks/srgb/upper-bound", | |
1608 | NB_OP_MODIFY, NULL); | |
1609 | nb_cli_enqueue_change(vty, | |
1610 | "./segment-routing/label-blocks/srlb/lower-bound", | |
8f6c8936 | 1611 | NB_OP_MODIFY, NULL); |
01d43141 EDP |
1612 | nb_cli_enqueue_change(vty, |
1613 | "./segment-routing/label-blocks/srlb/upper-bound", | |
8f6c8936 RW |
1614 | NB_OP_MODIFY, NULL); |
1615 | ||
1616 | return nb_cli_apply_changes(vty, NULL); | |
1617 | } | |
1618 | ||
25605051 | 1619 | void cli_show_isis_label_blocks(struct vty *vty, const struct lyd_node *dnode, |
01d43141 | 1620 | bool show_defaults) |
8f6c8936 | 1621 | { |
01d43141 EDP |
1622 | vty_out(vty, " segment-routing global-block %s %s", |
1623 | yang_dnode_get_string(dnode, "./srgb/lower-bound"), | |
1624 | yang_dnode_get_string(dnode, "./srgb/upper-bound")); | |
1625 | if (!yang_dnode_is_default(dnode, "./srlb/lower-bound") | |
1626 | || !yang_dnode_is_default(dnode, "./srlb/upper-bound")) | |
1627 | vty_out(vty, " local-block %s %s", | |
1628 | yang_dnode_get_string(dnode, "./srlb/lower-bound"), | |
1629 | yang_dnode_get_string(dnode, "./srlb/upper-bound")); | |
1630 | vty_out(vty, "\n"); | |
8f6c8936 RW |
1631 | } |
1632 | ||
1633 | /* | |
1634 | * XPath: /frr-isisd:isis/instance/segment-routing/msd/node-msd | |
1635 | */ | |
ca77b518 | 1636 | DEFPY_YANG (isis_sr_node_msd, |
8f6c8936 RW |
1637 | isis_sr_node_msd_cmd, |
1638 | "segment-routing node-msd (1-16)$msd", | |
1639 | SR_STR | |
1640 | "Maximum Stack Depth for this router\n" | |
1641 | "Maximum number of label that can be stack (1-16)\n") | |
1642 | { | |
1643 | nb_cli_enqueue_change(vty, "./segment-routing/msd/node-msd", | |
1644 | NB_OP_MODIFY, msd_str); | |
1645 | ||
1646 | return nb_cli_apply_changes(vty, NULL); | |
1647 | } | |
1648 | ||
ca77b518 | 1649 | DEFPY_YANG (no_isis_sr_node_msd, |
8f6c8936 RW |
1650 | no_isis_sr_node_msd_cmd, |
1651 | "no segment-routing node-msd [(1-16)]", | |
1652 | NO_STR | |
1653 | SR_STR | |
1654 | "Maximum Stack Depth for this router\n" | |
1655 | "Maximum number of label that can be stack (1-16)\n") | |
1656 | { | |
1657 | nb_cli_enqueue_change(vty, "./segment-routing/msd/node-msd", | |
1658 | NB_OP_DESTROY, NULL); | |
1659 | ||
1660 | return nb_cli_apply_changes(vty, NULL); | |
1661 | } | |
1662 | ||
25605051 | 1663 | void cli_show_isis_node_msd(struct vty *vty, const struct lyd_node *dnode, |
8f6c8936 RW |
1664 | bool show_defaults) |
1665 | { | |
1666 | vty_out(vty, " segment-routing node-msd %s\n", | |
1667 | yang_dnode_get_string(dnode, NULL)); | |
1668 | } | |
1669 | ||
1670 | /* | |
1671 | * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid | |
1672 | */ | |
ca77b518 | 1673 | DEFPY_YANG (isis_sr_prefix_sid, |
8f6c8936 RW |
1674 | isis_sr_prefix_sid_cmd, |
1675 | "segment-routing prefix\ | |
1676 | <A.B.C.D/M|X:X::X:X/M>$prefix\ | |
26f6acaf | 1677 | <absolute$sid_type (16-1048575)$sid_value|index$sid_type (0-65535)$sid_value>\ |
01983712 | 1678 | [<no-php-flag|explicit-null>$lh_behavior] [n-flag-clear$n_flag_clear]", |
8f6c8936 RW |
1679 | SR_STR |
1680 | "Prefix SID\n" | |
1681 | "IPv4 Prefix\n" | |
1682 | "IPv6 Prefix\n" | |
02c671af | 1683 | "Specify the absolute value of Prefix Segment ID\n" |
8f6c8936 | 1684 | "The Prefix Segment ID value\n" |
02c671af | 1685 | "Specify the index of Prefix Segment ID\n" |
8f6c8936 RW |
1686 | "The Prefix Segment ID index\n" |
1687 | "Don't request Penultimate Hop Popping (PHP)\n" | |
01983712 RW |
1688 | "Upstream neighbor must replace prefix-sid with explicit null label\n" |
1689 | "Not a node SID\n") | |
8f6c8936 RW |
1690 | { |
1691 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
1692 | nb_cli_enqueue_change(vty, "./sid-value-type", NB_OP_MODIFY, sid_type); | |
1693 | nb_cli_enqueue_change(vty, "./sid-value", NB_OP_MODIFY, sid_value_str); | |
1694 | if (lh_behavior) { | |
1695 | const char *value; | |
1696 | ||
1697 | if (strmatch(lh_behavior, "no-php-flag")) | |
1698 | value = "no-php"; | |
4c94922c | 1699 | else if (strmatch(lh_behavior, "explicit-null")) |
8f6c8936 | 1700 | value = "explicit-null"; |
4c94922c LS |
1701 | else |
1702 | value = "php"; | |
8f6c8936 RW |
1703 | |
1704 | nb_cli_enqueue_change(vty, "./last-hop-behavior", NB_OP_MODIFY, | |
1705 | value); | |
1706 | } else | |
1707 | nb_cli_enqueue_change(vty, "./last-hop-behavior", NB_OP_MODIFY, | |
1708 | NULL); | |
01983712 RW |
1709 | nb_cli_enqueue_change(vty, "./n-flag-clear", NB_OP_MODIFY, |
1710 | n_flag_clear ? "true" : "false"); | |
8f6c8936 RW |
1711 | |
1712 | return nb_cli_apply_changes( | |
1713 | vty, "./segment-routing/prefix-sid-map/prefix-sid[prefix='%s']", | |
1714 | prefix_str); | |
1715 | } | |
1716 | ||
ca77b518 | 1717 | DEFPY_YANG (no_isis_sr_prefix_sid, |
8f6c8936 RW |
1718 | no_isis_sr_prefix_sid_cmd, |
1719 | "no segment-routing prefix <A.B.C.D/M|X:X::X:X/M>$prefix\ | |
01983712 RW |
1720 | [<absolute$sid_type (16-1048575)|index (0-65535)> [<no-php-flag|explicit-null>]]\ |
1721 | [n-flag-clear]", | |
8f6c8936 RW |
1722 | NO_STR |
1723 | SR_STR | |
1724 | "Prefix SID\n" | |
1725 | "IPv4 Prefix\n" | |
1726 | "IPv6 Prefix\n" | |
02c671af | 1727 | "Specify the absolute value of Prefix Segment ID\n" |
8f6c8936 | 1728 | "The Prefix Segment ID value\n" |
02c671af | 1729 | "Specify the index of Prefix Segment ID\n" |
8f6c8936 RW |
1730 | "The Prefix Segment ID index\n" |
1731 | "Don't request Penultimate Hop Popping (PHP)\n" | |
01983712 RW |
1732 | "Upstream neighbor must replace prefix-sid with explicit null label\n" |
1733 | "Not a node SID\n") | |
8f6c8936 RW |
1734 | { |
1735 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); | |
1736 | ||
1737 | return nb_cli_apply_changes( | |
1738 | vty, "./segment-routing/prefix-sid-map/prefix-sid[prefix='%s']", | |
1739 | prefix_str); | |
1740 | } | |
1741 | ||
25605051 | 1742 | void cli_show_isis_prefix_sid(struct vty *vty, const struct lyd_node *dnode, |
8f6c8936 RW |
1743 | bool show_defaults) |
1744 | { | |
1745 | const char *prefix; | |
1746 | const char *lh_behavior; | |
1747 | const char *sid_value_type; | |
1748 | const char *sid_value; | |
01983712 | 1749 | bool n_flag_clear; |
8f6c8936 RW |
1750 | |
1751 | prefix = yang_dnode_get_string(dnode, "./prefix"); | |
1752 | lh_behavior = yang_dnode_get_string(dnode, "./last-hop-behavior"); | |
1753 | sid_value_type = yang_dnode_get_string(dnode, "./sid-value-type"); | |
1754 | sid_value = yang_dnode_get_string(dnode, "./sid-value"); | |
01983712 | 1755 | n_flag_clear = yang_dnode_get_bool(dnode, "./n-flag-clear"); |
8f6c8936 RW |
1756 | |
1757 | vty_out(vty, " segment-routing prefix %s", prefix); | |
1758 | if (strmatch(sid_value_type, "absolute")) | |
1759 | vty_out(vty, " absolute"); | |
1760 | else | |
1761 | vty_out(vty, " index"); | |
1762 | vty_out(vty, " %s", sid_value); | |
1763 | if (strmatch(lh_behavior, "no-php")) | |
1764 | vty_out(vty, " no-php-flag"); | |
1765 | else if (strmatch(lh_behavior, "explicit-null")) | |
1766 | vty_out(vty, " explicit-null"); | |
01983712 RW |
1767 | if (n_flag_clear) |
1768 | vty_out(vty, " n-flag-clear"); | |
8f6c8936 RW |
1769 | vty_out(vty, "\n"); |
1770 | } | |
1771 | ||
d20b14bc RW |
1772 | |
1773 | /* | |
1774 | * XPath: /frr-isisd:isis/instance/fast-reroute/level-{1,2}/lfa/priority-limit | |
1775 | */ | |
1776 | DEFPY_YANG (isis_frr_lfa_priority_limit, | |
1777 | isis_frr_lfa_priority_limit_cmd, | |
1778 | "[no] fast-reroute priority-limit <critical|high|medium>$priority [<level-1|level-2>$level]", | |
1779 | NO_STR | |
1780 | "Configure Fast ReRoute\n" | |
1781 | "Limit backup computation up to the prefix priority\n" | |
1782 | "Compute for critical priority prefixes only\n" | |
1783 | "Compute for critical & high priority prefixes\n" | |
1784 | "Compute for critical, high & medium priority prefixes\n" | |
1785 | "Set priority-limit for level-1 only\n" | |
1786 | "Set priority-limit for level-2 only\n") | |
1787 | { | |
1788 | if (!level || strmatch(level, "level-1")) { | |
1789 | if (no) { | |
1790 | nb_cli_enqueue_change( | |
1791 | vty, | |
1792 | "./fast-reroute/level-1/lfa/priority-limit", | |
1793 | NB_OP_DESTROY, NULL); | |
1794 | } else { | |
1795 | nb_cli_enqueue_change( | |
1796 | vty, | |
1797 | "./fast-reroute/level-1/lfa/priority-limit", | |
1798 | NB_OP_CREATE, priority); | |
1799 | } | |
1800 | } | |
1801 | if (!level || strmatch(level, "level-2")) { | |
1802 | if (no) { | |
1803 | nb_cli_enqueue_change( | |
1804 | vty, | |
1805 | "./fast-reroute/level-2/lfa/priority-limit", | |
1806 | NB_OP_DESTROY, NULL); | |
1807 | } else { | |
1808 | nb_cli_enqueue_change( | |
1809 | vty, | |
1810 | "./fast-reroute/level-2/lfa/priority-limit", | |
1811 | NB_OP_CREATE, priority); | |
1812 | } | |
1813 | } | |
1814 | ||
1815 | return nb_cli_apply_changes(vty, NULL); | |
1816 | } | |
1817 | ||
1818 | void cli_show_isis_frr_lfa_priority_limit(struct vty *vty, | |
25605051 | 1819 | const struct lyd_node *dnode, |
d20b14bc RW |
1820 | bool show_defaults) |
1821 | { | |
1822 | vty_out(vty, " fast-reroute priority-limit %s %s\n", | |
1823 | yang_dnode_get_string(dnode, NULL), | |
1824 | dnode->parent->parent->schema->name); | |
1825 | } | |
1826 | ||
1827 | /* | |
1828 | * XPath: /frr-isisd:isis/instance/fast-reroute/level-{1,2}/lfa/tiebreaker | |
1829 | */ | |
1830 | DEFPY_YANG (isis_frr_lfa_tiebreaker, | |
1831 | isis_frr_lfa_tiebreaker_cmd, | |
1832 | "[no] fast-reroute lfa\ | |
1833 | tiebreaker <downstream|lowest-backup-metric|node-protecting>$type\ | |
1834 | index (1-255)$index\ | |
1835 | [<level-1|level-2>$level]", | |
1836 | NO_STR | |
1837 | "Configure Fast ReRoute\n" | |
1838 | "LFA configuration\n" | |
1839 | "Configure tiebreaker for multiple backups\n" | |
1840 | "Prefer backup path via downstream node\n" | |
1841 | "Prefer backup path with lowest total metric\n" | |
1842 | "Prefer node protecting backup path\n" | |
1843 | "Set preference order among tiebreakers\n" | |
1844 | "Index\n" | |
1845 | "Configure tiebreaker for level-1 only\n" | |
1846 | "Configure tiebreaker for level-2 only\n") | |
1847 | { | |
1848 | char xpath[XPATH_MAXLEN]; | |
1849 | ||
1850 | if (!level || strmatch(level, "level-1")) { | |
1851 | if (no) { | |
1852 | snprintf( | |
1853 | xpath, XPATH_MAXLEN, | |
1854 | "./fast-reroute/level-1/lfa/tiebreaker[index='%s']", | |
1855 | index_str); | |
1856 | nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); | |
1857 | } else { | |
1858 | snprintf( | |
1859 | xpath, XPATH_MAXLEN, | |
1860 | "./fast-reroute/level-1/lfa/tiebreaker[index='%s']/type", | |
1861 | index_str); | |
1862 | nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, type); | |
1863 | } | |
1864 | } | |
1865 | if (!level || strmatch(level, "level-2")) { | |
1866 | if (no) { | |
1867 | snprintf( | |
1868 | xpath, XPATH_MAXLEN, | |
1869 | "./fast-reroute/level-2/lfa/tiebreaker[index='%s']", | |
1870 | index_str); | |
1871 | nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); | |
1872 | } else { | |
1873 | snprintf( | |
1874 | xpath, XPATH_MAXLEN, | |
1875 | "./fast-reroute/level-2/lfa/tiebreaker[index='%s']/type", | |
1876 | index_str); | |
1877 | nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, type); | |
1878 | } | |
1879 | } | |
1880 | ||
1881 | return nb_cli_apply_changes(vty, NULL); | |
1882 | } | |
1883 | ||
25605051 IR |
1884 | void cli_show_isis_frr_lfa_tiebreaker(struct vty *vty, |
1885 | const struct lyd_node *dnode, | |
d20b14bc RW |
1886 | bool show_defaults) |
1887 | { | |
1888 | vty_out(vty, " fast-reroute lfa tiebreaker %s index %s %s\n", | |
1889 | yang_dnode_get_string(dnode, "./type"), | |
1890 | yang_dnode_get_string(dnode, "./index"), | |
1891 | dnode->parent->parent->schema->name); | |
1892 | } | |
1893 | ||
1894 | /* | |
1895 | * XPath: /frr-isisd:isis/instance/fast-reroute/level-{1,2}/lfa/load-sharing | |
1896 | */ | |
1897 | DEFPY_YANG (isis_frr_lfa_load_sharing, | |
1898 | isis_frr_lfa_load_sharing_cmd, | |
1899 | "[no] fast-reroute load-sharing disable [<level-1|level-2>$level]", | |
1900 | NO_STR | |
1901 | "Configure Fast ReRoute\n" | |
1902 | "Load share prefixes across multiple backups\n" | |
1903 | "Disable load sharing\n" | |
1904 | "Disable load sharing for level-1 only\n" | |
1905 | "Disable load sharing for level-2 only\n") | |
1906 | { | |
1907 | if (!level || strmatch(level, "level-1")) { | |
1908 | if (no) { | |
1909 | nb_cli_enqueue_change( | |
1910 | vty, "./fast-reroute/level-1/lfa/load-sharing", | |
7ab5ca10 | 1911 | NB_OP_MODIFY, "true"); |
d20b14bc RW |
1912 | } else { |
1913 | nb_cli_enqueue_change( | |
1914 | vty, "./fast-reroute/level-1/lfa/load-sharing", | |
7ab5ca10 | 1915 | NB_OP_MODIFY, "false"); |
d20b14bc RW |
1916 | } |
1917 | } | |
1918 | if (!level || strmatch(level, "level-2")) { | |
1919 | if (no) { | |
1920 | nb_cli_enqueue_change( | |
1921 | vty, "./fast-reroute/level-2/lfa/load-sharing", | |
7ab5ca10 | 1922 | NB_OP_MODIFY, "true"); |
d20b14bc RW |
1923 | } else { |
1924 | nb_cli_enqueue_change( | |
1925 | vty, "./fast-reroute/level-2/lfa/load-sharing", | |
7ab5ca10 | 1926 | NB_OP_MODIFY, "false"); |
d20b14bc RW |
1927 | } |
1928 | } | |
1929 | ||
1930 | return nb_cli_apply_changes(vty, NULL); | |
1931 | } | |
1932 | ||
25605051 IR |
1933 | void cli_show_isis_frr_lfa_load_sharing(struct vty *vty, |
1934 | const struct lyd_node *dnode, | |
d20b14bc RW |
1935 | bool show_defaults) |
1936 | { | |
32931e1a | 1937 | if (yang_dnode_get_bool(dnode, NULL)) |
d20b14bc RW |
1938 | vty_out(vty, " no"); |
1939 | ||
1940 | vty_out(vty, " fast-reroute load-sharing disable %s\n", | |
1941 | dnode->parent->parent->schema->name); | |
1942 | } | |
1943 | ||
381200be RW |
1944 | /* |
1945 | * XPath: /frr-isisd:isis/instance/fast-reroute/level-{1,2}/remote-lfa/prefix-list | |
1946 | */ | |
1947 | DEFPY_YANG (isis_frr_remote_lfa_plist, | |
1948 | isis_frr_remote_lfa_plist_cmd, | |
1949 | "fast-reroute remote-lfa prefix-list WORD$plist [<level-1|level-2>$level]", | |
1950 | "Configure Fast ReRoute\n" | |
1951 | "Enable remote LFA related configuration\n" | |
1952 | "Filter PQ node router ID based on prefix list\n" | |
1953 | "Prefix-list name\n" | |
1954 | "Enable router ID filtering for level-1 only\n" | |
1955 | "Enable router ID filtering for level-2 only\n") | |
1956 | { | |
1957 | if (!level || strmatch(level, "level-1")) | |
1958 | nb_cli_enqueue_change( | |
1959 | vty, "./fast-reroute/level-1/remote-lfa/prefix-list", | |
1960 | NB_OP_MODIFY, plist); | |
1961 | if (!level || strmatch(level, "level-2")) | |
1962 | nb_cli_enqueue_change( | |
1963 | vty, "./fast-reroute/level-2/remote-lfa/prefix-list", | |
1964 | NB_OP_MODIFY, plist); | |
1965 | ||
1966 | return nb_cli_apply_changes(vty, NULL); | |
1967 | } | |
1968 | ||
1969 | DEFPY_YANG (no_isis_frr_remote_lfa_plist, | |
1970 | no_isis_frr_remote_lfa_plist_cmd, | |
1971 | "no fast-reroute remote-lfa prefix-list [WORD] [<level-1|level-2>$level]", | |
1972 | NO_STR | |
1973 | "Configure Fast ReRoute\n" | |
1974 | "Enable remote LFA related configuration\n" | |
1975 | "Filter PQ node router ID based on prefix list\n" | |
1976 | "Prefix-list name\n" | |
1977 | "Enable router ID filtering for level-1 only\n" | |
1978 | "Enable router ID filtering for level-2 only\n") | |
1979 | { | |
1980 | if (!level || strmatch(level, "level-1")) | |
1981 | nb_cli_enqueue_change( | |
1982 | vty, "./fast-reroute/level-1/remote-lfa/prefix-list", | |
1983 | NB_OP_DESTROY, NULL); | |
1984 | if (!level || strmatch(level, "level-2")) | |
1985 | nb_cli_enqueue_change( | |
1986 | vty, "./fast-reroute/level-2/remote-lfa/prefix-list", | |
1987 | NB_OP_DESTROY, NULL); | |
1988 | ||
1989 | return nb_cli_apply_changes(vty, NULL); | |
1990 | } | |
1991 | ||
25605051 IR |
1992 | void cli_show_isis_frr_remote_lfa_plist(struct vty *vty, |
1993 | const struct lyd_node *dnode, | |
381200be RW |
1994 | bool show_defaults) |
1995 | { | |
1996 | vty_out(vty, " fast-reroute remote-lfa prefix-list %s %s\n", | |
1997 | yang_dnode_get_string(dnode, NULL), | |
1998 | dnode->parent->parent->schema->name); | |
1999 | } | |
2000 | ||
a6a36c41 EDP |
2001 | /* |
2002 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/passive | |
2003 | */ | |
ca77b518 | 2004 | DEFPY_YANG(isis_passive, isis_passive_cmd, "[no] isis passive", |
a6a36c41 EDP |
2005 | NO_STR |
2006 | "IS-IS routing protocol\n" | |
2007 | "Configure the passive mode for interface\n") | |
2008 | { | |
5f1e5e3f EDP |
2009 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive", NB_OP_MODIFY, |
2010 | no ? "false" : "true"); | |
a6a36c41 EDP |
2011 | |
2012 | return nb_cli_apply_changes(vty, NULL); | |
2013 | } | |
2014 | ||
25605051 | 2015 | void cli_show_ip_isis_passive(struct vty *vty, const struct lyd_node *dnode, |
a6a36c41 EDP |
2016 | bool show_defaults) |
2017 | { | |
5f1e5e3f EDP |
2018 | if (!yang_dnode_get_bool(dnode, NULL)) |
2019 | vty_out(vty, " no"); | |
a6a36c41 EDP |
2020 | vty_out(vty, " isis passive\n"); |
2021 | } | |
2022 | ||
3e20c83a EDP |
2023 | /* |
2024 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/password | |
2025 | */ | |
2026 | ||
ca77b518 | 2027 | DEFPY_YANG(isis_passwd, isis_passwd_cmd, "isis password <md5|clear>$type WORD$pwd", |
3e20c83a EDP |
2028 | "IS-IS routing protocol\n" |
2029 | "Configure the authentication password for a circuit\n" | |
2030 | "HMAC-MD5 authentication\n" | |
2031 | "Cleartext password\n" | |
2032 | "Circuit password\n") | |
2033 | { | |
2034 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/password", NB_OP_CREATE, | |
2035 | NULL); | |
2036 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/password/password", | |
2037 | NB_OP_MODIFY, pwd); | |
2038 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/password/password-type", | |
2039 | NB_OP_MODIFY, type); | |
2040 | ||
2041 | return nb_cli_apply_changes(vty, NULL); | |
2042 | } | |
2043 | ||
ca77b518 | 2044 | DEFPY_YANG(no_isis_passwd, no_isis_passwd_cmd, "no isis password [<md5|clear> WORD]", |
3e20c83a EDP |
2045 | NO_STR |
2046 | "IS-IS routing protocol\n" | |
2047 | "Configure the authentication password for a circuit\n" | |
2048 | "HMAC-MD5 authentication\n" | |
2049 | "Cleartext password\n" | |
2050 | "Circuit password\n") | |
2051 | { | |
95ce849b | 2052 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/password", NB_OP_DESTROY, |
3e20c83a EDP |
2053 | NULL); |
2054 | ||
2055 | return nb_cli_apply_changes(vty, NULL); | |
2056 | } | |
2057 | ||
25605051 | 2058 | void cli_show_ip_isis_password(struct vty *vty, const struct lyd_node *dnode, |
3e20c83a EDP |
2059 | bool show_defaults) |
2060 | { | |
2061 | vty_out(vty, " isis password %s %s\n", | |
2062 | yang_dnode_get_string(dnode, "./password-type"), | |
2063 | yang_dnode_get_string(dnode, "./password")); | |
2064 | } | |
2065 | ||
be49219c EDP |
2066 | /* |
2067 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric | |
2068 | */ | |
ca77b518 | 2069 | DEFPY_YANG(isis_metric, isis_metric_cmd, |
be49219c EDP |
2070 | "isis metric [level-1|level-2]$level (0-16777215)$met", |
2071 | "IS-IS routing protocol\n" | |
2072 | "Set default metric for circuit\n" | |
2073 | "Specify metric for level-1 routing\n" | |
2074 | "Specify metric for level-2 routing\n" | |
2075 | "Default metric value\n") | |
2076 | { | |
2077 | if (!level || strmatch(level, "level-1")) | |
2078 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-1", | |
2079 | NB_OP_MODIFY, met_str); | |
2080 | if (!level || strmatch(level, "level-2")) | |
2081 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-2", | |
2082 | NB_OP_MODIFY, met_str); | |
2083 | ||
2084 | return nb_cli_apply_changes(vty, NULL); | |
2085 | } | |
2086 | ||
ca77b518 | 2087 | DEFPY_YANG(no_isis_metric, no_isis_metric_cmd, |
be49219c EDP |
2088 | "no isis metric [level-1|level-2]$level [(0-16777215)]", |
2089 | NO_STR | |
2090 | "IS-IS routing protocol\n" | |
2091 | "Set default metric for circuit\n" | |
2092 | "Specify metric for level-1 routing\n" | |
2093 | "Specify metric for level-2 routing\n" | |
2094 | "Default metric value\n") | |
2095 | { | |
2096 | if (!level || strmatch(level, "level-1")) | |
2097 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-1", | |
2098 | NB_OP_MODIFY, NULL); | |
2099 | if (!level || strmatch(level, "level-2")) | |
2100 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-2", | |
2101 | NB_OP_MODIFY, NULL); | |
2102 | ||
2103 | return nb_cli_apply_changes(vty, NULL); | |
2104 | } | |
2105 | ||
25605051 | 2106 | void cli_show_ip_isis_metric(struct vty *vty, const struct lyd_node *dnode, |
be49219c EDP |
2107 | bool show_defaults) |
2108 | { | |
2109 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
2110 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
2111 | ||
2112 | if (strmatch(l1, l2)) | |
2113 | vty_out(vty, " isis metric %s\n", l1); | |
2114 | else { | |
d32a4cac EDP |
2115 | vty_out(vty, " isis metric level-1 %s\n", l1); |
2116 | vty_out(vty, " isis metric level-2 %s\n", l2); | |
be49219c EDP |
2117 | } |
2118 | } | |
2119 | ||
356a2e3c EDP |
2120 | /* |
2121 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval | |
2122 | */ | |
ca77b518 | 2123 | DEFPY_YANG(isis_hello_interval, isis_hello_interval_cmd, |
356a2e3c EDP |
2124 | "isis hello-interval [level-1|level-2]$level (1-600)$intv", |
2125 | "IS-IS routing protocol\n" | |
2126 | "Set Hello interval\n" | |
2127 | "Specify hello-interval for level-1 IIHs\n" | |
2128 | "Specify hello-interval for level-2 IIHs\n" | |
2129 | "Holdtime 1 seconds, interval depends on multiplier\n") | |
2130 | { | |
2131 | if (!level || strmatch(level, "level-1")) | |
2132 | nb_cli_enqueue_change(vty, | |
2133 | "./frr-isisd:isis/hello/interval/level-1", | |
2134 | NB_OP_MODIFY, intv_str); | |
2135 | if (!level || strmatch(level, "level-2")) | |
2136 | nb_cli_enqueue_change(vty, | |
2137 | "./frr-isisd:isis/hello/interval/level-2", | |
2138 | NB_OP_MODIFY, intv_str); | |
2139 | ||
2140 | return nb_cli_apply_changes(vty, NULL); | |
2141 | } | |
2142 | ||
ca77b518 | 2143 | DEFPY_YANG(no_isis_hello_interval, no_isis_hello_interval_cmd, |
356a2e3c EDP |
2144 | "no isis hello-interval [level-1|level-2]$level [(1-600)]", |
2145 | NO_STR | |
2146 | "IS-IS routing protocol\n" | |
2147 | "Set Hello interval\n" | |
2148 | "Specify hello-interval for level-1 IIHs\n" | |
2149 | "Specify hello-interval for level-2 IIHs\n" | |
2150 | "Holdtime 1 second, interval depends on multiplier\n") | |
2151 | { | |
2152 | if (!level || strmatch(level, "level-1")) | |
2153 | nb_cli_enqueue_change(vty, | |
2154 | "./frr-isisd:isis/hello/interval/level-1", | |
2155 | NB_OP_MODIFY, NULL); | |
2156 | if (!level || strmatch(level, "level-2")) | |
2157 | nb_cli_enqueue_change(vty, | |
2158 | "./frr-isisd:isis/hello/interval/level-2", | |
2159 | NB_OP_MODIFY, NULL); | |
2160 | ||
2161 | return nb_cli_apply_changes(vty, NULL); | |
2162 | } | |
2163 | ||
25605051 IR |
2164 | void cli_show_ip_isis_hello_interval(struct vty *vty, |
2165 | const struct lyd_node *dnode, | |
356a2e3c EDP |
2166 | bool show_defaults) |
2167 | { | |
2168 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
2169 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
2170 | ||
2171 | if (strmatch(l1, l2)) | |
2172 | vty_out(vty, " isis hello-interval %s\n", l1); | |
2173 | else { | |
249312ab EDP |
2174 | vty_out(vty, " isis hello-interval level-1 %s\n", l1); |
2175 | vty_out(vty, " isis hello-interval level-2 %s\n", l2); | |
356a2e3c EDP |
2176 | } |
2177 | } | |
2178 | ||
4e75a67d EDP |
2179 | /* |
2180 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier | |
2181 | */ | |
ca77b518 | 2182 | DEFPY_YANG(isis_hello_multiplier, isis_hello_multiplier_cmd, |
4e75a67d EDP |
2183 | "isis hello-multiplier [level-1|level-2]$level (2-100)$mult", |
2184 | "IS-IS routing protocol\n" | |
2185 | "Set multiplier for Hello holding time\n" | |
2186 | "Specify hello multiplier for level-1 IIHs\n" | |
2187 | "Specify hello multiplier for level-2 IIHs\n" | |
2188 | "Hello multiplier value\n") | |
2189 | { | |
2190 | if (!level || strmatch(level, "level-1")) | |
2191 | nb_cli_enqueue_change( | |
2192 | vty, "./frr-isisd:isis/hello/multiplier/level-1", | |
2193 | NB_OP_MODIFY, mult_str); | |
2194 | if (!level || strmatch(level, "level-2")) | |
2195 | nb_cli_enqueue_change( | |
2196 | vty, "./frr-isisd:isis/hello/multiplier/level-2", | |
2197 | NB_OP_MODIFY, mult_str); | |
2198 | ||
2199 | return nb_cli_apply_changes(vty, NULL); | |
2200 | } | |
2201 | ||
ca77b518 | 2202 | DEFPY_YANG(no_isis_hello_multiplier, no_isis_hello_multiplier_cmd, |
4e75a67d EDP |
2203 | "no isis hello-multiplier [level-1|level-2]$level [(2-100)]", |
2204 | NO_STR | |
2205 | "IS-IS routing protocol\n" | |
2206 | "Set multiplier for Hello holding time\n" | |
2207 | "Specify hello multiplier for level-1 IIHs\n" | |
2208 | "Specify hello multiplier for level-2 IIHs\n" | |
2209 | "Hello multiplier value\n") | |
2210 | { | |
2211 | if (!level || strmatch(level, "level-1")) | |
2212 | nb_cli_enqueue_change( | |
2213 | vty, "./frr-isisd:isis/hello/multiplier/level-1", | |
2214 | NB_OP_MODIFY, NULL); | |
2215 | if (!level || strmatch(level, "level-2")) | |
2216 | nb_cli_enqueue_change( | |
2217 | vty, "./frr-isisd:isis/hello/multiplier/level-2", | |
2218 | NB_OP_MODIFY, NULL); | |
2219 | ||
2220 | return nb_cli_apply_changes(vty, NULL); | |
2221 | } | |
2222 | ||
25605051 | 2223 | void cli_show_ip_isis_hello_multi(struct vty *vty, const struct lyd_node *dnode, |
4e75a67d EDP |
2224 | bool show_defaults) |
2225 | { | |
2226 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
2227 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
2228 | ||
2229 | if (strmatch(l1, l2)) | |
2230 | vty_out(vty, " isis hello-multiplier %s\n", l1); | |
2231 | else { | |
249312ab EDP |
2232 | vty_out(vty, " isis hello-multiplier level-1 %s\n", l1); |
2233 | vty_out(vty, " isis hello-multiplier level-2 %s\n", l2); | |
4e75a67d EDP |
2234 | } |
2235 | } | |
2236 | ||
5f2ce446 EDP |
2237 | /* |
2238 | * XPath: | |
2239 | * /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake | |
2240 | */ | |
ca77b518 | 2241 | DEFPY_YANG(isis_threeway_adj, isis_threeway_adj_cmd, "[no] isis three-way-handshake", |
5f2ce446 EDP |
2242 | NO_STR |
2243 | "IS-IS commands\n" | |
2244 | "Enable/Disable three-way handshake\n") | |
2245 | { | |
2246 | nb_cli_enqueue_change(vty, | |
2247 | "./frr-isisd:isis/disable-three-way-handshake", | |
5f1e5e3f | 2248 | NB_OP_MODIFY, no ? "true" : "false"); |
5f2ce446 EDP |
2249 | |
2250 | return nb_cli_apply_changes(vty, NULL); | |
2251 | } | |
2252 | ||
25605051 IR |
2253 | void cli_show_ip_isis_threeway_shake(struct vty *vty, |
2254 | const struct lyd_node *dnode, | |
5f2ce446 EDP |
2255 | bool show_defaults) |
2256 | { | |
5f1e5e3f EDP |
2257 | if (yang_dnode_get_bool(dnode, NULL)) |
2258 | vty_out(vty, " no"); | |
2259 | vty_out(vty, " isis three-way-handshake\n"); | |
5f2ce446 EDP |
2260 | } |
2261 | ||
7b6b75e5 EDP |
2262 | /* |
2263 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding | |
2264 | */ | |
e36ec6ac | 2265 | DEFPY_YANG(isis_hello_padding, isis_hello_padding_cmd, |
06fbbf29 | 2266 | "[no] isis hello padding [during-adjacency-formation]$padding_type", |
e36ec6ac DO |
2267 | NO_STR |
2268 | "IS-IS routing protocol\n" | |
2269 | "Type of padding for IS-IS hello packets\n" | |
2270 | "Pad hello packets\n" | |
2271 | "Add padding to hello packets during adjacency formation only.\n") | |
7b6b75e5 | 2272 | { |
e36ec6ac DO |
2273 | if (no) { |
2274 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/hello/padding", | |
2275 | NB_OP_MODIFY, "disabled"); | |
2276 | } else { | |
2277 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/hello/padding", | |
2278 | NB_OP_MODIFY, | |
2279 | padding_type ? padding_type : "always"); | |
2280 | } | |
7b6b75e5 EDP |
2281 | return nb_cli_apply_changes(vty, NULL); |
2282 | } | |
2283 | ||
25605051 IR |
2284 | void cli_show_ip_isis_hello_padding(struct vty *vty, |
2285 | const struct lyd_node *dnode, | |
7b6b75e5 EDP |
2286 | bool show_defaults) |
2287 | { | |
e36ec6ac DO |
2288 | int hello_padding_type = yang_dnode_get_enum(dnode, NULL); |
2289 | if (hello_padding_type == ISIS_HELLO_PADDING_DISABLED) | |
7b6b75e5 | 2290 | vty_out(vty, " no"); |
e36ec6ac | 2291 | vty_out(vty, " isis hello padding"); |
06fbbf29 DO |
2292 | if (hello_padding_type == ISIS_HELLO_PADDING_DURING_ADJACENCY_FORMATION) |
2293 | vty_out(vty, " during-adjacency-formation"); | |
e36ec6ac | 2294 | vty_out(vty, "\n"); |
7b6b75e5 EDP |
2295 | } |
2296 | ||
9ce808b9 EDP |
2297 | /* |
2298 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval | |
2299 | */ | |
ca77b518 | 2300 | DEFPY_YANG(csnp_interval, csnp_interval_cmd, |
9ce808b9 EDP |
2301 | "isis csnp-interval (1-600)$intv [level-1|level-2]$level", |
2302 | "IS-IS routing protocol\n" | |
2303 | "Set CSNP interval in seconds\n" | |
2304 | "CSNP interval value\n" | |
2305 | "Specify interval for level-1 CSNPs\n" | |
2306 | "Specify interval for level-2 CSNPs\n") | |
2307 | { | |
2308 | if (!level || strmatch(level, "level-1")) | |
2309 | nb_cli_enqueue_change(vty, | |
2310 | "./frr-isisd:isis/csnp-interval/level-1", | |
2311 | NB_OP_MODIFY, intv_str); | |
2312 | if (!level || strmatch(level, "level-2")) | |
2313 | nb_cli_enqueue_change(vty, | |
2314 | "./frr-isisd:isis/csnp-interval/level-2", | |
2315 | NB_OP_MODIFY, intv_str); | |
2316 | ||
2317 | return nb_cli_apply_changes(vty, NULL); | |
2318 | } | |
2319 | ||
ca77b518 | 2320 | DEFPY_YANG(no_csnp_interval, no_csnp_interval_cmd, |
9ce808b9 EDP |
2321 | "no isis csnp-interval [(1-600)] [level-1|level-2]$level", |
2322 | NO_STR | |
2323 | "IS-IS routing protocol\n" | |
2324 | "Set CSNP interval in seconds\n" | |
2325 | "CSNP interval value\n" | |
2326 | "Specify interval for level-1 CSNPs\n" | |
2327 | "Specify interval for level-2 CSNPs\n") | |
2328 | { | |
2329 | if (!level || strmatch(level, "level-1")) | |
2330 | nb_cli_enqueue_change(vty, | |
2331 | "./frr-isisd:isis/csnp-interval/level-1", | |
2332 | NB_OP_MODIFY, NULL); | |
2333 | if (!level || strmatch(level, "level-2")) | |
2334 | nb_cli_enqueue_change(vty, | |
2335 | "./frr-isisd:isis/csnp-interval/level-2", | |
2336 | NB_OP_MODIFY, NULL); | |
2337 | ||
2338 | return nb_cli_apply_changes(vty, NULL); | |
2339 | } | |
2340 | ||
25605051 IR |
2341 | void cli_show_ip_isis_csnp_interval(struct vty *vty, |
2342 | const struct lyd_node *dnode, | |
9ce808b9 EDP |
2343 | bool show_defaults) |
2344 | { | |
2345 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
2346 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
2347 | ||
2348 | if (strmatch(l1, l2)) | |
2349 | vty_out(vty, " isis csnp-interval %s\n", l1); | |
2350 | else { | |
2351 | vty_out(vty, " isis csnp-interval %s level-1\n", l1); | |
2352 | vty_out(vty, " isis csnp-interval %s level-2\n", l2); | |
2353 | } | |
2354 | } | |
2355 | ||
2356 | /* | |
2357 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval | |
2358 | */ | |
ca77b518 | 2359 | DEFPY_YANG(psnp_interval, psnp_interval_cmd, |
9ce808b9 EDP |
2360 | "isis psnp-interval (1-120)$intv [level-1|level-2]$level", |
2361 | "IS-IS routing protocol\n" | |
2362 | "Set PSNP interval in seconds\n" | |
2363 | "PSNP interval value\n" | |
2364 | "Specify interval for level-1 PSNPs\n" | |
2365 | "Specify interval for level-2 PSNPs\n") | |
2366 | { | |
2367 | if (!level || strmatch(level, "level-1")) | |
2368 | nb_cli_enqueue_change(vty, | |
2369 | "./frr-isisd:isis/psnp-interval/level-1", | |
2370 | NB_OP_MODIFY, intv_str); | |
2371 | if (!level || strmatch(level, "level-2")) | |
2372 | nb_cli_enqueue_change(vty, | |
2373 | "./frr-isisd:isis/psnp-interval/level-2", | |
2374 | NB_OP_MODIFY, intv_str); | |
2375 | ||
2376 | return nb_cli_apply_changes(vty, NULL); | |
2377 | } | |
2378 | ||
ca77b518 | 2379 | DEFPY_YANG(no_psnp_interval, no_psnp_interval_cmd, |
9ce808b9 EDP |
2380 | "no isis psnp-interval [(1-120)] [level-1|level-2]$level", |
2381 | NO_STR | |
2382 | "IS-IS routing protocol\n" | |
2383 | "Set PSNP interval in seconds\n" | |
2384 | "PSNP interval value\n" | |
2385 | "Specify interval for level-1 PSNPs\n" | |
2386 | "Specify interval for level-2 PSNPs\n") | |
2387 | { | |
2388 | if (!level || strmatch(level, "level-1")) | |
2389 | nb_cli_enqueue_change(vty, | |
2390 | "./frr-isisd:isis/psnp-interval/level-1", | |
2391 | NB_OP_MODIFY, NULL); | |
2392 | if (!level || strmatch(level, "level-2")) | |
2393 | nb_cli_enqueue_change(vty, | |
2394 | "./frr-isisd:isis/psnp-interval/level-2", | |
2395 | NB_OP_MODIFY, NULL); | |
2396 | ||
2397 | return nb_cli_apply_changes(vty, NULL); | |
2398 | } | |
2399 | ||
25605051 IR |
2400 | void cli_show_ip_isis_psnp_interval(struct vty *vty, |
2401 | const struct lyd_node *dnode, | |
9ce808b9 EDP |
2402 | bool show_defaults) |
2403 | { | |
2404 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
2405 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
2406 | ||
2407 | if (strmatch(l1, l2)) | |
2408 | vty_out(vty, " isis psnp-interval %s\n", l1); | |
2409 | else { | |
2410 | vty_out(vty, " isis psnp-interval %s level-1\n", l1); | |
2411 | vty_out(vty, " isis psnp-interval %s level-2\n", l2); | |
2412 | } | |
2413 | } | |
2414 | ||
83d043f6 EDP |
2415 | /* |
2416 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/multi-topology | |
2417 | */ | |
ca77b518 | 2418 | DEFPY_YANG(circuit_topology, circuit_topology_cmd, |
a15014f3 | 2419 | "[no] isis topology<standard|ipv4-unicast|ipv4-mgmt|ipv6-unicast|ipv4-multicast|ipv6-multicast|ipv6-mgmt|ipv6-dstsrc>$topology", |
83d043f6 EDP |
2420 | NO_STR |
2421 | "IS-IS routing protocol\n" | |
2422 | "Configure interface IS-IS topologies\n" | |
a15014f3 | 2423 | "Standard topology\n" |
83d043f6 EDP |
2424 | "IPv4 unicast topology\n" |
2425 | "IPv4 management topology\n" | |
2426 | "IPv6 unicast topology\n" | |
2427 | "IPv4 multicast topology\n" | |
2428 | "IPv6 multicast topology\n" | |
2429 | "IPv6 management topology\n" | |
2430 | "IPv6 dst-src topology\n") | |
2431 | { | |
2432 | nb_cli_enqueue_change(vty, ".", NB_OP_MODIFY, no ? "false" : "true"); | |
2433 | ||
2434 | if (strmatch(topology, "ipv4-mgmt")) | |
2435 | return nb_cli_apply_changes( | |
2436 | vty, "./frr-isisd:isis/multi-topology/ipv4-management"); | |
2437 | else if (strmatch(topology, "ipv6-mgmt")) | |
2438 | return nb_cli_apply_changes( | |
2439 | vty, "./frr-isisd:isis/multi-topology/ipv6-management"); | |
a15014f3 PG |
2440 | if (strmatch(topology, "ipv4-unicast")) |
2441 | return nb_cli_apply_changes( | |
2442 | vty, "./frr-isisd:isis/multi-topology/standard"); | |
83d043f6 EDP |
2443 | else |
2444 | return nb_cli_apply_changes( | |
2445 | vty, "./frr-isisd:isis/multi-topology/%s", topology); | |
2446 | } | |
2447 | ||
a15014f3 PG |
2448 | void cli_show_ip_isis_mt_standard(struct vty *vty, const struct lyd_node *dnode, |
2449 | bool show_defaults) | |
83d043f6 EDP |
2450 | { |
2451 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2452 | vty_out(vty, " no"); | |
a15014f3 | 2453 | vty_out(vty, " isis topology standard\n"); |
83d043f6 EDP |
2454 | } |
2455 | ||
25605051 IR |
2456 | void cli_show_ip_isis_mt_ipv4_multicast(struct vty *vty, |
2457 | const struct lyd_node *dnode, | |
83d043f6 EDP |
2458 | bool show_defaults) |
2459 | { | |
2460 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2461 | vty_out(vty, " no"); | |
2462 | vty_out(vty, " isis topology ipv4-multicast\n"); | |
2463 | } | |
2464 | ||
25605051 IR |
2465 | void cli_show_ip_isis_mt_ipv4_mgmt(struct vty *vty, |
2466 | const struct lyd_node *dnode, | |
83d043f6 EDP |
2467 | bool show_defaults) |
2468 | { | |
2469 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2470 | vty_out(vty, " no"); | |
2471 | vty_out(vty, " isis topology ipv4-mgmt\n"); | |
2472 | } | |
2473 | ||
25605051 IR |
2474 | void cli_show_ip_isis_mt_ipv6_unicast(struct vty *vty, |
2475 | const struct lyd_node *dnode, | |
83d043f6 EDP |
2476 | bool show_defaults) |
2477 | { | |
2478 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2479 | vty_out(vty, " no"); | |
2480 | vty_out(vty, " isis topology ipv6-unicast\n"); | |
2481 | } | |
2482 | ||
25605051 IR |
2483 | void cli_show_ip_isis_mt_ipv6_multicast(struct vty *vty, |
2484 | const struct lyd_node *dnode, | |
83d043f6 EDP |
2485 | bool show_defaults) |
2486 | { | |
2487 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2488 | vty_out(vty, " no"); | |
2489 | vty_out(vty, " isis topology ipv6-multicast\n"); | |
2490 | } | |
2491 | ||
25605051 IR |
2492 | void cli_show_ip_isis_mt_ipv6_mgmt(struct vty *vty, |
2493 | const struct lyd_node *dnode, | |
83d043f6 EDP |
2494 | bool show_defaults) |
2495 | { | |
2496 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2497 | vty_out(vty, " no"); | |
2498 | vty_out(vty, " isis topology ipv6-mgmt\n"); | |
2499 | } | |
2500 | ||
25605051 IR |
2501 | void cli_show_ip_isis_mt_ipv6_dstsrc(struct vty *vty, |
2502 | const struct lyd_node *dnode, | |
83d043f6 EDP |
2503 | bool show_defaults) |
2504 | { | |
2505 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2506 | vty_out(vty, " no"); | |
2507 | vty_out(vty, " isis topology ipv6-dstsrc\n"); | |
2508 | } | |
2509 | ||
9302fbb6 EDP |
2510 | /* |
2511 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/circuit-type | |
2512 | */ | |
ca77b518 | 2513 | DEFPY_YANG(isis_circuit_type, isis_circuit_type_cmd, |
9302fbb6 EDP |
2514 | "isis circuit-type <level-1|level-1-2|level-2-only>$type", |
2515 | "IS-IS routing protocol\n" | |
2516 | "Configure circuit type for interface\n" | |
2517 | "Level-1 only adjacencies are formed\n" | |
2518 | "Level-1-2 adjacencies are formed\n" | |
2519 | "Level-2 only adjacencies are formed\n") | |
2520 | { | |
2521 | nb_cli_enqueue_change( | |
2522 | vty, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY, | |
2523 | strmatch(type, "level-2-only") ? "level-2" : type); | |
2524 | ||
2525 | return nb_cli_apply_changes(vty, NULL); | |
2526 | } | |
2527 | ||
ca77b518 | 2528 | DEFPY_YANG(no_isis_circuit_type, no_isis_circuit_type_cmd, |
9302fbb6 EDP |
2529 | "no isis circuit-type [level-1|level-1-2|level-2-only]", |
2530 | NO_STR | |
2531 | "IS-IS routing protocol\n" | |
2532 | "Configure circuit type for interface\n" | |
2533 | "Level-1 only adjacencies are formed\n" | |
2534 | "Level-1-2 adjacencies are formed\n" | |
2535 | "Level-2 only adjacencies are formed\n") | |
2536 | { | |
8685be73 | 2537 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type", |
2f9a06f0 | 2538 | NB_OP_MODIFY, NULL); |
8685be73 RW |
2539 | |
2540 | return nb_cli_apply_changes(vty, NULL); | |
9302fbb6 EDP |
2541 | } |
2542 | ||
25605051 | 2543 | void cli_show_ip_isis_circ_type(struct vty *vty, const struct lyd_node *dnode, |
9302fbb6 EDP |
2544 | bool show_defaults) |
2545 | { | |
2546 | int level = yang_dnode_get_enum(dnode, NULL); | |
2547 | ||
2548 | switch (level) { | |
2549 | case IS_LEVEL_1: | |
2550 | vty_out(vty, " isis circuit-type level-1\n"); | |
2551 | break; | |
2552 | case IS_LEVEL_2: | |
2553 | vty_out(vty, " isis circuit-type level-2-only\n"); | |
2554 | break; | |
2555 | case IS_LEVEL_1_AND_2: | |
2556 | vty_out(vty, " isis circuit-type level-1-2\n"); | |
2557 | break; | |
2558 | } | |
2559 | } | |
2560 | ||
d0820765 EDP |
2561 | /* |
2562 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/network-type | |
2563 | */ | |
ca77b518 | 2564 | DEFPY_YANG(isis_network, isis_network_cmd, "[no] isis network point-to-point", |
d0820765 EDP |
2565 | NO_STR |
2566 | "IS-IS routing protocol\n" | |
2567 | "Set network type\n" | |
2568 | "point-to-point network type\n") | |
2569 | { | |
2570 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/network-type", | |
2571 | NB_OP_MODIFY, | |
2572 | no ? "broadcast" : "point-to-point"); | |
2573 | ||
2574 | return nb_cli_apply_changes(vty, NULL); | |
2575 | } | |
2576 | ||
25605051 IR |
2577 | void cli_show_ip_isis_network_type(struct vty *vty, |
2578 | const struct lyd_node *dnode, | |
d0820765 EDP |
2579 | bool show_defaults) |
2580 | { | |
2581 | if (yang_dnode_get_enum(dnode, NULL) != CIRCUIT_T_P2P) | |
2582 | vty_out(vty, " no"); | |
2583 | ||
2584 | vty_out(vty, " isis network point-to-point\n"); | |
2585 | } | |
2586 | ||
d59c2d6b EDP |
2587 | /* |
2588 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority | |
2589 | */ | |
ca77b518 | 2590 | DEFPY_YANG(isis_priority, isis_priority_cmd, |
d59c2d6b EDP |
2591 | "isis priority (0-127)$prio [level-1|level-2]$level", |
2592 | "IS-IS routing protocol\n" | |
2593 | "Set priority for Designated Router election\n" | |
2594 | "Priority value\n" | |
2595 | "Specify priority for level-1 routing\n" | |
2596 | "Specify priority for level-2 routing\n") | |
2597 | { | |
2598 | if (!level || strmatch(level, "level-1")) | |
2599 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-1", | |
2600 | NB_OP_MODIFY, prio_str); | |
2601 | if (!level || strmatch(level, "level-2")) | |
2602 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-2", | |
2603 | NB_OP_MODIFY, prio_str); | |
2604 | ||
2605 | return nb_cli_apply_changes(vty, NULL); | |
2606 | } | |
2607 | ||
ca77b518 | 2608 | DEFPY_YANG(no_isis_priority, no_isis_priority_cmd, |
d59c2d6b EDP |
2609 | "no isis priority [(0-127)] [level-1|level-2]$level", |
2610 | NO_STR | |
2611 | "IS-IS routing protocol\n" | |
2612 | "Set priority for Designated Router election\n" | |
2613 | "Priority value\n" | |
2614 | "Specify priority for level-1 routing\n" | |
2615 | "Specify priority for level-2 routing\n") | |
2616 | { | |
2617 | if (!level || strmatch(level, "level-1")) | |
2618 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-1", | |
2619 | NB_OP_MODIFY, NULL); | |
2620 | if (!level || strmatch(level, "level-2")) | |
2621 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-2", | |
2622 | NB_OP_MODIFY, NULL); | |
2623 | ||
2624 | return nb_cli_apply_changes(vty, NULL); | |
2625 | } | |
2626 | ||
25605051 | 2627 | void cli_show_ip_isis_priority(struct vty *vty, const struct lyd_node *dnode, |
d59c2d6b EDP |
2628 | bool show_defaults) |
2629 | { | |
2630 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
2631 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
2632 | ||
2633 | if (strmatch(l1, l2)) | |
2634 | vty_out(vty, " isis priority %s\n", l1); | |
2635 | else { | |
2636 | vty_out(vty, " isis priority %s level-1\n", l1); | |
2637 | vty_out(vty, " isis priority %s level-2\n", l2); | |
2638 | } | |
2639 | } | |
2640 | ||
ed5d7032 | 2641 | /* |
d20b14bc RW |
2642 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/fast-reroute |
2643 | */ | |
25605051 | 2644 | void cli_show_ip_isis_frr(struct vty *vty, const struct lyd_node *dnode, |
d20b14bc RW |
2645 | bool show_defaults) |
2646 | { | |
2647 | bool l1_enabled, l2_enabled; | |
2648 | bool l1_node_protection, l2_node_protection; | |
ce4eccfa | 2649 | bool l1_link_fallback, l2_link_fallback; |
d20b14bc RW |
2650 | |
2651 | /* Classic LFA */ | |
2652 | l1_enabled = yang_dnode_get_bool(dnode, "./level-1/lfa/enable"); | |
2653 | l2_enabled = yang_dnode_get_bool(dnode, "./level-2/lfa/enable"); | |
2654 | ||
2655 | if (l1_enabled || l2_enabled) { | |
2656 | if (l1_enabled == l2_enabled) { | |
2657 | vty_out(vty, " isis fast-reroute lfa\n"); | |
2658 | vty_out(vty, "\n"); | |
2659 | } else { | |
2660 | if (l1_enabled) | |
2661 | vty_out(vty, | |
2662 | " isis fast-reroute lfa level-1\n"); | |
2663 | if (l2_enabled) | |
2664 | vty_out(vty, | |
2665 | " isis fast-reroute lfa level-2\n"); | |
2666 | } | |
2667 | } | |
2668 | ||
381200be RW |
2669 | /* Remote LFA */ |
2670 | l1_enabled = yang_dnode_get_bool(dnode, "./level-1/remote-lfa/enable"); | |
2671 | l2_enabled = yang_dnode_get_bool(dnode, "./level-2/remote-lfa/enable"); | |
2672 | ||
2673 | if (l1_enabled || l2_enabled) { | |
2674 | if (l1_enabled == l2_enabled) { | |
2675 | vty_out(vty, | |
2676 | " isis fast-reroute remote-lfa tunnel mpls-ldp\n"); | |
2677 | vty_out(vty, "\n"); | |
2678 | } else { | |
2679 | if (l1_enabled) | |
2680 | vty_out(vty, | |
2681 | " isis fast-reroute remote-lfa tunnel mpls-ldp level-1\n"); | |
2682 | if (l2_enabled) | |
2683 | vty_out(vty, | |
2684 | " isis fast-reroute remote-lfa tunnel mpls-ldp level-2\n"); | |
2685 | } | |
2686 | } | |
2687 | ||
d20b14bc RW |
2688 | /* TI-LFA */ |
2689 | l1_enabled = yang_dnode_get_bool(dnode, "./level-1/ti-lfa/enable"); | |
2690 | l2_enabled = yang_dnode_get_bool(dnode, "./level-2/ti-lfa/enable"); | |
2691 | l1_node_protection = | |
2692 | yang_dnode_get_bool(dnode, "./level-1/ti-lfa/node-protection"); | |
2693 | l2_node_protection = | |
2694 | yang_dnode_get_bool(dnode, "./level-2/ti-lfa/node-protection"); | |
ce4eccfa FR |
2695 | l1_link_fallback = |
2696 | yang_dnode_get_bool(dnode, "./level-1/ti-lfa/link-fallback"); | |
2697 | l2_link_fallback = | |
2698 | yang_dnode_get_bool(dnode, "./level-2/ti-lfa/link-fallback"); | |
2699 | ||
d20b14bc RW |
2700 | |
2701 | if (l1_enabled || l2_enabled) { | |
2702 | if (l1_enabled == l2_enabled | |
ce4eccfa FR |
2703 | && l1_node_protection == l2_node_protection |
2704 | && l1_link_fallback == l2_link_fallback) { | |
d20b14bc RW |
2705 | vty_out(vty, " isis fast-reroute ti-lfa"); |
2706 | if (l1_node_protection) | |
2707 | vty_out(vty, " node-protection"); | |
ce4eccfa FR |
2708 | if (l1_link_fallback) |
2709 | vty_out(vty, " link-fallback"); | |
d20b14bc RW |
2710 | vty_out(vty, "\n"); |
2711 | } else { | |
2712 | if (l1_enabled) { | |
2713 | vty_out(vty, | |
2714 | " isis fast-reroute ti-lfa level-1"); | |
2715 | if (l1_node_protection) | |
2716 | vty_out(vty, " node-protection"); | |
ce4eccfa FR |
2717 | if (l1_link_fallback) |
2718 | vty_out(vty, " link-fallback"); | |
d20b14bc RW |
2719 | vty_out(vty, "\n"); |
2720 | } | |
2721 | if (l2_enabled) { | |
2722 | vty_out(vty, | |
2723 | " isis fast-reroute ti-lfa level-2"); | |
2724 | if (l2_node_protection) | |
2725 | vty_out(vty, " node-protection"); | |
ce4eccfa FR |
2726 | if (l2_link_fallback) |
2727 | vty_out(vty, " link-fallback"); | |
d20b14bc RW |
2728 | vty_out(vty, "\n"); |
2729 | } | |
2730 | } | |
2731 | } | |
2732 | } | |
2733 | ||
2734 | /* | |
2735 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-{1,2}/lfa/enable | |
2736 | */ | |
2737 | DEFPY(isis_lfa, isis_lfa_cmd, | |
2738 | "[no] isis fast-reroute lfa [level-1|level-2]$level", | |
2739 | NO_STR | |
2740 | "IS-IS routing protocol\n" | |
2741 | "Interface IP Fast-reroute configuration\n" | |
2742 | "Enable LFA computation\n" | |
2743 | "Enable LFA computation for Level 1 only\n" | |
2744 | "Enable LFA computation for Level 2 only\n") | |
2745 | { | |
2746 | if (!level || strmatch(level, "level-1")) { | |
2747 | if (no) { | |
2748 | nb_cli_enqueue_change( | |
2749 | vty, | |
2750 | "./frr-isisd:isis/fast-reroute/level-1/lfa/enable", | |
2751 | NB_OP_MODIFY, "false"); | |
2752 | } else { | |
2753 | nb_cli_enqueue_change( | |
2754 | vty, | |
2755 | "./frr-isisd:isis/fast-reroute/level-1/lfa/enable", | |
2756 | NB_OP_MODIFY, "true"); | |
2757 | } | |
2758 | } | |
2759 | if (!level || strmatch(level, "level-2")) { | |
2760 | if (no) { | |
2761 | nb_cli_enqueue_change( | |
2762 | vty, | |
2763 | "./frr-isisd:isis/fast-reroute/level-2/lfa/enable", | |
2764 | NB_OP_MODIFY, "false"); | |
2765 | } else { | |
2766 | nb_cli_enqueue_change( | |
2767 | vty, | |
2768 | "./frr-isisd:isis/fast-reroute/level-2/lfa/enable", | |
2769 | NB_OP_MODIFY, "true"); | |
2770 | } | |
2771 | } | |
2772 | ||
2773 | return nb_cli_apply_changes(vty, NULL); | |
2774 | } | |
2775 | ||
2776 | /* | |
2777 | * XPath: | |
2778 | * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-{1,2}/lfa/exclude-interface | |
2779 | */ | |
2780 | DEFPY(isis_lfa_exclude_interface, isis_lfa_exclude_interface_cmd, | |
2781 | "[no] isis fast-reroute lfa [level-1|level-2]$level exclude interface IFNAME$ifname", | |
2782 | NO_STR | |
2783 | "IS-IS routing protocol\n" | |
2784 | "Interface IP Fast-reroute configuration\n" | |
2785 | "Enable LFA computation\n" | |
2786 | "Enable LFA computation for Level 1 only\n" | |
2787 | "Enable LFA computation for Level 2 only\n" | |
2788 | "FRR exclusion information\n" | |
2789 | "Exclude an interface from computation\n" | |
2790 | "Interface name\n") | |
2791 | { | |
2792 | if (!level || strmatch(level, "level-1")) { | |
2793 | if (no) { | |
2794 | nb_cli_enqueue_change( | |
2795 | vty, | |
2796 | "./frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface", | |
2797 | NB_OP_DESTROY, ifname); | |
2798 | } else { | |
2799 | nb_cli_enqueue_change( | |
2800 | vty, | |
2801 | "./frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface", | |
2802 | NB_OP_CREATE, ifname); | |
2803 | } | |
2804 | } | |
2805 | if (!level || strmatch(level, "level-2")) { | |
2806 | if (no) { | |
2807 | nb_cli_enqueue_change( | |
2808 | vty, | |
2809 | "./frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface", | |
2810 | NB_OP_DESTROY, ifname); | |
2811 | } else { | |
2812 | nb_cli_enqueue_change( | |
2813 | vty, | |
2814 | "./frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface", | |
2815 | NB_OP_CREATE, ifname); | |
2816 | } | |
2817 | } | |
2818 | ||
2819 | return nb_cli_apply_changes(vty, NULL); | |
2820 | } | |
2821 | ||
25605051 IR |
2822 | void cli_show_frr_lfa_exclude_interface(struct vty *vty, |
2823 | const struct lyd_node *dnode, | |
d20b14bc RW |
2824 | bool show_defaults) |
2825 | { | |
2826 | vty_out(vty, " isis fast-reroute lfa %s exclude interface %s\n", | |
2827 | dnode->parent->parent->schema->name, | |
2828 | yang_dnode_get_string(dnode, NULL)); | |
2829 | } | |
2830 | ||
381200be RW |
2831 | /* |
2832 | * XPath: | |
2833 | * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-{1,2}/remote-lfa/enable | |
2834 | */ | |
2835 | DEFPY(isis_remote_lfa, isis_remote_lfa_cmd, | |
2836 | "[no] isis fast-reroute remote-lfa tunnel mpls-ldp [level-1|level-2]$level", | |
2837 | NO_STR | |
2838 | "IS-IS routing protocol\n" | |
2839 | "Interface IP Fast-reroute configuration\n" | |
2840 | "Enable remote LFA computation\n" | |
2841 | "Enable remote LFA computation using tunnels\n" | |
2842 | "Use MPLS LDP tunnel to reach the remote LFA node\n" | |
2843 | "Enable LFA computation for Level 1 only\n" | |
2844 | "Enable LFA computation for Level 2 only\n") | |
2845 | { | |
2846 | if (!level || strmatch(level, "level-1")) { | |
2847 | if (no) { | |
2848 | nb_cli_enqueue_change( | |
2849 | vty, | |
2850 | "./frr-isisd:isis/fast-reroute/level-1/remote-lfa/enable", | |
2851 | NB_OP_MODIFY, "false"); | |
2852 | } else { | |
2853 | nb_cli_enqueue_change( | |
2854 | vty, | |
2855 | "./frr-isisd:isis/fast-reroute/level-1/remote-lfa/enable", | |
2856 | NB_OP_MODIFY, "true"); | |
2857 | } | |
2858 | } | |
2859 | if (!level || strmatch(level, "level-2")) { | |
2860 | if (no) { | |
2861 | nb_cli_enqueue_change( | |
2862 | vty, | |
2863 | "./frr-isisd:isis/fast-reroute/level-2/remote-lfa/enable", | |
2864 | NB_OP_MODIFY, "false"); | |
2865 | } else { | |
2866 | nb_cli_enqueue_change( | |
2867 | vty, | |
2868 | "./frr-isisd:isis/fast-reroute/level-2/remote-lfa/enable", | |
2869 | NB_OP_MODIFY, "true"); | |
2870 | } | |
2871 | } | |
2872 | ||
2873 | return nb_cli_apply_changes(vty, NULL); | |
2874 | } | |
2875 | ||
2876 | /* | |
2877 | * XPath: | |
2878 | * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-{1,2}/remote-lfa/maximum-metric | |
2879 | */ | |
2880 | DEFPY(isis_remote_lfa_max_metric, isis_remote_lfa_max_metric_cmd, | |
2881 | "[no] isis fast-reroute remote-lfa maximum-metric (1-16777215)$metric [level-1|level-2]$level", | |
2882 | NO_STR | |
2883 | "IS-IS routing protocol\n" | |
2884 | "Interface IP Fast-reroute configuration\n" | |
2885 | "Enable remote LFA computation\n" | |
2886 | "Limit remote LFA node selection within the metric\n" | |
2887 | "Value of the metric\n" | |
2888 | "Enable LFA computation for Level 1 only\n" | |
2889 | "Enable LFA computation for Level 2 only\n") | |
2890 | { | |
2891 | if (!level || strmatch(level, "level-1")) { | |
2892 | if (no) { | |
2893 | nb_cli_enqueue_change( | |
2894 | vty, | |
2895 | "./frr-isisd:isis/fast-reroute/level-1/remote-lfa/maximum-metric", | |
2896 | NB_OP_DESTROY, NULL); | |
2897 | } else { | |
2898 | nb_cli_enqueue_change( | |
2899 | vty, | |
2900 | "./frr-isisd:isis/fast-reroute/level-1/remote-lfa/maximum-metric", | |
2901 | NB_OP_MODIFY, metric_str); | |
2902 | } | |
2903 | } | |
2904 | if (!level || strmatch(level, "level-2")) { | |
2905 | if (no) { | |
2906 | nb_cli_enqueue_change( | |
2907 | vty, | |
2908 | "./frr-isisd:isis/fast-reroute/level-2/remote-lfa/maximum-metric", | |
2909 | NB_OP_DESTROY, NULL); | |
2910 | } else { | |
2911 | nb_cli_enqueue_change( | |
2912 | vty, | |
2913 | "./frr-isisd:isis/fast-reroute/level-2/remote-lfa/maximum-metric", | |
2914 | NB_OP_MODIFY, metric_str); | |
2915 | } | |
2916 | } | |
2917 | ||
2918 | return nb_cli_apply_changes(vty, NULL); | |
2919 | } | |
2920 | ||
25605051 IR |
2921 | void cli_show_frr_remote_lfa_max_metric(struct vty *vty, |
2922 | const struct lyd_node *dnode, | |
381200be RW |
2923 | bool show_defaults) |
2924 | { | |
2925 | vty_out(vty, " isis fast-reroute remote-lfa maximum-metric %s %s\n", | |
2926 | yang_dnode_get_string(dnode, NULL), | |
2927 | dnode->parent->parent->schema->name); | |
2928 | } | |
2929 | ||
d20b14bc RW |
2930 | /* |
2931 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-{1,2}/ti-lfa/enable | |
ed5d7032 RW |
2932 | */ |
2933 | DEFPY(isis_ti_lfa, isis_ti_lfa_cmd, | |
ce4eccfa | 2934 | "[no] isis fast-reroute ti-lfa [level-1|level-2]$level [node-protection$node_protection [link-fallback$link_fallback]]", |
ed5d7032 RW |
2935 | NO_STR |
2936 | "IS-IS routing protocol\n" | |
2937 | "Interface IP Fast-reroute configuration\n" | |
2938 | "Enable TI-LFA computation\n" | |
2939 | "Enable TI-LFA computation for Level 1 only\n" | |
2940 | "Enable TI-LFA computation for Level 2 only\n" | |
ce4eccfa FR |
2941 | "Protect against node failures\n" |
2942 | "Enable link-protection fallback\n") | |
ed5d7032 RW |
2943 | { |
2944 | if (!level || strmatch(level, "level-1")) { | |
2945 | if (no) { | |
2946 | nb_cli_enqueue_change( | |
2947 | vty, | |
2948 | "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable", | |
2949 | NB_OP_MODIFY, "false"); | |
2950 | nb_cli_enqueue_change( | |
2951 | vty, | |
2952 | "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection", | |
2953 | NB_OP_MODIFY, "false"); | |
ce4eccfa FR |
2954 | nb_cli_enqueue_change( |
2955 | vty, | |
2956 | "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/link-fallback", | |
2957 | NB_OP_MODIFY, "false"); | |
ed5d7032 RW |
2958 | } else { |
2959 | nb_cli_enqueue_change( | |
2960 | vty, | |
2961 | "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable", | |
2962 | NB_OP_MODIFY, "true"); | |
2963 | nb_cli_enqueue_change( | |
2964 | vty, | |
2965 | "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection", | |
2966 | NB_OP_MODIFY, | |
2967 | node_protection ? "true" : "false"); | |
ce4eccfa FR |
2968 | nb_cli_enqueue_change( |
2969 | vty, | |
2970 | "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/link-fallback", | |
2971 | NB_OP_MODIFY, link_fallback ? "true" : "false"); | |
ed5d7032 RW |
2972 | } |
2973 | } | |
2974 | if (!level || strmatch(level, "level-2")) { | |
2975 | if (no) { | |
2976 | nb_cli_enqueue_change( | |
2977 | vty, | |
2978 | "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable", | |
2979 | NB_OP_MODIFY, "false"); | |
2980 | nb_cli_enqueue_change( | |
2981 | vty, | |
2982 | "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection", | |
2983 | NB_OP_MODIFY, "false"); | |
ce4eccfa FR |
2984 | nb_cli_enqueue_change( |
2985 | vty, | |
2986 | "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/link-fallback", | |
2987 | NB_OP_MODIFY, "false"); | |
ed5d7032 RW |
2988 | } else { |
2989 | nb_cli_enqueue_change( | |
2990 | vty, | |
2991 | "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable", | |
2992 | NB_OP_MODIFY, "true"); | |
2993 | nb_cli_enqueue_change( | |
2994 | vty, | |
2995 | "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection", | |
2996 | NB_OP_MODIFY, | |
2997 | node_protection ? "true" : "false"); | |
ce4eccfa FR |
2998 | nb_cli_enqueue_change( |
2999 | vty, | |
3000 | "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/link-fallback", | |
3001 | NB_OP_MODIFY, link_fallback ? "true" : "false"); | |
ed5d7032 RW |
3002 | } |
3003 | } | |
3004 | ||
3005 | return nb_cli_apply_changes(vty, NULL); | |
3006 | } | |
3007 | ||
2adf66ff EDP |
3008 | /* |
3009 | * XPath: /frr-isisd:isis/instance/log-adjacency-changes | |
3010 | */ | |
ca77b518 | 3011 | DEFPY_YANG(log_adj_changes, log_adj_changes_cmd, "[no] log-adjacency-changes", |
2adf66ff EDP |
3012 | NO_STR "Log changes in adjacency state\n") |
3013 | { | |
5f1e5e3f EDP |
3014 | nb_cli_enqueue_change(vty, "./log-adjacency-changes", NB_OP_MODIFY, |
3015 | no ? "false" : "true"); | |
2adf66ff EDP |
3016 | |
3017 | return nb_cli_apply_changes(vty, NULL); | |
3018 | } | |
3019 | ||
25605051 | 3020 | void cli_show_isis_log_adjacency(struct vty *vty, const struct lyd_node *dnode, |
2adf66ff EDP |
3021 | bool show_defaults) |
3022 | { | |
5f1e5e3f EDP |
3023 | if (!yang_dnode_get_bool(dnode, NULL)) |
3024 | vty_out(vty, " no"); | |
2adf66ff EDP |
3025 | vty_out(vty, " log-adjacency-changes\n"); |
3026 | } | |
3027 | ||
9ace83b9 IL |
3028 | /* |
3029 | * XPath: /frr-isisd:isis/instance/log-pdu-drops | |
3030 | */ | |
3031 | DEFPY_YANG(log_pdu_drops, log_pdu_drops_cmd, "[no] log-pdu-drops", | |
3032 | NO_STR "Log any dropped PDUs\n") | |
3033 | { | |
3034 | nb_cli_enqueue_change(vty, "./log-pdu-drops", NB_OP_MODIFY, | |
3035 | no ? "false" : "true"); | |
3036 | ||
3037 | return nb_cli_apply_changes(vty, NULL); | |
3038 | } | |
3039 | ||
3040 | void cli_show_isis_log_pdu_drops(struct vty *vty, const struct lyd_node *dnode, | |
3041 | bool show_defaults) | |
3042 | { | |
3043 | if (!yang_dnode_get_bool(dnode, NULL)) | |
3044 | vty_out(vty, " no"); | |
3045 | vty_out(vty, " log-pdu-drops\n"); | |
3046 | } | |
3047 | ||
1cbf96a8 | 3048 | /* |
3049 | * XPath: /frr-isisd:isis/instance/mpls/ldp-sync | |
3050 | */ | |
3051 | DEFPY(isis_mpls_ldp_sync, isis_mpls_ldp_sync_cmd, "mpls ldp-sync", | |
3052 | MPLS_STR MPLS_LDP_SYNC_STR) | |
3053 | { | |
3054 | nb_cli_enqueue_change(vty, "./mpls/ldp-sync", NB_OP_CREATE, NULL); | |
3055 | ||
3056 | return nb_cli_apply_changes(vty, NULL); | |
3057 | } | |
3058 | ||
3059 | DEFPY(no_isis_mpls_ldp_sync, no_isis_mpls_ldp_sync_cmd, "no mpls ldp-sync", | |
3060 | NO_STR MPLS_STR NO_MPLS_LDP_SYNC_STR) | |
3061 | { | |
3062 | nb_cli_enqueue_change(vty, "./mpls/ldp-sync", NB_OP_DESTROY, NULL); | |
3063 | ||
3064 | return nb_cli_apply_changes(vty, NULL); | |
3065 | } | |
3066 | ||
25605051 | 3067 | void cli_show_isis_mpls_ldp_sync(struct vty *vty, const struct lyd_node *dnode, |
1cbf96a8 | 3068 | bool show_defaults) |
3069 | { | |
3070 | vty_out(vty, " mpls ldp-sync\n"); | |
3071 | } | |
3072 | ||
3073 | DEFPY(isis_mpls_ldp_sync_holddown, isis_mpls_ldp_sync_holddown_cmd, | |
3074 | "mpls ldp-sync holddown (0-10000)", | |
3075 | MPLS_STR MPLS_LDP_SYNC_STR | |
3076 | "Time to wait for LDP-SYNC to occur before restoring interface metric\n" | |
3077 | "Time in seconds\n") | |
3078 | { | |
3079 | nb_cli_enqueue_change(vty, "./mpls/ldp-sync/holddown", NB_OP_MODIFY, | |
3080 | holddown_str); | |
3081 | ||
3082 | return nb_cli_apply_changes(vty, NULL); | |
3083 | } | |
3084 | ||
3085 | DEFPY(no_isis_mpls_ldp_sync_holddown, no_isis_mpls_ldp_sync_holddown_cmd, | |
3086 | "no mpls ldp-sync holddown [<(1-10000)>]", | |
31011d9c | 3087 | NO_STR MPLS_STR MPLS_LDP_SYNC_STR NO_MPLS_LDP_SYNC_HOLDDOWN_STR "Time in seconds\n") |
1cbf96a8 | 3088 | { |
3089 | nb_cli_enqueue_change(vty, "./mpls/ldp-sync/holddown", NB_OP_DESTROY, | |
3090 | NULL); | |
3091 | ||
3092 | return nb_cli_apply_changes(vty, NULL); | |
3093 | } | |
3094 | ||
3095 | void cli_show_isis_mpls_ldp_sync_holddown(struct vty *vty, | |
25605051 | 3096 | const struct lyd_node *dnode, |
1cbf96a8 | 3097 | bool show_defaults) |
3098 | { | |
3099 | vty_out(vty, " mpls ldp-sync holddown %s\n", | |
3100 | yang_dnode_get_string(dnode, NULL)); | |
3101 | } | |
3102 | ||
3103 | /* | |
3104 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/ldp-sync | |
3105 | */ | |
3106 | DEFPY(isis_mpls_if_ldp_sync, isis_mpls_if_ldp_sync_cmd, | |
3107 | "[no] isis mpls ldp-sync", | |
3108 | NO_STR "IS-IS routing protocol\n" MPLS_STR MPLS_LDP_SYNC_STR) | |
3109 | { | |
3110 | const struct lyd_node *dnode; | |
1cbf96a8 | 3111 | |
3bb513c3 CH |
3112 | dnode = yang_dnode_getf(vty->candidate_config->dnode, |
3113 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
1cbf96a8 | 3114 | if (dnode == NULL) { |
3115 | vty_out(vty, "ISIS is not enabled on this circuit\n"); | |
3116 | return CMD_SUCCESS; | |
3117 | } | |
3118 | ||
1cbf96a8 | 3119 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/mpls/ldp-sync", |
3120 | NB_OP_MODIFY, no ? "false" : "true"); | |
3121 | ||
3122 | return nb_cli_apply_changes(vty, NULL); | |
3123 | } | |
3124 | ||
3125 | ||
25605051 IR |
3126 | void cli_show_isis_mpls_if_ldp_sync(struct vty *vty, |
3127 | const struct lyd_node *dnode, | |
1cbf96a8 | 3128 | bool show_defaults) |
3129 | { | |
3130 | if (!yang_dnode_get_bool(dnode, NULL)) | |
3131 | vty_out(vty, " no"); | |
3132 | ||
3133 | vty_out(vty, " isis mpls ldp-sync\n"); | |
3134 | } | |
3135 | ||
3136 | DEFPY(isis_mpls_if_ldp_sync_holddown, isis_mpls_if_ldp_sync_holddown_cmd, | |
3137 | "isis mpls ldp-sync holddown (0-10000)", | |
3138 | "IS-IS routing protocol\n" MPLS_STR MPLS_LDP_SYNC_STR | |
3139 | "Time to wait for LDP-SYNC to occur before restoring interface metric\n" | |
3140 | "Time in seconds\n") | |
3141 | { | |
3142 | const struct lyd_node *dnode; | |
1cbf96a8 | 3143 | |
3bb513c3 CH |
3144 | dnode = yang_dnode_getf(vty->candidate_config->dnode, |
3145 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
1cbf96a8 | 3146 | if (dnode == NULL) { |
3147 | vty_out(vty, "ISIS is not enabled on this circuit\n"); | |
3148 | return CMD_SUCCESS; | |
3149 | } | |
3150 | ||
1cbf96a8 | 3151 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/mpls/holddown", |
3152 | NB_OP_MODIFY, holddown_str); | |
3153 | ||
3154 | return nb_cli_apply_changes(vty, NULL); | |
3155 | } | |
3156 | ||
3157 | DEFPY(no_isis_mpls_if_ldp_sync_holddown, no_isis_mpls_if_ldp_sync_holddown_cmd, | |
3158 | "no isis mpls ldp-sync holddown [<(1-10000)>]", | |
3159 | NO_STR "IS-IS routing protocol\n" MPLS_STR NO_MPLS_LDP_SYNC_STR | |
31011d9c | 3160 | NO_MPLS_LDP_SYNC_HOLDDOWN_STR "Time in seconds\n") |
1cbf96a8 | 3161 | { |
3162 | const struct lyd_node *dnode; | |
1cbf96a8 | 3163 | |
3bb513c3 CH |
3164 | dnode = yang_dnode_getf(vty->candidate_config->dnode, |
3165 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
1cbf96a8 | 3166 | if (dnode == NULL) { |
3167 | vty_out(vty, "ISIS is not enabled on this circuit\n"); | |
3168 | return CMD_SUCCESS; | |
3169 | } | |
3170 | ||
1cbf96a8 | 3171 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/mpls/holddown", |
3172 | NB_OP_DESTROY, NULL); | |
3173 | ||
3174 | return nb_cli_apply_changes(vty, NULL); | |
3175 | } | |
3176 | ||
3177 | void cli_show_isis_mpls_if_ldp_sync_holddown(struct vty *vty, | |
25605051 | 3178 | const struct lyd_node *dnode, |
1cbf96a8 | 3179 | bool show_defaults) |
3180 | { | |
3181 | vty_out(vty, " isis mpls ldp-sync holddown %s\n", | |
3182 | yang_dnode_get_string(dnode, NULL)); | |
3183 | } | |
3184 | ||
20bd27e2 EDP |
3185 | void isis_cli_init(void) |
3186 | { | |
aaf2fd21 EDP |
3187 | install_element(CONFIG_NODE, &router_isis_cmd); |
3188 | install_element(CONFIG_NODE, &no_router_isis_cmd); | |
3189 | ||
3190 | install_element(INTERFACE_NODE, &ip_router_isis_cmd); | |
1457b1d5 | 3191 | install_element(INTERFACE_NODE, &ip_router_isis_vrf_cmd); |
aaf2fd21 | 3192 | install_element(INTERFACE_NODE, &ip6_router_isis_cmd); |
1457b1d5 | 3193 | install_element(INTERFACE_NODE, &ip6_router_isis_vrf_cmd); |
aaf2fd21 | 3194 | install_element(INTERFACE_NODE, &no_ip_router_isis_cmd); |
1457b1d5 | 3195 | install_element(INTERFACE_NODE, &no_ip_router_isis_vrf_cmd); |
c3e6ac0b | 3196 | install_element(INTERFACE_NODE, &isis_bfd_cmd); |
4affdba7 | 3197 | install_element(INTERFACE_NODE, &isis_bfd_profile_cmd); |
f084ea55 EDP |
3198 | |
3199 | install_element(ISIS_NODE, &net_cmd); | |
e6bdae69 EDP |
3200 | |
3201 | install_element(ISIS_NODE, &is_type_cmd); | |
3202 | install_element(ISIS_NODE, &no_is_type_cmd); | |
6bb043cd EDP |
3203 | |
3204 | install_element(ISIS_NODE, &dynamic_hostname_cmd); | |
05a3f9f0 EDP |
3205 | |
3206 | install_element(ISIS_NODE, &set_overload_bit_cmd); | |
01ea9b03 IL |
3207 | install_element(ISIS_NODE, &set_overload_bit_on_startup_cmd); |
3208 | install_element(ISIS_NODE, &no_set_overload_bit_on_startup_cmd); | |
3209 | ||
f3abc412 | 3210 | install_element(ISIS_NODE, &attached_bit_send_cmd); |
3211 | install_element(ISIS_NODE, &attached_bit_receive_ignore_cmd); | |
e0df3206 EDP |
3212 | |
3213 | install_element(ISIS_NODE, &metric_style_cmd); | |
3214 | install_element(ISIS_NODE, &no_metric_style_cmd); | |
933536e3 | 3215 | |
d74f913c IL |
3216 | install_element(ISIS_NODE, &advertise_high_metrics_cmd); |
3217 | ||
933536e3 EDP |
3218 | install_element(ISIS_NODE, &area_passwd_cmd); |
3219 | install_element(ISIS_NODE, &domain_passwd_cmd); | |
3220 | install_element(ISIS_NODE, &no_area_passwd_cmd); | |
1d6fe72e EDP |
3221 | |
3222 | install_element(ISIS_NODE, &lsp_gen_interval_cmd); | |
3223 | install_element(ISIS_NODE, &no_lsp_gen_interval_cmd); | |
7e869004 EDP |
3224 | install_element(ISIS_NODE, &lsp_refresh_interval_cmd); |
3225 | install_element(ISIS_NODE, &no_lsp_refresh_interval_cmd); | |
ea120aa0 EDP |
3226 | install_element(ISIS_NODE, &max_lsp_lifetime_cmd); |
3227 | install_element(ISIS_NODE, &no_max_lsp_lifetime_cmd); | |
d2c970ff EDP |
3228 | install_element(ISIS_NODE, &lsp_timers_cmd); |
3229 | install_element(ISIS_NODE, &no_lsp_timers_cmd); | |
27a45d16 EDP |
3230 | install_element(ISIS_NODE, &area_lsp_mtu_cmd); |
3231 | install_element(ISIS_NODE, &no_area_lsp_mtu_cmd); | |
3f3608d8 | 3232 | install_element(ISIS_NODE, &advertise_passive_only_cmd); |
dcb1dcd6 EDP |
3233 | |
3234 | install_element(ISIS_NODE, &spf_interval_cmd); | |
3235 | install_element(ISIS_NODE, &no_spf_interval_cmd); | |
d20b14bc RW |
3236 | install_element(ISIS_NODE, &spf_prefix_priority_cmd); |
3237 | install_element(ISIS_NODE, &no_spf_prefix_priority_cmd); | |
5336ba30 EDP |
3238 | install_element(ISIS_NODE, &spf_delay_ietf_cmd); |
3239 | install_element(ISIS_NODE, &no_spf_delay_ietf_cmd); | |
66e45e10 EDP |
3240 | |
3241 | install_element(ISIS_NODE, &area_purge_originator_cmd); | |
d1a80ef6 EDP |
3242 | |
3243 | install_element(ISIS_NODE, &isis_mpls_te_on_cmd); | |
3244 | install_element(ISIS_NODE, &no_isis_mpls_te_on_cmd); | |
3245 | install_element(ISIS_NODE, &isis_mpls_te_router_addr_cmd); | |
2e2a8b91 | 3246 | install_element(ISIS_NODE, &no_isis_mpls_te_router_addr_cmd); |
173f8887 OD |
3247 | install_element(ISIS_NODE, &isis_mpls_te_router_addr_v6_cmd); |
3248 | install_element(ISIS_NODE, &no_isis_mpls_te_router_addr_v6_cmd); | |
d1a80ef6 | 3249 | install_element(ISIS_NODE, &isis_mpls_te_inter_as_cmd); |
ed6189a9 OD |
3250 | install_element(ISIS_NODE, &isis_mpls_te_export_cmd); |
3251 | install_element(ISIS_NODE, &no_isis_mpls_te_export_cmd); | |
8b104c10 EDP |
3252 | |
3253 | install_element(ISIS_NODE, &isis_default_originate_cmd); | |
a041ac8e | 3254 | install_element(ISIS_NODE, &isis_redistribute_cmd); |
22af6a80 EDP |
3255 | |
3256 | install_element(ISIS_NODE, &isis_topology_cmd); | |
a6a36c41 | 3257 | |
8f6c8936 RW |
3258 | install_element(ISIS_NODE, &isis_sr_enable_cmd); |
3259 | install_element(ISIS_NODE, &no_isis_sr_enable_cmd); | |
3260 | install_element(ISIS_NODE, &isis_sr_global_block_label_range_cmd); | |
3261 | install_element(ISIS_NODE, &no_isis_sr_global_block_label_range_cmd); | |
3262 | install_element(ISIS_NODE, &isis_sr_node_msd_cmd); | |
3263 | install_element(ISIS_NODE, &no_isis_sr_node_msd_cmd); | |
3264 | install_element(ISIS_NODE, &isis_sr_prefix_sid_cmd); | |
3265 | install_element(ISIS_NODE, &no_isis_sr_prefix_sid_cmd); | |
d20b14bc RW |
3266 | install_element(ISIS_NODE, &isis_frr_lfa_priority_limit_cmd); |
3267 | install_element(ISIS_NODE, &isis_frr_lfa_tiebreaker_cmd); | |
3268 | install_element(ISIS_NODE, &isis_frr_lfa_load_sharing_cmd); | |
381200be RW |
3269 | install_element(ISIS_NODE, &isis_frr_remote_lfa_plist_cmd); |
3270 | install_element(ISIS_NODE, &no_isis_frr_remote_lfa_plist_cmd); | |
8f6c8936 | 3271 | |
a6a36c41 | 3272 | install_element(INTERFACE_NODE, &isis_passive_cmd); |
3e20c83a EDP |
3273 | |
3274 | install_element(INTERFACE_NODE, &isis_passwd_cmd); | |
3275 | install_element(INTERFACE_NODE, &no_isis_passwd_cmd); | |
be49219c EDP |
3276 | |
3277 | install_element(INTERFACE_NODE, &isis_metric_cmd); | |
3278 | install_element(INTERFACE_NODE, &no_isis_metric_cmd); | |
356a2e3c EDP |
3279 | |
3280 | install_element(INTERFACE_NODE, &isis_hello_interval_cmd); | |
3281 | install_element(INTERFACE_NODE, &no_isis_hello_interval_cmd); | |
4e75a67d EDP |
3282 | |
3283 | install_element(INTERFACE_NODE, &isis_hello_multiplier_cmd); | |
3284 | install_element(INTERFACE_NODE, &no_isis_hello_multiplier_cmd); | |
5f2ce446 EDP |
3285 | |
3286 | install_element(INTERFACE_NODE, &isis_threeway_adj_cmd); | |
7b6b75e5 EDP |
3287 | |
3288 | install_element(INTERFACE_NODE, &isis_hello_padding_cmd); | |
9ce808b9 EDP |
3289 | |
3290 | install_element(INTERFACE_NODE, &csnp_interval_cmd); | |
3291 | install_element(INTERFACE_NODE, &no_csnp_interval_cmd); | |
3292 | ||
3293 | install_element(INTERFACE_NODE, &psnp_interval_cmd); | |
3294 | install_element(INTERFACE_NODE, &no_psnp_interval_cmd); | |
83d043f6 EDP |
3295 | |
3296 | install_element(INTERFACE_NODE, &circuit_topology_cmd); | |
9302fbb6 EDP |
3297 | |
3298 | install_element(INTERFACE_NODE, &isis_circuit_type_cmd); | |
3299 | install_element(INTERFACE_NODE, &no_isis_circuit_type_cmd); | |
d0820765 EDP |
3300 | |
3301 | install_element(INTERFACE_NODE, &isis_network_cmd); | |
d59c2d6b EDP |
3302 | |
3303 | install_element(INTERFACE_NODE, &isis_priority_cmd); | |
3304 | install_element(INTERFACE_NODE, &no_isis_priority_cmd); | |
2adf66ff | 3305 | |
d20b14bc RW |
3306 | install_element(INTERFACE_NODE, &isis_lfa_cmd); |
3307 | install_element(INTERFACE_NODE, &isis_lfa_exclude_interface_cmd); | |
381200be RW |
3308 | install_element(INTERFACE_NODE, &isis_remote_lfa_cmd); |
3309 | install_element(INTERFACE_NODE, &isis_remote_lfa_max_metric_cmd); | |
ed5d7032 RW |
3310 | install_element(INTERFACE_NODE, &isis_ti_lfa_cmd); |
3311 | ||
2adf66ff | 3312 | install_element(ISIS_NODE, &log_adj_changes_cmd); |
9ace83b9 | 3313 | install_element(ISIS_NODE, &log_pdu_drops_cmd); |
1cbf96a8 | 3314 | |
3315 | install_element(ISIS_NODE, &isis_mpls_ldp_sync_cmd); | |
3316 | install_element(ISIS_NODE, &no_isis_mpls_ldp_sync_cmd); | |
3317 | install_element(ISIS_NODE, &isis_mpls_ldp_sync_holddown_cmd); | |
3318 | install_element(ISIS_NODE, &no_isis_mpls_ldp_sync_holddown_cmd); | |
3319 | install_element(INTERFACE_NODE, &isis_mpls_if_ldp_sync_cmd); | |
3320 | install_element(INTERFACE_NODE, &isis_mpls_if_ldp_sync_holddown_cmd); | |
3321 | install_element(INTERFACE_NODE, &no_isis_mpls_if_ldp_sync_holddown_cmd); | |
20bd27e2 EDP |
3322 | } |
3323 | ||
3324 | #endif /* ifndef FABRICD */ |