]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_cli.c
Merge pull request #6407 from donaldsharp/revert_ospfv3_fix
[mirror_frr.git] / isisd / isis_cli.c
CommitLineData
20bd27e2
EDP
1/*
2 * Copyright (C) 2001,2002 Sampo Saaristo
3 * Tampere University of Technology
4 * Institute of Communications Engineering
5 * Copyright (C) 2018 Volta Networks
6 * Emanuele Di Pascale
7 *
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)
11 * any later version.
12 *
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
16 * more details.
17 *
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
21 */
22
23#include <zebra.h>
24
25#include "if.h"
26#include "vrf.h"
27#include "log.h"
28#include "prefix.h"
29#include "command.h"
30#include "northbound_cli.h"
31#include "libfrr.h"
32#include "yang.h"
33#include "lib/linklist.h"
34#include "isisd/isisd.h"
2a1c520e 35#include "isisd/isis_nb.h"
20bd27e2
EDP
36#include "isisd/isis_misc.h"
37#include "isisd/isis_circuit.h"
38#include "isisd/isis_csm.h"
39
40#ifndef VTYSH_EXTRACT_PL
41#include "isisd/isis_cli_clippy.c"
42#endif
43
44#ifndef FABRICD
45
aaf2fd21
EDP
46/*
47 * XPath: /frr-isisd:isis/instance
48 */
49DEFPY_NOSH(router_isis, router_isis_cmd, "router isis WORD$tag",
50 ROUTER_STR
51 "ISO IS-IS\n"
52 "ISO Routing area tag\n")
53{
54 int ret;
55 char base_xpath[XPATH_MAXLEN];
56
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.
64 */
65 if (listcount(isis->area_list) == 0)
66 nb_cli_enqueue_change(vty, "./is-type", NB_OP_MODIFY,
67 "level-1-2");
68 ret = nb_cli_apply_changes(vty, base_xpath);
69 if (ret == CMD_SUCCESS)
70 VTY_PUSH_XPATH(ISIS_NODE, base_xpath);
71
72 return ret;
73}
74
75DEFPY(no_router_isis, no_router_isis_cmd, "no router isis WORD$tag",
76 NO_STR ROUTER_STR
77 "ISO IS-IS\n"
78 "ISO Routing area tag\n")
79{
80 char temp_xpath[XPATH_MAXLEN];
81 struct listnode *node, *nnode;
82 struct isis_circuit *circuit = NULL;
83 struct isis_area *area = NULL;
84
4ecc4b46
EDP
85 if (!yang_dnode_exists(vty->candidate_config->dnode,
86 "/frr-isisd:isis/instance[area-tag='%s']",
87 tag)) {
aaf2fd21
EDP
88 vty_out(vty, "ISIS area %s not found.\n", tag);
89 return CMD_ERR_NOTHING_TODO;
90 }
91
95ce849b 92 nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
4ecc4b46
EDP
93 area = isis_area_lookup(tag);
94 if (area && area->circuit_list && listcount(area->circuit_list)) {
aaf2fd21
EDP
95 for (ALL_LIST_ELEMENTS(area->circuit_list, node, nnode,
96 circuit)) {
97 /* add callbacks to delete each of the circuits listed
98 */
99 const char *vrf_name =
a36898e7
DS
100 vrf_lookup_by_id(circuit->interface->vrf_id)
101 ->name;
aaf2fd21
EDP
102 snprintf(
103 temp_xpath, XPATH_MAXLEN,
104 "/frr-interface:lib/interface[name='%s'][vrf='%s']/frr-isisd:isis",
105 circuit->interface->name, vrf_name);
95ce849b 106 nb_cli_enqueue_change(vty, temp_xpath, NB_OP_DESTROY,
aaf2fd21
EDP
107 NULL);
108 }
109 }
110
111 return nb_cli_apply_changes(
112 vty, "/frr-isisd:isis/instance[area-tag='%s']", tag);
113}
114
115void cli_show_router_isis(struct vty *vty, struct lyd_node *dnode,
116 bool show_defaults)
117{
118 vty_out(vty, "!\n");
119 vty_out(vty, "router isis %s\n",
120 yang_dnode_get_string(dnode, "./area-tag"));
121}
122
123/*
124 * XPath: /frr-interface:lib/interface/frr-isisd:isis/
125 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing
126 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing
127 * XPath: /frr-isisd:isis/instance
128 */
129DEFPY(ip_router_isis, ip_router_isis_cmd, "ip router isis WORD$tag",
130 "Interface Internet Protocol config commands\n"
131 "IP router interface commands\n"
132 "IS-IS routing protocol\n"
133 "Routing process tag\n")
134{
135 char temp_xpath[XPATH_MAXLEN];
136 const char *circ_type;
137 struct isis_area *area;
5f1e5e3f 138 struct interface *ifp;
aaf2fd21
EDP
139
140 /* area will be created if it is not present. make sure the yang model
141 * is synced with FRR and call the appropriate NB cb.
142 */
143 area = isis_area_lookup(tag);
144 if (!area) {
145 snprintf(temp_xpath, XPATH_MAXLEN,
146 "/frr-isisd:isis/instance[area-tag='%s']", tag);
147 nb_cli_enqueue_change(vty, temp_xpath, NB_OP_CREATE, tag);
148 snprintf(temp_xpath, XPATH_MAXLEN,
149 "/frr-isisd:isis/instance[area-tag='%s']/is-type",
150 tag);
151 nb_cli_enqueue_change(
152 vty, temp_xpath, NB_OP_MODIFY,
153 listcount(isis->area_list) == 0 ? "level-1-2" : NULL);
154 nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE,
155 NULL);
156 nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag",
157 NB_OP_MODIFY, tag);
158 nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv4-routing",
5f1e5e3f 159 NB_OP_MODIFY, "true");
aaf2fd21
EDP
160 nb_cli_enqueue_change(
161 vty, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY,
162 listcount(isis->area_list) == 0 ? "level-1-2"
163 : "level-1");
164 } else {
165 /* area exists, circuit type defaults to its area's is_type */
166 switch (area->is_type) {
167 case IS_LEVEL_1:
168 circ_type = "level-1";
169 break;
170 case IS_LEVEL_2:
171 circ_type = "level-2";
172 break;
173 case IS_LEVEL_1_AND_2:
174 circ_type = "level-1-2";
175 break;
8a5b2e10
EDP
176 default:
177 /* just to silence compiler warnings */
178 return CMD_WARNING_CONFIG_FAILED;
aaf2fd21
EDP
179 }
180 nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE,
181 NULL);
182 nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag",
183 NB_OP_MODIFY, tag);
184 nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv4-routing",
5f1e5e3f 185 NB_OP_MODIFY, "true");
aaf2fd21
EDP
186 nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type",
187 NB_OP_MODIFY, circ_type);
188 }
189
5f1e5e3f 190 /* check if the interface is a loopback and if so set it as passive */
8685be73
RW
191 ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false);
192 if (ifp && if_is_loopback(ifp))
193 nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive",
194 NB_OP_MODIFY, "true");
5f1e5e3f 195
aaf2fd21
EDP
196 return nb_cli_apply_changes(vty, NULL);
197}
198
199DEFPY(ip6_router_isis, ip6_router_isis_cmd, "ipv6 router isis WORD$tag",
200 "Interface Internet Protocol config commands\n"
201 "IP router interface commands\n"
202 "IS-IS routing protocol\n"
203 "Routing process tag\n")
204{
205 char temp_xpath[XPATH_MAXLEN];
206 const char *circ_type;
207 struct isis_area *area;
5f1e5e3f 208 struct interface *ifp;
aaf2fd21
EDP
209
210 /* area will be created if it is not present. make sure the yang model
211 * is synced with FRR and call the appropriate NB cb.
212 */
213 area = isis_area_lookup(tag);
214 if (!area) {
215 snprintf(temp_xpath, XPATH_MAXLEN,
216 "/frr-isisd:isis/instance[area-tag='%s']", tag);
217 nb_cli_enqueue_change(vty, temp_xpath, NB_OP_CREATE, tag);
218 snprintf(temp_xpath, XPATH_MAXLEN,
219 "/frr-isisd:isis/instance[area-tag='%s']/is-type",
220 tag);
221 nb_cli_enqueue_change(
222 vty, temp_xpath, NB_OP_MODIFY,
223 listcount(isis->area_list) == 0 ? "level-1-2" : NULL);
224 nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE,
225 NULL);
226 nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag",
227 NB_OP_MODIFY, tag);
228 nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv6-routing",
5f1e5e3f 229 NB_OP_MODIFY, "true");
aaf2fd21
EDP
230 nb_cli_enqueue_change(
231 vty, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY,
232 listcount(isis->area_list) == 0 ? "level-1-2"
233 : "level-1");
234 } else {
235 /* area exists, circuit type defaults to its area's is_type */
236 switch (area->is_type) {
237 case IS_LEVEL_1:
238 circ_type = "level-1";
239 break;
240 case IS_LEVEL_2:
241 circ_type = "level-2";
242 break;
243 case IS_LEVEL_1_AND_2:
244 circ_type = "level-1-2";
245 break;
8a5b2e10
EDP
246 default:
247 /* just to silence compiler warnings */
248 return CMD_WARNING_CONFIG_FAILED;
aaf2fd21
EDP
249 }
250 nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE,
251 NULL);
252 nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag",
253 NB_OP_MODIFY, tag);
254 nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv6-routing",
5f1e5e3f 255 NB_OP_MODIFY, "true");
aaf2fd21
EDP
256 nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type",
257 NB_OP_MODIFY, circ_type);
258 }
259
5f1e5e3f 260 /* check if the interface is a loopback and if so set it as passive */
8685be73
RW
261 ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false);
262 if (ifp && if_is_loopback(ifp))
263 nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive",
264 NB_OP_MODIFY, "true");
5f1e5e3f 265
aaf2fd21
EDP
266 return nb_cli_apply_changes(vty, NULL);
267}
268
269DEFPY(no_ip_router_isis, no_ip_router_isis_cmd,
270 "no <ip|ipv6>$ip router isis [WORD]$tag",
271 NO_STR
272 "Interface Internet Protocol config commands\n"
273 "IP router interface commands\n"
274 "IP router interface commands\n"
275 "IS-IS routing protocol\n"
276 "Routing process tag\n")
277{
472c3dae 278 const struct lyd_node *dnode;
aaf2fd21 279
472c3dae
RW
280 dnode = yang_dnode_get(vty->candidate_config->dnode,
281 "%s/frr-isisd:isis", VTY_CURR_XPATH);
282 if (!dnode)
283 return CMD_SUCCESS;
284
285 /*
286 * If both ipv4 and ipv6 are off delete the interface isis container.
aaf2fd21 287 */
472c3dae
RW
288 if (strmatch(ip, "ipv6")) {
289 if (!yang_dnode_get_bool(dnode, "./ipv4-routing"))
aaf2fd21 290 nb_cli_enqueue_change(vty, "./frr-isisd:isis",
95ce849b 291 NB_OP_DESTROY, NULL);
aaf2fd21
EDP
292 else
293 nb_cli_enqueue_change(vty,
294 "./frr-isisd:isis/ipv6-routing",
5f1e5e3f 295 NB_OP_MODIFY, "false");
472c3dae
RW
296 } else {
297 if (!yang_dnode_get_bool(dnode, "./ipv6-routing"))
aaf2fd21 298 nb_cli_enqueue_change(vty, "./frr-isisd:isis",
95ce849b 299 NB_OP_DESTROY, NULL);
aaf2fd21
EDP
300 else
301 nb_cli_enqueue_change(vty,
302 "./frr-isisd:isis/ipv4-routing",
5f1e5e3f 303 NB_OP_MODIFY, "false");
aaf2fd21
EDP
304 }
305
306 return nb_cli_apply_changes(vty, NULL);
307}
308
309void cli_show_ip_isis_ipv4(struct vty *vty, struct lyd_node *dnode,
310 bool show_defaults)
311{
5f1e5e3f
EDP
312 if (!yang_dnode_get_bool(dnode, NULL))
313 vty_out(vty, " no");
aaf2fd21
EDP
314 vty_out(vty, " ip router isis %s\n",
315 yang_dnode_get_string(dnode, "../area-tag"));
316}
317
318void cli_show_ip_isis_ipv6(struct vty *vty, struct lyd_node *dnode,
319 bool show_defaults)
320{
5f1e5e3f
EDP
321 if (!yang_dnode_get_bool(dnode, NULL))
322 vty_out(vty, " no");
aaf2fd21
EDP
323 vty_out(vty, " ipv6 router isis %s\n",
324 yang_dnode_get_string(dnode, "../area-tag"));
325}
326
c3e6ac0b
RZ
327/*
328 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring
329 */
330DEFPY(isis_bfd,
331 isis_bfd_cmd,
332 "[no] isis bfd",
333 NO_STR
334 PROTO_HELP
335 "Enable BFD support\n")
336{
337 const struct lyd_node *dnode;
338
339 dnode = yang_dnode_get(vty->candidate_config->dnode,
340 "%s/frr-isisd:isis", VTY_CURR_XPATH);
8222b997
RZ
341 if (dnode == NULL) {
342 vty_out(vty, "ISIS is not enabled on this circuit\n");
c3e6ac0b 343 return CMD_SUCCESS;
8222b997 344 }
c3e6ac0b
RZ
345
346 nb_cli_enqueue_change(vty, "./frr-isisd:isis/bfd-monitoring",
347 NB_OP_MODIFY, no ? "false" : "true");
348
349 return nb_cli_apply_changes(vty, NULL);
350}
351
352void cli_show_ip_isis_bfd_monitoring(struct vty *vty, struct lyd_node *dnode,
353 bool show_defaults)
354{
8222b997
RZ
355 if (!yang_dnode_get_bool(dnode, NULL))
356 vty_out(vty, " no");
357
def117f7 358 vty_out(vty, " isis bfd\n");
c3e6ac0b
RZ
359}
360
f084ea55
EDP
361/*
362 * XPath: /frr-isisd:isis/instance/area-address
363 */
364DEFPY(net, net_cmd, "[no] net WORD",
365 "Remove an existing Network Entity Title for this process\n"
366 "A Network Entity Title for this process (OSI only)\n"
367 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
368{
369 nb_cli_enqueue_change(vty, "./area-address",
95ce849b 370 no ? NB_OP_DESTROY : NB_OP_CREATE, net);
f084ea55
EDP
371
372 return nb_cli_apply_changes(vty, NULL);
373}
374
375void cli_show_isis_area_address(struct vty *vty, struct lyd_node *dnode,
376 bool show_defaults)
377{
378 vty_out(vty, " net %s\n", yang_dnode_get_string(dnode, NULL));
379}
380
e6bdae69
EDP
381/*
382 * XPath: /frr-isisd:isis/instance/is-type
383 */
384DEFPY(is_type, is_type_cmd, "is-type <level-1|level-1-2|level-2-only>$level",
385 "IS Level for this routing process (OSI only)\n"
386 "Act as a station router only\n"
387 "Act as both a station router and an area router\n"
388 "Act as an area router only\n")
389{
390 nb_cli_enqueue_change(vty, "./is-type", NB_OP_MODIFY,
391 strmatch(level, "level-2-only") ? "level-2"
392 : level);
393
394 return nb_cli_apply_changes(vty, NULL);
395}
396
397DEFPY(no_is_type, no_is_type_cmd,
398 "no is-type [<level-1|level-1-2|level-2-only>]",
399 NO_STR
400 "IS Level for this routing process (OSI only)\n"
401 "Act as a station router only\n"
402 "Act as both a station router and an area router\n"
403 "Act as an area router only\n")
404{
fd506bbb 405 nb_cli_enqueue_change(vty, "./is-type", NB_OP_MODIFY, NULL);
e6bdae69
EDP
406
407 return nb_cli_apply_changes(vty, NULL);
408}
409
410void cli_show_isis_is_type(struct vty *vty, struct lyd_node *dnode,
411 bool show_defaults)
412{
413 int is_type = yang_dnode_get_enum(dnode, NULL);
414
415 switch (is_type) {
416 case IS_LEVEL_1:
417 vty_out(vty, " is-type level-1\n");
418 break;
419 case IS_LEVEL_2:
420 vty_out(vty, " is-type level-2-only\n");
421 break;
422 case IS_LEVEL_1_AND_2:
423 vty_out(vty, " is-type level-1-2\n");
424 break;
425 }
426}
427
6bb043cd
EDP
428/*
429 * XPath: /frr-isisd:isis/instance/dynamic-hostname
430 */
431DEFPY(dynamic_hostname, dynamic_hostname_cmd, "[no] hostname dynamic",
432 NO_STR
433 "Dynamic hostname for IS-IS\n"
434 "Dynamic hostname\n")
435{
436 nb_cli_enqueue_change(vty, "./dynamic-hostname", NB_OP_MODIFY,
437 no ? "false" : "true");
438
439 return nb_cli_apply_changes(vty, NULL);
440}
441
442void cli_show_isis_dynamic_hostname(struct vty *vty, struct lyd_node *dnode,
443 bool show_defaults)
444{
445 if (!yang_dnode_get_bool(dnode, NULL))
446 vty_out(vty, " no");
447
448 vty_out(vty, " hostname dynamic\n");
449}
450
05a3f9f0
EDP
451/*
452 * XPath: /frr-isisd:isis/instance/overload
453 */
454DEFPY(set_overload_bit, set_overload_bit_cmd, "[no] set-overload-bit",
455 "Reset overload bit to accept transit traffic\n"
456 "Set overload bit to avoid any transit traffic\n")
457{
5f1e5e3f
EDP
458 nb_cli_enqueue_change(vty, "./overload", NB_OP_MODIFY,
459 no ? "false" : "true");
05a3f9f0
EDP
460
461 return nb_cli_apply_changes(vty, NULL);
462}
463
464void cli_show_isis_overload(struct vty *vty, struct lyd_node *dnode,
465 bool show_defaults)
466{
5f1e5e3f
EDP
467 if (!yang_dnode_get_bool(dnode, NULL))
468 vty_out(vty, " no");
05a3f9f0
EDP
469 vty_out(vty, " set-overload-bit\n");
470}
471
472/*
473 * XPath: /frr-isisd:isis/instance/attached
474 */
475DEFPY(set_attached_bit, set_attached_bit_cmd, "[no] set-attached-bit",
476 "Reset attached bit\n"
477 "Set attached bit to identify as L1/L2 router for inter-area traffic\n")
478{
5f1e5e3f
EDP
479 nb_cli_enqueue_change(vty, "./attached", NB_OP_MODIFY,
480 no ? "false" : "true");
05a3f9f0
EDP
481
482 return nb_cli_apply_changes(vty, NULL);
483}
484
485void cli_show_isis_attached(struct vty *vty, struct lyd_node *dnode,
486 bool show_defaults)
487{
5f1e5e3f
EDP
488 if (!yang_dnode_get_bool(dnode, NULL))
489 vty_out(vty, " no");
05a3f9f0
EDP
490 vty_out(vty, " set-attached-bit\n");
491}
492
e0df3206
EDP
493/*
494 * XPath: /frr-isisd:isis/instance/metric-style
495 */
496DEFPY(metric_style, metric_style_cmd,
f34ab52d 497 "metric-style <narrow|transition|wide>$style",
e0df3206
EDP
498 "Use old-style (ISO 10589) or new-style packet formats\n"
499 "Use old style of TLVs with narrow metric\n"
500 "Send and accept both styles of TLVs during transition\n"
501 "Use new style of TLVs to carry wider metric\n")
502{
503 nb_cli_enqueue_change(vty, "./metric-style", NB_OP_MODIFY, style);
504
505 return nb_cli_apply_changes(vty, NULL);
506}
507
508DEFPY(no_metric_style, no_metric_style_cmd,
f34ab52d
EDP
509 "no metric-style [narrow|transition|wide]",
510 NO_STR
511 "Use old-style (ISO 10589) or new-style packet formats\n"
e0df3206
EDP
512 "Use old style of TLVs with narrow metric\n"
513 "Send and accept both styles of TLVs during transition\n"
514 "Use new style of TLVs to carry wider metric\n")
515{
fd506bbb 516 nb_cli_enqueue_change(vty, "./metric-style", NB_OP_MODIFY, NULL);
e0df3206
EDP
517
518 return nb_cli_apply_changes(vty, NULL);
519}
520
521void cli_show_isis_metric_style(struct vty *vty, struct lyd_node *dnode,
522 bool show_defaults)
523{
524 int metric = yang_dnode_get_enum(dnode, NULL);
525
526 switch (metric) {
527 case ISIS_NARROW_METRIC:
528 vty_out(vty, " metric-style narrow\n");
529 break;
530 case ISIS_WIDE_METRIC:
531 vty_out(vty, " metric-style wide\n");
532 break;
533 case ISIS_TRANSITION_METRIC:
534 vty_out(vty, " metric-style transition\n");
535 break;
536 }
537}
538
933536e3
EDP
539/*
540 * XPath: /frr-isisd:isis/instance/area-password
541 */
542DEFPY(area_passwd, area_passwd_cmd,
543 "area-password <clear|md5>$pwd_type WORD$pwd [authenticate snp <send-only|validate>$snp]",
544 "Configure the authentication password for an area\n"
545 "Clear-text authentication type\n"
546 "MD5 authentication type\n"
547 "Level-wide password\n"
548 "Authentication\n"
549 "SNP PDUs\n"
550 "Send but do not check PDUs on receiving\n"
551 "Send and check PDUs on receiving\n")
552{
553 nb_cli_enqueue_change(vty, "./area-password", NB_OP_CREATE, NULL);
554 nb_cli_enqueue_change(vty, "./area-password/password", NB_OP_MODIFY,
555 pwd);
556 nb_cli_enqueue_change(vty, "./area-password/password-type",
557 NB_OP_MODIFY, pwd_type);
558 nb_cli_enqueue_change(vty, "./area-password/authenticate-snp",
559 NB_OP_MODIFY, snp ? snp : "none");
560
561 return nb_cli_apply_changes(vty, NULL);
562}
563
564void cli_show_isis_area_pwd(struct vty *vty, struct lyd_node *dnode,
565 bool show_defaults)
566{
567 const char *snp;
568
569 vty_out(vty, " area-password %s %s",
570 yang_dnode_get_string(dnode, "./password-type"),
571 yang_dnode_get_string(dnode, "./password"));
572 snp = yang_dnode_get_string(dnode, "./authenticate-snp");
573 if (!strmatch("none", snp))
574 vty_out(vty, " authenticate snp %s", snp);
575 vty_out(vty, "\n");
576}
577
578/*
579 * XPath: /frr-isisd:isis/instance/domain-password
580 */
581DEFPY(domain_passwd, domain_passwd_cmd,
582 "domain-password <clear|md5>$pwd_type WORD$pwd [authenticate snp <send-only|validate>$snp]",
583 "Set the authentication password for a routing domain\n"
584 "Clear-text authentication type\n"
585 "MD5 authentication type\n"
586 "Level-wide password\n"
587 "Authentication\n"
588 "SNP PDUs\n"
589 "Send but do not check PDUs on receiving\n"
590 "Send and check PDUs on receiving\n")
591{
592 nb_cli_enqueue_change(vty, "./domain-password", NB_OP_CREATE, NULL);
593 nb_cli_enqueue_change(vty, "./domain-password/password", NB_OP_MODIFY,
594 pwd);
595 nb_cli_enqueue_change(vty, "./domain-password/password-type",
596 NB_OP_MODIFY, pwd_type);
597 nb_cli_enqueue_change(vty, "./domain-password/authenticate-snp",
598 NB_OP_MODIFY, snp ? snp : "none");
599
600 return nb_cli_apply_changes(vty, NULL);
601}
602
603DEFPY(no_area_passwd, no_area_passwd_cmd,
604 "no <area-password|domain-password>$cmd",
605 NO_STR
606 "Configure the authentication password for an area\n"
607 "Set the authentication password for a routing domain\n")
608{
95ce849b 609 nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
933536e3
EDP
610
611 return nb_cli_apply_changes(vty, "./%s", cmd);
612}
613
614void cli_show_isis_domain_pwd(struct vty *vty, struct lyd_node *dnode,
615 bool show_defaults)
616{
617 const char *snp;
618
619 vty_out(vty, " domain-password %s %s",
620 yang_dnode_get_string(dnode, "./password-type"),
621 yang_dnode_get_string(dnode, "./password"));
622 snp = yang_dnode_get_string(dnode, "./authenticate-snp");
623 if (!strmatch("none", snp))
624 vty_out(vty, " authenticate snp %s", snp);
625 vty_out(vty, "\n");
626}
627
1d6fe72e 628/*
d2c970ff
EDP
629 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/generation-interval
630 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/generation-interval
1d6fe72e
EDP
631 */
632DEFPY(lsp_gen_interval, lsp_gen_interval_cmd,
633 "lsp-gen-interval [level-1|level-2]$level (1-120)$val",
634 "Minimum interval between regenerating same LSP\n"
635 "Set interval for level 1 only\n"
636 "Set interval for level 2 only\n"
637 "Minimum interval in seconds\n")
638{
639 if (!level || strmatch(level, "level-1"))
d2c970ff
EDP
640 nb_cli_enqueue_change(
641 vty, "./lsp/timers/level-1/generation-interval",
642 NB_OP_MODIFY, val_str);
1d6fe72e 643 if (!level || strmatch(level, "level-2"))
d2c970ff
EDP
644 nb_cli_enqueue_change(
645 vty, "./lsp/timers/level-2/generation-interval",
646 NB_OP_MODIFY, val_str);
1d6fe72e
EDP
647
648 return nb_cli_apply_changes(vty, NULL);
649}
650
651DEFPY(no_lsp_gen_interval, no_lsp_gen_interval_cmd,
652 "no lsp-gen-interval [level-1|level-2]$level [(1-120)]",
653 NO_STR
654 "Minimum interval between regenerating same LSP\n"
655 "Set interval for level 1 only\n"
656 "Set interval for level 2 only\n"
657 "Minimum interval in seconds\n")
658{
659 if (!level || strmatch(level, "level-1"))
d2c970ff
EDP
660 nb_cli_enqueue_change(
661 vty, "./lsp/timers/level-1/generation-interval",
662 NB_OP_MODIFY, NULL);
1d6fe72e 663 if (!level || strmatch(level, "level-2"))
d2c970ff
EDP
664 nb_cli_enqueue_change(
665 vty, "./lsp/timers/level-2/generation-interval",
666 NB_OP_MODIFY, NULL);
1d6fe72e
EDP
667
668 return nb_cli_apply_changes(vty, NULL);
669}
670
7e869004 671/*
d2c970ff
EDP
672 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval
673 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval
7e869004
EDP
674 */
675DEFPY(lsp_refresh_interval, lsp_refresh_interval_cmd,
676 "lsp-refresh-interval [level-1|level-2]$level (1-65235)$val",
677 "LSP refresh interval\n"
678 "LSP refresh interval for Level 1 only\n"
679 "LSP refresh interval for Level 2 only\n"
680 "LSP refresh interval in seconds\n")
681{
682 if (!level || strmatch(level, "level-1"))
d2c970ff
EDP
683 nb_cli_enqueue_change(vty,
684 "./lsp/timers/level-1/refresh-interval",
7e869004
EDP
685 NB_OP_MODIFY, val_str);
686 if (!level || strmatch(level, "level-2"))
d2c970ff
EDP
687 nb_cli_enqueue_change(vty,
688 "./lsp/timers/level-2/refresh-interval",
7e869004
EDP
689 NB_OP_MODIFY, val_str);
690
691 return nb_cli_apply_changes(vty, NULL);
692}
693
694DEFPY(no_lsp_refresh_interval, no_lsp_refresh_interval_cmd,
695 "no lsp-refresh-interval [level-1|level-2]$level [(1-65235)]",
696 NO_STR
697 "LSP refresh interval\n"
698 "LSP refresh interval for Level 1 only\n"
699 "LSP refresh interval for Level 2 only\n"
700 "LSP refresh interval in seconds\n")
701{
702 if (!level || strmatch(level, "level-1"))
d2c970ff
EDP
703 nb_cli_enqueue_change(vty,
704 "./lsp/timers/level-1/refresh-interval",
7e869004
EDP
705 NB_OP_MODIFY, NULL);
706 if (!level || strmatch(level, "level-2"))
d2c970ff
EDP
707 nb_cli_enqueue_change(vty,
708 "./lsp/timers/level-2/refresh-interval",
7e869004
EDP
709 NB_OP_MODIFY, NULL);
710
711 return nb_cli_apply_changes(vty, NULL);
712}
713
ea120aa0 714/*
d2c970ff
EDP
715 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime
716 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime
ea120aa0 717 */
d2c970ff 718
ea120aa0
EDP
719DEFPY(max_lsp_lifetime, max_lsp_lifetime_cmd,
720 "max-lsp-lifetime [level-1|level-2]$level (350-65535)$val",
721 "Maximum LSP lifetime\n"
722 "Maximum LSP lifetime for Level 1 only\n"
723 "Maximum LSP lifetime for Level 2 only\n"
724 "LSP lifetime in seconds\n")
725{
726 if (!level || strmatch(level, "level-1"))
d2c970ff
EDP
727 nb_cli_enqueue_change(vty,
728 "./lsp/timers/level-1/maximum-lifetime",
ea120aa0
EDP
729 NB_OP_MODIFY, val_str);
730 if (!level || strmatch(level, "level-2"))
d2c970ff
EDP
731 nb_cli_enqueue_change(vty,
732 "./lsp/timers/level-2/maximum-lifetime",
ea120aa0
EDP
733 NB_OP_MODIFY, val_str);
734
735 return nb_cli_apply_changes(vty, NULL);
736}
737
738DEFPY(no_max_lsp_lifetime, no_max_lsp_lifetime_cmd,
739 "no max-lsp-lifetime [level-1|level-2]$level [(350-65535)]",
740 NO_STR
741 "Maximum LSP lifetime\n"
742 "Maximum LSP lifetime for Level 1 only\n"
743 "Maximum LSP lifetime for Level 2 only\n"
744 "LSP lifetime in seconds\n")
745{
746 if (!level || strmatch(level, "level-1"))
d2c970ff
EDP
747 nb_cli_enqueue_change(vty,
748 "./lsp/timers/level-1/maximum-lifetime",
ea120aa0
EDP
749 NB_OP_MODIFY, NULL);
750 if (!level || strmatch(level, "level-2"))
d2c970ff
EDP
751 nb_cli_enqueue_change(vty,
752 "./lsp/timers/level-2/maximum-lifetime",
ea120aa0
EDP
753 NB_OP_MODIFY, NULL);
754
755 return nb_cli_apply_changes(vty, NULL);
756}
757
d2c970ff
EDP
758/* unified LSP timers command
759 * XPath: /frr-isisd:isis/instance/lsp/timers
760 */
761
762DEFPY(lsp_timers, lsp_timers_cmd,
763 "lsp-timers [level-1|level-2]$level gen-interval (1-120)$gen refresh-interval (1-65235)$refresh max-lifetime (350-65535)$lifetime",
764 "LSP-related timers\n"
765 "LSP-related timers for Level 1 only\n"
766 "LSP-related timers for Level 2 only\n"
767 "Minimum interval between regenerating same LSP\n"
768 "Generation interval in seconds\n"
769 "LSP refresh interval\n"
770 "LSP refresh interval in seconds\n"
771 "Maximum LSP lifetime\n"
772 "Maximum LSP lifetime in seconds\n")
ea120aa0 773{
d2c970ff
EDP
774 if (!level || strmatch(level, "level-1")) {
775 nb_cli_enqueue_change(
776 vty, "./lsp/timers/level-1/generation-interval",
777 NB_OP_MODIFY, gen_str);
778 nb_cli_enqueue_change(vty,
779 "./lsp/timers/level-1/refresh-interval",
780 NB_OP_MODIFY, refresh_str);
781 nb_cli_enqueue_change(vty,
782 "./lsp/timers/level-1/maximum-lifetime",
783 NB_OP_MODIFY, lifetime_str);
784 }
785 if (!level || strmatch(level, "level-2")) {
786 nb_cli_enqueue_change(
787 vty, "./lsp/timers/level-2/generation-interval",
788 NB_OP_MODIFY, gen_str);
789 nb_cli_enqueue_change(vty,
790 "./lsp/timers/level-2/refresh-interval",
791 NB_OP_MODIFY, refresh_str);
792 nb_cli_enqueue_change(vty,
793 "./lsp/timers/level-2/maximum-lifetime",
794 NB_OP_MODIFY, lifetime_str);
795 }
ea120aa0 796
d2c970ff
EDP
797 return nb_cli_apply_changes(vty, NULL);
798}
799
800DEFPY(no_lsp_timers, no_lsp_timers_cmd,
801 "no lsp-timers [level-1|level-2]$level [gen-interval (1-120) refresh-interval (1-65235) max-lifetime (350-65535)]",
802 NO_STR
803 "LSP-related timers\n"
804 "LSP-related timers for Level 1 only\n"
805 "LSP-related timers for Level 2 only\n"
806 "Minimum interval between regenerating same LSP\n"
807 "Generation interval in seconds\n"
808 "LSP refresh interval\n"
809 "LSP refresh interval in seconds\n"
810 "Maximum LSP lifetime\n"
811 "Maximum LSP lifetime in seconds\n")
812{
813 if (!level || strmatch(level, "level-1")) {
814 nb_cli_enqueue_change(
815 vty, "./lsp/timers/level-1/generation-interval",
816 NB_OP_MODIFY, NULL);
817 nb_cli_enqueue_change(vty,
818 "./lsp/timers/level-1/refresh-interval",
819 NB_OP_MODIFY, NULL);
820 nb_cli_enqueue_change(vty,
821 "./lsp/timers/level-1/maximum-lifetime",
822 NB_OP_MODIFY, NULL);
823 }
824 if (!level || strmatch(level, "level-2")) {
825 nb_cli_enqueue_change(
826 vty, "./lsp/timers/level-2/generation-interval",
827 NB_OP_MODIFY, NULL);
828 nb_cli_enqueue_change(vty,
829 "./lsp/timers/level-2/refresh-interval",
830 NB_OP_MODIFY, NULL);
831 nb_cli_enqueue_change(vty,
832 "./lsp/timers/level-2/maximum-lifetime",
833 NB_OP_MODIFY, NULL);
834 }
835
836 return nb_cli_apply_changes(vty, NULL);
837}
838
839void cli_show_isis_lsp_timers(struct vty *vty, struct lyd_node *dnode,
840 bool show_defaults)
841{
842 const char *l1_refresh =
843 yang_dnode_get_string(dnode, "./level-1/refresh-interval");
844 const char *l2_refresh =
845 yang_dnode_get_string(dnode, "./level-2/refresh-interval");
846 const char *l1_lifetime =
847 yang_dnode_get_string(dnode, "./level-1/maximum-lifetime");
848 const char *l2_lifetime =
849 yang_dnode_get_string(dnode, "./level-2/maximum-lifetime");
850 const char *l1_gen =
851 yang_dnode_get_string(dnode, "./level-1/generation-interval");
852 const char *l2_gen =
853 yang_dnode_get_string(dnode, "./level-2/generation-interval");
854 if (strmatch(l1_refresh, l2_refresh)
855 && strmatch(l1_lifetime, l2_lifetime) && strmatch(l1_gen, l2_gen))
856 vty_out(vty,
857 " lsp-timers gen-interval %s refresh-interval %s max-lifetime %s\n",
858 l1_gen, l1_refresh, l1_lifetime);
ea120aa0 859 else {
d2c970ff
EDP
860 vty_out(vty,
861 " lsp-timers level-1 gen-interval %s refresh-interval %s max-lifetime %s\n",
862 l1_gen, l1_refresh, l1_lifetime);
863 vty_out(vty,
864 " lsp-timers level-2 gen-interval %s refresh-interval %s max-lifetime %s\n",
865 l2_gen, l2_refresh, l2_lifetime);
ea120aa0
EDP
866 }
867}
868
27a45d16
EDP
869/*
870 * XPath: /frr-isisd:isis/instance/lsp/mtu
871 */
872DEFPY(area_lsp_mtu, area_lsp_mtu_cmd, "lsp-mtu (128-4352)$val",
873 "Configure the maximum size of generated LSPs\n"
874 "Maximum size of generated LSPs\n")
875{
876 nb_cli_enqueue_change(vty, "./lsp/mtu", NB_OP_MODIFY, val_str);
877
878 return nb_cli_apply_changes(vty, NULL);
879}
880
881DEFPY(no_area_lsp_mtu, no_area_lsp_mtu_cmd, "no lsp-mtu [(128-4352)]",
882 NO_STR
883 "Configure the maximum size of generated LSPs\n"
884 "Maximum size of generated LSPs\n")
885{
886 nb_cli_enqueue_change(vty, "./lsp/mtu", NB_OP_MODIFY, NULL);
887
888 return nb_cli_apply_changes(vty, NULL);
889}
890
891void cli_show_isis_lsp_mtu(struct vty *vty, struct lyd_node *dnode,
892 bool show_defaults)
893{
894 vty_out(vty, " lsp-mtu %s\n", yang_dnode_get_string(dnode, NULL));
895}
896
dcb1dcd6
EDP
897/*
898 * XPath: /frr-isisd:isis/instance/spf/minimum-interval
899 */
900DEFPY(spf_interval, spf_interval_cmd,
901 "spf-interval [level-1|level-2]$level (1-120)$val",
902 "Minimum interval between SPF calculations\n"
903 "Set interval for level 1 only\n"
904 "Set interval for level 2 only\n"
905 "Minimum interval between consecutive SPFs in seconds\n")
906{
907 if (!level || strmatch(level, "level-1"))
908 nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-1",
909 NB_OP_MODIFY, val_str);
910 if (!level || strmatch(level, "level-2"))
911 nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-2",
912 NB_OP_MODIFY, val_str);
913
914 return nb_cli_apply_changes(vty, NULL);
915}
916
917DEFPY(no_spf_interval, no_spf_interval_cmd,
918 "no spf-interval [level-1|level-2]$level [(1-120)]",
919 NO_STR
920 "Minimum interval between SPF calculations\n"
921 "Set interval for level 1 only\n"
922 "Set interval for level 2 only\n"
923 "Minimum interval between consecutive SPFs in seconds\n")
924{
925 if (!level || strmatch(level, "level-1"))
926 nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-1",
927 NB_OP_MODIFY, NULL);
928 if (!level || strmatch(level, "level-2"))
929 nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-2",
930 NB_OP_MODIFY, NULL);
931
932 return nb_cli_apply_changes(vty, NULL);
933}
934
935void cli_show_isis_spf_min_interval(struct vty *vty, struct lyd_node *dnode,
936 bool show_defaults)
937{
938 const char *l1 = yang_dnode_get_string(dnode, "./level-1");
939 const char *l2 = yang_dnode_get_string(dnode, "./level-2");
940
941 if (strmatch(l1, l2))
942 vty_out(vty, " spf-interval %s\n", l1);
943 else {
944 vty_out(vty, " spf-interval level-1 %s\n", l1);
945 vty_out(vty, " spf-interval level-2 %s\n", l2);
946 }
947}
948
5336ba30
EDP
949/*
950 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay
951 */
952DEFPY(spf_delay_ietf, spf_delay_ietf_cmd,
953 "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)",
954 "IETF SPF delay algorithm\n"
955 "Delay used while in QUIET state\n"
956 "Delay used while in QUIET state in milliseconds\n"
957 "Delay used while in SHORT_WAIT state\n"
958 "Delay used while in SHORT_WAIT state in milliseconds\n"
959 "Delay used while in LONG_WAIT\n"
960 "Delay used while in LONG_WAIT state in milliseconds\n"
961 "Time with no received IGP events before considering IGP stable\n"
962 "Time with no received IGP events before considering IGP stable (in milliseconds)\n"
963 "Maximum duration needed to learn all the events related to a single failure\n"
964 "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n")
965{
966 nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay", NB_OP_CREATE,
967 NULL);
968 nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/init-delay",
969 NB_OP_MODIFY, init_delay_str);
970 nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/short-delay",
971 NB_OP_MODIFY, short_delay_str);
972 nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/long-delay",
973 NB_OP_MODIFY, long_delay_str);
974 nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/hold-down",
975 NB_OP_MODIFY, holddown_str);
976 nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/time-to-learn",
977 NB_OP_MODIFY, time_to_learn_str);
978
979 return nb_cli_apply_changes(vty, NULL);
980}
981
982DEFPY(no_spf_delay_ietf, no_spf_delay_ietf_cmd,
983 "no spf-delay-ietf [init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)]",
984 NO_STR
f34ab52d 985 "IETF SPF delay algorithm\n"
5336ba30
EDP
986 "Delay used while in QUIET state\n"
987 "Delay used while in QUIET state in milliseconds\n"
988 "Delay used while in SHORT_WAIT state\n"
989 "Delay used while in SHORT_WAIT state in milliseconds\n"
990 "Delay used while in LONG_WAIT\n"
991 "Delay used while in LONG_WAIT state in milliseconds\n"
992 "Time with no received IGP events before considering IGP stable\n"
993 "Time with no received IGP events before considering IGP stable (in milliseconds)\n"
994 "Maximum duration needed to learn all the events related to a single failure\n"
995 "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n")
996{
95ce849b 997 nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay", NB_OP_DESTROY,
5336ba30
EDP
998 NULL);
999
1000 return nb_cli_apply_changes(vty, NULL);
1001}
1002
1003void cli_show_isis_spf_ietf_backoff(struct vty *vty, struct lyd_node *dnode,
1004 bool show_defaults)
1005{
1006 vty_out(vty,
1007 " spf-delay-ietf init-delay %s short-delay %s long-delay %s holddown %s time-to-learn %s\n",
1008 yang_dnode_get_string(dnode, "./init-delay"),
1009 yang_dnode_get_string(dnode, "./short-delay"),
1010 yang_dnode_get_string(dnode, "./long-delay"),
1011 yang_dnode_get_string(dnode, "./hold-down"),
1012 yang_dnode_get_string(dnode, "./time-to-learn"));
1013}
1014
66e45e10
EDP
1015/*
1016 * XPath: /frr-isisd:isis/instance/purge-originator
1017 */
1018DEFPY(area_purge_originator, area_purge_originator_cmd, "[no] purge-originator",
1019 NO_STR "Use the RFC 6232 purge-originator\n")
1020{
5f1e5e3f
EDP
1021 nb_cli_enqueue_change(vty, "./purge-originator", NB_OP_MODIFY,
1022 no ? "false" : "true");
66e45e10
EDP
1023
1024 return nb_cli_apply_changes(vty, NULL);
1025}
1026
1027void cli_show_isis_purge_origin(struct vty *vty, struct lyd_node *dnode,
1028 bool show_defaults)
1029{
5f1e5e3f
EDP
1030 if (!yang_dnode_get_bool(dnode, NULL))
1031 vty_out(vty, " no");
66e45e10
EDP
1032 vty_out(vty, " purge-originator\n");
1033}
1034
d1a80ef6 1035/*
2e2a8b91 1036 * XPath: /frr-isisd:isis/instance/mpls-te
d1a80ef6
EDP
1037 */
1038DEFPY(isis_mpls_te_on, isis_mpls_te_on_cmd, "mpls-te on",
1039 MPLS_TE_STR "Enable the MPLS-TE functionality\n")
1040{
2e2a8b91 1041 nb_cli_enqueue_change(vty, "./mpls-te", NB_OP_CREATE,
d1a80ef6
EDP
1042 NULL);
1043
1044 return nb_cli_apply_changes(vty, NULL);
1045}
1046
1047DEFPY(no_isis_mpls_te_on, no_isis_mpls_te_on_cmd, "no mpls-te [on]",
1048 NO_STR
1049 "Disable the MPLS-TE functionality\n"
2e2a8b91 1050 "Disable the MPLS-TE functionality\n")
d1a80ef6 1051{
2e2a8b91 1052 nb_cli_enqueue_change(vty, "./mpls-te", NB_OP_DESTROY,
d1a80ef6
EDP
1053 NULL);
1054
1055 return nb_cli_apply_changes(vty, NULL);
1056}
1057
1058void cli_show_isis_mpls_te(struct vty *vty, struct lyd_node *dnode,
1059 bool show_defaults)
1060{
1061 vty_out(vty, " mpls-te on\n");
1062}
1063
1064/*
2e2a8b91 1065 * XPath: /frr-isisd:isis/instance/mpls-te/router-address
d1a80ef6
EDP
1066 */
1067DEFPY(isis_mpls_te_router_addr, isis_mpls_te_router_addr_cmd,
1068 "mpls-te router-address A.B.C.D",
1069 MPLS_TE_STR
1070 "Stable IP address of the advertising router\n"
1071 "MPLS-TE router address in IPv4 address format\n")
1072{
2e2a8b91 1073 nb_cli_enqueue_change(vty, "./mpls-te/router-address",
d1a80ef6
EDP
1074 NB_OP_MODIFY, router_address_str);
1075
1076 return nb_cli_apply_changes(vty, NULL);
1077}
1078
2e2a8b91
OD
1079DEFPY(no_isis_mpls_te_router_addr, no_isis_mpls_te_router_addr_cmd,
1080 "no mpls-te router-address [A.B.C.D]",
1081 NO_STR MPLS_TE_STR
1082 "Delete IP address of the advertising router\n"
1083 "MPLS-TE router address in IPv4 address format\n")
1084{
1085 nb_cli_enqueue_change(vty, "./mpls-te/router-address",
1086 NB_OP_DESTROY, NULL);
1087
1088 return nb_cli_apply_changes(vty, NULL);
1089}
1090
d1a80ef6
EDP
1091void cli_show_isis_mpls_te_router_addr(struct vty *vty, struct lyd_node *dnode,
1092 bool show_defaults)
1093{
1094 vty_out(vty, " mpls-te router-address %s\n",
1095 yang_dnode_get_string(dnode, NULL));
1096}
1097
1098DEFPY(isis_mpls_te_inter_as, isis_mpls_te_inter_as_cmd,
1099 "[no] mpls-te inter-as [level-1|level-1-2|level-2-only]",
1100 NO_STR MPLS_TE_STR
1101 "Configure MPLS-TE Inter-AS support\n"
1102 "AREA native mode self originate INTER-AS LSP with L1 only flooding scope\n"
1103 "AREA native mode self originate INTER-AS LSP with L1 and L2 flooding scope\n"
1104 "AS native mode self originate INTER-AS LSP with L2 only flooding scope\n")
1105{
2e2a8b91 1106 vty_out(vty, "MPLS-TE Inter-AS is not yet supported\n");
d1a80ef6
EDP
1107 return CMD_SUCCESS;
1108}
1109
8b104c10
EDP
1110/*
1111 * XPath: /frr-isisd:isis/instance/default-information-originate
1112 */
1113DEFPY(isis_default_originate, isis_default_originate_cmd,
1114 "[no] default-information originate <ipv4|ipv6>$ip"
1115 " <level-1|level-2>$level [always]$always"
82c25998 1116 " [{metric (0-16777215)$metric|route-map WORD$rmap}]",
8b104c10
EDP
1117 NO_STR
1118 "Control distribution of default information\n"
1119 "Distribute a default route\n"
1120 "Distribute default route for IPv4\n"
1121 "Distribute default route for IPv6\n"
1122 "Distribute default route into level-1\n"
1123 "Distribute default route into level-2\n"
1124 "Always advertise default route\n"
1125 "Metric for default route\n"
1126 "ISIS default metric\n"
1127 "Route map reference\n"
1128 "Pointer to route-map entries\n")
1129{
1130 if (no)
95ce849b 1131 nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
8b104c10
EDP
1132 else {
1133 nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
5f1e5e3f
EDP
1134 nb_cli_enqueue_change(vty, "./always", NB_OP_MODIFY,
1135 always ? "true" : "false");
8b104c10 1136 nb_cli_enqueue_change(vty, "./route-map",
95ce849b 1137 rmap ? NB_OP_MODIFY : NB_OP_DESTROY,
8b104c10 1138 rmap ? rmap : NULL);
82c25998
DT
1139 nb_cli_enqueue_change(vty, "./metric", NB_OP_MODIFY,
1140 metric_str ? metric_str : NULL);
8b104c10
EDP
1141 if (strmatch(ip, "ipv6") && !always) {
1142 vty_out(vty,
1143 "Zebra doesn't implement default-originate for IPv6 yet\n");
1144 vty_out(vty,
1145 "so use with care or use default-originate always.\n");
1146 }
1147 }
1148
1149 return nb_cli_apply_changes(
1150 vty, "./default-information-originate/%s[level='%s']", ip,
1151 level);
1152}
1153
1154static void vty_print_def_origin(struct vty *vty, struct lyd_node *dnode,
f34ab52d
EDP
1155 const char *family, const char *level,
1156 bool show_defaults)
8b104c10 1157{
8b104c10 1158 vty_out(vty, " default-information originate %s %s", family, level);
5f1e5e3f 1159 if (yang_dnode_get_bool(dnode, "./always"))
8b104c10
EDP
1160 vty_out(vty, " always");
1161
1162 if (yang_dnode_exists(dnode, "./route-map"))
1163 vty_out(vty, " route-map %s",
1164 yang_dnode_get_string(dnode, "./route-map"));
82c25998
DT
1165 if (show_defaults || !yang_dnode_is_default(dnode, "./metric"))
1166 vty_out(vty, " metric %s",
1167 yang_dnode_get_string(dnode, "./metric"));
1168
8b104c10
EDP
1169 vty_out(vty, "\n");
1170}
1171
1172void cli_show_isis_def_origin_ipv4(struct vty *vty, struct lyd_node *dnode,
1173 bool show_defaults)
1174{
1175 const char *level = yang_dnode_get_string(dnode, "./level");
1176
1177 vty_print_def_origin(vty, dnode, "ipv4", level, show_defaults);
1178}
1179
1180void cli_show_isis_def_origin_ipv6(struct vty *vty, struct lyd_node *dnode,
1181 bool show_defaults)
1182{
1183 const char *level = yang_dnode_get_string(dnode, "./level");
1184
1185 vty_print_def_origin(vty, dnode, "ipv6", level, show_defaults);
1186}
1187
a041ac8e
EDP
1188/*
1189 * XPath: /frr-isisd:isis/instance/redistribute
1190 */
1191DEFPY(isis_redistribute, isis_redistribute_cmd,
1192 "[no] redistribute <ipv4|ipv6>$ip " PROTO_REDIST_STR
1193 "$proto"
1194 " <level-1|level-2>$level"
82c25998 1195 " [{metric (0-16777215)|route-map WORD}]",
a041ac8e
EDP
1196 NO_STR REDIST_STR
1197 "Redistribute IPv4 routes\n"
1198 "Redistribute IPv6 routes\n" PROTO_REDIST_HELP
1199 "Redistribute into level-1\n"
1200 "Redistribute into level-2\n"
1201 "Metric for redistributed routes\n"
1202 "ISIS default metric\n"
1203 "Route map reference\n"
1204 "Pointer to route-map entries\n")
1205{
1206 if (no)
95ce849b 1207 nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
a041ac8e
EDP
1208 else {
1209 nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
1210 nb_cli_enqueue_change(vty, "./route-map",
95ce849b 1211 route_map ? NB_OP_MODIFY : NB_OP_DESTROY,
a041ac8e 1212 route_map ? route_map : NULL);
82c25998
DT
1213 nb_cli_enqueue_change(vty, "./metric", NB_OP_MODIFY,
1214 metric_str ? metric_str : NULL);
a041ac8e
EDP
1215 }
1216
1217 return nb_cli_apply_changes(
1218 vty, "./redistribute/%s[protocol='%s'][level='%s']", ip, proto,
1219 level);
1220}
1221
1222static void vty_print_redistribute(struct vty *vty, struct lyd_node *dnode,
82c25998 1223 bool show_defaults, const char *family)
a041ac8e
EDP
1224{
1225 const char *level = yang_dnode_get_string(dnode, "./level");
1226 const char *protocol = yang_dnode_get_string(dnode, "./protocol");
1227
1228 vty_out(vty, " redistribute %s %s %s", family, protocol, level);
82c25998 1229 if (show_defaults || !yang_dnode_is_default(dnode, "./metric"))
a041ac8e
EDP
1230 vty_out(vty, " metric %s",
1231 yang_dnode_get_string(dnode, "./metric"));
82c25998 1232 if (yang_dnode_exists(dnode, "./route-map"))
a041ac8e
EDP
1233 vty_out(vty, " route-map %s",
1234 yang_dnode_get_string(dnode, "./route-map"));
1235 vty_out(vty, "\n");
1236}
1237
1238void cli_show_isis_redistribute_ipv4(struct vty *vty, struct lyd_node *dnode,
1239 bool show_defaults)
1240{
82c25998 1241 vty_print_redistribute(vty, dnode, show_defaults, "ipv4");
a041ac8e
EDP
1242}
1243void cli_show_isis_redistribute_ipv6(struct vty *vty, struct lyd_node *dnode,
1244 bool show_defaults)
1245{
82c25998 1246 vty_print_redistribute(vty, dnode, show_defaults, "ipv6");
a041ac8e
EDP
1247}
1248
22af6a80
EDP
1249/*
1250 * XPath: /frr-isisd:isis/instance/multi-topology
1251 */
1252DEFPY(isis_topology, isis_topology_cmd,
1253 "[no] topology "
1254 "<ipv4-unicast"
1255 "|ipv4-mgmt"
1256 "|ipv6-unicast"
1257 "|ipv4-multicast"
1258 "|ipv6-multicast"
1259 "|ipv6-mgmt"
1260 "|ipv6-dstsrc>$topology "
1261 "[overload]$overload",
1262 NO_STR
1263 "Configure IS-IS topologies\n"
1264 "IPv4 unicast topology\n"
1265 "IPv4 management topology\n"
1266 "IPv6 unicast topology\n"
1267 "IPv4 multicast topology\n"
1268 "IPv6 multicast topology\n"
1269 "IPv6 management topology\n"
1270 "IPv6 dst-src topology\n"
1271 "Set overload bit for topology\n")
1272{
1273 char base_xpath[XPATH_MAXLEN];
1274
1275 /* Since IPv4-unicast is not configurable it is not present in the
1276 * YANG model, so we need to validate it here
1277 */
1278 if (strmatch(topology, "ipv4-unicast")) {
1279 vty_out(vty, "Cannot configure IPv4 unicast topology\n");
1280 return CMD_WARNING_CONFIG_FAILED;
1281 }
1282
1283 if (strmatch(topology, "ipv4-mgmt"))
1284 snprintf(base_xpath, XPATH_MAXLEN,
1285 "./multi-topology/ipv4-management");
1286 else if (strmatch(topology, "ipv6-mgmt"))
1287 snprintf(base_xpath, XPATH_MAXLEN,
1288 "./multi-topology/ipv6-management");
1289 else
1290 snprintf(base_xpath, XPATH_MAXLEN, "./multi-topology/%s",
1291 topology);
1292
1293 if (no)
95ce849b 1294 nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
22af6a80
EDP
1295 else {
1296 nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
5f1e5e3f
EDP
1297 nb_cli_enqueue_change(vty, "./overload", NB_OP_MODIFY,
1298 overload ? "true" : "false");
22af6a80
EDP
1299 }
1300
1301 return nb_cli_apply_changes(vty, base_xpath);
1302}
1303
1304void cli_show_isis_mt_ipv4_multicast(struct vty *vty, struct lyd_node *dnode,
1305 bool show_defaults)
1306{
1307 vty_out(vty, " topology ipv4-multicast");
5f1e5e3f 1308 if (yang_dnode_get_bool(dnode, "./overload"))
22af6a80
EDP
1309 vty_out(vty, " overload");
1310 vty_out(vty, "\n");
1311}
1312
1313void cli_show_isis_mt_ipv4_mgmt(struct vty *vty, struct lyd_node *dnode,
1314 bool show_defaults)
1315{
1316 vty_out(vty, " topology ipv4-mgmt");
5f1e5e3f 1317 if (yang_dnode_get_bool(dnode, "./overload"))
22af6a80
EDP
1318 vty_out(vty, " overload");
1319 vty_out(vty, "\n");
1320}
1321
1322void cli_show_isis_mt_ipv6_unicast(struct vty *vty, struct lyd_node *dnode,
1323 bool show_defaults)
1324{
1325 vty_out(vty, " topology ipv6-unicast");
5f1e5e3f 1326 if (yang_dnode_get_bool(dnode, "./overload"))
22af6a80
EDP
1327 vty_out(vty, " overload");
1328 vty_out(vty, "\n");
1329}
1330
1331void cli_show_isis_mt_ipv6_multicast(struct vty *vty, struct lyd_node *dnode,
1332 bool show_defaults)
1333{
1334 vty_out(vty, " topology ipv6-multicast");
5f1e5e3f 1335 if (yang_dnode_get_bool(dnode, "./overload"))
22af6a80
EDP
1336 vty_out(vty, " overload");
1337 vty_out(vty, "\n");
1338}
1339
1340void cli_show_isis_mt_ipv6_mgmt(struct vty *vty, struct lyd_node *dnode,
1341 bool show_defaults)
1342{
1343 vty_out(vty, " topology ipv6-mgmt");
5f1e5e3f 1344 if (yang_dnode_get_bool(dnode, "./overload"))
22af6a80
EDP
1345 vty_out(vty, " overload");
1346 vty_out(vty, "\n");
1347}
1348
1349void cli_show_isis_mt_ipv6_dstsrc(struct vty *vty, struct lyd_node *dnode,
1350 bool show_defaults)
1351{
1352 vty_out(vty, " topology ipv6-dstsrc");
5f1e5e3f 1353 if (yang_dnode_get_bool(dnode, "./overload"))
22af6a80
EDP
1354 vty_out(vty, " overload");
1355 vty_out(vty, "\n");
1356}
1357
8f6c8936
RW
1358/*
1359 * XPath: /frr-isisd:isis/instance/segment-routing/enabled
1360 */
1361DEFPY (isis_sr_enable,
1362 isis_sr_enable_cmd,
1363 "segment-routing on",
1364 SR_STR
1365 "Enable Segment Routing\n")
1366{
1367 nb_cli_enqueue_change(vty, "./segment-routing/enabled", NB_OP_MODIFY,
1368 "true");
1369
1370 return nb_cli_apply_changes(vty, NULL);
1371}
1372
1373DEFPY (no_isis_sr_enable,
1374 no_isis_sr_enable_cmd,
1375 "no segment-routing [on]",
1376 NO_STR
1377 SR_STR
1378 "Disable Segment Routing\n")
1379{
1380 nb_cli_enqueue_change(vty, "./segment-routing/enabled", NB_OP_MODIFY,
1381 "false");
1382
1383 return nb_cli_apply_changes(vty, NULL);
1384}
1385
1386void cli_show_isis_sr_enabled(struct vty *vty, struct lyd_node *dnode,
1387 bool show_defaults)
1388{
1389 if (!yang_dnode_get_bool(dnode, NULL))
1390 vty_out(vty, " no");
1391
1392 vty_out(vty, " segment-routing on\n");
1393}
1394
1395/*
1396 * XPath: /frr-isisd:isis/instance/segment-routing/srgb
1397 */
1398DEFPY (isis_sr_global_block_label_range,
1399 isis_sr_global_block_label_range_cmd,
1400 "segment-routing global-block (16-1048575)$lower_bound (16-1048575)$upper_bound",
1401 SR_STR
1402 "Segment Routing Global Block label range\n"
1403 "The lower bound of SRGB (16-1048575)\n"
1404 "The upper bound of SRGB (16-1048575)\n")
1405{
1406 nb_cli_enqueue_change(vty, "./segment-routing/srgb/lower-bound",
1407 NB_OP_MODIFY, lower_bound_str);
1408 nb_cli_enqueue_change(vty, "./segment-routing/srgb/upper-bound",
1409 NB_OP_MODIFY, upper_bound_str);
1410
1411 return nb_cli_apply_changes(vty, NULL);
1412}
1413
1414DEFPY (no_isis_sr_global_block_label_range,
1415 no_isis_sr_global_block_label_range_cmd,
1416 "no segment-routing global-block [(0-1048575) (0-1048575)]",
1417 NO_STR
1418 SR_STR
1419 "Segment Routing Global Block label range\n"
1420 "The lower bound of SRGB (16-1048575)\n"
1421 "The upper bound of SRGB (block size may not exceed 65535)\n")
1422{
1423 nb_cli_enqueue_change(vty, "./segment-routing/srgb/lower-bound",
1424 NB_OP_MODIFY, NULL);
1425 nb_cli_enqueue_change(vty, "./segment-routing/srgb/upper-bound",
1426 NB_OP_MODIFY, NULL);
1427
1428 return nb_cli_apply_changes(vty, NULL);
1429}
1430
1431void cli_show_isis_srgb(struct vty *vty, struct lyd_node *dnode,
1432 bool show_defaults)
1433{
1434 vty_out(vty, " segment-routing global-block %s %s\n",
1435 yang_dnode_get_string(dnode, "./lower-bound"),
1436 yang_dnode_get_string(dnode, "./upper-bound"));
1437}
1438
1439/*
1440 * XPath: /frr-isisd:isis/instance/segment-routing/msd/node-msd
1441 */
1442DEFPY (isis_sr_node_msd,
1443 isis_sr_node_msd_cmd,
1444 "segment-routing node-msd (1-16)$msd",
1445 SR_STR
1446 "Maximum Stack Depth for this router\n"
1447 "Maximum number of label that can be stack (1-16)\n")
1448{
1449 nb_cli_enqueue_change(vty, "./segment-routing/msd/node-msd",
1450 NB_OP_MODIFY, msd_str);
1451
1452 return nb_cli_apply_changes(vty, NULL);
1453}
1454
1455DEFPY (no_isis_sr_node_msd,
1456 no_isis_sr_node_msd_cmd,
1457 "no segment-routing node-msd [(1-16)]",
1458 NO_STR
1459 SR_STR
1460 "Maximum Stack Depth for this router\n"
1461 "Maximum number of label that can be stack (1-16)\n")
1462{
1463 nb_cli_enqueue_change(vty, "./segment-routing/msd/node-msd",
1464 NB_OP_DESTROY, NULL);
1465
1466 return nb_cli_apply_changes(vty, NULL);
1467}
1468
1469void cli_show_isis_node_msd(struct vty *vty, struct lyd_node *dnode,
1470 bool show_defaults)
1471{
1472 vty_out(vty, " segment-routing node-msd %s\n",
1473 yang_dnode_get_string(dnode, NULL));
1474}
1475
1476/*
1477 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid
1478 */
1479DEFPY (isis_sr_prefix_sid,
1480 isis_sr_prefix_sid_cmd,
1481 "segment-routing prefix\
1482 <A.B.C.D/M|X:X::X:X/M>$prefix\
26f6acaf 1483 <absolute$sid_type (16-1048575)$sid_value|index$sid_type (0-65535)$sid_value>\
8f6c8936
RW
1484 [<no-php-flag|explicit-null>$lh_behavior]",
1485 SR_STR
1486 "Prefix SID\n"
1487 "IPv4 Prefix\n"
1488 "IPv6 Prefix\n"
1489 "Specify the absolute value of Prefix Segement ID\n"
1490 "The Prefix Segment ID value\n"
1491 "Specify the index of Prefix Segement ID\n"
1492 "The Prefix Segment ID index\n"
1493 "Don't request Penultimate Hop Popping (PHP)\n"
1494 "Upstream neighbor must replace prefix-sid with explicit null label\n")
1495{
1496 nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
1497 nb_cli_enqueue_change(vty, "./sid-value-type", NB_OP_MODIFY, sid_type);
1498 nb_cli_enqueue_change(vty, "./sid-value", NB_OP_MODIFY, sid_value_str);
1499 if (lh_behavior) {
1500 const char *value;
1501
1502 if (strmatch(lh_behavior, "no-php-flag"))
1503 value = "no-php";
1504 else
1505 value = "explicit-null";
1506
1507 nb_cli_enqueue_change(vty, "./last-hop-behavior", NB_OP_MODIFY,
1508 value);
1509 } else
1510 nb_cli_enqueue_change(vty, "./last-hop-behavior", NB_OP_MODIFY,
1511 NULL);
1512
1513 return nb_cli_apply_changes(
1514 vty, "./segment-routing/prefix-sid-map/prefix-sid[prefix='%s']",
1515 prefix_str);
1516}
1517
1518DEFPY (no_isis_sr_prefix_sid,
1519 no_isis_sr_prefix_sid_cmd,
1520 "no segment-routing prefix <A.B.C.D/M|X:X::X:X/M>$prefix\
26f6acaf 1521 [<absolute$sid_type (16-1048575)|index (0-65535)> [<no-php-flag|explicit-null>]]",
8f6c8936
RW
1522 NO_STR
1523 SR_STR
1524 "Prefix SID\n"
1525 "IPv4 Prefix\n"
1526 "IPv6 Prefix\n"
1527 "Specify the absolute value of Prefix Segement ID\n"
1528 "The Prefix Segment ID value\n"
1529 "Specify the index of Prefix Segement ID\n"
1530 "The Prefix Segment ID index\n"
1531 "Don't request Penultimate Hop Popping (PHP)\n"
1532 "Upstream neighbor must replace prefix-sid with explicit null label\n")
1533{
1534 nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
1535
1536 return nb_cli_apply_changes(
1537 vty, "./segment-routing/prefix-sid-map/prefix-sid[prefix='%s']",
1538 prefix_str);
1539}
1540
1541void cli_show_isis_prefix_sid(struct vty *vty, struct lyd_node *dnode,
1542 bool show_defaults)
1543{
1544 const char *prefix;
1545 const char *lh_behavior;
1546 const char *sid_value_type;
1547 const char *sid_value;
1548
1549 prefix = yang_dnode_get_string(dnode, "./prefix");
1550 lh_behavior = yang_dnode_get_string(dnode, "./last-hop-behavior");
1551 sid_value_type = yang_dnode_get_string(dnode, "./sid-value-type");
1552 sid_value = yang_dnode_get_string(dnode, "./sid-value");
1553
1554 vty_out(vty, " segment-routing prefix %s", prefix);
1555 if (strmatch(sid_value_type, "absolute"))
1556 vty_out(vty, " absolute");
1557 else
1558 vty_out(vty, " index");
1559 vty_out(vty, " %s", sid_value);
1560 if (strmatch(lh_behavior, "no-php"))
1561 vty_out(vty, " no-php-flag");
1562 else if (strmatch(lh_behavior, "explicit-null"))
1563 vty_out(vty, " explicit-null");
1564 vty_out(vty, "\n");
1565}
1566
a6a36c41
EDP
1567/*
1568 * XPath: /frr-interface:lib/interface/frr-isisd:isis/passive
1569 */
1570DEFPY(isis_passive, isis_passive_cmd, "[no] isis passive",
1571 NO_STR
1572 "IS-IS routing protocol\n"
1573 "Configure the passive mode for interface\n")
1574{
5f1e5e3f
EDP
1575 nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive", NB_OP_MODIFY,
1576 no ? "false" : "true");
a6a36c41
EDP
1577
1578 return nb_cli_apply_changes(vty, NULL);
1579}
1580
1581void cli_show_ip_isis_passive(struct vty *vty, struct lyd_node *dnode,
1582 bool show_defaults)
1583{
5f1e5e3f
EDP
1584 if (!yang_dnode_get_bool(dnode, NULL))
1585 vty_out(vty, " no");
a6a36c41
EDP
1586 vty_out(vty, " isis passive\n");
1587}
1588
3e20c83a
EDP
1589/*
1590 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password
1591 */
1592
1593DEFPY(isis_passwd, isis_passwd_cmd, "isis password <md5|clear>$type WORD$pwd",
1594 "IS-IS routing protocol\n"
1595 "Configure the authentication password for a circuit\n"
1596 "HMAC-MD5 authentication\n"
1597 "Cleartext password\n"
1598 "Circuit password\n")
1599{
1600 nb_cli_enqueue_change(vty, "./frr-isisd:isis/password", NB_OP_CREATE,
1601 NULL);
1602 nb_cli_enqueue_change(vty, "./frr-isisd:isis/password/password",
1603 NB_OP_MODIFY, pwd);
1604 nb_cli_enqueue_change(vty, "./frr-isisd:isis/password/password-type",
1605 NB_OP_MODIFY, type);
1606
1607 return nb_cli_apply_changes(vty, NULL);
1608}
1609
1610DEFPY(no_isis_passwd, no_isis_passwd_cmd, "no isis password [<md5|clear> WORD]",
1611 NO_STR
1612 "IS-IS routing protocol\n"
1613 "Configure the authentication password for a circuit\n"
1614 "HMAC-MD5 authentication\n"
1615 "Cleartext password\n"
1616 "Circuit password\n")
1617{
95ce849b 1618 nb_cli_enqueue_change(vty, "./frr-isisd:isis/password", NB_OP_DESTROY,
3e20c83a
EDP
1619 NULL);
1620
1621 return nb_cli_apply_changes(vty, NULL);
1622}
1623
1624void cli_show_ip_isis_password(struct vty *vty, struct lyd_node *dnode,
1625 bool show_defaults)
1626{
1627 vty_out(vty, " isis password %s %s\n",
1628 yang_dnode_get_string(dnode, "./password-type"),
1629 yang_dnode_get_string(dnode, "./password"));
1630}
1631
be49219c
EDP
1632/*
1633 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric
1634 */
1635DEFPY(isis_metric, isis_metric_cmd,
1636 "isis metric [level-1|level-2]$level (0-16777215)$met",
1637 "IS-IS routing protocol\n"
1638 "Set default metric for circuit\n"
1639 "Specify metric for level-1 routing\n"
1640 "Specify metric for level-2 routing\n"
1641 "Default metric value\n")
1642{
1643 if (!level || strmatch(level, "level-1"))
1644 nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-1",
1645 NB_OP_MODIFY, met_str);
1646 if (!level || strmatch(level, "level-2"))
1647 nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-2",
1648 NB_OP_MODIFY, met_str);
1649
1650 return nb_cli_apply_changes(vty, NULL);
1651}
1652
1653DEFPY(no_isis_metric, no_isis_metric_cmd,
1654 "no isis metric [level-1|level-2]$level [(0-16777215)]",
1655 NO_STR
1656 "IS-IS routing protocol\n"
1657 "Set default metric for circuit\n"
1658 "Specify metric for level-1 routing\n"
1659 "Specify metric for level-2 routing\n"
1660 "Default metric value\n")
1661{
1662 if (!level || strmatch(level, "level-1"))
1663 nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-1",
1664 NB_OP_MODIFY, NULL);
1665 if (!level || strmatch(level, "level-2"))
1666 nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-2",
1667 NB_OP_MODIFY, NULL);
1668
1669 return nb_cli_apply_changes(vty, NULL);
1670}
1671
1672void cli_show_ip_isis_metric(struct vty *vty, struct lyd_node *dnode,
1673 bool show_defaults)
1674{
1675 const char *l1 = yang_dnode_get_string(dnode, "./level-1");
1676 const char *l2 = yang_dnode_get_string(dnode, "./level-2");
1677
1678 if (strmatch(l1, l2))
1679 vty_out(vty, " isis metric %s\n", l1);
1680 else {
d32a4cac
EDP
1681 vty_out(vty, " isis metric level-1 %s\n", l1);
1682 vty_out(vty, " isis metric level-2 %s\n", l2);
be49219c
EDP
1683 }
1684}
1685
356a2e3c
EDP
1686/*
1687 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval
1688 */
1689DEFPY(isis_hello_interval, isis_hello_interval_cmd,
1690 "isis hello-interval [level-1|level-2]$level (1-600)$intv",
1691 "IS-IS routing protocol\n"
1692 "Set Hello interval\n"
1693 "Specify hello-interval for level-1 IIHs\n"
1694 "Specify hello-interval for level-2 IIHs\n"
1695 "Holdtime 1 seconds, interval depends on multiplier\n")
1696{
1697 if (!level || strmatch(level, "level-1"))
1698 nb_cli_enqueue_change(vty,
1699 "./frr-isisd:isis/hello/interval/level-1",
1700 NB_OP_MODIFY, intv_str);
1701 if (!level || strmatch(level, "level-2"))
1702 nb_cli_enqueue_change(vty,
1703 "./frr-isisd:isis/hello/interval/level-2",
1704 NB_OP_MODIFY, intv_str);
1705
1706 return nb_cli_apply_changes(vty, NULL);
1707}
1708
1709DEFPY(no_isis_hello_interval, no_isis_hello_interval_cmd,
1710 "no isis hello-interval [level-1|level-2]$level [(1-600)]",
1711 NO_STR
1712 "IS-IS routing protocol\n"
1713 "Set Hello interval\n"
1714 "Specify hello-interval for level-1 IIHs\n"
1715 "Specify hello-interval for level-2 IIHs\n"
1716 "Holdtime 1 second, interval depends on multiplier\n")
1717{
1718 if (!level || strmatch(level, "level-1"))
1719 nb_cli_enqueue_change(vty,
1720 "./frr-isisd:isis/hello/interval/level-1",
1721 NB_OP_MODIFY, NULL);
1722 if (!level || strmatch(level, "level-2"))
1723 nb_cli_enqueue_change(vty,
1724 "./frr-isisd:isis/hello/interval/level-2",
1725 NB_OP_MODIFY, NULL);
1726
1727 return nb_cli_apply_changes(vty, NULL);
1728}
1729
1730void cli_show_ip_isis_hello_interval(struct vty *vty, struct lyd_node *dnode,
1731 bool show_defaults)
1732{
1733 const char *l1 = yang_dnode_get_string(dnode, "./level-1");
1734 const char *l2 = yang_dnode_get_string(dnode, "./level-2");
1735
1736 if (strmatch(l1, l2))
1737 vty_out(vty, " isis hello-interval %s\n", l1);
1738 else {
249312ab
EDP
1739 vty_out(vty, " isis hello-interval level-1 %s\n", l1);
1740 vty_out(vty, " isis hello-interval level-2 %s\n", l2);
356a2e3c
EDP
1741 }
1742}
1743
4e75a67d
EDP
1744/*
1745 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier
1746 */
1747DEFPY(isis_hello_multiplier, isis_hello_multiplier_cmd,
1748 "isis hello-multiplier [level-1|level-2]$level (2-100)$mult",
1749 "IS-IS routing protocol\n"
1750 "Set multiplier for Hello holding time\n"
1751 "Specify hello multiplier for level-1 IIHs\n"
1752 "Specify hello multiplier for level-2 IIHs\n"
1753 "Hello multiplier value\n")
1754{
1755 if (!level || strmatch(level, "level-1"))
1756 nb_cli_enqueue_change(
1757 vty, "./frr-isisd:isis/hello/multiplier/level-1",
1758 NB_OP_MODIFY, mult_str);
1759 if (!level || strmatch(level, "level-2"))
1760 nb_cli_enqueue_change(
1761 vty, "./frr-isisd:isis/hello/multiplier/level-2",
1762 NB_OP_MODIFY, mult_str);
1763
1764 return nb_cli_apply_changes(vty, NULL);
1765}
1766
1767DEFPY(no_isis_hello_multiplier, no_isis_hello_multiplier_cmd,
1768 "no isis hello-multiplier [level-1|level-2]$level [(2-100)]",
1769 NO_STR
1770 "IS-IS routing protocol\n"
1771 "Set multiplier for Hello holding time\n"
1772 "Specify hello multiplier for level-1 IIHs\n"
1773 "Specify hello multiplier for level-2 IIHs\n"
1774 "Hello multiplier value\n")
1775{
1776 if (!level || strmatch(level, "level-1"))
1777 nb_cli_enqueue_change(
1778 vty, "./frr-isisd:isis/hello/multiplier/level-1",
1779 NB_OP_MODIFY, NULL);
1780 if (!level || strmatch(level, "level-2"))
1781 nb_cli_enqueue_change(
1782 vty, "./frr-isisd:isis/hello/multiplier/level-2",
1783 NB_OP_MODIFY, NULL);
1784
1785 return nb_cli_apply_changes(vty, NULL);
1786}
1787
1788void cli_show_ip_isis_hello_multi(struct vty *vty, struct lyd_node *dnode,
1789 bool show_defaults)
1790{
1791 const char *l1 = yang_dnode_get_string(dnode, "./level-1");
1792 const char *l2 = yang_dnode_get_string(dnode, "./level-2");
1793
1794 if (strmatch(l1, l2))
1795 vty_out(vty, " isis hello-multiplier %s\n", l1);
1796 else {
249312ab
EDP
1797 vty_out(vty, " isis hello-multiplier level-1 %s\n", l1);
1798 vty_out(vty, " isis hello-multiplier level-2 %s\n", l2);
4e75a67d
EDP
1799 }
1800}
1801
5f2ce446
EDP
1802/*
1803 * XPath:
1804 * /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake
1805 */
1806DEFPY(isis_threeway_adj, isis_threeway_adj_cmd, "[no] isis three-way-handshake",
1807 NO_STR
1808 "IS-IS commands\n"
1809 "Enable/Disable three-way handshake\n")
1810{
1811 nb_cli_enqueue_change(vty,
1812 "./frr-isisd:isis/disable-three-way-handshake",
5f1e5e3f 1813 NB_OP_MODIFY, no ? "true" : "false");
5f2ce446
EDP
1814
1815 return nb_cli_apply_changes(vty, NULL);
1816}
1817
1818void cli_show_ip_isis_threeway_shake(struct vty *vty, struct lyd_node *dnode,
1819 bool show_defaults)
1820{
5f1e5e3f
EDP
1821 if (yang_dnode_get_bool(dnode, NULL))
1822 vty_out(vty, " no");
1823 vty_out(vty, " isis three-way-handshake\n");
5f2ce446
EDP
1824}
1825
7b6b75e5
EDP
1826/*
1827 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding
1828 */
1829DEFPY(isis_hello_padding, isis_hello_padding_cmd, "[no] isis hello padding",
1830 NO_STR
1831 "IS-IS routing protocol\n"
1832 "Add padding to IS-IS hello packets\n"
1833 "Pad hello packets\n")
1834{
1835 nb_cli_enqueue_change(vty, "./frr-isisd:isis/hello/padding",
1836 NB_OP_MODIFY, no ? "false" : "true");
1837
1838 return nb_cli_apply_changes(vty, NULL);
1839}
1840
1841void cli_show_ip_isis_hello_padding(struct vty *vty, struct lyd_node *dnode,
1842 bool show_defaults)
1843{
1844 if (!yang_dnode_get_bool(dnode, NULL))
1845 vty_out(vty, " no");
1846
1847 vty_out(vty, " isis hello padding\n");
1848}
1849
9ce808b9
EDP
1850/*
1851 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval
1852 */
1853DEFPY(csnp_interval, csnp_interval_cmd,
1854 "isis csnp-interval (1-600)$intv [level-1|level-2]$level",
1855 "IS-IS routing protocol\n"
1856 "Set CSNP interval in seconds\n"
1857 "CSNP interval value\n"
1858 "Specify interval for level-1 CSNPs\n"
1859 "Specify interval for level-2 CSNPs\n")
1860{
1861 if (!level || strmatch(level, "level-1"))
1862 nb_cli_enqueue_change(vty,
1863 "./frr-isisd:isis/csnp-interval/level-1",
1864 NB_OP_MODIFY, intv_str);
1865 if (!level || strmatch(level, "level-2"))
1866 nb_cli_enqueue_change(vty,
1867 "./frr-isisd:isis/csnp-interval/level-2",
1868 NB_OP_MODIFY, intv_str);
1869
1870 return nb_cli_apply_changes(vty, NULL);
1871}
1872
1873DEFPY(no_csnp_interval, no_csnp_interval_cmd,
1874 "no isis csnp-interval [(1-600)] [level-1|level-2]$level",
1875 NO_STR
1876 "IS-IS routing protocol\n"
1877 "Set CSNP interval in seconds\n"
1878 "CSNP interval value\n"
1879 "Specify interval for level-1 CSNPs\n"
1880 "Specify interval for level-2 CSNPs\n")
1881{
1882 if (!level || strmatch(level, "level-1"))
1883 nb_cli_enqueue_change(vty,
1884 "./frr-isisd:isis/csnp-interval/level-1",
1885 NB_OP_MODIFY, NULL);
1886 if (!level || strmatch(level, "level-2"))
1887 nb_cli_enqueue_change(vty,
1888 "./frr-isisd:isis/csnp-interval/level-2",
1889 NB_OP_MODIFY, NULL);
1890
1891 return nb_cli_apply_changes(vty, NULL);
1892}
1893
1894void cli_show_ip_isis_csnp_interval(struct vty *vty, struct lyd_node *dnode,
1895 bool show_defaults)
1896{
1897 const char *l1 = yang_dnode_get_string(dnode, "./level-1");
1898 const char *l2 = yang_dnode_get_string(dnode, "./level-2");
1899
1900 if (strmatch(l1, l2))
1901 vty_out(vty, " isis csnp-interval %s\n", l1);
1902 else {
1903 vty_out(vty, " isis csnp-interval %s level-1\n", l1);
1904 vty_out(vty, " isis csnp-interval %s level-2\n", l2);
1905 }
1906}
1907
1908/*
1909 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval
1910 */
1911DEFPY(psnp_interval, psnp_interval_cmd,
1912 "isis psnp-interval (1-120)$intv [level-1|level-2]$level",
1913 "IS-IS routing protocol\n"
1914 "Set PSNP interval in seconds\n"
1915 "PSNP interval value\n"
1916 "Specify interval for level-1 PSNPs\n"
1917 "Specify interval for level-2 PSNPs\n")
1918{
1919 if (!level || strmatch(level, "level-1"))
1920 nb_cli_enqueue_change(vty,
1921 "./frr-isisd:isis/psnp-interval/level-1",
1922 NB_OP_MODIFY, intv_str);
1923 if (!level || strmatch(level, "level-2"))
1924 nb_cli_enqueue_change(vty,
1925 "./frr-isisd:isis/psnp-interval/level-2",
1926 NB_OP_MODIFY, intv_str);
1927
1928 return nb_cli_apply_changes(vty, NULL);
1929}
1930
1931DEFPY(no_psnp_interval, no_psnp_interval_cmd,
1932 "no isis psnp-interval [(1-120)] [level-1|level-2]$level",
1933 NO_STR
1934 "IS-IS routing protocol\n"
1935 "Set PSNP interval in seconds\n"
1936 "PSNP interval value\n"
1937 "Specify interval for level-1 PSNPs\n"
1938 "Specify interval for level-2 PSNPs\n")
1939{
1940 if (!level || strmatch(level, "level-1"))
1941 nb_cli_enqueue_change(vty,
1942 "./frr-isisd:isis/psnp-interval/level-1",
1943 NB_OP_MODIFY, NULL);
1944 if (!level || strmatch(level, "level-2"))
1945 nb_cli_enqueue_change(vty,
1946 "./frr-isisd:isis/psnp-interval/level-2",
1947 NB_OP_MODIFY, NULL);
1948
1949 return nb_cli_apply_changes(vty, NULL);
1950}
1951
1952void cli_show_ip_isis_psnp_interval(struct vty *vty, struct lyd_node *dnode,
1953 bool show_defaults)
1954{
1955 const char *l1 = yang_dnode_get_string(dnode, "./level-1");
1956 const char *l2 = yang_dnode_get_string(dnode, "./level-2");
1957
1958 if (strmatch(l1, l2))
1959 vty_out(vty, " isis psnp-interval %s\n", l1);
1960 else {
1961 vty_out(vty, " isis psnp-interval %s level-1\n", l1);
1962 vty_out(vty, " isis psnp-interval %s level-2\n", l2);
1963 }
1964}
1965
83d043f6
EDP
1966/*
1967 * XPath: /frr-interface:lib/interface/frr-isisd:isis/multi-topology
1968 */
1969DEFPY(circuit_topology, circuit_topology_cmd,
1970 "[no] isis topology"
1971 "<ipv4-unicast"
1972 "|ipv4-mgmt"
1973 "|ipv6-unicast"
1974 "|ipv4-multicast"
1975 "|ipv6-multicast"
1976 "|ipv6-mgmt"
1977 "|ipv6-dstsrc"
1978 ">$topology",
1979 NO_STR
1980 "IS-IS routing protocol\n"
1981 "Configure interface IS-IS topologies\n"
1982 "IPv4 unicast topology\n"
1983 "IPv4 management topology\n"
1984 "IPv6 unicast topology\n"
1985 "IPv4 multicast topology\n"
1986 "IPv6 multicast topology\n"
1987 "IPv6 management topology\n"
1988 "IPv6 dst-src topology\n")
1989{
1990 nb_cli_enqueue_change(vty, ".", NB_OP_MODIFY, no ? "false" : "true");
1991
1992 if (strmatch(topology, "ipv4-mgmt"))
1993 return nb_cli_apply_changes(
1994 vty, "./frr-isisd:isis/multi-topology/ipv4-management");
1995 else if (strmatch(topology, "ipv6-mgmt"))
1996 return nb_cli_apply_changes(
1997 vty, "./frr-isisd:isis/multi-topology/ipv6-management");
1998 else
1999 return nb_cli_apply_changes(
2000 vty, "./frr-isisd:isis/multi-topology/%s", topology);
2001}
2002
2003void cli_show_ip_isis_mt_ipv4_unicast(struct vty *vty, struct lyd_node *dnode,
2004 bool show_defaults)
2005{
2006 if (!yang_dnode_get_bool(dnode, NULL))
2007 vty_out(vty, " no");
2008 vty_out(vty, " isis topology ipv4-unicast\n");
2009}
2010
2011void cli_show_ip_isis_mt_ipv4_multicast(struct vty *vty, struct lyd_node *dnode,
2012 bool show_defaults)
2013{
2014 if (!yang_dnode_get_bool(dnode, NULL))
2015 vty_out(vty, " no");
2016 vty_out(vty, " isis topology ipv4-multicast\n");
2017}
2018
2019void cli_show_ip_isis_mt_ipv4_mgmt(struct vty *vty, struct lyd_node *dnode,
2020 bool show_defaults)
2021{
2022 if (!yang_dnode_get_bool(dnode, NULL))
2023 vty_out(vty, " no");
2024 vty_out(vty, " isis topology ipv4-mgmt\n");
2025}
2026
2027void cli_show_ip_isis_mt_ipv6_unicast(struct vty *vty, struct lyd_node *dnode,
2028 bool show_defaults)
2029{
2030 if (!yang_dnode_get_bool(dnode, NULL))
2031 vty_out(vty, " no");
2032 vty_out(vty, " isis topology ipv6-unicast\n");
2033}
2034
2035void cli_show_ip_isis_mt_ipv6_multicast(struct vty *vty, struct lyd_node *dnode,
2036 bool show_defaults)
2037{
2038 if (!yang_dnode_get_bool(dnode, NULL))
2039 vty_out(vty, " no");
2040 vty_out(vty, " isis topology ipv6-multicast\n");
2041}
2042
2043void cli_show_ip_isis_mt_ipv6_mgmt(struct vty *vty, struct lyd_node *dnode,
2044 bool show_defaults)
2045{
2046 if (!yang_dnode_get_bool(dnode, NULL))
2047 vty_out(vty, " no");
2048 vty_out(vty, " isis topology ipv6-mgmt\n");
2049}
2050
2051void cli_show_ip_isis_mt_ipv6_dstsrc(struct vty *vty, struct lyd_node *dnode,
2052 bool show_defaults)
2053{
2054 if (!yang_dnode_get_bool(dnode, NULL))
2055 vty_out(vty, " no");
2056 vty_out(vty, " isis topology ipv6-dstsrc\n");
2057}
2058
9302fbb6
EDP
2059/*
2060 * XPath: /frr-interface:lib/interface/frr-isisd:isis/circuit-type
2061 */
2062DEFPY(isis_circuit_type, isis_circuit_type_cmd,
2063 "isis circuit-type <level-1|level-1-2|level-2-only>$type",
2064 "IS-IS routing protocol\n"
2065 "Configure circuit type for interface\n"
2066 "Level-1 only adjacencies are formed\n"
2067 "Level-1-2 adjacencies are formed\n"
2068 "Level-2 only adjacencies are formed\n")
2069{
2070 nb_cli_enqueue_change(
2071 vty, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY,
2072 strmatch(type, "level-2-only") ? "level-2" : type);
2073
2074 return nb_cli_apply_changes(vty, NULL);
2075}
2076
2077DEFPY(no_isis_circuit_type, no_isis_circuit_type_cmd,
2078 "no isis circuit-type [level-1|level-1-2|level-2-only]",
2079 NO_STR
2080 "IS-IS routing protocol\n"
2081 "Configure circuit type for interface\n"
2082 "Level-1 only adjacencies are formed\n"
2083 "Level-1-2 adjacencies are formed\n"
2084 "Level-2 only adjacencies are formed\n")
2085{
8685be73
RW
2086 struct interface *ifp;
2087 struct isis_circuit *circuit;
2088 int is_type;
2089 const char *circ_type;
9302fbb6
EDP
2090
2091 /*
2092 * Default value depends on whether the circuit is part of an area,
2093 * and the is-type of the area if there is one. So we need to do this
2094 * here.
2095 */
8685be73
RW
2096 ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false);
2097 if (!ifp)
2098 goto def_val;
9302fbb6 2099
8685be73
RW
2100 circuit = circuit_scan_by_ifp(ifp);
2101 if (!circuit)
2102 goto def_val;
9302fbb6 2103
8685be73
RW
2104 if (circuit->state == C_STATE_UP)
2105 is_type = circuit->area->is_type;
2106 else
2107 goto def_val;
9302fbb6 2108
8685be73
RW
2109 switch (is_type) {
2110 case IS_LEVEL_1:
2111 circ_type = "level-1";
2112 break;
2113 case IS_LEVEL_2:
2114 circ_type = "level-2";
2115 break;
2116 case IS_LEVEL_1_AND_2:
2117 circ_type = "level-1-2";
2118 break;
2119 default:
2120 return CMD_ERR_NO_MATCH;
9302fbb6 2121 }
9302fbb6 2122 nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type",
83981138 2123 NB_OP_MODIFY, circ_type);
9302fbb6
EDP
2124
2125 return nb_cli_apply_changes(vty, NULL);
8685be73
RW
2126
2127def_val:
2128 nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type",
2129 NB_OP_MODIFY, NULL);
2130
2131 return nb_cli_apply_changes(vty, NULL);
9302fbb6
EDP
2132}
2133
2134void cli_show_ip_isis_circ_type(struct vty *vty, struct lyd_node *dnode,
2135 bool show_defaults)
2136{
2137 int level = yang_dnode_get_enum(dnode, NULL);
2138
2139 switch (level) {
2140 case IS_LEVEL_1:
2141 vty_out(vty, " isis circuit-type level-1\n");
2142 break;
2143 case IS_LEVEL_2:
2144 vty_out(vty, " isis circuit-type level-2-only\n");
2145 break;
2146 case IS_LEVEL_1_AND_2:
2147 vty_out(vty, " isis circuit-type level-1-2\n");
2148 break;
2149 }
2150}
2151
d0820765
EDP
2152/*
2153 * XPath: /frr-interface:lib/interface/frr-isisd:isis/network-type
2154 */
2155DEFPY(isis_network, isis_network_cmd, "[no] isis network point-to-point",
2156 NO_STR
2157 "IS-IS routing protocol\n"
2158 "Set network type\n"
2159 "point-to-point network type\n")
2160{
2161 nb_cli_enqueue_change(vty, "./frr-isisd:isis/network-type",
2162 NB_OP_MODIFY,
2163 no ? "broadcast" : "point-to-point");
2164
2165 return nb_cli_apply_changes(vty, NULL);
2166}
2167
2168void cli_show_ip_isis_network_type(struct vty *vty, struct lyd_node *dnode,
2169 bool show_defaults)
2170{
2171 if (yang_dnode_get_enum(dnode, NULL) != CIRCUIT_T_P2P)
2172 vty_out(vty, " no");
2173
2174 vty_out(vty, " isis network point-to-point\n");
2175}
2176
d59c2d6b
EDP
2177/*
2178 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority
2179 */
2180DEFPY(isis_priority, isis_priority_cmd,
2181 "isis priority (0-127)$prio [level-1|level-2]$level",
2182 "IS-IS routing protocol\n"
2183 "Set priority for Designated Router election\n"
2184 "Priority value\n"
2185 "Specify priority for level-1 routing\n"
2186 "Specify priority for level-2 routing\n")
2187{
2188 if (!level || strmatch(level, "level-1"))
2189 nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-1",
2190 NB_OP_MODIFY, prio_str);
2191 if (!level || strmatch(level, "level-2"))
2192 nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-2",
2193 NB_OP_MODIFY, prio_str);
2194
2195 return nb_cli_apply_changes(vty, NULL);
2196}
2197
2198DEFPY(no_isis_priority, no_isis_priority_cmd,
2199 "no isis priority [(0-127)] [level-1|level-2]$level",
2200 NO_STR
2201 "IS-IS routing protocol\n"
2202 "Set priority for Designated Router election\n"
2203 "Priority value\n"
2204 "Specify priority for level-1 routing\n"
2205 "Specify priority for level-2 routing\n")
2206{
2207 if (!level || strmatch(level, "level-1"))
2208 nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-1",
2209 NB_OP_MODIFY, NULL);
2210 if (!level || strmatch(level, "level-2"))
2211 nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-2",
2212 NB_OP_MODIFY, NULL);
2213
2214 return nb_cli_apply_changes(vty, NULL);
2215}
2216
2217void cli_show_ip_isis_priority(struct vty *vty, struct lyd_node *dnode,
2218 bool show_defaults)
2219{
2220 const char *l1 = yang_dnode_get_string(dnode, "./level-1");
2221 const char *l2 = yang_dnode_get_string(dnode, "./level-2");
2222
2223 if (strmatch(l1, l2))
2224 vty_out(vty, " isis priority %s\n", l1);
2225 else {
2226 vty_out(vty, " isis priority %s level-1\n", l1);
2227 vty_out(vty, " isis priority %s level-2\n", l2);
2228 }
2229}
2230
2adf66ff
EDP
2231/*
2232 * XPath: /frr-isisd:isis/instance/log-adjacency-changes
2233 */
2234DEFPY(log_adj_changes, log_adj_changes_cmd, "[no] log-adjacency-changes",
2235 NO_STR "Log changes in adjacency state\n")
2236{
5f1e5e3f
EDP
2237 nb_cli_enqueue_change(vty, "./log-adjacency-changes", NB_OP_MODIFY,
2238 no ? "false" : "true");
2adf66ff
EDP
2239
2240 return nb_cli_apply_changes(vty, NULL);
2241}
2242
2243void cli_show_isis_log_adjacency(struct vty *vty, struct lyd_node *dnode,
2244 bool show_defaults)
2245{
5f1e5e3f
EDP
2246 if (!yang_dnode_get_bool(dnode, NULL))
2247 vty_out(vty, " no");
2adf66ff
EDP
2248 vty_out(vty, " log-adjacency-changes\n");
2249}
2250
20bd27e2
EDP
2251void isis_cli_init(void)
2252{
aaf2fd21
EDP
2253 install_element(CONFIG_NODE, &router_isis_cmd);
2254 install_element(CONFIG_NODE, &no_router_isis_cmd);
2255
2256 install_element(INTERFACE_NODE, &ip_router_isis_cmd);
2257 install_element(INTERFACE_NODE, &ip6_router_isis_cmd);
2258 install_element(INTERFACE_NODE, &no_ip_router_isis_cmd);
c3e6ac0b 2259 install_element(INTERFACE_NODE, &isis_bfd_cmd);
f084ea55
EDP
2260
2261 install_element(ISIS_NODE, &net_cmd);
e6bdae69
EDP
2262
2263 install_element(ISIS_NODE, &is_type_cmd);
2264 install_element(ISIS_NODE, &no_is_type_cmd);
6bb043cd
EDP
2265
2266 install_element(ISIS_NODE, &dynamic_hostname_cmd);
05a3f9f0
EDP
2267
2268 install_element(ISIS_NODE, &set_overload_bit_cmd);
2269 install_element(ISIS_NODE, &set_attached_bit_cmd);
e0df3206
EDP
2270
2271 install_element(ISIS_NODE, &metric_style_cmd);
2272 install_element(ISIS_NODE, &no_metric_style_cmd);
933536e3
EDP
2273
2274 install_element(ISIS_NODE, &area_passwd_cmd);
2275 install_element(ISIS_NODE, &domain_passwd_cmd);
2276 install_element(ISIS_NODE, &no_area_passwd_cmd);
1d6fe72e
EDP
2277
2278 install_element(ISIS_NODE, &lsp_gen_interval_cmd);
2279 install_element(ISIS_NODE, &no_lsp_gen_interval_cmd);
7e869004
EDP
2280 install_element(ISIS_NODE, &lsp_refresh_interval_cmd);
2281 install_element(ISIS_NODE, &no_lsp_refresh_interval_cmd);
ea120aa0
EDP
2282 install_element(ISIS_NODE, &max_lsp_lifetime_cmd);
2283 install_element(ISIS_NODE, &no_max_lsp_lifetime_cmd);
d2c970ff
EDP
2284 install_element(ISIS_NODE, &lsp_timers_cmd);
2285 install_element(ISIS_NODE, &no_lsp_timers_cmd);
27a45d16
EDP
2286 install_element(ISIS_NODE, &area_lsp_mtu_cmd);
2287 install_element(ISIS_NODE, &no_area_lsp_mtu_cmd);
dcb1dcd6
EDP
2288
2289 install_element(ISIS_NODE, &spf_interval_cmd);
2290 install_element(ISIS_NODE, &no_spf_interval_cmd);
5336ba30
EDP
2291 install_element(ISIS_NODE, &spf_delay_ietf_cmd);
2292 install_element(ISIS_NODE, &no_spf_delay_ietf_cmd);
66e45e10
EDP
2293
2294 install_element(ISIS_NODE, &area_purge_originator_cmd);
d1a80ef6
EDP
2295
2296 install_element(ISIS_NODE, &isis_mpls_te_on_cmd);
2297 install_element(ISIS_NODE, &no_isis_mpls_te_on_cmd);
2298 install_element(ISIS_NODE, &isis_mpls_te_router_addr_cmd);
2e2a8b91 2299 install_element(ISIS_NODE, &no_isis_mpls_te_router_addr_cmd);
d1a80ef6 2300 install_element(ISIS_NODE, &isis_mpls_te_inter_as_cmd);
8b104c10
EDP
2301
2302 install_element(ISIS_NODE, &isis_default_originate_cmd);
a041ac8e 2303 install_element(ISIS_NODE, &isis_redistribute_cmd);
22af6a80
EDP
2304
2305 install_element(ISIS_NODE, &isis_topology_cmd);
a6a36c41 2306
8f6c8936
RW
2307 install_element(ISIS_NODE, &isis_sr_enable_cmd);
2308 install_element(ISIS_NODE, &no_isis_sr_enable_cmd);
2309 install_element(ISIS_NODE, &isis_sr_global_block_label_range_cmd);
2310 install_element(ISIS_NODE, &no_isis_sr_global_block_label_range_cmd);
2311 install_element(ISIS_NODE, &isis_sr_node_msd_cmd);
2312 install_element(ISIS_NODE, &no_isis_sr_node_msd_cmd);
2313 install_element(ISIS_NODE, &isis_sr_prefix_sid_cmd);
2314 install_element(ISIS_NODE, &no_isis_sr_prefix_sid_cmd);
2315
a6a36c41 2316 install_element(INTERFACE_NODE, &isis_passive_cmd);
3e20c83a
EDP
2317
2318 install_element(INTERFACE_NODE, &isis_passwd_cmd);
2319 install_element(INTERFACE_NODE, &no_isis_passwd_cmd);
be49219c
EDP
2320
2321 install_element(INTERFACE_NODE, &isis_metric_cmd);
2322 install_element(INTERFACE_NODE, &no_isis_metric_cmd);
356a2e3c
EDP
2323
2324 install_element(INTERFACE_NODE, &isis_hello_interval_cmd);
2325 install_element(INTERFACE_NODE, &no_isis_hello_interval_cmd);
4e75a67d
EDP
2326
2327 install_element(INTERFACE_NODE, &isis_hello_multiplier_cmd);
2328 install_element(INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
5f2ce446
EDP
2329
2330 install_element(INTERFACE_NODE, &isis_threeway_adj_cmd);
7b6b75e5
EDP
2331
2332 install_element(INTERFACE_NODE, &isis_hello_padding_cmd);
9ce808b9
EDP
2333
2334 install_element(INTERFACE_NODE, &csnp_interval_cmd);
2335 install_element(INTERFACE_NODE, &no_csnp_interval_cmd);
2336
2337 install_element(INTERFACE_NODE, &psnp_interval_cmd);
2338 install_element(INTERFACE_NODE, &no_psnp_interval_cmd);
83d043f6
EDP
2339
2340 install_element(INTERFACE_NODE, &circuit_topology_cmd);
9302fbb6
EDP
2341
2342 install_element(INTERFACE_NODE, &isis_circuit_type_cmd);
2343 install_element(INTERFACE_NODE, &no_isis_circuit_type_cmd);
d0820765
EDP
2344
2345 install_element(INTERFACE_NODE, &isis_network_cmd);
d59c2d6b
EDP
2346
2347 install_element(INTERFACE_NODE, &isis_priority_cmd);
2348 install_element(INTERFACE_NODE, &no_isis_priority_cmd);
2adf66ff
EDP
2349
2350 install_element(ISIS_NODE, &log_adj_changes_cmd);
20bd27e2
EDP
2351}
2352
2353#endif /* ifndef FABRICD */