blob: 84e1c8894d0625550fc196477f71ad2a134e47ba [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
jardineb5d44e2003-12-23 08:09:43 +000023#include <zebra.h>
jardineb5d44e2003-12-23 08:09:43 +000024
25#include "thread.h"
26#include "vty.h"
27#include "command.h"
28#include "log.h"
29#include "memory.h"
30#include "linklist.h"
31#include "if.h"
32#include "hash.h"
33#include "stream.h"
34#include "prefix.h"
35#include "table.h"
36
37#include "isisd/dict.h"
38#include "isisd/include-netbsd/iso.h"
39#include "isisd/isis_constants.h"
40#include "isisd/isis_common.h"
41#include "isisd/isis_circuit.h"
42#include "isisd/isis_flags.h"
43#include "isisd/isisd.h"
44#include "isisd/isis_dynhn.h"
45#include "isisd/isis_adjacency.h"
46#include "isisd/isis_pdu.h"
47#include "isisd/isis_misc.h"
48#include "isisd/isis_constants.h"
49#include "isisd/isis_tlv.h"
50#include "isisd/isis_lsp.h"
51#include "isisd/isis_spf.h"
52#include "isisd/isis_route.h"
53#include "isisd/isis_zebra.h"
54#include "isisd/isis_events.h"
55
56#ifdef TOPOLOGY_GENERATE
57#include "spgrid.h"
hassof390d2c2004-09-10 20:48:21 +000058u_char DEFAULT_TOPOLOGY_BASEIS[6] = { 0xFE, 0xED, 0xFE, 0xED, 0x00, 0x00 };
jardineb5d44e2003-12-23 08:09:43 +000059#endif /* TOPOLOGY_GENERATE */
60
jardineb5d44e2003-12-23 08:09:43 +000061struct isis *isis = NULL;
hasso73d1aea2004-09-24 10:45:28 +000062extern struct thread_master *master;
jardineb5d44e2003-12-23 08:09:43 +000063
jardineb5d44e2003-12-23 08:09:43 +000064void
65isis_new (unsigned long process_id)
66{
hassoaac372f2005-09-01 17:52:33 +000067 isis = XCALLOC (MTYPE_ISIS, sizeof (struct isis));
jardineb5d44e2003-12-23 08:09:43 +000068 /*
69 * Default values
70 */
71 isis->max_area_addrs = 3;
72
73 isis->process_id = process_id;
74 isis->area_list = list_new ();
75 isis->init_circ_list = list_new ();
76 isis->uptime = time (NULL);
77 isis->nexthops = list_new ();
78#ifdef HAVE_IPV6
79 isis->nexthops6 = list_new ();
80#endif /* HAVE_IPV6 */
81 /*
82 * uncomment the next line for full debugs
83 */
hassof390d2c2004-09-10 20:48:21 +000084 /* isis->debugs = 0xFFFF; */
jardineb5d44e2003-12-23 08:09:43 +000085}
86
87struct isis_area *
88isis_area_create ()
89{
jardineb5d44e2003-12-23 08:09:43 +000090 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +000091
hassoaac372f2005-09-01 17:52:33 +000092 area = XCALLOC (MTYPE_ISIS_AREA, sizeof (struct isis_area));
jardineb5d44e2003-12-23 08:09:43 +000093
94 /*
95 * The first instance is level-1-2 rest are level-1, unless otherwise
96 * configured
97 */
98 if (listcount (isis->area_list) > 0)
99 area->is_type = IS_LEVEL_1;
100 else
101 area->is_type = IS_LEVEL_1_AND_2;
102 /*
103 * intialize the databases
104 */
105 area->lspdb[0] = lsp_db_init ();
106 area->lspdb[1] = lsp_db_init ();
hassof390d2c2004-09-10 20:48:21 +0000107
jardineb5d44e2003-12-23 08:09:43 +0000108 spftree_area_init (area);
hassofac1f7c2005-09-26 18:26:26 +0000109 area->route_table[0] = route_table_init ();
110 area->route_table[1] = route_table_init ();
jardineb5d44e2003-12-23 08:09:43 +0000111#ifdef HAVE_IPV6
hassofac1f7c2005-09-26 18:26:26 +0000112 area->route_table6[0] = route_table_init ();
113 area->route_table6[1] = route_table_init ();
jardineb5d44e2003-12-23 08:09:43 +0000114#endif /* HAVE_IPV6 */
115 area->circuit_list = list_new ();
116 area->area_addrs = list_new ();
hassof390d2c2004-09-10 20:48:21 +0000117 THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1);
jardineb5d44e2003-12-23 08:09:43 +0000118 area->flags.maxindex = -1;
119 /*
120 * Default values
121 */
hassof390d2c2004-09-10 20:48:21 +0000122 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200 */
123 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200 */
jardineb5d44e2003-12-23 08:09:43 +0000124 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
125 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
hassof390d2c2004-09-10 20:48:21 +0000126 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900 */
127 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900 */
jardineb5d44e2003-12-23 08:09:43 +0000128 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
129 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
130 area->dynhostname = 1;
hasso2984d262005-09-26 16:49:07 +0000131 area->oldmetric = 1;
jardineb5d44e2003-12-23 08:09:43 +0000132 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 *
hassof90a5f62004-10-11 13:11:56 +0000144isis_area_lookup (const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000145{
146 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +0000147 struct listnode *node;
hassof390d2c2004-09-10 20:48:21 +0000148
hasso3fdb2dd2005-09-28 18:45:54 +0000149 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
jardineb5d44e2003-12-23 08:09:43 +0000150 if ((area->area_tag == NULL && area_tag == NULL) ||
hassof390d2c2004-09-10 20:48:21 +0000151 (area->area_tag && area_tag
152 && strcmp (area->area_tag, area_tag) == 0))
153 return area;
154
jardineb5d44e2003-12-23 08:09:43 +0000155 return NULL;
156}
157
hassof390d2c2004-09-10 20:48:21 +0000158int
hassof90a5f62004-10-11 13:11:56 +0000159isis_area_get (struct vty *vty, const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000160{
jardineb5d44e2003-12-23 08:09:43 +0000161 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000162
jardineb5d44e2003-12-23 08:09:43 +0000163 area = isis_area_lookup (area_tag);
hassof390d2c2004-09-10 20:48:21 +0000164
165 if (area)
166 {
167 vty->node = ISIS_NODE;
168 vty->index = area;
169 return CMD_SUCCESS;
170 }
171
jardineb5d44e2003-12-23 08:09:43 +0000172 area = isis_area_create ();
173 area->area_tag = strdup (area_tag);
174 listnode_add (isis->area_list, area);
hassof390d2c2004-09-10 20:48:21 +0000175
hassoc89c05d2005-09-04 21:36:36 +0000176 if (isis->debugs & DEBUG_EVENTS)
177 zlog_debug ("New IS-IS area instance %s", area->area_tag);
jardineb5d44e2003-12-23 08:09:43 +0000178
179 vty->node = ISIS_NODE;
180 vty->index = area;
hassof390d2c2004-09-10 20:48:21 +0000181
jardineb5d44e2003-12-23 08:09:43 +0000182 return CMD_SUCCESS;
183}
184
185int
hassof90a5f62004-10-11 13:11:56 +0000186isis_area_destroy (struct vty *vty, const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000187{
jardineb5d44e2003-12-23 08:09:43 +0000188 struct isis_area *area;
paul1eb8ef22005-04-07 07:30:20 +0000189 struct listnode *node, *nnode;
jardineb5d44e2003-12-23 08:09:43 +0000190 struct isis_circuit *circuit;
191
192 area = isis_area_lookup (area_tag);
jardineb5d44e2003-12-23 08:09:43 +0000193
hassof390d2c2004-09-10 20:48:21 +0000194 if (area == NULL)
195 {
196 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
197 return CMD_WARNING;
jardineb5d44e2003-12-23 08:09:43 +0000198 }
hassof390d2c2004-09-10 20:48:21 +0000199
200 if (area->circuit_list)
201 {
paul1eb8ef22005-04-07 07:30:20 +0000202 for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))
203 isis_circuit_del (circuit);
204
hassof390d2c2004-09-10 20:48:21 +0000205 list_delete (area->circuit_list);
206 }
jardineb5d44e2003-12-23 08:09:43 +0000207 listnode_delete (isis->area_list, area);
hassof390d2c2004-09-10 20:48:21 +0000208 THREAD_TIMER_OFF (area->t_tick);
jardineb5d44e2003-12-23 08:09:43 +0000209 if (area->t_remove_aged)
210 thread_cancel (area->t_remove_aged);
hassof390d2c2004-09-10 20:48:21 +0000211 THREAD_TIMER_OFF (area->t_lsp_refresh[0]);
212 THREAD_TIMER_OFF (area->t_lsp_refresh[1]);
jardineb5d44e2003-12-23 08:09:43 +0000213
214 XFREE (MTYPE_ISIS_AREA, area);
hassof390d2c2004-09-10 20:48:21 +0000215
jardineb5d44e2003-12-23 08:09:43 +0000216 return CMD_SUCCESS;
217}
218
hassof390d2c2004-09-10 20:48:21 +0000219int
hassof7c43dc2004-09-26 16:24:14 +0000220area_net_title (struct vty *vty, u_char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000221{
jardineb5d44e2003-12-23 08:09:43 +0000222 struct isis_area *area;
223 struct area_addr *addr;
224 struct area_addr *addrp;
hasso3fdb2dd2005-09-28 18:45:54 +0000225 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000226
227 u_char buff[255];
228 area = vty->index;
229
hassof390d2c2004-09-10 20:48:21 +0000230 if (!area)
231 {
232 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
233 return CMD_WARNING;
234 }
jardineb5d44e2003-12-23 08:09:43 +0000235
236 /* We check that we are not over the maximal number of addresses */
hassof390d2c2004-09-10 20:48:21 +0000237 if (listcount (area->area_addrs) >= isis->max_area_addrs)
238 {
239 vty_out (vty, "Maximum of area addresses (%d) already reached %s",
240 isis->max_area_addrs, VTY_NEWLINE);
241 return CMD_WARNING;
242 }
jardineb5d44e2003-12-23 08:09:43 +0000243
244 addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));
245 addr->addr_len = dotformat2buff (buff, net_title);
246 memcpy (addr->area_addr, buff, addr->addr_len);
247#ifdef EXTREME_DEBUG
hasso529d65b2004-12-24 00:14:50 +0000248 zlog_debug ("added area address %s for area %s (address length %d)",
jardineb5d44e2003-12-23 08:09:43 +0000249 net_title, area->area_tag, addr->addr_len);
250#endif /* EXTREME_DEBUG */
hassof390d2c2004-09-10 20:48:21 +0000251 if (addr->addr_len < 8 || addr->addr_len > 20)
252 {
253 zlog_warn ("area address must be at least 8..20 octets long (%d)",
254 addr->addr_len);
jardineb5d44e2003-12-23 08:09:43 +0000255 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
256 return CMD_WARNING;
257 }
258
hassof390d2c2004-09-10 20:48:21 +0000259 if (isis->sysid_set == 0)
260 {
261 /*
262 * First area address - get the SystemID for this router
263 */
264 memcpy (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN), ISIS_SYS_ID_LEN);
265 isis->sysid_set = 1;
hassoc89c05d2005-09-04 21:36:36 +0000266 if (isis->debugs & DEBUG_EVENTS)
267 zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid));
jardineb5d44e2003-12-23 08:09:43 +0000268 }
hassof390d2c2004-09-10 20:48:21 +0000269 else
270 {
271 /*
272 * Check that the SystemID portions match
273 */
274 if (memcmp (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN),
275 ISIS_SYS_ID_LEN))
276 {
277 vty_out (vty,
278 "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 }
jardineb5d44e2003-12-23 08:09:43 +0000283
hassof390d2c2004-09-10 20:48:21 +0000284 /* now we see that we don't already have this address */
hasso3fdb2dd2005-09-28 18:45:54 +0000285 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
286 {
287 if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) != (addr->addr_len))
288 continue;
289 if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
290 {
291 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
292 return CMD_SUCCESS; /* silent fail */
293 }
294 }
hassof390d2c2004-09-10 20:48:21 +0000295
296 }
jardineb5d44e2003-12-23 08:09:43 +0000297 /*
298 * Forget the systemID part of the address
299 */
300 addr->addr_len -= (ISIS_SYS_ID_LEN + 1);
301 listnode_add (area->area_addrs, addr);
302
303 /* only now we can safely generate our LSPs for this area */
hassof390d2c2004-09-10 20:48:21 +0000304 if (listcount (area->area_addrs) > 0)
305 {
306 lsp_l1_generate (area);
307 lsp_l2_generate (area);
308 }
jardineb5d44e2003-12-23 08:09:43 +0000309
310 return CMD_SUCCESS;
311}
312
313int
hassof7c43dc2004-09-26 16:24:14 +0000314area_clear_net_title (struct vty *vty, u_char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000315{
316 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000317 struct area_addr addr, *addrp = NULL;
hasso3fdb2dd2005-09-28 18:45:54 +0000318 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000319 u_char buff[255];
320
321 area = vty->index;
hassof390d2c2004-09-10 20:48:21 +0000322 if (!area)
323 {
324 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
325 return CMD_WARNING;
326 }
327
jardineb5d44e2003-12-23 08:09:43 +0000328 addr.addr_len = dotformat2buff (buff, net_title);
hassof390d2c2004-09-10 20:48:21 +0000329 if (addr.addr_len < 8 || addr.addr_len > 20)
330 {
331 vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
332 addr.addr_len, VTY_NEWLINE);
333 return CMD_WARNING;
334 }
335
336 memcpy (addr.area_addr, buff, (int) addr.addr_len);
337
hasso3fdb2dd2005-09-28 18:45:54 +0000338 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
jardineb5d44e2003-12-23 08:09:43 +0000339 if (addrp->addr_len == addr.addr_len &&
340 !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
hassof390d2c2004-09-10 20:48:21 +0000341 break;
342
343 if (!addrp)
344 {
345 vty_out (vty, "No area address %s for area %s %s", net_title,
346 area->area_tag, VTY_NEWLINE);
347 return CMD_WARNING;
348 }
349
jardineb5d44e2003-12-23 08:09:43 +0000350 listnode_delete (area->area_addrs, addrp);
hassof390d2c2004-09-10 20:48:21 +0000351
jardineb5d44e2003-12-23 08:09:43 +0000352 return CMD_SUCCESS;
353}
354
jardineb5d44e2003-12-23 08:09:43 +0000355/*
356 * 'show clns neighbors' command
357 */
358
359int
hassof390d2c2004-09-10 20:48:21 +0000360show_clns_neigh (struct vty *vty, char detail)
jardineb5d44e2003-12-23 08:09:43 +0000361{
hasso3fdb2dd2005-09-28 18:45:54 +0000362 struct listnode *anode, *cnode;
jardineb5d44e2003-12-23 08:09:43 +0000363 struct isis_area *area;
364 struct isis_circuit *circuit;
365 struct list *db;
366 int i;
367
hassof390d2c2004-09-10 20:48:21 +0000368 if (!isis)
369 {
370 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
371 return CMD_SUCCESS;
372 }
jardineb5d44e2003-12-23 08:09:43 +0000373
hasso3fdb2dd2005-09-28 18:45:54 +0000374 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
hassof390d2c2004-09-10 20:48:21 +0000375 {
hassof390d2c2004-09-10 20:48:21 +0000376 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000377
hassof390d2c2004-09-10 20:48:21 +0000378 if (detail == ISIS_UI_LEVEL_BRIEF)
379 vty_out (vty, " System Id Interface L State "
380 "Holdtime SNPA%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000381
hasso3fdb2dd2005-09-28 18:45:54 +0000382 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
hassof390d2c2004-09-10 20:48:21 +0000383 {
hassof390d2c2004-09-10 20:48:21 +0000384 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
385 {
386 for (i = 0; i < 2; i++)
387 {
388 db = circuit->u.bc.adjdb[i];
389 if (db && db->count)
390 {
391 if (detail == ISIS_UI_LEVEL_BRIEF)
392 isis_adjdb_iterate (db,
393 (void (*)
394 (struct isis_adjacency *,
395 void *)) isis_adj_print_vty,
396 vty);
397 if (detail == ISIS_UI_LEVEL_DETAIL)
398 isis_adjdb_iterate (db,
399 (void (*)
400 (struct isis_adjacency *,
401 void *))
402 isis_adj_print_vty_detail, vty);
403 if (detail == ISIS_UI_LEVEL_EXTENSIVE)
404 isis_adjdb_iterate (db,
405 (void (*)
406 (struct isis_adjacency *,
407 void *))
408 isis_adj_print_vty_extensive,
409 vty);
410 }
411 }
412 }
413 else if (circuit->circ_type == CIRCUIT_T_P2P &&
414 circuit->u.p2p.neighbor)
415 {
416 if (detail == ISIS_UI_LEVEL_BRIEF)
417 isis_adj_p2p_print_vty (circuit->u.p2p.neighbor, vty);
418 if (detail == ISIS_UI_LEVEL_DETAIL)
419 isis_adj_p2p_print_vty_detail (circuit->u.p2p.neighbor, vty);
420 if (detail == ISIS_UI_LEVEL_EXTENSIVE)
421 isis_adj_p2p_print_vty_extensive (circuit->u.p2p.neighbor,
422 vty);
423 }
424 }
jardineb5d44e2003-12-23 08:09:43 +0000425 }
hassof390d2c2004-09-10 20:48:21 +0000426
jardineb5d44e2003-12-23 08:09:43 +0000427 return CMD_SUCCESS;
428}
429
430DEFUN (show_clns_neighbors,
431 show_clns_neighbors_cmd,
432 "show clns neighbors",
433 SHOW_STR
434 "clns network information\n"
435 "CLNS neighbor adjacencies\n")
436{
hassof390d2c2004-09-10 20:48:21 +0000437 return show_clns_neigh (vty, ISIS_UI_LEVEL_BRIEF);
jardineb5d44e2003-12-23 08:09:43 +0000438}
439
440ALIAS (show_clns_neighbors,
441 show_isis_neighbors_cmd,
442 "show isis neighbors",
443 SHOW_STR
444 "IS-IS network information\n"
445 "IS-IS neighbor adjacencies\n")
446
447DEFUN (show_clns_neighbors_detail,
448 show_clns_neighbors_detail_cmd,
449 "show clns neighbors detail",
450 SHOW_STR
451 "clns network information\n"
452 "CLNS neighbor adjacencies\n"
453 "show detailed information\n")
454{
hassof390d2c2004-09-10 20:48:21 +0000455 return show_clns_neigh (vty, ISIS_UI_LEVEL_DETAIL);
jardineb5d44e2003-12-23 08:09:43 +0000456}
457
458ALIAS (show_clns_neighbors_detail,
459 show_isis_neighbors_detail_cmd,
460 "show isis neighbors detail",
461 SHOW_STR
462 "IS-IS network information\n"
463 "IS-IS neighbor adjacencies\n"
464 "show detailed information\n")
jardineb5d44e2003-12-23 08:09:43 +0000465/*
466 * 'isis debug', 'show debugging'
467 */
jardineb5d44e2003-12-23 08:09:43 +0000468void
469print_debug (struct vty *vty, int flags, int onoff)
470{
471 char onoffs[4];
472 if (onoff)
hassof390d2c2004-09-10 20:48:21 +0000473 strcpy (onoffs, "on");
jardineb5d44e2003-12-23 08:09:43 +0000474 else
hassof390d2c2004-09-10 20:48:21 +0000475 strcpy (onoffs, "off");
jardineb5d44e2003-12-23 08:09:43 +0000476
477 if (flags & DEBUG_ADJ_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000478 vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs,
479 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000480 if (flags & DEBUG_CHECKSUM_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000481 vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs,
482 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000483 if (flags & DEBUG_LOCAL_UPDATES)
hassof390d2c2004-09-10 20:48:21 +0000484 vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs,
485 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000486 if (flags & DEBUG_PROTOCOL_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000487 vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs,
488 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000489 if (flags & DEBUG_SNP_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000490 vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs,
491 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000492 if (flags & DEBUG_SPF_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000493 vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000494 if (flags & DEBUG_SPF_STATS)
hassof390d2c2004-09-10 20:48:21 +0000495 vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s",
496 onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000497 if (flags & DEBUG_SPF_TRIGGERS)
hassof390d2c2004-09-10 20:48:21 +0000498 vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs,
499 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000500 if (flags & DEBUG_UPDATE_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000501 vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs,
502 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000503 if (flags & DEBUG_RTE_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000504 vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs,
505 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000506 if (flags & DEBUG_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000507 vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000508
509}
510
511DEFUN (show_debugging,
512 show_debugging_cmd,
513 "show debugging",
514 SHOW_STR
515 "State of each debugging option\n")
516{
hassof390d2c2004-09-10 20:48:21 +0000517 vty_out (vty, "IS-IS:%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000518 print_debug (vty, isis->debugs, 1);
519 return CMD_SUCCESS;
520}
521
jardin9e867fe2003-12-23 08:56:18 +0000522/* Debug node. */
hassof390d2c2004-09-10 20:48:21 +0000523static struct cmd_node debug_node = {
jardin9e867fe2003-12-23 08:56:18 +0000524 DEBUG_NODE,
hassof390d2c2004-09-10 20:48:21 +0000525 "",
526 1
jardin9e867fe2003-12-23 08:56:18 +0000527};
528
529static int
530config_write_debug (struct vty *vty)
531{
532 int write = 0;
533 int flags = isis->debugs;
534
hassof390d2c2004-09-10 20:48:21 +0000535 if (flags & DEBUG_ADJ_PACKETS)
536 {
537 vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE);
538 write++;
539 }
540 if (flags & DEBUG_CHECKSUM_ERRORS)
541 {
542 vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE);
543 write++;
544 }
545 if (flags & DEBUG_LOCAL_UPDATES)
546 {
547 vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE);
548 write++;
549 }
550 if (flags & DEBUG_PROTOCOL_ERRORS)
551 {
552 vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE);
553 write++;
554 }
555 if (flags & DEBUG_SNP_PACKETS)
556 {
557 vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE);
558 write++;
559 }
560 if (flags & DEBUG_SPF_EVENTS)
561 {
562 vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE);
563 write++;
564 }
565 if (flags & DEBUG_SPF_STATS)
566 {
567 vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE);
568 write++;
569 }
570 if (flags & DEBUG_SPF_TRIGGERS)
571 {
572 vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE);
573 write++;
574 }
575 if (flags & DEBUG_UPDATE_PACKETS)
576 {
577 vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE);
578 write++;
579 }
580 if (flags & DEBUG_RTE_EVENTS)
581 {
582 vty_out (vty, "debug isis route-events%s", VTY_NEWLINE);
583 write++;
584 }
585 if (flags & DEBUG_EVENTS)
586 {
587 vty_out (vty, "debug isis events%s", VTY_NEWLINE);
588 write++;
589 }
jardin9e867fe2003-12-23 08:56:18 +0000590
591 return write;
592}
593
jardineb5d44e2003-12-23 08:09:43 +0000594DEFUN (debug_isis_adj,
595 debug_isis_adj_cmd,
596 "debug isis adj-packets",
597 DEBUG_STR
598 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000599 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000600{
601 isis->debugs |= DEBUG_ADJ_PACKETS;
hassof390d2c2004-09-10 20:48:21 +0000602 print_debug (vty, DEBUG_ADJ_PACKETS, 1);
jardineb5d44e2003-12-23 08:09:43 +0000603
604 return CMD_SUCCESS;
605}
606
607DEFUN (no_debug_isis_adj,
608 no_debug_isis_adj_cmd,
609 "no debug isis adj-packets",
610 UNDEBUG_STR
611 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000612 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000613{
jardineb5d44e2003-12-23 08:09:43 +0000614 isis->debugs &= ~DEBUG_ADJ_PACKETS;
615 print_debug (vty, DEBUG_ADJ_PACKETS, 0);
616
617 return CMD_SUCCESS;
618}
619
jardineb5d44e2003-12-23 08:09:43 +0000620DEFUN (debug_isis_csum,
621 debug_isis_csum_cmd,
622 "debug isis checksum-errors",
623 DEBUG_STR
624 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000625 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000626{
627 isis->debugs |= DEBUG_CHECKSUM_ERRORS;
628 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1);
629
630 return CMD_SUCCESS;
631}
632
633DEFUN (no_debug_isis_csum,
634 no_debug_isis_csum_cmd,
635 "no debug isis checksum-errors",
636 UNDEBUG_STR
637 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000638 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000639{
640 isis->debugs &= ~DEBUG_CHECKSUM_ERRORS;
641 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000642
jardineb5d44e2003-12-23 08:09:43 +0000643 return CMD_SUCCESS;
644}
645
646DEFUN (debug_isis_lupd,
647 debug_isis_lupd_cmd,
648 "debug isis local-updates",
649 DEBUG_STR
650 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000651 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000652{
653 isis->debugs |= DEBUG_LOCAL_UPDATES;
654 print_debug (vty, DEBUG_LOCAL_UPDATES, 1);
655
656 return CMD_SUCCESS;
657}
658
659DEFUN (no_debug_isis_lupd,
660 no_debug_isis_lupd_cmd,
661 "no debug isis local-updates",
662 UNDEBUG_STR
663 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000664 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000665{
666 isis->debugs &= ~DEBUG_LOCAL_UPDATES;
hassof390d2c2004-09-10 20:48:21 +0000667 print_debug (vty, DEBUG_LOCAL_UPDATES, 0);
668
jardineb5d44e2003-12-23 08:09:43 +0000669 return CMD_SUCCESS;
670}
671
672DEFUN (debug_isis_err,
673 debug_isis_err_cmd,
hassof390d2c2004-09-10 20:48:21 +0000674 "debug isis protocol-errors",
jardineb5d44e2003-12-23 08:09:43 +0000675 DEBUG_STR
676 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000677 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000678{
679 isis->debugs |= DEBUG_PROTOCOL_ERRORS;
680 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1);
681
682 return CMD_SUCCESS;
683}
684
685DEFUN (no_debug_isis_err,
686 no_debug_isis_err_cmd,
687 "no debug isis protocol-errors",
688 UNDEBUG_STR
689 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000690 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000691{
692 isis->debugs &= ~DEBUG_PROTOCOL_ERRORS;
693 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000694
jardineb5d44e2003-12-23 08:09:43 +0000695 return CMD_SUCCESS;
696}
697
698DEFUN (debug_isis_snp,
699 debug_isis_snp_cmd,
700 "debug isis snp-packets",
701 DEBUG_STR
702 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000703 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000704{
705 isis->debugs |= DEBUG_SNP_PACKETS;
706 print_debug (vty, DEBUG_SNP_PACKETS, 1);
707
708 return CMD_SUCCESS;
709}
710
711DEFUN (no_debug_isis_snp,
712 no_debug_isis_snp_cmd,
713 "no debug isis snp-packets",
714 UNDEBUG_STR
715 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000716 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000717{
hassof390d2c2004-09-10 20:48:21 +0000718 isis->debugs &= ~DEBUG_SNP_PACKETS;
jardineb5d44e2003-12-23 08:09:43 +0000719 print_debug (vty, DEBUG_SNP_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +0000720
jardineb5d44e2003-12-23 08:09:43 +0000721 return CMD_SUCCESS;
722}
723
jardineb5d44e2003-12-23 08:09:43 +0000724DEFUN (debug_isis_upd,
725 debug_isis_upd_cmd,
726 "debug isis update-packets",
727 DEBUG_STR
728 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000729 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000730{
731 isis->debugs |= DEBUG_UPDATE_PACKETS;
732 print_debug (vty, DEBUG_UPDATE_PACKETS, 1);
733
734 return CMD_SUCCESS;
735}
736
737DEFUN (no_debug_isis_upd,
738 no_debug_isis_upd_cmd,
739 "no debug isis update-packets",
740 UNDEBUG_STR
741 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000742 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000743{
744 isis->debugs &= ~DEBUG_UPDATE_PACKETS;
745 print_debug (vty, DEBUG_UPDATE_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +0000746
jardineb5d44e2003-12-23 08:09:43 +0000747 return CMD_SUCCESS;
748}
749
jardineb5d44e2003-12-23 08:09:43 +0000750DEFUN (debug_isis_spfevents,
751 debug_isis_spfevents_cmd,
752 "debug isis spf-events",
753 DEBUG_STR
754 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000755 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000756{
757 isis->debugs |= DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +0000758 print_debug (vty, DEBUG_SPF_EVENTS, 1);
jardineb5d44e2003-12-23 08:09:43 +0000759
760 return CMD_SUCCESS;
761}
762
763DEFUN (no_debug_isis_spfevents,
764 no_debug_isis_spfevents_cmd,
765 "no debug isis spf-events",
766 UNDEBUG_STR
767 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000768 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000769{
770 isis->debugs &= ~DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +0000771 print_debug (vty, DEBUG_SPF_EVENTS, 0);
772
jardineb5d44e2003-12-23 08:09:43 +0000773 return CMD_SUCCESS;
774}
775
776
777DEFUN (debug_isis_spfstats,
778 debug_isis_spfstats_cmd,
779 "debug isis spf-statistics ",
780 DEBUG_STR
781 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000782 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +0000783{
784 isis->debugs |= DEBUG_SPF_STATS;
785 print_debug (vty, DEBUG_SPF_STATS, 1);
786
787 return CMD_SUCCESS;
788}
789
790DEFUN (no_debug_isis_spfstats,
791 no_debug_isis_spfstats_cmd,
792 "no debug isis spf-statistics",
793 UNDEBUG_STR
794 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000795 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +0000796{
797 isis->debugs &= ~DEBUG_SPF_STATS;
798 print_debug (vty, DEBUG_SPF_STATS, 0);
hassof390d2c2004-09-10 20:48:21 +0000799
jardineb5d44e2003-12-23 08:09:43 +0000800 return CMD_SUCCESS;
801}
802
803DEFUN (debug_isis_spftrigg,
804 debug_isis_spftrigg_cmd,
805 "debug isis spf-triggers",
806 DEBUG_STR
807 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000808 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +0000809{
810 isis->debugs |= DEBUG_SPF_TRIGGERS;
811 print_debug (vty, DEBUG_SPF_TRIGGERS, 1);
812
813 return CMD_SUCCESS;
814}
815
816DEFUN (no_debug_isis_spftrigg,
817 no_debug_isis_spftrigg_cmd,
818 "no debug isis spf-triggers",
819 UNDEBUG_STR
820 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000821 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +0000822{
823 isis->debugs &= ~DEBUG_SPF_TRIGGERS;
824 print_debug (vty, DEBUG_SPF_TRIGGERS, 0);
hassof390d2c2004-09-10 20:48:21 +0000825
jardineb5d44e2003-12-23 08:09:43 +0000826 return CMD_SUCCESS;
827}
828
829DEFUN (debug_isis_rtevents,
830 debug_isis_rtevents_cmd,
831 "debug isis route-events",
832 DEBUG_STR
833 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000834 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +0000835{
836 isis->debugs |= DEBUG_RTE_EVENTS;
837 print_debug (vty, DEBUG_RTE_EVENTS, 1);
838
839 return CMD_SUCCESS;
840}
841
842DEFUN (no_debug_isis_rtevents,
843 no_debug_isis_rtevents_cmd,
844 "no debug isis route-events",
845 UNDEBUG_STR
846 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000847 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +0000848{
849 isis->debugs &= ~DEBUG_RTE_EVENTS;
850 print_debug (vty, DEBUG_RTE_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +0000851
jardineb5d44e2003-12-23 08:09:43 +0000852 return CMD_SUCCESS;
853}
854
855DEFUN (debug_isis_events,
856 debug_isis_events_cmd,
857 "debug isis events",
858 DEBUG_STR
859 "IS-IS information\n"
hassof1082d12005-09-19 04:23:34 +0000860 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000861{
862 isis->debugs |= DEBUG_EVENTS;
863 print_debug (vty, DEBUG_EVENTS, 1);
864
865 return CMD_SUCCESS;
866}
867
868DEFUN (no_debug_isis_events,
869 no_debug_isis_events_cmd,
870 "no debug isis events",
871 UNDEBUG_STR
872 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000873 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000874{
875 isis->debugs &= ~DEBUG_EVENTS;
876 print_debug (vty, DEBUG_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +0000877
jardineb5d44e2003-12-23 08:09:43 +0000878 return CMD_SUCCESS;
879}
880
jardineb5d44e2003-12-23 08:09:43 +0000881DEFUN (show_hostname,
882 show_hostname_cmd,
883 "show isis hostname",
884 SHOW_STR
885 "IS-IS information\n"
886 "IS-IS Dynamic hostname mapping\n")
887{
888 dynhn_print_all (vty);
hassof390d2c2004-09-10 20:48:21 +0000889
jardineb5d44e2003-12-23 08:09:43 +0000890 return CMD_SUCCESS;
891}
892
jardineb5d44e2003-12-23 08:09:43 +0000893DEFUN (show_database,
894 show_database_cmd,
895 "show isis database",
hassof390d2c2004-09-10 20:48:21 +0000896 SHOW_STR "IS-IS information\n" "IS-IS link state database\n")
jardineb5d44e2003-12-23 08:09:43 +0000897{
hasso3fdb2dd2005-09-28 18:45:54 +0000898 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000899 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000900 int level, lsp_count;
jardineb5d44e2003-12-23 08:09:43 +0000901
902 if (isis->area_list->count == 0)
903 return CMD_SUCCESS;
jardineb5d44e2003-12-23 08:09:43 +0000904
hasso3fdb2dd2005-09-28 18:45:54 +0000905 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +0000906 {
hassof390d2c2004-09-10 20:48:21 +0000907 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
908 VTY_NEWLINE);
909 for (level = 0; level < ISIS_LEVELS; level++)
910 {
911 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
912 {
913 vty_out (vty, "IS-IS Level-%d link-state database:%s",
914 level + 1, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000915
hassof390d2c2004-09-10 20:48:21 +0000916 lsp_count = lsp_print_all (vty, area->lspdb[level],
917 ISIS_UI_LEVEL_BRIEF,
918 area->dynhostname);
919
920 vty_out (vty, "%s %u LSPs%s%s",
921 VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE);
922 }
923 }
jardineb5d44e2003-12-23 08:09:43 +0000924 }
jardineb5d44e2003-12-23 08:09:43 +0000925
926 return CMD_SUCCESS;
927}
928
jardineb5d44e2003-12-23 08:09:43 +0000929DEFUN (show_database_detail,
930 show_database_detail_cmd,
931 "show isis database detail",
932 SHOW_STR
933 "IS-IS information\n"
934 "IS-IS link state database\n")
935{
hasso3fdb2dd2005-09-28 18:45:54 +0000936 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000937 struct isis_area *area;
938 int level, lsp_count;
939
940 if (isis->area_list->count == 0)
941 return CMD_SUCCESS;
942
hasso3fdb2dd2005-09-28 18:45:54 +0000943 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +0000944 {
hassof390d2c2004-09-10 20:48:21 +0000945 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
946 VTY_NEWLINE);
947 for (level = 0; level < ISIS_LEVELS; level++)
948 {
949 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
950 {
951 vty_out (vty, "IS-IS Level-%d Link State Database:%s",
952 level + 1, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000953
hassof390d2c2004-09-10 20:48:21 +0000954 lsp_count = lsp_print_all (vty, area->lspdb[level],
955 ISIS_UI_LEVEL_DETAIL,
956 area->dynhostname);
jardineb5d44e2003-12-23 08:09:43 +0000957
hassof390d2c2004-09-10 20:48:21 +0000958 vty_out (vty, "%s %u LSPs%s%s",
959 VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE);
960 }
961 }
jardineb5d44e2003-12-23 08:09:43 +0000962 }
jardineb5d44e2003-12-23 08:09:43 +0000963
964 return CMD_SUCCESS;
965}
966
967/*
968 * 'router isis' command
969 */
970DEFUN (router_isis,
971 router_isis_cmd,
972 "router isis WORD",
hassof390d2c2004-09-10 20:48:21 +0000973 ROUTER_STR
jardineb5d44e2003-12-23 08:09:43 +0000974 "ISO IS-IS\n"
975 "ISO Routing area tag")
976{
jardineb5d44e2003-12-23 08:09:43 +0000977 return isis_area_get (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +0000978}
979
980/*
981 *'no router isis' command
982 */
983DEFUN (no_router_isis,
984 no_router_isis_cmd,
985 "no router isis WORD",
hassof390d2c2004-09-10 20:48:21 +0000986 "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag")
jardineb5d44e2003-12-23 08:09:43 +0000987{
988 return isis_area_destroy (vty, argv[0]);
989}
990
991/*
992 * 'net' command
993 */
994DEFUN (net,
995 net_cmd,
996 "net WORD",
997 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +0000998 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +0000999{
hassof7c43dc2004-09-26 16:24:14 +00001000 return area_net_title (vty, (u_char *)argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001001}
1002
jardineb5d44e2003-12-23 08:09:43 +00001003/*
1004 * 'no net' command
1005 */
1006DEFUN (no_net,
1007 no_net_cmd,
1008 "no net WORD",
1009 NO_STR
1010 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001011 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001012{
hassof7c43dc2004-09-26 16:24:14 +00001013 return area_clear_net_title (vty, (u_char *)argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001014}
1015
1016DEFUN (area_passwd,
1017 area_passwd_cmd,
1018 "area-password WORD",
1019 "Configure the authentication password for an area\n"
hassof390d2c2004-09-10 20:48:21 +00001020 "Area password\n")
jardineb5d44e2003-12-23 08:09:43 +00001021{
1022 struct isis_area *area;
1023 int len;
1024
1025 area = vty->index;
1026
hassof390d2c2004-09-10 20:48:21 +00001027 if (!area)
1028 {
1029 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1030 return CMD_WARNING;
1031 }
1032
jardineb5d44e2003-12-23 08:09:43 +00001033 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001034 if (len > 254)
1035 {
1036 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1037 return CMD_WARNING;
1038 }
1039 area->area_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001040 area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001041 strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001042
hasso1cbc5622005-01-01 10:29:51 +00001043 if (argc > 1)
1044 {
1045 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1046 if (strncmp(argv[1], "v", 1) == 0)
1047 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1048 else
1049 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1050 }
1051 else
1052 {
1053 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1054 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1055 }
1056
jardineb5d44e2003-12-23 08:09:43 +00001057 return CMD_SUCCESS;
1058}
1059
hasso1cbc5622005-01-01 10:29:51 +00001060ALIAS (area_passwd,
1061 area_passwd_snpauth_cmd,
1062 "area-password WORD authenticate snp (send-only|validate)",
1063 "Configure the authentication password for an area\n"
1064 "Area password\n"
1065 "Authentication\n"
1066 "SNP PDUs\n"
1067 "Send but do not check PDUs on receiving\n"
1068 "Send and check PDUs on receiving\n");
1069
jardineb5d44e2003-12-23 08:09:43 +00001070DEFUN (no_area_passwd,
1071 no_area_passwd_cmd,
1072 "no area-password",
1073 NO_STR
1074 "Configure the authentication password for an area\n")
1075{
1076 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001077
jardineb5d44e2003-12-23 08:09:43 +00001078 area = vty->index;
1079
hassof390d2c2004-09-10 20:48:21 +00001080 if (!area)
1081 {
1082 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1083 return CMD_WARNING;
1084 }
1085
jardineb5d44e2003-12-23 08:09:43 +00001086 memset (&area->area_passwd, 0, sizeof (struct isis_passwd));
1087
1088 return CMD_SUCCESS;
1089}
1090
jardineb5d44e2003-12-23 08:09:43 +00001091DEFUN (domain_passwd,
1092 domain_passwd_cmd,
1093 "domain-password WORD",
1094 "Set the authentication password for a routing domain\n"
hassof390d2c2004-09-10 20:48:21 +00001095 "Routing domain password\n")
jardineb5d44e2003-12-23 08:09:43 +00001096{
1097 struct isis_area *area;
1098 int len;
1099
1100 area = vty->index;
1101
hassof390d2c2004-09-10 20:48:21 +00001102 if (!area)
1103 {
1104 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1105 return CMD_WARNING;
1106 }
1107
jardineb5d44e2003-12-23 08:09:43 +00001108 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001109 if (len > 254)
1110 {
1111 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1112 return CMD_WARNING;
1113 }
1114 area->domain_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001115 area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001116 strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001117
hasso1cbc5622005-01-01 10:29:51 +00001118 if (argc > 1)
1119 {
1120 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1121 if (strncmp(argv[1], "v", 1) == 0)
1122 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1123 else
1124 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1125 }
1126 else
1127 {
1128 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1129 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1130 }
1131
jardineb5d44e2003-12-23 08:09:43 +00001132 return CMD_SUCCESS;
1133}
1134
hasso1cbc5622005-01-01 10:29:51 +00001135ALIAS (domain_passwd,
1136 domain_passwd_snpauth_cmd,
1137 "domain-password WORD authenticate snp (send-only|validate)",
1138 "Set the authentication password for a routing domain\n"
1139 "Routing domain password\n"
1140 "Authentication\n"
1141 "SNP PDUs\n"
1142 "Send but do not check PDUs on receiving\n"
1143 "Send and check PDUs on receiving\n");
1144
jardineb5d44e2003-12-23 08:09:43 +00001145DEFUN (no_domain_passwd,
1146 no_domain_passwd_cmd,
1147 "no domain-password WORD",
1148 NO_STR
1149 "Set the authentication password for a routing domain\n")
1150{
1151 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001152
jardineb5d44e2003-12-23 08:09:43 +00001153 area = vty->index;
1154
hassof390d2c2004-09-10 20:48:21 +00001155 if (!area)
1156 {
1157 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1158 return CMD_WARNING;
1159 }
1160
jardineb5d44e2003-12-23 08:09:43 +00001161 memset (&area->domain_passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001162
jardineb5d44e2003-12-23 08:09:43 +00001163 return CMD_SUCCESS;
1164}
1165
1166DEFUN (is_type,
1167 is_type_cmd,
1168 "is-type (level-1|level-1-2|level-2-only)",
1169 "IS Level for this routing process (OSI only)\n"
1170 "Act as a station router only\n"
1171 "Act as both a station router and an area router\n"
1172 "Act as an area router only\n")
1173{
1174 struct isis_area *area;
1175 int type;
1176
1177 area = vty->index;
1178
hassof390d2c2004-09-10 20:48:21 +00001179 if (!area)
1180 {
1181 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1182 return CMD_WARNING;
1183 }
jardineb5d44e2003-12-23 08:09:43 +00001184
hassof7c43dc2004-09-26 16:24:14 +00001185 type = string2circuit_t ((u_char *)argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001186 if (!type)
1187 {
1188 vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
1189 return CMD_SUCCESS;
1190 }
jardineb5d44e2003-12-23 08:09:43 +00001191
1192 isis_event_system_type_change (area, type);
hassof390d2c2004-09-10 20:48:21 +00001193
jardineb5d44e2003-12-23 08:09:43 +00001194 return CMD_SUCCESS;
1195}
1196
1197DEFUN (no_is_type,
1198 no_is_type_cmd,
1199 "no is-type (level-1|level-1-2|level-2-only)",
1200 NO_STR
1201 "IS Level for this routing process (OSI only)\n"
1202 "Act as a station router only\n"
1203 "Act as both a station router and an area router\n"
1204 "Act as an area router only\n")
1205{
jardineb5d44e2003-12-23 08:09:43 +00001206 struct isis_area *area;
1207 int type;
1208
1209 area = vty->index;
1210 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001211
jardineb5d44e2003-12-23 08:09:43 +00001212 /*
1213 * Put the is-type back to default. Which is level-1-2 on first
1214 * circuit for the area level-1 for the rest
1215 */
paul1eb8ef22005-04-07 07:30:20 +00001216 if (listgetdata (listhead (isis->area_list)) == area)
jardineb5d44e2003-12-23 08:09:43 +00001217 type = IS_LEVEL_1_AND_2;
1218 else
1219 type = IS_LEVEL_1;
1220
1221 isis_event_system_type_change (area, type);
1222
1223 return CMD_SUCCESS;
1224}
1225
1226DEFUN (lsp_gen_interval,
1227 lsp_gen_interval_cmd,
1228 "lsp-gen-interval <1-120>",
1229 "Minimum interval between regenerating same LSP\n"
1230 "Minimum interval in seconds\n")
1231{
1232 struct isis_area *area;
1233 uint16_t interval;
1234
1235 area = vty->index;
1236 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001237
jardineb5d44e2003-12-23 08:09:43 +00001238 interval = atoi (argv[0]);
1239 area->lsp_gen_interval[0] = interval;
1240 area->lsp_gen_interval[1] = interval;
1241
1242 return CMD_SUCCESS;
1243}
1244
1245DEFUN (no_lsp_gen_interval,
1246 no_lsp_gen_interval_cmd,
1247 "no lsp-gen-interval",
1248 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001249 "Minimum interval between regenerating same LSP\n")
jardineb5d44e2003-12-23 08:09:43 +00001250{
1251 struct isis_area *area;
1252
1253 area = vty->index;
1254 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001255
jardineb5d44e2003-12-23 08:09:43 +00001256 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
1257 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
1258
1259 return CMD_SUCCESS;
1260}
1261
1262ALIAS (no_lsp_gen_interval,
1263 no_lsp_gen_interval_arg_cmd,
1264 "no lsp-gen-interval <1-120>",
1265 NO_STR
1266 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001267 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001268
1269DEFUN (lsp_gen_interval_l1,
1270 lsp_gen_interval_l1_cmd,
1271 "lsp-gen-interval level-1 <1-120>",
1272 "Minimum interval between regenerating same LSP\n"
1273 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001274 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001275{
1276 struct isis_area *area;
1277 uint16_t interval;
1278
1279 area = vty->index;
1280 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001281
jardineb5d44e2003-12-23 08:09:43 +00001282 interval = atoi (argv[0]);
1283 area->lsp_gen_interval[0] = interval;
1284
1285 return CMD_SUCCESS;
1286}
1287
1288DEFUN (no_lsp_gen_interval_l1,
1289 no_lsp_gen_interval_l1_cmd,
1290 "no lsp-gen-interval level-1",
1291 NO_STR
1292 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001293 "Set interval for level 1 only\n")
jardineb5d44e2003-12-23 08:09:43 +00001294{
1295 struct isis_area *area;
1296
1297 area = vty->index;
1298 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001299
jardineb5d44e2003-12-23 08:09:43 +00001300 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
1301
1302 return CMD_SUCCESS;
1303}
1304
1305ALIAS (no_lsp_gen_interval_l1,
1306 no_lsp_gen_interval_l1_arg_cmd,
1307 "no lsp-gen-interval level-1 <1-120>",
1308 NO_STR
1309 "Minimum interval between regenerating same LSP\n"
1310 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001311 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001312
1313DEFUN (lsp_gen_interval_l2,
1314 lsp_gen_interval_l2_cmd,
1315 "lsp-gen-interval level-2 <1-120>",
1316 "Minimum interval between regenerating same LSP\n"
1317 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001318 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001319{
1320 struct isis_area *area;
1321 int interval;
1322
1323 area = vty->index;
1324 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001325
jardineb5d44e2003-12-23 08:09:43 +00001326 interval = atoi (argv[0]);
1327 area->lsp_gen_interval[1] = interval;
1328
1329 return CMD_SUCCESS;
1330}
1331
1332DEFUN (no_lsp_gen_interval_l2,
1333 no_lsp_gen_interval_l2_cmd,
1334 "no lsp-gen-interval level-2",
1335 NO_STR
1336 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001337 "Set interval for level 2 only\n")
jardineb5d44e2003-12-23 08:09:43 +00001338{
1339 struct isis_area *area;
1340 int interval;
1341
1342 area = vty->index;
1343 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001344
jardineb5d44e2003-12-23 08:09:43 +00001345 interval = atoi (argv[0]);
1346 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
1347
1348 return CMD_SUCCESS;
1349}
1350
1351ALIAS (no_lsp_gen_interval_l2,
1352 no_lsp_gen_interval_l2_arg_cmd,
1353 "no lsp-gen-interval level-2 <1-120>",
1354 NO_STR
1355 "Minimum interval between regenerating same LSP\n"
1356 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001357 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001358
1359DEFUN (metric_style,
1360 metric_style_cmd,
hasso2984d262005-09-26 16:49:07 +00001361 "metric-style (narrow|transition|wide)",
jardineb5d44e2003-12-23 08:09:43 +00001362 "Use old-style (ISO 10589) or new-style packet formats\n"
1363 "Use old style of TLVs with narrow metric\n"
hasso2984d262005-09-26 16:49:07 +00001364 "Send and accept both styles of TLVs during transition\n"
jardineb5d44e2003-12-23 08:09:43 +00001365 "Use new style of TLVs to carry wider metric\n")
1366{
1367 struct isis_area *area;
1368
1369 area = vty->index;
1370 assert (area);
hasso2984d262005-09-26 16:49:07 +00001371
1372 if (strncmp (argv[0], "w", 1) == 0)
1373 {
1374 area->newmetric = 1;
1375 area->oldmetric = 0;
1376 }
1377 else if (strncmp (argv[0], "t", 1) == 0)
1378 {
1379 area->newmetric = 1;
1380 area->oldmetric = 1;
1381 }
1382 else if (strncmp (argv[0], "n", 1) == 0)
1383 {
1384 area->newmetric = 0;
1385 area->oldmetric = 1;
1386 }
jardineb5d44e2003-12-23 08:09:43 +00001387
1388 return CMD_SUCCESS;
1389}
1390
1391DEFUN (no_metric_style,
1392 no_metric_style_cmd,
hasso2984d262005-09-26 16:49:07 +00001393 "no metric-style",
jardineb5d44e2003-12-23 08:09:43 +00001394 NO_STR
hasso2984d262005-09-26 16:49:07 +00001395 "Use old-style (ISO 10589) or new-style packet formats\n")
jardineb5d44e2003-12-23 08:09:43 +00001396{
1397 struct isis_area *area;
1398
1399 area = vty->index;
1400 assert (area);
1401
hasso2984d262005-09-26 16:49:07 +00001402 /* Default is narrow metric. */
1403 area->newmetric = 0;
1404 area->oldmetric = 1;
jardineb5d44e2003-12-23 08:09:43 +00001405
1406 return CMD_SUCCESS;
1407}
1408
1409DEFUN (dynamic_hostname,
1410 dynamic_hostname_cmd,
1411 "hostname dynamic",
1412 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00001413 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00001414{
1415 struct isis_area *area;
1416
1417 area = vty->index;
1418 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001419
jardineb5d44e2003-12-23 08:09:43 +00001420 area->dynhostname = 1;
hassof390d2c2004-09-10 20:48:21 +00001421
jardineb5d44e2003-12-23 08:09:43 +00001422 return CMD_SUCCESS;
1423}
1424
1425DEFUN (no_dynamic_hostname,
1426 no_dynamic_hostname_cmd,
1427 "no hostname dynamic",
1428 NO_STR
1429 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00001430 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00001431{
1432 struct isis_area *area;
1433
1434 area = vty->index;
1435 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001436
jardineb5d44e2003-12-23 08:09:43 +00001437 area->dynhostname = 0;
hassof390d2c2004-09-10 20:48:21 +00001438
jardineb5d44e2003-12-23 08:09:43 +00001439 return CMD_SUCCESS;
1440}
1441
1442DEFUN (spf_interval,
1443 spf_interval_cmd,
1444 "spf-interval <1-120>",
hasso2097cd82003-12-23 11:51:08 +00001445 "Minimum interval between SPF calculations\n"
jardineb5d44e2003-12-23 08:09:43 +00001446 "Minimum interval between consecutive SPFs in seconds\n")
1447{
1448 struct isis_area *area;
1449 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001450
jardineb5d44e2003-12-23 08:09:43 +00001451 area = vty->index;
1452 interval = atoi (argv[0]);
1453 area->min_spf_interval[0] = interval;
1454 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001455
jardineb5d44e2003-12-23 08:09:43 +00001456 return CMD_SUCCESS;
1457}
1458
1459DEFUN (no_spf_interval,
1460 no_spf_interval_cmd,
1461 "no spf-interval",
1462 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001463 "Minimum interval between SPF calculations\n")
jardineb5d44e2003-12-23 08:09:43 +00001464{
1465 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001466
jardineb5d44e2003-12-23 08:09:43 +00001467 area = vty->index;
1468
1469 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
1470 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001471
jardineb5d44e2003-12-23 08:09:43 +00001472 return CMD_SUCCESS;
1473}
1474
1475ALIAS (no_spf_interval,
1476 no_spf_interval_arg_cmd,
1477 "no spf-interval <1-120>",
1478 NO_STR
1479 "Minimum interval between SPF calculations\n"
hassof390d2c2004-09-10 20:48:21 +00001480 "Minimum interval between consecutive SPFs in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001481
1482DEFUN (spf_interval_l1,
1483 spf_interval_l1_cmd,
1484 "spf-interval level-1 <1-120>",
1485 "Minimum interval between SPF calculations\n"
1486 "Set interval for level 1 only\n"
1487 "Minimum interval between consecutive SPFs in seconds\n")
1488{
1489 struct isis_area *area;
1490 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001491
jardineb5d44e2003-12-23 08:09:43 +00001492 area = vty->index;
1493 interval = atoi (argv[0]);
1494 area->min_spf_interval[0] = interval;
hassof390d2c2004-09-10 20:48:21 +00001495
jardineb5d44e2003-12-23 08:09:43 +00001496 return CMD_SUCCESS;
1497}
1498
1499DEFUN (no_spf_interval_l1,
1500 no_spf_interval_l1_cmd,
1501 "no spf-interval level-1",
1502 NO_STR
1503 "Minimum interval between SPF calculations\n"
1504 "Set interval for level 1 only\n")
1505{
1506 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001507
jardineb5d44e2003-12-23 08:09:43 +00001508 area = vty->index;
1509
1510 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001511
jardineb5d44e2003-12-23 08:09:43 +00001512 return CMD_SUCCESS;
1513}
1514
1515ALIAS (no_spf_interval,
1516 no_spf_interval_l1_arg_cmd,
1517 "no spf-interval level-1 <1-120>",
1518 NO_STR
1519 "Minimum interval between SPF calculations\n"
1520 "Set interval for level 1 only\n"
1521 "Minimum interval between consecutive SPFs in seconds\n")
1522
1523DEFUN (spf_interval_l2,
1524 spf_interval_l2_cmd,
1525 "spf-interval level-2 <1-120>",
1526 "Minimum interval between SPF calculations\n"
1527 "Set interval for level 2 only\n"
1528 "Minimum interval between consecutive SPFs in seconds\n")
1529{
1530 struct isis_area *area;
1531 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001532
jardineb5d44e2003-12-23 08:09:43 +00001533 area = vty->index;
1534 interval = atoi (argv[0]);
1535 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001536
jardineb5d44e2003-12-23 08:09:43 +00001537 return CMD_SUCCESS;
1538}
1539
1540DEFUN (no_spf_interval_l2,
1541 no_spf_interval_l2_cmd,
1542 "no spf-interval level-2",
1543 NO_STR
1544 "Minimum interval between SPF calculations\n"
1545 "Set interval for level 2 only\n")
1546{
1547 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001548
jardineb5d44e2003-12-23 08:09:43 +00001549 area = vty->index;
1550
1551 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001552
jardineb5d44e2003-12-23 08:09:43 +00001553 return CMD_SUCCESS;
1554}
1555
1556ALIAS (no_spf_interval,
1557 no_spf_interval_l2_arg_cmd,
1558 "no spf-interval level-2 <1-120>",
1559 NO_STR
1560 "Minimum interval between SPF calculations\n"
1561 "Set interval for level 2 only\n"
1562 "Minimum interval between consecutive SPFs in seconds\n")
1563
jardineb5d44e2003-12-23 08:09:43 +00001564#ifdef TOPOLOGY_GENERATE
1565DEFUN (topology_generate_grid,
1566 topology_generate_grid_cmd,
1567 "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "
1568 "[param]",
hassof1082d12005-09-19 04:23:34 +00001569 "Topology generation for IS-IS\n"
1570 "Topology generation\n"
1571 "Grid topology\n"
jardineb5d44e2003-12-23 08:09:43 +00001572 "X parameter of the grid\n"
1573 "Y parameter of the grid\n"
1574 "Random seed\n"
1575 "Optional param 1\n"
1576 "Optional param 2\n"
1577 "Optional param 3\n"
1578 "Topology\n")
1579{
1580 struct isis_area *area;
1581
1582 area = vty->index;
1583 assert (area);
1584
hassof390d2c2004-09-10 20:48:21 +00001585 if (!spgrid_check_params (vty, argc, argv))
1586 {
1587 if (area->topology)
1588 list_delete (area->topology);
1589 area->topology = list_new ();
1590 memcpy (area->top_params, vty->buf, 200);
1591 gen_spgrid_topology (vty, area->topology);
1592 remove_topology_lsps (area);
1593 generate_topology_lsps (area);
hassof1082d12005-09-19 04:23:34 +00001594 /* Regenerate L1 LSP to get two way connection to the generated
1595 * topology. */
1596 lsp_regenerate_schedule (area);
hassof390d2c2004-09-10 20:48:21 +00001597 }
jardineb5d44e2003-12-23 08:09:43 +00001598
1599 return CMD_SUCCESS;
1600}
1601
hassof695b012005-04-02 19:03:39 +00001602DEFUN (show_isis_generated_topology,
1603 show_isis_generated_topology_cmd,
hassof1082d12005-09-19 04:23:34 +00001604 "show isis generated-topologies",
jardineb5d44e2003-12-23 08:09:43 +00001605 SHOW_STR
hassof1082d12005-09-19 04:23:34 +00001606 "CLNS network information\n"
1607 "Show generated topologies\n")
jardineb5d44e2003-12-23 08:09:43 +00001608{
1609 struct isis_area *area;
paul92c9f222005-05-25 12:21:13 +00001610 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +00001611 struct listnode *node2;
1612 struct arc *arc;
hassof1082d12005-09-19 04:23:34 +00001613
paul92c9f222005-05-25 12:21:13 +00001614 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof1082d12005-09-19 04:23:34 +00001615 {
1616 if (!area->topology)
1617 continue;
1618
1619 vty_out (vty, "Topology for isis area: %s%s", area->area_tag,
1620 VTY_NEWLINE);
1621 vty_out (vty, "From node To node Distance%s", VTY_NEWLINE);
1622
1623 for (ALL_LIST_ELEMENTS_RO (area->topology, node2, arc))
1624 vty_out (vty, "%9ld %11ld %12ld%s", arc->from_node, arc->to_node,
1625 arc->distance, VTY_NEWLINE);
1626 }
jardineb5d44e2003-12-23 08:09:43 +00001627 return CMD_SUCCESS;
1628}
1629
hassof1082d12005-09-19 04:23:34 +00001630/* Base IS for topology generation. */
hassof390d2c2004-09-10 20:48:21 +00001631DEFUN (topology_baseis,
jardineb5d44e2003-12-23 08:09:43 +00001632 topology_baseis_cmd,
1633 "topology base-is WORD",
hassof1082d12005-09-19 04:23:34 +00001634 "Topology generation for IS-IS\n"
1635 "A Network IS Base for this topology\n"
1636 "XXXX.XXXX.XXXX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001637{
1638 struct isis_area *area;
1639 u_char buff[ISIS_SYS_ID_LEN];
1640
1641 area = vty->index;
1642 assert (area);
1643
hassof390d2c2004-09-10 20:48:21 +00001644 if (sysid2buff (buff, argv[0]))
hassof1082d12005-09-19 04:23:34 +00001645 sysid2buff (area->topology_baseis, argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001646
jardineb5d44e2003-12-23 08:09:43 +00001647 return CMD_SUCCESS;
1648}
1649
jardineb5d44e2003-12-23 08:09:43 +00001650DEFUN (no_topology_baseis,
1651 no_topology_baseis_cmd,
1652 "no topology base-is WORD",
1653 NO_STR
hassof1082d12005-09-19 04:23:34 +00001654 "Topology generation for IS-IS\n"
1655 "A Network IS Base for this topology\n"
1656 "XXXX.XXXX.XXXX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001657{
1658 struct isis_area *area;
1659
1660 area = vty->index;
1661 assert (area);
1662
hassof390d2c2004-09-10 20:48:21 +00001663 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
jardineb5d44e2003-12-23 08:09:43 +00001664 return CMD_SUCCESS;
1665}
1666
hassof1082d12005-09-19 04:23:34 +00001667ALIAS (no_topology_baseis,
1668 no_topology_baseis_noid_cmd,
1669 "no topology base-is",
1670 NO_STR
1671 "Topology generation for IS-IS\n"
1672 "A Network IS Base for this topology\n")
1673
1674DEFUN (topology_basedynh,
1675 topology_basedynh_cmd,
1676 "topology base-dynh WORD",
1677 "Topology generation for IS-IS\n"
1678 "Dynamic hostname base for this topology\n"
1679 "Dynamic hostname base\n")
1680{
1681 struct isis_area *area;
1682
1683 area = vty->index;
1684 assert (area);
1685
1686 /* I hope that it's enough. */
1687 area->topology_basedynh = strndup (argv[0], 16);
1688 return CMD_SUCCESS;
1689}
jardineb5d44e2003-12-23 08:09:43 +00001690#endif /* TOPOLOGY_GENERATE */
1691
1692DEFUN (lsp_lifetime,
1693 lsp_lifetime_cmd,
1694 "lsp-lifetime <380-65535>",
1695 "Maximum LSP lifetime\n"
hassof390d2c2004-09-10 20:48:21 +00001696 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001697{
1698 struct isis_area *area;
1699 uint16_t interval;
1700
1701 area = vty->index;
1702 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001703
jardineb5d44e2003-12-23 08:09:43 +00001704 interval = atoi (argv[0]);
1705
hassof390d2c2004-09-10 20:48:21 +00001706 if (interval < ISIS_MIN_LSP_LIFETIME)
1707 {
1708 vty_out (vty, "LSP lifetime (%us) below %us%s",
1709 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001710
hassof390d2c2004-09-10 20:48:21 +00001711 return CMD_WARNING;
1712 }
jardineb5d44e2003-12-23 08:09:43 +00001713
1714
1715 area->max_lsp_lifetime[0] = interval;
1716 area->max_lsp_lifetime[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001717 area->lsp_refresh[0] = interval - 300;
1718 area->lsp_refresh[1] = interval - 300;
jardineb5d44e2003-12-23 08:09:43 +00001719
hassof390d2c2004-09-10 20:48:21 +00001720 if (area->t_lsp_refresh[0])
1721 {
1722 thread_cancel (area->t_lsp_refresh[0]);
1723 thread_execute (master, lsp_refresh_l1, area, 0);
1724 }
jardineb5d44e2003-12-23 08:09:43 +00001725
hassof390d2c2004-09-10 20:48:21 +00001726 if (area->t_lsp_refresh[1])
1727 {
1728 thread_cancel (area->t_lsp_refresh[1]);
1729 thread_execute (master, lsp_refresh_l2, area, 0);
1730 }
jardineb5d44e2003-12-23 08:09:43 +00001731
1732
1733 return CMD_SUCCESS;
1734}
1735
1736DEFUN (no_lsp_lifetime,
1737 no_lsp_lifetime_cmd,
1738 "no lsp-lifetime",
1739 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001740 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001741{
1742 struct isis_area *area;
1743
1744 area = vty->index;
1745 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001746
1747 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */
1748 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */
1749 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */
1750 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001751
1752 return CMD_SUCCESS;
1753}
1754
1755ALIAS (no_lsp_lifetime,
1756 no_lsp_lifetime_arg_cmd,
1757 "no lsp-lifetime <380-65535>",
1758 NO_STR
1759 "Maximum LSP lifetime\n"
hassof390d2c2004-09-10 20:48:21 +00001760 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001761
1762DEFUN (lsp_lifetime_l1,
1763 lsp_lifetime_l1_cmd,
1764 "lsp-lifetime level-1 <380-65535>",
1765 "Maximum LSP lifetime for Level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001766 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001767{
1768 struct isis_area *area;
1769 uint16_t interval;
1770
1771 area = vty->index;
1772 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001773
jardineb5d44e2003-12-23 08:09:43 +00001774 interval = atoi (argv[0]);
1775
hassof390d2c2004-09-10 20:48:21 +00001776 if (interval < ISIS_MIN_LSP_LIFETIME)
1777 {
1778 vty_out (vty, "Level-1 LSP lifetime (%us) below %us%s",
1779 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001780
hassof390d2c2004-09-10 20:48:21 +00001781 return CMD_WARNING;
1782 }
jardineb5d44e2003-12-23 08:09:43 +00001783
1784
1785 area->max_lsp_lifetime[0] = interval;
hassof390d2c2004-09-10 20:48:21 +00001786 area->lsp_refresh[0] = interval - 300;
jardineb5d44e2003-12-23 08:09:43 +00001787
1788 return CMD_SUCCESS;
1789}
1790
1791DEFUN (no_lsp_lifetime_l1,
1792 no_lsp_lifetime_l1_cmd,
1793 "no lsp-lifetime level-1",
1794 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001795 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001796{
1797 struct isis_area *area;
1798
1799 area = vty->index;
1800 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001801
1802 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */
1803 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001804
1805 return CMD_SUCCESS;
1806}
1807
1808ALIAS (no_lsp_lifetime_l1,
1809 no_lsp_lifetime_l1_arg_cmd,
1810 "no lsp-lifetime level-1 <380-65535>",
1811 NO_STR
1812 "Maximum LSP lifetime for Level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001813 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001814
1815DEFUN (lsp_lifetime_l2,
1816 lsp_lifetime_l2_cmd,
1817 "lsp-lifetime level-2 <380-65535>",
1818 "Maximum LSP lifetime for Level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001819 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001820{
1821 struct isis_area *area;
1822 uint16_t interval;
1823
1824 area = vty->index;
1825 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001826
jardineb5d44e2003-12-23 08:09:43 +00001827 interval = atoi (argv[0]);
1828
hassof390d2c2004-09-10 20:48:21 +00001829 if (interval < ISIS_MIN_LSP_LIFETIME)
1830 {
1831 vty_out (vty, "Level-2 LSP lifetime (%us) below %us%s",
1832 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001833
hassof390d2c2004-09-10 20:48:21 +00001834 return CMD_WARNING;
1835 }
jardineb5d44e2003-12-23 08:09:43 +00001836
1837 area->max_lsp_lifetime[1] = interval;
1838 area->lsp_refresh[1] = interval - 300;
1839
1840 return CMD_SUCCESS;
1841}
1842
1843DEFUN (no_lsp_lifetime_l2,
1844 no_lsp_lifetime_l2_cmd,
1845 "no lsp-lifetime level-2",
1846 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001847 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001848{
1849 struct isis_area *area;
1850
1851 area = vty->index;
1852 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001853
1854 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */
1855 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001856
1857 return CMD_SUCCESS;
1858}
1859
1860ALIAS (no_lsp_lifetime_l2,
1861 no_lsp_lifetime_l2_arg_cmd,
1862 "no lsp-lifetime level-2 <380-65535>",
1863 NO_STR
1864 "Maximum LSP lifetime for Level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001865 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001866
1867/* IS-IS configuration write function */
1868int
1869isis_config_write (struct vty *vty)
1870{
1871 int write = 0;
jardineb5d44e2003-12-23 08:09:43 +00001872
hassof390d2c2004-09-10 20:48:21 +00001873 if (isis != NULL)
1874 {
1875 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +00001876 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +00001877
hasso3fdb2dd2005-09-28 18:45:54 +00001878 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +00001879 {
1880 /* ISIS - Area name */
1881 vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE);
1882 write++;
1883 /* ISIS - Net */
1884 if (listcount (area->area_addrs) > 0)
1885 {
1886 struct area_addr *area_addr;
hasso3fdb2dd2005-09-28 18:45:54 +00001887 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
1888 {
1889 vty_out (vty, " net %s%s",
1890 isonet_print (area_addr->area_addr,
1891 area_addr->addr_len + ISIS_SYS_ID_LEN +
1892 1), VTY_NEWLINE);
1893 write++;
1894 }
hassof390d2c2004-09-10 20:48:21 +00001895 }
hasso3fdb2dd2005-09-28 18:45:54 +00001896 /* ISIS - Dynamic hostname - Defaults to true so only display if
1897 * false. */
hassof390d2c2004-09-10 20:48:21 +00001898 if (!area->dynhostname)
1899 {
1900 vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);
1901 write++;
1902 }
1903 /* ISIS - Metric-Style - when true displays wide */
1904 if (area->newmetric)
1905 {
hasso2984d262005-09-26 16:49:07 +00001906 if (!area->oldmetric)
1907 vty_out (vty, " metric-style wide%s", VTY_NEWLINE);
1908 else
1909 vty_out (vty, " metric-style transition%s", VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +00001910 write++;
1911 }
hasso2984d262005-09-26 16:49:07 +00001912
hassof390d2c2004-09-10 20:48:21 +00001913 /* ISIS - Area is-type (level-1-2 is default) */
1914 if (area->is_type == IS_LEVEL_1)
1915 {
1916 vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
1917 write++;
1918 }
1919 else
1920 {
1921 if (area->is_type == IS_LEVEL_2)
1922 {
1923 vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
1924 write++;
1925 }
1926 }
1927 /* ISIS - Lsp generation interval */
1928 if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1])
1929 {
1930 if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT)
1931 {
1932 vty_out (vty, " lsp-gen-interval %d%s",
1933 area->lsp_gen_interval[0], VTY_NEWLINE);
1934 write++;
1935 }
1936 }
1937 else
1938 {
1939 if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT)
1940 {
1941 vty_out (vty, " lsp-gen-interval level-1 %d%s",
1942 area->lsp_gen_interval[0], VTY_NEWLINE);
1943 write++;
1944 }
1945 if (area->lsp_gen_interval[1] != LSP_GEN_INTERVAL_DEFAULT)
1946 {
1947 vty_out (vty, " lsp-gen-interval level-2 %d%s",
1948 area->lsp_gen_interval[1], VTY_NEWLINE);
1949 write++;
1950 }
1951 }
1952 /* ISIS - LSP lifetime */
1953 if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1])
1954 {
1955 if (area->max_lsp_lifetime[0] != MAX_AGE)
1956 {
1957 vty_out (vty, " lsp-lifetime %u%s", area->max_lsp_lifetime[0],
1958 VTY_NEWLINE);
1959 write++;
1960 }
1961 }
1962 else
1963 {
1964 if (area->max_lsp_lifetime[0] != MAX_AGE)
1965 {
1966 vty_out (vty, " lsp-lifetime level-1 %u%s",
1967 area->max_lsp_lifetime[0], VTY_NEWLINE);
1968 write++;
1969 }
1970 if (area->max_lsp_lifetime[1] != MAX_AGE)
1971 {
1972 vty_out (vty, " lsp-lifetime level-2 %u%s",
1973 area->max_lsp_lifetime[1], VTY_NEWLINE);
1974 write++;
1975 }
1976 }
hasso53c997c2004-09-15 16:21:59 +00001977 /* Authentication passwords. */
1978 if (area->area_passwd.len > 0)
1979 {
hasso1cbc5622005-01-01 10:29:51 +00001980 vty_out(vty, " area-password %s", area->area_passwd.passwd);
1981 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
1982 {
1983 vty_out(vty, " authenticate snp ");
1984 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
1985 vty_out(vty, "validate");
1986 else
1987 vty_out(vty, "send-only");
1988 }
1989 vty_out(vty, "%s", VTY_NEWLINE);
hasso53c997c2004-09-15 16:21:59 +00001990 write++;
1991 }
1992 if (area->domain_passwd.len > 0)
1993 {
hasso1cbc5622005-01-01 10:29:51 +00001994 vty_out(vty, " domain-password %s", area->domain_passwd.passwd);
1995 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
1996 {
1997 vty_out(vty, " authenticate snp ");
1998 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
1999 vty_out(vty, "validate");
2000 else
2001 vty_out(vty, "send-only");
2002 }
2003 vty_out(vty, "%s", VTY_NEWLINE);
hasso53c997c2004-09-15 16:21:59 +00002004 write++;
2005 }
hassof1082d12005-09-19 04:23:34 +00002006
hassof390d2c2004-09-10 20:48:21 +00002007#ifdef TOPOLOGY_GENERATE
hassof1082d12005-09-19 04:23:34 +00002008 if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,
2009 ISIS_SYS_ID_LEN))
2010 {
2011 vty_out (vty, " topology base-is %s%s",
2012 sysid_print (area->topology_baseis), VTY_NEWLINE);
2013 write++;
2014 }
2015 if (area->topology_basedynh)
2016 {
2017 vty_out (vty, " topology base-dynh %s%s",
2018 area->topology_basedynh, VTY_NEWLINE);
2019 write++;
2020 }
2021 /* We save the whole command line here. */
2022 if (strlen(area->top_params))
hassof390d2c2004-09-10 20:48:21 +00002023 {
2024 vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE);
2025 write++;
2026 }
hassof390d2c2004-09-10 20:48:21 +00002027#endif /* TOPOLOGY_GENERATE */
hassof1082d12005-09-19 04:23:34 +00002028
hassof390d2c2004-09-10 20:48:21 +00002029 }
jardineb5d44e2003-12-23 08:09:43 +00002030 }
hassof390d2c2004-09-10 20:48:21 +00002031
jardineb5d44e2003-12-23 08:09:43 +00002032 return write;
2033}
2034
hassof390d2c2004-09-10 20:48:21 +00002035struct cmd_node isis_node = {
jardineb5d44e2003-12-23 08:09:43 +00002036 ISIS_NODE,
hasso2097cd82003-12-23 11:51:08 +00002037 "%s(config-router)# ",
jardineb5d44e2003-12-23 08:09:43 +00002038 1
2039};
2040
hassof390d2c2004-09-10 20:48:21 +00002041void
jardineb5d44e2003-12-23 08:09:43 +00002042isis_init ()
2043{
jardineb5d44e2003-12-23 08:09:43 +00002044 /* Install IS-IS top node */
2045 install_node (&isis_node, isis_config_write);
hassof390d2c2004-09-10 20:48:21 +00002046
jardineb5d44e2003-12-23 08:09:43 +00002047 install_element (VIEW_NODE, &show_clns_neighbors_cmd);
2048 install_element (VIEW_NODE, &show_isis_neighbors_cmd);
2049 install_element (VIEW_NODE, &show_clns_neighbors_detail_cmd);
2050 install_element (VIEW_NODE, &show_isis_neighbors_detail_cmd);
2051
2052 install_element (VIEW_NODE, &show_hostname_cmd);
2053 install_element (VIEW_NODE, &show_database_cmd);
2054 install_element (VIEW_NODE, &show_database_detail_cmd);
2055
2056 install_element (ENABLE_NODE, &show_clns_neighbors_cmd);
2057 install_element (ENABLE_NODE, &show_isis_neighbors_cmd);
2058 install_element (ENABLE_NODE, &show_clns_neighbors_detail_cmd);
2059 install_element (ENABLE_NODE, &show_isis_neighbors_detail_cmd);
2060
2061 install_element (ENABLE_NODE, &show_hostname_cmd);
2062 install_element (ENABLE_NODE, &show_database_cmd);
2063 install_element (ENABLE_NODE, &show_database_detail_cmd);
2064 install_element (ENABLE_NODE, &show_debugging_cmd);
2065
hassof390d2c2004-09-10 20:48:21 +00002066 install_node (&debug_node, config_write_debug);
jardin9e867fe2003-12-23 08:56:18 +00002067
jardineb5d44e2003-12-23 08:09:43 +00002068 install_element (ENABLE_NODE, &debug_isis_adj_cmd);
2069 install_element (ENABLE_NODE, &no_debug_isis_adj_cmd);
2070 install_element (ENABLE_NODE, &debug_isis_csum_cmd);
2071 install_element (ENABLE_NODE, &no_debug_isis_csum_cmd);
2072 install_element (ENABLE_NODE, &debug_isis_lupd_cmd);
2073 install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd);
2074 install_element (ENABLE_NODE, &debug_isis_err_cmd);
2075 install_element (ENABLE_NODE, &no_debug_isis_err_cmd);
2076 install_element (ENABLE_NODE, &debug_isis_snp_cmd);
2077 install_element (ENABLE_NODE, &no_debug_isis_snp_cmd);
2078 install_element (ENABLE_NODE, &debug_isis_upd_cmd);
2079 install_element (ENABLE_NODE, &no_debug_isis_upd_cmd);
2080 install_element (ENABLE_NODE, &debug_isis_spfevents_cmd);
2081 install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd);
2082 install_element (ENABLE_NODE, &debug_isis_spfstats_cmd);
2083 install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd);
2084 install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd);
2085 install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd);
2086 install_element (ENABLE_NODE, &debug_isis_rtevents_cmd);
2087 install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);
2088 install_element (ENABLE_NODE, &debug_isis_events_cmd);
2089 install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
2090
jardin9e867fe2003-12-23 08:56:18 +00002091 install_element (CONFIG_NODE, &debug_isis_adj_cmd);
2092 install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);
2093 install_element (CONFIG_NODE, &debug_isis_csum_cmd);
2094 install_element (CONFIG_NODE, &no_debug_isis_csum_cmd);
2095 install_element (CONFIG_NODE, &debug_isis_lupd_cmd);
2096 install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd);
2097 install_element (CONFIG_NODE, &debug_isis_err_cmd);
2098 install_element (CONFIG_NODE, &no_debug_isis_err_cmd);
2099 install_element (CONFIG_NODE, &debug_isis_snp_cmd);
2100 install_element (CONFIG_NODE, &no_debug_isis_snp_cmd);
2101 install_element (CONFIG_NODE, &debug_isis_upd_cmd);
2102 install_element (CONFIG_NODE, &no_debug_isis_upd_cmd);
2103 install_element (CONFIG_NODE, &debug_isis_spfevents_cmd);
2104 install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd);
2105 install_element (CONFIG_NODE, &debug_isis_spfstats_cmd);
2106 install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd);
2107 install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd);
2108 install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd);
2109 install_element (CONFIG_NODE, &debug_isis_rtevents_cmd);
2110 install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);
2111 install_element (CONFIG_NODE, &debug_isis_events_cmd);
2112 install_element (CONFIG_NODE, &no_debug_isis_events_cmd);
2113
jardineb5d44e2003-12-23 08:09:43 +00002114 install_element (CONFIG_NODE, &router_isis_cmd);
2115 install_element (CONFIG_NODE, &no_router_isis_cmd);
2116
2117 install_default (ISIS_NODE);
2118
2119 install_element (ISIS_NODE, &net_cmd);
2120 install_element (ISIS_NODE, &no_net_cmd);
2121
2122 install_element (ISIS_NODE, &is_type_cmd);
2123 install_element (ISIS_NODE, &no_is_type_cmd);
2124
2125 install_element (ISIS_NODE, &area_passwd_cmd);
hasso1cbc5622005-01-01 10:29:51 +00002126 install_element (ISIS_NODE, &area_passwd_snpauth_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002127 install_element (ISIS_NODE, &no_area_passwd_cmd);
2128
2129 install_element (ISIS_NODE, &domain_passwd_cmd);
hasso1cbc5622005-01-01 10:29:51 +00002130 install_element (ISIS_NODE, &domain_passwd_snpauth_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002131 install_element (ISIS_NODE, &no_domain_passwd_cmd);
2132
2133 install_element (ISIS_NODE, &lsp_gen_interval_cmd);
2134 install_element (ISIS_NODE, &no_lsp_gen_interval_cmd);
2135 install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd);
2136 install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd);
2137 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd);
2138 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd);
2139 install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd);
2140 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd);
2141 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd);
2142
2143 install_element (ISIS_NODE, &spf_interval_cmd);
2144 install_element (ISIS_NODE, &no_spf_interval_cmd);
2145 install_element (ISIS_NODE, &no_spf_interval_arg_cmd);
2146 install_element (ISIS_NODE, &spf_interval_l1_cmd);
2147 install_element (ISIS_NODE, &no_spf_interval_l1_cmd);
2148 install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd);
2149 install_element (ISIS_NODE, &spf_interval_l2_cmd);
2150 install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
2151 install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
hassof390d2c2004-09-10 20:48:21 +00002152
jardineb5d44e2003-12-23 08:09:43 +00002153 install_element (ISIS_NODE, &lsp_lifetime_cmd);
2154 install_element (ISIS_NODE, &no_lsp_lifetime_cmd);
2155 install_element (ISIS_NODE, &no_lsp_lifetime_arg_cmd);
2156 install_element (ISIS_NODE, &lsp_lifetime_l1_cmd);
2157 install_element (ISIS_NODE, &no_lsp_lifetime_l1_cmd);
2158 install_element (ISIS_NODE, &no_lsp_lifetime_l1_arg_cmd);
2159 install_element (ISIS_NODE, &lsp_lifetime_l2_cmd);
2160 install_element (ISIS_NODE, &no_lsp_lifetime_l2_cmd);
2161 install_element (ISIS_NODE, &no_lsp_lifetime_l2_arg_cmd);
2162
2163 install_element (ISIS_NODE, &dynamic_hostname_cmd);
2164 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
2165
2166 install_element (ISIS_NODE, &metric_style_cmd);
2167 install_element (ISIS_NODE, &no_metric_style_cmd);
2168#ifdef TOPOLOGY_GENERATE
2169 install_element (ISIS_NODE, &topology_generate_grid_cmd);
2170 install_element (ISIS_NODE, &topology_baseis_cmd);
hassof1082d12005-09-19 04:23:34 +00002171 install_element (ISIS_NODE, &topology_basedynh_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002172 install_element (ISIS_NODE, &no_topology_baseis_cmd);
hassof1082d12005-09-19 04:23:34 +00002173 install_element (ISIS_NODE, &no_topology_baseis_noid_cmd);
hassof695b012005-04-02 19:03:39 +00002174 install_element (VIEW_NODE, &show_isis_generated_topology_cmd);
2175 install_element (ENABLE_NODE, &show_isis_generated_topology_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002176#endif /* TOPOLOGY_GENERATE */
2177
hassof390d2c2004-09-10 20:48:21 +00002178 isis_new (0);
jardineb5d44e2003-12-23 08:09:43 +00002179 isis_circuit_init ();
2180 isis_zebra_init ();
2181 isis_spf_cmds_init ();
2182}