blob: 8794a12cc862eb46051c4f9dfa3f345aa72d3098 [file] [log] [blame]
jardineb5d44e2003-12-23 08:09:43 +00001/*
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 <string.h>
24#include <zebra.h>
25#include <net/ethernet.h>
26
27#include "thread.h"
28#include "vty.h"
29#include "command.h"
30#include "log.h"
31#include "memory.h"
32#include "linklist.h"
33#include "if.h"
34#include "hash.h"
35#include "stream.h"
36#include "prefix.h"
37#include "table.h"
38
39#include "isisd/dict.h"
40#include "isisd/include-netbsd/iso.h"
41#include "isisd/isis_constants.h"
42#include "isisd/isis_common.h"
43#include "isisd/isis_circuit.h"
44#include "isisd/isis_flags.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"
60u_char DEFAULT_TOPOLOGY_BASEIS[6] = {0xFE, 0xED, 0xFE, 0xED, 0x00, 0x00};
61#endif /* TOPOLOGY_GENERATE */
62
63
64struct isis *isis = NULL;
65struct thread_master *master;
66
67
68void
69isis_new (unsigned long process_id)
70{
71
72 isis = XMALLOC (MTYPE_ISIS, sizeof(struct isis));
73 bzero (isis, sizeof (struct isis));
74 /*
75 * Default values
76 */
77 isis->max_area_addrs = 3;
78
79 isis->process_id = process_id;
80 isis->area_list = list_new ();
81 isis->init_circ_list = list_new ();
82 isis->uptime = time (NULL);
83 isis->nexthops = list_new ();
84#ifdef HAVE_IPV6
85 isis->nexthops6 = list_new ();
86#endif /* HAVE_IPV6 */
87 /*
88 * uncomment the next line for full debugs
89 */
90 /* isis->debugs = 0xFFFF; */
91}
92
93struct isis_area *
94isis_area_create ()
95{
96
97 struct isis_area *area;
98
99 area = XMALLOC (MTYPE_ISIS_AREA, sizeof (struct isis_area));
100 memset (area, 0, sizeof (struct isis_area));
101
102 /*
103 * The first instance is level-1-2 rest are level-1, unless otherwise
104 * configured
105 */
106 if (listcount (isis->area_list) > 0)
107 area->is_type = IS_LEVEL_1;
108 else
109 area->is_type = IS_LEVEL_1_AND_2;
110 /*
111 * intialize the databases
112 */
113 area->lspdb[0] = lsp_db_init ();
114 area->lspdb[1] = lsp_db_init ();
115
116 spftree_area_init (area);
117 area->route_table = route_table_init ();
118#ifdef HAVE_IPV6
119 area->route_table6 = route_table_init ();
120#endif /* HAVE_IPV6 */
121 area->circuit_list = list_new ();
122 area->area_addrs = list_new ();
123 area->t_tick = thread_add_timer (master, lsp_tick, area, 1);
124 area->flags.maxindex = -1;
125 /*
126 * Default values
127 */
128 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200 */
129 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200 */
130 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
131 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
132 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900 */
133 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900 */
134 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
135 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
136 area->dynhostname = 1;
137 area->lsp_frag_threshold = 90;
138#ifdef TOPOLOGY_GENERATE
139 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
140#endif /* TOPOLOGY_GENERATE */
141
142 /* FIXME: Think of a better way... */
143 area->min_bcast_mtu = 1497;
144
145 return area;
146}
147
148struct isis_area *
149isis_area_lookup (char *area_tag)
150{
151 struct isis_area *area;
152 struct listnode *node;
153
154 LIST_LOOP (isis->area_list, area, node)
155 if ((area->area_tag == NULL && area_tag == NULL) ||
156 (area->area_tag && area_tag && strcmp (area->area_tag, area_tag) == 0))
157 return area;
158
159 return NULL;
160}
161
162int
163isis_area_get (struct vty *vty, char *area_tag)
164{
165
166 struct isis_area *area;
167
168 area = isis_area_lookup (area_tag);
169
170 if (area) {
171 vty->node = ISIS_NODE;
172 vty->index = area;
173 return CMD_SUCCESS;
174 }
175
176 area = isis_area_create ();
177 area->area_tag = strdup (area_tag);
178 listnode_add (isis->area_list, area);
179
180 zlog_info ("new IS-IS area instance %s", area->area_tag);
181
182 vty->node = ISIS_NODE;
183 vty->index = area;
184
185 return CMD_SUCCESS;
186}
187
188int
189isis_area_destroy (struct vty *vty, char *area_tag)
190{
191
192 struct isis_area *area;
193 struct listnode *node;
194 struct isis_circuit *circuit;
195
196 area = isis_area_lookup (area_tag);
197
198 if (area == NULL) {
199 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
200 return CMD_WARNING;
201 }
202
203 if (area->circuit_list) {
204 node = listhead (area->circuit_list);
205 while (node) {
206 circuit = getdata (node);
207 nextnode (node);
208 isis_circuit_del (circuit);
209 }
210 list_delete (area->circuit_list);
211 }
212 listnode_delete (isis->area_list, area);
213 if (area->t_tick)
214 thread_cancel (area->t_tick);
215 if (area->t_remove_aged)
216 thread_cancel (area->t_remove_aged);
217 if (area->t_lsp_refresh[0])
218 thread_cancel (area->t_lsp_refresh[0]);
219 if (area->t_lsp_refresh[1])
220 thread_cancel (area->t_lsp_refresh[1]);
221
222 XFREE (MTYPE_ISIS_AREA, area);
223
224 return CMD_SUCCESS;
225}
226
227int
228area_net_title (struct vty *vty , char *net_title)
229{
230
231 struct isis_area *area;
232 struct area_addr *addr;
233 struct area_addr *addrp;
234 struct listnode *node;
235
236 u_char buff[255];
237 area = vty->index;
238
239 if (!area) {
240 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
241 return CMD_WARNING;
242 }
243
244 /* We check that we are not over the maximal number of addresses */
245 if (listcount (area->area_addrs) >= isis->max_area_addrs) {
246 vty_out (vty, "Maximum of area addresses (%d) already reached %s",
247 isis->max_area_addrs, VTY_NEWLINE);
248 return CMD_WARNING;
249 }
250
251 addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));
252 addr->addr_len = dotformat2buff (buff, net_title);
253 memcpy (addr->area_addr, buff, addr->addr_len);
254#ifdef EXTREME_DEBUG
255 zlog_info ("added area address %s for area %s (address length %d)",
256 net_title, area->area_tag, addr->addr_len);
257#endif /* EXTREME_DEBUG */
258 if (addr->addr_len < 8 || addr->addr_len > 20) {
259 zlog_warn ("area address must be at least 8..20 octets long (%d)",
260 addr->addr_len);
261 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
262 return CMD_WARNING;
263 }
264
265 if (isis->sysid_set == 0) {
266 /*
267 * First area address - get the SystemID for this router
268 */
269 memcpy (isis->sysid, GETSYSID(addr, ISIS_SYS_ID_LEN), ISIS_SYS_ID_LEN);
270 isis->sysid_set = 1;
271 zlog_info ("Router has SystemID %s", sysid_print (isis->sysid));
272 } else {
273 /*
274 * Check that the SystemID portions match
275 */
276 if (memcmp (isis->sysid, GETSYSID(addr, ISIS_SYS_ID_LEN),
277 ISIS_SYS_ID_LEN)) {
278 vty_out (vty, "System ID must not change when defining additional area"
279 " addresses%s", VTY_NEWLINE);
280 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
281 return CMD_WARNING;
282 }
283
284 /* now we see that we don't already have this address */
285 LIST_LOOP (area->area_addrs, addrp, node) {
286 if ((addrp->addr_len+ ISIS_SYS_ID_LEN + 1) == (addr->addr_len)) {
287 if (!memcmp (addrp->area_addr, addr->area_addr,addr->addr_len)) {
288 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
289 return CMD_SUCCESS; /* silent fail */
290 }
291 }
292 }
293
294 }
295 /*
296 * Forget the systemID part of the address
297 */
298 addr->addr_len -= (ISIS_SYS_ID_LEN + 1);
299 listnode_add (area->area_addrs, addr);
300
301 /* only now we can safely generate our LSPs for this area */
302 if (listcount(area->area_addrs) > 0) {
303 lsp_l1_generate (area);
304 lsp_l2_generate (area);
305 }
306
307 return CMD_SUCCESS;
308}
309
310int
311area_clear_net_title (struct vty *vty, char *net_title)
312{
313 struct isis_area *area;
314 struct area_addr addr, *addrp = NULL;
315 struct listnode *node;
316 u_char buff[255];
317
318 area = vty->index;
319 if (!area) {
320 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
321 return CMD_WARNING;
322 }
323
324 addr.addr_len = dotformat2buff (buff, net_title);
325 if (addr.addr_len < 8 || addr.addr_len > 20) {
326 vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
327 addr.addr_len, VTY_NEWLINE);
328 return CMD_WARNING;
329 }
330
331 memcpy(addr.area_addr, buff, (int)addr.addr_len);
332
333 LIST_LOOP (area->area_addrs, addrp, node)
334 if (addrp->addr_len == addr.addr_len &&
335 !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
336 break;
337
338 if (!addrp) {
339 vty_out (vty, "No area address %s for area %s %s", net_title,
340 area->area_tag, VTY_NEWLINE);
341 return CMD_WARNING;
342 }
343
344 listnode_delete (area->area_addrs, addrp);
345
346 return CMD_SUCCESS;
347}
348
349
350/*
351 * 'show clns neighbors' command
352 */
353
354int
355show_clns_neigh (struct vty *vty, char detail)
356{
357 struct listnode *node_area, *node_circ;
358 struct isis_area *area;
359 struct isis_circuit *circuit;
360 struct list *db;
361 int i;
362
363 if (!isis) {
364 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
365 return CMD_SUCCESS;
366 }
367
368 for (node_area = listhead (isis->area_list); node_area;
369 nextnode (node_area)) {
370 area = getdata (node_area);
371 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
372
373 if (detail==ISIS_UI_LEVEL_BRIEF)
374 vty_out (vty, " System Id Interface L State "
375 "Holdtime SNPA%s", VTY_NEWLINE);
376
377 for (node_circ = listhead (area->circuit_list); node_circ;
378 nextnode (node_circ)) {
379 circuit = getdata (node_circ);
380 if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
381 for (i = 0; i < 2; i++) {
382 db = circuit->u.bc.adjdb[i];
383 if (db && db->count) {
384 if (detail == ISIS_UI_LEVEL_BRIEF)
385 isis_adjdb_iterate (db, (void (*) (struct isis_adjacency *,
386 void *))
387 isis_adj_print_vty, vty);
388 if (detail == ISIS_UI_LEVEL_DETAIL)
389 isis_adjdb_iterate (db, (void (*) (struct isis_adjacency *,
390 void *))
391 isis_adj_print_vty_detail, vty);
392 if (detail == ISIS_UI_LEVEL_EXTENSIVE)
393 isis_adjdb_iterate (db, (void (*) (struct isis_adjacency *,
394 void *))
395 isis_adj_print_vty_extensive, vty);
396 }
397 }
398 } else if (circuit->circ_type == CIRCUIT_T_P2P &&
399 circuit->u.p2p.neighbor) {
400 if (detail==ISIS_UI_LEVEL_BRIEF)
401 isis_adj_p2p_print_vty (circuit->u.p2p.neighbor, vty);
402 if (detail==ISIS_UI_LEVEL_DETAIL)
403 isis_adj_p2p_print_vty_detail (circuit->u.p2p.neighbor, vty);
404 if (detail==ISIS_UI_LEVEL_EXTENSIVE)
405 isis_adj_p2p_print_vty_extensive (circuit->u.p2p.neighbor, vty);
406 }
407 }
408 }
409
410 return CMD_SUCCESS;
411}
412
413DEFUN (show_clns_neighbors,
414 show_clns_neighbors_cmd,
415 "show clns neighbors",
416 SHOW_STR
417 "clns network information\n"
418 "CLNS neighbor adjacencies\n")
419{
420 return show_clns_neigh(vty, ISIS_UI_LEVEL_BRIEF);
421}
422
423ALIAS (show_clns_neighbors,
424 show_isis_neighbors_cmd,
425 "show isis neighbors",
426 SHOW_STR
427 "IS-IS network information\n"
428 "IS-IS neighbor adjacencies\n")
429
430DEFUN (show_clns_neighbors_detail,
431 show_clns_neighbors_detail_cmd,
432 "show clns neighbors detail",
433 SHOW_STR
434 "clns network information\n"
435 "CLNS neighbor adjacencies\n"
436 "show detailed information\n")
437{
438 return show_clns_neigh(vty, ISIS_UI_LEVEL_DETAIL);
439}
440
441ALIAS (show_clns_neighbors_detail,
442 show_isis_neighbors_detail_cmd,
443 "show isis neighbors detail",
444 SHOW_STR
445 "IS-IS network information\n"
446 "IS-IS neighbor adjacencies\n"
447 "show detailed information\n")
448
449/*
450 * 'isis debug', 'show debugging'
451 */
452
453void
454print_debug (struct vty *vty, int flags, int onoff)
455{
456 char onoffs[4];
457 if (onoff)
458 strcpy (onoffs,"on");
459 else
460 strcpy (onoffs,"off");
461
462 if (flags & DEBUG_ADJ_PACKETS)
463 vty_out (vty,"IS-IS Adjacency related packets debugging is %s%s", onoffs,
464 VTY_NEWLINE);
465 if (flags & DEBUG_CHECKSUM_ERRORS)
466 vty_out (vty,"IS-IS checksum errors debugging is %s%s", onoffs,
467 VTY_NEWLINE);
468 if (flags & DEBUG_LOCAL_UPDATES)
469 vty_out (vty,"IS-IS local updates debugging is %s%s", onoffs,
470 VTY_NEWLINE);
471 if (flags & DEBUG_PROTOCOL_ERRORS)
472 vty_out (vty,"IS-IS protocol errors debugging is %s%s", onoffs,
473 VTY_NEWLINE);
474 if (flags & DEBUG_SNP_PACKETS)
475 vty_out (vty,"IS-IS CSNP/PSNP packets debugging is %s%s", onoffs,
476 VTY_NEWLINE);
477 if (flags & DEBUG_SPF_EVENTS)
478 vty_out (vty,"IS-IS SPF events debugging is %s%s", onoffs,
479 VTY_NEWLINE);
480 if (flags & DEBUG_SPF_STATS)
481 vty_out (vty,"IS-IS SPF Timing and Statistics Data debugging is %s%s",
482 onoffs, VTY_NEWLINE);
483 if (flags & DEBUG_SPF_TRIGGERS)
484 vty_out (vty,"IS-IS SPF triggering events debugging is %s%s", onoffs,
485 VTY_NEWLINE);
486 if (flags & DEBUG_UPDATE_PACKETS)
487 vty_out (vty,"IS-IS Update related packet debugging is %s%s", onoffs,
488 VTY_NEWLINE);
489 if (flags & DEBUG_RTE_EVENTS)
490 vty_out (vty,"IS-IS Route related debuggin is %s%s", onoffs,
491 VTY_NEWLINE);
492 if (flags & DEBUG_EVENTS)
493 vty_out (vty,"IS-IS Event debugging is %s%s", onoffs,
494 VTY_NEWLINE);
495
496}
497
498DEFUN (show_debugging,
499 show_debugging_cmd,
500 "show debugging",
501 SHOW_STR
502 "State of each debugging option\n")
503{
504 vty_out (vty,"IS-IS:%s", VTY_NEWLINE);
505 print_debug (vty, isis->debugs, 1);
506 return CMD_SUCCESS;
507}
508
509DEFUN (debug_isis_adj,
510 debug_isis_adj_cmd,
511 "debug isis adj-packets",
512 DEBUG_STR
513 "IS-IS information\n"
514 "IS-IS Adjacency related packets\n"
515 )
516{
517 isis->debugs |= DEBUG_ADJ_PACKETS;
518 print_debug (vty,DEBUG_ADJ_PACKETS,1);
519
520 return CMD_SUCCESS;
521}
522
523DEFUN (no_debug_isis_adj,
524 no_debug_isis_adj_cmd,
525 "no debug isis adj-packets",
526 UNDEBUG_STR
527 "IS-IS information\n"
528 "IS-IS Adjacency related packets\n"
529 )
530{
531
532 isis->debugs &= ~DEBUG_ADJ_PACKETS;
533 print_debug (vty, DEBUG_ADJ_PACKETS, 0);
534
535 return CMD_SUCCESS;
536}
537
538
539DEFUN (debug_isis_csum,
540 debug_isis_csum_cmd,
541 "debug isis checksum-errors",
542 DEBUG_STR
543 "IS-IS information\n"
544 "IS-IS LSP checksum errors\n"
545 )
546{
547 isis->debugs |= DEBUG_CHECKSUM_ERRORS;
548 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1);
549
550 return CMD_SUCCESS;
551}
552
553DEFUN (no_debug_isis_csum,
554 no_debug_isis_csum_cmd,
555 "no debug isis checksum-errors",
556 UNDEBUG_STR
557 "IS-IS information\n"
558 "IS-IS LSP checksum errors\n"
559 )
560{
561 isis->debugs &= ~DEBUG_CHECKSUM_ERRORS;
562 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0);
563
564 return CMD_SUCCESS;
565}
566
567DEFUN (debug_isis_lupd,
568 debug_isis_lupd_cmd,
569 "debug isis local-updates",
570 DEBUG_STR
571 "IS-IS information\n"
572 "IS-IS local update packets\n"
573 )
574{
575 isis->debugs |= DEBUG_LOCAL_UPDATES;
576 print_debug (vty, DEBUG_LOCAL_UPDATES, 1);
577
578 return CMD_SUCCESS;
579}
580
581DEFUN (no_debug_isis_lupd,
582 no_debug_isis_lupd_cmd,
583 "no debug isis local-updates",
584 UNDEBUG_STR
585 "IS-IS information\n"
586 "IS-IS local update packets\n"
587 )
588{
589 isis->debugs &= ~DEBUG_LOCAL_UPDATES;
590 print_debug (vty, DEBUG_LOCAL_UPDATES , 0);
591
592 return CMD_SUCCESS;
593}
594
595DEFUN (debug_isis_err,
596 debug_isis_err_cmd,
597 "debug isis protocol-errors",
598 DEBUG_STR
599 "IS-IS information\n"
600 "IS-IS LSP protocol errors\n"
601 )
602{
603 isis->debugs |= DEBUG_PROTOCOL_ERRORS;
604 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1);
605
606 return CMD_SUCCESS;
607}
608
609DEFUN (no_debug_isis_err,
610 no_debug_isis_err_cmd,
611 "no debug isis protocol-errors",
612 UNDEBUG_STR
613 "IS-IS information\n"
614 "IS-IS LSP protocol errors\n"
615 )
616{
617 isis->debugs &= ~DEBUG_PROTOCOL_ERRORS;
618 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0);
619
620 return CMD_SUCCESS;
621}
622
623DEFUN (debug_isis_snp,
624 debug_isis_snp_cmd,
625 "debug isis snp-packets",
626 DEBUG_STR
627 "IS-IS information\n"
628 "IS-IS CSNP/PSNP packets\n"
629 )
630{
631 isis->debugs |= DEBUG_SNP_PACKETS;
632 print_debug (vty, DEBUG_SNP_PACKETS, 1);
633
634 return CMD_SUCCESS;
635}
636
637DEFUN (no_debug_isis_snp,
638 no_debug_isis_snp_cmd,
639 "no debug isis snp-packets",
640 UNDEBUG_STR
641 "IS-IS information\n"
642 "IS-IS CSNP/PSNP packets\n"
643 )
644{
645 isis->debugs &= ~DEBUG_SNP_PACKETS ;
646 print_debug (vty, DEBUG_SNP_PACKETS, 0);
647
648 return CMD_SUCCESS;
649}
650
651
652
653DEFUN (debug_isis_upd,
654 debug_isis_upd_cmd,
655 "debug isis update-packets",
656 DEBUG_STR
657 "IS-IS information\n"
658 "IS-IS Update related packets\n"
659 )
660{
661 isis->debugs |= DEBUG_UPDATE_PACKETS;
662 print_debug (vty, DEBUG_UPDATE_PACKETS, 1);
663
664 return CMD_SUCCESS;
665}
666
667DEFUN (no_debug_isis_upd,
668 no_debug_isis_upd_cmd,
669 "no debug isis update-packets",
670 UNDEBUG_STR
671 "IS-IS information\n"
672 "IS-IS Update related packets\n"
673 )
674{
675 isis->debugs &= ~DEBUG_UPDATE_PACKETS;
676 print_debug (vty, DEBUG_UPDATE_PACKETS, 0);
677
678 return CMD_SUCCESS;
679}
680
681
682DEFUN (debug_isis_spfevents,
683 debug_isis_spfevents_cmd,
684 "debug isis spf-events",
685 DEBUG_STR
686 "IS-IS information\n"
687 "IS-IS Shortest Path First Events\n"
688 )
689{
690 isis->debugs |= DEBUG_SPF_EVENTS;
691 print_debug (vty, DEBUG_SPF_EVENTS , 1);
692
693 return CMD_SUCCESS;
694}
695
696DEFUN (no_debug_isis_spfevents,
697 no_debug_isis_spfevents_cmd,
698 "no debug isis spf-events",
699 UNDEBUG_STR
700 "IS-IS information\n"
701 "IS-IS Shortest Path First Events\n"
702 )
703{
704 isis->debugs &= ~DEBUG_SPF_EVENTS;
705 print_debug (vty, DEBUG_SPF_EVENTS , 0);
706
707 return CMD_SUCCESS;
708}
709
710
711DEFUN (debug_isis_spfstats,
712 debug_isis_spfstats_cmd,
713 "debug isis spf-statistics ",
714 DEBUG_STR
715 "IS-IS information\n"
716 "IS-IS SPF Timing and Statistic Data\n"
717 )
718{
719 isis->debugs |= DEBUG_SPF_STATS;
720 print_debug (vty, DEBUG_SPF_STATS, 1);
721
722 return CMD_SUCCESS;
723}
724
725DEFUN (no_debug_isis_spfstats,
726 no_debug_isis_spfstats_cmd,
727 "no debug isis spf-statistics",
728 UNDEBUG_STR
729 "IS-IS information\n"
730 "IS-IS SPF Timing and Statistic Data\n"
731 )
732{
733 isis->debugs &= ~DEBUG_SPF_STATS;
734 print_debug (vty, DEBUG_SPF_STATS, 0);
735
736 return CMD_SUCCESS;
737}
738
739DEFUN (debug_isis_spftrigg,
740 debug_isis_spftrigg_cmd,
741 "debug isis spf-triggers",
742 DEBUG_STR
743 "IS-IS information\n"
744 "IS-IS SPF triggering events\n"
745 )
746{
747 isis->debugs |= DEBUG_SPF_TRIGGERS;
748 print_debug (vty, DEBUG_SPF_TRIGGERS, 1);
749
750 return CMD_SUCCESS;
751}
752
753DEFUN (no_debug_isis_spftrigg,
754 no_debug_isis_spftrigg_cmd,
755 "no debug isis spf-triggers",
756 UNDEBUG_STR
757 "IS-IS information\n"
758 "IS-IS SPF triggering events\n"
759 )
760{
761 isis->debugs &= ~DEBUG_SPF_TRIGGERS;
762 print_debug (vty, DEBUG_SPF_TRIGGERS, 0);
763
764 return CMD_SUCCESS;
765}
766
767DEFUN (debug_isis_rtevents,
768 debug_isis_rtevents_cmd,
769 "debug isis route-events",
770 DEBUG_STR
771 "IS-IS information\n"
772 "IS-IS Route related events\n"
773 )
774{
775 isis->debugs |= DEBUG_RTE_EVENTS;
776 print_debug (vty, DEBUG_RTE_EVENTS, 1);
777
778 return CMD_SUCCESS;
779}
780
781DEFUN (no_debug_isis_rtevents,
782 no_debug_isis_rtevents_cmd,
783 "no debug isis route-events",
784 UNDEBUG_STR
785 "IS-IS information\n"
786 "IS-IS Route related events\n"
787 )
788{
789 isis->debugs &= ~DEBUG_RTE_EVENTS;
790 print_debug (vty, DEBUG_RTE_EVENTS, 0);
791
792 return CMD_SUCCESS;
793}
794
795DEFUN (debug_isis_events,
796 debug_isis_events_cmd,
797 "debug isis events",
798 DEBUG_STR
799 "IS-IS information\n"
800 "IS-IS Events\n"
801 )
802{
803 isis->debugs |= DEBUG_EVENTS;
804 print_debug (vty, DEBUG_EVENTS, 1);
805
806 return CMD_SUCCESS;
807}
808
809DEFUN (no_debug_isis_events,
810 no_debug_isis_events_cmd,
811 "no debug isis events",
812 UNDEBUG_STR
813 "IS-IS information\n"
814 "IS-IS Events\n"
815 )
816{
817 isis->debugs &= ~DEBUG_EVENTS;
818 print_debug (vty, DEBUG_EVENTS, 0);
819
820 return CMD_SUCCESS;
821}
822
823
824DEFUN (show_hostname,
825 show_hostname_cmd,
826 "show isis hostname",
827 SHOW_STR
828 "IS-IS information\n"
829 "IS-IS Dynamic hostname mapping\n")
830{
831 dynhn_print_all (vty);
832
833 return CMD_SUCCESS;
834}
835
836
837DEFUN (show_database,
838 show_database_cmd,
839 "show isis database",
840 SHOW_STR
841 "IS-IS information\n"
842 "IS-IS link state database\n")
843{
844 struct listnode *node;
845 struct isis_area *area;
846 int level,lsp_count;
847
848 if (isis->area_list->count == 0)
849 return CMD_SUCCESS;
850
851 for (node = listhead (isis->area_list); node; nextnode (node)) {
852 area = getdata (node);
853 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
854 VTY_NEWLINE);
855 for (level=0;level<ISIS_LEVELS;level++) {
856 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0) {
857 vty_out (vty,"IS-IS Level-%d link-state database:%s", level+1,
858 VTY_NEWLINE);
859
860 lsp_count = lsp_print_all (vty, area->lspdb[level],
861 ISIS_UI_LEVEL_BRIEF,
862 area->dynhostname);
863
864 vty_out (vty,"%s %u LSPs%s%s",
865 VTY_NEWLINE,
866 lsp_count,
867 VTY_NEWLINE,
868 VTY_NEWLINE);
869 }
870 }
871 }
872
873 return CMD_SUCCESS;
874}
875
876
877DEFUN (show_database_detail,
878 show_database_detail_cmd,
879 "show isis database detail",
880 SHOW_STR
881 "IS-IS information\n"
882 "IS-IS link state database\n")
883{
884 struct listnode *node;
885 struct isis_area *area;
886 int level, lsp_count;
887
888 if (isis->area_list->count == 0)
889 return CMD_SUCCESS;
890
891 for (node = listhead (isis->area_list); node; nextnode (node)) {
892 area = getdata (node);
893 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
894 VTY_NEWLINE);
895 for (level=0;level<ISIS_LEVELS;level++) {
896 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0) {
897 vty_out (vty,"IS-IS Level-%d Link State Database:%s", level+1,
898 VTY_NEWLINE);
899
900 lsp_count = lsp_print_all (vty, area->lspdb[level],
901 ISIS_UI_LEVEL_DETAIL,
902 area->dynhostname);
903
904 vty_out (vty,"%s %u LSPs%s%s",
905 VTY_NEWLINE,
906 lsp_count,
907 VTY_NEWLINE,
908 VTY_NEWLINE);
909 }
910 }
911 }
912
913 return CMD_SUCCESS;
914}
915
916/*
917 * 'router isis' command
918 */
919DEFUN (router_isis,
920 router_isis_cmd,
921 "router isis WORD",
922 ROUTER_STR
923 "ISO IS-IS\n"
924 "ISO Routing area tag")
925{
926
927 return isis_area_get (vty, argv[0]);
928
929}
930
931/*
932 *'no router isis' command
933 */
934DEFUN (no_router_isis,
935 no_router_isis_cmd,
936 "no router isis WORD",
937 "no\n"
938 ROUTER_STR
939 "ISO IS-IS\n"
940 "ISO Routing area tag")
941
942{
943 return isis_area_destroy (vty, argv[0]);
944}
945
946/*
947 * 'net' command
948 */
949DEFUN (net,
950 net_cmd,
951 "net WORD",
952 "A Network Entity Title for this process (OSI only)\n"
953 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n" )
954{
955 return area_net_title (vty, argv[0]);
956}
957
958
959/*
960 * 'no net' command
961 */
962DEFUN (no_net,
963 no_net_cmd,
964 "no net WORD",
965 NO_STR
966 "A Network Entity Title for this process (OSI only)\n"
967 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n" )
968{
969 return area_clear_net_title (vty, argv[0]);
970}
971
972DEFUN (area_passwd,
973 area_passwd_cmd,
974 "area-password WORD",
975 "Configure the authentication password for an area\n"
976 "Area password\n" )
977{
978 struct isis_area *area;
979 int len;
980
981 area = vty->index;
982
983 if (!area) {
984 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
985 return CMD_WARNING;
986 }
987
988 len = strlen (argv[0]);
989 if (len > 254) {
990 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
991 return CMD_WARNING;
992 }
993 area->area_passwd.len = (u_char)len;
994 area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
995 strncpy (area->area_passwd.passwd, argv[0], 255);
996
997 return CMD_SUCCESS;
998}
999
1000DEFUN (no_area_passwd,
1001 no_area_passwd_cmd,
1002 "no area-password",
1003 NO_STR
1004 "Configure the authentication password for an area\n")
1005{
1006 struct isis_area *area;
1007
1008 area = vty->index;
1009
1010 if (!area) {
1011 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1012 return CMD_WARNING;
1013 }
1014
1015 memset (&area->area_passwd, 0, sizeof (struct isis_passwd));
1016
1017 return CMD_SUCCESS;
1018}
1019
1020
1021DEFUN (domain_passwd,
1022 domain_passwd_cmd,
1023 "domain-password WORD",
1024 "Set the authentication password for a routing domain\n"
1025 "Routing domain password\n" )
1026{
1027 struct isis_area *area;
1028 int len;
1029
1030 area = vty->index;
1031
1032 if (!area) {
1033 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1034 return CMD_WARNING;
1035 }
1036
1037 len = strlen (argv[0]);
1038 if (len > 254) {
1039 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1040 return CMD_WARNING;
1041 }
1042 area->domain_passwd.len = (u_char)len;
1043 area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
1044 strncpy (area->domain_passwd.passwd, argv[0], 255);
1045
1046 return CMD_SUCCESS;
1047}
1048
1049
1050DEFUN (no_domain_passwd,
1051 no_domain_passwd_cmd,
1052 "no domain-password WORD",
1053 NO_STR
1054 "Set the authentication password for a routing domain\n")
1055{
1056 struct isis_area *area;
1057
1058 area = vty->index;
1059
1060 if (!area) {
1061 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1062 return CMD_WARNING;
1063 }
1064
1065 memset (&area->domain_passwd, 0, sizeof (struct isis_passwd));
1066
1067 return CMD_SUCCESS;
1068}
1069
1070DEFUN (is_type,
1071 is_type_cmd,
1072 "is-type (level-1|level-1-2|level-2-only)",
1073 "IS Level for this routing process (OSI only)\n"
1074 "Act as a station router only\n"
1075 "Act as both a station router and an area router\n"
1076 "Act as an area router only\n")
1077{
1078 struct isis_area *area;
1079 int type;
1080
1081 area = vty->index;
1082
1083 if (!area) {
1084 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1085 return CMD_WARNING;
1086 }
1087
1088 type = string2circuit_t (argv[0]);
1089 if (!type) {
1090 vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
1091 return CMD_SUCCESS;
1092 }
1093
1094 isis_event_system_type_change (area, type);
1095
1096 return CMD_SUCCESS;
1097}
1098
1099DEFUN (no_is_type,
1100 no_is_type_cmd,
1101 "no is-type (level-1|level-1-2|level-2-only)",
1102 NO_STR
1103 "IS Level for this routing process (OSI only)\n"
1104 "Act as a station router only\n"
1105 "Act as both a station router and an area router\n"
1106 "Act as an area router only\n")
1107{
1108
1109 struct isis_area *area;
1110 int type;
1111
1112 area = vty->index;
1113 assert (area);
1114
1115 /*
1116 * Put the is-type back to default. Which is level-1-2 on first
1117 * circuit for the area level-1 for the rest
1118 */
1119 if (getdata (listhead (isis->area_list)) == area )
1120 type = IS_LEVEL_1_AND_2;
1121 else
1122 type = IS_LEVEL_1;
1123
1124 isis_event_system_type_change (area, type);
1125
1126 return CMD_SUCCESS;
1127}
1128
1129DEFUN (lsp_gen_interval,
1130 lsp_gen_interval_cmd,
1131 "lsp-gen-interval <1-120>",
1132 "Minimum interval between regenerating same LSP\n"
1133 "Minimum interval in seconds\n")
1134{
1135 struct isis_area *area;
1136 uint16_t interval;
1137
1138 area = vty->index;
1139 assert (area);
1140
1141 interval = atoi (argv[0]);
1142 area->lsp_gen_interval[0] = interval;
1143 area->lsp_gen_interval[1] = interval;
1144
1145 return CMD_SUCCESS;
1146}
1147
1148DEFUN (no_lsp_gen_interval,
1149 no_lsp_gen_interval_cmd,
1150 "no lsp-gen-interval",
1151 NO_STR
1152 "Minimum interval between regenerating same LSP\n"
1153 )
1154{
1155 struct isis_area *area;
1156
1157 area = vty->index;
1158 assert (area);
1159
1160 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
1161 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
1162
1163 return CMD_SUCCESS;
1164}
1165
1166ALIAS (no_lsp_gen_interval,
1167 no_lsp_gen_interval_arg_cmd,
1168 "no lsp-gen-interval <1-120>",
1169 NO_STR
1170 "Minimum interval between regenerating same LSP\n"
1171 "Minimum interval in seconds\n"
1172 )
1173
1174DEFUN (lsp_gen_interval_l1,
1175 lsp_gen_interval_l1_cmd,
1176 "lsp-gen-interval level-1 <1-120>",
1177 "Minimum interval between regenerating same LSP\n"
1178 "Set interval for level 1 only\n"
1179 "Minimum interval in seconds\n"
1180 )
1181{
1182 struct isis_area *area;
1183 uint16_t interval;
1184
1185 area = vty->index;
1186 assert (area);
1187
1188 interval = atoi (argv[0]);
1189 area->lsp_gen_interval[0] = interval;
1190
1191 return CMD_SUCCESS;
1192}
1193
1194DEFUN (no_lsp_gen_interval_l1,
1195 no_lsp_gen_interval_l1_cmd,
1196 "no lsp-gen-interval level-1",
1197 NO_STR
1198 "Minimum interval between regenerating same LSP\n"
1199 "Set interval for level 1 only\n"
1200
1201 )
1202{
1203 struct isis_area *area;
1204
1205 area = vty->index;
1206 assert (area);
1207
1208 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
1209
1210 return CMD_SUCCESS;
1211}
1212
1213ALIAS (no_lsp_gen_interval_l1,
1214 no_lsp_gen_interval_l1_arg_cmd,
1215 "no lsp-gen-interval level-1 <1-120>",
1216 NO_STR
1217 "Minimum interval between regenerating same LSP\n"
1218 "Set interval for level 1 only\n"
1219 "Minimum interval in seconds\n"
1220 )
1221
1222
1223DEFUN (lsp_gen_interval_l2,
1224 lsp_gen_interval_l2_cmd,
1225 "lsp-gen-interval level-2 <1-120>",
1226 "Minimum interval between regenerating same LSP\n"
1227 "Set interval for level 2 only\n"
1228 "Minimum interval in seconds\n"
1229 )
1230{
1231 struct isis_area *area;
1232 int interval;
1233
1234 area = vty->index;
1235 assert (area);
1236
1237 interval = atoi (argv[0]);
1238 area->lsp_gen_interval[1] = interval;
1239
1240 return CMD_SUCCESS;
1241}
1242
1243DEFUN (no_lsp_gen_interval_l2,
1244 no_lsp_gen_interval_l2_cmd,
1245 "no lsp-gen-interval level-2",
1246 NO_STR
1247 "Minimum interval between regenerating same LSP\n"
1248 "Set interval for level 2 only\n"
1249 )
1250{
1251 struct isis_area *area;
1252 int interval;
1253
1254 area = vty->index;
1255 assert (area);
1256
1257 interval = atoi (argv[0]);
1258 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
1259
1260 return CMD_SUCCESS;
1261}
1262
1263ALIAS (no_lsp_gen_interval_l2,
1264 no_lsp_gen_interval_l2_arg_cmd,
1265 "no lsp-gen-interval level-2 <1-120>",
1266 NO_STR
1267 "Minimum interval between regenerating same LSP\n"
1268 "Set interval for level 2 only\n"
1269 "Minimum interval in seconds\n"
1270 )
1271
1272
1273DEFUN (metric_style,
1274 metric_style_cmd,
1275 "metric-style (narrow|wide)",
1276 "Use old-style (ISO 10589) or new-style packet formats\n"
1277 "Use old style of TLVs with narrow metric\n"
1278 "Use new style of TLVs to carry wider metric\n")
1279{
1280 struct isis_area *area;
1281
1282 area = vty->index;
1283 assert (area);
1284 if (!strcmp(argv[0],"wide"))
1285 area->newmetric = 1;
1286 else
1287 area->newmetric = 0;
1288
1289 return CMD_SUCCESS;
1290}
1291
1292DEFUN (no_metric_style,
1293 no_metric_style_cmd,
1294 "no metric-style (narrow|wide)",
1295 NO_STR
1296 "Use old-style (ISO 10589) or new-style packet formats\n"
1297 "Use old style of TLVs with narrow metric\n"
1298 "Use new style of TLVs to carry wider metric\n")
1299{
1300 struct isis_area *area;
1301
1302 area = vty->index;
1303 assert (area);
1304
1305 if (!strcmp(argv[0],"wide"))
1306 area->newmetric = 0;
1307 else
1308 area->newmetric = 1;
1309
1310 return CMD_SUCCESS;
1311}
1312
1313DEFUN (dynamic_hostname,
1314 dynamic_hostname_cmd,
1315 "hostname dynamic",
1316 "Dynamic hostname for IS-IS\n"
1317 "Dynamic hostname\n")
1318{
1319 struct isis_area *area;
1320
1321 area = vty->index;
1322 assert (area);
1323
1324 area->dynhostname = 1;
1325
1326 return CMD_SUCCESS;
1327}
1328
1329DEFUN (no_dynamic_hostname,
1330 no_dynamic_hostname_cmd,
1331 "no hostname dynamic",
1332 NO_STR
1333 "Dynamic hostname for IS-IS\n"
1334 "Dynamic hostname\n")
1335{
1336 struct isis_area *area;
1337
1338 area = vty->index;
1339 assert (area);
1340
1341 area->dynhostname = 0;
1342
1343 return CMD_SUCCESS;
1344}
1345
1346DEFUN (spf_interval,
1347 spf_interval_cmd,
1348 "spf-interval <1-120>",
1349 "Minimum interval between SPF calculations"
1350 "Minimum interval between consecutive SPFs in seconds\n")
1351{
1352 struct isis_area *area;
1353 u_int16_t interval;
1354
1355 area = vty->index;
1356 interval = atoi (argv[0]);
1357 area->min_spf_interval[0] = interval;
1358 area->min_spf_interval[1] = interval;
1359
1360 return CMD_SUCCESS;
1361}
1362
1363DEFUN (no_spf_interval,
1364 no_spf_interval_cmd,
1365 "no spf-interval",
1366 NO_STR
1367 "Minimum interval between SPF calculations\n"
1368 )
1369{
1370 struct isis_area *area;
1371
1372 area = vty->index;
1373
1374 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
1375 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
1376
1377 return CMD_SUCCESS;
1378}
1379
1380ALIAS (no_spf_interval,
1381 no_spf_interval_arg_cmd,
1382 "no spf-interval <1-120>",
1383 NO_STR
1384 "Minimum interval between SPF calculations\n"
1385 "Minimum interval between consecutive SPFs in seconds\n"
1386 )
1387
1388DEFUN (spf_interval_l1,
1389 spf_interval_l1_cmd,
1390 "spf-interval level-1 <1-120>",
1391 "Minimum interval between SPF calculations\n"
1392 "Set interval for level 1 only\n"
1393 "Minimum interval between consecutive SPFs in seconds\n")
1394{
1395 struct isis_area *area;
1396 u_int16_t interval;
1397
1398 area = vty->index;
1399 interval = atoi (argv[0]);
1400 area->min_spf_interval[0] = interval;
1401
1402 return CMD_SUCCESS;
1403}
1404
1405DEFUN (no_spf_interval_l1,
1406 no_spf_interval_l1_cmd,
1407 "no spf-interval level-1",
1408 NO_STR
1409 "Minimum interval between SPF calculations\n"
1410 "Set interval for level 1 only\n")
1411{
1412 struct isis_area *area;
1413
1414 area = vty->index;
1415
1416 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
1417
1418 return CMD_SUCCESS;
1419}
1420
1421ALIAS (no_spf_interval,
1422 no_spf_interval_l1_arg_cmd,
1423 "no spf-interval level-1 <1-120>",
1424 NO_STR
1425 "Minimum interval between SPF calculations\n"
1426 "Set interval for level 1 only\n"
1427 "Minimum interval between consecutive SPFs in seconds\n")
1428
1429DEFUN (spf_interval_l2,
1430 spf_interval_l2_cmd,
1431 "spf-interval level-2 <1-120>",
1432 "Minimum interval between SPF calculations\n"
1433 "Set interval for level 2 only\n"
1434 "Minimum interval between consecutive SPFs in seconds\n")
1435{
1436 struct isis_area *area;
1437 u_int16_t interval;
1438
1439 area = vty->index;
1440 interval = atoi (argv[0]);
1441 area->min_spf_interval[1] = interval;
1442
1443 return CMD_SUCCESS;
1444}
1445
1446DEFUN (no_spf_interval_l2,
1447 no_spf_interval_l2_cmd,
1448 "no spf-interval level-2",
1449 NO_STR
1450 "Minimum interval between SPF calculations\n"
1451 "Set interval for level 2 only\n")
1452{
1453 struct isis_area *area;
1454
1455 area = vty->index;
1456
1457 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
1458
1459 return CMD_SUCCESS;
1460}
1461
1462ALIAS (no_spf_interval,
1463 no_spf_interval_l2_arg_cmd,
1464 "no spf-interval level-2 <1-120>",
1465 NO_STR
1466 "Minimum interval between SPF calculations\n"
1467 "Set interval for level 2 only\n"
1468 "Minimum interval between consecutive SPFs in seconds\n")
1469
1470
1471#ifdef TOPOLOGY_GENERATE
1472DEFUN (topology_generate_grid,
1473 topology_generate_grid_cmd,
1474 "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "
1475 "[param]",
1476 "Topology for IS-IS\n"
1477 "Topology for IS-IS\n"
1478 "Topology grid for IS-IS\n"
1479 "X parameter of the grid\n"
1480 "Y parameter of the grid\n"
1481 "Random seed\n"
1482 "Optional param 1\n"
1483 "Optional param 2\n"
1484 "Optional param 3\n"
1485 "Topology\n")
1486{
1487 struct isis_area *area;
1488
1489 area = vty->index;
1490 assert (area);
1491
1492 if (!spgrid_check_params (vty, argc, argv)) {
1493 if (area->topology)
1494 list_delete (area->topology);
1495 area->topology = list_new();
1496 memcpy(area->top_params,vty->buf,200);
1497 gen_spgrid_topology (vty, area->topology);
1498 remove_topology_lsps (area);
1499 generate_topology_lsps (area);
1500 }
1501
1502 return CMD_SUCCESS;
1503}
1504
1505DEFUN (show_isis_topology,
1506 show_isis_topology_cmd,
1507 "show isis topology",
1508 SHOW_STR
1509 "clns network information\n"
1510 "CLNS neighbor adjacencies\n")
1511{
1512 struct isis_area *area;
1513 struct listnode *node;
1514 struct listnode *node2;
1515 struct arc *arc;
1516 LIST_LOOP (isis->area_list, area, node) {
1517 if (area->topology) {
1518 vty_out (vty, "Topology for isis area:%s%s",area->area_tag, VTY_NEWLINE);
1519 LIST_LOOP (area->topology, arc, node2) {
1520 vty_out (vty, "a %ld %ld %ld%s",arc->from_node, arc->to_node,
1521 arc->distance, VTY_NEWLINE);
1522 }
1523 }
1524 }
1525 return CMD_SUCCESS;
1526}
1527
1528/*
1529 * 'topology base-is' command
1530 */
1531DEFUN (topology_baseis ,
1532 topology_baseis_cmd,
1533 "topology base-is WORD",
1534 "Topology for IS-IS\n"
1535 "Topology for IS-IS\n"
1536 "A Network IS Base for this topology"
1537 "XX.XXXX.XXXX.XX Network entity title (NET)\n" )
1538{
1539 struct isis_area *area;
1540 u_char buff[ISIS_SYS_ID_LEN];
1541
1542 area = vty->index;
1543 assert (area);
1544
1545 if (sysid2buff (buff, argv[0])) {
1546 sysid2buff (area->topology_baseis, argv[0]);
1547 }
1548
1549 return CMD_SUCCESS;
1550}
1551
1552/*
1553 * 'no net' command
1554 */
1555DEFUN (no_topology_baseis,
1556 no_topology_baseis_cmd,
1557 "no topology base-is WORD",
1558 NO_STR
1559 "A Network Entity Title for this process (OSI only)"
1560 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n" )
1561{
1562 struct isis_area *area;
1563
1564 area = vty->index;
1565 assert (area);
1566
1567 memcpy(area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
1568 return CMD_SUCCESS;
1569}
1570
1571#endif /* TOPOLOGY_GENERATE */
1572
1573DEFUN (lsp_lifetime,
1574 lsp_lifetime_cmd,
1575 "lsp-lifetime <380-65535>",
1576 "Maximum LSP lifetime\n"
1577 "LSP lifetime in seconds\n"
1578 )
1579{
1580 struct isis_area *area;
1581 uint16_t interval;
1582
1583 area = vty->index;
1584 assert (area);
1585
1586 interval = atoi (argv[0]);
1587
1588 if (interval < ISIS_MIN_LSP_LIFETIME) {
1589 vty_out (vty, "LSP lifetime (%us) below %us%s",
1590 interval,
1591 ISIS_MIN_LSP_LIFETIME,
1592 VTY_NEWLINE);
1593
1594 return CMD_WARNING;
1595 }
1596
1597
1598 area->max_lsp_lifetime[0] = interval;
1599 area->max_lsp_lifetime[1] = interval;
1600 area->lsp_refresh[0] = interval-300;
1601 area->lsp_refresh[1] = interval-300;
1602
1603 if (area->t_lsp_refresh[0]) {
1604 thread_cancel (area->t_lsp_refresh[0]);
1605 thread_execute (master, lsp_refresh_l1, area, 0);
1606 }
1607
1608 if (area->t_lsp_refresh[1]) {
1609 thread_cancel (area->t_lsp_refresh[1]);
1610 thread_execute (master, lsp_refresh_l2, area, 0);
1611 }
1612
1613
1614 return CMD_SUCCESS;
1615}
1616
1617DEFUN (no_lsp_lifetime,
1618 no_lsp_lifetime_cmd,
1619 "no lsp-lifetime",
1620 NO_STR
1621 "LSP lifetime in seconds\n"
1622 )
1623{
1624 struct isis_area *area;
1625
1626 area = vty->index;
1627 assert (area);
1628
1629 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */
1630 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */
1631 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */
1632 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */
1633
1634 return CMD_SUCCESS;
1635}
1636
1637ALIAS (no_lsp_lifetime,
1638 no_lsp_lifetime_arg_cmd,
1639 "no lsp-lifetime <380-65535>",
1640 NO_STR
1641 "Maximum LSP lifetime\n"
1642 "LSP lifetime in seconds\n"
1643 )
1644
1645DEFUN (lsp_lifetime_l1,
1646 lsp_lifetime_l1_cmd,
1647 "lsp-lifetime level-1 <380-65535>",
1648 "Maximum LSP lifetime for Level 1 only\n"
1649 "LSP lifetime for Level 1 only in seconds\n"
1650 )
1651{
1652 struct isis_area *area;
1653 uint16_t interval;
1654
1655 area = vty->index;
1656 assert (area);
1657
1658 interval = atoi (argv[0]);
1659
1660 if (interval < ISIS_MIN_LSP_LIFETIME) {
1661 vty_out (vty, "Level-1 LSP lifetime (%us) below %us%s",
1662 interval,
1663 ISIS_MIN_LSP_LIFETIME,
1664 VTY_NEWLINE);
1665
1666 return CMD_WARNING;
1667 }
1668
1669
1670 area->max_lsp_lifetime[0] = interval;
1671 area->lsp_refresh[0] = interval-300;
1672
1673 return CMD_SUCCESS;
1674}
1675
1676DEFUN (no_lsp_lifetime_l1,
1677 no_lsp_lifetime_l1_cmd,
1678 "no lsp-lifetime level-1",
1679 NO_STR
1680 "LSP lifetime for Level 1 only in seconds\n"
1681 )
1682{
1683 struct isis_area *area;
1684
1685 area = vty->index;
1686 assert (area);
1687
1688 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */
1689 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */
1690
1691 return CMD_SUCCESS;
1692}
1693
1694ALIAS (no_lsp_lifetime_l1,
1695 no_lsp_lifetime_l1_arg_cmd,
1696 "no lsp-lifetime level-1 <380-65535>",
1697 NO_STR
1698 "Maximum LSP lifetime for Level 1 only\n"
1699 "LSP lifetime for Level 1 only in seconds\n"
1700 )
1701
1702DEFUN (lsp_lifetime_l2,
1703 lsp_lifetime_l2_cmd,
1704 "lsp-lifetime level-2 <380-65535>",
1705 "Maximum LSP lifetime for Level 2 only\n"
1706 "LSP lifetime for Level 2 only in seconds\n"
1707 )
1708{
1709 struct isis_area *area;
1710 uint16_t interval;
1711
1712 area = vty->index;
1713 assert (area);
1714
1715 interval = atoi (argv[0]);
1716
1717 if (interval < ISIS_MIN_LSP_LIFETIME) {
1718 vty_out (vty, "Level-2 LSP lifetime (%us) below %us%s",
1719 interval,
1720 ISIS_MIN_LSP_LIFETIME,
1721 VTY_NEWLINE);
1722
1723 return CMD_WARNING;
1724 }
1725
1726
1727 area->max_lsp_lifetime[1] = interval;
1728 area->lsp_refresh[1] = interval - 300;
1729
1730 return CMD_SUCCESS;
1731}
1732
1733DEFUN (no_lsp_lifetime_l2,
1734 no_lsp_lifetime_l2_cmd,
1735 "no lsp-lifetime level-2",
1736 NO_STR
1737 "LSP lifetime for Level 2 only in seconds\n"
1738 )
1739{
1740 struct isis_area *area;
1741
1742 area = vty->index;
1743 assert (area);
1744
1745 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */
1746 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */
1747
1748 return CMD_SUCCESS;
1749}
1750
1751ALIAS (no_lsp_lifetime_l2,
1752 no_lsp_lifetime_l2_arg_cmd,
1753 "no lsp-lifetime level-2 <380-65535>",
1754 NO_STR
1755 "Maximum LSP lifetime for Level 2 only\n"
1756 "LSP lifetime for Level 2 only in seconds\n"
1757 )
1758
1759
1760
1761
1762/* IS-IS configuration write function */
1763int
1764isis_config_write (struct vty *vty)
1765{
1766 int write = 0;
1767
1768 if (isis != NULL) {
1769 struct isis_area *area;
1770 struct listnode *node;
1771 struct listnode *node2;
1772
1773 LIST_LOOP (isis->area_list, area, node) {
1774 /* ISIS - Area name */
1775 vty_out (vty, "router isis %s%s",area->area_tag, VTY_NEWLINE);
1776 write++;
1777 /* ISIS - Net */
1778 if (listcount (area->area_addrs) > 0) {
1779 struct area_addr *area_addr;
1780 LIST_LOOP (area->area_addrs, area_addr, node2) {
1781 vty_out (vty, " net %s%s",
1782 isonet_print (area_addr->area_addr,
1783 area_addr->addr_len + ISIS_SYS_ID_LEN + 1),
1784 VTY_NEWLINE);
1785 write ++;
1786 }
1787 }
1788 /* ISIS - Dynamic hostname - Defaults to true so only display if false*/
1789 if (!area->dynhostname) {
1790 vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);
1791 write ++;
1792 }
1793 /* ISIS - Metric-Style - when true displays wide */
1794 if (area->newmetric) {
1795 vty_out (vty, " metric-style wide%s", VTY_NEWLINE);
1796 write ++;
1797 }
1798 /* ISIS - Area is-type (level-1-2 is default) */
1799 if (area->is_type == IS_LEVEL_1) {
1800 vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
1801 write ++;
1802 } else {if (area->is_type == IS_LEVEL_2) {
1803 vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
1804 write ++;
1805 }}
1806 /* ISIS - Lsp generation interval */
1807 if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1]) {
1808 if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT) {
1809 vty_out (vty, " lsp-gen-interval %d%s", area->lsp_gen_interval[0],
1810 VTY_NEWLINE);
1811 write ++;
1812 }} else {
1813 if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT) {
1814 vty_out (vty, " lsp-gen-interval level-1 %d%s",
1815 area->lsp_gen_interval[0], VTY_NEWLINE);
1816 write ++;
1817 }
1818 if (area->lsp_gen_interval[1] != LSP_GEN_INTERVAL_DEFAULT) {
1819 vty_out (vty, " lsp-gen-interval level-2 %d%s",
1820 area->lsp_gen_interval[1], VTY_NEWLINE);
1821 write ++;
1822 }
1823 }
1824 /* ISIS - LSP lifetime */
1825 if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1]) {
1826 if (area->max_lsp_lifetime[0] != MAX_AGE) {
1827 vty_out (vty, " lsp-lifetime %u%s", area->max_lsp_lifetime[0],
1828 VTY_NEWLINE);
1829 write ++;
1830 }} else {
1831 if (area->max_lsp_lifetime[0] != MAX_AGE) {
1832 vty_out (vty, " lsp-lifetime level-1 %u%s", area->max_lsp_lifetime[0],
1833 VTY_NEWLINE);
1834 write ++;
1835 }
1836 if (area->max_lsp_lifetime[1] != MAX_AGE) {
1837 vty_out (vty, " lsp-lifetime level-2 %u%s", area->max_lsp_lifetime[1],
1838 VTY_NEWLINE);
1839 write ++;
1840 }
1841 }
1842 #ifdef TOPOLOGY_GENERATE
1843 /* seems we save the whole command line here */
1844 if (area->top_params) {
1845 vty_out (vty, " %s%s",area->top_params, VTY_NEWLINE);
1846 write ++;
1847 }
1848
1849 if (memcmp(area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,
1850 ISIS_SYS_ID_LEN)) {
1851 vty_out (vty, " topology base_is %s%s",
1852 sysid_print (area->topology_baseis), VTY_NEWLINE);
1853 write ++;
1854 }
1855
1856 #endif /* TOPOLOGY_GENERATE */
1857 }
1858 }
1859
1860 return write;
1861}
1862
1863struct cmd_node isis_node =
1864{
1865 ISIS_NODE,
1866 "%s(config_router)# ",
1867 1
1868};
1869
1870void
1871isis_init ()
1872{
1873
1874 /* Install IS-IS top node */
1875 install_node (&isis_node, isis_config_write);
1876
1877 install_element (VIEW_NODE, &show_clns_neighbors_cmd);
1878 install_element (VIEW_NODE, &show_isis_neighbors_cmd);
1879 install_element (VIEW_NODE, &show_clns_neighbors_detail_cmd);
1880 install_element (VIEW_NODE, &show_isis_neighbors_detail_cmd);
1881
1882 install_element (VIEW_NODE, &show_hostname_cmd);
1883 install_element (VIEW_NODE, &show_database_cmd);
1884 install_element (VIEW_NODE, &show_database_detail_cmd);
1885
1886 install_element (ENABLE_NODE, &show_clns_neighbors_cmd);
1887 install_element (ENABLE_NODE, &show_isis_neighbors_cmd);
1888 install_element (ENABLE_NODE, &show_clns_neighbors_detail_cmd);
1889 install_element (ENABLE_NODE, &show_isis_neighbors_detail_cmd);
1890
1891 install_element (ENABLE_NODE, &show_hostname_cmd);
1892 install_element (ENABLE_NODE, &show_database_cmd);
1893 install_element (ENABLE_NODE, &show_database_detail_cmd);
1894 install_element (ENABLE_NODE, &show_debugging_cmd);
1895
1896 install_element (ENABLE_NODE, &debug_isis_adj_cmd);
1897 install_element (ENABLE_NODE, &no_debug_isis_adj_cmd);
1898 install_element (ENABLE_NODE, &debug_isis_csum_cmd);
1899 install_element (ENABLE_NODE, &no_debug_isis_csum_cmd);
1900 install_element (ENABLE_NODE, &debug_isis_lupd_cmd);
1901 install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd);
1902 install_element (ENABLE_NODE, &debug_isis_err_cmd);
1903 install_element (ENABLE_NODE, &no_debug_isis_err_cmd);
1904 install_element (ENABLE_NODE, &debug_isis_snp_cmd);
1905 install_element (ENABLE_NODE, &no_debug_isis_snp_cmd);
1906 install_element (ENABLE_NODE, &debug_isis_upd_cmd);
1907 install_element (ENABLE_NODE, &no_debug_isis_upd_cmd);
1908 install_element (ENABLE_NODE, &debug_isis_spfevents_cmd);
1909 install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd);
1910 install_element (ENABLE_NODE, &debug_isis_spfstats_cmd);
1911 install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd);
1912 install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd);
1913 install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd);
1914 install_element (ENABLE_NODE, &debug_isis_rtevents_cmd);
1915 install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);
1916 install_element (ENABLE_NODE, &debug_isis_events_cmd);
1917 install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
1918
1919 install_element (CONFIG_NODE, &router_isis_cmd);
1920 install_element (CONFIG_NODE, &no_router_isis_cmd);
1921
1922 install_default (ISIS_NODE);
1923
1924 install_element (ISIS_NODE, &net_cmd);
1925 install_element (ISIS_NODE, &no_net_cmd);
1926
1927 install_element (ISIS_NODE, &is_type_cmd);
1928 install_element (ISIS_NODE, &no_is_type_cmd);
1929
1930 install_element (ISIS_NODE, &area_passwd_cmd);
1931 install_element (ISIS_NODE, &no_area_passwd_cmd);
1932
1933 install_element (ISIS_NODE, &domain_passwd_cmd);
1934 install_element (ISIS_NODE, &no_domain_passwd_cmd);
1935
1936 install_element (ISIS_NODE, &lsp_gen_interval_cmd);
1937 install_element (ISIS_NODE, &no_lsp_gen_interval_cmd);
1938 install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd);
1939 install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd);
1940 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd);
1941 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd);
1942 install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd);
1943 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd);
1944 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd);
1945
1946 install_element (ISIS_NODE, &spf_interval_cmd);
1947 install_element (ISIS_NODE, &no_spf_interval_cmd);
1948 install_element (ISIS_NODE, &no_spf_interval_arg_cmd);
1949 install_element (ISIS_NODE, &spf_interval_l1_cmd);
1950 install_element (ISIS_NODE, &no_spf_interval_l1_cmd);
1951 install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd);
1952 install_element (ISIS_NODE, &spf_interval_l2_cmd);
1953 install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
1954 install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
1955
1956 install_element (ISIS_NODE, &lsp_lifetime_cmd);
1957 install_element (ISIS_NODE, &no_lsp_lifetime_cmd);
1958 install_element (ISIS_NODE, &no_lsp_lifetime_arg_cmd);
1959 install_element (ISIS_NODE, &lsp_lifetime_l1_cmd);
1960 install_element (ISIS_NODE, &no_lsp_lifetime_l1_cmd);
1961 install_element (ISIS_NODE, &no_lsp_lifetime_l1_arg_cmd);
1962 install_element (ISIS_NODE, &lsp_lifetime_l2_cmd);
1963 install_element (ISIS_NODE, &no_lsp_lifetime_l2_cmd);
1964 install_element (ISIS_NODE, &no_lsp_lifetime_l2_arg_cmd);
1965
1966 install_element (ISIS_NODE, &dynamic_hostname_cmd);
1967 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
1968
1969 install_element (ISIS_NODE, &metric_style_cmd);
1970 install_element (ISIS_NODE, &no_metric_style_cmd);
1971#ifdef TOPOLOGY_GENERATE
1972 install_element (ISIS_NODE, &topology_generate_grid_cmd);
1973 install_element (ISIS_NODE, &topology_baseis_cmd);
1974 install_element (ISIS_NODE, &no_topology_baseis_cmd);
1975 install_element (VIEW_NODE, &show_isis_topology_cmd);
1976 install_element (ENABLE_NODE, &show_isis_topology_cmd);
1977#endif /* TOPOLOGY_GENERATE */
1978
1979 isis_new(0);
1980 isis_circuit_init ();
1981 isis_zebra_init ();
1982 isis_spf_cmds_init ();
1983}
1984
1985
1986
1987
1988
1989