2 * Copyright (C) 2001,2002 Sampo Saaristo
3 * Tampere University of Technology
4 * Institute of Communications Engineering
5 * Copyright (C) 2018 Volta Networks
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #include "northbound_cli.h"
33 #include "lib/linklist.h"
34 #include "isisd/isisd.h"
35 #include "isisd/isis_cli.h"
36 #include "isisd/isis_misc.h"
37 #include "isisd/isis_circuit.h"
38 #include "isisd/isis_csm.h"
40 #ifndef VTYSH_EXTRACT_PL
41 #include "isisd/isis_cli_clippy.c"
47 * XPath: /frr-isisd:isis/instance
49 DEFPY_NOSH(router_isis
, router_isis_cmd
, "router isis WORD$tag",
52 "ISO Routing area tag\n")
55 char base_xpath
[XPATH_MAXLEN
];
57 snprintf(base_xpath
, XPATH_MAXLEN
,
58 "/frr-isisd:isis/instance[area-tag='%s']", tag
);
59 nb_cli_enqueue_change(vty
, ".", NB_OP_CREATE
, NULL
);
60 /* default value in yang for is-type is level-1, but in FRR
61 * the first instance is assigned is-type level-1-2. We
62 * need to make sure to set it in the yang model so that it
63 * is consistent with what FRR sees.
65 if (listcount(isis
->area_list
) == 0)
66 nb_cli_enqueue_change(vty
, "./is-type", NB_OP_MODIFY
,
68 ret
= nb_cli_apply_changes(vty
, base_xpath
);
69 if (ret
== CMD_SUCCESS
)
70 VTY_PUSH_XPATH(ISIS_NODE
, base_xpath
);
75 DEFPY(no_router_isis
, no_router_isis_cmd
, "no router isis WORD$tag",
78 "ISO Routing area tag\n")
80 char temp_xpath
[XPATH_MAXLEN
];
81 struct listnode
*node
, *nnode
;
82 struct isis_circuit
*circuit
= NULL
;
83 struct isis_area
*area
= NULL
;
85 area
= isis_area_lookup(tag
);
87 vty_out(vty
, "ISIS area %s not found.\n", tag
);
88 return CMD_ERR_NOTHING_TODO
;
91 nb_cli_enqueue_change(vty
, ".", NB_OP_DELETE
, NULL
);
92 if (area
->circuit_list
&& listcount(area
->circuit_list
)) {
93 for (ALL_LIST_ELEMENTS(area
->circuit_list
, node
, nnode
,
95 /* add callbacks to delete each of the circuits listed
97 const char *vrf_name
=
98 vrf_lookup_by_id(circuit
->interface
->vrf_id
)
101 temp_xpath
, XPATH_MAXLEN
,
102 "/frr-interface:lib/interface[name='%s'][vrf='%s']/frr-isisd:isis",
103 circuit
->interface
->name
, vrf_name
);
104 nb_cli_enqueue_change(vty
, temp_xpath
, NB_OP_DELETE
,
109 return nb_cli_apply_changes(
110 vty
, "/frr-isisd:isis/instance[area-tag='%s']", tag
);
113 void cli_show_router_isis(struct vty
*vty
, struct lyd_node
*dnode
,
117 vty_out(vty
, "router isis %s\n",
118 yang_dnode_get_string(dnode
, "./area-tag"));
122 * XPath: /frr-interface:lib/interface/frr-isisd:isis/
123 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing
124 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing
125 * XPath: /frr-isisd:isis/instance
127 DEFPY(ip_router_isis
, ip_router_isis_cmd
, "ip router isis WORD$tag",
128 "Interface Internet Protocol config commands\n"
129 "IP router interface commands\n"
130 "IS-IS routing protocol\n"
131 "Routing process tag\n")
133 char temp_xpath
[XPATH_MAXLEN
];
134 const char *circ_type
;
135 struct isis_area
*area
;
137 /* area will be created if it is not present. make sure the yang model
138 * is synced with FRR and call the appropriate NB cb.
140 area
= isis_area_lookup(tag
);
142 snprintf(temp_xpath
, XPATH_MAXLEN
,
143 "/frr-isisd:isis/instance[area-tag='%s']", tag
);
144 nb_cli_enqueue_change(vty
, temp_xpath
, NB_OP_CREATE
, tag
);
145 snprintf(temp_xpath
, XPATH_MAXLEN
,
146 "/frr-isisd:isis/instance[area-tag='%s']/is-type",
148 nb_cli_enqueue_change(
149 vty
, temp_xpath
, NB_OP_MODIFY
,
150 listcount(isis
->area_list
) == 0 ? "level-1-2" : NULL
);
151 nb_cli_enqueue_change(vty
, "./frr-isisd:isis", NB_OP_CREATE
,
153 nb_cli_enqueue_change(vty
, "./frr-isisd:isis/area-tag",
155 nb_cli_enqueue_change(vty
, "./frr-isisd:isis/ipv4-routing",
157 nb_cli_enqueue_change(
158 vty
, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY
,
159 listcount(isis
->area_list
) == 0 ? "level-1-2"
162 /* area exists, circuit type defaults to its area's is_type */
163 switch (area
->is_type
) {
165 circ_type
= "level-1";
168 circ_type
= "level-2";
170 case IS_LEVEL_1_AND_2
:
171 circ_type
= "level-1-2";
174 nb_cli_enqueue_change(vty
, "./frr-isisd:isis", NB_OP_CREATE
,
176 nb_cli_enqueue_change(vty
, "./frr-isisd:isis/area-tag",
178 nb_cli_enqueue_change(vty
, "./frr-isisd:isis/ipv4-routing",
180 nb_cli_enqueue_change(vty
, "./frr-isisd:isis/circuit-type",
181 NB_OP_MODIFY
, circ_type
);
184 return nb_cli_apply_changes(vty
, NULL
);
187 DEFPY(ip6_router_isis
, ip6_router_isis_cmd
, "ipv6 router isis WORD$tag",
188 "Interface Internet Protocol config commands\n"
189 "IP router interface commands\n"
190 "IS-IS routing protocol\n"
191 "Routing process tag\n")
193 char temp_xpath
[XPATH_MAXLEN
];
194 const char *circ_type
;
195 struct isis_area
*area
;
197 /* area will be created if it is not present. make sure the yang model
198 * is synced with FRR and call the appropriate NB cb.
200 area
= isis_area_lookup(tag
);
202 snprintf(temp_xpath
, XPATH_MAXLEN
,
203 "/frr-isisd:isis/instance[area-tag='%s']", tag
);
204 nb_cli_enqueue_change(vty
, temp_xpath
, NB_OP_CREATE
, tag
);
205 snprintf(temp_xpath
, XPATH_MAXLEN
,
206 "/frr-isisd:isis/instance[area-tag='%s']/is-type",
208 nb_cli_enqueue_change(
209 vty
, temp_xpath
, NB_OP_MODIFY
,
210 listcount(isis
->area_list
) == 0 ? "level-1-2" : NULL
);
211 nb_cli_enqueue_change(vty
, "./frr-isisd:isis", NB_OP_CREATE
,
213 nb_cli_enqueue_change(vty
, "./frr-isisd:isis/area-tag",
215 nb_cli_enqueue_change(vty
, "./frr-isisd:isis/ipv6-routing",
217 nb_cli_enqueue_change(
218 vty
, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY
,
219 listcount(isis
->area_list
) == 0 ? "level-1-2"
222 /* area exists, circuit type defaults to its area's is_type */
223 switch (area
->is_type
) {
225 circ_type
= "level-1";
228 circ_type
= "level-2";
230 case IS_LEVEL_1_AND_2
:
231 circ_type
= "level-1-2";
234 nb_cli_enqueue_change(vty
, "./frr-isisd:isis", NB_OP_CREATE
,
236 nb_cli_enqueue_change(vty
, "./frr-isisd:isis/area-tag",
238 nb_cli_enqueue_change(vty
, "./frr-isisd:isis/ipv6-routing",
240 nb_cli_enqueue_change(vty
, "./frr-isisd:isis/circuit-type",
241 NB_OP_MODIFY
, circ_type
);
244 return nb_cli_apply_changes(vty
, NULL
);
247 DEFPY(no_ip_router_isis
, no_ip_router_isis_cmd
,
248 "no <ip|ipv6>$ip router isis [WORD]$tag",
250 "Interface Internet Protocol config commands\n"
251 "IP router interface commands\n"
252 "IP router interface commands\n"
253 "IS-IS routing protocol\n"
254 "Routing process tag\n")
256 const struct lyd_node
*dnode
=
257 yang_dnode_get(running_config
->dnode
, VTY_CURR_XPATH
);
258 struct interface
*ifp
;
259 struct isis_circuit
*circuit
= NULL
;
261 /* check for the existance of a circuit */
263 ifp
= yang_dnode_get_entry(dnode
, false);
265 circuit
= circuit_scan_by_ifp(ifp
);
268 /* if both ipv4 and ipv6 are off delete the interface isis container too
270 if (!strncmp(ip
, "ipv6", strlen("ipv6"))) {
271 if (circuit
&& !circuit
->ip_router
)
272 nb_cli_enqueue_change(vty
, "./frr-isisd:isis",
275 nb_cli_enqueue_change(vty
,
276 "./frr-isisd:isis/ipv6-routing",
278 } else { /* no ipv4 */
279 if (circuit
&& !circuit
->ipv6_router
)
280 nb_cli_enqueue_change(vty
, "./frr-isisd:isis",
283 nb_cli_enqueue_change(vty
,
284 "./frr-isisd:isis/ipv4-routing",
288 return nb_cli_apply_changes(vty
, NULL
);
291 void cli_show_ip_isis_ipv4(struct vty
*vty
, struct lyd_node
*dnode
,
294 vty_out(vty
, " ip router isis %s\n",
295 yang_dnode_get_string(dnode
, "../area-tag"));
298 void cli_show_ip_isis_ipv6(struct vty
*vty
, struct lyd_node
*dnode
,
301 vty_out(vty
, " ipv6 router isis %s\n",
302 yang_dnode_get_string(dnode
, "../area-tag"));
306 * XPath: /frr-isisd:isis/instance/area-address
308 DEFPY(net
, net_cmd
, "[no] net WORD",
309 "Remove an existing Network Entity Title for this process\n"
310 "A Network Entity Title for this process (OSI only)\n"
311 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
313 nb_cli_enqueue_change(vty
, "./area-address",
314 no
? NB_OP_DELETE
: NB_OP_CREATE
, net
);
316 return nb_cli_apply_changes(vty
, NULL
);
319 void cli_show_isis_area_address(struct vty
*vty
, struct lyd_node
*dnode
,
322 vty_out(vty
, " net %s\n", yang_dnode_get_string(dnode
, NULL
));
326 * XPath: /frr-isisd:isis/instance/is-type
328 DEFPY(is_type
, is_type_cmd
, "is-type <level-1|level-1-2|level-2-only>$level",
329 "IS Level for this routing process (OSI only)\n"
330 "Act as a station router only\n"
331 "Act as both a station router and an area router\n"
332 "Act as an area router only\n")
334 nb_cli_enqueue_change(vty
, "./is-type", NB_OP_MODIFY
,
335 strmatch(level
, "level-2-only") ? "level-2"
338 return nb_cli_apply_changes(vty
, NULL
);
341 DEFPY(no_is_type
, no_is_type_cmd
,
342 "no is-type [<level-1|level-1-2|level-2-only>]",
344 "IS Level for this routing process (OSI only)\n"
345 "Act as a station router only\n"
346 "Act as both a station router and an area router\n"
347 "Act as an area router only\n")
349 const char *value
= NULL
;
350 const struct lyd_node
*dnode
=
351 yang_dnode_get(running_config
->dnode
, VTY_CURR_XPATH
);
352 struct isis_area
*area
= yang_dnode_get_entry(dnode
, false);
355 * Put the is-type back to defaults:
356 * - level-1-2 on first area
357 * - level-1 for the rest
359 if (area
&& listgetdata(listhead(isis
->area_list
)) == area
)
363 nb_cli_enqueue_change(vty
, "./is-type", NB_OP_MODIFY
, value
);
365 return nb_cli_apply_changes(vty
, NULL
);
368 void cli_show_isis_is_type(struct vty
*vty
, struct lyd_node
*dnode
,
371 int is_type
= yang_dnode_get_enum(dnode
, NULL
);
375 vty_out(vty
, " is-type level-1\n");
378 vty_out(vty
, " is-type level-2-only\n");
380 case IS_LEVEL_1_AND_2
:
381 vty_out(vty
, " is-type level-1-2\n");
387 * XPath: /frr-isisd:isis/instance/dynamic-hostname
389 DEFPY(dynamic_hostname
, dynamic_hostname_cmd
, "[no] hostname dynamic",
391 "Dynamic hostname for IS-IS\n"
392 "Dynamic hostname\n")
394 nb_cli_enqueue_change(vty
, "./dynamic-hostname", NB_OP_MODIFY
,
395 no
? "false" : "true");
397 return nb_cli_apply_changes(vty
, NULL
);
400 void cli_show_isis_dynamic_hostname(struct vty
*vty
, struct lyd_node
*dnode
,
403 if (!yang_dnode_get_bool(dnode
, NULL
))
406 vty_out(vty
, " hostname dynamic\n");
410 * XPath: /frr-isisd:isis/instance/overload
412 DEFPY(set_overload_bit
, set_overload_bit_cmd
, "[no] set-overload-bit",
413 "Reset overload bit to accept transit traffic\n"
414 "Set overload bit to avoid any transit traffic\n")
416 nb_cli_enqueue_change(vty
, "./overload",
417 no
? NB_OP_DELETE
: NB_OP_CREATE
, NULL
);
419 return nb_cli_apply_changes(vty
, NULL
);
422 void cli_show_isis_overload(struct vty
*vty
, struct lyd_node
*dnode
,
425 vty_out(vty
, " set-overload-bit\n");
429 * XPath: /frr-isisd:isis/instance/attached
431 DEFPY(set_attached_bit
, set_attached_bit_cmd
, "[no] set-attached-bit",
432 "Reset attached bit\n"
433 "Set attached bit to identify as L1/L2 router for inter-area traffic\n")
435 nb_cli_enqueue_change(vty
, "./attached",
436 no
? NB_OP_DELETE
: NB_OP_CREATE
, NULL
);
438 return nb_cli_apply_changes(vty
, NULL
);
441 void cli_show_isis_attached(struct vty
*vty
, struct lyd_node
*dnode
,
444 vty_out(vty
, " set-attached-bit\n");
448 * XPath: /frr-isisd:isis/instance/metric-style
450 DEFPY(metric_style
, metric_style_cmd
,
451 "metric-style <narrow|transition|wide>$style",
452 "Use old-style (ISO 10589) or new-style packet formats\n"
453 "Use old style of TLVs with narrow metric\n"
454 "Send and accept both styles of TLVs during transition\n"
455 "Use new style of TLVs to carry wider metric\n")
457 nb_cli_enqueue_change(vty
, "./metric-style", NB_OP_MODIFY
, style
);
459 return nb_cli_apply_changes(vty
, NULL
);
462 DEFPY(no_metric_style
, no_metric_style_cmd
,
463 "no metric-style [narrow|transition|wide]",
465 "Use old-style (ISO 10589) or new-style packet formats\n"
466 "Use old style of TLVs with narrow metric\n"
467 "Send and accept both styles of TLVs during transition\n"
468 "Use new style of TLVs to carry wider metric\n")
470 nb_cli_enqueue_change(vty
, "./metric-style", NB_OP_MODIFY
, "narrow");
472 return nb_cli_apply_changes(vty
, NULL
);
475 void cli_show_isis_metric_style(struct vty
*vty
, struct lyd_node
*dnode
,
478 int metric
= yang_dnode_get_enum(dnode
, NULL
);
481 case ISIS_NARROW_METRIC
:
482 vty_out(vty
, " metric-style narrow\n");
484 case ISIS_WIDE_METRIC
:
485 vty_out(vty
, " metric-style wide\n");
487 case ISIS_TRANSITION_METRIC
:
488 vty_out(vty
, " metric-style transition\n");
494 * XPath: /frr-isisd:isis/instance/area-password
496 DEFPY(area_passwd
, area_passwd_cmd
,
497 "area-password <clear|md5>$pwd_type WORD$pwd [authenticate snp <send-only|validate>$snp]",
498 "Configure the authentication password for an area\n"
499 "Clear-text authentication type\n"
500 "MD5 authentication type\n"
501 "Level-wide password\n"
504 "Send but do not check PDUs on receiving\n"
505 "Send and check PDUs on receiving\n")
507 nb_cli_enqueue_change(vty
, "./area-password", NB_OP_CREATE
, NULL
);
508 nb_cli_enqueue_change(vty
, "./area-password/password", NB_OP_MODIFY
,
510 nb_cli_enqueue_change(vty
, "./area-password/password-type",
511 NB_OP_MODIFY
, pwd_type
);
512 nb_cli_enqueue_change(vty
, "./area-password/authenticate-snp",
513 NB_OP_MODIFY
, snp
? snp
: "none");
515 return nb_cli_apply_changes(vty
, NULL
);
518 void cli_show_isis_area_pwd(struct vty
*vty
, struct lyd_node
*dnode
,
523 vty_out(vty
, " area-password %s %s",
524 yang_dnode_get_string(dnode
, "./password-type"),
525 yang_dnode_get_string(dnode
, "./password"));
526 snp
= yang_dnode_get_string(dnode
, "./authenticate-snp");
527 if (!strmatch("none", snp
))
528 vty_out(vty
, " authenticate snp %s", snp
);
533 * XPath: /frr-isisd:isis/instance/domain-password
535 DEFPY(domain_passwd
, domain_passwd_cmd
,
536 "domain-password <clear|md5>$pwd_type WORD$pwd [authenticate snp <send-only|validate>$snp]",
537 "Set the authentication password for a routing domain\n"
538 "Clear-text authentication type\n"
539 "MD5 authentication type\n"
540 "Level-wide password\n"
543 "Send but do not check PDUs on receiving\n"
544 "Send and check PDUs on receiving\n")
546 nb_cli_enqueue_change(vty
, "./domain-password", NB_OP_CREATE
, NULL
);
547 nb_cli_enqueue_change(vty
, "./domain-password/password", NB_OP_MODIFY
,
549 nb_cli_enqueue_change(vty
, "./domain-password/password-type",
550 NB_OP_MODIFY
, pwd_type
);
551 nb_cli_enqueue_change(vty
, "./domain-password/authenticate-snp",
552 NB_OP_MODIFY
, snp
? snp
: "none");
554 return nb_cli_apply_changes(vty
, NULL
);
557 DEFPY(no_area_passwd
, no_area_passwd_cmd
,
558 "no <area-password|domain-password>$cmd",
560 "Configure the authentication password for an area\n"
561 "Set the authentication password for a routing domain\n")
563 nb_cli_enqueue_change(vty
, ".", NB_OP_DELETE
, NULL
);
565 return nb_cli_apply_changes(vty
, "./%s", cmd
);
568 void cli_show_isis_domain_pwd(struct vty
*vty
, struct lyd_node
*dnode
,
573 vty_out(vty
, " domain-password %s %s",
574 yang_dnode_get_string(dnode
, "./password-type"),
575 yang_dnode_get_string(dnode
, "./password"));
576 snp
= yang_dnode_get_string(dnode
, "./authenticate-snp");
577 if (!strmatch("none", snp
))
578 vty_out(vty
, " authenticate snp %s", snp
);
583 * XPath: /frr-isisd:isis/instance/lsp/generation-interval
585 DEFPY(lsp_gen_interval
, lsp_gen_interval_cmd
,
586 "lsp-gen-interval [level-1|level-2]$level (1-120)$val",
587 "Minimum interval between regenerating same LSP\n"
588 "Set interval for level 1 only\n"
589 "Set interval for level 2 only\n"
590 "Minimum interval in seconds\n")
592 if (!level
|| strmatch(level
, "level-1"))
593 nb_cli_enqueue_change(vty
, "./lsp/generation-interval/level-1",
594 NB_OP_MODIFY
, val_str
);
595 if (!level
|| strmatch(level
, "level-2"))
596 nb_cli_enqueue_change(vty
, "./lsp/generation-interval/level-2",
597 NB_OP_MODIFY
, val_str
);
599 return nb_cli_apply_changes(vty
, NULL
);
602 DEFPY(no_lsp_gen_interval
, no_lsp_gen_interval_cmd
,
603 "no lsp-gen-interval [level-1|level-2]$level [(1-120)]",
605 "Minimum interval between regenerating same LSP\n"
606 "Set interval for level 1 only\n"
607 "Set interval for level 2 only\n"
608 "Minimum interval in seconds\n")
610 if (!level
|| strmatch(level
, "level-1"))
611 nb_cli_enqueue_change(vty
, "./lsp/generation-interval/level-1",
613 if (!level
|| strmatch(level
, "level-2"))
614 nb_cli_enqueue_change(vty
, "./lsp/generation-interval/level-2",
617 return nb_cli_apply_changes(vty
, NULL
);
620 void cli_show_isis_lsp_gen_interval(struct vty
*vty
, struct lyd_node
*dnode
,
623 const char *l1
= yang_dnode_get_string(dnode
, "./level-1");
624 const char *l2
= yang_dnode_get_string(dnode
, "./level-2");
626 if (strmatch(l1
, l2
))
627 vty_out(vty
, " lsp-gen-interval %s\n", l1
);
629 vty_out(vty
, " lsp-gen-interval level-1 %s\n", l1
);
630 vty_out(vty
, " lsp-gen-interval level-2 %s\n", l2
);
635 * XPath: /frr-isisd:isis/instance/lsp/refresh-interval
637 DEFPY(lsp_refresh_interval
, lsp_refresh_interval_cmd
,
638 "lsp-refresh-interval [level-1|level-2]$level (1-65235)$val",
639 "LSP refresh interval\n"
640 "LSP refresh interval for Level 1 only\n"
641 "LSP refresh interval for Level 2 only\n"
642 "LSP refresh interval in seconds\n")
644 if (!level
|| strmatch(level
, "level-1"))
645 nb_cli_enqueue_change(vty
, "./lsp/refresh-interval/level-1",
646 NB_OP_MODIFY
, val_str
);
647 if (!level
|| strmatch(level
, "level-2"))
648 nb_cli_enqueue_change(vty
, "./lsp/refresh-interval/level-2",
649 NB_OP_MODIFY
, val_str
);
651 return nb_cli_apply_changes(vty
, NULL
);
654 DEFPY(no_lsp_refresh_interval
, no_lsp_refresh_interval_cmd
,
655 "no lsp-refresh-interval [level-1|level-2]$level [(1-65235)]",
657 "LSP refresh interval\n"
658 "LSP refresh interval for Level 1 only\n"
659 "LSP refresh interval for Level 2 only\n"
660 "LSP refresh interval in seconds\n")
662 if (!level
|| strmatch(level
, "level-1"))
663 nb_cli_enqueue_change(vty
, "./lsp/refresh-interval/level-1",
665 if (!level
|| strmatch(level
, "level-2"))
666 nb_cli_enqueue_change(vty
, "./lsp/refresh-interval/level-2",
669 return nb_cli_apply_changes(vty
, NULL
);
672 void cli_show_isis_lsp_ref_interval(struct vty
*vty
, struct lyd_node
*dnode
,
675 const char *l1
= yang_dnode_get_string(dnode
, "./level-1");
676 const char *l2
= yang_dnode_get_string(dnode
, "./level-2");
678 if (strmatch(l1
, l2
))
679 vty_out(vty
, " lsp-refresh-interval %s\n", l1
);
681 vty_out(vty
, " lsp-refresh-interval level-1 %s\n", l1
);
682 vty_out(vty
, " lsp-refresh-interval level-2 %s\n", l2
);
687 * XPath: /frr-isisd:isis/instance/lsp/maximum-lifetime
689 DEFPY(max_lsp_lifetime
, max_lsp_lifetime_cmd
,
690 "max-lsp-lifetime [level-1|level-2]$level (350-65535)$val",
691 "Maximum LSP lifetime\n"
692 "Maximum LSP lifetime for Level 1 only\n"
693 "Maximum LSP lifetime for Level 2 only\n"
694 "LSP lifetime in seconds\n")
696 if (!level
|| strmatch(level
, "level-1"))
697 nb_cli_enqueue_change(vty
, "./lsp/maximum-lifetime/level-1",
698 NB_OP_MODIFY
, val_str
);
699 if (!level
|| strmatch(level
, "level-2"))
700 nb_cli_enqueue_change(vty
, "./lsp/maximum-lifetime/level-2",
701 NB_OP_MODIFY
, val_str
);
703 return nb_cli_apply_changes(vty
, NULL
);
706 DEFPY(no_max_lsp_lifetime
, no_max_lsp_lifetime_cmd
,
707 "no max-lsp-lifetime [level-1|level-2]$level [(350-65535)]",
709 "Maximum LSP lifetime\n"
710 "Maximum LSP lifetime for Level 1 only\n"
711 "Maximum LSP lifetime for Level 2 only\n"
712 "LSP lifetime in seconds\n")
714 if (!level
|| strmatch(level
, "level-1"))
715 nb_cli_enqueue_change(vty
, "./lsp/maximum-lifetime/level-1",
717 if (!level
|| strmatch(level
, "level-2"))
718 nb_cli_enqueue_change(vty
, "./lsp/maximum-lifetime/level-2",
721 return nb_cli_apply_changes(vty
, NULL
);
724 void cli_show_isis_lsp_max_lifetime(struct vty
*vty
, struct lyd_node
*dnode
,
727 const char *l1
= yang_dnode_get_string(dnode
, "./level-1");
728 const char *l2
= yang_dnode_get_string(dnode
, "./level-2");
730 if (strmatch(l1
, l2
))
731 vty_out(vty
, " max-lsp-lifetime %s\n", l1
);
733 vty_out(vty
, " max-lsp-lifetime level-1 %s\n", l1
);
734 vty_out(vty
, " max-lsp-lifetime level-2 %s\n", l2
);
739 * XPath: /frr-isisd:isis/instance/lsp/mtu
741 DEFPY(area_lsp_mtu
, area_lsp_mtu_cmd
, "lsp-mtu (128-4352)$val",
742 "Configure the maximum size of generated LSPs\n"
743 "Maximum size of generated LSPs\n")
745 nb_cli_enqueue_change(vty
, "./lsp/mtu", NB_OP_MODIFY
, val_str
);
747 return nb_cli_apply_changes(vty
, NULL
);
750 DEFPY(no_area_lsp_mtu
, no_area_lsp_mtu_cmd
, "no lsp-mtu [(128-4352)]",
752 "Configure the maximum size of generated LSPs\n"
753 "Maximum size of generated LSPs\n")
755 nb_cli_enqueue_change(vty
, "./lsp/mtu", NB_OP_MODIFY
, NULL
);
757 return nb_cli_apply_changes(vty
, NULL
);
760 void cli_show_isis_lsp_mtu(struct vty
*vty
, struct lyd_node
*dnode
,
763 vty_out(vty
, " lsp-mtu %s\n", yang_dnode_get_string(dnode
, NULL
));
767 * XPath: /frr-isisd:isis/instance/spf/minimum-interval
769 DEFPY(spf_interval
, spf_interval_cmd
,
770 "spf-interval [level-1|level-2]$level (1-120)$val",
771 "Minimum interval between SPF calculations\n"
772 "Set interval for level 1 only\n"
773 "Set interval for level 2 only\n"
774 "Minimum interval between consecutive SPFs in seconds\n")
776 if (!level
|| strmatch(level
, "level-1"))
777 nb_cli_enqueue_change(vty
, "./spf/minimum-interval/level-1",
778 NB_OP_MODIFY
, val_str
);
779 if (!level
|| strmatch(level
, "level-2"))
780 nb_cli_enqueue_change(vty
, "./spf/minimum-interval/level-2",
781 NB_OP_MODIFY
, val_str
);
783 return nb_cli_apply_changes(vty
, NULL
);
786 DEFPY(no_spf_interval
, no_spf_interval_cmd
,
787 "no spf-interval [level-1|level-2]$level [(1-120)]",
789 "Minimum interval between SPF calculations\n"
790 "Set interval for level 1 only\n"
791 "Set interval for level 2 only\n"
792 "Minimum interval between consecutive SPFs in seconds\n")
794 if (!level
|| strmatch(level
, "level-1"))
795 nb_cli_enqueue_change(vty
, "./spf/minimum-interval/level-1",
797 if (!level
|| strmatch(level
, "level-2"))
798 nb_cli_enqueue_change(vty
, "./spf/minimum-interval/level-2",
801 return nb_cli_apply_changes(vty
, NULL
);
804 void cli_show_isis_spf_min_interval(struct vty
*vty
, struct lyd_node
*dnode
,
807 const char *l1
= yang_dnode_get_string(dnode
, "./level-1");
808 const char *l2
= yang_dnode_get_string(dnode
, "./level-2");
810 if (strmatch(l1
, l2
))
811 vty_out(vty
, " spf-interval %s\n", l1
);
813 vty_out(vty
, " spf-interval level-1 %s\n", l1
);
814 vty_out(vty
, " spf-interval level-2 %s\n", l2
);
818 void isis_cli_init(void)
820 install_element(CONFIG_NODE
, &router_isis_cmd
);
821 install_element(CONFIG_NODE
, &no_router_isis_cmd
);
823 install_element(INTERFACE_NODE
, &ip_router_isis_cmd
);
824 install_element(INTERFACE_NODE
, &ip6_router_isis_cmd
);
825 install_element(INTERFACE_NODE
, &no_ip_router_isis_cmd
);
827 install_element(ISIS_NODE
, &net_cmd
);
829 install_element(ISIS_NODE
, &is_type_cmd
);
830 install_element(ISIS_NODE
, &no_is_type_cmd
);
832 install_element(ISIS_NODE
, &dynamic_hostname_cmd
);
834 install_element(ISIS_NODE
, &set_overload_bit_cmd
);
835 install_element(ISIS_NODE
, &set_attached_bit_cmd
);
837 install_element(ISIS_NODE
, &metric_style_cmd
);
838 install_element(ISIS_NODE
, &no_metric_style_cmd
);
840 install_element(ISIS_NODE
, &area_passwd_cmd
);
841 install_element(ISIS_NODE
, &domain_passwd_cmd
);
842 install_element(ISIS_NODE
, &no_area_passwd_cmd
);
844 install_element(ISIS_NODE
, &lsp_gen_interval_cmd
);
845 install_element(ISIS_NODE
, &no_lsp_gen_interval_cmd
);
846 install_element(ISIS_NODE
, &lsp_refresh_interval_cmd
);
847 install_element(ISIS_NODE
, &no_lsp_refresh_interval_cmd
);
848 install_element(ISIS_NODE
, &max_lsp_lifetime_cmd
);
849 install_element(ISIS_NODE
, &no_max_lsp_lifetime_cmd
);
850 install_element(ISIS_NODE
, &area_lsp_mtu_cmd
);
851 install_element(ISIS_NODE
, &no_area_lsp_mtu_cmd
);
853 install_element(ISIS_NODE
, &spf_interval_cmd
);
854 install_element(ISIS_NODE
, &no_spf_interval_cmd
);
857 #endif /* ifndef FABRICD */