]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isisd.c
isisd: add a slight delay to lsp_regenerate_schedule
[mirror_frr.git] / isisd / isisd.c
1 /*
2 * IS-IS Rout(e)ing protocol - isisd.c
3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
7 *
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)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23 #include <zebra.h>
24
25 #include "thread.h"
26 #include "vty.h"
27 #include "command.h"
28 #include "log.h"
29 #include "memory.h"
30 #include "time.h"
31 #include "linklist.h"
32 #include "if.h"
33 #include "hash.h"
34 #include "stream.h"
35 #include "prefix.h"
36 #include "table.h"
37
38 #include "isisd/dict.h"
39 #include "isisd/include-netbsd/iso.h"
40 #include "isisd/isis_constants.h"
41 #include "isisd/isis_common.h"
42 #include "isisd/isis_flags.h"
43 #include "isisd/isis_circuit.h"
44 #include "isisd/isis_csm.h"
45 #include "isisd/isisd.h"
46 #include "isisd/isis_dynhn.h"
47 #include "isisd/isis_adjacency.h"
48 #include "isisd/isis_pdu.h"
49 #include "isisd/isis_misc.h"
50 #include "isisd/isis_constants.h"
51 #include "isisd/isis_tlv.h"
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"
57
58 #ifdef TOPOLOGY_GENERATE
59 #include "spgrid.h"
60 u_char DEFAULT_TOPOLOGY_BASEIS[6] = { 0xFE, 0xED, 0xFE, 0xED, 0x00, 0x00 };
61 #endif /* TOPOLOGY_GENERATE */
62
63 struct isis *isis = NULL;
64
65 /*
66 * Prototypes.
67 */
68 int isis_area_get(struct vty *, const char *);
69 int isis_area_destroy(struct vty *, const char *);
70 int area_net_title(struct vty *, const char *);
71 int area_clear_net_title(struct vty *, const char *);
72 int show_isis_interface_common(struct vty *, const char *ifname, char);
73 int show_isis_neighbor_common(struct vty *, const char *id, char);
74 int clear_isis_neighbor_common(struct vty *, const char *id);
75 int isis_config_write(struct vty *);
76
77
78
79 void
80 isis_new (unsigned long process_id)
81 {
82 isis = XCALLOC (MTYPE_ISIS, sizeof (struct isis));
83 /*
84 * Default values
85 */
86 isis->max_area_addrs = 3;
87 isis->process_id = process_id;
88 isis->router_id = 0;
89 isis->area_list = list_new ();
90 isis->init_circ_list = list_new ();
91 isis->uptime = time (NULL);
92 isis->nexthops = list_new ();
93 #ifdef HAVE_IPV6
94 isis->nexthops6 = list_new ();
95 #endif /* HAVE_IPV6 */
96 dyn_cache_init ();
97 /*
98 * uncomment the next line for full debugs
99 */
100 /* isis->debugs = 0xFFFF; */
101 }
102
103 struct isis_area *
104 isis_area_create (const char *area_tag)
105 {
106 struct isis_area *area;
107
108 area = XCALLOC (MTYPE_ISIS_AREA, sizeof (struct isis_area));
109
110 /*
111 * The first instance is level-1-2 rest are level-1, unless otherwise
112 * configured
113 */
114 if (listcount (isis->area_list) > 0)
115 area->is_type = IS_LEVEL_1;
116 else
117 area->is_type = IS_LEVEL_1_AND_2;
118
119 /*
120 * intialize the databases
121 */
122 if (area->is_type & IS_LEVEL_1)
123 {
124 area->lspdb[0] = lsp_db_init ();
125 area->route_table[0] = route_table_init ();
126 #ifdef HAVE_IPV6
127 area->route_table6[0] = route_table_init ();
128 #endif /* HAVE_IPV6 */
129 }
130 if (area->is_type & IS_LEVEL_2)
131 {
132 area->lspdb[1] = lsp_db_init ();
133 area->route_table[1] = route_table_init ();
134 #ifdef HAVE_IPV6
135 area->route_table6[1] = route_table_init ();
136 #endif /* HAVE_IPV6 */
137 }
138
139 spftree_area_init (area);
140
141 area->circuit_list = list_new ();
142 area->area_addrs = list_new ();
143 THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1);
144 flags_initialize (&area->flags);
145
146 /*
147 * Default values
148 */
149 area->max_lsp_lifetime[0] = DEFAULT_LSP_LIFETIME; /* 1200 */
150 area->max_lsp_lifetime[1] = DEFAULT_LSP_LIFETIME; /* 1200 */
151 area->lsp_refresh[0] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
152 area->lsp_refresh[1] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
153 area->lsp_gen_interval[0] = DEFAULT_MIN_LSP_GEN_INTERVAL;
154 area->lsp_gen_interval[1] = DEFAULT_MIN_LSP_GEN_INTERVAL;
155 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
156 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
157 area->dynhostname = 1;
158 area->oldmetric = 0;
159 area->newmetric = 1;
160 area->lsp_frag_threshold = 90;
161 area->lsp_mtu = DEFAULT_LSP_MTU;
162 #ifdef TOPOLOGY_GENERATE
163 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
164 #endif /* TOPOLOGY_GENERATE */
165
166 area->area_tag = strdup (area_tag);
167 listnode_add (isis->area_list, area);
168 area->isis = isis;
169
170 return area;
171 }
172
173 struct isis_area *
174 isis_area_lookup (const char *area_tag)
175 {
176 struct isis_area *area;
177 struct listnode *node;
178
179 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
180 if ((area->area_tag == NULL && area_tag == NULL) ||
181 (area->area_tag && area_tag
182 && strcmp (area->area_tag, area_tag) == 0))
183 return area;
184
185 return NULL;
186 }
187
188 int
189 isis_area_get (struct vty *vty, const char *area_tag)
190 {
191 struct isis_area *area;
192
193 area = isis_area_lookup (area_tag);
194
195 if (area)
196 {
197 vty->node = ISIS_NODE;
198 vty->index = area;
199 return CMD_SUCCESS;
200 }
201
202 area = isis_area_create (area_tag);
203
204 if (isis->debugs & DEBUG_EVENTS)
205 zlog_debug ("New IS-IS area instance %s", area->area_tag);
206
207 vty->node = ISIS_NODE;
208 vty->index = area;
209
210 return CMD_SUCCESS;
211 }
212
213 int
214 isis_area_destroy (struct vty *vty, const char *area_tag)
215 {
216 struct isis_area *area;
217 struct listnode *node, *nnode;
218 struct isis_circuit *circuit;
219 struct area_addr *addr;
220
221 area = isis_area_lookup (area_tag);
222
223 if (area == NULL)
224 {
225 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
226 return CMD_ERR_NO_MATCH;
227 }
228
229 if (area->circuit_list)
230 {
231 for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))
232 {
233 circuit->ip_router = 0;
234 #ifdef HAVE_IPV6
235 circuit->ipv6_router = 0;
236 #endif
237 isis_csm_state_change (ISIS_DISABLE, circuit, area);
238 }
239 list_delete (area->circuit_list);
240 area->circuit_list = NULL;
241 }
242
243 if (area->lspdb[0] != NULL)
244 {
245 lsp_db_destroy (area->lspdb[0]);
246 area->lspdb[0] = NULL;
247 }
248 if (area->lspdb[1] != NULL)
249 {
250 lsp_db_destroy (area->lspdb[1]);
251 area->lspdb[1] = NULL;
252 }
253
254 spftree_area_del (area);
255
256 /* invalidate and validate would delete all routes from zebra */
257 isis_route_invalidate (area);
258 isis_route_validate (area);
259
260 if (area->route_table[0])
261 {
262 route_table_finish (area->route_table[0]);
263 area->route_table[0] = NULL;
264 }
265 if (area->route_table[1])
266 {
267 route_table_finish (area->route_table[1]);
268 area->route_table[1] = NULL;
269 }
270 #ifdef HAVE_IPV6
271 if (area->route_table6[0])
272 {
273 route_table_finish (area->route_table6[0]);
274 area->route_table6[0] = NULL;
275 }
276 if (area->route_table6[1])
277 {
278 route_table_finish (area->route_table6[1]);
279 area->route_table6[1] = NULL;
280 }
281 #endif /* HAVE_IPV6 */
282
283 for (ALL_LIST_ELEMENTS (area->area_addrs, node, nnode, addr))
284 {
285 list_delete_node (area->area_addrs, node);
286 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
287 }
288 area->area_addrs = NULL;
289
290 THREAD_TIMER_OFF (area->t_tick);
291 THREAD_TIMER_OFF (area->t_lsp_refresh[0]);
292 THREAD_TIMER_OFF (area->t_lsp_refresh[1]);
293
294 thread_cancel_event (master, area);
295
296 listnode_delete (isis->area_list, area);
297
298 free (area->area_tag);
299
300 XFREE (MTYPE_ISIS_AREA, area);
301
302 if (listcount (isis->area_list) == 0)
303 {
304 memset (isis->sysid, 0, ISIS_SYS_ID_LEN);
305 isis->sysid_set = 0;
306 }
307
308 return CMD_SUCCESS;
309 }
310
311 int
312 area_net_title (struct vty *vty, const char *net_title)
313 {
314 struct isis_area *area;
315 struct area_addr *addr;
316 struct area_addr *addrp;
317 struct listnode *node;
318
319 u_char buff[255];
320 area = vty->index;
321
322 if (!area)
323 {
324 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
325 return CMD_ERR_NO_MATCH;
326 }
327
328 /* We check that we are not over the maximal number of addresses */
329 if (listcount (area->area_addrs) >= isis->max_area_addrs)
330 {
331 vty_out (vty, "Maximum of area addresses (%d) already reached %s",
332 isis->max_area_addrs, VTY_NEWLINE);
333 return CMD_ERR_NOTHING_TODO;
334 }
335
336 addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));
337 addr->addr_len = dotformat2buff (buff, net_title);
338 memcpy (addr->area_addr, buff, addr->addr_len);
339 #ifdef EXTREME_DEBUG
340 zlog_debug ("added area address %s for area %s (address length %d)",
341 net_title, area->area_tag, addr->addr_len);
342 #endif /* EXTREME_DEBUG */
343 if (addr->addr_len < 8 || addr->addr_len > 20)
344 {
345 vty_out (vty, "area address must be at least 8..20 octets long (%d)%s",
346 addr->addr_len, VTY_NEWLINE);
347 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
348 return CMD_ERR_AMBIGUOUS;
349 }
350
351 if (addr->area_addr[addr->addr_len-1] != 0)
352 {
353 vty_out (vty, "nsel byte (last byte) in area address must be 0%s",
354 VTY_NEWLINE);
355 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
356 return CMD_ERR_AMBIGUOUS;
357 }
358
359 if (isis->sysid_set == 0)
360 {
361 /*
362 * First area address - get the SystemID for this router
363 */
364 memcpy (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN);
365 isis->sysid_set = 1;
366 if (isis->debugs & DEBUG_EVENTS)
367 zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid));
368 }
369 else
370 {
371 /*
372 * Check that the SystemID portions match
373 */
374 if (memcmp (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN))
375 {
376 vty_out (vty,
377 "System ID must not change when defining additional area"
378 " addresses%s", VTY_NEWLINE);
379 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
380 return CMD_ERR_AMBIGUOUS;
381 }
382
383 /* now we see that we don't already have this address */
384 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
385 {
386 if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN) != (addr->addr_len))
387 continue;
388 if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
389 {
390 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
391 return CMD_SUCCESS; /* silent fail */
392 }
393 }
394 }
395
396 /*
397 * Forget the systemID part of the address
398 */
399 addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN);
400 listnode_add (area->area_addrs, addr);
401
402 /* only now we can safely generate our LSPs for this area */
403 if (listcount (area->area_addrs) > 0)
404 {
405 if (area->is_type & IS_LEVEL_1)
406 lsp_generate (area, IS_LEVEL_1);
407 if (area->is_type & IS_LEVEL_2)
408 lsp_generate (area, IS_LEVEL_2);
409 }
410
411 return CMD_SUCCESS;
412 }
413
414 int
415 area_clear_net_title (struct vty *vty, const char *net_title)
416 {
417 struct isis_area *area;
418 struct area_addr addr, *addrp = NULL;
419 struct listnode *node;
420 u_char buff[255];
421
422 area = vty->index;
423 if (!area)
424 {
425 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
426 return CMD_ERR_NO_MATCH;
427 }
428
429 addr.addr_len = dotformat2buff (buff, net_title);
430 if (addr.addr_len < 8 || addr.addr_len > 20)
431 {
432 vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
433 addr.addr_len, VTY_NEWLINE);
434 return CMD_ERR_AMBIGUOUS;
435 }
436
437 memcpy (addr.area_addr, buff, (int) addr.addr_len);
438
439 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
440 if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len &&
441 !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
442 break;
443
444 if (!addrp)
445 {
446 vty_out (vty, "No area address %s for area %s %s", net_title,
447 area->area_tag, VTY_NEWLINE);
448 return CMD_ERR_NO_MATCH;
449 }
450
451 listnode_delete (area->area_addrs, addrp);
452 XFREE (MTYPE_ISIS_AREA_ADDR, addrp);
453
454 /*
455 * Last area address - reset the SystemID for this router
456 */
457 if (listcount (area->area_addrs) == 0)
458 {
459 memset (isis->sysid, 0, ISIS_SYS_ID_LEN);
460 isis->sysid_set = 0;
461 if (isis->debugs & DEBUG_EVENTS)
462 zlog_debug ("Router has no SystemID");
463 }
464
465 return CMD_SUCCESS;
466 }
467
468 /*
469 * 'show isis interface' command
470 */
471
472 int
473 show_isis_interface_common (struct vty *vty, const char *ifname, char detail)
474 {
475 struct listnode *anode, *cnode;
476 struct isis_area *area;
477 struct isis_circuit *circuit;
478
479 if (!isis)
480 {
481 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
482 return CMD_SUCCESS;
483 }
484
485 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
486 {
487 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
488
489 if (detail == ISIS_UI_LEVEL_BRIEF)
490 vty_out (vty, " Interface CircId State Type Level%s",
491 VTY_NEWLINE);
492
493 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
494 if (!ifname)
495 isis_circuit_print_vty (circuit, vty, detail);
496 else if (strcmp(circuit->interface->name, ifname) == 0)
497 isis_circuit_print_vty (circuit, vty, detail);
498 }
499
500 return CMD_SUCCESS;
501 }
502
503 DEFUN (show_isis_interface,
504 show_isis_interface_cmd,
505 "show isis interface",
506 SHOW_STR
507 "ISIS network information\n"
508 "ISIS interface\n")
509 {
510 return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_BRIEF);
511 }
512
513 DEFUN (show_isis_interface_detail,
514 show_isis_interface_detail_cmd,
515 "show isis interface detail",
516 SHOW_STR
517 "ISIS network information\n"
518 "ISIS interface\n"
519 "show detailed information\n")
520 {
521 return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_DETAIL);
522 }
523
524 DEFUN (show_isis_interface_arg,
525 show_isis_interface_arg_cmd,
526 "show isis interface WORD",
527 SHOW_STR
528 "ISIS network information\n"
529 "ISIS interface\n"
530 "ISIS interface name\n")
531 {
532 return show_isis_interface_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
533 }
534
535 /*
536 * 'show isis neighbor' command
537 */
538
539 int
540 show_isis_neighbor_common (struct vty *vty, const char *id, char detail)
541 {
542 struct listnode *anode, *cnode, *node;
543 struct isis_area *area;
544 struct isis_circuit *circuit;
545 struct list *adjdb;
546 struct isis_adjacency *adj;
547 struct isis_dynhn *dynhn;
548 u_char sysid[ISIS_SYS_ID_LEN];
549 int i;
550
551 if (!isis)
552 {
553 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
554 return CMD_SUCCESS;
555 }
556
557 memset (sysid, 0, ISIS_SYS_ID_LEN);
558 if (id)
559 {
560 if (sysid2buff (sysid, id) == 0)
561 {
562 dynhn = dynhn_find_by_name (id);
563 if (dynhn == NULL)
564 {
565 vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
566 return CMD_SUCCESS;
567 }
568 memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
569 }
570 }
571
572 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
573 {
574 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
575
576 if (detail == ISIS_UI_LEVEL_BRIEF)
577 vty_out (vty, " System Id Interface L State"
578 " Holdtime SNPA%s", VTY_NEWLINE);
579
580 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
581 {
582 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
583 {
584 for (i = 0; i < 2; i++)
585 {
586 adjdb = circuit->u.bc.adjdb[i];
587 if (adjdb && adjdb->count)
588 {
589 for (ALL_LIST_ELEMENTS_RO (adjdb, node, adj))
590 if (!id || !memcmp (adj->sysid, sysid,
591 ISIS_SYS_ID_LEN))
592 isis_adj_print_vty (adj, vty, detail);
593 }
594 }
595 }
596 else if (circuit->circ_type == CIRCUIT_T_P2P &&
597 circuit->u.p2p.neighbor)
598 {
599 adj = circuit->u.p2p.neighbor;
600 if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
601 isis_adj_print_vty (adj, vty, detail);
602 }
603 }
604 }
605
606 return CMD_SUCCESS;
607 }
608
609 /*
610 * 'clear isis neighbor' command
611 */
612 int
613 clear_isis_neighbor_common (struct vty *vty, const char *id)
614 {
615 struct listnode *anode, *cnode, *cnextnode, *node, *nnode;
616 struct isis_area *area;
617 struct isis_circuit *circuit;
618 struct list *adjdb;
619 struct isis_adjacency *adj;
620 struct isis_dynhn *dynhn;
621 u_char sysid[ISIS_SYS_ID_LEN];
622 int i;
623
624 if (!isis)
625 {
626 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
627 return CMD_SUCCESS;
628 }
629
630 memset (sysid, 0, ISIS_SYS_ID_LEN);
631 if (id)
632 {
633 if (sysid2buff (sysid, id) == 0)
634 {
635 dynhn = dynhn_find_by_name (id);
636 if (dynhn == NULL)
637 {
638 vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
639 return CMD_SUCCESS;
640 }
641 memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
642 }
643 }
644
645 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
646 {
647 for (ALL_LIST_ELEMENTS (area->circuit_list, cnode, cnextnode, circuit))
648 {
649 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
650 {
651 for (i = 0; i < 2; i++)
652 {
653 adjdb = circuit->u.bc.adjdb[i];
654 if (adjdb && adjdb->count)
655 {
656 for (ALL_LIST_ELEMENTS (adjdb, node, nnode, adj))
657 if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
658 isis_adj_state_change (adj, ISIS_ADJ_DOWN,
659 "clear user request");
660 }
661 }
662 }
663 else if (circuit->circ_type == CIRCUIT_T_P2P &&
664 circuit->u.p2p.neighbor)
665 {
666 adj = circuit->u.p2p.neighbor;
667 if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
668 isis_adj_state_change (adj, ISIS_ADJ_DOWN,
669 "clear user request");
670 }
671 }
672 }
673
674 return CMD_SUCCESS;
675 }
676
677 DEFUN (show_isis_neighbor,
678 show_isis_neighbor_cmd,
679 "show isis neighbor",
680 SHOW_STR
681 "ISIS network information\n"
682 "ISIS neighbor adjacencies\n")
683 {
684 return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_BRIEF);
685 }
686
687 DEFUN (show_isis_neighbor_detail,
688 show_isis_neighbor_detail_cmd,
689 "show isis neighbor detail",
690 SHOW_STR
691 "ISIS network information\n"
692 "ISIS neighbor adjacencies\n"
693 "show detailed information\n")
694 {
695 return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_DETAIL);
696 }
697
698 DEFUN (show_isis_neighbor_arg,
699 show_isis_neighbor_arg_cmd,
700 "show isis neighbor WORD",
701 SHOW_STR
702 "ISIS network information\n"
703 "ISIS neighbor adjacencies\n"
704 "System id\n")
705 {
706 return show_isis_neighbor_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
707 }
708
709 DEFUN (clear_isis_neighbor,
710 clear_isis_neighbor_cmd,
711 "clear isis neighbor",
712 CLEAR_STR
713 "Reset ISIS network information\n"
714 "Reset ISIS neighbor adjacencies\n")
715 {
716 return clear_isis_neighbor_common (vty, NULL);
717 }
718
719 DEFUN (clear_isis_neighbor_arg,
720 clear_isis_neighbor_arg_cmd,
721 "clear isis neighbor WORD",
722 CLEAR_STR
723 "ISIS network information\n"
724 "ISIS neighbor adjacencies\n"
725 "System id\n")
726 {
727 return clear_isis_neighbor_common (vty, argv[0]);
728 }
729
730 /*
731 * 'isis debug', 'show debugging'
732 */
733 void
734 print_debug (struct vty *vty, int flags, int onoff)
735 {
736 char onoffs[4];
737 if (onoff)
738 strcpy (onoffs, "on");
739 else
740 strcpy (onoffs, "off");
741
742 if (flags & DEBUG_ADJ_PACKETS)
743 vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs,
744 VTY_NEWLINE);
745 if (flags & DEBUG_CHECKSUM_ERRORS)
746 vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs,
747 VTY_NEWLINE);
748 if (flags & DEBUG_LOCAL_UPDATES)
749 vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs,
750 VTY_NEWLINE);
751 if (flags & DEBUG_PROTOCOL_ERRORS)
752 vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs,
753 VTY_NEWLINE);
754 if (flags & DEBUG_SNP_PACKETS)
755 vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs,
756 VTY_NEWLINE);
757 if (flags & DEBUG_SPF_EVENTS)
758 vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE);
759 if (flags & DEBUG_SPF_STATS)
760 vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s",
761 onoffs, VTY_NEWLINE);
762 if (flags & DEBUG_SPF_TRIGGERS)
763 vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs,
764 VTY_NEWLINE);
765 if (flags & DEBUG_UPDATE_PACKETS)
766 vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs,
767 VTY_NEWLINE);
768 if (flags & DEBUG_RTE_EVENTS)
769 vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs,
770 VTY_NEWLINE);
771 if (flags & DEBUG_EVENTS)
772 vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);
773 if (flags & DEBUG_PACKET_DUMP)
774 vty_out (vty, "IS-IS Packet dump debugging is %s%s", onoffs, VTY_NEWLINE);
775 if (flags & DEBUG_LSP_GEN)
776 vty_out (vty, "IS-IS LSP generation debugging is %s%s", onoffs, VTY_NEWLINE);
777 if (flags & DEBUG_LSP_SCHED)
778 vty_out (vty, "IS-IS LSP scheduling debugging is %s%s", onoffs, VTY_NEWLINE);
779 }
780
781 DEFUN (show_debugging,
782 show_debugging_cmd,
783 "show debugging isis",
784 SHOW_STR
785 "State of each debugging option\n"
786 ISIS_STR)
787 {
788 vty_out (vty, "IS-IS:%s", VTY_NEWLINE);
789 print_debug (vty, isis->debugs, 1);
790 return CMD_SUCCESS;
791 }
792
793 /* Debug node. */
794 static struct cmd_node debug_node = {
795 DEBUG_NODE,
796 "",
797 1
798 };
799
800 static int
801 config_write_debug (struct vty *vty)
802 {
803 int write = 0;
804 int flags = isis->debugs;
805
806 if (flags & DEBUG_ADJ_PACKETS)
807 {
808 vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE);
809 write++;
810 }
811 if (flags & DEBUG_CHECKSUM_ERRORS)
812 {
813 vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE);
814 write++;
815 }
816 if (flags & DEBUG_LOCAL_UPDATES)
817 {
818 vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE);
819 write++;
820 }
821 if (flags & DEBUG_PROTOCOL_ERRORS)
822 {
823 vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE);
824 write++;
825 }
826 if (flags & DEBUG_SNP_PACKETS)
827 {
828 vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE);
829 write++;
830 }
831 if (flags & DEBUG_SPF_EVENTS)
832 {
833 vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE);
834 write++;
835 }
836 if (flags & DEBUG_SPF_STATS)
837 {
838 vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE);
839 write++;
840 }
841 if (flags & DEBUG_SPF_TRIGGERS)
842 {
843 vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE);
844 write++;
845 }
846 if (flags & DEBUG_UPDATE_PACKETS)
847 {
848 vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE);
849 write++;
850 }
851 if (flags & DEBUG_RTE_EVENTS)
852 {
853 vty_out (vty, "debug isis route-events%s", VTY_NEWLINE);
854 write++;
855 }
856 if (flags & DEBUG_EVENTS)
857 {
858 vty_out (vty, "debug isis events%s", VTY_NEWLINE);
859 write++;
860 }
861 if (flags & DEBUG_PACKET_DUMP)
862 {
863 vty_out (vty, "debug isis packet-dump%s", VTY_NEWLINE);
864 write++;
865 }
866 if (flags & DEBUG_LSP_GEN)
867 {
868 vty_out (vty, "debug isis lsp-gen%s", VTY_NEWLINE);
869 write++;
870 }
871 if (flags & DEBUG_LSP_SCHED)
872 {
873 vty_out (vty, "debug isis lsp-sched%s", VTY_NEWLINE);
874 write++;
875 }
876
877 return write;
878 }
879
880 DEFUN (debug_isis_adj,
881 debug_isis_adj_cmd,
882 "debug isis adj-packets",
883 DEBUG_STR
884 "IS-IS information\n"
885 "IS-IS Adjacency related packets\n")
886 {
887 isis->debugs |= DEBUG_ADJ_PACKETS;
888 print_debug (vty, DEBUG_ADJ_PACKETS, 1);
889
890 return CMD_SUCCESS;
891 }
892
893 DEFUN (no_debug_isis_adj,
894 no_debug_isis_adj_cmd,
895 "no debug isis adj-packets",
896 UNDEBUG_STR
897 "IS-IS information\n"
898 "IS-IS Adjacency related packets\n")
899 {
900 isis->debugs &= ~DEBUG_ADJ_PACKETS;
901 print_debug (vty, DEBUG_ADJ_PACKETS, 0);
902
903 return CMD_SUCCESS;
904 }
905
906 DEFUN (debug_isis_csum,
907 debug_isis_csum_cmd,
908 "debug isis checksum-errors",
909 DEBUG_STR
910 "IS-IS information\n"
911 "IS-IS LSP checksum errors\n")
912 {
913 isis->debugs |= DEBUG_CHECKSUM_ERRORS;
914 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1);
915
916 return CMD_SUCCESS;
917 }
918
919 DEFUN (no_debug_isis_csum,
920 no_debug_isis_csum_cmd,
921 "no debug isis checksum-errors",
922 UNDEBUG_STR
923 "IS-IS information\n"
924 "IS-IS LSP checksum errors\n")
925 {
926 isis->debugs &= ~DEBUG_CHECKSUM_ERRORS;
927 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0);
928
929 return CMD_SUCCESS;
930 }
931
932 DEFUN (debug_isis_lupd,
933 debug_isis_lupd_cmd,
934 "debug isis local-updates",
935 DEBUG_STR
936 "IS-IS information\n"
937 "IS-IS local update packets\n")
938 {
939 isis->debugs |= DEBUG_LOCAL_UPDATES;
940 print_debug (vty, DEBUG_LOCAL_UPDATES, 1);
941
942 return CMD_SUCCESS;
943 }
944
945 DEFUN (no_debug_isis_lupd,
946 no_debug_isis_lupd_cmd,
947 "no debug isis local-updates",
948 UNDEBUG_STR
949 "IS-IS information\n"
950 "IS-IS local update packets\n")
951 {
952 isis->debugs &= ~DEBUG_LOCAL_UPDATES;
953 print_debug (vty, DEBUG_LOCAL_UPDATES, 0);
954
955 return CMD_SUCCESS;
956 }
957
958 DEFUN (debug_isis_err,
959 debug_isis_err_cmd,
960 "debug isis protocol-errors",
961 DEBUG_STR
962 "IS-IS information\n"
963 "IS-IS LSP protocol errors\n")
964 {
965 isis->debugs |= DEBUG_PROTOCOL_ERRORS;
966 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1);
967
968 return CMD_SUCCESS;
969 }
970
971 DEFUN (no_debug_isis_err,
972 no_debug_isis_err_cmd,
973 "no debug isis protocol-errors",
974 UNDEBUG_STR
975 "IS-IS information\n"
976 "IS-IS LSP protocol errors\n")
977 {
978 isis->debugs &= ~DEBUG_PROTOCOL_ERRORS;
979 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0);
980
981 return CMD_SUCCESS;
982 }
983
984 DEFUN (debug_isis_snp,
985 debug_isis_snp_cmd,
986 "debug isis snp-packets",
987 DEBUG_STR
988 "IS-IS information\n"
989 "IS-IS CSNP/PSNP packets\n")
990 {
991 isis->debugs |= DEBUG_SNP_PACKETS;
992 print_debug (vty, DEBUG_SNP_PACKETS, 1);
993
994 return CMD_SUCCESS;
995 }
996
997 DEFUN (no_debug_isis_snp,
998 no_debug_isis_snp_cmd,
999 "no debug isis snp-packets",
1000 UNDEBUG_STR
1001 "IS-IS information\n"
1002 "IS-IS CSNP/PSNP packets\n")
1003 {
1004 isis->debugs &= ~DEBUG_SNP_PACKETS;
1005 print_debug (vty, DEBUG_SNP_PACKETS, 0);
1006
1007 return CMD_SUCCESS;
1008 }
1009
1010 DEFUN (debug_isis_upd,
1011 debug_isis_upd_cmd,
1012 "debug isis update-packets",
1013 DEBUG_STR
1014 "IS-IS information\n"
1015 "IS-IS Update related packets\n")
1016 {
1017 isis->debugs |= DEBUG_UPDATE_PACKETS;
1018 print_debug (vty, DEBUG_UPDATE_PACKETS, 1);
1019
1020 return CMD_SUCCESS;
1021 }
1022
1023 DEFUN (no_debug_isis_upd,
1024 no_debug_isis_upd_cmd,
1025 "no debug isis update-packets",
1026 UNDEBUG_STR
1027 "IS-IS information\n"
1028 "IS-IS Update related packets\n")
1029 {
1030 isis->debugs &= ~DEBUG_UPDATE_PACKETS;
1031 print_debug (vty, DEBUG_UPDATE_PACKETS, 0);
1032
1033 return CMD_SUCCESS;
1034 }
1035
1036 DEFUN (debug_isis_spfevents,
1037 debug_isis_spfevents_cmd,
1038 "debug isis spf-events",
1039 DEBUG_STR
1040 "IS-IS information\n"
1041 "IS-IS Shortest Path First Events\n")
1042 {
1043 isis->debugs |= DEBUG_SPF_EVENTS;
1044 print_debug (vty, DEBUG_SPF_EVENTS, 1);
1045
1046 return CMD_SUCCESS;
1047 }
1048
1049 DEFUN (no_debug_isis_spfevents,
1050 no_debug_isis_spfevents_cmd,
1051 "no debug isis spf-events",
1052 UNDEBUG_STR
1053 "IS-IS information\n"
1054 "IS-IS Shortest Path First Events\n")
1055 {
1056 isis->debugs &= ~DEBUG_SPF_EVENTS;
1057 print_debug (vty, DEBUG_SPF_EVENTS, 0);
1058
1059 return CMD_SUCCESS;
1060 }
1061
1062 DEFUN (debug_isis_spfstats,
1063 debug_isis_spfstats_cmd,
1064 "debug isis spf-statistics ",
1065 DEBUG_STR
1066 "IS-IS information\n"
1067 "IS-IS SPF Timing and Statistic Data\n")
1068 {
1069 isis->debugs |= DEBUG_SPF_STATS;
1070 print_debug (vty, DEBUG_SPF_STATS, 1);
1071
1072 return CMD_SUCCESS;
1073 }
1074
1075 DEFUN (no_debug_isis_spfstats,
1076 no_debug_isis_spfstats_cmd,
1077 "no debug isis spf-statistics",
1078 UNDEBUG_STR
1079 "IS-IS information\n"
1080 "IS-IS SPF Timing and Statistic Data\n")
1081 {
1082 isis->debugs &= ~DEBUG_SPF_STATS;
1083 print_debug (vty, DEBUG_SPF_STATS, 0);
1084
1085 return CMD_SUCCESS;
1086 }
1087
1088 DEFUN (debug_isis_spftrigg,
1089 debug_isis_spftrigg_cmd,
1090 "debug isis spf-triggers",
1091 DEBUG_STR
1092 "IS-IS information\n"
1093 "IS-IS SPF triggering events\n")
1094 {
1095 isis->debugs |= DEBUG_SPF_TRIGGERS;
1096 print_debug (vty, DEBUG_SPF_TRIGGERS, 1);
1097
1098 return CMD_SUCCESS;
1099 }
1100
1101 DEFUN (no_debug_isis_spftrigg,
1102 no_debug_isis_spftrigg_cmd,
1103 "no debug isis spf-triggers",
1104 UNDEBUG_STR
1105 "IS-IS information\n"
1106 "IS-IS SPF triggering events\n")
1107 {
1108 isis->debugs &= ~DEBUG_SPF_TRIGGERS;
1109 print_debug (vty, DEBUG_SPF_TRIGGERS, 0);
1110
1111 return CMD_SUCCESS;
1112 }
1113
1114 DEFUN (debug_isis_rtevents,
1115 debug_isis_rtevents_cmd,
1116 "debug isis route-events",
1117 DEBUG_STR
1118 "IS-IS information\n"
1119 "IS-IS Route related events\n")
1120 {
1121 isis->debugs |= DEBUG_RTE_EVENTS;
1122 print_debug (vty, DEBUG_RTE_EVENTS, 1);
1123
1124 return CMD_SUCCESS;
1125 }
1126
1127 DEFUN (no_debug_isis_rtevents,
1128 no_debug_isis_rtevents_cmd,
1129 "no debug isis route-events",
1130 UNDEBUG_STR
1131 "IS-IS information\n"
1132 "IS-IS Route related events\n")
1133 {
1134 isis->debugs &= ~DEBUG_RTE_EVENTS;
1135 print_debug (vty, DEBUG_RTE_EVENTS, 0);
1136
1137 return CMD_SUCCESS;
1138 }
1139
1140 DEFUN (debug_isis_events,
1141 debug_isis_events_cmd,
1142 "debug isis events",
1143 DEBUG_STR
1144 "IS-IS information\n"
1145 "IS-IS Events\n")
1146 {
1147 isis->debugs |= DEBUG_EVENTS;
1148 print_debug (vty, DEBUG_EVENTS, 1);
1149
1150 return CMD_SUCCESS;
1151 }
1152
1153 DEFUN (no_debug_isis_events,
1154 no_debug_isis_events_cmd,
1155 "no debug isis events",
1156 UNDEBUG_STR
1157 "IS-IS information\n"
1158 "IS-IS Events\n")
1159 {
1160 isis->debugs &= ~DEBUG_EVENTS;
1161 print_debug (vty, DEBUG_EVENTS, 0);
1162
1163 return CMD_SUCCESS;
1164 }
1165
1166 DEFUN (debug_isis_packet_dump,
1167 debug_isis_packet_dump_cmd,
1168 "debug isis packet-dump",
1169 DEBUG_STR
1170 "IS-IS information\n"
1171 "IS-IS packet dump\n")
1172 {
1173 isis->debugs |= DEBUG_PACKET_DUMP;
1174 print_debug (vty, DEBUG_PACKET_DUMP, 1);
1175
1176 return CMD_SUCCESS;
1177 }
1178
1179 DEFUN (no_debug_isis_packet_dump,
1180 no_debug_isis_packet_dump_cmd,
1181 "no debug isis packet-dump",
1182 UNDEBUG_STR
1183 "IS-IS information\n"
1184 "IS-IS packet dump\n")
1185 {
1186 isis->debugs &= ~DEBUG_PACKET_DUMP;
1187 print_debug (vty, DEBUG_PACKET_DUMP, 0);
1188
1189 return CMD_SUCCESS;
1190 }
1191
1192 DEFUN (debug_isis_lsp_gen,
1193 debug_isis_lsp_gen_cmd,
1194 "debug isis lsp-gen",
1195 DEBUG_STR
1196 "IS-IS information\n"
1197 "IS-IS generation of own LSPs\n")
1198 {
1199 isis->debugs |= DEBUG_LSP_GEN;
1200 print_debug (vty, DEBUG_LSP_GEN, 1);
1201
1202 return CMD_SUCCESS;
1203 }
1204
1205 DEFUN (no_debug_isis_lsp_gen,
1206 no_debug_isis_lsp_gen_cmd,
1207 "no debug isis lsp-gen",
1208 UNDEBUG_STR
1209 "IS-IS information\n"
1210 "IS-IS generation of own LSPs\n")
1211 {
1212 isis->debugs &= ~DEBUG_LSP_GEN;
1213 print_debug (vty, DEBUG_LSP_GEN, 0);
1214
1215 return CMD_SUCCESS;
1216 }
1217
1218 DEFUN (debug_isis_lsp_sched,
1219 debug_isis_lsp_sched_cmd,
1220 "debug isis lsp-sched",
1221 DEBUG_STR
1222 "IS-IS information\n"
1223 "IS-IS scheduling of LSP generation\n")
1224 {
1225 isis->debugs |= DEBUG_LSP_SCHED;
1226 print_debug (vty, DEBUG_LSP_SCHED, 1);
1227
1228 return CMD_SUCCESS;
1229 }
1230
1231 DEFUN (no_debug_isis_lsp_sched,
1232 no_debug_isis_lsp_sched_cmd,
1233 "no debug isis lsp-gen",
1234 UNDEBUG_STR
1235 "IS-IS information\n"
1236 "IS-IS scheduling of LSP generation\n")
1237 {
1238 isis->debugs &= ~DEBUG_LSP_SCHED;
1239 print_debug (vty, DEBUG_LSP_SCHED, 0);
1240
1241 return CMD_SUCCESS;
1242 }
1243
1244 DEFUN (show_hostname,
1245 show_hostname_cmd,
1246 "show isis hostname",
1247 SHOW_STR
1248 "IS-IS information\n"
1249 "IS-IS Dynamic hostname mapping\n")
1250 {
1251 dynhn_print_all (vty);
1252
1253 return CMD_SUCCESS;
1254 }
1255
1256 static void
1257 vty_out_timestr(struct vty *vty, time_t uptime)
1258 {
1259 struct tm *tm;
1260 time_t difftime = time (NULL);
1261 difftime -= uptime;
1262 tm = gmtime (&difftime);
1263
1264 #define ONE_DAY_SECOND 60*60*24
1265 #define ONE_WEEK_SECOND 60*60*24*7
1266 if (difftime < ONE_DAY_SECOND)
1267 vty_out (vty, "%02d:%02d:%02d",
1268 tm->tm_hour, tm->tm_min, tm->tm_sec);
1269 else if (difftime < ONE_WEEK_SECOND)
1270 vty_out (vty, "%dd%02dh%02dm",
1271 tm->tm_yday, tm->tm_hour, tm->tm_min);
1272 else
1273 vty_out (vty, "%02dw%dd%02dh",
1274 tm->tm_yday/7,
1275 tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
1276 vty_out (vty, " ago");
1277 }
1278
1279 DEFUN (show_isis_summary,
1280 show_isis_summary_cmd,
1281 "show isis summary",
1282 SHOW_STR "IS-IS information\n" "IS-IS summary\n")
1283 {
1284 struct listnode *node, *node2;
1285 struct isis_area *area;
1286 struct isis_spftree *spftree;
1287 int level;
1288
1289 if (isis == NULL)
1290 {
1291 vty_out (vty, "ISIS is not running%s", VTY_NEWLINE);
1292 return CMD_SUCCESS;
1293 }
1294
1295 vty_out (vty, "Process Id : %ld%s", isis->process_id,
1296 VTY_NEWLINE);
1297 if (isis->sysid_set)
1298 vty_out (vty, "System Id : %s%s", sysid_print (isis->sysid),
1299 VTY_NEWLINE);
1300
1301 vty_out (vty, "Up time : ");
1302 vty_out_timestr(vty, isis->uptime);
1303 vty_out (vty, "%s", VTY_NEWLINE);
1304
1305 if (isis->area_list)
1306 vty_out (vty, "Number of areas : %d%s", isis->area_list->count,
1307 VTY_NEWLINE);
1308
1309 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
1310 {
1311 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
1312 VTY_NEWLINE);
1313
1314 if (listcount (area->area_addrs) > 0)
1315 {
1316 struct area_addr *area_addr;
1317 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
1318 {
1319 vty_out (vty, " Net: %s%s",
1320 isonet_print (area_addr->area_addr,
1321 area_addr->addr_len + ISIS_SYS_ID_LEN +
1322 1), VTY_NEWLINE);
1323 }
1324 }
1325
1326 for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++)
1327 {
1328 if ((area->is_type & level) == 0)
1329 continue;
1330
1331 vty_out (vty, " Level-%d:%s", level, VTY_NEWLINE);
1332 spftree = area->spftree[level - 1];
1333 if (spftree->pending)
1334 vty_out (vty, " IPv4 SPF: (pending)%s", VTY_NEWLINE);
1335 else
1336 vty_out (vty, " IPv4 SPF:%s", VTY_NEWLINE);
1337
1338 vty_out (vty, " minimum interval : %d%s",
1339 area->min_spf_interval[level - 1], VTY_NEWLINE);
1340
1341 vty_out (vty, " last run elapsed : ");
1342 vty_out_timestr(vty, spftree->last_run_timestamp);
1343 vty_out (vty, "%s", VTY_NEWLINE);
1344
1345 vty_out (vty, " last run duration : %u usec%s",
1346 (u_int32_t)spftree->last_run_duration, VTY_NEWLINE);
1347
1348 vty_out (vty, " run count : %d%s",
1349 spftree->runcount, VTY_NEWLINE);
1350
1351 #ifdef HAVE_IPV6
1352 spftree = area->spftree6[level - 1];
1353 if (spftree->pending)
1354 vty_out (vty, " IPv6 SPF: (pending)%s", VTY_NEWLINE);
1355 else
1356 vty_out (vty, " IPv6 SPF:%s", VTY_NEWLINE);
1357
1358 vty_out (vty, " minimum interval : %d%s",
1359 area->min_spf_interval[level - 1], VTY_NEWLINE);
1360
1361 vty_out (vty, " last run elapsed : ");
1362 vty_out_timestr(vty, spftree->last_run_timestamp);
1363 vty_out (vty, "%s", VTY_NEWLINE);
1364
1365 vty_out (vty, " last run duration : %ld msec%s",
1366 spftree->last_run_duration, VTY_NEWLINE);
1367
1368 vty_out (vty, " run count : %d%s",
1369 spftree->runcount, VTY_NEWLINE);
1370 #endif
1371 }
1372 }
1373 vty_out (vty, "%s", VTY_NEWLINE);
1374
1375 return CMD_SUCCESS;
1376 }
1377
1378 /*
1379 * This function supports following display options:
1380 * [ show isis database [detail] ]
1381 * [ show isis database <sysid> [detail] ]
1382 * [ show isis database <hostname> [detail] ]
1383 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1384 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1385 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1386 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1387 * [ show isis database detail <sysid> ]
1388 * [ show isis database detail <hostname> ]
1389 * [ show isis database detail <sysid>.<pseudo-id> ]
1390 * [ show isis database detail <hostname>.<pseudo-id> ]
1391 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1392 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1393 */
1394 static int
1395 show_isis_database (struct vty *vty, const char *argv, int ui_level)
1396 {
1397 struct listnode *node;
1398 struct isis_area *area;
1399 struct isis_lsp *lsp;
1400 struct isis_dynhn *dynhn;
1401 const char *pos = argv;
1402 u_char lspid[ISIS_SYS_ID_LEN+2];
1403 char sysid[255];
1404 u_char number[3];
1405 int level, lsp_count;
1406
1407 if (isis->area_list->count == 0)
1408 return CMD_SUCCESS;
1409
1410 memset (&lspid, 0, ISIS_SYS_ID_LEN);
1411 memset (&sysid, 0, 255);
1412
1413 /*
1414 * extract fragment and pseudo id from the string argv
1415 * in the forms:
1416 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1417 * (b) <systemid/hostname>.<pseudo-id> or
1418 * (c) <systemid/hostname> or
1419 * Where systemid is in the form:
1420 * xxxx.xxxx.xxxx
1421 */
1422 if (argv)
1423 strncpy (sysid, argv, 254);
1424 if (argv && strlen (argv) > 3)
1425 {
1426 pos = argv + strlen (argv) - 3;
1427 if (strncmp (pos, "-", 1) == 0)
1428 {
1429 memcpy (number, ++pos, 2);
1430 lspid[ISIS_SYS_ID_LEN+1] = (u_char) strtol ((char *)number, NULL, 16);
1431 pos -= 4;
1432 if (strncmp (pos, ".", 1) != 0)
1433 return CMD_ERR_AMBIGUOUS;
1434 }
1435 if (strncmp (pos, ".", 1) == 0)
1436 {
1437 memcpy (number, ++pos, 2);
1438 lspid[ISIS_SYS_ID_LEN] = (u_char) strtol ((char *)number, NULL, 16);
1439 sysid[pos - argv - 1] = '\0';
1440 }
1441 }
1442
1443 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
1444 {
1445 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
1446 VTY_NEWLINE);
1447
1448 for (level = 0; level < ISIS_LEVELS; level++)
1449 {
1450 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
1451 {
1452 lsp = NULL;
1453 if (argv != NULL)
1454 {
1455 /*
1456 * Try to find the lsp-id if the argv string is in
1457 * the form hostname.<pseudo-id>-<fragment>
1458 */
1459 if (sysid2buff (lspid, sysid))
1460 {
1461 lsp = lsp_search (lspid, area->lspdb[level]);
1462 }
1463 else if ((dynhn = dynhn_find_by_name (sysid)))
1464 {
1465 memcpy (lspid, dynhn->id, ISIS_SYS_ID_LEN);
1466 lsp = lsp_search (lspid, area->lspdb[level]);
1467 }
1468 else if (strncmp(unix_hostname (), sysid, 15) == 0)
1469 {
1470 memcpy (lspid, isis->sysid, ISIS_SYS_ID_LEN);
1471 lsp = lsp_search (lspid, area->lspdb[level]);
1472 }
1473 }
1474
1475 if (lsp != NULL || argv == NULL)
1476 {
1477 vty_out (vty, "IS-IS Level-%d link-state database:%s",
1478 level + 1, VTY_NEWLINE);
1479
1480 /* print the title in all cases */
1481 vty_out (vty, "LSP ID PduLen "
1482 "SeqNumber Chksum Holdtime ATT/P/OL%s",
1483 VTY_NEWLINE);
1484 }
1485
1486 if (lsp)
1487 {
1488 if (ui_level == ISIS_UI_LEVEL_DETAIL)
1489 lsp_print_detail (lsp, vty, area->dynhostname);
1490 else
1491 lsp_print (lsp, vty, area->dynhostname);
1492 }
1493 else if (argv == NULL)
1494 {
1495 lsp_count = lsp_print_all (vty, area->lspdb[level],
1496 ui_level,
1497 area->dynhostname);
1498
1499 vty_out (vty, " %u LSPs%s%s",
1500 lsp_count, VTY_NEWLINE, VTY_NEWLINE);
1501 }
1502 }
1503 }
1504 }
1505
1506 return CMD_SUCCESS;
1507 }
1508
1509 DEFUN (show_database_brief,
1510 show_database_cmd,
1511 "show isis database",
1512 SHOW_STR
1513 "IS-IS information\n"
1514 "IS-IS link state database\n")
1515 {
1516 return show_isis_database (vty, NULL, ISIS_UI_LEVEL_BRIEF);
1517 }
1518
1519 DEFUN (show_database_lsp_brief,
1520 show_database_arg_cmd,
1521 "show isis database WORD",
1522 SHOW_STR
1523 "IS-IS information\n"
1524 "IS-IS link state database\n"
1525 "LSP ID\n")
1526 {
1527 return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_BRIEF);
1528 }
1529
1530 DEFUN (show_database_lsp_detail,
1531 show_database_arg_detail_cmd,
1532 "show isis database WORD detail",
1533 SHOW_STR
1534 "IS-IS information\n"
1535 "IS-IS link state database\n"
1536 "LSP ID\n"
1537 "Detailed information\n")
1538 {
1539 return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
1540 }
1541
1542 DEFUN (show_database_detail,
1543 show_database_detail_cmd,
1544 "show isis database detail",
1545 SHOW_STR
1546 "IS-IS information\n"
1547 "IS-IS link state database\n")
1548 {
1549 return show_isis_database (vty, NULL, ISIS_UI_LEVEL_DETAIL);
1550 }
1551
1552 DEFUN (show_database_detail_lsp,
1553 show_database_detail_arg_cmd,
1554 "show isis database detail WORD",
1555 SHOW_STR
1556 "IS-IS information\n"
1557 "IS-IS link state database\n"
1558 "Detailed information\n"
1559 "LSP ID\n")
1560 {
1561 return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
1562 }
1563
1564 /*
1565 * 'router isis' command
1566 */
1567 DEFUN (router_isis,
1568 router_isis_cmd,
1569 "router isis WORD",
1570 ROUTER_STR
1571 "ISO IS-IS\n"
1572 "ISO Routing area tag")
1573 {
1574 return isis_area_get (vty, argv[0]);
1575 }
1576
1577 /*
1578 *'no router isis' command
1579 */
1580 DEFUN (no_router_isis,
1581 no_router_isis_cmd,
1582 "no router isis WORD",
1583 "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag")
1584 {
1585 return isis_area_destroy (vty, argv[0]);
1586 }
1587
1588 /*
1589 * 'net' command
1590 */
1591 DEFUN (net,
1592 net_cmd,
1593 "net WORD",
1594 "A Network Entity Title for this process (OSI only)\n"
1595 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1596 {
1597 return area_net_title (vty, argv[0]);
1598 }
1599
1600 /*
1601 * 'no net' command
1602 */
1603 DEFUN (no_net,
1604 no_net_cmd,
1605 "no net WORD",
1606 NO_STR
1607 "A Network Entity Title for this process (OSI only)\n"
1608 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1609 {
1610 return area_clear_net_title (vty, argv[0]);
1611 }
1612
1613 static
1614 int area_set_lsp_mtu(struct vty *vty, struct isis_area *area, unsigned int lsp_mtu)
1615 {
1616 struct isis_circuit *circuit;
1617 struct listnode *node;
1618
1619 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit))
1620 {
1621 if(lsp_mtu > isis_circuit_pdu_size(circuit))
1622 {
1623 vty_out(vty, "ISIS area contains circuit %s, which has a maximum PDU size of %zu.%s",
1624 circuit->interface->name, isis_circuit_pdu_size(circuit),
1625 VTY_NEWLINE);
1626 return CMD_ERR_AMBIGUOUS;
1627 }
1628 }
1629
1630 area->lsp_mtu = lsp_mtu;
1631 lsp_regenerate_schedule(area, IS_LEVEL_1_AND_2, 1);
1632
1633 return CMD_SUCCESS;
1634 }
1635
1636 DEFUN (area_lsp_mtu,
1637 area_lsp_mtu_cmd,
1638 "lsp-mtu <128-4352>",
1639 "Configure the maximum size of generated LSPs\n"
1640 "Maximum size of generated LSPs\n")
1641 {
1642 struct isis_area *area;
1643
1644 area = vty->index;
1645 if (!area)
1646 {
1647 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1648 return CMD_ERR_NO_MATCH;
1649 }
1650
1651 unsigned int lsp_mtu;
1652
1653 VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0], 128, 4352);
1654
1655 return area_set_lsp_mtu(vty, area, lsp_mtu);
1656 }
1657
1658 DEFUN(no_area_lsp_mtu,
1659 no_area_lsp_mtu_cmd,
1660 "no lsp-mtu",
1661 NO_STR
1662 "Configure the maximum size of generated LSPs\n")
1663 {
1664 struct isis_area *area;
1665
1666 area = vty->index;
1667 if (!area)
1668 {
1669 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1670 return CMD_ERR_NO_MATCH;
1671 }
1672
1673 return area_set_lsp_mtu(vty, area, DEFAULT_LSP_MTU);
1674 }
1675
1676 ALIAS(no_area_lsp_mtu,
1677 no_area_lsp_mtu_arg_cmd,
1678 "no lsp-mtu <128-4352>",
1679 NO_STR
1680 "Configure the maximum size of generated LSPs\n"
1681 "Maximum size of generated LSPs\n");
1682
1683 DEFUN (area_passwd_md5,
1684 area_passwd_md5_cmd,
1685 "area-password md5 WORD",
1686 "Configure the authentication password for an area\n"
1687 "Authentication type\n"
1688 "Area password\n")
1689 {
1690 struct isis_area *area;
1691 int len;
1692
1693 area = vty->index;
1694
1695 if (!area)
1696 {
1697 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1698 return CMD_ERR_NO_MATCH;
1699 }
1700
1701 len = strlen (argv[0]);
1702 if (len > 254)
1703 {
1704 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1705 return CMD_ERR_AMBIGUOUS;
1706 }
1707
1708 area->area_passwd.len = (u_char) len;
1709 area->area_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1710 strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
1711
1712 if (argc > 1)
1713 {
1714 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1715 if (strncmp(argv[1], "v", 1) == 0)
1716 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1717 else
1718 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1719 }
1720 else
1721 {
1722 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1723 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1724 }
1725 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1726
1727 return CMD_SUCCESS;
1728 }
1729
1730 ALIAS (area_passwd_md5,
1731 area_passwd_md5_snpauth_cmd,
1732 "area-password md5 WORD authenticate snp (send-only|validate)",
1733 "Configure the authentication password for an area\n"
1734 "Authentication type\n"
1735 "Area password\n"
1736 "Authentication\n"
1737 "SNP PDUs\n"
1738 "Send but do not check PDUs on receiving\n"
1739 "Send and check PDUs on receiving\n");
1740
1741 DEFUN (area_passwd_clear,
1742 area_passwd_clear_cmd,
1743 "area-password clear WORD",
1744 "Configure the authentication password for an area\n"
1745 "Authentication type\n"
1746 "Area password\n")
1747 {
1748 struct isis_area *area;
1749 int len;
1750
1751 area = vty->index;
1752
1753 if (!area)
1754 {
1755 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1756 return CMD_ERR_NO_MATCH;
1757 }
1758
1759 len = strlen (argv[0]);
1760 if (len > 254)
1761 {
1762 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1763 return CMD_ERR_AMBIGUOUS;
1764 }
1765
1766 area->area_passwd.len = (u_char) len;
1767 area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
1768 strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
1769
1770 if (argc > 1)
1771 {
1772 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1773 if (strncmp(argv[1], "v", 1) == 0)
1774 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1775 else
1776 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1777 }
1778 else
1779 {
1780 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1781 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1782 }
1783 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1784
1785 return CMD_SUCCESS;
1786 }
1787
1788 ALIAS (area_passwd_clear,
1789 area_passwd_clear_snpauth_cmd,
1790 "area-password clear WORD authenticate snp (send-only|validate)",
1791 "Configure the authentication password for an area\n"
1792 "Authentication type\n"
1793 "Area password\n"
1794 "Authentication\n"
1795 "SNP PDUs\n"
1796 "Send but do not check PDUs on receiving\n"
1797 "Send and check PDUs on receiving\n");
1798
1799 DEFUN (no_area_passwd,
1800 no_area_passwd_cmd,
1801 "no area-password",
1802 NO_STR
1803 "Configure the authentication password for an area\n")
1804 {
1805 struct isis_area *area;
1806
1807 area = vty->index;
1808
1809 if (!area)
1810 {
1811 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1812 return CMD_ERR_NO_MATCH;
1813 }
1814
1815 memset (&area->area_passwd, 0, sizeof (struct isis_passwd));
1816 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1817
1818 return CMD_SUCCESS;
1819 }
1820
1821 DEFUN (domain_passwd_md5,
1822 domain_passwd_md5_cmd,
1823 "domain-password md5 WORD",
1824 "Set the authentication password for a routing domain\n"
1825 "Authentication type\n"
1826 "Routing domain password\n")
1827 {
1828 struct isis_area *area;
1829 int len;
1830
1831 area = vty->index;
1832
1833 if (!area)
1834 {
1835 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1836 return CMD_ERR_NO_MATCH;
1837 }
1838
1839 len = strlen (argv[0]);
1840 if (len > 254)
1841 {
1842 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1843 return CMD_ERR_AMBIGUOUS;
1844 }
1845
1846 area->domain_passwd.len = (u_char) len;
1847 area->domain_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1848 strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
1849
1850 if (argc > 1)
1851 {
1852 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1853 if (strncmp(argv[1], "v", 1) == 0)
1854 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1855 else
1856 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1857 }
1858 else
1859 {
1860 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1861 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1862 }
1863 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1864
1865 return CMD_SUCCESS;
1866 }
1867
1868 ALIAS (domain_passwd_md5,
1869 domain_passwd_md5_snpauth_cmd,
1870 "domain-password md5 WORD authenticate snp (send-only|validate)",
1871 "Set the authentication password for a routing domain\n"
1872 "Authentication type\n"
1873 "Routing domain password\n"
1874 "Authentication\n"
1875 "SNP PDUs\n"
1876 "Send but do not check PDUs on receiving\n"
1877 "Send and check PDUs on receiving\n");
1878
1879 DEFUN (domain_passwd_clear,
1880 domain_passwd_clear_cmd,
1881 "domain-password clear WORD",
1882 "Set the authentication password for a routing domain\n"
1883 "Authentication type\n"
1884 "Routing domain password\n")
1885 {
1886 struct isis_area *area;
1887 int len;
1888
1889 area = vty->index;
1890
1891 if (!area)
1892 {
1893 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1894 return CMD_ERR_NO_MATCH;
1895 }
1896
1897 len = strlen (argv[0]);
1898 if (len > 254)
1899 {
1900 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1901 return CMD_ERR_AMBIGUOUS;
1902 }
1903
1904 area->domain_passwd.len = (u_char) len;
1905 area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
1906 strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
1907
1908 if (argc > 1)
1909 {
1910 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1911 if (strncmp(argv[1], "v", 1) == 0)
1912 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1913 else
1914 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1915 }
1916 else
1917 {
1918 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1919 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1920 }
1921 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1922
1923 return CMD_SUCCESS;
1924 }
1925
1926 ALIAS (domain_passwd_clear,
1927 domain_passwd_clear_snpauth_cmd,
1928 "domain-password clear WORD authenticate snp (send-only|validate)",
1929 "Set the authentication password for a routing domain\n"
1930 "Authentication type\n"
1931 "Routing domain password\n"
1932 "Authentication\n"
1933 "SNP PDUs\n"
1934 "Send but do not check PDUs on receiving\n"
1935 "Send and check PDUs on receiving\n");
1936
1937 DEFUN (no_domain_passwd,
1938 no_domain_passwd_cmd,
1939 "no domain-password",
1940 NO_STR
1941 "Set the authentication password for a routing domain\n")
1942 {
1943 struct isis_area *area;
1944
1945 area = vty->index;
1946
1947 if (!area)
1948 {
1949 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1950 return CMD_ERR_NO_MATCH;
1951 }
1952
1953 memset (&area->domain_passwd, 0, sizeof (struct isis_passwd));
1954 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1955
1956 return CMD_SUCCESS;
1957 }
1958
1959 DEFUN (is_type,
1960 is_type_cmd,
1961 "is-type (level-1|level-1-2|level-2-only)",
1962 "IS Level for this routing process (OSI only)\n"
1963 "Act as a station router only\n"
1964 "Act as both a station router and an area router\n"
1965 "Act as an area router only\n")
1966 {
1967 struct isis_area *area;
1968 int type;
1969
1970 area = vty->index;
1971
1972 if (!area)
1973 {
1974 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1975 return CMD_ERR_NO_MATCH;
1976 }
1977
1978 type = string2circuit_t (argv[0]);
1979 if (!type)
1980 {
1981 vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
1982 return CMD_SUCCESS;
1983 }
1984
1985 isis_event_system_type_change (area, type);
1986
1987 return CMD_SUCCESS;
1988 }
1989
1990 DEFUN (no_is_type,
1991 no_is_type_cmd,
1992 "no is-type (level-1|level-1-2|level-2-only)",
1993 NO_STR
1994 "IS Level for this routing process (OSI only)\n"
1995 "Act as a station router only\n"
1996 "Act as both a station router and an area router\n"
1997 "Act as an area router only\n")
1998 {
1999 struct isis_area *area;
2000 int type;
2001
2002 area = vty->index;
2003 assert (area);
2004
2005 /*
2006 * Put the is-type back to defaults:
2007 * - level-1-2 on first area
2008 * - level-1 for the rest
2009 */
2010 if (listgetdata (listhead (isis->area_list)) == area)
2011 type = IS_LEVEL_1_AND_2;
2012 else
2013 type = IS_LEVEL_1;
2014
2015 isis_event_system_type_change (area, type);
2016
2017 return CMD_SUCCESS;
2018 }
2019
2020 static int
2021 set_lsp_gen_interval (struct vty *vty, struct isis_area *area,
2022 uint16_t interval, int level)
2023 {
2024 int lvl;
2025
2026 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2027 {
2028 if (!(lvl & level))
2029 continue;
2030
2031 if (interval >= area->lsp_refresh[lvl-1])
2032 {
2033 vty_out (vty, "LSP gen interval %us must be less than "
2034 "the LSP refresh interval %us%s",
2035 interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
2036 return CMD_ERR_AMBIGUOUS;
2037 }
2038 }
2039
2040 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2041 {
2042 if (!(lvl & level))
2043 continue;
2044 area->lsp_gen_interval[lvl-1] = interval;
2045 }
2046
2047 return CMD_SUCCESS;
2048 }
2049
2050 DEFUN (lsp_gen_interval,
2051 lsp_gen_interval_cmd,
2052 "lsp-gen-interval <1-120>",
2053 "Minimum interval between regenerating same LSP\n"
2054 "Minimum interval in seconds\n")
2055 {
2056 struct isis_area *area;
2057 uint16_t interval;
2058 int level;
2059
2060 area = vty->index;
2061 interval = atoi (argv[0]);
2062 level = IS_LEVEL_1 | IS_LEVEL_2;
2063 return set_lsp_gen_interval (vty, area, interval, level);
2064 }
2065
2066 DEFUN (no_lsp_gen_interval,
2067 no_lsp_gen_interval_cmd,
2068 "no lsp-gen-interval",
2069 NO_STR
2070 "Minimum interval between regenerating same LSP\n")
2071 {
2072 struct isis_area *area;
2073 uint16_t interval;
2074 int level;
2075
2076 area = vty->index;
2077 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
2078 level = IS_LEVEL_1 | IS_LEVEL_2;
2079 return set_lsp_gen_interval (vty, area, interval, level);
2080 }
2081
2082 ALIAS (no_lsp_gen_interval,
2083 no_lsp_gen_interval_arg_cmd,
2084 "no lsp-gen-interval <1-120>",
2085 NO_STR
2086 "Minimum interval between regenerating same LSP\n"
2087 "Minimum interval in seconds\n")
2088
2089 DEFUN (lsp_gen_interval_l1,
2090 lsp_gen_interval_l1_cmd,
2091 "lsp-gen-interval level-1 <1-120>",
2092 "Minimum interval between regenerating same LSP\n"
2093 "Set interval for level 1 only\n"
2094 "Minimum interval in seconds\n")
2095 {
2096 struct isis_area *area;
2097 uint16_t interval;
2098 int level;
2099
2100 area = vty->index;
2101 interval = atoi (argv[0]);
2102 level = IS_LEVEL_1;
2103 return set_lsp_gen_interval (vty, area, interval, level);
2104 }
2105
2106 DEFUN (no_lsp_gen_interval_l1,
2107 no_lsp_gen_interval_l1_cmd,
2108 "no lsp-gen-interval level-1",
2109 NO_STR
2110 "Minimum interval between regenerating same LSP\n"
2111 "Set interval for level 1 only\n")
2112 {
2113 struct isis_area *area;
2114 uint16_t interval;
2115 int level;
2116
2117 area = vty->index;
2118 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
2119 level = IS_LEVEL_1;
2120 return set_lsp_gen_interval (vty, area, interval, level);
2121 }
2122
2123 ALIAS (no_lsp_gen_interval_l1,
2124 no_lsp_gen_interval_l1_arg_cmd,
2125 "no lsp-gen-interval level-1 <1-120>",
2126 NO_STR
2127 "Minimum interval between regenerating same LSP\n"
2128 "Set interval for level 1 only\n"
2129 "Minimum interval in seconds\n")
2130
2131 DEFUN (lsp_gen_interval_l2,
2132 lsp_gen_interval_l2_cmd,
2133 "lsp-gen-interval level-2 <1-120>",
2134 "Minimum interval between regenerating same LSP\n"
2135 "Set interval for level 2 only\n"
2136 "Minimum interval in seconds\n")
2137 {
2138 struct isis_area *area;
2139 uint16_t interval;
2140 int level;
2141
2142 area = vty->index;
2143 interval = atoi (argv[0]);
2144 level = IS_LEVEL_2;
2145 return set_lsp_gen_interval (vty, area, interval, level);
2146 }
2147
2148 DEFUN (no_lsp_gen_interval_l2,
2149 no_lsp_gen_interval_l2_cmd,
2150 "no lsp-gen-interval level-2",
2151 NO_STR
2152 "Minimum interval between regenerating same LSP\n"
2153 "Set interval for level 2 only\n")
2154 {
2155 struct isis_area *area;
2156 uint16_t interval;
2157 int level;
2158
2159 area = vty->index;
2160 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
2161 level = IS_LEVEL_2;
2162 return set_lsp_gen_interval (vty, area, interval, level);
2163 }
2164
2165 ALIAS (no_lsp_gen_interval_l2,
2166 no_lsp_gen_interval_l2_arg_cmd,
2167 "no lsp-gen-interval level-2 <1-120>",
2168 NO_STR
2169 "Minimum interval between regenerating same LSP\n"
2170 "Set interval for level 2 only\n"
2171 "Minimum interval in seconds\n")
2172
2173 static int
2174 validate_metric_style_narrow (struct vty *vty, struct isis_area *area)
2175 {
2176 struct isis_circuit *circuit;
2177 struct listnode *node;
2178
2179 if (! vty)
2180 return CMD_ERR_AMBIGUOUS;
2181
2182 if (! area)
2183 {
2184 vty_out (vty, "ISIS area is invalid%s", VTY_NEWLINE);
2185 return CMD_ERR_AMBIGUOUS;
2186 }
2187
2188 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
2189 {
2190 if ((area->is_type & IS_LEVEL_1) &&
2191 (circuit->is_type & IS_LEVEL_1) &&
2192 (circuit->te_metric[0] > MAX_NARROW_LINK_METRIC))
2193 {
2194 vty_out (vty, "ISIS circuit %s metric is invalid%s",
2195 circuit->interface->name, VTY_NEWLINE);
2196 return CMD_ERR_AMBIGUOUS;
2197 }
2198 if ((area->is_type & IS_LEVEL_2) &&
2199 (circuit->is_type & IS_LEVEL_2) &&
2200 (circuit->te_metric[1] > MAX_NARROW_LINK_METRIC))
2201 {
2202 vty_out (vty, "ISIS circuit %s metric is invalid%s",
2203 circuit->interface->name, VTY_NEWLINE);
2204 return CMD_ERR_AMBIGUOUS;
2205 }
2206 }
2207
2208 return CMD_SUCCESS;
2209 }
2210
2211 DEFUN (metric_style,
2212 metric_style_cmd,
2213 "metric-style (narrow|transition|wide)",
2214 "Use old-style (ISO 10589) or new-style packet formats\n"
2215 "Use old style of TLVs with narrow metric\n"
2216 "Send and accept both styles of TLVs during transition\n"
2217 "Use new style of TLVs to carry wider metric\n")
2218 {
2219 struct isis_area *area;
2220 int ret;
2221
2222 area = vty->index;
2223 assert (area);
2224
2225 if (strncmp (argv[0], "w", 1) == 0)
2226 {
2227 area->newmetric = 1;
2228 area->oldmetric = 0;
2229 }
2230 else
2231 {
2232 ret = validate_metric_style_narrow (vty, area);
2233 if (ret != CMD_SUCCESS)
2234 return ret;
2235
2236 if (strncmp (argv[0], "t", 1) == 0)
2237 {
2238 area->newmetric = 1;
2239 area->oldmetric = 1;
2240 }
2241 else if (strncmp (argv[0], "n", 1) == 0)
2242 {
2243 area->newmetric = 0;
2244 area->oldmetric = 1;
2245 }
2246 }
2247
2248 return CMD_SUCCESS;
2249 }
2250
2251 DEFUN (no_metric_style,
2252 no_metric_style_cmd,
2253 "no metric-style",
2254 NO_STR
2255 "Use old-style (ISO 10589) or new-style packet formats\n")
2256 {
2257 struct isis_area *area;
2258 int ret;
2259
2260 area = vty->index;
2261 assert (area);
2262
2263 ret = validate_metric_style_narrow (vty, area);
2264 if (ret != CMD_SUCCESS)
2265 return ret;
2266
2267 /* Default is narrow metric. */
2268 area->newmetric = 0;
2269 area->oldmetric = 1;
2270
2271 return CMD_SUCCESS;
2272 }
2273
2274 DEFUN (set_overload_bit,
2275 set_overload_bit_cmd,
2276 "set-overload-bit",
2277 "Set overload bit to avoid any transit traffic\n"
2278 "Set overload bit\n")
2279 {
2280 struct isis_area *area;
2281
2282 area = vty->index;
2283 assert (area);
2284
2285 area->overload_bit = LSPBIT_OL;
2286 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2287
2288 return CMD_SUCCESS;
2289 }
2290
2291 DEFUN (no_set_overload_bit,
2292 no_set_overload_bit_cmd,
2293 "no set-overload-bit",
2294 "Reset overload bit to accept transit traffic\n"
2295 "Reset overload bit\n")
2296 {
2297 struct isis_area *area;
2298
2299 area = vty->index;
2300 assert (area);
2301
2302 area->overload_bit = 0;
2303 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2304
2305 return CMD_SUCCESS;
2306 }
2307
2308 DEFUN (set_attached_bit,
2309 set_attached_bit_cmd,
2310 "set-attached-bit",
2311 "Set attached bit to identify as L1/L2 router for inter-area traffic\n"
2312 "Set attached bit\n")
2313 {
2314 struct isis_area *area;
2315
2316 area = vty->index;
2317 assert (area);
2318
2319 area->attached_bit = LSPBIT_ATT;
2320 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2321
2322 return CMD_SUCCESS;
2323 }
2324
2325 DEFUN (no_set_attached_bit,
2326 no_set_attached_bit_cmd,
2327 "no set-attached-bit",
2328 "Reset attached bit\n")
2329 {
2330 struct isis_area *area;
2331
2332 area = vty->index;
2333 assert (area);
2334
2335 area->attached_bit = 0;
2336 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2337
2338 return CMD_SUCCESS;
2339 }
2340
2341 DEFUN (dynamic_hostname,
2342 dynamic_hostname_cmd,
2343 "hostname dynamic",
2344 "Dynamic hostname for IS-IS\n"
2345 "Dynamic hostname\n")
2346 {
2347 struct isis_area *area;
2348
2349 area = vty->index;
2350 assert (area);
2351
2352 if (!area->dynhostname)
2353 {
2354 area->dynhostname = 1;
2355 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0);
2356 }
2357
2358 return CMD_SUCCESS;
2359 }
2360
2361 DEFUN (no_dynamic_hostname,
2362 no_dynamic_hostname_cmd,
2363 "no hostname dynamic",
2364 NO_STR
2365 "Dynamic hostname for IS-IS\n"
2366 "Dynamic hostname\n")
2367 {
2368 struct isis_area *area;
2369
2370 area = vty->index;
2371 assert (area);
2372
2373 if (area->dynhostname)
2374 {
2375 area->dynhostname = 0;
2376 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0);
2377 }
2378
2379 return CMD_SUCCESS;
2380 }
2381
2382 DEFUN (spf_interval,
2383 spf_interval_cmd,
2384 "spf-interval <1-120>",
2385 "Minimum interval between SPF calculations\n"
2386 "Minimum interval between consecutive SPFs in seconds\n")
2387 {
2388 struct isis_area *area;
2389 u_int16_t interval;
2390
2391 area = vty->index;
2392 interval = atoi (argv[0]);
2393 area->min_spf_interval[0] = interval;
2394 area->min_spf_interval[1] = interval;
2395
2396 return CMD_SUCCESS;
2397 }
2398
2399 DEFUN (no_spf_interval,
2400 no_spf_interval_cmd,
2401 "no spf-interval",
2402 NO_STR
2403 "Minimum interval between SPF calculations\n")
2404 {
2405 struct isis_area *area;
2406
2407 area = vty->index;
2408
2409 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
2410 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
2411
2412 return CMD_SUCCESS;
2413 }
2414
2415 ALIAS (no_spf_interval,
2416 no_spf_interval_arg_cmd,
2417 "no spf-interval <1-120>",
2418 NO_STR
2419 "Minimum interval between SPF calculations\n"
2420 "Minimum interval between consecutive SPFs in seconds\n")
2421
2422 DEFUN (spf_interval_l1,
2423 spf_interval_l1_cmd,
2424 "spf-interval level-1 <1-120>",
2425 "Minimum interval between SPF calculations\n"
2426 "Set interval for level 1 only\n"
2427 "Minimum interval between consecutive SPFs in seconds\n")
2428 {
2429 struct isis_area *area;
2430 u_int16_t interval;
2431
2432 area = vty->index;
2433 interval = atoi (argv[0]);
2434 area->min_spf_interval[0] = interval;
2435
2436 return CMD_SUCCESS;
2437 }
2438
2439 DEFUN (no_spf_interval_l1,
2440 no_spf_interval_l1_cmd,
2441 "no spf-interval level-1",
2442 NO_STR
2443 "Minimum interval between SPF calculations\n"
2444 "Set interval for level 1 only\n")
2445 {
2446 struct isis_area *area;
2447
2448 area = vty->index;
2449
2450 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
2451
2452 return CMD_SUCCESS;
2453 }
2454
2455 ALIAS (no_spf_interval,
2456 no_spf_interval_l1_arg_cmd,
2457 "no spf-interval level-1 <1-120>",
2458 NO_STR
2459 "Minimum interval between SPF calculations\n"
2460 "Set interval for level 1 only\n"
2461 "Minimum interval between consecutive SPFs in seconds\n")
2462
2463 DEFUN (spf_interval_l2,
2464 spf_interval_l2_cmd,
2465 "spf-interval level-2 <1-120>",
2466 "Minimum interval between SPF calculations\n"
2467 "Set interval for level 2 only\n"
2468 "Minimum interval between consecutive SPFs in seconds\n")
2469 {
2470 struct isis_area *area;
2471 u_int16_t interval;
2472
2473 area = vty->index;
2474 interval = atoi (argv[0]);
2475 area->min_spf_interval[1] = interval;
2476
2477 return CMD_SUCCESS;
2478 }
2479
2480 DEFUN (no_spf_interval_l2,
2481 no_spf_interval_l2_cmd,
2482 "no spf-interval level-2",
2483 NO_STR
2484 "Minimum interval between SPF calculations\n"
2485 "Set interval for level 2 only\n")
2486 {
2487 struct isis_area *area;
2488
2489 area = vty->index;
2490
2491 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
2492
2493 return CMD_SUCCESS;
2494 }
2495
2496 ALIAS (no_spf_interval,
2497 no_spf_interval_l2_arg_cmd,
2498 "no spf-interval level-2 <1-120>",
2499 NO_STR
2500 "Minimum interval between SPF calculations\n"
2501 "Set interval for level 2 only\n"
2502 "Minimum interval between consecutive SPFs in seconds\n")
2503
2504 static int
2505 set_lsp_max_lifetime (struct vty *vty, struct isis_area *area,
2506 uint16_t interval, int level)
2507 {
2508 int lvl;
2509 int set_refresh_interval[ISIS_LEVELS] = {0, 0};
2510 uint16_t refresh_interval;
2511
2512 refresh_interval = interval - 300;
2513
2514 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
2515 {
2516 if (!(lvl & level))
2517 continue;
2518 if (refresh_interval < area->lsp_refresh[lvl-1])
2519 {
2520 vty_out (vty, "Level %d Max LSP lifetime %us must be 300s greater than "
2521 "the configured LSP refresh interval %us%s",
2522 lvl, interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
2523 vty_out (vty, "Automatically reducing level %d LSP refresh interval "
2524 "to %us%s", lvl, refresh_interval, VTY_NEWLINE);
2525 set_refresh_interval[lvl-1] = 1;
2526
2527 if (refresh_interval <= area->lsp_gen_interval[lvl-1])
2528 {
2529 vty_out (vty, "LSP refresh interval %us must be greater than "
2530 "the configured LSP gen interval %us%s",
2531 refresh_interval, area->lsp_gen_interval[lvl-1],
2532 VTY_NEWLINE);
2533 return CMD_ERR_AMBIGUOUS;
2534 }
2535 }
2536 }
2537
2538 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
2539 {
2540 if (!(lvl & level))
2541 continue;
2542 area->max_lsp_lifetime[lvl-1] = interval;
2543 /* Automatically reducing lsp_refresh_interval to interval - 300 */
2544 if (set_refresh_interval[lvl-1])
2545 area->lsp_refresh[lvl-1] = refresh_interval;
2546 }
2547
2548 lsp_regenerate_schedule (area, level, 1);
2549
2550 return CMD_SUCCESS;
2551 }
2552
2553 DEFUN (max_lsp_lifetime,
2554 max_lsp_lifetime_cmd,
2555 "max-lsp-lifetime <350-65535>",
2556 "Maximum LSP lifetime\n"
2557 "LSP lifetime in seconds\n")
2558 {
2559 struct isis_area *area;
2560 uint16_t interval;
2561 int level;
2562
2563 area = vty->index;
2564 interval = atoi (argv[0]);
2565 level = IS_LEVEL_1 | IS_LEVEL_2;
2566 return set_lsp_max_lifetime (vty, area, interval, level);
2567 }
2568
2569 DEFUN (no_max_lsp_lifetime,
2570 no_max_lsp_lifetime_cmd,
2571 "no max-lsp-lifetime",
2572 NO_STR
2573 "LSP lifetime in seconds\n")
2574 {
2575 struct isis_area *area;
2576 uint16_t interval;
2577 int level;
2578
2579 area = vty->index;
2580 interval = DEFAULT_LSP_LIFETIME;
2581 level = IS_LEVEL_1 | IS_LEVEL_2;
2582 return set_lsp_max_lifetime (vty, area, interval, level);
2583 }
2584
2585 ALIAS (no_max_lsp_lifetime,
2586 no_max_lsp_lifetime_arg_cmd,
2587 "no max-lsp-lifetime <350-65535>",
2588 NO_STR
2589 "Maximum LSP lifetime\n"
2590 "LSP lifetime in seconds\n")
2591
2592 DEFUN (max_lsp_lifetime_l1,
2593 max_lsp_lifetime_l1_cmd,
2594 "max-lsp-lifetime level-1 <350-65535>",
2595 "Maximum LSP lifetime for Level 1 only\n"
2596 "LSP lifetime for Level 1 only in seconds\n")
2597 {
2598 struct isis_area *area;
2599 uint16_t interval;
2600 int level;
2601
2602 area = vty->index;
2603 interval = atoi (argv[0]);
2604 level = IS_LEVEL_1;
2605 return set_lsp_max_lifetime (vty, area, interval, level);
2606 }
2607
2608 DEFUN (no_max_lsp_lifetime_l1,
2609 no_max_lsp_lifetime_l1_cmd,
2610 "no max-lsp-lifetime level-1",
2611 NO_STR
2612 "LSP lifetime for Level 1 only in seconds\n")
2613 {
2614 struct isis_area *area;
2615 uint16_t interval;
2616 int level;
2617
2618 area = vty->index;
2619 interval = DEFAULT_LSP_LIFETIME;
2620 level = IS_LEVEL_1;
2621 return set_lsp_max_lifetime (vty, area, interval, level);
2622 }
2623
2624 ALIAS (no_max_lsp_lifetime_l1,
2625 no_max_lsp_lifetime_l1_arg_cmd,
2626 "no max-lsp-lifetime level-1 <350-65535>",
2627 NO_STR
2628 "Maximum LSP lifetime for Level 1 only\n"
2629 "LSP lifetime for Level 1 only in seconds\n")
2630
2631 DEFUN (max_lsp_lifetime_l2,
2632 max_lsp_lifetime_l2_cmd,
2633 "max-lsp-lifetime level-2 <350-65535>",
2634 "Maximum LSP lifetime for Level 2 only\n"
2635 "LSP lifetime for Level 2 only in seconds\n")
2636 {
2637 struct isis_area *area;
2638 uint16_t interval;
2639 int level;
2640
2641 area = vty->index;
2642 interval = atoi (argv[0]);
2643 level = IS_LEVEL_2;
2644 return set_lsp_max_lifetime (vty, area, interval, level);
2645 }
2646
2647 DEFUN (no_max_lsp_lifetime_l2,
2648 no_max_lsp_lifetime_l2_cmd,
2649 "no max-lsp-lifetime level-2",
2650 NO_STR
2651 "LSP lifetime for Level 2 only in seconds\n")
2652 {
2653 struct isis_area *area;
2654 uint16_t interval;
2655 int level;
2656
2657 area = vty->index;
2658 interval = DEFAULT_LSP_LIFETIME;
2659 level = IS_LEVEL_2;
2660 return set_lsp_max_lifetime (vty, area, interval, level);
2661 }
2662
2663 ALIAS (no_max_lsp_lifetime_l2,
2664 no_max_lsp_lifetime_l2_arg_cmd,
2665 "no max-lsp-lifetime level-2 <350-65535>",
2666 NO_STR
2667 "Maximum LSP lifetime for Level 2 only\n"
2668 "LSP lifetime for Level 2 only in seconds\n")
2669
2670 static int
2671 set_lsp_refresh_interval (struct vty *vty, struct isis_area *area,
2672 uint16_t interval, int level)
2673 {
2674 int lvl;
2675
2676 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2677 {
2678 if (!(lvl & level))
2679 continue;
2680 if (interval <= area->lsp_gen_interval[lvl-1])
2681 {
2682 vty_out (vty, "LSP refresh interval %us must be greater than "
2683 "the configured LSP gen interval %us%s",
2684 interval, area->lsp_gen_interval[lvl-1],
2685 VTY_NEWLINE);
2686 return CMD_ERR_AMBIGUOUS;
2687 }
2688 if (interval > (area->max_lsp_lifetime[lvl-1] - 300))
2689 {
2690 vty_out (vty, "LSP refresh interval %us must be less than "
2691 "the configured LSP lifetime %us less 300%s",
2692 interval, area->max_lsp_lifetime[lvl-1],
2693 VTY_NEWLINE);
2694 return CMD_ERR_AMBIGUOUS;
2695 }
2696 }
2697
2698 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2699 {
2700 if (!(lvl & level))
2701 continue;
2702 area->lsp_refresh[lvl-1] = interval;
2703 }
2704 lsp_regenerate_schedule (area, level, 1);
2705
2706 return CMD_SUCCESS;
2707 }
2708
2709 DEFUN (lsp_refresh_interval,
2710 lsp_refresh_interval_cmd,
2711 "lsp-refresh-interval <1-65235>",
2712 "LSP refresh interval\n"
2713 "LSP refresh interval in seconds\n")
2714 {
2715 struct isis_area *area;
2716 uint16_t interval;
2717 int level;
2718
2719 area = vty->index;
2720 interval = atoi (argv[0]);
2721 level = IS_LEVEL_1 | IS_LEVEL_2;
2722 return set_lsp_refresh_interval (vty, area, interval, level);
2723 }
2724
2725 DEFUN (no_lsp_refresh_interval,
2726 no_lsp_refresh_interval_cmd,
2727 "no lsp-refresh-interval",
2728 NO_STR
2729 "LSP refresh interval in seconds\n")
2730 {
2731 struct isis_area *area;
2732 uint16_t interval;
2733 int level;
2734
2735 area = vty->index;
2736 interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
2737 level = IS_LEVEL_1 | IS_LEVEL_2;
2738 return set_lsp_refresh_interval (vty, area, interval, level);
2739 }
2740
2741 ALIAS (no_lsp_refresh_interval,
2742 no_lsp_refresh_interval_arg_cmd,
2743 "no lsp-refresh-interval <1-65235>",
2744 NO_STR
2745 "LSP refresh interval\n"
2746 "LSP refresh interval in seconds\n")
2747
2748 DEFUN (lsp_refresh_interval_l1,
2749 lsp_refresh_interval_l1_cmd,
2750 "lsp-refresh-interval level-1 <1-65235>",
2751 "LSP refresh interval for Level 1 only\n"
2752 "LSP refresh interval for Level 1 only in seconds\n")
2753 {
2754 struct isis_area *area;
2755 uint16_t interval;
2756 int level;
2757
2758 area = vty->index;
2759 interval = atoi (argv[0]);
2760 level = IS_LEVEL_1;
2761 return set_lsp_refresh_interval (vty, area, interval, level);
2762 }
2763
2764 DEFUN (no_lsp_refresh_interval_l1,
2765 no_lsp_refresh_interval_l1_cmd,
2766 "no lsp-refresh-interval level-1",
2767 NO_STR
2768 "LSP refresh interval for Level 1 only in seconds\n")
2769 {
2770 struct isis_area *area;
2771 uint16_t interval;
2772 int level;
2773
2774 area = vty->index;
2775 interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
2776 level = IS_LEVEL_1;
2777 return set_lsp_refresh_interval (vty, area, interval, level);
2778 }
2779
2780 ALIAS (no_lsp_refresh_interval_l1,
2781 no_lsp_refresh_interval_l1_arg_cmd,
2782 "no lsp-refresh-interval level-1 <1-65235>",
2783 NO_STR
2784 "LSP refresh interval for Level 1 only\n"
2785 "LSP refresh interval for Level 1 only in seconds\n")
2786
2787 DEFUN (lsp_refresh_interval_l2,
2788 lsp_refresh_interval_l2_cmd,
2789 "lsp-refresh-interval level-2 <1-65235>",
2790 "LSP refresh interval for Level 2 only\n"
2791 "LSP refresh interval for Level 2 only in seconds\n")
2792 {
2793 struct isis_area *area;
2794 uint16_t interval;
2795 int level;
2796
2797 area = vty->index;
2798 interval = atoi (argv[0]);
2799 level = IS_LEVEL_2;
2800 return set_lsp_refresh_interval (vty, area, interval, level);
2801 }
2802
2803 DEFUN (no_lsp_refresh_interval_l2,
2804 no_lsp_refresh_interval_l2_cmd,
2805 "no lsp-refresh-interval level-2",
2806 NO_STR
2807 "LSP refresh interval for Level 2 only in seconds\n")
2808 {
2809 struct isis_area *area;
2810 uint16_t interval;
2811 int level;
2812
2813 area = vty->index;
2814 interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
2815 level = IS_LEVEL_2;
2816 return set_lsp_refresh_interval (vty, area, interval, level);
2817 }
2818
2819 ALIAS (no_lsp_refresh_interval_l2,
2820 no_lsp_refresh_interval_l2_arg_cmd,
2821 "no lsp-refresh-interval level-2 <1-65235>",
2822 NO_STR
2823 "LSP refresh interval for Level 2 only\n"
2824 "LSP refresh interval for Level 2 only in seconds\n")
2825
2826 DEFUN (log_adj_changes,
2827 log_adj_changes_cmd,
2828 "log-adjacency-changes",
2829 "Log changes in adjacency state\n")
2830 {
2831 struct isis_area *area;
2832
2833 area = vty->index;
2834 assert (area);
2835
2836 area->log_adj_changes = 1;
2837
2838 return CMD_SUCCESS;
2839 }
2840
2841 DEFUN (no_log_adj_changes,
2842 no_log_adj_changes_cmd,
2843 "no log-adjacency-changes",
2844 "Stop logging changes in adjacency state\n")
2845 {
2846 struct isis_area *area;
2847
2848 area = vty->index;
2849 assert (area);
2850
2851 area->log_adj_changes = 0;
2852
2853 return CMD_SUCCESS;
2854 }
2855
2856 #ifdef TOPOLOGY_GENERATE
2857
2858 DEFUN (topology_generate_grid,
2859 topology_generate_grid_cmd,
2860 "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "
2861 "[param]",
2862 "Topology generation for IS-IS\n"
2863 "Topology generation\n"
2864 "Grid topology\n"
2865 "X parameter of the grid\n"
2866 "Y parameter of the grid\n"
2867 "Random seed\n"
2868 "Optional param 1\n"
2869 "Optional param 2\n"
2870 "Optional param 3\n"
2871 "Topology\n")
2872 {
2873 struct isis_area *area;
2874
2875 area = vty->index;
2876 assert (area);
2877
2878 if (!spgrid_check_params (vty, argc, argv))
2879 {
2880 if (area->topology)
2881 list_delete (area->topology);
2882 area->topology = list_new ();
2883 memcpy (area->top_params, vty->buf, 200);
2884 gen_spgrid_topology (vty, area->topology);
2885 remove_topology_lsps (area);
2886 generate_topology_lsps (area);
2887 /* Regenerate L1 LSP to get two way connection to the generated
2888 * topology. */
2889 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2890 }
2891
2892 return CMD_SUCCESS;
2893 }
2894
2895 DEFUN (show_isis_generated_topology,
2896 show_isis_generated_topology_cmd,
2897 "show isis generated-topologies",
2898 SHOW_STR
2899 "ISIS network information\n"
2900 "Show generated topologies\n")
2901 {
2902 struct isis_area *area;
2903 struct listnode *node;
2904 struct listnode *node2;
2905 struct arc *arc;
2906
2907 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
2908 {
2909 if (!area->topology)
2910 continue;
2911
2912 vty_out (vty, "Topology for isis area: %s%s", area->area_tag,
2913 VTY_NEWLINE);
2914 vty_out (vty, "From node To node Distance%s", VTY_NEWLINE);
2915
2916 for (ALL_LIST_ELEMENTS_RO (area->topology, node2, arc))
2917 vty_out (vty, "%9ld %11ld %12ld%s", arc->from_node, arc->to_node,
2918 arc->distance, VTY_NEWLINE);
2919 }
2920 return CMD_SUCCESS;
2921 }
2922
2923 /* Base IS for topology generation. */
2924 DEFUN (topology_baseis,
2925 topology_baseis_cmd,
2926 "topology base-is WORD",
2927 "Topology generation for IS-IS\n"
2928 "A Network IS Base for this topology\n"
2929 "XXXX.XXXX.XXXX Network entity title (NET)\n")
2930 {
2931 struct isis_area *area;
2932 u_char buff[ISIS_SYS_ID_LEN];
2933
2934 area = vty->index;
2935 assert (area);
2936
2937 if (sysid2buff (buff, argv[0]))
2938 sysid2buff (area->topology_baseis, argv[0]);
2939
2940 return CMD_SUCCESS;
2941 }
2942
2943 DEFUN (no_topology_baseis,
2944 no_topology_baseis_cmd,
2945 "no topology base-is WORD",
2946 NO_STR
2947 "Topology generation for IS-IS\n"
2948 "A Network IS Base for this topology\n"
2949 "XXXX.XXXX.XXXX Network entity title (NET)\n")
2950 {
2951 struct isis_area *area;
2952
2953 area = vty->index;
2954 assert (area);
2955
2956 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
2957 return CMD_SUCCESS;
2958 }
2959
2960 ALIAS (no_topology_baseis,
2961 no_topology_baseis_noid_cmd,
2962 "no topology base-is",
2963 NO_STR
2964 "Topology generation for IS-IS\n"
2965 "A Network IS Base for this topology\n")
2966
2967 DEFUN (topology_basedynh,
2968 topology_basedynh_cmd,
2969 "topology base-dynh WORD",
2970 "Topology generation for IS-IS\n"
2971 "Dynamic hostname base for this topology\n"
2972 "Dynamic hostname base\n")
2973 {
2974 struct isis_area *area;
2975
2976 area = vty->index;
2977 assert (area);
2978
2979 /* I hope that it's enough. */
2980 area->topology_basedynh = strndup (argv[0], 16);
2981 return CMD_SUCCESS;
2982 }
2983
2984 #endif /* TOPOLOGY_GENERATE */
2985
2986 /* IS-IS configuration write function */
2987 int
2988 isis_config_write (struct vty *vty)
2989 {
2990 int write = 0;
2991
2992 if (isis != NULL)
2993 {
2994 struct isis_area *area;
2995 struct listnode *node, *node2;
2996
2997 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
2998 {
2999 /* ISIS - Area name */
3000 vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE);
3001 write++;
3002 /* ISIS - Net */
3003 if (listcount (area->area_addrs) > 0)
3004 {
3005 struct area_addr *area_addr;
3006 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
3007 {
3008 vty_out (vty, " net %s%s",
3009 isonet_print (area_addr->area_addr,
3010 area_addr->addr_len + ISIS_SYS_ID_LEN +
3011 1), VTY_NEWLINE);
3012 write++;
3013 }
3014 }
3015 /* ISIS - Dynamic hostname - Defaults to true so only display if
3016 * false. */
3017 if (!area->dynhostname)
3018 {
3019 vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);
3020 write++;
3021 }
3022 /* ISIS - Metric-Style - when true displays wide */
3023 if (area->newmetric)
3024 {
3025 if (!area->oldmetric)
3026 vty_out (vty, " metric-style wide%s", VTY_NEWLINE);
3027 else
3028 vty_out (vty, " metric-style transition%s", VTY_NEWLINE);
3029 write++;
3030 }
3031 else
3032 {
3033 vty_out (vty, " metric-style narrow%s", VTY_NEWLINE);
3034 write++;
3035 }
3036 /* ISIS - overload-bit */
3037 if (area->overload_bit)
3038 {
3039 vty_out (vty, " set-overload-bit%s", VTY_NEWLINE);
3040 write++;
3041 }
3042 /* ISIS - Area is-type (level-1-2 is default) */
3043 if (area->is_type == IS_LEVEL_1)
3044 {
3045 vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
3046 write++;
3047 }
3048 else if (area->is_type == IS_LEVEL_2)
3049 {
3050 vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
3051 write++;
3052 }
3053 /* ISIS - Lsp generation interval */
3054 if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1])
3055 {
3056 if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
3057 {
3058 vty_out (vty, " lsp-gen-interval %d%s",
3059 area->lsp_gen_interval[0], VTY_NEWLINE);
3060 write++;
3061 }
3062 }
3063 else
3064 {
3065 if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
3066 {
3067 vty_out (vty, " lsp-gen-interval level-1 %d%s",
3068 area->lsp_gen_interval[0], VTY_NEWLINE);
3069 write++;
3070 }
3071 if (area->lsp_gen_interval[1] != DEFAULT_MIN_LSP_GEN_INTERVAL)
3072 {
3073 vty_out (vty, " lsp-gen-interval level-2 %d%s",
3074 area->lsp_gen_interval[1], VTY_NEWLINE);
3075 write++;
3076 }
3077 }
3078 /* ISIS - LSP lifetime */
3079 if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1])
3080 {
3081 if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
3082 {
3083 vty_out (vty, " max-lsp-lifetime %u%s", area->max_lsp_lifetime[0],
3084 VTY_NEWLINE);
3085 write++;
3086 }
3087 }
3088 else
3089 {
3090 if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
3091 {
3092 vty_out (vty, " max-lsp-lifetime level-1 %u%s",
3093 area->max_lsp_lifetime[0], VTY_NEWLINE);
3094 write++;
3095 }
3096 if (area->max_lsp_lifetime[1] != DEFAULT_LSP_LIFETIME)
3097 {
3098 vty_out (vty, " max-lsp-lifetime level-2 %u%s",
3099 area->max_lsp_lifetime[1], VTY_NEWLINE);
3100 write++;
3101 }
3102 }
3103 /* ISIS - LSP refresh interval */
3104 if (area->lsp_refresh[0] == area->lsp_refresh[1])
3105 {
3106 if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
3107 {
3108 vty_out (vty, " lsp-refresh-interval %u%s", area->lsp_refresh[0],
3109 VTY_NEWLINE);
3110 write++;
3111 }
3112 }
3113 else
3114 {
3115 if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
3116 {
3117 vty_out (vty, " lsp-refresh-interval level-1 %u%s",
3118 area->lsp_refresh[0], VTY_NEWLINE);
3119 write++;
3120 }
3121 if (area->lsp_refresh[1] != DEFAULT_MAX_LSP_GEN_INTERVAL)
3122 {
3123 vty_out (vty, " lsp-refresh-interval level-2 %u%s",
3124 area->lsp_refresh[1], VTY_NEWLINE);
3125 write++;
3126 }
3127 }
3128 if (area->lsp_mtu != DEFAULT_LSP_MTU)
3129 {
3130 vty_out(vty, " lsp-mtu %u%s", area->lsp_mtu, VTY_NEWLINE);
3131 write++;
3132 }
3133
3134 /* Minimum SPF interval. */
3135 if (area->min_spf_interval[0] == area->min_spf_interval[1])
3136 {
3137 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
3138 {
3139 vty_out (vty, " spf-interval %d%s",
3140 area->min_spf_interval[0], VTY_NEWLINE);
3141 write++;
3142 }
3143 }
3144 else
3145 {
3146 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
3147 {
3148 vty_out (vty, " spf-interval level-1 %d%s",
3149 area->min_spf_interval[0], VTY_NEWLINE);
3150 write++;
3151 }
3152 if (area->min_spf_interval[1] != MINIMUM_SPF_INTERVAL)
3153 {
3154 vty_out (vty, " spf-interval level-2 %d%s",
3155 area->min_spf_interval[1], VTY_NEWLINE);
3156 write++;
3157 }
3158 }
3159 /* Authentication passwords. */
3160 if (area->area_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
3161 {
3162 vty_out(vty, " area-password md5 %s", area->area_passwd.passwd);
3163 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
3164 {
3165 vty_out(vty, " authenticate snp ");
3166 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
3167 vty_out(vty, "validate");
3168 else
3169 vty_out(vty, "send-only");
3170 }
3171 vty_out(vty, "%s", VTY_NEWLINE);
3172 write++;
3173 }
3174 else if (area->area_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
3175 {
3176 vty_out(vty, " area-password clear %s", area->area_passwd.passwd);
3177 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
3178 {
3179 vty_out(vty, " authenticate snp ");
3180 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
3181 vty_out(vty, "validate");
3182 else
3183 vty_out(vty, "send-only");
3184 }
3185 vty_out(vty, "%s", VTY_NEWLINE);
3186 write++;
3187 }
3188 if (area->domain_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
3189 {
3190 vty_out(vty, " domain-password md5 %s",
3191 area->domain_passwd.passwd);
3192 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
3193 {
3194 vty_out(vty, " authenticate snp ");
3195 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
3196 vty_out(vty, "validate");
3197 else
3198 vty_out(vty, "send-only");
3199 }
3200 vty_out(vty, "%s", VTY_NEWLINE);
3201 write++;
3202 }
3203 else if (area->domain_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
3204 {
3205 vty_out(vty, " domain-password clear %s",
3206 area->domain_passwd.passwd);
3207 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
3208 {
3209 vty_out(vty, " authenticate snp ");
3210 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
3211 vty_out(vty, "validate");
3212 else
3213 vty_out(vty, "send-only");
3214 }
3215 vty_out(vty, "%s", VTY_NEWLINE);
3216 write++;
3217 }
3218
3219 if (area->log_adj_changes)
3220 {
3221 vty_out (vty, " log-adjacency-changes%s", VTY_NEWLINE);
3222 write++;
3223 }
3224
3225 #ifdef TOPOLOGY_GENERATE
3226 if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,
3227 ISIS_SYS_ID_LEN))
3228 {
3229 vty_out (vty, " topology base-is %s%s",
3230 sysid_print ((u_char *)area->topology_baseis), VTY_NEWLINE);
3231 write++;
3232 }
3233 if (area->topology_basedynh)
3234 {
3235 vty_out (vty, " topology base-dynh %s%s",
3236 area->topology_basedynh, VTY_NEWLINE);
3237 write++;
3238 }
3239 /* We save the whole command line here. */
3240 if (strlen(area->top_params))
3241 {
3242 vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE);
3243 write++;
3244 }
3245 #endif /* TOPOLOGY_GENERATE */
3246
3247 }
3248 }
3249
3250 return write;
3251 }
3252
3253 struct cmd_node isis_node = {
3254 ISIS_NODE,
3255 "%s(config-router)# ",
3256 1
3257 };
3258
3259 void
3260 isis_init ()
3261 {
3262 /* Install IS-IS top node */
3263 install_node (&isis_node, isis_config_write);
3264
3265 install_element (VIEW_NODE, &show_isis_summary_cmd);
3266
3267 install_element (VIEW_NODE, &show_isis_interface_cmd);
3268 install_element (VIEW_NODE, &show_isis_interface_detail_cmd);
3269 install_element (VIEW_NODE, &show_isis_interface_arg_cmd);
3270
3271 install_element (VIEW_NODE, &show_isis_neighbor_cmd);
3272 install_element (VIEW_NODE, &show_isis_neighbor_detail_cmd);
3273 install_element (VIEW_NODE, &show_isis_neighbor_arg_cmd);
3274 install_element (VIEW_NODE, &clear_isis_neighbor_cmd);
3275 install_element (VIEW_NODE, &clear_isis_neighbor_arg_cmd);
3276
3277 install_element (VIEW_NODE, &show_hostname_cmd);
3278 install_element (VIEW_NODE, &show_database_cmd);
3279 install_element (VIEW_NODE, &show_database_arg_cmd);
3280 install_element (VIEW_NODE, &show_database_arg_detail_cmd);
3281 install_element (VIEW_NODE, &show_database_detail_cmd);
3282 install_element (VIEW_NODE, &show_database_detail_arg_cmd);
3283
3284 install_element (ENABLE_NODE, &show_isis_summary_cmd);
3285
3286 install_element (ENABLE_NODE, &show_isis_interface_cmd);
3287 install_element (ENABLE_NODE, &show_isis_interface_detail_cmd);
3288 install_element (ENABLE_NODE, &show_isis_interface_arg_cmd);
3289
3290 install_element (ENABLE_NODE, &show_isis_neighbor_cmd);
3291 install_element (ENABLE_NODE, &show_isis_neighbor_detail_cmd);
3292 install_element (ENABLE_NODE, &show_isis_neighbor_arg_cmd);
3293 install_element (ENABLE_NODE, &clear_isis_neighbor_cmd);
3294 install_element (ENABLE_NODE, &clear_isis_neighbor_arg_cmd);
3295
3296 install_element (ENABLE_NODE, &show_hostname_cmd);
3297 install_element (ENABLE_NODE, &show_database_cmd);
3298 install_element (ENABLE_NODE, &show_database_arg_cmd);
3299 install_element (ENABLE_NODE, &show_database_arg_detail_cmd);
3300 install_element (ENABLE_NODE, &show_database_detail_cmd);
3301 install_element (ENABLE_NODE, &show_database_detail_arg_cmd);
3302 install_element (ENABLE_NODE, &show_debugging_cmd);
3303
3304 install_node (&debug_node, config_write_debug);
3305
3306 install_element (ENABLE_NODE, &debug_isis_adj_cmd);
3307 install_element (ENABLE_NODE, &no_debug_isis_adj_cmd);
3308 install_element (ENABLE_NODE, &debug_isis_csum_cmd);
3309 install_element (ENABLE_NODE, &no_debug_isis_csum_cmd);
3310 install_element (ENABLE_NODE, &debug_isis_lupd_cmd);
3311 install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd);
3312 install_element (ENABLE_NODE, &debug_isis_err_cmd);
3313 install_element (ENABLE_NODE, &no_debug_isis_err_cmd);
3314 install_element (ENABLE_NODE, &debug_isis_snp_cmd);
3315 install_element (ENABLE_NODE, &no_debug_isis_snp_cmd);
3316 install_element (ENABLE_NODE, &debug_isis_upd_cmd);
3317 install_element (ENABLE_NODE, &no_debug_isis_upd_cmd);
3318 install_element (ENABLE_NODE, &debug_isis_spfevents_cmd);
3319 install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd);
3320 install_element (ENABLE_NODE, &debug_isis_spfstats_cmd);
3321 install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd);
3322 install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd);
3323 install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd);
3324 install_element (ENABLE_NODE, &debug_isis_rtevents_cmd);
3325 install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);
3326 install_element (ENABLE_NODE, &debug_isis_events_cmd);
3327 install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
3328 install_element (ENABLE_NODE, &debug_isis_packet_dump_cmd);
3329 install_element (ENABLE_NODE, &no_debug_isis_packet_dump_cmd);
3330 install_element (ENABLE_NODE, &debug_isis_lsp_gen_cmd);
3331 install_element (ENABLE_NODE, &no_debug_isis_lsp_gen_cmd);
3332 install_element (ENABLE_NODE, &debug_isis_lsp_sched_cmd);
3333 install_element (ENABLE_NODE, &no_debug_isis_lsp_sched_cmd);
3334
3335 install_element (CONFIG_NODE, &debug_isis_adj_cmd);
3336 install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);
3337 install_element (CONFIG_NODE, &debug_isis_csum_cmd);
3338 install_element (CONFIG_NODE, &no_debug_isis_csum_cmd);
3339 install_element (CONFIG_NODE, &debug_isis_lupd_cmd);
3340 install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd);
3341 install_element (CONFIG_NODE, &debug_isis_err_cmd);
3342 install_element (CONFIG_NODE, &no_debug_isis_err_cmd);
3343 install_element (CONFIG_NODE, &debug_isis_snp_cmd);
3344 install_element (CONFIG_NODE, &no_debug_isis_snp_cmd);
3345 install_element (CONFIG_NODE, &debug_isis_upd_cmd);
3346 install_element (CONFIG_NODE, &no_debug_isis_upd_cmd);
3347 install_element (CONFIG_NODE, &debug_isis_spfevents_cmd);
3348 install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd);
3349 install_element (CONFIG_NODE, &debug_isis_spfstats_cmd);
3350 install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd);
3351 install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd);
3352 install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd);
3353 install_element (CONFIG_NODE, &debug_isis_rtevents_cmd);
3354 install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);
3355 install_element (CONFIG_NODE, &debug_isis_events_cmd);
3356 install_element (CONFIG_NODE, &no_debug_isis_events_cmd);
3357 install_element (CONFIG_NODE, &debug_isis_packet_dump_cmd);
3358 install_element (CONFIG_NODE, &no_debug_isis_packet_dump_cmd);
3359 install_element (CONFIG_NODE, &debug_isis_lsp_gen_cmd);
3360 install_element (CONFIG_NODE, &no_debug_isis_lsp_gen_cmd);
3361 install_element (CONFIG_NODE, &debug_isis_lsp_sched_cmd);
3362 install_element (CONFIG_NODE, &no_debug_isis_lsp_sched_cmd);
3363
3364 install_element (CONFIG_NODE, &router_isis_cmd);
3365 install_element (CONFIG_NODE, &no_router_isis_cmd);
3366
3367 install_default (ISIS_NODE);
3368
3369 install_element (ISIS_NODE, &net_cmd);
3370 install_element (ISIS_NODE, &no_net_cmd);
3371
3372 install_element (ISIS_NODE, &is_type_cmd);
3373 install_element (ISIS_NODE, &no_is_type_cmd);
3374
3375 install_element (ISIS_NODE, &area_lsp_mtu_cmd);
3376 install_element (ISIS_NODE, &no_area_lsp_mtu_cmd);
3377 install_element (ISIS_NODE, &no_area_lsp_mtu_arg_cmd);
3378
3379 install_element (ISIS_NODE, &area_passwd_md5_cmd);
3380 install_element (ISIS_NODE, &area_passwd_md5_snpauth_cmd);
3381 install_element (ISIS_NODE, &area_passwd_clear_cmd);
3382 install_element (ISIS_NODE, &area_passwd_clear_snpauth_cmd);
3383 install_element (ISIS_NODE, &no_area_passwd_cmd);
3384
3385 install_element (ISIS_NODE, &domain_passwd_md5_cmd);
3386 install_element (ISIS_NODE, &domain_passwd_md5_snpauth_cmd);
3387 install_element (ISIS_NODE, &domain_passwd_clear_cmd);
3388 install_element (ISIS_NODE, &domain_passwd_clear_snpauth_cmd);
3389 install_element (ISIS_NODE, &no_domain_passwd_cmd);
3390
3391 install_element (ISIS_NODE, &lsp_gen_interval_cmd);
3392 install_element (ISIS_NODE, &no_lsp_gen_interval_cmd);
3393 install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd);
3394 install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd);
3395 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd);
3396 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd);
3397 install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd);
3398 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd);
3399 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd);
3400
3401 install_element (ISIS_NODE, &spf_interval_cmd);
3402 install_element (ISIS_NODE, &no_spf_interval_cmd);
3403 install_element (ISIS_NODE, &no_spf_interval_arg_cmd);
3404 install_element (ISIS_NODE, &spf_interval_l1_cmd);
3405 install_element (ISIS_NODE, &no_spf_interval_l1_cmd);
3406 install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd);
3407 install_element (ISIS_NODE, &spf_interval_l2_cmd);
3408 install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
3409 install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
3410
3411 install_element (ISIS_NODE, &max_lsp_lifetime_cmd);
3412 install_element (ISIS_NODE, &no_max_lsp_lifetime_cmd);
3413 install_element (ISIS_NODE, &no_max_lsp_lifetime_arg_cmd);
3414 install_element (ISIS_NODE, &max_lsp_lifetime_l1_cmd);
3415 install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_cmd);
3416 install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_arg_cmd);
3417 install_element (ISIS_NODE, &max_lsp_lifetime_l2_cmd);
3418 install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_cmd);
3419 install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_arg_cmd);
3420
3421 install_element (ISIS_NODE, &lsp_refresh_interval_cmd);
3422 install_element (ISIS_NODE, &no_lsp_refresh_interval_cmd);
3423 install_element (ISIS_NODE, &no_lsp_refresh_interval_arg_cmd);
3424 install_element (ISIS_NODE, &lsp_refresh_interval_l1_cmd);
3425 install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_cmd);
3426 install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_arg_cmd);
3427 install_element (ISIS_NODE, &lsp_refresh_interval_l2_cmd);
3428 install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_cmd);
3429 install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_arg_cmd);
3430
3431 install_element (ISIS_NODE, &set_overload_bit_cmd);
3432 install_element (ISIS_NODE, &no_set_overload_bit_cmd);
3433
3434 install_element (ISIS_NODE, &set_attached_bit_cmd);
3435 install_element (ISIS_NODE, &no_set_attached_bit_cmd);
3436
3437 install_element (ISIS_NODE, &dynamic_hostname_cmd);
3438 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
3439
3440 install_element (ISIS_NODE, &metric_style_cmd);
3441 install_element (ISIS_NODE, &no_metric_style_cmd);
3442
3443 install_element (ISIS_NODE, &log_adj_changes_cmd);
3444 install_element (ISIS_NODE, &no_log_adj_changes_cmd);
3445
3446 #ifdef TOPOLOGY_GENERATE
3447 install_element (ISIS_NODE, &topology_generate_grid_cmd);
3448 install_element (ISIS_NODE, &topology_baseis_cmd);
3449 install_element (ISIS_NODE, &topology_basedynh_cmd);
3450 install_element (ISIS_NODE, &no_topology_baseis_cmd);
3451 install_element (ISIS_NODE, &no_topology_baseis_noid_cmd);
3452 install_element (VIEW_NODE, &show_isis_generated_topology_cmd);
3453 install_element (ENABLE_NODE, &show_isis_generated_topology_cmd);
3454 #endif /* TOPOLOGY_GENERATE */
3455 }