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