]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isisd.c
isisd: move and rename the infinity metric constants
[mirror_frr.git] / isisd / isisd.c
CommitLineData
eb5d44eb 1/*
2 * IS-IS Rout(e)ing protocol - isisd.c
3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
d62a17ae 5 * Tampere University of Technology
eb5d44eb 6 * Institute of Communications Engineering
7 *
d62a17ae 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public Licenseas published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
eb5d44eb 11 * any later version.
12 *
d62a17ae 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
eb5d44eb 16 * more details.
896014f4
DL
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
eb5d44eb 21 */
22
eb5d44eb 23#include <zebra.h>
eb5d44eb 24
25#include "thread.h"
26#include "vty.h"
27#include "command.h"
28#include "log.h"
29#include "memory.h"
3f045a08 30#include "time.h"
eb5d44eb 31#include "linklist.h"
32#include "if.h"
33#include "hash.h"
34#include "stream.h"
35#include "prefix.h"
36#include "table.h"
676a4ea3 37#include "qobj.h"
65251ce8 38#include "zclient.h"
eab88f36 39#include "vrf.h"
03f7e182 40#include "spf_backoff.h"
aaf2fd21 41#include "lib/northbound_cli.h"
eb5d44eb 42
eb5d44eb 43#include "isisd/isis_constants.h"
44#include "isisd/isis_common.h"
eb5d44eb 45#include "isisd/isis_flags.h"
3f045a08
JB
46#include "isisd/isis_circuit.h"
47#include "isisd/isis_csm.h"
eb5d44eb 48#include "isisd/isisd.h"
49#include "isisd/isis_dynhn.h"
50#include "isisd/isis_adjacency.h"
51#include "isisd/isis_pdu.h"
52#include "isisd/isis_misc.h"
53#include "isisd/isis_constants.h"
eb5d44eb 54#include "isisd/isis_lsp.h"
55#include "isisd/isis_spf.h"
56#include "isisd/isis_route.h"
57#include "isisd/isis_zebra.h"
58#include "isisd/isis_events.h"
f8c06e2c 59#include "isisd/isis_te.h"
064f4896 60#include "isisd/isis_mt.h"
26f6acaf 61#include "isisd/isis_sr.h"
8e6fb83b 62#include "isisd/fabricd.h"
2a1c520e 63#include "isisd/isis_nb.h"
eb5d44eb 64
e740f9c1 65/* For debug statement. */
66unsigned long debug_adj_pkt;
67unsigned long debug_snp_pkt;
68unsigned long debug_update_pkt;
69unsigned long debug_spf_events;
70unsigned long debug_rte_events;
71unsigned long debug_events;
72unsigned long debug_pkt_dump;
73unsigned long debug_lsp_gen;
74unsigned long debug_lsp_sched;
75unsigned long debug_flooding;
76unsigned long debug_bfd;
77unsigned long debug_tx_queue;
78unsigned long debug_sr;
1cbf96a8 79unsigned long debug_ldp_sync;
c951ee6e 80unsigned long debug_tilfa;
e740f9c1 81
676a4ea3
DL
82DEFINE_QOBJ_TYPE(isis_area)
83
eab88f36
K
84/* ISIS process wide configuration. */
85static struct isis_master isis_master;
86
87/* ISIS process wide configuration pointer to export. */
88struct isis_master *im;
89
41b36e90
PJ
90/*
91 * Prototypes.
92 */
41b36e90 93int isis_area_get(struct vty *, const char *);
3f045a08
JB
94int area_net_title(struct vty *, const char *);
95int area_clear_net_title(struct vty *, const char *);
eab88f36
K
96int show_isis_interface_common(struct vty *, const char *ifname, char,
97 const char *vrf_name, bool all_vrf);
98int show_isis_neighbor_common(struct vty *, const char *id, char,
99 const char *vrf_name, bool all_vrf);
100int clear_isis_neighbor_common(struct vty *, const char *id, const char *vrf_name,
101 bool all_vrf);
102
103static void isis_add(struct isis *isis)
104{
105 listnode_add(im->isis, isis);
106}
107
108static void isis_delete(struct isis *isis)
109{
110 listnode_delete(im->isis, isis);
111}
112
113/* Link ISIS instance to VRF. */
114void isis_vrf_link(struct isis *isis, struct vrf *vrf)
115{
116 isis->vrf_id = vrf->vrf_id;
117 if (vrf->info != (void *)isis)
118 vrf->info = (void *)isis;
119}
120
121/* Unlink ISIS instance to VRF. */
122void isis_vrf_unlink(struct isis *isis, struct vrf *vrf)
123{
124 if (vrf->info == (void *)isis)
125 vrf->info = NULL;
126 isis->vrf_id = VRF_UNKNOWN;
127}
128
129struct isis *isis_lookup_by_vrfid(vrf_id_t vrf_id)
130{
36944791
RW
131 struct isis *isis;
132 struct listnode *node;
41b36e90 133
36944791 134 for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
eab88f36
K
135 if (isis->vrf_id == vrf_id)
136 return isis;
36944791 137
eab88f36
K
138 return NULL;
139}
140
141struct isis *isis_lookup_by_vrfname(const char *vrfname)
142{
36944791
RW
143 struct isis *isis;
144 struct listnode *node;
eab88f36 145
36944791 146 for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
eab88f36
K
147 if (isis->name && vrfname && strcmp(isis->name, vrfname) == 0)
148 return isis;
36944791 149
eab88f36
K
150 return NULL;
151}
152
36944791 153struct isis *isis_lookup_by_sysid(const uint8_t *sysid)
eab88f36 154{
36944791
RW
155 struct isis *isis;
156 struct listnode *node;
157
158 for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
eab88f36
K
159 if (!memcmp(isis->sysid, sysid, ISIS_SYS_ID_LEN))
160 return isis;
36944791 161
eab88f36
K
162 return NULL;
163}
164
165void isis_master_init(struct thread_master *master)
166{
167 memset(&isis_master, 0, sizeof(struct isis_master));
168 im = &isis_master;
169 im->isis = list_new();
170 im->master = master;
171}
41b36e90 172
65251ce8 173void isis_global_instance_create(const char *vrf_name)
d62a17ae 174{
36944791 175 struct isis *isis;
eab88f36 176
65251ce8 177 isis = isis_lookup_by_vrfname(vrf_name);
eab88f36 178 if (isis == NULL) {
65251ce8 179 isis = isis_new(vrf_name);
eab88f36
K
180 isis_add(isis);
181 }
182}
183
65251ce8 184struct isis *isis_new(const char *vrf_name)
eab88f36 185{
36944791
RW
186 struct vrf *vrf;
187 struct isis *isis;
eab88f36 188
d62a17ae 189 isis = XCALLOC(MTYPE_ISIS, sizeof(struct isis));
65251ce8 190 vrf = vrf_lookup_by_name(vrf_name);
eab88f36
K
191
192 if (vrf) {
65251ce8 193 isis->vrf_id = vrf->vrf_id;
eab88f36
K
194 isis_vrf_link(isis, vrf);
195 isis->name = XSTRDUP(MTYPE_ISIS, vrf->name);
65251ce8 196 } else {
197 isis->vrf_id = VRF_UNKNOWN;
198 isis->name = XSTRDUP(MTYPE_ISIS, vrf_name);
eab88f36
K
199 }
200
201 if (IS_DEBUG_EVENTS)
202 zlog_debug(
203 "%s: Create new isis instance with vrf_name %s vrf_id %u",
204 __func__, isis->name, isis->vrf_id);
205
d62a17ae 206 /*
207 * Default values
208 */
209 isis->max_area_addrs = 3;
eab88f36 210 isis->process_id = getpid();
d62a17ae 211 isis->router_id = 0;
212 isis->area_list = list_new();
213 isis->init_circ_list = list_new();
214 isis->uptime = time(NULL);
eab88f36
K
215 dyn_cache_init(isis);
216
217 return isis;
d62a17ae 218}
219
eab88f36 220struct isis_area *isis_area_create(const char *area_tag, const char *vrf_name)
d62a17ae 221{
222 struct isis_area *area;
eab88f36
K
223 struct isis *isis = NULL;
224 struct vrf *vrf = NULL;
d62a17ae 225 area = XCALLOC(MTYPE_ISIS_AREA, sizeof(struct isis_area));
226
7b36d36e
RW
227 if (vrf_name) {
228 vrf = vrf_lookup_by_name(vrf_name);
229 if (vrf) {
230 isis = isis_lookup_by_vrfid(vrf->vrf_id);
231 if (isis == NULL) {
65251ce8 232 isis = isis_new(vrf_name);
233 isis_add(isis);
234 }
235 } else {
236 isis = isis_lookup_by_vrfid(VRF_UNKNOWN);
237 if (isis == NULL) {
238 isis = isis_new(vrf_name);
7b36d36e
RW
239 isis_add(isis);
240 }
65251ce8 241 }
7b36d36e
RW
242 } else {
243 isis = isis_lookup_by_vrfid(VRF_DEFAULT);
244 if (isis == NULL) {
65251ce8 245 isis = isis_new(VRF_DEFAULT_NAME);
7b36d36e
RW
246 isis_add(isis);
247 }
248 }
249
250 listnode_add(isis->area_list, area);
251 area->isis = isis;
252
d62a17ae 253 /*
65f18157 254 * Fabricd runs only as level-2.
26eb18e2 255 * For IS-IS, the default is level-1-2
d62a17ae 256 */
26eb18e2 257 if (fabricd)
65f18157 258 area->is_type = IS_LEVEL_2;
cc50ddb2
EDP
259 else
260 area->is_type = yang_get_default_enum(
261 "/frr-isisd:isis/instance/is-type");
d62a17ae 262
263 /*
264 * intialize the databases
265 */
4bef0ec4
DL
266 if (area->is_type & IS_LEVEL_1)
267 lsp_db_init(&area->lspdb[0]);
268 if (area->is_type & IS_LEVEL_2)
269 lsp_db_init(&area->lspdb[1]);
d62a17ae 270
271 spftree_area_init(area);
272
273 area->circuit_list = list_new();
75eddbc3 274 area->adjacency_list = list_new();
d62a17ae 275 area->area_addrs = list_new();
52a7c25e
RW
276 if (!CHECK_FLAG(im->options, F_ISIS_UNIT_TEST))
277 thread_add_timer(master, lsp_tick, area, 1, &area->t_tick);
d62a17ae 278 flags_initialize(&area->flags);
279
26f6acaf
RW
280 isis_sr_area_init(area);
281
d62a17ae 282 /*
283 * Default values
284 */
cc50ddb2
EDP
285#ifndef FABRICD
286 enum isis_metric_style default_style;
287
288 area->max_lsp_lifetime[0] = yang_get_default_uint16(
d2c970ff 289 "/frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime");
cc50ddb2 290 area->max_lsp_lifetime[1] = yang_get_default_uint16(
d2c970ff 291 "/frr-isisd:isis/instance/lsp/timers/level-2/maximum-lifetime");
cc50ddb2 292 area->lsp_refresh[0] = yang_get_default_uint16(
d2c970ff 293 "/frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval");
cc50ddb2 294 area->lsp_refresh[1] = yang_get_default_uint16(
d2c970ff 295 "/frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval");
cc50ddb2 296 area->lsp_gen_interval[0] = yang_get_default_uint16(
d2c970ff 297 "/frr-isisd:isis/instance/lsp/timers/level-1/generation-interval");
cc50ddb2 298 area->lsp_gen_interval[1] = yang_get_default_uint16(
d2c970ff 299 "/frr-isisd:isis/instance/lsp/timers/level-2/generation-interval");
cc50ddb2
EDP
300 area->min_spf_interval[0] = yang_get_default_uint16(
301 "/frr-isisd:isis/instance/spf/minimum-interval/level-1");
302 area->min_spf_interval[1] = yang_get_default_uint16(
303 "/frr-isisd:isis/instance/spf/minimum-interval/level-1");
304 area->dynhostname = yang_get_default_bool(
305 "/frr-isisd:isis/instance/dynamic-hostname");
306 default_style =
307 yang_get_default_enum("/frr-isisd:isis/instance/metric-style");
308 area->oldmetric = default_style == ISIS_WIDE_METRIC ? 0 : 1;
309 area->newmetric = default_style == ISIS_NARROW_METRIC ? 0 : 1;
310 area->lsp_frag_threshold = 90; /* not currently configurable */
311 area->lsp_mtu =
312 yang_get_default_uint16("/frr-isisd:isis/instance/lsp/mtu");
313#else
d62a17ae 314 area->max_lsp_lifetime[0] = DEFAULT_LSP_LIFETIME; /* 1200 */
315 area->max_lsp_lifetime[1] = DEFAULT_LSP_LIFETIME; /* 1200 */
316 area->lsp_refresh[0] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
317 area->lsp_refresh[1] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
318 area->lsp_gen_interval[0] = DEFAULT_MIN_LSP_GEN_INTERVAL;
319 area->lsp_gen_interval[1] = DEFAULT_MIN_LSP_GEN_INTERVAL;
320 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
321 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
322 area->dynhostname = 1;
323 area->oldmetric = 0;
324 area->newmetric = 1;
325 area->lsp_frag_threshold = 90;
326 area->lsp_mtu = DEFAULT_LSP_MTU;
cc50ddb2 327#endif /* ifndef FABRICD */
d62a17ae 328
329 area_mt_init(area);
41b36e90 330
d62a17ae 331 area->area_tag = strdup(area_tag);
eab88f36 332
8e6fb83b 333 if (fabricd)
b30e837b 334 area->fabricd = fabricd_new(area);
9196731f
CF
335
336 area->lsp_refresh_arg[0].area = area;
337 area->lsp_refresh_arg[0].level = IS_LEVEL_1;
338 area->lsp_refresh_arg[1].area = area;
339 area->lsp_refresh_arg[1].level = IS_LEVEL_2;
340
690497fb
G
341 area->bfd_signalled_down = false;
342 area->bfd_force_spf_refresh = false;
343
9196731f 344
d62a17ae 345 QOBJ_REG(area, isis_area);
eb5d44eb 346
d62a17ae 347 return area;
348}
3f045a08 349
65251ce8 350struct isis_area *isis_area_lookup_by_vrf(const char *area_tag,
351 const char *vrf_name)
352{
353 struct isis_area *area;
354 struct listnode *node;
355 struct isis *isis = NULL;
356
357 isis = isis_lookup_by_vrfname(vrf_name);
358 if (isis == NULL)
359 return NULL;
360
361 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area))
362 if (strcmp(area->area_tag, area_tag) == 0)
363 return area;
364
365 return NULL;
366}
367
eab88f36 368struct isis_area *isis_area_lookup(const char *area_tag, vrf_id_t vrf_id)
d62a17ae 369{
370 struct isis_area *area;
371 struct listnode *node;
36944791 372 struct isis *isis;
eab88f36
K
373
374 isis = isis_lookup_by_vrfid(vrf_id);
375 if (isis == NULL)
376 return NULL;
3f045a08 377
d62a17ae 378 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area))
379 if ((area->area_tag == NULL && area_tag == NULL)
380 || (area->area_tag && area_tag
381 && strcmp(area->area_tag, area_tag) == 0))
382 return area;
3f045a08 383
d62a17ae 384 return NULL;
385}
3f045a08 386
d62a17ae 387int isis_area_get(struct vty *vty, const char *area_tag)
388{
389 struct isis_area *area;
5475ecf7 390
eab88f36 391 area = isis_area_lookup(area_tag, VRF_DEFAULT);
03f7e182 392
d62a17ae 393 if (area) {
7c0cbd0e 394 VTY_PUSH_CONTEXT(ROUTER_NODE, area);
d62a17ae 395 return CMD_SUCCESS;
396 }
397
eab88f36 398 area = isis_area_create(area_tag, VRF_DEFAULT_NAME);
3f045a08 399
e740f9c1 400 if (IS_DEBUG_EVENTS)
d62a17ae 401 zlog_debug("New IS-IS area instance %s", area->area_tag);
3f045a08 402
7c0cbd0e 403 VTY_PUSH_CONTEXT(ROUTER_NODE, area);
f3ccedaa 404
d62a17ae 405 return CMD_SUCCESS;
406}
3f045a08 407
14c6e772 408void isis_area_destroy(struct isis_area *area)
eb5d44eb 409{
d62a17ae 410 struct listnode *node, *nnode;
411 struct isis_circuit *circuit;
412 struct area_addr *addr;
eb5d44eb 413
d62a17ae 414 QOBJ_UNREG(area);
415
b30e837b
CF
416 if (fabricd)
417 fabricd_finish(area->fabricd);
418
2e2a8b91
OD
419 /* Disable MPLS if necessary before flooding LSP */
420 if (IS_MPLS_TE(area->mta))
421 area->mta->status = disable;
422
d62a17ae 423 if (area->circuit_list) {
424 for (ALL_LIST_ELEMENTS(area->circuit_list, node, nnode,
425 circuit)) {
426 circuit->ip_router = 0;
427 circuit->ipv6_router = 0;
428 isis_csm_state_change(ISIS_DISABLE, circuit, area);
429 }
6a154c88 430 list_delete(&area->circuit_list);
d62a17ae 431 }
75eddbc3 432 list_delete(&area->adjacency_list);
d62a17ae 433
4bef0ec4
DL
434 lsp_db_fini(&area->lspdb[0]);
435 lsp_db_fini(&area->lspdb[1]);
d62a17ae 436
3dace42d 437 /* invalidate and verify to delete all routes from zebra */
688ea1cb 438 isis_area_invalidate_routes(area, area->is_type);
3dace42d
CF
439 isis_area_verify_routes(area);
440
26f6acaf
RW
441 isis_sr_area_term(area);
442
d62a17ae 443 spftree_area_del(area);
444
8f15843b
DS
445 if (area->spf_timer[0])
446 isis_spf_timer_free(THREAD_ARG(area->spf_timer[0]));
50478845 447 thread_cancel(&area->spf_timer[0]);
8f15843b
DS
448 if (area->spf_timer[1])
449 isis_spf_timer_free(THREAD_ARG(area->spf_timer[1]));
50478845 450 thread_cancel(&area->spf_timer[1]);
d62a17ae 451
452 spf_backoff_free(area->spf_delay_ietf[0]);
453 spf_backoff_free(area->spf_delay_ietf[1]);
454
52a7c25e
RW
455 if (!CHECK_FLAG(im->options, F_ISIS_UNIT_TEST))
456 isis_redist_area_finish(area);
d62a17ae 457
458 for (ALL_LIST_ELEMENTS(area->area_addrs, node, nnode, addr)) {
459 list_delete_node(area->area_addrs, node);
460 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
461 }
462 area->area_addrs = NULL;
463
50478845
MS
464 thread_cancel(&area->t_tick);
465 thread_cancel(&area->t_lsp_refresh[0]);
466 thread_cancel(&area->t_lsp_refresh[1]);
d62a17ae 467
468 thread_cancel_event(master, area);
469
eab88f36 470 listnode_delete(area->isis->area_list, area);
d62a17ae 471
472 free(area->area_tag);
473
474 area_mt_finish(area);
475
eab88f36
K
476 if (listcount(area->isis->area_list) == 0) {
477 memset(area->isis->sysid, 0, ISIS_SYS_ID_LEN);
478 area->isis->sysid_set = 0;
479 }
480
d62a17ae 481 XFREE(MTYPE_ISIS_AREA, area);
482
eab88f36
K
483}
484
65251ce8 485/* This is hook function for vrf create called as part of vrf_init */
486static int isis_vrf_new(struct vrf *vrf)
487{
488 if (IS_DEBUG_EVENTS)
489 zlog_debug("%s: VRF Created: %s(%u)", __func__, vrf->name,
490 vrf->vrf_id);
491
492 return 0;
493}
494
495/* This is hook function for vrf delete call as part of vrf_init */
496static int isis_vrf_delete(struct vrf *vrf)
497{
498 if (IS_DEBUG_EVENTS)
499 zlog_debug("%s: VRF Deletion: %s(%u)", __func__, vrf->name,
500 vrf->vrf_id);
501
502 return 0;
503}
504
505static int isis_vrf_enable(struct vrf *vrf)
506{
507 struct isis *isis;
508 vrf_id_t old_vrf_id;
509
510 if (IS_DEBUG_EVENTS)
511 zlog_debug("%s: VRF %s id %u enabled", __func__, vrf->name,
512 vrf->vrf_id);
513
514 isis = isis_lookup_by_vrfname(vrf->name);
515 if (isis) {
516 if (isis->name && strmatch(vrf->name, VRF_DEFAULT_NAME)) {
517 XFREE(MTYPE_ISIS, isis->name);
518 isis->name = NULL;
519 }
520 old_vrf_id = isis->vrf_id;
521 /* We have instance configured, link to VRF and make it "up". */
522 isis_vrf_link(isis, vrf);
523 if (IS_DEBUG_EVENTS)
524 zlog_debug(
525 "%s: isis linked to vrf %s vrf_id %u (old id %u)",
526 __func__, vrf->name, isis->vrf_id, old_vrf_id);
527 if (old_vrf_id != isis->vrf_id) {
528 frr_with_privs (&isisd_privs) {
529 /* stop zebra redist to us for old vrf */
530 zclient_send_dereg_requests(zclient,
531 old_vrf_id);
532 /* start zebra redist to us for new vrf */
533 isis_zebra_vrf_register(isis);
534 }
535 }
536 }
537
538 return 0;
539}
540
541static int isis_vrf_disable(struct vrf *vrf)
542{
543 struct isis *isis;
544 vrf_id_t old_vrf_id = VRF_UNKNOWN;
545
546 if (vrf->vrf_id == VRF_DEFAULT)
547 return 0;
548
549 if (IS_DEBUG_EVENTS)
550 zlog_debug("%s: VRF %s id %d disabled.", __func__, vrf->name,
551 vrf->vrf_id);
552 isis = isis_lookup_by_vrfname(vrf->name);
553 if (isis) {
554 old_vrf_id = isis->vrf_id;
555
556 /* We have instance configured, unlink
557 * from VRF and make it "down".
558 */
559 isis_vrf_unlink(isis, vrf);
560 if (IS_DEBUG_EVENTS)
561 zlog_debug("%s: isis old_vrf_id %d unlinked", __func__,
562 old_vrf_id);
563 }
564
565 return 0;
566}
567
568void isis_vrf_init(void)
569{
570 vrf_init(isis_vrf_new, isis_vrf_enable, isis_vrf_disable,
571 isis_vrf_delete, isis_vrf_enable);
572}
573
eab88f36
K
574void isis_finish(struct isis *isis)
575{
576 struct vrf *vrf = NULL;
577
578 isis_delete(isis);
579 if (isis->name) {
580 vrf = vrf_lookup_by_name(isis->name);
581 if (vrf)
582 isis_vrf_unlink(isis, vrf);
583 XFREE(MTYPE_ISIS, isis->name);
584 } else {
585 vrf = vrf_lookup_by_id(VRF_DEFAULT);
586 if (vrf)
587 isis_vrf_unlink(isis, vrf);
d62a17ae 588 }
eab88f36 589
d53e72e5 590 isis_redist_free(isis);
e76731cf
DS
591 list_delete(&isis->area_list);
592 list_delete(&isis->init_circ_list);
eab88f36
K
593 XFREE(MTYPE_ISIS, isis);
594}
595
596void isis_terminate()
597{
36944791 598 struct isis *isis;
eab88f36
K
599 struct listnode *node, *nnode;
600
601 if (listcount(im->isis) == 0)
602 return;
603
604 for (ALL_LIST_ELEMENTS(im->isis, node, nnode, isis))
605 isis_finish(isis);
d62a17ae 606}
607
22af6a80 608#ifdef FABRICD
d62a17ae 609static void area_set_mt_enabled(struct isis_area *area, uint16_t mtid,
610 bool enabled)
611{
612 struct isis_area_mt_setting *setting;
613
614 setting = area_get_mt_setting(area, mtid);
615 if (setting->enabled != enabled) {
616 setting->enabled = enabled;
617 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0);
618 }
619}
620
621static void area_set_mt_overload(struct isis_area *area, uint16_t mtid,
622 bool overload)
623{
624 struct isis_area_mt_setting *setting;
625
626 setting = area_get_mt_setting(area, mtid);
627 if (setting->overload != overload) {
628 setting->overload = overload;
629 if (setting->enabled)
630 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2,
631 0);
632 }
633}
22af6a80 634#endif /* ifdef FABRICD */
d62a17ae 635
636int area_net_title(struct vty *vty, const char *net_title)
637{
638 VTY_DECLVAR_CONTEXT(isis_area, area);
639 struct area_addr *addr;
640 struct area_addr *addrp;
641 struct listnode *node;
eb5d44eb 642
d7c0a89a 643 uint8_t buff[255];
d62a17ae 644
645 /* We check that we are not over the maximal number of addresses */
eab88f36 646 if (listcount(area->area_addrs) >= area->isis->max_area_addrs) {
d62a17ae 647 vty_out(vty,
648 "Maximum of area addresses (%d) already reached \n",
eab88f36 649 area->isis->max_area_addrs);
d62a17ae 650 return CMD_ERR_NOTHING_TODO;
651 }
652
653 addr = XMALLOC(MTYPE_ISIS_AREA_ADDR, sizeof(struct area_addr));
654 addr->addr_len = dotformat2buff(buff, net_title);
655 memcpy(addr->area_addr, buff, addr->addr_len);
eb5d44eb 656#ifdef EXTREME_DEBUG
d62a17ae 657 zlog_debug("added area address %s for area %s (address length %d)",
658 net_title, area->area_tag, addr->addr_len);
eb5d44eb 659#endif /* EXTREME_DEBUG */
d62a17ae 660 if (addr->addr_len < 8 || addr->addr_len > 20) {
661 vty_out(vty,
662 "area address must be at least 8..20 octets long (%d)\n",
663 addr->addr_len);
664 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
a5fdb4c5 665 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 666 }
667
668 if (addr->area_addr[addr->addr_len - 1] != 0) {
669 vty_out(vty,
670 "nsel byte (last byte) in area address must be 0\n");
671 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
a5fdb4c5 672 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 673 }
674
eab88f36 675 if (area->isis->sysid_set == 0) {
d62a17ae 676 /*
677 * First area address - get the SystemID for this router
678 */
eab88f36
K
679 memcpy(area->isis->sysid, GETSYSID(addr), ISIS_SYS_ID_LEN);
680 area->isis->sysid_set = 1;
e740f9c1 681 if (IS_DEBUG_EVENTS)
d62a17ae 682 zlog_debug("Router has SystemID %s",
eab88f36 683 sysid_print(area->isis->sysid));
d62a17ae 684 } else {
685 /*
686 * Check that the SystemID portions match
687 */
eab88f36
K
688 if (memcmp(area->isis->sysid, GETSYSID(addr),
689 ISIS_SYS_ID_LEN)) {
d62a17ae 690 vty_out(vty,
691 "System ID must not change when defining additional area addresses\n");
692 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
a5fdb4c5 693 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 694 }
695
696 /* now we see that we don't already have this address */
697 for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node, addrp)) {
698 if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN)
699 != (addr->addr_len))
700 continue;
701 if (!memcmp(addrp->area_addr, addr->area_addr,
702 addr->addr_len)) {
703 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
704 return CMD_SUCCESS; /* silent fail */
705 }
706 }
707 }
708
709 /*
710 * Forget the systemID part of the address
711 */
712 addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN);
713 listnode_add(area->area_addrs, addr);
714
715 /* only now we can safely generate our LSPs for this area */
716 if (listcount(area->area_addrs) > 0) {
717 if (area->is_type & IS_LEVEL_1)
718 lsp_generate(area, IS_LEVEL_1);
719 if (area->is_type & IS_LEVEL_2)
720 lsp_generate(area, IS_LEVEL_2);
721 }
722
723 return CMD_SUCCESS;
724}
725
726int area_clear_net_title(struct vty *vty, const char *net_title)
727{
728 VTY_DECLVAR_CONTEXT(isis_area, area);
729 struct area_addr addr, *addrp = NULL;
730 struct listnode *node;
d7c0a89a 731 uint8_t buff[255];
d62a17ae 732
733 addr.addr_len = dotformat2buff(buff, net_title);
734 if (addr.addr_len < 8 || addr.addr_len > 20) {
735 vty_out(vty,
736 "Unsupported area address length %d, should be 8...20 \n",
737 addr.addr_len);
a5fdb4c5 738 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 739 }
740
741 memcpy(addr.area_addr, buff, (int)addr.addr_len);
742
743 for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node, addrp))
744 if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len
745 && !memcmp(addrp->area_addr, addr.area_addr, addr.addr_len))
746 break;
747
748 if (!addrp) {
749 vty_out(vty, "No area address %s for area %s \n", net_title,
750 area->area_tag);
751 return CMD_ERR_NO_MATCH;
752 }
753
754 listnode_delete(area->area_addrs, addrp);
755 XFREE(MTYPE_ISIS_AREA_ADDR, addrp);
756
757 /*
758 * Last area address - reset the SystemID for this router
759 */
760 if (listcount(area->area_addrs) == 0) {
eab88f36
K
761 memset(area->isis->sysid, 0, ISIS_SYS_ID_LEN);
762 area->isis->sysid_set = 0;
e740f9c1 763 if (IS_DEBUG_EVENTS)
d62a17ae 764 zlog_debug("Router has no SystemID");
765 }
766
767 return CMD_SUCCESS;
eb5d44eb 768}
769
eb5d44eb 770/*
3f045a08 771 * 'show isis interface' command
eb5d44eb 772 */
773
eab88f36
K
774int show_isis_interface_common(struct vty *vty, const char *ifname, char detail,
775 const char *vrf_name, bool all_vrf)
eb5d44eb 776{
36944791 777 struct listnode *anode, *cnode, *inode;
d62a17ae 778 struct isis_area *area;
779 struct isis_circuit *circuit;
36944791 780 struct isis *isis;
eb5d44eb 781
eab88f36 782 if (!im) {
d62a17ae 783 vty_out(vty, "IS-IS Routing Process not enabled\n");
784 return CMD_SUCCESS;
785 }
eab88f36
K
786 if (vrf_name) {
787 if (all_vrf) {
36944791 788 for (ALL_LIST_ELEMENTS_RO(im->isis, inode, isis)) {
eab88f36
K
789 for (ALL_LIST_ELEMENTS_RO(isis->area_list,
790 anode, area)) {
791 vty_out(vty, "Area %s:\n",
792 area->area_tag);
793
794 if (detail == ISIS_UI_LEVEL_BRIEF)
795 vty_out(vty,
796 " Interface CircId State Type Level\n");
797
798 for (ALL_LIST_ELEMENTS_RO(
799 area->circuit_list, cnode,
800 circuit))
801 if (!ifname)
802 isis_circuit_print_vty(
803 circuit, vty,
804 detail);
805 else if (strcmp(circuit->interface->name, ifname) == 0)
806 isis_circuit_print_vty(
807 circuit, vty,
808 detail);
809 }
810 }
36944791 811 return CMD_SUCCESS;
eab88f36
K
812 }
813 isis = isis_lookup_by_vrfname(vrf_name);
814 if (isis != NULL) {
815 for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode,
816 area)) {
817 vty_out(vty, "Area %s:\n", area->area_tag);
eb5d44eb 818
eab88f36
K
819 if (detail == ISIS_UI_LEVEL_BRIEF)
820 vty_out(vty,
821 " Interface CircId State Type Level\n");
822
823 for (ALL_LIST_ELEMENTS_RO(area->circuit_list,
824 cnode, circuit))
825 if (!ifname)
826 isis_circuit_print_vty(
827 circuit, vty, detail);
828 else if (
829 strcmp(circuit->interface->name,
830 ifname)
831 == 0)
832 isis_circuit_print_vty(
833 circuit, vty, detail);
834 }
835 }
d62a17ae 836 }
f390d2c7 837
d62a17ae 838 return CMD_SUCCESS;
eb5d44eb 839}
840
eab88f36
K
841DEFUN(show_isis_interface,
842 show_isis_interface_cmd,
843 "show " PROTO_NAME " [vrf <NAME|all>] interface",
844 SHOW_STR
845 PROTO_HELP
846 VRF_CMD_HELP_STR
847 "All VRFs\n"
848 "IS-IS interface\n")
eb5d44eb 849{
eab88f36
K
850 const char *vrf_name = VRF_DEFAULT_NAME;
851 bool all_vrf = false;
852 int idx_vrf = 0;
853
854 ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
855 return show_isis_interface_common(vty, NULL, ISIS_UI_LEVEL_BRIEF,
856 vrf_name, all_vrf);
eb5d44eb 857}
858
eab88f36
K
859DEFUN(show_isis_interface_detail,
860 show_isis_interface_detail_cmd,
861 "show " PROTO_NAME " [vrf <NAME|all>] interface detail",
862 SHOW_STR
863 PROTO_HELP
864 VRF_CMD_HELP_STR
865 "All VRFs\n"
866 "IS-IS interface\n"
867 "show detailed information\n")
3f045a08 868{
eab88f36
K
869 const char *vrf_name = VRF_DEFAULT_NAME;
870 bool all_vrf = false;
871 int idx_vrf = 0;
872
873 ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
874 return show_isis_interface_common(vty, NULL, ISIS_UI_LEVEL_DETAIL,
875 vrf_name, all_vrf);
3f045a08 876}
eb5d44eb 877
eab88f36
K
878DEFUN(show_isis_interface_arg,
879 show_isis_interface_arg_cmd,
880 "show " PROTO_NAME " [vrf <NAME|all>] interface WORD",
881 SHOW_STR
882 PROTO_HELP
883 VRF_CMD_HELP_STR
884 "All VRFs\n"
885 "IS-IS interface\n"
886 "IS-IS interface name\n")
3f045a08 887{
eab88f36
K
888 int idx_word = 0;
889 const char *vrf_name = VRF_DEFAULT_NAME;
890 bool all_vrf = false;
891 int idx_vrf = 0;
3f045a08 892
eab88f36
K
893 ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
894
895 char *ifname = argv_find(argv, argc, "WORD", &idx_word)
896 ? argv[idx_word]->arg
897 : NULL;
898 return show_isis_interface_common(vty, ifname, ISIS_UI_LEVEL_DETAIL,
899 vrf_name, all_vrf);
900}
3f045a08 901
eab88f36
K
902static void isis_neighbor_common(struct vty *vty, const char *id, char detail,
903 struct isis *isis, uint8_t *sysid)
d62a17ae 904{
905 struct listnode *anode, *cnode, *node;
906 struct isis_area *area;
907 struct isis_circuit *circuit;
908 struct list *adjdb;
909 struct isis_adjacency *adj;
d62a17ae 910 int i;
911
d62a17ae 912 for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
913 vty_out(vty, "Area %s:\n", area->area_tag);
914
915 if (detail == ISIS_UI_LEVEL_BRIEF)
916 vty_out(vty,
917 " System Id Interface L State Holdtime SNPA\n");
918
919 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) {
920 if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
921 for (i = 0; i < 2; i++) {
922 adjdb = circuit->u.bc.adjdb[i];
923 if (adjdb && adjdb->count) {
924 for (ALL_LIST_ELEMENTS_RO(
925 adjdb, node, adj))
926 if (!id
eab88f36
K
927 || !memcmp(
928 adj->sysid,
929 sysid,
930 ISIS_SYS_ID_LEN))
d62a17ae 931 isis_adj_print_vty(
932 adj,
933 vty,
934 detail);
935 }
936 }
937 } else if (circuit->circ_type == CIRCUIT_T_P2P
938 && circuit->u.p2p.neighbor) {
939 adj = circuit->u.p2p.neighbor;
940 if (!id
941 || !memcmp(adj->sysid, sysid,
942 ISIS_SYS_ID_LEN))
943 isis_adj_print_vty(adj, vty, detail);
944 }
945 }
946 }
947
3f045a08 948}
3f045a08 949/*
eab88f36 950 * 'show isis neighbor' command
3f045a08 951 */
eab88f36
K
952
953int show_isis_neighbor_common(struct vty *vty, const char *id, char detail,
954 const char *vrf_name, bool all_vrf)
d62a17ae 955{
36944791 956 struct listnode *node;
d62a17ae 957 struct isis_dynhn *dynhn;
d7c0a89a 958 uint8_t sysid[ISIS_SYS_ID_LEN];
36944791 959 struct isis *isis;
d62a17ae 960
eab88f36 961 if (!im) {
d62a17ae 962 vty_out(vty, "IS-IS Routing Process not enabled\n");
963 return CMD_SUCCESS;
964 }
965
966 memset(sysid, 0, ISIS_SYS_ID_LEN);
967 if (id) {
968 if (sysid2buff(sysid, id) == 0) {
969 dynhn = dynhn_find_by_name(id);
970 if (dynhn == NULL) {
971 vty_out(vty, "Invalid system id %s\n", id);
972 return CMD_SUCCESS;
973 }
974 memcpy(sysid, dynhn->id, ISIS_SYS_ID_LEN);
975 }
976 }
977
eab88f36
K
978 if (vrf_name) {
979 if (all_vrf) {
36944791 980 for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) {
eab88f36
K
981 isis_neighbor_common(vty, id, detail, isis,
982 sysid);
983 }
36944791 984 return CMD_SUCCESS;
eab88f36
K
985 }
986 isis = isis_lookup_by_vrfname(vrf_name);
987 if (isis != NULL)
988 isis_neighbor_common(vty, id, detail, isis, sysid);
989 }
990
991 return CMD_SUCCESS;
992}
993
994static void isis_neighbor_common_clear(struct vty *vty, const char *id,
995 uint8_t *sysid, struct isis *isis)
996{
36944791 997 struct listnode *anode, *cnode, *node, *nnode;
eab88f36
K
998 struct isis_area *area;
999 struct isis_circuit *circuit;
1000 struct list *adjdb;
1001 struct isis_adjacency *adj;
1002 int i;
1003
d62a17ae 1004 for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
36944791 1005 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) {
d62a17ae 1006 if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
1007 for (i = 0; i < 2; i++) {
1008 adjdb = circuit->u.bc.adjdb[i];
1009 if (adjdb && adjdb->count) {
1010 for (ALL_LIST_ELEMENTS(
1011 adjdb, node, nnode,
1012 adj))
1013 if (!id
eab88f36
K
1014 || !memcmp(
1015 adj->sysid,
1016 sysid,
1017 ISIS_SYS_ID_LEN))
d62a17ae 1018 isis_adj_state_change(
16167b31 1019 &adj,
d62a17ae 1020 ISIS_ADJ_DOWN,
1021 "clear user request");
1022 }
1023 }
1024 } else if (circuit->circ_type == CIRCUIT_T_P2P
1025 && circuit->u.p2p.neighbor) {
1026 adj = circuit->u.p2p.neighbor;
1027 if (!id
1028 || !memcmp(adj->sysid, sysid,
1029 ISIS_SYS_ID_LEN))
1030 isis_adj_state_change(
16167b31 1031 &adj, ISIS_ADJ_DOWN,
d62a17ae 1032 "clear user request");
1033 }
1034 }
1035 }
3f045a08 1036}
eab88f36
K
1037/*
1038 * 'clear isis neighbor' command
1039 */
1040int clear_isis_neighbor_common(struct vty *vty, const char *id, const char *vrf_name,
1041 bool all_vrf)
eb5d44eb 1042{
36944791 1043 struct listnode *node;
eab88f36
K
1044 struct isis_dynhn *dynhn;
1045 uint8_t sysid[ISIS_SYS_ID_LEN];
36944791 1046 struct isis *isis;
eb5d44eb 1047
eab88f36
K
1048 if (!im) {
1049 vty_out(vty, "IS-IS Routing Process not enabled\n");
1050 return CMD_SUCCESS;
1051 }
3f045a08 1052
eab88f36
K
1053 memset(sysid, 0, ISIS_SYS_ID_LEN);
1054 if (id) {
1055 if (sysid2buff(sysid, id) == 0) {
1056 dynhn = dynhn_find_by_name(id);
1057 if (dynhn == NULL) {
1058 vty_out(vty, "Invalid system id %s\n", id);
1059 return CMD_SUCCESS;
1060 }
1061 memcpy(sysid, dynhn->id, ISIS_SYS_ID_LEN);
1062 }
1063 }
1064 if (vrf_name) {
1065 if (all_vrf) {
36944791 1066 for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
eab88f36
K
1067 isis_neighbor_common_clear(vty, id, sysid,
1068 isis);
36944791 1069 return CMD_SUCCESS;
eab88f36
K
1070 }
1071 isis = isis_lookup_by_vrfname(vrf_name);
1072 if (isis != NULL)
1073 isis_neighbor_common_clear(vty, id, sysid, isis);
1074 }
3f045a08 1075
eab88f36 1076 return CMD_SUCCESS;
3f045a08
JB
1077}
1078
eab88f36
K
1079DEFUN(show_isis_neighbor,
1080 show_isis_neighbor_cmd,
1081 "show " PROTO_NAME " [vrf <NAME|all>] neighbor",
1082 SHOW_STR
1083 PROTO_HELP
1084 VRF_CMD_HELP_STR
1085 "All vrfs\n"
1086 "IS-IS neighbor adjacencies\n")
1087{
1088 const char *vrf_name = VRF_DEFAULT_NAME;
1089 bool all_vrf = false;
1090 int idx_vrf = 0;
1091
1092 ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
1093 return show_isis_neighbor_common(vty, NULL, ISIS_UI_LEVEL_BRIEF,
1094 vrf_name, all_vrf);
1095}
1096
1097DEFUN(show_isis_neighbor_detail,
1098 show_isis_neighbor_detail_cmd,
1099 "show " PROTO_NAME " [vrf <NAME|all>] neighbor detail",
1100 SHOW_STR
1101 PROTO_HELP
1102 VRF_CMD_HELP_STR
1103 "all vrfs\n"
1104 "IS-IS neighbor adjacencies\n"
1105 "show detailed information\n")
1106{
1107 const char *vrf_name = VRF_DEFAULT_NAME;
1108 bool all_vrf = false;
1109 int idx_vrf = 0;
1110
1111 ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
1112
1113 return show_isis_neighbor_common(vty, NULL, ISIS_UI_LEVEL_DETAIL,
1114 vrf_name, all_vrf);
1115}
1116
1117DEFUN(show_isis_neighbor_arg,
1118 show_isis_neighbor_arg_cmd,
1119 "show " PROTO_NAME " [vrf <NAME|all>] neighbor WORD",
1120 SHOW_STR
1121 PROTO_HELP
1122 VRF_CMD_HELP_STR
1123 "All vrfs\n"
1124 "IS-IS neighbor adjacencies\n"
1125 "System id\n")
1126{
1127 int idx_word = 0;
1128 const char *vrf_name = VRF_DEFAULT_NAME;
1129 bool all_vrf = false;
1130 int idx_vrf = 0;
1131
1132 ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
1133 char *id = argv_find(argv, argc, "WORD", &idx_word)
1134 ? argv[idx_word]->arg
1135 : NULL;
1136
1137 return show_isis_neighbor_common(vty, id, ISIS_UI_LEVEL_DETAIL,
1138 vrf_name, all_vrf);
1139}
1140
1141DEFUN(clear_isis_neighbor,
1142 clear_isis_neighbor_cmd,
1143 "clear " PROTO_NAME " [vrf <NAME|all>] neighbor",
1144 CLEAR_STR
1145 PROTO_HELP
1146 VRF_CMD_HELP_STR
1147 "All vrfs\n"
1148 "IS-IS neighbor adjacencies\n")
1149{
1150 const char *vrf_name = VRF_DEFAULT_NAME;
1151 bool all_vrf = false;
1152 int idx_vrf = 0;
1153
1154 ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
1155 return clear_isis_neighbor_common(vty, NULL, vrf_name, all_vrf);
1156}
1157
1158DEFUN(clear_isis_neighbor_arg,
1159 clear_isis_neighbor_arg_cmd,
1160 "clear " PROTO_NAME " [vrf <NAME|all>] neighbor WORD",
1161 CLEAR_STR
1162 PROTO_HELP
1163 VRF_CMD_HELP_STR
1164 "All vrfs\n"
1165 "IS-IS neighbor adjacencies\n"
1166 "System id\n")
1167{
1168 int idx_word = 0;
1169 const char *vrf_name = VRF_DEFAULT_NAME;
1170 bool all_vrf = false;
1171 int idx_vrf = 0;
1172
1173 char *id = argv_find(argv, argc, "WORD", &idx_word)
1174 ? argv[idx_word]->arg
1175 : NULL;
1176 ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
1177 return clear_isis_neighbor_common(vty, id, vrf_name, all_vrf);
3f045a08
JB
1178}
1179
eb5d44eb 1180/*
1181 * 'isis debug', 'show debugging'
1182 */
d62a17ae 1183void print_debug(struct vty *vty, int flags, int onoff)
1184{
5627d3fe 1185 const char *onoffs = onoff ? "on" : "off";
d62a17ae 1186
1187 if (flags & DEBUG_ADJ_PACKETS)
1188 vty_out(vty,
1189 "IS-IS Adjacency related packets debugging is %s\n",
1190 onoffs);
161fa356
CF
1191 if (flags & DEBUG_TX_QUEUE)
1192 vty_out(vty, "IS-IS TX queue debugging is %s\n",
1193 onoffs);
d62a17ae 1194 if (flags & DEBUG_SNP_PACKETS)
1195 vty_out(vty, "IS-IS CSNP/PSNP packets debugging is %s\n",
1196 onoffs);
1197 if (flags & DEBUG_SPF_EVENTS)
1198 vty_out(vty, "IS-IS SPF events debugging is %s\n", onoffs);
26f6acaf
RW
1199 if (flags & DEBUG_SR)
1200 vty_out(vty, "IS-IS Segment Routing events debugging is %s\n",
1201 onoffs);
c951ee6e
RW
1202 if (flags & DEBUG_TILFA)
1203 vty_out(vty, "IS-IS TI-LFA events debugging is %s\n", onoffs);
d62a17ae 1204 if (flags & DEBUG_UPDATE_PACKETS)
1205 vty_out(vty, "IS-IS Update related packet debugging is %s\n",
1206 onoffs);
1207 if (flags & DEBUG_RTE_EVENTS)
1208 vty_out(vty, "IS-IS Route related debuggin is %s\n", onoffs);
1209 if (flags & DEBUG_EVENTS)
1210 vty_out(vty, "IS-IS Event debugging is %s\n", onoffs);
1211 if (flags & DEBUG_PACKET_DUMP)
1212 vty_out(vty, "IS-IS Packet dump debugging is %s\n", onoffs);
1213 if (flags & DEBUG_LSP_GEN)
1214 vty_out(vty, "IS-IS LSP generation debugging is %s\n", onoffs);
1215 if (flags & DEBUG_LSP_SCHED)
1216 vty_out(vty, "IS-IS LSP scheduling debugging is %s\n", onoffs);
ddb33326
CF
1217 if (flags & DEBUG_FLOODING)
1218 vty_out(vty, "IS-IS Flooding debugging is %s\n", onoffs);
2815f817
CF
1219 if (flags & DEBUG_BFD)
1220 vty_out(vty, "IS-IS BFD debugging is %s\n", onoffs);
1cbf96a8 1221 if (flags & DEBUG_LDP_SYNC)
1222 vty_out(vty, "IS-IS ldp-sync debugging is %s\n", onoffs);
eb5d44eb 1223}
1224
87f6dc50
DS
1225DEFUN_NOSH (show_debugging,
1226 show_debugging_isis_cmd,
7c0cbd0e 1227 "show debugging [" PROTO_NAME "]",
87f6dc50
DS
1228 SHOW_STR
1229 "State of each debugging option\n"
7c0cbd0e 1230 PROTO_HELP)
eb5d44eb 1231{
7c0cbd0e 1232 vty_out(vty, PROTO_NAME " debugging status:\n");
87f6dc50 1233
e740f9c1 1234 if (IS_DEBUG_ADJ_PACKETS)
1235 print_debug(vty, DEBUG_ADJ_PACKETS, 1);
1236 if (IS_DEBUG_TX_QUEUE)
1237 print_debug(vty, DEBUG_TX_QUEUE, 1);
1238 if (IS_DEBUG_SNP_PACKETS)
1239 print_debug(vty, DEBUG_SNP_PACKETS, 1);
1240 if (IS_DEBUG_SPF_EVENTS)
1241 print_debug(vty, DEBUG_SPF_EVENTS, 1);
1242 if (IS_DEBUG_SR)
1243 print_debug(vty, DEBUG_SR, 1);
1244 if (IS_DEBUG_UPDATE_PACKETS)
1245 print_debug(vty, DEBUG_UPDATE_PACKETS, 1);
1246 if (IS_DEBUG_RTE_EVENTS)
1247 print_debug(vty, DEBUG_RTE_EVENTS, 1);
1248 if (IS_DEBUG_EVENTS)
1249 print_debug(vty, DEBUG_EVENTS, 1);
1250 if (IS_DEBUG_PACKET_DUMP)
1251 print_debug(vty, DEBUG_PACKET_DUMP, 1);
1252 if (IS_DEBUG_LSP_GEN)
1253 print_debug(vty, DEBUG_LSP_GEN, 1);
1254 if (IS_DEBUG_LSP_SCHED)
1255 print_debug(vty, DEBUG_LSP_SCHED, 1);
1256 if (IS_DEBUG_FLOODING)
1257 print_debug(vty, DEBUG_FLOODING, 1);
1258 if (IS_DEBUG_BFD)
1259 print_debug(vty, DEBUG_BFD, 1);
1cbf96a8 1260 if (IS_DEBUG_LDP_SYNC)
1261 print_debug(vty, DEBUG_LDP_SYNC, 1);
d62a17ae 1262 return CMD_SUCCESS;
eb5d44eb 1263}
1264
612c2c15 1265static int config_write_debug(struct vty *vty);
9e867fe6 1266/* Debug node. */
62b346ee 1267static struct cmd_node debug_node = {
f4b8291f 1268 .name = "debug",
62b346ee
DL
1269 .node = DEBUG_NODE,
1270 .prompt = "",
612c2c15 1271 .config_write = config_write_debug,
62b346ee 1272};
d62a17ae 1273
1274static int config_write_debug(struct vty *vty)
1275{
1276 int write = 0;
d62a17ae 1277
e740f9c1 1278 if (IS_DEBUG_ADJ_PACKETS) {
7c0cbd0e 1279 vty_out(vty, "debug " PROTO_NAME " adj-packets\n");
d62a17ae 1280 write++;
1281 }
e740f9c1 1282 if (IS_DEBUG_TX_QUEUE) {
161fa356
CF
1283 vty_out(vty, "debug " PROTO_NAME " tx-queue\n");
1284 write++;
1285 }
e740f9c1 1286 if (IS_DEBUG_SNP_PACKETS) {
7c0cbd0e 1287 vty_out(vty, "debug " PROTO_NAME " snp-packets\n");
d62a17ae 1288 write++;
1289 }
e740f9c1 1290 if (IS_DEBUG_SPF_EVENTS) {
7c0cbd0e 1291 vty_out(vty, "debug " PROTO_NAME " spf-events\n");
d62a17ae 1292 write++;
1293 }
e740f9c1 1294 if (IS_DEBUG_SR) {
26f6acaf
RW
1295 vty_out(vty, "debug " PROTO_NAME " sr-events\n");
1296 write++;
1297 }
c951ee6e
RW
1298 if (IS_DEBUG_TILFA) {
1299 vty_out(vty, "debug " PROTO_NAME " ti-lfa\n");
1300 write++;
1301 }
e740f9c1 1302 if (IS_DEBUG_UPDATE_PACKETS) {
7c0cbd0e 1303 vty_out(vty, "debug " PROTO_NAME " update-packets\n");
d62a17ae 1304 write++;
1305 }
e740f9c1 1306 if (IS_DEBUG_RTE_EVENTS) {
7c0cbd0e 1307 vty_out(vty, "debug " PROTO_NAME " route-events\n");
d62a17ae 1308 write++;
1309 }
e740f9c1 1310 if (IS_DEBUG_EVENTS) {
7c0cbd0e 1311 vty_out(vty, "debug " PROTO_NAME " events\n");
d62a17ae 1312 write++;
1313 }
e740f9c1 1314 if (IS_DEBUG_PACKET_DUMP) {
7c0cbd0e 1315 vty_out(vty, "debug " PROTO_NAME " packet-dump\n");
d62a17ae 1316 write++;
1317 }
e740f9c1 1318 if (IS_DEBUG_LSP_GEN) {
7c0cbd0e 1319 vty_out(vty, "debug " PROTO_NAME " lsp-gen\n");
d62a17ae 1320 write++;
1321 }
e740f9c1 1322 if (IS_DEBUG_LSP_SCHED) {
7c0cbd0e 1323 vty_out(vty, "debug " PROTO_NAME " lsp-sched\n");
d62a17ae 1324 write++;
1325 }
e740f9c1 1326 if (IS_DEBUG_FLOODING) {
d4cff91a
CF
1327 vty_out(vty, "debug " PROTO_NAME " flooding\n");
1328 write++;
1329 }
e740f9c1 1330 if (IS_DEBUG_BFD) {
2815f817
CF
1331 vty_out(vty, "debug " PROTO_NAME " bfd\n");
1332 write++;
1333 }
1cbf96a8 1334 if (IS_DEBUG_LDP_SYNC) {
1335 vty_out(vty, "debug " PROTO_NAME " ldp-sync\n");
1336 write++;
1337 }
d62a17ae 1338 write += spf_backoff_write_config(vty);
1339
1340 return write;
9e867fe6 1341}
1342
eb5d44eb 1343DEFUN (debug_isis_adj,
1344 debug_isis_adj_cmd,
7c0cbd0e 1345 "debug " PROTO_NAME " adj-packets",
eb5d44eb 1346 DEBUG_STR
7c0cbd0e 1347 PROTO_HELP
f390d2c7 1348 "IS-IS Adjacency related packets\n")
eb5d44eb 1349{
e740f9c1 1350 debug_adj_pkt |= DEBUG_ADJ_PACKETS;
d62a17ae 1351 print_debug(vty, DEBUG_ADJ_PACKETS, 1);
eb5d44eb 1352
d62a17ae 1353 return CMD_SUCCESS;
eb5d44eb 1354}
1355
1356DEFUN (no_debug_isis_adj,
1357 no_debug_isis_adj_cmd,
7c0cbd0e 1358 "no debug " PROTO_NAME " adj-packets",
16cedbb0 1359 NO_STR
eb5d44eb 1360 UNDEBUG_STR
7c0cbd0e 1361 PROTO_HELP
f390d2c7 1362 "IS-IS Adjacency related packets\n")
eb5d44eb 1363{
e740f9c1 1364 debug_adj_pkt &= ~DEBUG_ADJ_PACKETS;
d62a17ae 1365 print_debug(vty, DEBUG_ADJ_PACKETS, 0);
eb5d44eb 1366
d62a17ae 1367 return CMD_SUCCESS;
eb5d44eb 1368}
1369
161fa356
CF
1370DEFUN (debug_isis_tx_queue,
1371 debug_isis_tx_queue_cmd,
1372 "debug " PROTO_NAME " tx-queue",
1373 DEBUG_STR
1374 PROTO_HELP
1375 "IS-IS TX queues\n")
1376{
e740f9c1 1377 debug_tx_queue |= DEBUG_TX_QUEUE;
161fa356
CF
1378 print_debug(vty, DEBUG_TX_QUEUE, 1);
1379
1380 return CMD_SUCCESS;
1381}
1382
1383DEFUN (no_debug_isis_tx_queue,
1384 no_debug_isis_tx_queue_cmd,
1385 "no debug " PROTO_NAME " tx-queue",
1386 NO_STR
1387 UNDEBUG_STR
1388 PROTO_HELP
1389 "IS-IS TX queues\n")
1390{
e740f9c1 1391 debug_tx_queue &= ~DEBUG_TX_QUEUE;
161fa356
CF
1392 print_debug(vty, DEBUG_TX_QUEUE, 0);
1393
1394 return CMD_SUCCESS;
1395}
1396
ddb33326
CF
1397DEFUN (debug_isis_flooding,
1398 debug_isis_flooding_cmd,
1399 "debug " PROTO_NAME " flooding",
1400 DEBUG_STR
1401 PROTO_HELP
1402 "Flooding algorithm\n")
1403{
e740f9c1 1404 debug_flooding |= DEBUG_FLOODING;
ddb33326
CF
1405 print_debug(vty, DEBUG_FLOODING, 1);
1406
1407 return CMD_SUCCESS;
1408}
1409
1410DEFUN (no_debug_isis_flooding,
1411 no_debug_isis_flooding_cmd,
1412 "no debug " PROTO_NAME " flooding",
1413 NO_STR
1414 UNDEBUG_STR
1415 PROTO_HELP
1416 "Flooding algorithm\n")
1417{
e740f9c1 1418 debug_flooding &= ~DEBUG_FLOODING;
ddb33326
CF
1419 print_debug(vty, DEBUG_FLOODING, 0);
1420
1421 return CMD_SUCCESS;
1422}
1423
eb5d44eb 1424DEFUN (debug_isis_snp,
1425 debug_isis_snp_cmd,
7c0cbd0e 1426 "debug " PROTO_NAME " snp-packets",
eb5d44eb 1427 DEBUG_STR
7c0cbd0e 1428 PROTO_HELP
f390d2c7 1429 "IS-IS CSNP/PSNP packets\n")
eb5d44eb 1430{
e740f9c1 1431 debug_snp_pkt |= DEBUG_SNP_PACKETS;
d62a17ae 1432 print_debug(vty, DEBUG_SNP_PACKETS, 1);
eb5d44eb 1433
d62a17ae 1434 return CMD_SUCCESS;
eb5d44eb 1435}
1436
1437DEFUN (no_debug_isis_snp,
1438 no_debug_isis_snp_cmd,
7c0cbd0e 1439 "no debug " PROTO_NAME " snp-packets",
16cedbb0 1440 NO_STR
eb5d44eb 1441 UNDEBUG_STR
7c0cbd0e 1442 PROTO_HELP
f390d2c7 1443 "IS-IS CSNP/PSNP packets\n")
eb5d44eb 1444{
e740f9c1 1445 debug_snp_pkt &= ~DEBUG_SNP_PACKETS;
d62a17ae 1446 print_debug(vty, DEBUG_SNP_PACKETS, 0);
f390d2c7 1447
d62a17ae 1448 return CMD_SUCCESS;
eb5d44eb 1449}
1450
eb5d44eb 1451DEFUN (debug_isis_upd,
1452 debug_isis_upd_cmd,
7c0cbd0e 1453 "debug " PROTO_NAME " update-packets",
eb5d44eb 1454 DEBUG_STR
7c0cbd0e 1455 PROTO_HELP
f390d2c7 1456 "IS-IS Update related packets\n")
eb5d44eb 1457{
e740f9c1 1458 debug_update_pkt |= DEBUG_UPDATE_PACKETS;
d62a17ae 1459 print_debug(vty, DEBUG_UPDATE_PACKETS, 1);
eb5d44eb 1460
d62a17ae 1461 return CMD_SUCCESS;
eb5d44eb 1462}
1463
1464DEFUN (no_debug_isis_upd,
1465 no_debug_isis_upd_cmd,
7c0cbd0e 1466 "no debug " PROTO_NAME " update-packets",
16cedbb0 1467 NO_STR
eb5d44eb 1468 UNDEBUG_STR
7c0cbd0e 1469 PROTO_HELP
f390d2c7 1470 "IS-IS Update related packets\n")
eb5d44eb 1471{
e740f9c1 1472 debug_update_pkt &= ~DEBUG_UPDATE_PACKETS;
d62a17ae 1473 print_debug(vty, DEBUG_UPDATE_PACKETS, 0);
f390d2c7 1474
d62a17ae 1475 return CMD_SUCCESS;
eb5d44eb 1476}
1477
eb5d44eb 1478DEFUN (debug_isis_spfevents,
1479 debug_isis_spfevents_cmd,
7c0cbd0e 1480 "debug " PROTO_NAME " spf-events",
eb5d44eb 1481 DEBUG_STR
7c0cbd0e 1482 PROTO_HELP
f390d2c7 1483 "IS-IS Shortest Path First Events\n")
eb5d44eb 1484{
e740f9c1 1485 debug_spf_events |= DEBUG_SPF_EVENTS;
d62a17ae 1486 print_debug(vty, DEBUG_SPF_EVENTS, 1);
eb5d44eb 1487
d62a17ae 1488 return CMD_SUCCESS;
eb5d44eb 1489}
1490
1491DEFUN (no_debug_isis_spfevents,
1492 no_debug_isis_spfevents_cmd,
7c0cbd0e 1493 "no debug " PROTO_NAME " spf-events",
16cedbb0 1494 NO_STR
eb5d44eb 1495 UNDEBUG_STR
7c0cbd0e 1496 PROTO_HELP
f390d2c7 1497 "IS-IS Shortest Path First Events\n")
eb5d44eb 1498{
e740f9c1 1499 debug_spf_events &= ~DEBUG_SPF_EVENTS;
d62a17ae 1500 print_debug(vty, DEBUG_SPF_EVENTS, 0);
f390d2c7 1501
d62a17ae 1502 return CMD_SUCCESS;
eb5d44eb 1503}
1504
26f6acaf
RW
1505DEFUN (debug_isis_srevents,
1506 debug_isis_srevents_cmd,
1507 "debug " PROTO_NAME " sr-events",
1508 DEBUG_STR
1509 PROTO_HELP
1510 "IS-IS Segment Routing Events\n")
1511{
e740f9c1 1512 debug_sr |= DEBUG_SR;
26f6acaf
RW
1513 print_debug(vty, DEBUG_SR, 1);
1514
1515 return CMD_SUCCESS;
1516}
1517
1518DEFUN (no_debug_isis_srevents,
1519 no_debug_isis_srevents_cmd,
1520 "no debug " PROTO_NAME " sr-events",
1521 NO_STR
1522 UNDEBUG_STR
1523 PROTO_HELP
1524 "IS-IS Segment Routing Events\n")
1525{
e740f9c1 1526 debug_sr &= ~DEBUG_SR;
26f6acaf
RW
1527 print_debug(vty, DEBUG_SR, 0);
1528
1529 return CMD_SUCCESS;
1530}
1531
c951ee6e
RW
1532DEFUN (debug_isis_tilfa,
1533 debug_isis_tilfa_cmd,
1534 "debug " PROTO_NAME " ti-lfa",
1535 DEBUG_STR
1536 PROTO_HELP
1537 "IS-IS TI-LFA Events\n")
1538{
1539 debug_tilfa |= DEBUG_TILFA;
1540 print_debug(vty, DEBUG_TILFA, 1);
1541
1542 return CMD_SUCCESS;
1543}
1544
1545DEFUN (no_debug_isis_tilfa,
1546 no_debug_isis_tilfa_cmd,
1547 "no debug " PROTO_NAME " ti-lfa",
1548 NO_STR
1549 UNDEBUG_STR
1550 PROTO_HELP
1551 "IS-IS TI-LFA Events\n")
1552{
1553 debug_tilfa &= ~DEBUG_TILFA;
1554 print_debug(vty, DEBUG_TILFA, 0);
1555
1556 return CMD_SUCCESS;
1557}
1558
eb5d44eb 1559DEFUN (debug_isis_rtevents,
1560 debug_isis_rtevents_cmd,
7c0cbd0e 1561 "debug " PROTO_NAME " route-events",
eb5d44eb 1562 DEBUG_STR
7c0cbd0e 1563 PROTO_HELP
f390d2c7 1564 "IS-IS Route related events\n")
eb5d44eb 1565{
e740f9c1 1566 debug_rte_events |= DEBUG_RTE_EVENTS;
d62a17ae 1567 print_debug(vty, DEBUG_RTE_EVENTS, 1);
eb5d44eb 1568
d62a17ae 1569 return CMD_SUCCESS;
eb5d44eb 1570}
1571
1572DEFUN (no_debug_isis_rtevents,
1573 no_debug_isis_rtevents_cmd,
7c0cbd0e 1574 "no debug " PROTO_NAME " route-events",
16cedbb0 1575 NO_STR
eb5d44eb 1576 UNDEBUG_STR
7c0cbd0e 1577 PROTO_HELP
f390d2c7 1578 "IS-IS Route related events\n")
eb5d44eb 1579{
e740f9c1 1580 debug_rte_events &= ~DEBUG_RTE_EVENTS;
d62a17ae 1581 print_debug(vty, DEBUG_RTE_EVENTS, 0);
f390d2c7 1582
d62a17ae 1583 return CMD_SUCCESS;
eb5d44eb 1584}
1585
1586DEFUN (debug_isis_events,
1587 debug_isis_events_cmd,
7c0cbd0e 1588 "debug " PROTO_NAME " events",
eb5d44eb 1589 DEBUG_STR
7c0cbd0e 1590 PROTO_HELP
f1082d19 1591 "IS-IS Events\n")
eb5d44eb 1592{
e740f9c1 1593 debug_events |= DEBUG_EVENTS;
d62a17ae 1594 print_debug(vty, DEBUG_EVENTS, 1);
eb5d44eb 1595
d62a17ae 1596 return CMD_SUCCESS;
eb5d44eb 1597}
1598
1599DEFUN (no_debug_isis_events,
1600 no_debug_isis_events_cmd,
7c0cbd0e 1601 "no debug " PROTO_NAME " events",
16cedbb0 1602 NO_STR
eb5d44eb 1603 UNDEBUG_STR
7c0cbd0e 1604 PROTO_HELP
f390d2c7 1605 "IS-IS Events\n")
eb5d44eb 1606{
e740f9c1 1607 debug_events &= ~DEBUG_EVENTS;
d62a17ae 1608 print_debug(vty, DEBUG_EVENTS, 0);
f390d2c7 1609
d62a17ae 1610 return CMD_SUCCESS;
eb5d44eb 1611}
1612
3f045a08
JB
1613DEFUN (debug_isis_packet_dump,
1614 debug_isis_packet_dump_cmd,
7c0cbd0e 1615 "debug " PROTO_NAME " packet-dump",
3f045a08 1616 DEBUG_STR
7c0cbd0e 1617 PROTO_HELP
3f045a08
JB
1618 "IS-IS packet dump\n")
1619{
e740f9c1 1620 debug_pkt_dump |= DEBUG_PACKET_DUMP;
d62a17ae 1621 print_debug(vty, DEBUG_PACKET_DUMP, 1);
3f045a08 1622
d62a17ae 1623 return CMD_SUCCESS;
3f045a08
JB
1624}
1625
1626DEFUN (no_debug_isis_packet_dump,
1627 no_debug_isis_packet_dump_cmd,
7c0cbd0e 1628 "no debug " PROTO_NAME " packet-dump",
16cedbb0 1629 NO_STR
3f045a08 1630 UNDEBUG_STR
7c0cbd0e 1631 PROTO_HELP
3f045a08
JB
1632 "IS-IS packet dump\n")
1633{
e740f9c1 1634 debug_pkt_dump &= ~DEBUG_PACKET_DUMP;
d62a17ae 1635 print_debug(vty, DEBUG_PACKET_DUMP, 0);
3f045a08 1636
d62a17ae 1637 return CMD_SUCCESS;
3f045a08
JB
1638}
1639
14872644
CF
1640DEFUN (debug_isis_lsp_gen,
1641 debug_isis_lsp_gen_cmd,
7c0cbd0e 1642 "debug " PROTO_NAME " lsp-gen",
14872644 1643 DEBUG_STR
7c0cbd0e 1644 PROTO_HELP
14872644
CF
1645 "IS-IS generation of own LSPs\n")
1646{
e740f9c1 1647 debug_lsp_gen |= DEBUG_LSP_GEN;
d62a17ae 1648 print_debug(vty, DEBUG_LSP_GEN, 1);
14872644 1649
d62a17ae 1650 return CMD_SUCCESS;
14872644
CF
1651}
1652
1653DEFUN (no_debug_isis_lsp_gen,
1654 no_debug_isis_lsp_gen_cmd,
7c0cbd0e 1655 "no debug " PROTO_NAME " lsp-gen",
16cedbb0 1656 NO_STR
14872644 1657 UNDEBUG_STR
7c0cbd0e 1658 PROTO_HELP
14872644
CF
1659 "IS-IS generation of own LSPs\n")
1660{
e740f9c1 1661 debug_lsp_gen &= ~DEBUG_LSP_GEN;
d62a17ae 1662 print_debug(vty, DEBUG_LSP_GEN, 0);
14872644 1663
d62a17ae 1664 return CMD_SUCCESS;
14872644
CF
1665}
1666
414766a1
CF
1667DEFUN (debug_isis_lsp_sched,
1668 debug_isis_lsp_sched_cmd,
7c0cbd0e 1669 "debug " PROTO_NAME " lsp-sched",
414766a1 1670 DEBUG_STR
7c0cbd0e 1671 PROTO_HELP
414766a1
CF
1672 "IS-IS scheduling of LSP generation\n")
1673{
e740f9c1 1674 debug_lsp_sched |= DEBUG_LSP_SCHED;
d62a17ae 1675 print_debug(vty, DEBUG_LSP_SCHED, 1);
414766a1 1676
d62a17ae 1677 return CMD_SUCCESS;
414766a1
CF
1678}
1679
49d41a26
DS
1680DEFUN (no_debug_isis_lsp_sched,
1681 no_debug_isis_lsp_sched_cmd,
7c0cbd0e 1682 "no debug " PROTO_NAME " lsp-sched",
16cedbb0 1683 NO_STR
49d41a26 1684 UNDEBUG_STR
7c0cbd0e 1685 PROTO_HELP
49d41a26
DS
1686 "IS-IS scheduling of LSP generation\n")
1687{
e740f9c1 1688 debug_lsp_sched &= ~DEBUG_LSP_SCHED;
d62a17ae 1689 print_debug(vty, DEBUG_LSP_SCHED, 0);
49d41a26 1690
d62a17ae 1691 return CMD_SUCCESS;
49d41a26
DS
1692}
1693
2815f817
CF
1694DEFUN (debug_isis_bfd,
1695 debug_isis_bfd_cmd,
1696 "debug " PROTO_NAME " bfd",
1697 DEBUG_STR
1698 PROTO_HELP
1699 PROTO_NAME " interaction with BFD\n")
1700{
e740f9c1 1701 debug_bfd |= DEBUG_BFD;
2815f817
CF
1702 print_debug(vty, DEBUG_BFD, 1);
1703
1704 return CMD_SUCCESS;
1705}
1706
1707DEFUN (no_debug_isis_bfd,
1708 no_debug_isis_bfd_cmd,
1709 "no debug " PROTO_NAME " bfd",
1710 NO_STR
1711 UNDEBUG_STR
1712 PROTO_HELP
1713 PROTO_NAME " interaction with BFD\n")
1714{
e740f9c1 1715 debug_bfd &= ~DEBUG_BFD;
2815f817
CF
1716 print_debug(vty, DEBUG_BFD, 0);
1717
1718 return CMD_SUCCESS;
1719}
1720
1cbf96a8 1721DEFUN(debug_isis_ldp_sync, debug_isis_ldp_sync_cmd,
1722 "debug " PROTO_NAME " ldp-sync",
1723 DEBUG_STR PROTO_HELP PROTO_NAME " interaction with LDP-Sync\n")
1724{
1725 debug_ldp_sync |= DEBUG_LDP_SYNC;
1726 print_debug(vty, DEBUG_LDP_SYNC, 1);
1727
1728 return CMD_SUCCESS;
1729}
1730
1731DEFUN(no_debug_isis_ldp_sync, no_debug_isis_ldp_sync_cmd,
1732 "no debug " PROTO_NAME " ldp-sync",
1733 NO_STR UNDEBUG_STR PROTO_HELP PROTO_NAME " interaction with LDP-Sync\n")
1734{
1735 debug_ldp_sync &= ~DEBUG_LDP_SYNC;
1736 print_debug(vty, DEBUG_LDP_SYNC, 0);
1737
1738 return CMD_SUCCESS;
1739}
1740
1741DEFUN (show_hostname,
1742 show_hostname_cmd,
1743 "show " PROTO_NAME " hostname",
1744 SHOW_STR
1745 PROTO_HELP
1746 "IS-IS Dynamic hostname mapping\n")
eb5d44eb 1747{
36944791 1748 struct listnode *node;
eab88f36
K
1749 const char *vrf_name = VRF_DEFAULT_NAME;
1750 bool all_vrf = false;
1751 int idx_vrf = 0;
36944791 1752 struct isis *isis;
eab88f36
K
1753
1754 ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
1755 if (vrf_name) {
1756 if (all_vrf) {
36944791 1757 for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
eab88f36 1758 dynhn_print_all(vty, isis);
36944791
RW
1759
1760 return CMD_SUCCESS;
eab88f36
K
1761 }
1762 isis = isis_lookup_by_vrfname(vrf_name);
1763 if (isis != NULL)
1764 dynhn_print_all(vty, isis);
1765 }
f390d2c7 1766
d62a17ae 1767 return CMD_SUCCESS;
eb5d44eb 1768}
1769
eab88f36 1770static void isis_spf_ietf_common(struct vty *vty, struct isis *isis)
03f7e182 1771{
d62a17ae 1772 struct listnode *node;
1773 struct isis_area *area;
d62a17ae 1774 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
eab88f36
K
1775
1776 vty_out(vty, "vrf : %s\n", isis->name);
d62a17ae 1777 vty_out(vty, "Area %s:\n",
1778 area->area_tag ? area->area_tag : "null");
1779
1780 for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) {
1781 if ((area->is_type & level) == 0)
1782 continue;
1783
1784 vty_out(vty, " Level-%d:\n", level);
1785 vty_out(vty, " SPF delay status: ");
1786 if (area->spf_timer[level - 1]) {
1787 struct timeval remain = thread_timer_remain(
1788 area->spf_timer[level - 1]);
a97986ff
DL
1789 vty_out(vty, "Pending, due in %lld msec\n",
1790 (long long)remain.tv_sec * 1000
d62a17ae 1791 + remain.tv_usec / 1000);
1792 } else {
1793 vty_out(vty, "Not scheduled\n");
1794 }
1795
1796 if (area->spf_delay_ietf[level - 1]) {
1797 vty_out(vty,
1798 " Using draft-ietf-rtgwg-backoff-algo-04\n");
1799 spf_backoff_show(
1800 area->spf_delay_ietf[level - 1], vty,
1801 " ");
1802 } else {
1803 vty_out(vty, " Using legacy backoff algo\n");
1804 }
1805 }
1806 }
eab88f36
K
1807}
1808
1809DEFUN(show_isis_spf_ietf, show_isis_spf_ietf_cmd,
1810 "show " PROTO_NAME " [vrf <NAME|all>] spf-delay-ietf",
1811 SHOW_STR PROTO_HELP VRF_CMD_HELP_STR
1812 "All VRFs\n"
1813 "SPF delay IETF information\n")
1814{
36944791
RW
1815 struct listnode *node;
1816 struct isis *isis;
eab88f36
K
1817 int idx_vrf = 0;
1818 const char *vrf_name = VRF_DEFAULT_NAME;
1819 bool all_vrf = false;
1820
1821 ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf)
1822
1823 if (!im) {
1824 vty_out(vty, "ISIS is not running\n");
1825 return CMD_SUCCESS;
1826 }
1827
1828 if (vrf_name) {
1829 if (all_vrf) {
36944791 1830 for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
eab88f36 1831 isis_spf_ietf_common(vty, isis);
36944791
RW
1832
1833 return CMD_SUCCESS;
eab88f36
K
1834 }
1835 isis = isis_lookup_by_vrfname(vrf_name);
1836 if (isis != NULL)
1837 isis_spf_ietf_common(vty, isis);
1838 }
1839
d62a17ae 1840 return CMD_SUCCESS;
03f7e182
SL
1841}
1842
eab88f36 1843static void common_isis_summary(struct vty *vty, struct isis *isis)
3f045a08 1844{
d62a17ae 1845 struct listnode *node, *node2;
1846 struct isis_area *area;
d62a17ae 1847 int level;
1848
eab88f36 1849 vty_out(vty, "vrf : %s\n", isis->name);
d62a17ae 1850 vty_out(vty, "Process Id : %ld\n", isis->process_id);
1851 if (isis->sysid_set)
1852 vty_out(vty, "System Id : %s\n",
1853 sysid_print(isis->sysid));
1854
1855 vty_out(vty, "Up time : ");
1856 vty_out_timestr(vty, isis->uptime);
1857 vty_out(vty, "\n");
1858
1859 if (isis->area_list)
1860 vty_out(vty, "Number of areas : %d\n", isis->area_list->count);
1861
1862 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
1863 vty_out(vty, "Area %s:\n",
1864 area->area_tag ? area->area_tag : "null");
1865
92ed0cde
CF
1866 if (fabricd) {
1867 uint8_t tier = fabricd_tier(area);
1868 if (tier == ISIS_TIER_UNDEFINED)
1869 vty_out(vty, " Tier: undefined\n");
1870 else
6cde4b45 1871 vty_out(vty, " Tier: %hhu\n", tier);
92ed0cde
CF
1872 }
1873
d62a17ae 1874 if (listcount(area->area_addrs) > 0) {
1875 struct area_addr *area_addr;
1876 for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node2,
1877 area_addr)) {
1878 vty_out(vty, " Net: %s\n",
1879 isonet_print(area_addr->area_addr,
1880 area_addr->addr_len
1881 + ISIS_SYS_ID_LEN
1882 + 1));
1883 }
1884 }
1885
39bb53d6
CF
1886 vty_out(vty, " TX counters per PDU type:\n");
1887 pdu_counter_print(vty, " ", area->pdu_tx_counters);
86d6f80d
CF
1888 vty_out(vty, " LSP RXMT: %" PRIu64 "\n",
1889 area->lsp_rxmt_count);
39bb53d6
CF
1890 vty_out(vty, " RX counters per PDU type:\n");
1891 pdu_counter_print(vty, " ", area->pdu_rx_counters);
1892
d62a17ae 1893 for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) {
1894 if ((area->is_type & level) == 0)
1895 continue;
1896
1897 vty_out(vty, " Level-%d:\n", level);
062f4d36
CF
1898
1899 vty_out(vty, " LSP0 regenerated: %" PRIu64 "\n",
1900 area->lsp_gen_count[level - 1]);
1901
6f004b60
CF
1902 vty_out(vty, " LSPs purged: %" PRIu64 "\n",
1903 area->lsp_purge_count[level - 1]);
1904
d62a17ae 1905 if (area->spf_timer[level - 1])
1906 vty_out(vty, " SPF: (pending)\n");
1907 else
1908 vty_out(vty, " SPF:\n");
1909
1910 vty_out(vty, " minimum interval : %d",
1911 area->min_spf_interval[level - 1]);
1912 if (area->spf_delay_ietf[level - 1])
1913 vty_out(vty,
1914 " (not used, IETF SPF delay activated)");
1915 vty_out(vty, "\n");
1916
a6f71d37
RW
1917 if (area->ip_circuits) {
1918 vty_out(vty, " IPv4 route computation:\n");
1919 isis_spf_print(
1920 area->spftree[SPFTREE_IPV4][level - 1],
1921 vty);
1922 }
d62a17ae 1923
a6f71d37
RW
1924 if (area->ipv6_circuits) {
1925 vty_out(vty, " IPv6 route computation:\n");
1926 isis_spf_print(
1927 area->spftree[SPFTREE_IPV6][level - 1],
1928 vty);
1929 }
321c1bbb 1930
a6f71d37
RW
1931 if (area->ipv6_circuits
1932 && isis_area_ipv6_dstsrc_enabled(area)) {
1933 vty_out(vty,
1934 " IPv6 dst-src route computation:\n");
1935 isis_spf_print(area->spftree[SPFTREE_DSTSRC]
1936 [level - 1],
1937 vty);
1938 }
d62a17ae 1939 }
1940 }
eab88f36
K
1941}
1942
1943DEFUN(show_isis_summary, show_isis_summary_cmd,
1944 "show " PROTO_NAME " [vrf <NAME|all>] summary",
1945 SHOW_STR PROTO_HELP VRF_CMD_HELP_STR
1946 "All VRFs\n"
1947 "summary\n")
1948{
36944791 1949 struct listnode *node;
eab88f36 1950 int idx_vrf = 0;
36944791 1951 struct isis *isis;
eab88f36
K
1952 const char *vrf_name = VRF_DEFAULT_NAME;
1953 bool all_vrf = false;
1954
1955 ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf)
1956 if (!im) {
1957 vty_out(vty, PROTO_NAME " is not running\n");
1958 return CMD_SUCCESS;
1959 }
1960 if (vrf_name) {
1961 if (all_vrf) {
36944791 1962 for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
eab88f36 1963 common_isis_summary(vty, isis);
36944791
RW
1964
1965 return CMD_SUCCESS;
eab88f36
K
1966 }
1967 isis = isis_lookup_by_vrfname(vrf_name);
1968 if (isis != NULL)
1969 common_isis_summary(vty, isis);
1970 }
1971
d62a17ae 1972 vty_out(vty, "\n");
1973
1974 return CMD_SUCCESS;
eb5d44eb 1975}
1976
eab88f36
K
1977struct isis_lsp *lsp_for_arg(struct lspdb_head *head, const char *argv,
1978 struct isis *isis)
d62a17ae 1979{
eb2bcb28 1980 char sysid[255] = {0};
d7c0a89a 1981 uint8_t number[3];
eb2bcb28
CF
1982 const char *pos;
1983 uint8_t lspid[ISIS_SYS_ID_LEN + 2] = {0};
1984 struct isis_dynhn *dynhn;
1985 struct isis_lsp *lsp = NULL;
d62a17ae 1986
eb2bcb28
CF
1987 if (!argv)
1988 return NULL;
d62a17ae 1989
1990 /*
1991 * extract fragment and pseudo id from the string argv
1992 * in the forms:
1993 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1994 * (b) <systemid/hostname>.<pseudo-id> or
1995 * (c) <systemid/hostname> or
1996 * Where systemid is in the form:
1997 * xxxx.xxxx.xxxx
1998 */
1999 if (argv)
e28544ed 2000 strlcpy(sysid, argv, sizeof(sysid));
d62a17ae 2001 if (argv && strlen(argv) > 3) {
2002 pos = argv + strlen(argv) - 3;
2003 if (strncmp(pos, "-", 1) == 0) {
2004 memcpy(number, ++pos, 2);
2005 lspid[ISIS_SYS_ID_LEN + 1] =
d7c0a89a 2006 (uint8_t)strtol((char *)number, NULL, 16);
d62a17ae 2007 pos -= 4;
2008 if (strncmp(pos, ".", 1) != 0)
eb2bcb28 2009 return NULL;
d62a17ae 2010 }
2011 if (strncmp(pos, ".", 1) == 0) {
2012 memcpy(number, ++pos, 2);
2013 lspid[ISIS_SYS_ID_LEN] =
d7c0a89a 2014 (uint8_t)strtol((char *)number, NULL, 16);
d62a17ae 2015 sysid[pos - argv - 1] = '\0';
2016 }
2017 }
2018
eb2bcb28
CF
2019 /*
2020 * Try to find the lsp-id if the argv
2021 * string is in
2022 * the form
2023 * hostname.<pseudo-id>-<fragment>
2024 */
2025 if (sysid2buff(lspid, sysid)) {
4bef0ec4 2026 lsp = lsp_search(head, lspid);
eb2bcb28
CF
2027 } else if ((dynhn = dynhn_find_by_name(sysid))) {
2028 memcpy(lspid, dynhn->id, ISIS_SYS_ID_LEN);
4bef0ec4 2029 lsp = lsp_search(head, lspid);
eb2bcb28
CF
2030 } else if (strncmp(cmd_hostname_get(), sysid, 15) == 0) {
2031 memcpy(lspid, isis->sysid, ISIS_SYS_ID_LEN);
4bef0ec4 2032 lsp = lsp_search(head, lspid);
eb2bcb28
CF
2033 }
2034
2035 return lsp;
2036}
2037
52a7c25e
RW
2038void show_isis_database_lspdb(struct vty *vty, struct isis_area *area,
2039 int level, struct lspdb_head *lspdb,
2040 const char *argv, int ui_level)
2041{
2042 struct isis_lsp *lsp;
2043 int lsp_count;
2044
2045 if (lspdb_count(lspdb) > 0) {
2046 lsp = lsp_for_arg(lspdb, argv, area->isis);
2047
2048 if (lsp != NULL || argv == NULL) {
2049 vty_out(vty, "IS-IS Level-%d link-state database:\n",
2050 level + 1);
2051
2052 /* print the title in all cases */
2053 vty_out(vty,
2054 "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n");
2055 }
2056
2057 if (lsp) {
2058 if (ui_level == ISIS_UI_LEVEL_DETAIL)
2059 lsp_print_detail(lsp, vty, area->dynhostname,
2060 area->isis);
2061 else
2062 lsp_print(lsp, vty, area->dynhostname,
2063 area->isis);
2064 } else if (argv == NULL) {
2065 lsp_count =
2066 lsp_print_all(vty, lspdb, ui_level,
2067 area->dynhostname, area->isis);
2068
2069 vty_out(vty, " %u LSPs\n\n", lsp_count);
2070 }
2071 }
2072}
2073
2074static void show_isis_database_common(struct vty *vty, const char *argv,
2075 int ui_level, struct isis *isis)
eb2bcb28
CF
2076{
2077 struct listnode *node;
2078 struct isis_area *area;
52a7c25e 2079 int level;
eb2bcb28
CF
2080
2081 if (isis->area_list->count == 0)
52a7c25e 2082 return;
eb2bcb28 2083
d62a17ae 2084 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
2085 vty_out(vty, "Area %s:\n",
2086 area->area_tag ? area->area_tag : "null");
2087
52a7c25e
RW
2088 for (level = 0; level < ISIS_LEVELS; level++)
2089 show_isis_database_lspdb(vty, area, level,
2090 &area->lspdb[level], argv,
2091 ui_level);
d62a17ae 2092 }
eab88f36
K
2093}
2094/*
2095 * This function supports following display options:
2096 * [ show isis database [detail] ]
2097 * [ show isis database <sysid> [detail] ]
2098 * [ show isis database <hostname> [detail] ]
2099 * [ show isis database <sysid>.<pseudo-id> [detail] ]
2100 * [ show isis database <hostname>.<pseudo-id> [detail] ]
2101 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
2102 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
2103 * [ show isis database detail <sysid> ]
2104 * [ show isis database detail <hostname> ]
2105 * [ show isis database detail <sysid>.<pseudo-id> ]
2106 * [ show isis database detail <hostname>.<pseudo-id> ]
2107 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
2108 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
2109 */
2110static int show_isis_database(struct vty *vty, const char *argv, int ui_level,
2111 const char *vrf_name, bool all_vrf)
2112{
36944791
RW
2113 struct listnode *node;
2114 struct isis *isis;
eab88f36
K
2115
2116 if (vrf_name) {
2117 if (all_vrf) {
36944791 2118 for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
eab88f36
K
2119 show_isis_database_common(vty, argv, ui_level,
2120 isis);
36944791
RW
2121
2122 return CMD_SUCCESS;
eab88f36
K
2123 }
2124 isis = isis_lookup_by_vrfname(vrf_name);
36944791 2125 if (isis)
eab88f36
K
2126 show_isis_database_common(vty, argv, ui_level, isis);
2127 }
d62a17ae 2128
2129 return CMD_SUCCESS;
eb5d44eb 2130}
2131
eab88f36
K
2132DEFUN(show_database, show_database_cmd,
2133 "show " PROTO_NAME " [vrf <NAME|all>] database [detail] [WORD]",
2134 SHOW_STR PROTO_HELP VRF_CMD_HELP_STR
2135 "All VRFs\n"
2136 "Link state database\n"
2137 "Detailed information\n"
2138 "LSP ID\n")
3f045a08 2139{
d62a17ae 2140 int idx = 0;
eab88f36
K
2141 int idx_vrf = 0;
2142 const char *vrf_name = VRF_DEFAULT_NAME;
2143 bool all_vrf = false;
d62a17ae 2144 int uilevel = argv_find(argv, argc, "detail", &idx)
2145 ? ISIS_UI_LEVEL_DETAIL
2146 : ISIS_UI_LEVEL_BRIEF;
2147 char *id = argv_find(argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL;
eab88f36
K
2148 ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
2149 return show_isis_database(vty, id, uilevel, vrf_name, all_vrf);
3f045a08
JB
2150}
2151
aaf2fd21 2152#ifdef FABRICD
d62a17ae 2153/*
aaf2fd21 2154 * 'router openfabric' command
3f045a08 2155 */
aaf2fd21
EDP
2156DEFUN_NOSH (router_openfabric,
2157 router_openfabric_cmd,
2158 "router openfabric WORD",
3f045a08 2159 ROUTER_STR
7c0cbd0e 2160 PROTO_HELP
efd7904e 2161 "ISO Routing area tag\n")
3f045a08 2162{
d62a17ae 2163 int idx_word = 2;
2164 return isis_area_get(vty, argv[idx_word]->arg);
3f045a08
JB
2165}
2166
d62a17ae 2167/*
aaf2fd21 2168 *'no router openfabric' command
3f045a08 2169 */
aaf2fd21
EDP
2170DEFUN (no_router_openfabric,
2171 no_router_openfabric_cmd,
2172 "no router openfabric WORD",
7c0cbd0e
CF
2173 NO_STR
2174 ROUTER_STR
2175 PROTO_HELP
2176 "ISO Routing area tag\n")
eb5d44eb 2177{
14c6e772
RW
2178 struct isis_area *area;
2179 const char *area_tag;
d62a17ae 2180 int idx_word = 3;
14c6e772
RW
2181
2182 area_tag = argv[idx_word]->arg;
eab88f36 2183 area = isis_area_lookup(area_tag, VRF_DEFAULT);
14c6e772
RW
2184 if (area == NULL) {
2185 zlog_warn("%s: could not find area with area-tag %s",
2186 __func__, area_tag);
2187 return CMD_ERR_NO_MATCH;
2188 }
2189
2190 isis_area_destroy(area);
2191 return CMD_SUCCESS;
eb5d44eb 2192}
aaf2fd21 2193#endif /* ifdef FABRICD */
f084ea55 2194#ifdef FABRICD
eb5d44eb 2195/*
2196 * 'net' command
2197 */
2198DEFUN (net,
2199 net_cmd,
2200 "net WORD",
2201 "A Network Entity Title for this process (OSI only)\n"
f390d2c7 2202 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
eb5d44eb 2203{
d62a17ae 2204 int idx_word = 1;
2205 return area_net_title(vty, argv[idx_word]->arg);
eb5d44eb 2206}
2207
eb5d44eb 2208/*
2209 * 'no net' command
2210 */
2211DEFUN (no_net,
2212 no_net_cmd,
2213 "no net WORD",
2214 NO_STR
2215 "A Network Entity Title for this process (OSI only)\n"
f390d2c7 2216 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
eb5d44eb 2217{
d62a17ae 2218 int idx_word = 2;
2219 return area_clear_net_title(vty, argv[idx_word]->arg);
eb5d44eb 2220}
f084ea55 2221#endif /* ifdef FABRICD */
22af6a80 2222#ifdef FABRICD
064f4896
CF
2223DEFUN (isis_topology,
2224 isis_topology_cmd,
2225 "topology " ISIS_MT_NAMES " [overload]",
2226 "Configure IS-IS topologies\n"
2227 ISIS_MT_DESCRIPTIONS
2228 "Set overload bit for topology\n")
2229{
d62a17ae 2230 VTY_DECLVAR_CONTEXT(isis_area, area);
064f4896 2231
d62a17ae 2232 const char *arg = argv[1]->arg;
2233 uint16_t mtid = isis_str2mtid(arg);
c3ea3906 2234
d62a17ae 2235 if (area->oldmetric) {
2236 vty_out(vty,
2237 "Multi topology IS-IS can only be used with wide metrics\n");
a5fdb4c5 2238 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 2239 }
c3ea3906 2240
d62a17ae 2241 if (mtid == (uint16_t)-1) {
2242 vty_out(vty, "Don't know topology '%s'\n", arg);
a5fdb4c5 2243 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 2244 }
2245 if (mtid == ISIS_MT_IPV4_UNICAST) {
2246 vty_out(vty, "Cannot configure IPv4 unicast topology\n");
a5fdb4c5 2247 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 2248 }
064f4896 2249
d62a17ae 2250 area_set_mt_enabled(area, mtid, true);
2251 area_set_mt_overload(area, mtid, (argc == 3));
2252 return CMD_SUCCESS;
064f4896
CF
2253}
2254
2255DEFUN (no_isis_topology,
2256 no_isis_topology_cmd,
2257 "no topology " ISIS_MT_NAMES " [overload]",
2258 NO_STR
2259 "Configure IS-IS topologies\n"
2260 ISIS_MT_DESCRIPTIONS
2261 "Set overload bit for topology\n")
2262{
d62a17ae 2263 VTY_DECLVAR_CONTEXT(isis_area, area);
064f4896 2264
d62a17ae 2265 const char *arg = argv[2]->arg;
2266 uint16_t mtid = isis_str2mtid(arg);
c3ea3906 2267
d62a17ae 2268 if (area->oldmetric) {
2269 vty_out(vty,
2270 "Multi topology IS-IS can only be used with wide metrics\n");
a5fdb4c5 2271 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 2272 }
c3ea3906 2273
d62a17ae 2274 if (mtid == (uint16_t)-1) {
2275 vty_out(vty, "Don't know topology '%s'\n", arg);
a5fdb4c5 2276 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 2277 }
2278 if (mtid == ISIS_MT_IPV4_UNICAST) {
2279 vty_out(vty, "Cannot configure IPv4 unicast topology\n");
a5fdb4c5 2280 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 2281 }
064f4896 2282
d62a17ae 2283 area_set_mt_enabled(area, mtid, false);
2284 area_set_mt_overload(area, mtid, false);
2285 return CMD_SUCCESS;
064f4896 2286}
22af6a80 2287#endif /* ifdef FABRICD */
064f4896 2288
6754fc66 2289void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu)
b20ccb3a 2290{
d62a17ae 2291 area->lsp_mtu = lsp_mtu;
2292 lsp_regenerate_schedule(area, IS_LEVEL_1_AND_2, 1);
2293}
2294
2295static int isis_area_passwd_set(struct isis_area *area, int level,
d7c0a89a
QY
2296 uint8_t passwd_type, const char *passwd,
2297 uint8_t snp_auth)
d62a17ae 2298{
2299 struct isis_passwd *dest;
2300 struct isis_passwd modified;
2301 int len;
2302
2303 assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2));
2304 dest = (level == IS_LEVEL_1) ? &area->area_passwd
2305 : &area->domain_passwd;
2306 memset(&modified, 0, sizeof(modified));
2307
2308 if (passwd_type != ISIS_PASSWD_TYPE_UNUSED) {
2309 if (!passwd)
2310 return -1;
2311
2312 len = strlen(passwd);
2313 if (len > 254)
2314 return -1;
2315
2316 modified.len = len;
e28544ed
QY
2317 strlcpy((char *)modified.passwd, passwd,
2318 sizeof(modified.passwd));
d62a17ae 2319 modified.type = passwd_type;
2320 modified.snp_auth = snp_auth;
2321 }
2322
2323 if (memcmp(&modified, dest, sizeof(modified))) {
2324 memcpy(dest, &modified, sizeof(modified));
2325 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2326 }
2327
2328 return 0;
2329}
2330
2331int isis_area_passwd_unset(struct isis_area *area, int level)
2332{
2333 return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_UNUSED, NULL,
2334 0);
2335}
2336
2337int isis_area_passwd_cleartext_set(struct isis_area *area, int level,
d7c0a89a 2338 const char *passwd, uint8_t snp_auth)
d62a17ae 2339{
2340 return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_CLEARTXT,
2341 passwd, snp_auth);
2342}
2343
2344int isis_area_passwd_hmac_md5_set(struct isis_area *area, int level,
d7c0a89a 2345 const char *passwd, uint8_t snp_auth)
d62a17ae 2346{
2347 return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_HMAC_MD5,
2348 passwd, snp_auth);
b20ccb3a
CF
2349}
2350
3dace42d
CF
2351void isis_area_invalidate_routes(struct isis_area *area, int levels)
2352{
2353 for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) {
2354 if (!(level & levels))
2355 continue;
be985ba0
CF
2356 for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) {
2357 isis_spf_invalidate_routes(
2358 area->spftree[tree][level - 1]);
2359 }
3dace42d
CF
2360 }
2361}
2362
2363void isis_area_verify_routes(struct isis_area *area)
2364{
be985ba0
CF
2365 for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++)
2366 isis_spf_verify_routes(area, area->spftree[tree]);
3dace42d
CF
2367}
2368
d62a17ae 2369static void area_resign_level(struct isis_area *area, int level)
3f045a08 2370{
3dace42d
CF
2371 isis_area_invalidate_routes(area, level);
2372 isis_area_verify_routes(area);
2373
4bef0ec4 2374 lsp_db_fini(&area->lspdb[level - 1]);
be985ba0
CF
2375
2376 for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) {
2377 if (area->spftree[tree][level - 1]) {
2378 isis_spftree_del(area->spftree[tree][level - 1]);
2379 area->spftree[tree][level - 1] = NULL;
2380 }
d62a17ae 2381 }
be985ba0 2382
8f15843b
DS
2383 if (area->spf_timer[level - 1])
2384 isis_spf_timer_free(THREAD_ARG(area->spf_timer[level - 1]));
2385
50478845 2386 thread_cancel(&area->spf_timer[level - 1]);
3f045a08 2387
d62a17ae 2388 sched_debug(
2389 "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
2390 area->area_tag, level);
50478845 2391 thread_cancel(&area->t_lsp_refresh[level - 1]);
d62a17ae 2392 area->lsp_regenerate_pending[level - 1] = 0;
2393}
3f045a08 2394
d62a17ae 2395void isis_area_is_type_set(struct isis_area *area, int is_type)
2396{
2397 struct listnode *node;
2398 struct isis_circuit *circuit;
3f045a08 2399
e740f9c1 2400 if (IS_DEBUG_EVENTS)
d62a17ae 2401 zlog_debug("ISIS-Evt (%s) system type change %s -> %s",
2402 area->area_tag, circuit_t2string(area->is_type),
2403 circuit_t2string(is_type));
f390d2c7 2404
d62a17ae 2405 if (area->is_type == is_type)
2406 return; /* No change */
2407
2408 switch (area->is_type) {
2409 case IS_LEVEL_1:
2410 if (is_type == IS_LEVEL_2)
2411 area_resign_level(area, IS_LEVEL_1);
2412
4bef0ec4 2413 lsp_db_init(&area->lspdb[1]);
d62a17ae 2414 break;
2415
2416 case IS_LEVEL_1_AND_2:
2417 if (is_type == IS_LEVEL_1)
2418 area_resign_level(area, IS_LEVEL_2);
2419 else
2420 area_resign_level(area, IS_LEVEL_1);
2421 break;
2422
2423 case IS_LEVEL_2:
2424 if (is_type == IS_LEVEL_1)
2425 area_resign_level(area, IS_LEVEL_2);
2426
4bef0ec4 2427 lsp_db_init(&area->lspdb[0]);
d62a17ae 2428 break;
2429
2430 default:
2431 break;
2432 }
2433
2434 area->is_type = is_type;
2435
2436 /* override circuit's is_type */
2437 if (area->is_type != IS_LEVEL_1_AND_2) {
2438 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit))
2439 isis_circuit_is_type_set(circuit, is_type);
2440 }
2441
2442 spftree_area_init(area);
2443
2444 if (listcount(area->area_addrs) > 0) {
2445 if (is_type & IS_LEVEL_1)
2446 lsp_generate(area, IS_LEVEL_1);
2447 if (is_type & IS_LEVEL_2)
2448 lsp_generate(area, IS_LEVEL_2);
2449 }
2450 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2451
2452 return;
eb5d44eb 2453}
2454
a38a72db
CF
2455void isis_area_metricstyle_set(struct isis_area *area, bool old_metric,
2456 bool new_metric)
e38e0df0 2457{
e0df3206
EDP
2458 area->oldmetric = old_metric;
2459 area->newmetric = new_metric;
2460 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
e38e0df0
SV
2461}
2462
a38a72db 2463void isis_area_overload_bit_set(struct isis_area *area, bool overload_bit)
eb5d44eb 2464{
d62a17ae 2465 char new_overload_bit = overload_bit ? LSPBIT_OL : 0;
eb5d44eb 2466
d62a17ae 2467 if (new_overload_bit != area->overload_bit) {
2468 area->overload_bit = new_overload_bit;
2469 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2470 }
9414b6f6
EDP
2471#ifndef FABRICD
2472 isis_notif_db_overload(area, overload_bit);
2473#endif /* ifndef FABRICD */
3f045a08
JB
2474}
2475
a38a72db 2476void isis_area_attached_bit_set(struct isis_area *area, bool attached_bit)
3f045a08 2477{
d62a17ae 2478 char new_attached_bit = attached_bit ? LSPBIT_ATT : 0;
3f045a08 2479
d62a17ae 2480 if (new_attached_bit != area->attached_bit) {
2481 area->attached_bit = new_attached_bit;
2482 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2483 }
eb5d44eb 2484}
2485
a38a72db 2486void isis_area_dynhostname_set(struct isis_area *area, bool dynhostname)
eb5d44eb 2487{
d62a17ae 2488 if (area->dynhostname != dynhostname) {
2489 area->dynhostname = dynhostname;
2490 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0);
2491 }
eb5d44eb 2492}
2493
d62a17ae 2494void isis_area_max_lsp_lifetime_set(struct isis_area *area, int level,
2495 uint16_t max_lsp_lifetime)
eb5d44eb 2496{
d62a17ae 2497 assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2));
eb5d44eb 2498
d62a17ae 2499 if (area->max_lsp_lifetime[level - 1] == max_lsp_lifetime)
2500 return;
3f045a08 2501
d62a17ae 2502 area->max_lsp_lifetime[level - 1] = max_lsp_lifetime;
2503 lsp_regenerate_schedule(area, level, 1);
3f045a08
JB
2504}
2505
d62a17ae 2506void isis_area_lsp_refresh_set(struct isis_area *area, int level,
2507 uint16_t lsp_refresh)
3f045a08 2508{
d62a17ae 2509 assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2));
eb5d44eb 2510
d62a17ae 2511 if (area->lsp_refresh[level - 1] == lsp_refresh)
2512 return;
eb5d44eb 2513
d62a17ae 2514 area->lsp_refresh[level - 1] = lsp_refresh;
2515 lsp_regenerate_schedule(area, level, 1);
3f045a08
JB
2516}
2517
2adf66ff 2518#ifdef FABRICD
3f045a08
JB
2519DEFUN (log_adj_changes,
2520 log_adj_changes_cmd,
2521 "log-adjacency-changes",
2522 "Log changes in adjacency state\n")
2523{
d62a17ae 2524 VTY_DECLVAR_CONTEXT(isis_area, area);
eb5d44eb 2525
d62a17ae 2526 area->log_adj_changes = 1;
eb5d44eb 2527
d62a17ae 2528 return CMD_SUCCESS;
eb5d44eb 2529}
2530
3f045a08
JB
2531DEFUN (no_log_adj_changes,
2532 no_log_adj_changes_cmd,
2533 "no log-adjacency-changes",
d7fa34c1 2534 NO_STR
3f045a08 2535 "Stop logging changes in adjacency state\n")
eb5d44eb 2536{
d62a17ae 2537 VTY_DECLVAR_CONTEXT(isis_area, area);
f390d2c7 2538
d62a17ae 2539 area->log_adj_changes = 0;
eb5d44eb 2540
d62a17ae 2541 return CMD_SUCCESS;
eb5d44eb 2542}
2adf66ff 2543#endif /* ifdef FABRICD */
20600086 2544#ifdef FABRICD
eb5d44eb 2545/* IS-IS configuration write function */
612c2c15 2546static int isis_config_write(struct vty *vty)
d62a17ae 2547{
2548 int write = 0;
eab88f36 2549 struct isis_area *area;
36944791
RW
2550 struct listnode *node, *node2, *inode;
2551 struct isis *isis;
eab88f36
K
2552
2553 if (!im) {
2554 vty_out(vty, "IS-IS Routing Process not enabled\n");
2555 return CMD_SUCCESS;
2556 }
d62a17ae 2557
36944791 2558 for (ALL_LIST_ELEMENTS_RO(im->isis, inode, isis)) {
d62a17ae 2559 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
2560 /* ISIS - Area name */
7c0cbd0e 2561 vty_out(vty, "router " PROTO_NAME " %s\n", area->area_tag);
d62a17ae 2562 write++;
2563 /* ISIS - Net */
2564 if (listcount(area->area_addrs) > 0) {
2565 struct area_addr *area_addr;
2566 for (ALL_LIST_ELEMENTS_RO(area->area_addrs,
2567 node2, area_addr)) {
2568 vty_out(vty, " net %s\n",
2569 isonet_print(
2570 area_addr->area_addr,
2571 area_addr->addr_len
2572 + ISIS_SYS_ID_LEN
2573 + 1));
2574 write++;
2575 }
2576 }
2577 /* ISIS - Dynamic hostname - Defaults to true so only
2578 * display if
2579 * false. */
2580 if (!area->dynhostname) {
2581 vty_out(vty, " no hostname dynamic\n");
2582 write++;
2583 }
2584 /* ISIS - Metric-Style - when true displays wide */
65f18157
CF
2585 if (!fabricd) {
2586 if (area->newmetric) {
2587 if (!area->oldmetric)
2588 vty_out(vty, " metric-style wide\n");
2589 else
2590 vty_out(vty,
2591 " metric-style transition\n");
2592 write++;
2593 } else {
2594 vty_out(vty, " metric-style narrow\n");
2595 write++;
2596 }
d62a17ae 2597 }
2598 /* ISIS - overload-bit */
2599 if (area->overload_bit) {
2600 vty_out(vty, " set-overload-bit\n");
2601 write++;
2602 }
2603 /* ISIS - Area is-type (level-1-2 is default) */
65f18157
CF
2604 if (!fabricd) {
2605 if (area->is_type == IS_LEVEL_1) {
2606 vty_out(vty, " is-type level-1\n");
2607 write++;
2608 } else if (area->is_type == IS_LEVEL_2) {
2609 vty_out(vty, " is-type level-2-only\n");
2610 write++;
2611 }
d62a17ae 2612 }
2613 write += isis_redist_config_write(vty, area, AF_INET);
2614 write += isis_redist_config_write(vty, area, AF_INET6);
2615 /* ISIS - Lsp generation interval */
2616 if (area->lsp_gen_interval[0]
2617 == area->lsp_gen_interval[1]) {
2618 if (area->lsp_gen_interval[0]
2619 != DEFAULT_MIN_LSP_GEN_INTERVAL) {
2620 vty_out(vty, " lsp-gen-interval %d\n",
2621 area->lsp_gen_interval[0]);
2622 write++;
2623 }
2624 } else {
2625 if (area->lsp_gen_interval[0]
2626 != DEFAULT_MIN_LSP_GEN_INTERVAL) {
2627 vty_out(vty,
2628 " lsp-gen-interval level-1 %d\n",
2629 area->lsp_gen_interval[0]);
2630 write++;
2631 }
2632 if (area->lsp_gen_interval[1]
2633 != DEFAULT_MIN_LSP_GEN_INTERVAL) {
2634 vty_out(vty,
2635 " lsp-gen-interval level-2 %d\n",
2636 area->lsp_gen_interval[1]);
2637 write++;
2638 }
2639 }
2640 /* ISIS - LSP lifetime */
2641 if (area->max_lsp_lifetime[0]
2642 == area->max_lsp_lifetime[1]) {
2643 if (area->max_lsp_lifetime[0]
2644 != DEFAULT_LSP_LIFETIME) {
2645 vty_out(vty, " max-lsp-lifetime %u\n",
2646 area->max_lsp_lifetime[0]);
2647 write++;
2648 }
2649 } else {
2650 if (area->max_lsp_lifetime[0]
2651 != DEFAULT_LSP_LIFETIME) {
2652 vty_out(vty,
2653 " max-lsp-lifetime level-1 %u\n",
2654 area->max_lsp_lifetime[0]);
2655 write++;
2656 }
2657 if (area->max_lsp_lifetime[1]
2658 != DEFAULT_LSP_LIFETIME) {
2659 vty_out(vty,
2660 " max-lsp-lifetime level-2 %u\n",
2661 area->max_lsp_lifetime[1]);
2662 write++;
2663 }
2664 }
2665 /* ISIS - LSP refresh interval */
2666 if (area->lsp_refresh[0] == area->lsp_refresh[1]) {
2667 if (area->lsp_refresh[0]
2668 != DEFAULT_MAX_LSP_GEN_INTERVAL) {
2669 vty_out(vty,
2670 " lsp-refresh-interval %u\n",
2671 area->lsp_refresh[0]);
2672 write++;
2673 }
2674 } else {
2675 if (area->lsp_refresh[0]
2676 != DEFAULT_MAX_LSP_GEN_INTERVAL) {
2677 vty_out(vty,
2678 " lsp-refresh-interval level-1 %u\n",
2679 area->lsp_refresh[0]);
2680 write++;
2681 }
2682 if (area->lsp_refresh[1]
2683 != DEFAULT_MAX_LSP_GEN_INTERVAL) {
2684 vty_out(vty,
2685 " lsp-refresh-interval level-2 %u\n",
2686 area->lsp_refresh[1]);
2687 write++;
2688 }
2689 }
2690 if (area->lsp_mtu != DEFAULT_LSP_MTU) {
2691 vty_out(vty, " lsp-mtu %u\n", area->lsp_mtu);
2692 write++;
2693 }
2c92bee4
CF
2694 if (area->purge_originator) {
2695 vty_out(vty, " purge-originator\n");
2696 write++;
2697 }
d62a17ae 2698
2699 /* Minimum SPF interval. */
2700 if (area->min_spf_interval[0]
2701 == area->min_spf_interval[1]) {
2702 if (area->min_spf_interval[0]
2703 != MINIMUM_SPF_INTERVAL) {
2704 vty_out(vty, " spf-interval %d\n",
2705 area->min_spf_interval[0]);
2706 write++;
2707 }
2708 } else {
2709 if (area->min_spf_interval[0]
2710 != MINIMUM_SPF_INTERVAL) {
2711 vty_out(vty,
2712 " spf-interval level-1 %d\n",
2713 area->min_spf_interval[0]);
2714 write++;
2715 }
2716 if (area->min_spf_interval[1]
2717 != MINIMUM_SPF_INTERVAL) {
2718 vty_out(vty,
2719 " spf-interval level-2 %d\n",
2720 area->min_spf_interval[1]);
2721 write++;
2722 }
2723 }
2724
2725 /* IETF SPF interval */
2726 if (area->spf_delay_ietf[0]) {
2727 vty_out(vty,
2728 " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n",
2729 spf_backoff_init_delay(
2730 area->spf_delay_ietf[0]),
2731 spf_backoff_short_delay(
2732 area->spf_delay_ietf[0]),
2733 spf_backoff_long_delay(
2734 area->spf_delay_ietf[0]),
2735 spf_backoff_holddown(
2736 area->spf_delay_ietf[0]),
2737 spf_backoff_timetolearn(
2738 area->spf_delay_ietf[0]));
2739 write++;
2740 }
2741
2742 /* Authentication passwords. */
2743 if (area->area_passwd.type
2744 == ISIS_PASSWD_TYPE_HMAC_MD5) {
2745 vty_out(vty, " area-password md5 %s",
2746 area->area_passwd.passwd);
2747 if (CHECK_FLAG(area->area_passwd.snp_auth,
2748 SNP_AUTH_SEND)) {
2749 vty_out(vty, " authenticate snp ");
2750 if (CHECK_FLAG(
2751 area->area_passwd.snp_auth,
2752 SNP_AUTH_RECV))
2753 vty_out(vty, "validate");
2754 else
2755 vty_out(vty, "send-only");
2756 }
2757 vty_out(vty, "\n");
2758 write++;
2759 } else if (area->area_passwd.type
2760 == ISIS_PASSWD_TYPE_CLEARTXT) {
2761 vty_out(vty, " area-password clear %s",
2762 area->area_passwd.passwd);
2763 if (CHECK_FLAG(area->area_passwd.snp_auth,
2764 SNP_AUTH_SEND)) {
2765 vty_out(vty, " authenticate snp ");
2766 if (CHECK_FLAG(
2767 area->area_passwd.snp_auth,
2768 SNP_AUTH_RECV))
2769 vty_out(vty, "validate");
2770 else
2771 vty_out(vty, "send-only");
2772 }
2773 vty_out(vty, "\n");
2774 write++;
2775 }
2776 if (area->domain_passwd.type
2777 == ISIS_PASSWD_TYPE_HMAC_MD5) {
2778 vty_out(vty, " domain-password md5 %s",
2779 area->domain_passwd.passwd);
2780 if (CHECK_FLAG(area->domain_passwd.snp_auth,
2781 SNP_AUTH_SEND)) {
2782 vty_out(vty, " authenticate snp ");
2783 if (CHECK_FLAG(area->domain_passwd
2784 .snp_auth,
2785 SNP_AUTH_RECV))
2786 vty_out(vty, "validate");
2787 else
2788 vty_out(vty, "send-only");
2789 }
2790 vty_out(vty, "\n");
2791 write++;
2792 } else if (area->domain_passwd.type
2793 == ISIS_PASSWD_TYPE_CLEARTXT) {
2794 vty_out(vty, " domain-password clear %s",
2795 area->domain_passwd.passwd);
2796 if (CHECK_FLAG(area->domain_passwd.snp_auth,
2797 SNP_AUTH_SEND)) {
2798 vty_out(vty, " authenticate snp ");
2799 if (CHECK_FLAG(area->domain_passwd
2800 .snp_auth,
2801 SNP_AUTH_RECV))
2802 vty_out(vty, "validate");
2803 else
2804 vty_out(vty, "send-only");
2805 }
2806 vty_out(vty, "\n");
2807 write++;
2808 }
2809
2810 if (area->log_adj_changes) {
2811 vty_out(vty, " log-adjacency-changes\n");
2812 write++;
2813 }
2814
2815 write += area_write_mt_settings(area, vty);
92ed0cde 2816 write += fabricd_write_settings(area, vty);
d62a17ae 2817 }
d62a17ae 2818 }
2819
2820 return write;
2821}
2822
f4b8291f
DL
2823struct cmd_node router_node = {
2824 .name = "openfabric",
2825 .node = OPENFABRIC_NODE,
2826 .parent_node = CONFIG_NODE,
2827 .prompt = "%s(config-router)# ",
2828 .config_write = isis_config_write,
2829};
20600086
EDP
2830#else
2831/* IS-IS configuration write function */
612c2c15 2832static int isis_config_write(struct vty *vty)
20600086
EDP
2833{
2834 int write = 0;
2835 struct lyd_node *dnode;
2836
2837 dnode = yang_dnode_get(running_config->dnode, "/frr-isisd:isis");
cc50ddb2 2838 if (dnode) {
20600086 2839 nb_cli_show_dnode_cmds(vty, dnode, false);
cc50ddb2
EDP
2840 write++;
2841 }
20600086
EDP
2842
2843 return write;
2844}
20600086 2845
62b346ee 2846struct cmd_node router_node = {
f4b8291f
DL
2847 .name = "isis",
2848 .node = ISIS_NODE,
24389580 2849 .parent_node = CONFIG_NODE,
62b346ee 2850 .prompt = "%s(config-router)# ",
612c2c15 2851 .config_write = isis_config_write,
62b346ee 2852};
f4b8291f 2853#endif /* ifdef FABRICD */
d62a17ae 2854
4d762f26 2855void isis_init(void)
d62a17ae 2856{
2857 /* Install IS-IS top node */
612c2c15 2858 install_node(&router_node);
d62a17ae 2859
2860 install_element(VIEW_NODE, &show_isis_summary_cmd);
2861
2862 install_element(VIEW_NODE, &show_isis_spf_ietf_cmd);
2863
2864 install_element(VIEW_NODE, &show_isis_interface_cmd);
2865 install_element(VIEW_NODE, &show_isis_interface_detail_cmd);
2866 install_element(VIEW_NODE, &show_isis_interface_arg_cmd);
2867
2868 install_element(VIEW_NODE, &show_isis_neighbor_cmd);
2869 install_element(VIEW_NODE, &show_isis_neighbor_detail_cmd);
2870 install_element(VIEW_NODE, &show_isis_neighbor_arg_cmd);
2b55d953
IR
2871 install_element(ENABLE_NODE, &clear_isis_neighbor_cmd);
2872 install_element(ENABLE_NODE, &clear_isis_neighbor_arg_cmd);
d62a17ae 2873
2874 install_element(VIEW_NODE, &show_hostname_cmd);
2875 install_element(VIEW_NODE, &show_database_cmd);
2876
2877 install_element(ENABLE_NODE, &show_debugging_isis_cmd);
2878
612c2c15 2879 install_node(&debug_node);
d62a17ae 2880
2881 install_element(ENABLE_NODE, &debug_isis_adj_cmd);
2882 install_element(ENABLE_NODE, &no_debug_isis_adj_cmd);
161fa356
CF
2883 install_element(ENABLE_NODE, &debug_isis_tx_queue_cmd);
2884 install_element(ENABLE_NODE, &no_debug_isis_tx_queue_cmd);
ddb33326
CF
2885 install_element(ENABLE_NODE, &debug_isis_flooding_cmd);
2886 install_element(ENABLE_NODE, &no_debug_isis_flooding_cmd);
d62a17ae 2887 install_element(ENABLE_NODE, &debug_isis_snp_cmd);
2888 install_element(ENABLE_NODE, &no_debug_isis_snp_cmd);
2889 install_element(ENABLE_NODE, &debug_isis_upd_cmd);
2890 install_element(ENABLE_NODE, &no_debug_isis_upd_cmd);
2891 install_element(ENABLE_NODE, &debug_isis_spfevents_cmd);
2892 install_element(ENABLE_NODE, &no_debug_isis_spfevents_cmd);
26f6acaf
RW
2893 install_element(ENABLE_NODE, &debug_isis_srevents_cmd);
2894 install_element(ENABLE_NODE, &no_debug_isis_srevents_cmd);
c951ee6e
RW
2895 install_element(ENABLE_NODE, &debug_isis_tilfa_cmd);
2896 install_element(ENABLE_NODE, &no_debug_isis_tilfa_cmd);
d62a17ae 2897 install_element(ENABLE_NODE, &debug_isis_rtevents_cmd);
2898 install_element(ENABLE_NODE, &no_debug_isis_rtevents_cmd);
2899 install_element(ENABLE_NODE, &debug_isis_events_cmd);
2900 install_element(ENABLE_NODE, &no_debug_isis_events_cmd);
2901 install_element(ENABLE_NODE, &debug_isis_packet_dump_cmd);
2902 install_element(ENABLE_NODE, &no_debug_isis_packet_dump_cmd);
2903 install_element(ENABLE_NODE, &debug_isis_lsp_gen_cmd);
2904 install_element(ENABLE_NODE, &no_debug_isis_lsp_gen_cmd);
2905 install_element(ENABLE_NODE, &debug_isis_lsp_sched_cmd);
2906 install_element(ENABLE_NODE, &no_debug_isis_lsp_sched_cmd);
2815f817
CF
2907 install_element(ENABLE_NODE, &debug_isis_bfd_cmd);
2908 install_element(ENABLE_NODE, &no_debug_isis_bfd_cmd);
1cbf96a8 2909 install_element(ENABLE_NODE, &debug_isis_ldp_sync_cmd);
2910 install_element(ENABLE_NODE, &no_debug_isis_ldp_sync_cmd);
d62a17ae 2911
2912 install_element(CONFIG_NODE, &debug_isis_adj_cmd);
2913 install_element(CONFIG_NODE, &no_debug_isis_adj_cmd);
161fa356
CF
2914 install_element(CONFIG_NODE, &debug_isis_tx_queue_cmd);
2915 install_element(CONFIG_NODE, &no_debug_isis_tx_queue_cmd);
ddb33326
CF
2916 install_element(CONFIG_NODE, &debug_isis_flooding_cmd);
2917 install_element(CONFIG_NODE, &no_debug_isis_flooding_cmd);
d62a17ae 2918 install_element(CONFIG_NODE, &debug_isis_snp_cmd);
2919 install_element(CONFIG_NODE, &no_debug_isis_snp_cmd);
2920 install_element(CONFIG_NODE, &debug_isis_upd_cmd);
2921 install_element(CONFIG_NODE, &no_debug_isis_upd_cmd);
2922 install_element(CONFIG_NODE, &debug_isis_spfevents_cmd);
2923 install_element(CONFIG_NODE, &no_debug_isis_spfevents_cmd);
26f6acaf
RW
2924 install_element(CONFIG_NODE, &debug_isis_srevents_cmd);
2925 install_element(CONFIG_NODE, &no_debug_isis_srevents_cmd);
c951ee6e
RW
2926 install_element(CONFIG_NODE, &debug_isis_tilfa_cmd);
2927 install_element(CONFIG_NODE, &no_debug_isis_tilfa_cmd);
d62a17ae 2928 install_element(CONFIG_NODE, &debug_isis_rtevents_cmd);
2929 install_element(CONFIG_NODE, &no_debug_isis_rtevents_cmd);
2930 install_element(CONFIG_NODE, &debug_isis_events_cmd);
2931 install_element(CONFIG_NODE, &no_debug_isis_events_cmd);
2932 install_element(CONFIG_NODE, &debug_isis_packet_dump_cmd);
2933 install_element(CONFIG_NODE, &no_debug_isis_packet_dump_cmd);
2934 install_element(CONFIG_NODE, &debug_isis_lsp_gen_cmd);
2935 install_element(CONFIG_NODE, &no_debug_isis_lsp_gen_cmd);
2936 install_element(CONFIG_NODE, &debug_isis_lsp_sched_cmd);
2937 install_element(CONFIG_NODE, &no_debug_isis_lsp_sched_cmd);
2815f817
CF
2938 install_element(CONFIG_NODE, &debug_isis_bfd_cmd);
2939 install_element(CONFIG_NODE, &no_debug_isis_bfd_cmd);
1cbf96a8 2940 install_element(CONFIG_NODE, &debug_isis_ldp_sync_cmd);
2941 install_element(CONFIG_NODE, &no_debug_isis_ldp_sync_cmd);
d62a17ae 2942
7c0cbd0e 2943 install_default(ROUTER_NODE);
d62a17ae 2944
aaf2fd21
EDP
2945#ifdef FABRICD
2946 install_element(CONFIG_NODE, &router_openfabric_cmd);
2947 install_element(CONFIG_NODE, &no_router_openfabric_cmd);
2adf66ff 2948
7c0cbd0e
CF
2949 install_element(ROUTER_NODE, &net_cmd);
2950 install_element(ROUTER_NODE, &no_net_cmd);
2adf66ff 2951
7c0cbd0e
CF
2952 install_element(ROUTER_NODE, &isis_topology_cmd);
2953 install_element(ROUTER_NODE, &no_isis_topology_cmd);
2adf66ff 2954
7c0cbd0e
CF
2955 install_element(ROUTER_NODE, &log_adj_changes_cmd);
2956 install_element(ROUTER_NODE, &no_log_adj_changes_cmd);
2adf66ff 2957#endif /* ifdef FABRICD */
d62a17ae 2958
2959 spf_backoff_cmd_init();
eb5d44eb 2960}