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