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