]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isisd.c
tests: Introduce BFD IS-IS topotests
[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"
03f7e182 38#include "spf_backoff.h"
aaf2fd21 39#include "lib/northbound_cli.h"
eb5d44eb 40
eb5d44eb 41#include "isisd/isis_constants.h"
42#include "isisd/isis_common.h"
eb5d44eb 43#include "isisd/isis_flags.h"
3f045a08
JB
44#include "isisd/isis_circuit.h"
45#include "isisd/isis_csm.h"
eb5d44eb 46#include "isisd/isisd.h"
47#include "isisd/isis_dynhn.h"
48#include "isisd/isis_adjacency.h"
49#include "isisd/isis_pdu.h"
50#include "isisd/isis_misc.h"
51#include "isisd/isis_constants.h"
eb5d44eb 52#include "isisd/isis_lsp.h"
53#include "isisd/isis_spf.h"
54#include "isisd/isis_route.h"
55#include "isisd/isis_zebra.h"
56#include "isisd/isis_events.h"
f8c06e2c 57#include "isisd/isis_te.h"
064f4896 58#include "isisd/isis_mt.h"
26f6acaf 59#include "isisd/isis_sr.h"
8e6fb83b 60#include "isisd/fabricd.h"
2a1c520e 61#include "isisd/isis_nb.h"
eb5d44eb 62
e740f9c1 63/* For debug statement. */
64unsigned long debug_adj_pkt;
65unsigned long debug_snp_pkt;
66unsigned long debug_update_pkt;
67unsigned long debug_spf_events;
68unsigned long debug_rte_events;
69unsigned long debug_events;
70unsigned long debug_pkt_dump;
71unsigned long debug_lsp_gen;
72unsigned long debug_lsp_sched;
73unsigned long debug_flooding;
74unsigned long debug_bfd;
75unsigned long debug_tx_queue;
76unsigned long debug_sr;
77
eb5d44eb 78struct isis *isis = NULL;
eb5d44eb 79
676a4ea3
DL
80DEFINE_QOBJ_TYPE(isis)
81DEFINE_QOBJ_TYPE(isis_area)
82
41b36e90
PJ
83/*
84 * Prototypes.
85 */
41b36e90 86int isis_area_get(struct vty *, const char *);
3f045a08
JB
87int area_net_title(struct vty *, const char *);
88int area_clear_net_title(struct vty *, const char *);
89int show_isis_interface_common(struct vty *, const char *ifname, char);
90int show_isis_neighbor_common(struct vty *, const char *id, char);
91int clear_isis_neighbor_common(struct vty *, const char *id);
41b36e90
PJ
92
93
260fcb95 94void isis_new(unsigned long process_id, vrf_id_t vrf_id)
d62a17ae 95{
96 isis = XCALLOC(MTYPE_ISIS, sizeof(struct isis));
97 /*
98 * Default values
99 */
260fcb95 100 isis->vrf_id = vrf_id;
d62a17ae 101 isis->max_area_addrs = 3;
102 isis->process_id = process_id;
103 isis->router_id = 0;
104 isis->area_list = list_new();
105 isis->init_circ_list = list_new();
106 isis->uptime = time(NULL);
d62a17ae 107 dyn_cache_init();
8e6fb83b 108
d62a17ae 109 QOBJ_REG(isis, isis);
110}
111
112struct isis_area *isis_area_create(const char *area_tag)
113{
114 struct isis_area *area;
115
116 area = XCALLOC(MTYPE_ISIS_AREA, sizeof(struct isis_area));
117
118 /*
65f18157 119 * Fabricd runs only as level-2.
26eb18e2 120 * For IS-IS, the default is level-1-2
d62a17ae 121 */
26eb18e2 122 if (fabricd)
65f18157 123 area->is_type = IS_LEVEL_2;
cc50ddb2
EDP
124 else
125 area->is_type = yang_get_default_enum(
126 "/frr-isisd:isis/instance/is-type");
d62a17ae 127
128 /*
129 * intialize the databases
130 */
4bef0ec4
DL
131 if (area->is_type & IS_LEVEL_1)
132 lsp_db_init(&area->lspdb[0]);
133 if (area->is_type & IS_LEVEL_2)
134 lsp_db_init(&area->lspdb[1]);
d62a17ae 135
136 spftree_area_init(area);
137
138 area->circuit_list = list_new();
139 area->area_addrs = list_new();
140 thread_add_timer(master, lsp_tick, area, 1, &area->t_tick);
141 flags_initialize(&area->flags);
142
26f6acaf
RW
143 isis_sr_area_init(area);
144
d62a17ae 145 /*
146 * Default values
147 */
cc50ddb2
EDP
148#ifndef FABRICD
149 enum isis_metric_style default_style;
150
151 area->max_lsp_lifetime[0] = yang_get_default_uint16(
d2c970ff 152 "/frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime");
cc50ddb2 153 area->max_lsp_lifetime[1] = yang_get_default_uint16(
d2c970ff 154 "/frr-isisd:isis/instance/lsp/timers/level-2/maximum-lifetime");
cc50ddb2 155 area->lsp_refresh[0] = yang_get_default_uint16(
d2c970ff 156 "/frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval");
cc50ddb2 157 area->lsp_refresh[1] = yang_get_default_uint16(
d2c970ff 158 "/frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval");
cc50ddb2 159 area->lsp_gen_interval[0] = yang_get_default_uint16(
d2c970ff 160 "/frr-isisd:isis/instance/lsp/timers/level-1/generation-interval");
cc50ddb2 161 area->lsp_gen_interval[1] = yang_get_default_uint16(
d2c970ff 162 "/frr-isisd:isis/instance/lsp/timers/level-2/generation-interval");
cc50ddb2
EDP
163 area->min_spf_interval[0] = yang_get_default_uint16(
164 "/frr-isisd:isis/instance/spf/minimum-interval/level-1");
165 area->min_spf_interval[1] = yang_get_default_uint16(
166 "/frr-isisd:isis/instance/spf/minimum-interval/level-1");
167 area->dynhostname = yang_get_default_bool(
168 "/frr-isisd:isis/instance/dynamic-hostname");
169 default_style =
170 yang_get_default_enum("/frr-isisd:isis/instance/metric-style");
171 area->oldmetric = default_style == ISIS_WIDE_METRIC ? 0 : 1;
172 area->newmetric = default_style == ISIS_NARROW_METRIC ? 0 : 1;
173 area->lsp_frag_threshold = 90; /* not currently configurable */
174 area->lsp_mtu =
175 yang_get_default_uint16("/frr-isisd:isis/instance/lsp/mtu");
176#else
d62a17ae 177 area->max_lsp_lifetime[0] = DEFAULT_LSP_LIFETIME; /* 1200 */
178 area->max_lsp_lifetime[1] = DEFAULT_LSP_LIFETIME; /* 1200 */
179 area->lsp_refresh[0] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
180 area->lsp_refresh[1] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
181 area->lsp_gen_interval[0] = DEFAULT_MIN_LSP_GEN_INTERVAL;
182 area->lsp_gen_interval[1] = DEFAULT_MIN_LSP_GEN_INTERVAL;
183 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
184 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
185 area->dynhostname = 1;
186 area->oldmetric = 0;
187 area->newmetric = 1;
188 area->lsp_frag_threshold = 90;
189 area->lsp_mtu = DEFAULT_LSP_MTU;
cc50ddb2 190#endif /* ifndef FABRICD */
d62a17ae 191
192 area_mt_init(area);
41b36e90 193
d62a17ae 194 area->area_tag = strdup(area_tag);
195 listnode_add(isis->area_list, area);
196 area->isis = isis;
f390d2c7 197
8e6fb83b 198 if (fabricd)
b30e837b 199 area->fabricd = fabricd_new(area);
9196731f
CF
200
201 area->lsp_refresh_arg[0].area = area;
202 area->lsp_refresh_arg[0].level = IS_LEVEL_1;
203 area->lsp_refresh_arg[1].area = area;
204 area->lsp_refresh_arg[1].level = IS_LEVEL_2;
205
206
d62a17ae 207 QOBJ_REG(area, isis_area);
eb5d44eb 208
d62a17ae 209 return area;
210}
3f045a08 211
d62a17ae 212struct isis_area *isis_area_lookup(const char *area_tag)
213{
214 struct isis_area *area;
215 struct listnode *node;
3f045a08 216
d62a17ae 217 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area))
218 if ((area->area_tag == NULL && area_tag == NULL)
219 || (area->area_tag && area_tag
220 && strcmp(area->area_tag, area_tag) == 0))
221 return area;
3f045a08 222
d62a17ae 223 return NULL;
224}
3f045a08 225
d62a17ae 226int isis_area_get(struct vty *vty, const char *area_tag)
227{
228 struct isis_area *area;
5475ecf7 229
d62a17ae 230 area = isis_area_lookup(area_tag);
03f7e182 231
d62a17ae 232 if (area) {
7c0cbd0e 233 VTY_PUSH_CONTEXT(ROUTER_NODE, area);
d62a17ae 234 return CMD_SUCCESS;
235 }
236
237 area = isis_area_create(area_tag);
3f045a08 238
e740f9c1 239 if (IS_DEBUG_EVENTS)
d62a17ae 240 zlog_debug("New IS-IS area instance %s", area->area_tag);
3f045a08 241
7c0cbd0e 242 VTY_PUSH_CONTEXT(ROUTER_NODE, area);
f3ccedaa 243
d62a17ae 244 return CMD_SUCCESS;
245}
3f045a08 246
aaf2fd21 247int isis_area_destroy(const char *area_tag)
eb5d44eb 248{
d62a17ae 249 struct isis_area *area;
250 struct listnode *node, *nnode;
251 struct isis_circuit *circuit;
252 struct area_addr *addr;
eb5d44eb 253
d62a17ae 254 area = isis_area_lookup(area_tag);
255
256 if (area == NULL) {
aaf2fd21
EDP
257 zlog_warn("%s: could not find area with area-tag %s",
258 __func__, area_tag);
d62a17ae 259 return CMD_ERR_NO_MATCH;
260 }
261
262 QOBJ_UNREG(area);
263
b30e837b
CF
264 if (fabricd)
265 fabricd_finish(area->fabricd);
266
2e2a8b91
OD
267 /* Disable MPLS if necessary before flooding LSP */
268 if (IS_MPLS_TE(area->mta))
269 area->mta->status = disable;
270
d62a17ae 271 if (area->circuit_list) {
272 for (ALL_LIST_ELEMENTS(area->circuit_list, node, nnode,
273 circuit)) {
274 circuit->ip_router = 0;
275 circuit->ipv6_router = 0;
276 isis_csm_state_change(ISIS_DISABLE, circuit, area);
277 }
6a154c88 278 list_delete(&area->circuit_list);
d62a17ae 279 }
280
4bef0ec4
DL
281 lsp_db_fini(&area->lspdb[0]);
282 lsp_db_fini(&area->lspdb[1]);
d62a17ae 283
3dace42d 284 /* invalidate and verify to delete all routes from zebra */
688ea1cb 285 isis_area_invalidate_routes(area, area->is_type);
3dace42d
CF
286 isis_area_verify_routes(area);
287
26f6acaf
RW
288 isis_sr_area_term(area);
289
d62a17ae 290 spftree_area_del(area);
291
292 THREAD_TIMER_OFF(area->spf_timer[0]);
293 THREAD_TIMER_OFF(area->spf_timer[1]);
294
295 spf_backoff_free(area->spf_delay_ietf[0]);
296 spf_backoff_free(area->spf_delay_ietf[1]);
297
d62a17ae 298 isis_redist_area_finish(area);
299
300 for (ALL_LIST_ELEMENTS(area->area_addrs, node, nnode, addr)) {
301 list_delete_node(area->area_addrs, node);
302 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
303 }
304 area->area_addrs = NULL;
305
306 THREAD_TIMER_OFF(area->t_tick);
307 THREAD_TIMER_OFF(area->t_lsp_refresh[0]);
308 THREAD_TIMER_OFF(area->t_lsp_refresh[1]);
309
310 thread_cancel_event(master, area);
311
312 listnode_delete(isis->area_list, area);
313
314 free(area->area_tag);
315
316 area_mt_finish(area);
317
318 XFREE(MTYPE_ISIS_AREA, area);
319
320 if (listcount(isis->area_list) == 0) {
321 memset(isis->sysid, 0, ISIS_SYS_ID_LEN);
322 isis->sysid_set = 0;
323 }
324
325 return CMD_SUCCESS;
326}
327
22af6a80 328#ifdef FABRICD
d62a17ae 329static void area_set_mt_enabled(struct isis_area *area, uint16_t mtid,
330 bool enabled)
331{
332 struct isis_area_mt_setting *setting;
333
334 setting = area_get_mt_setting(area, mtid);
335 if (setting->enabled != enabled) {
336 setting->enabled = enabled;
337 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0);
338 }
339}
340
341static void area_set_mt_overload(struct isis_area *area, uint16_t mtid,
342 bool overload)
343{
344 struct isis_area_mt_setting *setting;
345
346 setting = area_get_mt_setting(area, mtid);
347 if (setting->overload != overload) {
348 setting->overload = overload;
349 if (setting->enabled)
350 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2,
351 0);
352 }
353}
22af6a80 354#endif /* ifdef FABRICD */
d62a17ae 355
356int area_net_title(struct vty *vty, const char *net_title)
357{
358 VTY_DECLVAR_CONTEXT(isis_area, area);
359 struct area_addr *addr;
360 struct area_addr *addrp;
361 struct listnode *node;
eb5d44eb 362
d7c0a89a 363 uint8_t buff[255];
d62a17ae 364
365 /* We check that we are not over the maximal number of addresses */
366 if (listcount(area->area_addrs) >= isis->max_area_addrs) {
367 vty_out(vty,
368 "Maximum of area addresses (%d) already reached \n",
369 isis->max_area_addrs);
370 return CMD_ERR_NOTHING_TODO;
371 }
372
373 addr = XMALLOC(MTYPE_ISIS_AREA_ADDR, sizeof(struct area_addr));
374 addr->addr_len = dotformat2buff(buff, net_title);
375 memcpy(addr->area_addr, buff, addr->addr_len);
eb5d44eb 376#ifdef EXTREME_DEBUG
d62a17ae 377 zlog_debug("added area address %s for area %s (address length %d)",
378 net_title, area->area_tag, addr->addr_len);
eb5d44eb 379#endif /* EXTREME_DEBUG */
d62a17ae 380 if (addr->addr_len < 8 || addr->addr_len > 20) {
381 vty_out(vty,
382 "area address must be at least 8..20 octets long (%d)\n",
383 addr->addr_len);
384 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
a5fdb4c5 385 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 386 }
387
388 if (addr->area_addr[addr->addr_len - 1] != 0) {
389 vty_out(vty,
390 "nsel byte (last byte) in area address must be 0\n");
391 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
a5fdb4c5 392 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 393 }
394
395 if (isis->sysid_set == 0) {
396 /*
397 * First area address - get the SystemID for this router
398 */
399 memcpy(isis->sysid, GETSYSID(addr), ISIS_SYS_ID_LEN);
400 isis->sysid_set = 1;
e740f9c1 401 if (IS_DEBUG_EVENTS)
d62a17ae 402 zlog_debug("Router has SystemID %s",
403 sysid_print(isis->sysid));
404 } else {
405 /*
406 * Check that the SystemID portions match
407 */
408 if (memcmp(isis->sysid, GETSYSID(addr), ISIS_SYS_ID_LEN)) {
409 vty_out(vty,
410 "System ID must not change when defining additional area addresses\n");
411 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
a5fdb4c5 412 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 413 }
414
415 /* now we see that we don't already have this address */
416 for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node, addrp)) {
417 if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN)
418 != (addr->addr_len))
419 continue;
420 if (!memcmp(addrp->area_addr, addr->area_addr,
421 addr->addr_len)) {
422 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
423 return CMD_SUCCESS; /* silent fail */
424 }
425 }
426 }
427
428 /*
429 * Forget the systemID part of the address
430 */
431 addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN);
432 listnode_add(area->area_addrs, addr);
433
434 /* only now we can safely generate our LSPs for this area */
435 if (listcount(area->area_addrs) > 0) {
436 if (area->is_type & IS_LEVEL_1)
437 lsp_generate(area, IS_LEVEL_1);
438 if (area->is_type & IS_LEVEL_2)
439 lsp_generate(area, IS_LEVEL_2);
440 }
441
442 return CMD_SUCCESS;
443}
444
445int area_clear_net_title(struct vty *vty, const char *net_title)
446{
447 VTY_DECLVAR_CONTEXT(isis_area, area);
448 struct area_addr addr, *addrp = NULL;
449 struct listnode *node;
d7c0a89a 450 uint8_t buff[255];
d62a17ae 451
452 addr.addr_len = dotformat2buff(buff, net_title);
453 if (addr.addr_len < 8 || addr.addr_len > 20) {
454 vty_out(vty,
455 "Unsupported area address length %d, should be 8...20 \n",
456 addr.addr_len);
a5fdb4c5 457 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 458 }
459
460 memcpy(addr.area_addr, buff, (int)addr.addr_len);
461
462 for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node, addrp))
463 if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len
464 && !memcmp(addrp->area_addr, addr.area_addr, addr.addr_len))
465 break;
466
467 if (!addrp) {
468 vty_out(vty, "No area address %s for area %s \n", net_title,
469 area->area_tag);
470 return CMD_ERR_NO_MATCH;
471 }
472
473 listnode_delete(area->area_addrs, addrp);
474 XFREE(MTYPE_ISIS_AREA_ADDR, addrp);
475
476 /*
477 * Last area address - reset the SystemID for this router
478 */
479 if (listcount(area->area_addrs) == 0) {
480 memset(isis->sysid, 0, ISIS_SYS_ID_LEN);
481 isis->sysid_set = 0;
e740f9c1 482 if (IS_DEBUG_EVENTS)
d62a17ae 483 zlog_debug("Router has no SystemID");
484 }
485
486 return CMD_SUCCESS;
eb5d44eb 487}
488
eb5d44eb 489/*
3f045a08 490 * 'show isis interface' command
eb5d44eb 491 */
492
d62a17ae 493int show_isis_interface_common(struct vty *vty, const char *ifname, char detail)
eb5d44eb 494{
d62a17ae 495 struct listnode *anode, *cnode;
496 struct isis_area *area;
497 struct isis_circuit *circuit;
eb5d44eb 498
d62a17ae 499 if (!isis) {
500 vty_out(vty, "IS-IS Routing Process not enabled\n");
501 return CMD_SUCCESS;
502 }
eb5d44eb 503
d62a17ae 504 for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
505 vty_out(vty, "Area %s:\n", area->area_tag);
f390d2c7 506
d62a17ae 507 if (detail == ISIS_UI_LEVEL_BRIEF)
508 vty_out(vty,
509 " Interface CircId State Type Level\n");
f390d2c7 510
d62a17ae 511 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit))
512 if (!ifname)
513 isis_circuit_print_vty(circuit, vty, detail);
514 else if (strcmp(circuit->interface->name, ifname) == 0)
515 isis_circuit_print_vty(circuit, vty, detail);
516 }
f390d2c7 517
d62a17ae 518 return CMD_SUCCESS;
eb5d44eb 519}
520
3f045a08
JB
521DEFUN (show_isis_interface,
522 show_isis_interface_cmd,
7c0cbd0e 523 "show " PROTO_NAME " interface",
eb5d44eb 524 SHOW_STR
7c0cbd0e 525 PROTO_HELP
3f045a08 526 "ISIS interface\n")
eb5d44eb 527{
d62a17ae 528 return show_isis_interface_common(vty, NULL, ISIS_UI_LEVEL_BRIEF);
eb5d44eb 529}
530
3f045a08
JB
531DEFUN (show_isis_interface_detail,
532 show_isis_interface_detail_cmd,
7c0cbd0e 533 "show " PROTO_NAME " interface detail",
eb5d44eb 534 SHOW_STR
7c0cbd0e 535 PROTO_HELP
3f045a08
JB
536 "ISIS interface\n"
537 "show detailed information\n")
538{
d62a17ae 539 return show_isis_interface_common(vty, NULL, ISIS_UI_LEVEL_DETAIL);
3f045a08 540}
eb5d44eb 541
3f045a08
JB
542DEFUN (show_isis_interface_arg,
543 show_isis_interface_arg_cmd,
7c0cbd0e 544 "show " PROTO_NAME " interface WORD",
eb5d44eb 545 SHOW_STR
7c0cbd0e 546 PROTO_HELP
3f045a08
JB
547 "ISIS interface\n"
548 "ISIS interface name\n")
549{
d62a17ae 550 int idx_word = 3;
551 return show_isis_interface_common(vty, argv[idx_word]->arg,
552 ISIS_UI_LEVEL_DETAIL);
3f045a08
JB
553}
554
555/*
556 * 'show isis neighbor' command
557 */
558
d62a17ae 559int show_isis_neighbor_common(struct vty *vty, const char *id, char detail)
560{
561 struct listnode *anode, *cnode, *node;
562 struct isis_area *area;
563 struct isis_circuit *circuit;
564 struct list *adjdb;
565 struct isis_adjacency *adj;
566 struct isis_dynhn *dynhn;
d7c0a89a 567 uint8_t sysid[ISIS_SYS_ID_LEN];
d62a17ae 568 int i;
569
570 if (!isis) {
571 vty_out(vty, "IS-IS Routing Process not enabled\n");
572 return CMD_SUCCESS;
573 }
574
575 memset(sysid, 0, ISIS_SYS_ID_LEN);
576 if (id) {
577 if (sysid2buff(sysid, id) == 0) {
578 dynhn = dynhn_find_by_name(id);
579 if (dynhn == NULL) {
580 vty_out(vty, "Invalid system id %s\n", id);
581 return CMD_SUCCESS;
582 }
583 memcpy(sysid, dynhn->id, ISIS_SYS_ID_LEN);
584 }
585 }
586
587 for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
588 vty_out(vty, "Area %s:\n", area->area_tag);
589
590 if (detail == ISIS_UI_LEVEL_BRIEF)
591 vty_out(vty,
592 " System Id Interface L State Holdtime SNPA\n");
593
594 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) {
595 if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
596 for (i = 0; i < 2; i++) {
597 adjdb = circuit->u.bc.adjdb[i];
598 if (adjdb && adjdb->count) {
599 for (ALL_LIST_ELEMENTS_RO(
600 adjdb, node, adj))
601 if (!id
602 || !memcmp(adj->sysid,
603 sysid,
604 ISIS_SYS_ID_LEN))
605 isis_adj_print_vty(
606 adj,
607 vty,
608 detail);
609 }
610 }
611 } else if (circuit->circ_type == CIRCUIT_T_P2P
612 && circuit->u.p2p.neighbor) {
613 adj = circuit->u.p2p.neighbor;
614 if (!id
615 || !memcmp(adj->sysid, sysid,
616 ISIS_SYS_ID_LEN))
617 isis_adj_print_vty(adj, vty, detail);
618 }
619 }
620 }
621
622 return CMD_SUCCESS;
3f045a08
JB
623}
624
625/*
626 * 'clear isis neighbor' command
627 */
d62a17ae 628int clear_isis_neighbor_common(struct vty *vty, const char *id)
629{
630 struct listnode *anode, *cnode, *cnextnode, *node, *nnode;
631 struct isis_area *area;
632 struct isis_circuit *circuit;
633 struct list *adjdb;
634 struct isis_adjacency *adj;
635 struct isis_dynhn *dynhn;
d7c0a89a 636 uint8_t sysid[ISIS_SYS_ID_LEN];
d62a17ae 637 int i;
638
639 if (!isis) {
640 vty_out(vty, "IS-IS Routing Process not enabled\n");
641 return CMD_SUCCESS;
642 }
643
644 memset(sysid, 0, ISIS_SYS_ID_LEN);
645 if (id) {
646 if (sysid2buff(sysid, id) == 0) {
647 dynhn = dynhn_find_by_name(id);
648 if (dynhn == NULL) {
649 vty_out(vty, "Invalid system id %s\n", id);
650 return CMD_SUCCESS;
651 }
652 memcpy(sysid, dynhn->id, ISIS_SYS_ID_LEN);
653 }
654 }
655
656 for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
657 for (ALL_LIST_ELEMENTS(area->circuit_list, cnode, cnextnode,
658 circuit)) {
659 if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
660 for (i = 0; i < 2; i++) {
661 adjdb = circuit->u.bc.adjdb[i];
662 if (adjdb && adjdb->count) {
663 for (ALL_LIST_ELEMENTS(
664 adjdb, node, nnode,
665 adj))
666 if (!id
667 || !memcmp(adj->sysid,
668 sysid,
669 ISIS_SYS_ID_LEN))
670 isis_adj_state_change(
16167b31 671 &adj,
d62a17ae 672 ISIS_ADJ_DOWN,
673 "clear user request");
674 }
675 }
676 } else if (circuit->circ_type == CIRCUIT_T_P2P
677 && circuit->u.p2p.neighbor) {
678 adj = circuit->u.p2p.neighbor;
679 if (!id
680 || !memcmp(adj->sysid, sysid,
681 ISIS_SYS_ID_LEN))
682 isis_adj_state_change(
16167b31 683 &adj, ISIS_ADJ_DOWN,
d62a17ae 684 "clear user request");
685 }
686 }
687 }
688
689 return CMD_SUCCESS;
3f045a08
JB
690}
691
692DEFUN (show_isis_neighbor,
693 show_isis_neighbor_cmd,
7c0cbd0e 694 "show " PROTO_NAME " neighbor",
3f045a08 695 SHOW_STR
7c0cbd0e 696 PROTO_HELP
3f045a08 697 "ISIS neighbor adjacencies\n")
eb5d44eb 698{
d62a17ae 699 return show_isis_neighbor_common(vty, NULL, ISIS_UI_LEVEL_BRIEF);
eb5d44eb 700}
701
3f045a08
JB
702DEFUN (show_isis_neighbor_detail,
703 show_isis_neighbor_detail_cmd,
7c0cbd0e 704 "show " PROTO_NAME " neighbor detail",
eb5d44eb 705 SHOW_STR
7c0cbd0e 706 PROTO_HELP
3f045a08 707 "ISIS neighbor adjacencies\n"
eb5d44eb 708 "show detailed information\n")
3f045a08 709{
d62a17ae 710 return show_isis_neighbor_common(vty, NULL, ISIS_UI_LEVEL_DETAIL);
3f045a08
JB
711}
712
713DEFUN (show_isis_neighbor_arg,
714 show_isis_neighbor_arg_cmd,
7c0cbd0e 715 "show " PROTO_NAME " neighbor WORD",
3f045a08 716 SHOW_STR
7c0cbd0e 717 PROTO_HELP
3f045a08
JB
718 "ISIS neighbor adjacencies\n"
719 "System id\n")
720{
d62a17ae 721 int idx_word = 3;
722 return show_isis_neighbor_common(vty, argv[idx_word]->arg,
723 ISIS_UI_LEVEL_DETAIL);
3f045a08
JB
724}
725
726DEFUN (clear_isis_neighbor,
727 clear_isis_neighbor_cmd,
7c0cbd0e 728 "clear " PROTO_NAME " neighbor",
3f045a08 729 CLEAR_STR
7c0cbd0e
CF
730 PROTO_HELP
731 "ISIS neighbor adjacencies\n")
3f045a08 732{
d62a17ae 733 return clear_isis_neighbor_common(vty, NULL);
3f045a08
JB
734}
735
736DEFUN (clear_isis_neighbor_arg,
737 clear_isis_neighbor_arg_cmd,
7c0cbd0e 738 "clear " PROTO_NAME " neighbor WORD",
3f045a08 739 CLEAR_STR
7c0cbd0e 740 PROTO_HELP
3f045a08
JB
741 "ISIS neighbor adjacencies\n"
742 "System id\n")
743{
d62a17ae 744 int idx_word = 3;
745 return clear_isis_neighbor_common(vty, argv[idx_word]->arg);
3f045a08
JB
746}
747
eb5d44eb 748/*
749 * 'isis debug', 'show debugging'
750 */
d62a17ae 751void print_debug(struct vty *vty, int flags, int onoff)
752{
5627d3fe 753 const char *onoffs = onoff ? "on" : "off";
d62a17ae 754
755 if (flags & DEBUG_ADJ_PACKETS)
756 vty_out(vty,
757 "IS-IS Adjacency related packets debugging is %s\n",
758 onoffs);
161fa356
CF
759 if (flags & DEBUG_TX_QUEUE)
760 vty_out(vty, "IS-IS TX queue debugging is %s\n",
761 onoffs);
d62a17ae 762 if (flags & DEBUG_SNP_PACKETS)
763 vty_out(vty, "IS-IS CSNP/PSNP packets debugging is %s\n",
764 onoffs);
765 if (flags & DEBUG_SPF_EVENTS)
766 vty_out(vty, "IS-IS SPF events debugging is %s\n", onoffs);
26f6acaf
RW
767 if (flags & DEBUG_SR)
768 vty_out(vty, "IS-IS Segment Routing events debugging is %s\n",
769 onoffs);
d62a17ae 770 if (flags & DEBUG_UPDATE_PACKETS)
771 vty_out(vty, "IS-IS Update related packet debugging is %s\n",
772 onoffs);
773 if (flags & DEBUG_RTE_EVENTS)
774 vty_out(vty, "IS-IS Route related debuggin is %s\n", onoffs);
775 if (flags & DEBUG_EVENTS)
776 vty_out(vty, "IS-IS Event debugging is %s\n", onoffs);
777 if (flags & DEBUG_PACKET_DUMP)
778 vty_out(vty, "IS-IS Packet dump debugging is %s\n", onoffs);
779 if (flags & DEBUG_LSP_GEN)
780 vty_out(vty, "IS-IS LSP generation debugging is %s\n", onoffs);
781 if (flags & DEBUG_LSP_SCHED)
782 vty_out(vty, "IS-IS LSP scheduling debugging is %s\n", onoffs);
ddb33326
CF
783 if (flags & DEBUG_FLOODING)
784 vty_out(vty, "IS-IS Flooding debugging is %s\n", onoffs);
2815f817
CF
785 if (flags & DEBUG_BFD)
786 vty_out(vty, "IS-IS BFD debugging is %s\n", onoffs);
eb5d44eb 787}
788
87f6dc50
DS
789DEFUN_NOSH (show_debugging,
790 show_debugging_isis_cmd,
7c0cbd0e 791 "show debugging [" PROTO_NAME "]",
87f6dc50
DS
792 SHOW_STR
793 "State of each debugging option\n"
7c0cbd0e 794 PROTO_HELP)
eb5d44eb 795{
7c0cbd0e 796 vty_out(vty, PROTO_NAME " debugging status:\n");
87f6dc50 797
e740f9c1 798 if (IS_DEBUG_ADJ_PACKETS)
799 print_debug(vty, DEBUG_ADJ_PACKETS, 1);
800 if (IS_DEBUG_TX_QUEUE)
801 print_debug(vty, DEBUG_TX_QUEUE, 1);
802 if (IS_DEBUG_SNP_PACKETS)
803 print_debug(vty, DEBUG_SNP_PACKETS, 1);
804 if (IS_DEBUG_SPF_EVENTS)
805 print_debug(vty, DEBUG_SPF_EVENTS, 1);
806 if (IS_DEBUG_SR)
807 print_debug(vty, DEBUG_SR, 1);
808 if (IS_DEBUG_UPDATE_PACKETS)
809 print_debug(vty, DEBUG_UPDATE_PACKETS, 1);
810 if (IS_DEBUG_RTE_EVENTS)
811 print_debug(vty, DEBUG_RTE_EVENTS, 1);
812 if (IS_DEBUG_EVENTS)
813 print_debug(vty, DEBUG_EVENTS, 1);
814 if (IS_DEBUG_PACKET_DUMP)
815 print_debug(vty, DEBUG_PACKET_DUMP, 1);
816 if (IS_DEBUG_LSP_GEN)
817 print_debug(vty, DEBUG_LSP_GEN, 1);
818 if (IS_DEBUG_LSP_SCHED)
819 print_debug(vty, DEBUG_LSP_SCHED, 1);
820 if (IS_DEBUG_FLOODING)
821 print_debug(vty, DEBUG_FLOODING, 1);
822 if (IS_DEBUG_BFD)
823 print_debug(vty, DEBUG_BFD, 1);
d62a17ae 824 return CMD_SUCCESS;
eb5d44eb 825}
826
612c2c15 827static int config_write_debug(struct vty *vty);
9e867fe6 828/* Debug node. */
62b346ee 829static struct cmd_node debug_node = {
f4b8291f 830 .name = "debug",
62b346ee
DL
831 .node = DEBUG_NODE,
832 .prompt = "",
612c2c15 833 .config_write = config_write_debug,
62b346ee 834};
d62a17ae 835
836static int config_write_debug(struct vty *vty)
837{
838 int write = 0;
d62a17ae 839
e740f9c1 840 if (IS_DEBUG_ADJ_PACKETS) {
7c0cbd0e 841 vty_out(vty, "debug " PROTO_NAME " adj-packets\n");
d62a17ae 842 write++;
843 }
e740f9c1 844 if (IS_DEBUG_TX_QUEUE) {
161fa356
CF
845 vty_out(vty, "debug " PROTO_NAME " tx-queue\n");
846 write++;
847 }
e740f9c1 848 if (IS_DEBUG_SNP_PACKETS) {
7c0cbd0e 849 vty_out(vty, "debug " PROTO_NAME " snp-packets\n");
d62a17ae 850 write++;
851 }
e740f9c1 852 if (IS_DEBUG_SPF_EVENTS) {
7c0cbd0e 853 vty_out(vty, "debug " PROTO_NAME " spf-events\n");
d62a17ae 854 write++;
855 }
e740f9c1 856 if (IS_DEBUG_SR) {
26f6acaf
RW
857 vty_out(vty, "debug " PROTO_NAME " sr-events\n");
858 write++;
859 }
e740f9c1 860 if (IS_DEBUG_UPDATE_PACKETS) {
7c0cbd0e 861 vty_out(vty, "debug " PROTO_NAME " update-packets\n");
d62a17ae 862 write++;
863 }
e740f9c1 864 if (IS_DEBUG_RTE_EVENTS) {
7c0cbd0e 865 vty_out(vty, "debug " PROTO_NAME " route-events\n");
d62a17ae 866 write++;
867 }
e740f9c1 868 if (IS_DEBUG_EVENTS) {
7c0cbd0e 869 vty_out(vty, "debug " PROTO_NAME " events\n");
d62a17ae 870 write++;
871 }
e740f9c1 872 if (IS_DEBUG_PACKET_DUMP) {
7c0cbd0e 873 vty_out(vty, "debug " PROTO_NAME " packet-dump\n");
d62a17ae 874 write++;
875 }
e740f9c1 876 if (IS_DEBUG_LSP_GEN) {
7c0cbd0e 877 vty_out(vty, "debug " PROTO_NAME " lsp-gen\n");
d62a17ae 878 write++;
879 }
e740f9c1 880 if (IS_DEBUG_LSP_SCHED) {
7c0cbd0e 881 vty_out(vty, "debug " PROTO_NAME " lsp-sched\n");
d62a17ae 882 write++;
883 }
e740f9c1 884 if (IS_DEBUG_FLOODING) {
d4cff91a
CF
885 vty_out(vty, "debug " PROTO_NAME " flooding\n");
886 write++;
887 }
e740f9c1 888 if (IS_DEBUG_BFD) {
2815f817
CF
889 vty_out(vty, "debug " PROTO_NAME " bfd\n");
890 write++;
891 }
d62a17ae 892 write += spf_backoff_write_config(vty);
893
894 return write;
9e867fe6 895}
896
eb5d44eb 897DEFUN (debug_isis_adj,
898 debug_isis_adj_cmd,
7c0cbd0e 899 "debug " PROTO_NAME " adj-packets",
eb5d44eb 900 DEBUG_STR
7c0cbd0e 901 PROTO_HELP
f390d2c7 902 "IS-IS Adjacency related packets\n")
eb5d44eb 903{
e740f9c1 904 debug_adj_pkt |= DEBUG_ADJ_PACKETS;
d62a17ae 905 print_debug(vty, DEBUG_ADJ_PACKETS, 1);
eb5d44eb 906
d62a17ae 907 return CMD_SUCCESS;
eb5d44eb 908}
909
910DEFUN (no_debug_isis_adj,
911 no_debug_isis_adj_cmd,
7c0cbd0e 912 "no debug " PROTO_NAME " adj-packets",
16cedbb0 913 NO_STR
eb5d44eb 914 UNDEBUG_STR
7c0cbd0e 915 PROTO_HELP
f390d2c7 916 "IS-IS Adjacency related packets\n")
eb5d44eb 917{
e740f9c1 918 debug_adj_pkt &= ~DEBUG_ADJ_PACKETS;
d62a17ae 919 print_debug(vty, DEBUG_ADJ_PACKETS, 0);
eb5d44eb 920
d62a17ae 921 return CMD_SUCCESS;
eb5d44eb 922}
923
161fa356
CF
924DEFUN (debug_isis_tx_queue,
925 debug_isis_tx_queue_cmd,
926 "debug " PROTO_NAME " tx-queue",
927 DEBUG_STR
928 PROTO_HELP
929 "IS-IS TX queues\n")
930{
e740f9c1 931 debug_tx_queue |= DEBUG_TX_QUEUE;
161fa356
CF
932 print_debug(vty, DEBUG_TX_QUEUE, 1);
933
934 return CMD_SUCCESS;
935}
936
937DEFUN (no_debug_isis_tx_queue,
938 no_debug_isis_tx_queue_cmd,
939 "no debug " PROTO_NAME " tx-queue",
940 NO_STR
941 UNDEBUG_STR
942 PROTO_HELP
943 "IS-IS TX queues\n")
944{
e740f9c1 945 debug_tx_queue &= ~DEBUG_TX_QUEUE;
161fa356
CF
946 print_debug(vty, DEBUG_TX_QUEUE, 0);
947
948 return CMD_SUCCESS;
949}
950
ddb33326
CF
951DEFUN (debug_isis_flooding,
952 debug_isis_flooding_cmd,
953 "debug " PROTO_NAME " flooding",
954 DEBUG_STR
955 PROTO_HELP
956 "Flooding algorithm\n")
957{
e740f9c1 958 debug_flooding |= DEBUG_FLOODING;
ddb33326
CF
959 print_debug(vty, DEBUG_FLOODING, 1);
960
961 return CMD_SUCCESS;
962}
963
964DEFUN (no_debug_isis_flooding,
965 no_debug_isis_flooding_cmd,
966 "no debug " PROTO_NAME " flooding",
967 NO_STR
968 UNDEBUG_STR
969 PROTO_HELP
970 "Flooding algorithm\n")
971{
e740f9c1 972 debug_flooding &= ~DEBUG_FLOODING;
ddb33326
CF
973 print_debug(vty, DEBUG_FLOODING, 0);
974
975 return CMD_SUCCESS;
976}
977
eb5d44eb 978DEFUN (debug_isis_snp,
979 debug_isis_snp_cmd,
7c0cbd0e 980 "debug " PROTO_NAME " snp-packets",
eb5d44eb 981 DEBUG_STR
7c0cbd0e 982 PROTO_HELP
f390d2c7 983 "IS-IS CSNP/PSNP packets\n")
eb5d44eb 984{
e740f9c1 985 debug_snp_pkt |= DEBUG_SNP_PACKETS;
d62a17ae 986 print_debug(vty, DEBUG_SNP_PACKETS, 1);
eb5d44eb 987
d62a17ae 988 return CMD_SUCCESS;
eb5d44eb 989}
990
991DEFUN (no_debug_isis_snp,
992 no_debug_isis_snp_cmd,
7c0cbd0e 993 "no debug " PROTO_NAME " snp-packets",
16cedbb0 994 NO_STR
eb5d44eb 995 UNDEBUG_STR
7c0cbd0e 996 PROTO_HELP
f390d2c7 997 "IS-IS CSNP/PSNP packets\n")
eb5d44eb 998{
e740f9c1 999 debug_snp_pkt &= ~DEBUG_SNP_PACKETS;
d62a17ae 1000 print_debug(vty, DEBUG_SNP_PACKETS, 0);
f390d2c7 1001
d62a17ae 1002 return CMD_SUCCESS;
eb5d44eb 1003}
1004
eb5d44eb 1005DEFUN (debug_isis_upd,
1006 debug_isis_upd_cmd,
7c0cbd0e 1007 "debug " PROTO_NAME " update-packets",
eb5d44eb 1008 DEBUG_STR
7c0cbd0e 1009 PROTO_HELP
f390d2c7 1010 "IS-IS Update related packets\n")
eb5d44eb 1011{
e740f9c1 1012 debug_update_pkt |= DEBUG_UPDATE_PACKETS;
d62a17ae 1013 print_debug(vty, DEBUG_UPDATE_PACKETS, 1);
eb5d44eb 1014
d62a17ae 1015 return CMD_SUCCESS;
eb5d44eb 1016}
1017
1018DEFUN (no_debug_isis_upd,
1019 no_debug_isis_upd_cmd,
7c0cbd0e 1020 "no debug " PROTO_NAME " update-packets",
16cedbb0 1021 NO_STR
eb5d44eb 1022 UNDEBUG_STR
7c0cbd0e 1023 PROTO_HELP
f390d2c7 1024 "IS-IS Update related packets\n")
eb5d44eb 1025{
e740f9c1 1026 debug_update_pkt &= ~DEBUG_UPDATE_PACKETS;
d62a17ae 1027 print_debug(vty, DEBUG_UPDATE_PACKETS, 0);
f390d2c7 1028
d62a17ae 1029 return CMD_SUCCESS;
eb5d44eb 1030}
1031
eb5d44eb 1032DEFUN (debug_isis_spfevents,
1033 debug_isis_spfevents_cmd,
7c0cbd0e 1034 "debug " PROTO_NAME " spf-events",
eb5d44eb 1035 DEBUG_STR
7c0cbd0e 1036 PROTO_HELP
f390d2c7 1037 "IS-IS Shortest Path First Events\n")
eb5d44eb 1038{
e740f9c1 1039 debug_spf_events |= DEBUG_SPF_EVENTS;
d62a17ae 1040 print_debug(vty, DEBUG_SPF_EVENTS, 1);
eb5d44eb 1041
d62a17ae 1042 return CMD_SUCCESS;
eb5d44eb 1043}
1044
1045DEFUN (no_debug_isis_spfevents,
1046 no_debug_isis_spfevents_cmd,
7c0cbd0e 1047 "no debug " PROTO_NAME " spf-events",
16cedbb0 1048 NO_STR
eb5d44eb 1049 UNDEBUG_STR
7c0cbd0e 1050 PROTO_HELP
f390d2c7 1051 "IS-IS Shortest Path First Events\n")
eb5d44eb 1052{
e740f9c1 1053 debug_spf_events &= ~DEBUG_SPF_EVENTS;
d62a17ae 1054 print_debug(vty, DEBUG_SPF_EVENTS, 0);
f390d2c7 1055
d62a17ae 1056 return CMD_SUCCESS;
eb5d44eb 1057}
1058
26f6acaf
RW
1059DEFUN (debug_isis_srevents,
1060 debug_isis_srevents_cmd,
1061 "debug " PROTO_NAME " sr-events",
1062 DEBUG_STR
1063 PROTO_HELP
1064 "IS-IS Segment Routing Events\n")
1065{
e740f9c1 1066 debug_sr |= DEBUG_SR;
26f6acaf
RW
1067 print_debug(vty, DEBUG_SR, 1);
1068
1069 return CMD_SUCCESS;
1070}
1071
1072DEFUN (no_debug_isis_srevents,
1073 no_debug_isis_srevents_cmd,
1074 "no debug " PROTO_NAME " sr-events",
1075 NO_STR
1076 UNDEBUG_STR
1077 PROTO_HELP
1078 "IS-IS Segment Routing Events\n")
1079{
e740f9c1 1080 debug_sr &= ~DEBUG_SR;
26f6acaf
RW
1081 print_debug(vty, DEBUG_SR, 0);
1082
1083 return CMD_SUCCESS;
1084}
1085
eb5d44eb 1086DEFUN (debug_isis_rtevents,
1087 debug_isis_rtevents_cmd,
7c0cbd0e 1088 "debug " PROTO_NAME " route-events",
eb5d44eb 1089 DEBUG_STR
7c0cbd0e 1090 PROTO_HELP
f390d2c7 1091 "IS-IS Route related events\n")
eb5d44eb 1092{
e740f9c1 1093 debug_rte_events |= DEBUG_RTE_EVENTS;
d62a17ae 1094 print_debug(vty, DEBUG_RTE_EVENTS, 1);
eb5d44eb 1095
d62a17ae 1096 return CMD_SUCCESS;
eb5d44eb 1097}
1098
1099DEFUN (no_debug_isis_rtevents,
1100 no_debug_isis_rtevents_cmd,
7c0cbd0e 1101 "no debug " PROTO_NAME " route-events",
16cedbb0 1102 NO_STR
eb5d44eb 1103 UNDEBUG_STR
7c0cbd0e 1104 PROTO_HELP
f390d2c7 1105 "IS-IS Route related events\n")
eb5d44eb 1106{
e740f9c1 1107 debug_rte_events &= ~DEBUG_RTE_EVENTS;
d62a17ae 1108 print_debug(vty, DEBUG_RTE_EVENTS, 0);
f390d2c7 1109
d62a17ae 1110 return CMD_SUCCESS;
eb5d44eb 1111}
1112
1113DEFUN (debug_isis_events,
1114 debug_isis_events_cmd,
7c0cbd0e 1115 "debug " PROTO_NAME " events",
eb5d44eb 1116 DEBUG_STR
7c0cbd0e 1117 PROTO_HELP
f1082d19 1118 "IS-IS Events\n")
eb5d44eb 1119{
e740f9c1 1120 debug_events |= DEBUG_EVENTS;
d62a17ae 1121 print_debug(vty, DEBUG_EVENTS, 1);
eb5d44eb 1122
d62a17ae 1123 return CMD_SUCCESS;
eb5d44eb 1124}
1125
1126DEFUN (no_debug_isis_events,
1127 no_debug_isis_events_cmd,
7c0cbd0e 1128 "no debug " PROTO_NAME " events",
16cedbb0 1129 NO_STR
eb5d44eb 1130 UNDEBUG_STR
7c0cbd0e 1131 PROTO_HELP
f390d2c7 1132 "IS-IS Events\n")
eb5d44eb 1133{
e740f9c1 1134 debug_events &= ~DEBUG_EVENTS;
d62a17ae 1135 print_debug(vty, DEBUG_EVENTS, 0);
f390d2c7 1136
d62a17ae 1137 return CMD_SUCCESS;
eb5d44eb 1138}
1139
3f045a08
JB
1140DEFUN (debug_isis_packet_dump,
1141 debug_isis_packet_dump_cmd,
7c0cbd0e 1142 "debug " PROTO_NAME " packet-dump",
3f045a08 1143 DEBUG_STR
7c0cbd0e 1144 PROTO_HELP
3f045a08
JB
1145 "IS-IS packet dump\n")
1146{
e740f9c1 1147 debug_pkt_dump |= DEBUG_PACKET_DUMP;
d62a17ae 1148 print_debug(vty, DEBUG_PACKET_DUMP, 1);
3f045a08 1149
d62a17ae 1150 return CMD_SUCCESS;
3f045a08
JB
1151}
1152
1153DEFUN (no_debug_isis_packet_dump,
1154 no_debug_isis_packet_dump_cmd,
7c0cbd0e 1155 "no debug " PROTO_NAME " packet-dump",
16cedbb0 1156 NO_STR
3f045a08 1157 UNDEBUG_STR
7c0cbd0e 1158 PROTO_HELP
3f045a08
JB
1159 "IS-IS packet dump\n")
1160{
e740f9c1 1161 debug_pkt_dump &= ~DEBUG_PACKET_DUMP;
d62a17ae 1162 print_debug(vty, DEBUG_PACKET_DUMP, 0);
3f045a08 1163
d62a17ae 1164 return CMD_SUCCESS;
3f045a08
JB
1165}
1166
14872644
CF
1167DEFUN (debug_isis_lsp_gen,
1168 debug_isis_lsp_gen_cmd,
7c0cbd0e 1169 "debug " PROTO_NAME " lsp-gen",
14872644 1170 DEBUG_STR
7c0cbd0e 1171 PROTO_HELP
14872644
CF
1172 "IS-IS generation of own LSPs\n")
1173{
e740f9c1 1174 debug_lsp_gen |= DEBUG_LSP_GEN;
d62a17ae 1175 print_debug(vty, DEBUG_LSP_GEN, 1);
14872644 1176
d62a17ae 1177 return CMD_SUCCESS;
14872644
CF
1178}
1179
1180DEFUN (no_debug_isis_lsp_gen,
1181 no_debug_isis_lsp_gen_cmd,
7c0cbd0e 1182 "no debug " PROTO_NAME " lsp-gen",
16cedbb0 1183 NO_STR
14872644 1184 UNDEBUG_STR
7c0cbd0e 1185 PROTO_HELP
14872644
CF
1186 "IS-IS generation of own LSPs\n")
1187{
e740f9c1 1188 debug_lsp_gen &= ~DEBUG_LSP_GEN;
d62a17ae 1189 print_debug(vty, DEBUG_LSP_GEN, 0);
14872644 1190
d62a17ae 1191 return CMD_SUCCESS;
14872644
CF
1192}
1193
414766a1
CF
1194DEFUN (debug_isis_lsp_sched,
1195 debug_isis_lsp_sched_cmd,
7c0cbd0e 1196 "debug " PROTO_NAME " lsp-sched",
414766a1 1197 DEBUG_STR
7c0cbd0e 1198 PROTO_HELP
414766a1
CF
1199 "IS-IS scheduling of LSP generation\n")
1200{
e740f9c1 1201 debug_lsp_sched |= DEBUG_LSP_SCHED;
d62a17ae 1202 print_debug(vty, DEBUG_LSP_SCHED, 1);
414766a1 1203
d62a17ae 1204 return CMD_SUCCESS;
414766a1
CF
1205}
1206
49d41a26
DS
1207DEFUN (no_debug_isis_lsp_sched,
1208 no_debug_isis_lsp_sched_cmd,
7c0cbd0e 1209 "no debug " PROTO_NAME " lsp-sched",
16cedbb0 1210 NO_STR
49d41a26 1211 UNDEBUG_STR
7c0cbd0e 1212 PROTO_HELP
49d41a26
DS
1213 "IS-IS scheduling of LSP generation\n")
1214{
e740f9c1 1215 debug_lsp_sched &= ~DEBUG_LSP_SCHED;
d62a17ae 1216 print_debug(vty, DEBUG_LSP_SCHED, 0);
49d41a26 1217
d62a17ae 1218 return CMD_SUCCESS;
49d41a26
DS
1219}
1220
2815f817
CF
1221DEFUN (debug_isis_bfd,
1222 debug_isis_bfd_cmd,
1223 "debug " PROTO_NAME " bfd",
1224 DEBUG_STR
1225 PROTO_HELP
1226 PROTO_NAME " interaction with BFD\n")
1227{
e740f9c1 1228 debug_bfd |= DEBUG_BFD;
2815f817
CF
1229 print_debug(vty, DEBUG_BFD, 1);
1230
1231 return CMD_SUCCESS;
1232}
1233
1234DEFUN (no_debug_isis_bfd,
1235 no_debug_isis_bfd_cmd,
1236 "no debug " PROTO_NAME " bfd",
1237 NO_STR
1238 UNDEBUG_STR
1239 PROTO_HELP
1240 PROTO_NAME " interaction with BFD\n")
1241{
e740f9c1 1242 debug_bfd &= ~DEBUG_BFD;
2815f817
CF
1243 print_debug(vty, DEBUG_BFD, 0);
1244
1245 return CMD_SUCCESS;
1246}
1247
eb5d44eb 1248DEFUN (show_hostname,
1249 show_hostname_cmd,
7c0cbd0e 1250 "show " PROTO_NAME " hostname",
eb5d44eb 1251 SHOW_STR
7c0cbd0e 1252 PROTO_HELP
eb5d44eb 1253 "IS-IS Dynamic hostname mapping\n")
1254{
d62a17ae 1255 dynhn_print_all(vty);
f390d2c7 1256
d62a17ae 1257 return CMD_SUCCESS;
eb5d44eb 1258}
1259
03f7e182
SL
1260DEFUN (show_isis_spf_ietf,
1261 show_isis_spf_ietf_cmd,
7c0cbd0e 1262 "show " PROTO_NAME " spf-delay-ietf",
03f7e182 1263 SHOW_STR
7c0cbd0e
CF
1264 PROTO_HELP
1265 "SPF delay IETF information\n")
03f7e182 1266{
d62a17ae 1267 if (!isis) {
1268 vty_out(vty, "ISIS is not running\n");
1269 return CMD_SUCCESS;
1270 }
1271
1272 struct listnode *node;
1273 struct isis_area *area;
1274
1275 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
1276 vty_out(vty, "Area %s:\n",
1277 area->area_tag ? area->area_tag : "null");
1278
1279 for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) {
1280 if ((area->is_type & level) == 0)
1281 continue;
1282
1283 vty_out(vty, " Level-%d:\n", level);
1284 vty_out(vty, " SPF delay status: ");
1285 if (area->spf_timer[level - 1]) {
1286 struct timeval remain = thread_timer_remain(
1287 area->spf_timer[level - 1]);
a97986ff
DL
1288 vty_out(vty, "Pending, due in %lld msec\n",
1289 (long long)remain.tv_sec * 1000
d62a17ae 1290 + remain.tv_usec / 1000);
1291 } else {
1292 vty_out(vty, "Not scheduled\n");
1293 }
1294
1295 if (area->spf_delay_ietf[level - 1]) {
1296 vty_out(vty,
1297 " Using draft-ietf-rtgwg-backoff-algo-04\n");
1298 spf_backoff_show(
1299 area->spf_delay_ietf[level - 1], vty,
1300 " ");
1301 } else {
1302 vty_out(vty, " Using legacy backoff algo\n");
1303 }
1304 }
1305 }
1306 return CMD_SUCCESS;
03f7e182
SL
1307}
1308
3f045a08
JB
1309DEFUN (show_isis_summary,
1310 show_isis_summary_cmd,
7c0cbd0e
CF
1311 "show " PROTO_NAME " summary",
1312 SHOW_STR PROTO_HELP "summary\n")
3f045a08 1313{
d62a17ae 1314 struct listnode *node, *node2;
1315 struct isis_area *area;
d62a17ae 1316 int level;
1317
1318 if (isis == NULL) {
7c0cbd0e 1319 vty_out(vty, PROTO_NAME " is not running\n");
d62a17ae 1320 return CMD_SUCCESS;
1321 }
1322
1323 vty_out(vty, "Process Id : %ld\n", isis->process_id);
1324 if (isis->sysid_set)
1325 vty_out(vty, "System Id : %s\n",
1326 sysid_print(isis->sysid));
1327
1328 vty_out(vty, "Up time : ");
1329 vty_out_timestr(vty, isis->uptime);
1330 vty_out(vty, "\n");
1331
1332 if (isis->area_list)
1333 vty_out(vty, "Number of areas : %d\n", isis->area_list->count);
1334
1335 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
1336 vty_out(vty, "Area %s:\n",
1337 area->area_tag ? area->area_tag : "null");
1338
92ed0cde
CF
1339 if (fabricd) {
1340 uint8_t tier = fabricd_tier(area);
1341 if (tier == ISIS_TIER_UNDEFINED)
1342 vty_out(vty, " Tier: undefined\n");
1343 else
1344 vty_out(vty, " Tier: %" PRIu8 "\n", tier);
1345 }
1346
d62a17ae 1347 if (listcount(area->area_addrs) > 0) {
1348 struct area_addr *area_addr;
1349 for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node2,
1350 area_addr)) {
1351 vty_out(vty, " Net: %s\n",
1352 isonet_print(area_addr->area_addr,
1353 area_addr->addr_len
1354 + ISIS_SYS_ID_LEN
1355 + 1));
1356 }
1357 }
1358
39bb53d6
CF
1359 vty_out(vty, " TX counters per PDU type:\n");
1360 pdu_counter_print(vty, " ", area->pdu_tx_counters);
86d6f80d
CF
1361 vty_out(vty, " LSP RXMT: %" PRIu64 "\n",
1362 area->lsp_rxmt_count);
39bb53d6
CF
1363 vty_out(vty, " RX counters per PDU type:\n");
1364 pdu_counter_print(vty, " ", area->pdu_rx_counters);
1365
d62a17ae 1366 for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) {
1367 if ((area->is_type & level) == 0)
1368 continue;
1369
1370 vty_out(vty, " Level-%d:\n", level);
062f4d36
CF
1371
1372 vty_out(vty, " LSP0 regenerated: %" PRIu64 "\n",
1373 area->lsp_gen_count[level - 1]);
1374
6f004b60
CF
1375 vty_out(vty, " LSPs purged: %" PRIu64 "\n",
1376 area->lsp_purge_count[level - 1]);
1377
d62a17ae 1378 if (area->spf_timer[level - 1])
1379 vty_out(vty, " SPF: (pending)\n");
1380 else
1381 vty_out(vty, " SPF:\n");
1382
1383 vty_out(vty, " minimum interval : %d",
1384 area->min_spf_interval[level - 1]);
1385 if (area->spf_delay_ietf[level - 1])
1386 vty_out(vty,
1387 " (not used, IETF SPF delay activated)");
1388 vty_out(vty, "\n");
1389
1390 vty_out(vty, " IPv4 route computation:\n");
be985ba0
CF
1391 isis_spf_print(area->spftree[SPFTREE_IPV4][level - 1],
1392 vty);
d62a17ae 1393
d62a17ae 1394 vty_out(vty, " IPv6 route computation:\n");
be985ba0
CF
1395 isis_spf_print(area->spftree[SPFTREE_IPV6][level - 1],
1396 vty);
321c1bbb
CF
1397
1398 vty_out(vty, " IPv6 dst-src route computation:\n");
1399 isis_spf_print(area->spftree[SPFTREE_DSTSRC][level-1],
1400 vty);
d62a17ae 1401 }
1402 }
1403 vty_out(vty, "\n");
1404
1405 return CMD_SUCCESS;
eb5d44eb 1406}
1407
4bef0ec4 1408struct isis_lsp *lsp_for_arg(struct lspdb_head *head, const char *argv)
d62a17ae 1409{
eb2bcb28 1410 char sysid[255] = {0};
d7c0a89a 1411 uint8_t number[3];
eb2bcb28
CF
1412 const char *pos;
1413 uint8_t lspid[ISIS_SYS_ID_LEN + 2] = {0};
1414 struct isis_dynhn *dynhn;
1415 struct isis_lsp *lsp = NULL;
d62a17ae 1416
eb2bcb28
CF
1417 if (!argv)
1418 return NULL;
d62a17ae 1419
1420 /*
1421 * extract fragment and pseudo id from the string argv
1422 * in the forms:
1423 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1424 * (b) <systemid/hostname>.<pseudo-id> or
1425 * (c) <systemid/hostname> or
1426 * Where systemid is in the form:
1427 * xxxx.xxxx.xxxx
1428 */
1429 if (argv)
e28544ed 1430 strlcpy(sysid, argv, sizeof(sysid));
d62a17ae 1431 if (argv && strlen(argv) > 3) {
1432 pos = argv + strlen(argv) - 3;
1433 if (strncmp(pos, "-", 1) == 0) {
1434 memcpy(number, ++pos, 2);
1435 lspid[ISIS_SYS_ID_LEN + 1] =
d7c0a89a 1436 (uint8_t)strtol((char *)number, NULL, 16);
d62a17ae 1437 pos -= 4;
1438 if (strncmp(pos, ".", 1) != 0)
eb2bcb28 1439 return NULL;
d62a17ae 1440 }
1441 if (strncmp(pos, ".", 1) == 0) {
1442 memcpy(number, ++pos, 2);
1443 lspid[ISIS_SYS_ID_LEN] =
d7c0a89a 1444 (uint8_t)strtol((char *)number, NULL, 16);
d62a17ae 1445 sysid[pos - argv - 1] = '\0';
1446 }
1447 }
1448
eb2bcb28
CF
1449 /*
1450 * Try to find the lsp-id if the argv
1451 * string is in
1452 * the form
1453 * hostname.<pseudo-id>-<fragment>
1454 */
1455 if (sysid2buff(lspid, sysid)) {
4bef0ec4 1456 lsp = lsp_search(head, lspid);
eb2bcb28
CF
1457 } else if ((dynhn = dynhn_find_by_name(sysid))) {
1458 memcpy(lspid, dynhn->id, ISIS_SYS_ID_LEN);
4bef0ec4 1459 lsp = lsp_search(head, lspid);
eb2bcb28
CF
1460 } else if (strncmp(cmd_hostname_get(), sysid, 15) == 0) {
1461 memcpy(lspid, isis->sysid, ISIS_SYS_ID_LEN);
4bef0ec4 1462 lsp = lsp_search(head, lspid);
eb2bcb28
CF
1463 }
1464
1465 return lsp;
1466}
1467
1468/*
1469 * This function supports following display options:
1470 * [ show isis database [detail] ]
1471 * [ show isis database <sysid> [detail] ]
1472 * [ show isis database <hostname> [detail] ]
1473 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1474 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1475 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1476 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1477 * [ show isis database detail <sysid> ]
1478 * [ show isis database detail <hostname> ]
1479 * [ show isis database detail <sysid>.<pseudo-id> ]
1480 * [ show isis database detail <hostname>.<pseudo-id> ]
1481 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1482 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1483 */
1484static int show_isis_database(struct vty *vty, const char *argv, int ui_level)
1485{
1486 struct listnode *node;
1487 struct isis_area *area;
1488 struct isis_lsp *lsp;
1489 int level, lsp_count;
1490
1491 if (isis->area_list->count == 0)
1492 return CMD_SUCCESS;
1493
d62a17ae 1494 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
1495 vty_out(vty, "Area %s:\n",
1496 area->area_tag ? area->area_tag : "null");
1497
1498 for (level = 0; level < ISIS_LEVELS; level++) {
4bef0ec4
DL
1499 if (lspdb_count(&area->lspdb[level]) > 0) {
1500 lsp = lsp_for_arg(&area->lspdb[level], argv);
d62a17ae 1501
1502 if (lsp != NULL || argv == NULL) {
1503 vty_out(vty,
1504 "IS-IS Level-%d link-state database:\n",
1505 level + 1);
1506
1507 /* print the title in all cases */
1508 vty_out(vty,
1509 "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n");
1510 }
1511
1512 if (lsp) {
1513 if (ui_level == ISIS_UI_LEVEL_DETAIL)
1514 lsp_print_detail(
1515 lsp, vty,
1516 area->dynhostname);
1517 else
1518 lsp_print(lsp, vty,
1519 area->dynhostname);
1520 } else if (argv == NULL) {
1521 lsp_count = lsp_print_all(
4bef0ec4 1522 vty, &area->lspdb[level],
d62a17ae 1523 ui_level, area->dynhostname);
1524
1525 vty_out(vty, " %u LSPs\n\n",
1526 lsp_count);
1527 }
1528 }
1529 }
1530 }
1531
1532 return CMD_SUCCESS;
eb5d44eb 1533}
1534
3a2d747c 1535DEFUN (show_database,
3f045a08 1536 show_database_cmd,
7c0cbd0e 1537 "show " PROTO_NAME " database [detail] [WORD]",
3f045a08 1538 SHOW_STR
7c0cbd0e
CF
1539 PROTO_HELP
1540 "Link state database\n"
3f045a08
JB
1541 "Detailed information\n"
1542 "LSP ID\n")
1543{
d62a17ae 1544 int idx = 0;
1545 int uilevel = argv_find(argv, argc, "detail", &idx)
1546 ? ISIS_UI_LEVEL_DETAIL
1547 : ISIS_UI_LEVEL_BRIEF;
1548 char *id = argv_find(argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL;
1549 return show_isis_database(vty, id, uilevel);
3f045a08
JB
1550}
1551
aaf2fd21 1552#ifdef FABRICD
d62a17ae 1553/*
aaf2fd21 1554 * 'router openfabric' command
3f045a08 1555 */
aaf2fd21
EDP
1556DEFUN_NOSH (router_openfabric,
1557 router_openfabric_cmd,
1558 "router openfabric WORD",
3f045a08 1559 ROUTER_STR
7c0cbd0e 1560 PROTO_HELP
efd7904e 1561 "ISO Routing area tag\n")
3f045a08 1562{
d62a17ae 1563 int idx_word = 2;
1564 return isis_area_get(vty, argv[idx_word]->arg);
3f045a08
JB
1565}
1566
d62a17ae 1567/*
aaf2fd21 1568 *'no router openfabric' command
3f045a08 1569 */
aaf2fd21
EDP
1570DEFUN (no_router_openfabric,
1571 no_router_openfabric_cmd,
1572 "no router openfabric WORD",
7c0cbd0e
CF
1573 NO_STR
1574 ROUTER_STR
1575 PROTO_HELP
1576 "ISO Routing area tag\n")
eb5d44eb 1577{
d62a17ae 1578 int idx_word = 3;
aaf2fd21 1579 return isis_area_destroy(argv[idx_word]->arg);
eb5d44eb 1580}
aaf2fd21 1581#endif /* ifdef FABRICD */
f084ea55 1582#ifdef FABRICD
eb5d44eb 1583/*
1584 * 'net' command
1585 */
1586DEFUN (net,
1587 net_cmd,
1588 "net WORD",
1589 "A Network Entity Title for this process (OSI only)\n"
f390d2c7 1590 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
eb5d44eb 1591{
d62a17ae 1592 int idx_word = 1;
1593 return area_net_title(vty, argv[idx_word]->arg);
eb5d44eb 1594}
1595
eb5d44eb 1596/*
1597 * 'no net' command
1598 */
1599DEFUN (no_net,
1600 no_net_cmd,
1601 "no net WORD",
1602 NO_STR
1603 "A Network Entity Title for this process (OSI only)\n"
f390d2c7 1604 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
eb5d44eb 1605{
d62a17ae 1606 int idx_word = 2;
1607 return area_clear_net_title(vty, argv[idx_word]->arg);
eb5d44eb 1608}
f084ea55 1609#endif /* ifdef FABRICD */
22af6a80 1610#ifdef FABRICD
064f4896
CF
1611DEFUN (isis_topology,
1612 isis_topology_cmd,
1613 "topology " ISIS_MT_NAMES " [overload]",
1614 "Configure IS-IS topologies\n"
1615 ISIS_MT_DESCRIPTIONS
1616 "Set overload bit for topology\n")
1617{
d62a17ae 1618 VTY_DECLVAR_CONTEXT(isis_area, area);
064f4896 1619
d62a17ae 1620 const char *arg = argv[1]->arg;
1621 uint16_t mtid = isis_str2mtid(arg);
c3ea3906 1622
d62a17ae 1623 if (area->oldmetric) {
1624 vty_out(vty,
1625 "Multi topology IS-IS can only be used with wide metrics\n");
a5fdb4c5 1626 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 1627 }
c3ea3906 1628
d62a17ae 1629 if (mtid == (uint16_t)-1) {
1630 vty_out(vty, "Don't know topology '%s'\n", arg);
a5fdb4c5 1631 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 1632 }
1633 if (mtid == ISIS_MT_IPV4_UNICAST) {
1634 vty_out(vty, "Cannot configure IPv4 unicast topology\n");
a5fdb4c5 1635 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 1636 }
064f4896 1637
d62a17ae 1638 area_set_mt_enabled(area, mtid, true);
1639 area_set_mt_overload(area, mtid, (argc == 3));
1640 return CMD_SUCCESS;
064f4896
CF
1641}
1642
1643DEFUN (no_isis_topology,
1644 no_isis_topology_cmd,
1645 "no topology " ISIS_MT_NAMES " [overload]",
1646 NO_STR
1647 "Configure IS-IS topologies\n"
1648 ISIS_MT_DESCRIPTIONS
1649 "Set overload bit for topology\n")
1650{
d62a17ae 1651 VTY_DECLVAR_CONTEXT(isis_area, area);
064f4896 1652
d62a17ae 1653 const char *arg = argv[2]->arg;
1654 uint16_t mtid = isis_str2mtid(arg);
c3ea3906 1655
d62a17ae 1656 if (area->oldmetric) {
1657 vty_out(vty,
1658 "Multi topology IS-IS can only be used with wide metrics\n");
a5fdb4c5 1659 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 1660 }
c3ea3906 1661
d62a17ae 1662 if (mtid == (uint16_t)-1) {
1663 vty_out(vty, "Don't know topology '%s'\n", arg);
a5fdb4c5 1664 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 1665 }
1666 if (mtid == ISIS_MT_IPV4_UNICAST) {
1667 vty_out(vty, "Cannot configure IPv4 unicast topology\n");
a5fdb4c5 1668 return CMD_WARNING_CONFIG_FAILED;
d62a17ae 1669 }
064f4896 1670
d62a17ae 1671 area_set_mt_enabled(area, mtid, false);
1672 area_set_mt_overload(area, mtid, false);
1673 return CMD_SUCCESS;
064f4896 1674}
22af6a80 1675#endif /* ifdef FABRICD */
064f4896 1676
6754fc66 1677void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu)
b20ccb3a 1678{
d62a17ae 1679 area->lsp_mtu = lsp_mtu;
1680 lsp_regenerate_schedule(area, IS_LEVEL_1_AND_2, 1);
1681}
1682
1683static int isis_area_passwd_set(struct isis_area *area, int level,
d7c0a89a
QY
1684 uint8_t passwd_type, const char *passwd,
1685 uint8_t snp_auth)
d62a17ae 1686{
1687 struct isis_passwd *dest;
1688 struct isis_passwd modified;
1689 int len;
1690
1691 assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2));
1692 dest = (level == IS_LEVEL_1) ? &area->area_passwd
1693 : &area->domain_passwd;
1694 memset(&modified, 0, sizeof(modified));
1695
1696 if (passwd_type != ISIS_PASSWD_TYPE_UNUSED) {
1697 if (!passwd)
1698 return -1;
1699
1700 len = strlen(passwd);
1701 if (len > 254)
1702 return -1;
1703
1704 modified.len = len;
e28544ed
QY
1705 strlcpy((char *)modified.passwd, passwd,
1706 sizeof(modified.passwd));
d62a17ae 1707 modified.type = passwd_type;
1708 modified.snp_auth = snp_auth;
1709 }
1710
1711 if (memcmp(&modified, dest, sizeof(modified))) {
1712 memcpy(dest, &modified, sizeof(modified));
1713 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1714 }
1715
1716 return 0;
1717}
1718
1719int isis_area_passwd_unset(struct isis_area *area, int level)
1720{
1721 return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_UNUSED, NULL,
1722 0);
1723}
1724
1725int isis_area_passwd_cleartext_set(struct isis_area *area, int level,
d7c0a89a 1726 const char *passwd, uint8_t snp_auth)
d62a17ae 1727{
1728 return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_CLEARTXT,
1729 passwd, snp_auth);
1730}
1731
1732int isis_area_passwd_hmac_md5_set(struct isis_area *area, int level,
d7c0a89a 1733 const char *passwd, uint8_t snp_auth)
d62a17ae 1734{
1735 return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_HMAC_MD5,
1736 passwd, snp_auth);
b20ccb3a
CF
1737}
1738
3dace42d
CF
1739void isis_area_invalidate_routes(struct isis_area *area, int levels)
1740{
1741 for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) {
1742 if (!(level & levels))
1743 continue;
be985ba0
CF
1744 for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) {
1745 isis_spf_invalidate_routes(
1746 area->spftree[tree][level - 1]);
1747 }
3dace42d
CF
1748 }
1749}
1750
1751void isis_area_verify_routes(struct isis_area *area)
1752{
be985ba0
CF
1753 for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++)
1754 isis_spf_verify_routes(area, area->spftree[tree]);
3dace42d
CF
1755}
1756
d62a17ae 1757static void area_resign_level(struct isis_area *area, int level)
3f045a08 1758{
3dace42d
CF
1759 isis_area_invalidate_routes(area, level);
1760 isis_area_verify_routes(area);
1761
4bef0ec4 1762 lsp_db_fini(&area->lspdb[level - 1]);
be985ba0
CF
1763
1764 for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) {
1765 if (area->spftree[tree][level - 1]) {
1766 isis_spftree_del(area->spftree[tree][level - 1]);
1767 area->spftree[tree][level - 1] = NULL;
1768 }
d62a17ae 1769 }
be985ba0 1770
d62a17ae 1771 THREAD_TIMER_OFF(area->spf_timer[level - 1]);
3f045a08 1772
d62a17ae 1773 sched_debug(
1774 "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
1775 area->area_tag, level);
1776 THREAD_TIMER_OFF(area->t_lsp_refresh[level - 1]);
1777 area->lsp_regenerate_pending[level - 1] = 0;
1778}
3f045a08 1779
d62a17ae 1780void isis_area_is_type_set(struct isis_area *area, int is_type)
1781{
1782 struct listnode *node;
1783 struct isis_circuit *circuit;
3f045a08 1784
e740f9c1 1785 if (IS_DEBUG_EVENTS)
d62a17ae 1786 zlog_debug("ISIS-Evt (%s) system type change %s -> %s",
1787 area->area_tag, circuit_t2string(area->is_type),
1788 circuit_t2string(is_type));
f390d2c7 1789
d62a17ae 1790 if (area->is_type == is_type)
1791 return; /* No change */
1792
1793 switch (area->is_type) {
1794 case IS_LEVEL_1:
1795 if (is_type == IS_LEVEL_2)
1796 area_resign_level(area, IS_LEVEL_1);
1797
4bef0ec4 1798 lsp_db_init(&area->lspdb[1]);
d62a17ae 1799 break;
1800
1801 case IS_LEVEL_1_AND_2:
1802 if (is_type == IS_LEVEL_1)
1803 area_resign_level(area, IS_LEVEL_2);
1804 else
1805 area_resign_level(area, IS_LEVEL_1);
1806 break;
1807
1808 case IS_LEVEL_2:
1809 if (is_type == IS_LEVEL_1)
1810 area_resign_level(area, IS_LEVEL_2);
1811
4bef0ec4 1812 lsp_db_init(&area->lspdb[0]);
d62a17ae 1813 break;
1814
1815 default:
1816 break;
1817 }
1818
1819 area->is_type = is_type;
1820
1821 /* override circuit's is_type */
1822 if (area->is_type != IS_LEVEL_1_AND_2) {
1823 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit))
1824 isis_circuit_is_type_set(circuit, is_type);
1825 }
1826
1827 spftree_area_init(area);
1828
1829 if (listcount(area->area_addrs) > 0) {
1830 if (is_type & IS_LEVEL_1)
1831 lsp_generate(area, IS_LEVEL_1);
1832 if (is_type & IS_LEVEL_2)
1833 lsp_generate(area, IS_LEVEL_2);
1834 }
1835 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1836
1837 return;
eb5d44eb 1838}
1839
a38a72db
CF
1840void isis_area_metricstyle_set(struct isis_area *area, bool old_metric,
1841 bool new_metric)
e38e0df0 1842{
e0df3206
EDP
1843 area->oldmetric = old_metric;
1844 area->newmetric = new_metric;
1845 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
e38e0df0
SV
1846}
1847
a38a72db 1848void isis_area_overload_bit_set(struct isis_area *area, bool overload_bit)
eb5d44eb 1849{
d62a17ae 1850 char new_overload_bit = overload_bit ? LSPBIT_OL : 0;
eb5d44eb 1851
d62a17ae 1852 if (new_overload_bit != area->overload_bit) {
1853 area->overload_bit = new_overload_bit;
1854 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1855 }
9414b6f6
EDP
1856#ifndef FABRICD
1857 isis_notif_db_overload(area, overload_bit);
1858#endif /* ifndef FABRICD */
3f045a08
JB
1859}
1860
a38a72db 1861void isis_area_attached_bit_set(struct isis_area *area, bool attached_bit)
3f045a08 1862{
d62a17ae 1863 char new_attached_bit = attached_bit ? LSPBIT_ATT : 0;
3f045a08 1864
d62a17ae 1865 if (new_attached_bit != area->attached_bit) {
1866 area->attached_bit = new_attached_bit;
1867 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1868 }
eb5d44eb 1869}
1870
a38a72db 1871void isis_area_dynhostname_set(struct isis_area *area, bool dynhostname)
eb5d44eb 1872{
d62a17ae 1873 if (area->dynhostname != dynhostname) {
1874 area->dynhostname = dynhostname;
1875 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0);
1876 }
eb5d44eb 1877}
1878
d62a17ae 1879void isis_area_max_lsp_lifetime_set(struct isis_area *area, int level,
1880 uint16_t max_lsp_lifetime)
eb5d44eb 1881{
d62a17ae 1882 assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2));
eb5d44eb 1883
d62a17ae 1884 if (area->max_lsp_lifetime[level - 1] == max_lsp_lifetime)
1885 return;
3f045a08 1886
d62a17ae 1887 area->max_lsp_lifetime[level - 1] = max_lsp_lifetime;
1888 lsp_regenerate_schedule(area, level, 1);
3f045a08
JB
1889}
1890
d62a17ae 1891void isis_area_lsp_refresh_set(struct isis_area *area, int level,
1892 uint16_t lsp_refresh)
3f045a08 1893{
d62a17ae 1894 assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2));
eb5d44eb 1895
d62a17ae 1896 if (area->lsp_refresh[level - 1] == lsp_refresh)
1897 return;
eb5d44eb 1898
d62a17ae 1899 area->lsp_refresh[level - 1] = lsp_refresh;
1900 lsp_regenerate_schedule(area, level, 1);
3f045a08
JB
1901}
1902
2adf66ff 1903#ifdef FABRICD
3f045a08
JB
1904DEFUN (log_adj_changes,
1905 log_adj_changes_cmd,
1906 "log-adjacency-changes",
1907 "Log changes in adjacency state\n")
1908{
d62a17ae 1909 VTY_DECLVAR_CONTEXT(isis_area, area);
eb5d44eb 1910
d62a17ae 1911 area->log_adj_changes = 1;
eb5d44eb 1912
d62a17ae 1913 return CMD_SUCCESS;
eb5d44eb 1914}
1915
3f045a08
JB
1916DEFUN (no_log_adj_changes,
1917 no_log_adj_changes_cmd,
1918 "no log-adjacency-changes",
d7fa34c1 1919 NO_STR
3f045a08 1920 "Stop logging changes in adjacency state\n")
eb5d44eb 1921{
d62a17ae 1922 VTY_DECLVAR_CONTEXT(isis_area, area);
f390d2c7 1923
d62a17ae 1924 area->log_adj_changes = 0;
eb5d44eb 1925
d62a17ae 1926 return CMD_SUCCESS;
eb5d44eb 1927}
2adf66ff 1928#endif /* ifdef FABRICD */
20600086 1929#ifdef FABRICD
eb5d44eb 1930/* IS-IS configuration write function */
612c2c15 1931static int isis_config_write(struct vty *vty)
d62a17ae 1932{
1933 int write = 0;
1934
1935 if (isis != NULL) {
1936 struct isis_area *area;
1937 struct listnode *node, *node2;
1938
1939 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
1940 /* ISIS - Area name */
7c0cbd0e 1941 vty_out(vty, "router " PROTO_NAME " %s\n", area->area_tag);
d62a17ae 1942 write++;
1943 /* ISIS - Net */
1944 if (listcount(area->area_addrs) > 0) {
1945 struct area_addr *area_addr;
1946 for (ALL_LIST_ELEMENTS_RO(area->area_addrs,
1947 node2, area_addr)) {
1948 vty_out(vty, " net %s\n",
1949 isonet_print(
1950 area_addr->area_addr,
1951 area_addr->addr_len
1952 + ISIS_SYS_ID_LEN
1953 + 1));
1954 write++;
1955 }
1956 }
1957 /* ISIS - Dynamic hostname - Defaults to true so only
1958 * display if
1959 * false. */
1960 if (!area->dynhostname) {
1961 vty_out(vty, " no hostname dynamic\n");
1962 write++;
1963 }
1964 /* ISIS - Metric-Style - when true displays wide */
65f18157
CF
1965 if (!fabricd) {
1966 if (area->newmetric) {
1967 if (!area->oldmetric)
1968 vty_out(vty, " metric-style wide\n");
1969 else
1970 vty_out(vty,
1971 " metric-style transition\n");
1972 write++;
1973 } else {
1974 vty_out(vty, " metric-style narrow\n");
1975 write++;
1976 }
d62a17ae 1977 }
1978 /* ISIS - overload-bit */
1979 if (area->overload_bit) {
1980 vty_out(vty, " set-overload-bit\n");
1981 write++;
1982 }
1983 /* ISIS - Area is-type (level-1-2 is default) */
65f18157
CF
1984 if (!fabricd) {
1985 if (area->is_type == IS_LEVEL_1) {
1986 vty_out(vty, " is-type level-1\n");
1987 write++;
1988 } else if (area->is_type == IS_LEVEL_2) {
1989 vty_out(vty, " is-type level-2-only\n");
1990 write++;
1991 }
d62a17ae 1992 }
1993 write += isis_redist_config_write(vty, area, AF_INET);
1994 write += isis_redist_config_write(vty, area, AF_INET6);
1995 /* ISIS - Lsp generation interval */
1996 if (area->lsp_gen_interval[0]
1997 == area->lsp_gen_interval[1]) {
1998 if (area->lsp_gen_interval[0]
1999 != DEFAULT_MIN_LSP_GEN_INTERVAL) {
2000 vty_out(vty, " lsp-gen-interval %d\n",
2001 area->lsp_gen_interval[0]);
2002 write++;
2003 }
2004 } else {
2005 if (area->lsp_gen_interval[0]
2006 != DEFAULT_MIN_LSP_GEN_INTERVAL) {
2007 vty_out(vty,
2008 " lsp-gen-interval level-1 %d\n",
2009 area->lsp_gen_interval[0]);
2010 write++;
2011 }
2012 if (area->lsp_gen_interval[1]
2013 != DEFAULT_MIN_LSP_GEN_INTERVAL) {
2014 vty_out(vty,
2015 " lsp-gen-interval level-2 %d\n",
2016 area->lsp_gen_interval[1]);
2017 write++;
2018 }
2019 }
2020 /* ISIS - LSP lifetime */
2021 if (area->max_lsp_lifetime[0]
2022 == area->max_lsp_lifetime[1]) {
2023 if (area->max_lsp_lifetime[0]
2024 != DEFAULT_LSP_LIFETIME) {
2025 vty_out(vty, " max-lsp-lifetime %u\n",
2026 area->max_lsp_lifetime[0]);
2027 write++;
2028 }
2029 } else {
2030 if (area->max_lsp_lifetime[0]
2031 != DEFAULT_LSP_LIFETIME) {
2032 vty_out(vty,
2033 " max-lsp-lifetime level-1 %u\n",
2034 area->max_lsp_lifetime[0]);
2035 write++;
2036 }
2037 if (area->max_lsp_lifetime[1]
2038 != DEFAULT_LSP_LIFETIME) {
2039 vty_out(vty,
2040 " max-lsp-lifetime level-2 %u\n",
2041 area->max_lsp_lifetime[1]);
2042 write++;
2043 }
2044 }
2045 /* ISIS - LSP refresh interval */
2046 if (area->lsp_refresh[0] == area->lsp_refresh[1]) {
2047 if (area->lsp_refresh[0]
2048 != DEFAULT_MAX_LSP_GEN_INTERVAL) {
2049 vty_out(vty,
2050 " lsp-refresh-interval %u\n",
2051 area->lsp_refresh[0]);
2052 write++;
2053 }
2054 } else {
2055 if (area->lsp_refresh[0]
2056 != DEFAULT_MAX_LSP_GEN_INTERVAL) {
2057 vty_out(vty,
2058 " lsp-refresh-interval level-1 %u\n",
2059 area->lsp_refresh[0]);
2060 write++;
2061 }
2062 if (area->lsp_refresh[1]
2063 != DEFAULT_MAX_LSP_GEN_INTERVAL) {
2064 vty_out(vty,
2065 " lsp-refresh-interval level-2 %u\n",
2066 area->lsp_refresh[1]);
2067 write++;
2068 }
2069 }
2070 if (area->lsp_mtu != DEFAULT_LSP_MTU) {
2071 vty_out(vty, " lsp-mtu %u\n", area->lsp_mtu);
2072 write++;
2073 }
2c92bee4
CF
2074 if (area->purge_originator) {
2075 vty_out(vty, " purge-originator\n");
2076 write++;
2077 }
d62a17ae 2078
2079 /* Minimum SPF interval. */
2080 if (area->min_spf_interval[0]
2081 == area->min_spf_interval[1]) {
2082 if (area->min_spf_interval[0]
2083 != MINIMUM_SPF_INTERVAL) {
2084 vty_out(vty, " spf-interval %d\n",
2085 area->min_spf_interval[0]);
2086 write++;
2087 }
2088 } else {
2089 if (area->min_spf_interval[0]
2090 != MINIMUM_SPF_INTERVAL) {
2091 vty_out(vty,
2092 " spf-interval level-1 %d\n",
2093 area->min_spf_interval[0]);
2094 write++;
2095 }
2096 if (area->min_spf_interval[1]
2097 != MINIMUM_SPF_INTERVAL) {
2098 vty_out(vty,
2099 " spf-interval level-2 %d\n",
2100 area->min_spf_interval[1]);
2101 write++;
2102 }
2103 }
2104
2105 /* IETF SPF interval */
2106 if (area->spf_delay_ietf[0]) {
2107 vty_out(vty,
2108 " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n",
2109 spf_backoff_init_delay(
2110 area->spf_delay_ietf[0]),
2111 spf_backoff_short_delay(
2112 area->spf_delay_ietf[0]),
2113 spf_backoff_long_delay(
2114 area->spf_delay_ietf[0]),
2115 spf_backoff_holddown(
2116 area->spf_delay_ietf[0]),
2117 spf_backoff_timetolearn(
2118 area->spf_delay_ietf[0]));
2119 write++;
2120 }
2121
2122 /* Authentication passwords. */
2123 if (area->area_passwd.type
2124 == ISIS_PASSWD_TYPE_HMAC_MD5) {
2125 vty_out(vty, " area-password md5 %s",
2126 area->area_passwd.passwd);
2127 if (CHECK_FLAG(area->area_passwd.snp_auth,
2128 SNP_AUTH_SEND)) {
2129 vty_out(vty, " authenticate snp ");
2130 if (CHECK_FLAG(
2131 area->area_passwd.snp_auth,
2132 SNP_AUTH_RECV))
2133 vty_out(vty, "validate");
2134 else
2135 vty_out(vty, "send-only");
2136 }
2137 vty_out(vty, "\n");
2138 write++;
2139 } else if (area->area_passwd.type
2140 == ISIS_PASSWD_TYPE_CLEARTXT) {
2141 vty_out(vty, " area-password clear %s",
2142 area->area_passwd.passwd);
2143 if (CHECK_FLAG(area->area_passwd.snp_auth,
2144 SNP_AUTH_SEND)) {
2145 vty_out(vty, " authenticate snp ");
2146 if (CHECK_FLAG(
2147 area->area_passwd.snp_auth,
2148 SNP_AUTH_RECV))
2149 vty_out(vty, "validate");
2150 else
2151 vty_out(vty, "send-only");
2152 }
2153 vty_out(vty, "\n");
2154 write++;
2155 }
2156 if (area->domain_passwd.type
2157 == ISIS_PASSWD_TYPE_HMAC_MD5) {
2158 vty_out(vty, " domain-password md5 %s",
2159 area->domain_passwd.passwd);
2160 if (CHECK_FLAG(area->domain_passwd.snp_auth,
2161 SNP_AUTH_SEND)) {
2162 vty_out(vty, " authenticate snp ");
2163 if (CHECK_FLAG(area->domain_passwd
2164 .snp_auth,
2165 SNP_AUTH_RECV))
2166 vty_out(vty, "validate");
2167 else
2168 vty_out(vty, "send-only");
2169 }
2170 vty_out(vty, "\n");
2171 write++;
2172 } else if (area->domain_passwd.type
2173 == ISIS_PASSWD_TYPE_CLEARTXT) {
2174 vty_out(vty, " domain-password clear %s",
2175 area->domain_passwd.passwd);
2176 if (CHECK_FLAG(area->domain_passwd.snp_auth,
2177 SNP_AUTH_SEND)) {
2178 vty_out(vty, " authenticate snp ");
2179 if (CHECK_FLAG(area->domain_passwd
2180 .snp_auth,
2181 SNP_AUTH_RECV))
2182 vty_out(vty, "validate");
2183 else
2184 vty_out(vty, "send-only");
2185 }
2186 vty_out(vty, "\n");
2187 write++;
2188 }
2189
2190 if (area->log_adj_changes) {
2191 vty_out(vty, " log-adjacency-changes\n");
2192 write++;
2193 }
2194
2195 write += area_write_mt_settings(area, vty);
92ed0cde 2196 write += fabricd_write_settings(area, vty);
d62a17ae 2197 }
d62a17ae 2198 }
2199
2200 return write;
2201}
2202
f4b8291f
DL
2203struct cmd_node router_node = {
2204 .name = "openfabric",
2205 .node = OPENFABRIC_NODE,
2206 .parent_node = CONFIG_NODE,
2207 .prompt = "%s(config-router)# ",
2208 .config_write = isis_config_write,
2209};
20600086
EDP
2210#else
2211/* IS-IS configuration write function */
612c2c15 2212static int isis_config_write(struct vty *vty)
20600086
EDP
2213{
2214 int write = 0;
2215 struct lyd_node *dnode;
2216
2217 dnode = yang_dnode_get(running_config->dnode, "/frr-isisd:isis");
cc50ddb2 2218 if (dnode) {
20600086 2219 nb_cli_show_dnode_cmds(vty, dnode, false);
cc50ddb2
EDP
2220 write++;
2221 }
20600086
EDP
2222
2223 return write;
2224}
20600086 2225
62b346ee 2226struct cmd_node router_node = {
f4b8291f
DL
2227 .name = "isis",
2228 .node = ISIS_NODE,
24389580 2229 .parent_node = CONFIG_NODE,
62b346ee 2230 .prompt = "%s(config-router)# ",
612c2c15 2231 .config_write = isis_config_write,
62b346ee 2232};
f4b8291f 2233#endif /* ifdef FABRICD */
d62a17ae 2234
4d762f26 2235void isis_init(void)
d62a17ae 2236{
2237 /* Install IS-IS top node */
612c2c15 2238 install_node(&router_node);
d62a17ae 2239
2240 install_element(VIEW_NODE, &show_isis_summary_cmd);
2241
2242 install_element(VIEW_NODE, &show_isis_spf_ietf_cmd);
2243
2244 install_element(VIEW_NODE, &show_isis_interface_cmd);
2245 install_element(VIEW_NODE, &show_isis_interface_detail_cmd);
2246 install_element(VIEW_NODE, &show_isis_interface_arg_cmd);
2247
2248 install_element(VIEW_NODE, &show_isis_neighbor_cmd);
2249 install_element(VIEW_NODE, &show_isis_neighbor_detail_cmd);
2250 install_element(VIEW_NODE, &show_isis_neighbor_arg_cmd);
2251 install_element(VIEW_NODE, &clear_isis_neighbor_cmd);
2252 install_element(VIEW_NODE, &clear_isis_neighbor_arg_cmd);
2253
2254 install_element(VIEW_NODE, &show_hostname_cmd);
2255 install_element(VIEW_NODE, &show_database_cmd);
2256
2257 install_element(ENABLE_NODE, &show_debugging_isis_cmd);
2258
612c2c15 2259 install_node(&debug_node);
d62a17ae 2260
2261 install_element(ENABLE_NODE, &debug_isis_adj_cmd);
2262 install_element(ENABLE_NODE, &no_debug_isis_adj_cmd);
161fa356
CF
2263 install_element(ENABLE_NODE, &debug_isis_tx_queue_cmd);
2264 install_element(ENABLE_NODE, &no_debug_isis_tx_queue_cmd);
ddb33326
CF
2265 install_element(ENABLE_NODE, &debug_isis_flooding_cmd);
2266 install_element(ENABLE_NODE, &no_debug_isis_flooding_cmd);
d62a17ae 2267 install_element(ENABLE_NODE, &debug_isis_snp_cmd);
2268 install_element(ENABLE_NODE, &no_debug_isis_snp_cmd);
2269 install_element(ENABLE_NODE, &debug_isis_upd_cmd);
2270 install_element(ENABLE_NODE, &no_debug_isis_upd_cmd);
2271 install_element(ENABLE_NODE, &debug_isis_spfevents_cmd);
2272 install_element(ENABLE_NODE, &no_debug_isis_spfevents_cmd);
26f6acaf
RW
2273 install_element(ENABLE_NODE, &debug_isis_srevents_cmd);
2274 install_element(ENABLE_NODE, &no_debug_isis_srevents_cmd);
d62a17ae 2275 install_element(ENABLE_NODE, &debug_isis_rtevents_cmd);
2276 install_element(ENABLE_NODE, &no_debug_isis_rtevents_cmd);
2277 install_element(ENABLE_NODE, &debug_isis_events_cmd);
2278 install_element(ENABLE_NODE, &no_debug_isis_events_cmd);
2279 install_element(ENABLE_NODE, &debug_isis_packet_dump_cmd);
2280 install_element(ENABLE_NODE, &no_debug_isis_packet_dump_cmd);
2281 install_element(ENABLE_NODE, &debug_isis_lsp_gen_cmd);
2282 install_element(ENABLE_NODE, &no_debug_isis_lsp_gen_cmd);
2283 install_element(ENABLE_NODE, &debug_isis_lsp_sched_cmd);
2284 install_element(ENABLE_NODE, &no_debug_isis_lsp_sched_cmd);
2815f817
CF
2285 install_element(ENABLE_NODE, &debug_isis_bfd_cmd);
2286 install_element(ENABLE_NODE, &no_debug_isis_bfd_cmd);
d62a17ae 2287
2288 install_element(CONFIG_NODE, &debug_isis_adj_cmd);
2289 install_element(CONFIG_NODE, &no_debug_isis_adj_cmd);
161fa356
CF
2290 install_element(CONFIG_NODE, &debug_isis_tx_queue_cmd);
2291 install_element(CONFIG_NODE, &no_debug_isis_tx_queue_cmd);
ddb33326
CF
2292 install_element(CONFIG_NODE, &debug_isis_flooding_cmd);
2293 install_element(CONFIG_NODE, &no_debug_isis_flooding_cmd);
d62a17ae 2294 install_element(CONFIG_NODE, &debug_isis_snp_cmd);
2295 install_element(CONFIG_NODE, &no_debug_isis_snp_cmd);
2296 install_element(CONFIG_NODE, &debug_isis_upd_cmd);
2297 install_element(CONFIG_NODE, &no_debug_isis_upd_cmd);
2298 install_element(CONFIG_NODE, &debug_isis_spfevents_cmd);
2299 install_element(CONFIG_NODE, &no_debug_isis_spfevents_cmd);
26f6acaf
RW
2300 install_element(CONFIG_NODE, &debug_isis_srevents_cmd);
2301 install_element(CONFIG_NODE, &no_debug_isis_srevents_cmd);
d62a17ae 2302 install_element(CONFIG_NODE, &debug_isis_rtevents_cmd);
2303 install_element(CONFIG_NODE, &no_debug_isis_rtevents_cmd);
2304 install_element(CONFIG_NODE, &debug_isis_events_cmd);
2305 install_element(CONFIG_NODE, &no_debug_isis_events_cmd);
2306 install_element(CONFIG_NODE, &debug_isis_packet_dump_cmd);
2307 install_element(CONFIG_NODE, &no_debug_isis_packet_dump_cmd);
2308 install_element(CONFIG_NODE, &debug_isis_lsp_gen_cmd);
2309 install_element(CONFIG_NODE, &no_debug_isis_lsp_gen_cmd);
2310 install_element(CONFIG_NODE, &debug_isis_lsp_sched_cmd);
2311 install_element(CONFIG_NODE, &no_debug_isis_lsp_sched_cmd);
2815f817
CF
2312 install_element(CONFIG_NODE, &debug_isis_bfd_cmd);
2313 install_element(CONFIG_NODE, &no_debug_isis_bfd_cmd);
d62a17ae 2314
7c0cbd0e 2315 install_default(ROUTER_NODE);
d62a17ae 2316
aaf2fd21
EDP
2317#ifdef FABRICD
2318 install_element(CONFIG_NODE, &router_openfabric_cmd);
2319 install_element(CONFIG_NODE, &no_router_openfabric_cmd);
2adf66ff 2320
7c0cbd0e
CF
2321 install_element(ROUTER_NODE, &net_cmd);
2322 install_element(ROUTER_NODE, &no_net_cmd);
2adf66ff 2323
7c0cbd0e
CF
2324 install_element(ROUTER_NODE, &isis_topology_cmd);
2325 install_element(ROUTER_NODE, &no_isis_topology_cmd);
2adf66ff 2326
7c0cbd0e
CF
2327 install_element(ROUTER_NODE, &log_adj_changes_cmd);
2328 install_element(ROUTER_NODE, &no_log_adj_changes_cmd);
2adf66ff 2329#endif /* ifdef FABRICD */
d62a17ae 2330
2331 spf_backoff_cmd_init();
eb5d44eb 2332}