blob: 7c669fcbf2bce5b7f805e2b6419858db214ca4e9 [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
Paul Jakma41b36e92006-12-08 01:09:50 +000064/*
65 * Prototypes.
66 */
67void isis_new(unsigned long);
68struct isis_area *isis_area_create(void);
69int isis_area_get(struct vty *, const char *);
70int isis_area_destroy(struct vty *, const char *);
71int area_net_title(struct vty *, const u_char *);
72int area_clear_net_title(struct vty *, const u_char *);
73int show_clns_neigh(struct vty *, char);
74void print_debug(struct vty *, int, int);
75int isis_config_write(struct vty *);
76
77
78
jardineb5d44e2003-12-23 08:09:43 +000079void
80isis_new (unsigned long process_id)
81{
hassoaac372f2005-09-01 17:52:33 +000082 isis = XCALLOC (MTYPE_ISIS, sizeof (struct isis));
jardineb5d44e2003-12-23 08:09:43 +000083 /*
84 * Default values
85 */
86 isis->max_area_addrs = 3;
87
88 isis->process_id = process_id;
89 isis->area_list = list_new ();
90 isis->init_circ_list = list_new ();
91 isis->uptime = time (NULL);
92 isis->nexthops = list_new ();
93#ifdef HAVE_IPV6
94 isis->nexthops6 = list_new ();
95#endif /* HAVE_IPV6 */
96 /*
97 * uncomment the next line for full debugs
98 */
hassof390d2c2004-09-10 20:48:21 +000099 /* isis->debugs = 0xFFFF; */
jardineb5d44e2003-12-23 08:09:43 +0000100}
101
102struct isis_area *
103isis_area_create ()
104{
jardineb5d44e2003-12-23 08:09:43 +0000105 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000106
hassoaac372f2005-09-01 17:52:33 +0000107 area = XCALLOC (MTYPE_ISIS_AREA, sizeof (struct isis_area));
jardineb5d44e2003-12-23 08:09:43 +0000108
109 /*
110 * The first instance is level-1-2 rest are level-1, unless otherwise
111 * configured
112 */
113 if (listcount (isis->area_list) > 0)
114 area->is_type = IS_LEVEL_1;
115 else
116 area->is_type = IS_LEVEL_1_AND_2;
117 /*
118 * intialize the databases
119 */
120 area->lspdb[0] = lsp_db_init ();
121 area->lspdb[1] = lsp_db_init ();
hassof390d2c2004-09-10 20:48:21 +0000122
jardineb5d44e2003-12-23 08:09:43 +0000123 spftree_area_init (area);
hassofac1f7c2005-09-26 18:26:26 +0000124 area->route_table[0] = route_table_init ();
125 area->route_table[1] = route_table_init ();
jardineb5d44e2003-12-23 08:09:43 +0000126#ifdef HAVE_IPV6
hassofac1f7c2005-09-26 18:26:26 +0000127 area->route_table6[0] = route_table_init ();
128 area->route_table6[1] = route_table_init ();
jardineb5d44e2003-12-23 08:09:43 +0000129#endif /* HAVE_IPV6 */
130 area->circuit_list = list_new ();
131 area->area_addrs = list_new ();
hassof390d2c2004-09-10 20:48:21 +0000132 THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1);
Paul Jakmac7350c42008-01-29 19:29:44 +0000133 flags_initialize (&area->flags);
jardineb5d44e2003-12-23 08:09:43 +0000134 /*
135 * Default values
136 */
hassof390d2c2004-09-10 20:48:21 +0000137 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200 */
138 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200 */
jardineb5d44e2003-12-23 08:09:43 +0000139 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
140 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
hassof390d2c2004-09-10 20:48:21 +0000141 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900 */
142 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900 */
jardineb5d44e2003-12-23 08:09:43 +0000143 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
144 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
145 area->dynhostname = 1;
hasso2984d262005-09-26 16:49:07 +0000146 area->oldmetric = 1;
jardineb5d44e2003-12-23 08:09:43 +0000147 area->lsp_frag_threshold = 90;
148#ifdef TOPOLOGY_GENERATE
149 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
150#endif /* TOPOLOGY_GENERATE */
151
152 /* FIXME: Think of a better way... */
153 area->min_bcast_mtu = 1497;
154
155 return area;
156}
157
158struct isis_area *
hassof90a5f62004-10-11 13:11:56 +0000159isis_area_lookup (const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000160{
161 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +0000162 struct listnode *node;
hassof390d2c2004-09-10 20:48:21 +0000163
hasso3fdb2dd2005-09-28 18:45:54 +0000164 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
jardineb5d44e2003-12-23 08:09:43 +0000165 if ((area->area_tag == NULL && area_tag == NULL) ||
hassof390d2c2004-09-10 20:48:21 +0000166 (area->area_tag && area_tag
167 && strcmp (area->area_tag, area_tag) == 0))
168 return area;
169
jardineb5d44e2003-12-23 08:09:43 +0000170 return NULL;
171}
172
hassof390d2c2004-09-10 20:48:21 +0000173int
hassof90a5f62004-10-11 13:11:56 +0000174isis_area_get (struct vty *vty, const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000175{
jardineb5d44e2003-12-23 08:09:43 +0000176 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000177
jardineb5d44e2003-12-23 08:09:43 +0000178 area = isis_area_lookup (area_tag);
hassof390d2c2004-09-10 20:48:21 +0000179
180 if (area)
181 {
182 vty->node = ISIS_NODE;
183 vty->index = area;
184 return CMD_SUCCESS;
185 }
186
jardineb5d44e2003-12-23 08:09:43 +0000187 area = isis_area_create ();
188 area->area_tag = strdup (area_tag);
189 listnode_add (isis->area_list, area);
hassof390d2c2004-09-10 20:48:21 +0000190
hassoc89c05d2005-09-04 21:36:36 +0000191 if (isis->debugs & DEBUG_EVENTS)
192 zlog_debug ("New IS-IS area instance %s", area->area_tag);
jardineb5d44e2003-12-23 08:09:43 +0000193
194 vty->node = ISIS_NODE;
195 vty->index = area;
hassof390d2c2004-09-10 20:48:21 +0000196
jardineb5d44e2003-12-23 08:09:43 +0000197 return CMD_SUCCESS;
198}
199
200int
hassof90a5f62004-10-11 13:11:56 +0000201isis_area_destroy (struct vty *vty, const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000202{
jardineb5d44e2003-12-23 08:09:43 +0000203 struct isis_area *area;
paul1eb8ef22005-04-07 07:30:20 +0000204 struct listnode *node, *nnode;
jardineb5d44e2003-12-23 08:09:43 +0000205 struct isis_circuit *circuit;
206
207 area = isis_area_lookup (area_tag);
jardineb5d44e2003-12-23 08:09:43 +0000208
hassof390d2c2004-09-10 20:48:21 +0000209 if (area == NULL)
210 {
211 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
212 return CMD_WARNING;
jardineb5d44e2003-12-23 08:09:43 +0000213 }
hassof390d2c2004-09-10 20:48:21 +0000214
215 if (area->circuit_list)
216 {
paul1eb8ef22005-04-07 07:30:20 +0000217 for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))
Paul Jakmac7350c42008-01-29 19:29:44 +0000218 {
219 /* The fact that it's in circuit_list means that it was configured */
220 isis_circuit_deconfigure (circuit, area);
221 isis_circuit_del (circuit);
222 }
paul1eb8ef22005-04-07 07:30:20 +0000223
hassof390d2c2004-09-10 20:48:21 +0000224 list_delete (area->circuit_list);
225 }
jardineb5d44e2003-12-23 08:09:43 +0000226 listnode_delete (isis->area_list, area);
hassof390d2c2004-09-10 20:48:21 +0000227 THREAD_TIMER_OFF (area->t_tick);
jardineb5d44e2003-12-23 08:09:43 +0000228 if (area->t_remove_aged)
229 thread_cancel (area->t_remove_aged);
hassof390d2c2004-09-10 20:48:21 +0000230 THREAD_TIMER_OFF (area->t_lsp_refresh[0]);
231 THREAD_TIMER_OFF (area->t_lsp_refresh[1]);
jardineb5d44e2003-12-23 08:09:43 +0000232
233 XFREE (MTYPE_ISIS_AREA, area);
hassof390d2c2004-09-10 20:48:21 +0000234
jardineb5d44e2003-12-23 08:09:43 +0000235 return CMD_SUCCESS;
236}
237
hassof390d2c2004-09-10 20:48:21 +0000238int
Paul Jakma41b36e92006-12-08 01:09:50 +0000239area_net_title (struct vty *vty, const u_char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000240{
jardineb5d44e2003-12-23 08:09:43 +0000241 struct isis_area *area;
242 struct area_addr *addr;
243 struct area_addr *addrp;
hasso3fdb2dd2005-09-28 18:45:54 +0000244 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000245
246 u_char buff[255];
247 area = vty->index;
248
hassof390d2c2004-09-10 20:48:21 +0000249 if (!area)
250 {
251 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
252 return CMD_WARNING;
253 }
jardineb5d44e2003-12-23 08:09:43 +0000254
255 /* We check that we are not over the maximal number of addresses */
hassof390d2c2004-09-10 20:48:21 +0000256 if (listcount (area->area_addrs) >= isis->max_area_addrs)
257 {
258 vty_out (vty, "Maximum of area addresses (%d) already reached %s",
259 isis->max_area_addrs, VTY_NEWLINE);
260 return CMD_WARNING;
261 }
jardineb5d44e2003-12-23 08:09:43 +0000262
263 addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));
264 addr->addr_len = dotformat2buff (buff, net_title);
265 memcpy (addr->area_addr, buff, addr->addr_len);
266#ifdef EXTREME_DEBUG
hasso529d65b2004-12-24 00:14:50 +0000267 zlog_debug ("added area address %s for area %s (address length %d)",
jardineb5d44e2003-12-23 08:09:43 +0000268 net_title, area->area_tag, addr->addr_len);
269#endif /* EXTREME_DEBUG */
hassof390d2c2004-09-10 20:48:21 +0000270 if (addr->addr_len < 8 || addr->addr_len > 20)
271 {
272 zlog_warn ("area address must be at least 8..20 octets long (%d)",
273 addr->addr_len);
jardineb5d44e2003-12-23 08:09:43 +0000274 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
275 return CMD_WARNING;
276 }
277
hassof390d2c2004-09-10 20:48:21 +0000278 if (isis->sysid_set == 0)
279 {
280 /*
281 * First area address - get the SystemID for this router
282 */
283 memcpy (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN), ISIS_SYS_ID_LEN);
284 isis->sysid_set = 1;
hassoc89c05d2005-09-04 21:36:36 +0000285 if (isis->debugs & DEBUG_EVENTS)
286 zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid));
jardineb5d44e2003-12-23 08:09:43 +0000287 }
hassof390d2c2004-09-10 20:48:21 +0000288 else
289 {
290 /*
291 * Check that the SystemID portions match
292 */
293 if (memcmp (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN),
294 ISIS_SYS_ID_LEN))
295 {
296 vty_out (vty,
297 "System ID must not change when defining additional area"
298 " addresses%s", VTY_NEWLINE);
299 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
300 return CMD_WARNING;
301 }
jardineb5d44e2003-12-23 08:09:43 +0000302
hassof390d2c2004-09-10 20:48:21 +0000303 /* now we see that we don't already have this address */
hasso3fdb2dd2005-09-28 18:45:54 +0000304 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
305 {
306 if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) != (addr->addr_len))
307 continue;
308 if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
309 {
310 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
311 return CMD_SUCCESS; /* silent fail */
312 }
313 }
hassof390d2c2004-09-10 20:48:21 +0000314
315 }
jardineb5d44e2003-12-23 08:09:43 +0000316 /*
317 * Forget the systemID part of the address
318 */
319 addr->addr_len -= (ISIS_SYS_ID_LEN + 1);
320 listnode_add (area->area_addrs, addr);
321
322 /* only now we can safely generate our LSPs for this area */
hassof390d2c2004-09-10 20:48:21 +0000323 if (listcount (area->area_addrs) > 0)
324 {
325 lsp_l1_generate (area);
326 lsp_l2_generate (area);
327 }
jardineb5d44e2003-12-23 08:09:43 +0000328
329 return CMD_SUCCESS;
330}
331
332int
Paul Jakma41b36e92006-12-08 01:09:50 +0000333area_clear_net_title (struct vty *vty, const u_char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000334{
335 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000336 struct area_addr addr, *addrp = NULL;
hasso3fdb2dd2005-09-28 18:45:54 +0000337 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000338 u_char buff[255];
339
340 area = vty->index;
hassof390d2c2004-09-10 20:48:21 +0000341 if (!area)
342 {
343 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
344 return CMD_WARNING;
345 }
346
jardineb5d44e2003-12-23 08:09:43 +0000347 addr.addr_len = dotformat2buff (buff, net_title);
hassof390d2c2004-09-10 20:48:21 +0000348 if (addr.addr_len < 8 || addr.addr_len > 20)
349 {
350 vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
351 addr.addr_len, VTY_NEWLINE);
352 return CMD_WARNING;
353 }
354
355 memcpy (addr.area_addr, buff, (int) addr.addr_len);
356
hasso3fdb2dd2005-09-28 18:45:54 +0000357 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
jardineb5d44e2003-12-23 08:09:43 +0000358 if (addrp->addr_len == addr.addr_len &&
359 !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
hassof390d2c2004-09-10 20:48:21 +0000360 break;
361
362 if (!addrp)
363 {
364 vty_out (vty, "No area address %s for area %s %s", net_title,
365 area->area_tag, VTY_NEWLINE);
366 return CMD_WARNING;
367 }
368
jardineb5d44e2003-12-23 08:09:43 +0000369 listnode_delete (area->area_addrs, addrp);
hassof390d2c2004-09-10 20:48:21 +0000370
jardineb5d44e2003-12-23 08:09:43 +0000371 return CMD_SUCCESS;
372}
373
jardineb5d44e2003-12-23 08:09:43 +0000374/*
375 * 'show clns neighbors' command
376 */
377
378int
hassof390d2c2004-09-10 20:48:21 +0000379show_clns_neigh (struct vty *vty, char detail)
jardineb5d44e2003-12-23 08:09:43 +0000380{
hasso3fdb2dd2005-09-28 18:45:54 +0000381 struct listnode *anode, *cnode;
jardineb5d44e2003-12-23 08:09:43 +0000382 struct isis_area *area;
383 struct isis_circuit *circuit;
384 struct list *db;
385 int i;
386
hassof390d2c2004-09-10 20:48:21 +0000387 if (!isis)
388 {
389 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
390 return CMD_SUCCESS;
391 }
jardineb5d44e2003-12-23 08:09:43 +0000392
hasso3fdb2dd2005-09-28 18:45:54 +0000393 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
hassof390d2c2004-09-10 20:48:21 +0000394 {
hassof390d2c2004-09-10 20:48:21 +0000395 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000396
hassof390d2c2004-09-10 20:48:21 +0000397 if (detail == ISIS_UI_LEVEL_BRIEF)
398 vty_out (vty, " System Id Interface L State "
399 "Holdtime SNPA%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000400
hasso3fdb2dd2005-09-28 18:45:54 +0000401 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
hassof390d2c2004-09-10 20:48:21 +0000402 {
hassof390d2c2004-09-10 20:48:21 +0000403 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
404 {
405 for (i = 0; i < 2; i++)
406 {
407 db = circuit->u.bc.adjdb[i];
408 if (db && db->count)
409 {
410 if (detail == ISIS_UI_LEVEL_BRIEF)
411 isis_adjdb_iterate (db,
412 (void (*)
413 (struct isis_adjacency *,
414 void *)) isis_adj_print_vty,
415 vty);
416 if (detail == ISIS_UI_LEVEL_DETAIL)
417 isis_adjdb_iterate (db,
418 (void (*)
419 (struct isis_adjacency *,
420 void *))
421 isis_adj_print_vty_detail, vty);
422 if (detail == ISIS_UI_LEVEL_EXTENSIVE)
423 isis_adjdb_iterate (db,
424 (void (*)
425 (struct isis_adjacency *,
426 void *))
427 isis_adj_print_vty_extensive,
428 vty);
429 }
430 }
431 }
432 else if (circuit->circ_type == CIRCUIT_T_P2P &&
433 circuit->u.p2p.neighbor)
434 {
435 if (detail == ISIS_UI_LEVEL_BRIEF)
436 isis_adj_p2p_print_vty (circuit->u.p2p.neighbor, vty);
437 if (detail == ISIS_UI_LEVEL_DETAIL)
438 isis_adj_p2p_print_vty_detail (circuit->u.p2p.neighbor, vty);
439 if (detail == ISIS_UI_LEVEL_EXTENSIVE)
440 isis_adj_p2p_print_vty_extensive (circuit->u.p2p.neighbor,
441 vty);
442 }
443 }
jardineb5d44e2003-12-23 08:09:43 +0000444 }
hassof390d2c2004-09-10 20:48:21 +0000445
jardineb5d44e2003-12-23 08:09:43 +0000446 return CMD_SUCCESS;
447}
448
449DEFUN (show_clns_neighbors,
450 show_clns_neighbors_cmd,
451 "show clns neighbors",
452 SHOW_STR
453 "clns network information\n"
454 "CLNS neighbor adjacencies\n")
455{
hassof390d2c2004-09-10 20:48:21 +0000456 return show_clns_neigh (vty, ISIS_UI_LEVEL_BRIEF);
jardineb5d44e2003-12-23 08:09:43 +0000457}
458
459ALIAS (show_clns_neighbors,
460 show_isis_neighbors_cmd,
461 "show isis neighbors",
462 SHOW_STR
463 "IS-IS network information\n"
464 "IS-IS neighbor adjacencies\n")
465
466DEFUN (show_clns_neighbors_detail,
467 show_clns_neighbors_detail_cmd,
468 "show clns neighbors detail",
469 SHOW_STR
470 "clns network information\n"
471 "CLNS neighbor adjacencies\n"
472 "show detailed information\n")
473{
hassof390d2c2004-09-10 20:48:21 +0000474 return show_clns_neigh (vty, ISIS_UI_LEVEL_DETAIL);
jardineb5d44e2003-12-23 08:09:43 +0000475}
476
477ALIAS (show_clns_neighbors_detail,
478 show_isis_neighbors_detail_cmd,
479 "show isis neighbors detail",
480 SHOW_STR
481 "IS-IS network information\n"
482 "IS-IS neighbor adjacencies\n"
483 "show detailed information\n")
jardineb5d44e2003-12-23 08:09:43 +0000484/*
485 * 'isis debug', 'show debugging'
486 */
jardineb5d44e2003-12-23 08:09:43 +0000487void
488print_debug (struct vty *vty, int flags, int onoff)
489{
490 char onoffs[4];
491 if (onoff)
hassof390d2c2004-09-10 20:48:21 +0000492 strcpy (onoffs, "on");
jardineb5d44e2003-12-23 08:09:43 +0000493 else
hassof390d2c2004-09-10 20:48:21 +0000494 strcpy (onoffs, "off");
jardineb5d44e2003-12-23 08:09:43 +0000495
496 if (flags & DEBUG_ADJ_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000497 vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs,
498 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000499 if (flags & DEBUG_CHECKSUM_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000500 vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs,
501 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000502 if (flags & DEBUG_LOCAL_UPDATES)
hassof390d2c2004-09-10 20:48:21 +0000503 vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs,
504 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000505 if (flags & DEBUG_PROTOCOL_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000506 vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs,
507 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000508 if (flags & DEBUG_SNP_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000509 vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs,
510 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000511 if (flags & DEBUG_SPF_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000512 vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000513 if (flags & DEBUG_SPF_STATS)
hassof390d2c2004-09-10 20:48:21 +0000514 vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s",
515 onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000516 if (flags & DEBUG_SPF_TRIGGERS)
hassof390d2c2004-09-10 20:48:21 +0000517 vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs,
518 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000519 if (flags & DEBUG_UPDATE_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000520 vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs,
521 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000522 if (flags & DEBUG_RTE_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000523 vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs,
524 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000525 if (flags & DEBUG_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000526 vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000527
528}
529
530DEFUN (show_debugging,
531 show_debugging_cmd,
532 "show debugging",
533 SHOW_STR
534 "State of each debugging option\n")
535{
hassof390d2c2004-09-10 20:48:21 +0000536 vty_out (vty, "IS-IS:%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000537 print_debug (vty, isis->debugs, 1);
538 return CMD_SUCCESS;
539}
540
jardin9e867fe2003-12-23 08:56:18 +0000541/* Debug node. */
hassof390d2c2004-09-10 20:48:21 +0000542static struct cmd_node debug_node = {
jardin9e867fe2003-12-23 08:56:18 +0000543 DEBUG_NODE,
hassof390d2c2004-09-10 20:48:21 +0000544 "",
545 1
jardin9e867fe2003-12-23 08:56:18 +0000546};
547
548static int
549config_write_debug (struct vty *vty)
550{
551 int write = 0;
552 int flags = isis->debugs;
553
hassof390d2c2004-09-10 20:48:21 +0000554 if (flags & DEBUG_ADJ_PACKETS)
555 {
556 vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE);
557 write++;
558 }
559 if (flags & DEBUG_CHECKSUM_ERRORS)
560 {
561 vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE);
562 write++;
563 }
564 if (flags & DEBUG_LOCAL_UPDATES)
565 {
566 vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE);
567 write++;
568 }
569 if (flags & DEBUG_PROTOCOL_ERRORS)
570 {
571 vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE);
572 write++;
573 }
574 if (flags & DEBUG_SNP_PACKETS)
575 {
576 vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE);
577 write++;
578 }
579 if (flags & DEBUG_SPF_EVENTS)
580 {
581 vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE);
582 write++;
583 }
584 if (flags & DEBUG_SPF_STATS)
585 {
586 vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE);
587 write++;
588 }
589 if (flags & DEBUG_SPF_TRIGGERS)
590 {
591 vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE);
592 write++;
593 }
594 if (flags & DEBUG_UPDATE_PACKETS)
595 {
596 vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE);
597 write++;
598 }
599 if (flags & DEBUG_RTE_EVENTS)
600 {
601 vty_out (vty, "debug isis route-events%s", VTY_NEWLINE);
602 write++;
603 }
604 if (flags & DEBUG_EVENTS)
605 {
606 vty_out (vty, "debug isis events%s", VTY_NEWLINE);
607 write++;
608 }
jardin9e867fe2003-12-23 08:56:18 +0000609
610 return write;
611}
612
jardineb5d44e2003-12-23 08:09:43 +0000613DEFUN (debug_isis_adj,
614 debug_isis_adj_cmd,
615 "debug isis adj-packets",
616 DEBUG_STR
617 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000618 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000619{
620 isis->debugs |= DEBUG_ADJ_PACKETS;
hassof390d2c2004-09-10 20:48:21 +0000621 print_debug (vty, DEBUG_ADJ_PACKETS, 1);
jardineb5d44e2003-12-23 08:09:43 +0000622
623 return CMD_SUCCESS;
624}
625
626DEFUN (no_debug_isis_adj,
627 no_debug_isis_adj_cmd,
628 "no debug isis adj-packets",
629 UNDEBUG_STR
630 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000631 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000632{
jardineb5d44e2003-12-23 08:09:43 +0000633 isis->debugs &= ~DEBUG_ADJ_PACKETS;
634 print_debug (vty, DEBUG_ADJ_PACKETS, 0);
635
636 return CMD_SUCCESS;
637}
638
jardineb5d44e2003-12-23 08:09:43 +0000639DEFUN (debug_isis_csum,
640 debug_isis_csum_cmd,
641 "debug isis checksum-errors",
642 DEBUG_STR
643 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000644 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000645{
646 isis->debugs |= DEBUG_CHECKSUM_ERRORS;
647 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1);
648
649 return CMD_SUCCESS;
650}
651
652DEFUN (no_debug_isis_csum,
653 no_debug_isis_csum_cmd,
654 "no debug isis checksum-errors",
655 UNDEBUG_STR
656 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000657 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000658{
659 isis->debugs &= ~DEBUG_CHECKSUM_ERRORS;
660 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000661
jardineb5d44e2003-12-23 08:09:43 +0000662 return CMD_SUCCESS;
663}
664
665DEFUN (debug_isis_lupd,
666 debug_isis_lupd_cmd,
667 "debug isis local-updates",
668 DEBUG_STR
669 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000670 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000671{
672 isis->debugs |= DEBUG_LOCAL_UPDATES;
673 print_debug (vty, DEBUG_LOCAL_UPDATES, 1);
674
675 return CMD_SUCCESS;
676}
677
678DEFUN (no_debug_isis_lupd,
679 no_debug_isis_lupd_cmd,
680 "no debug isis local-updates",
681 UNDEBUG_STR
682 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000683 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000684{
685 isis->debugs &= ~DEBUG_LOCAL_UPDATES;
hassof390d2c2004-09-10 20:48:21 +0000686 print_debug (vty, DEBUG_LOCAL_UPDATES, 0);
687
jardineb5d44e2003-12-23 08:09:43 +0000688 return CMD_SUCCESS;
689}
690
691DEFUN (debug_isis_err,
692 debug_isis_err_cmd,
hassof390d2c2004-09-10 20:48:21 +0000693 "debug isis protocol-errors",
jardineb5d44e2003-12-23 08:09:43 +0000694 DEBUG_STR
695 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000696 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000697{
698 isis->debugs |= DEBUG_PROTOCOL_ERRORS;
699 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1);
700
701 return CMD_SUCCESS;
702}
703
704DEFUN (no_debug_isis_err,
705 no_debug_isis_err_cmd,
706 "no debug isis protocol-errors",
707 UNDEBUG_STR
708 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000709 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000710{
711 isis->debugs &= ~DEBUG_PROTOCOL_ERRORS;
712 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000713
jardineb5d44e2003-12-23 08:09:43 +0000714 return CMD_SUCCESS;
715}
716
717DEFUN (debug_isis_snp,
718 debug_isis_snp_cmd,
719 "debug isis snp-packets",
720 DEBUG_STR
721 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000722 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000723{
724 isis->debugs |= DEBUG_SNP_PACKETS;
725 print_debug (vty, DEBUG_SNP_PACKETS, 1);
726
727 return CMD_SUCCESS;
728}
729
730DEFUN (no_debug_isis_snp,
731 no_debug_isis_snp_cmd,
732 "no debug isis snp-packets",
733 UNDEBUG_STR
734 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000735 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000736{
hassof390d2c2004-09-10 20:48:21 +0000737 isis->debugs &= ~DEBUG_SNP_PACKETS;
jardineb5d44e2003-12-23 08:09:43 +0000738 print_debug (vty, DEBUG_SNP_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +0000739
jardineb5d44e2003-12-23 08:09:43 +0000740 return CMD_SUCCESS;
741}
742
jardineb5d44e2003-12-23 08:09:43 +0000743DEFUN (debug_isis_upd,
744 debug_isis_upd_cmd,
745 "debug isis update-packets",
746 DEBUG_STR
747 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000748 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000749{
750 isis->debugs |= DEBUG_UPDATE_PACKETS;
751 print_debug (vty, DEBUG_UPDATE_PACKETS, 1);
752
753 return CMD_SUCCESS;
754}
755
756DEFUN (no_debug_isis_upd,
757 no_debug_isis_upd_cmd,
758 "no debug isis update-packets",
759 UNDEBUG_STR
760 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000761 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000762{
763 isis->debugs &= ~DEBUG_UPDATE_PACKETS;
764 print_debug (vty, DEBUG_UPDATE_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +0000765
jardineb5d44e2003-12-23 08:09:43 +0000766 return CMD_SUCCESS;
767}
768
jardineb5d44e2003-12-23 08:09:43 +0000769DEFUN (debug_isis_spfevents,
770 debug_isis_spfevents_cmd,
771 "debug isis spf-events",
772 DEBUG_STR
773 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000774 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000775{
776 isis->debugs |= DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +0000777 print_debug (vty, DEBUG_SPF_EVENTS, 1);
jardineb5d44e2003-12-23 08:09:43 +0000778
779 return CMD_SUCCESS;
780}
781
782DEFUN (no_debug_isis_spfevents,
783 no_debug_isis_spfevents_cmd,
784 "no debug isis spf-events",
785 UNDEBUG_STR
786 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000787 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000788{
789 isis->debugs &= ~DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +0000790 print_debug (vty, DEBUG_SPF_EVENTS, 0);
791
jardineb5d44e2003-12-23 08:09:43 +0000792 return CMD_SUCCESS;
793}
794
795
796DEFUN (debug_isis_spfstats,
797 debug_isis_spfstats_cmd,
798 "debug isis spf-statistics ",
799 DEBUG_STR
800 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000801 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +0000802{
803 isis->debugs |= DEBUG_SPF_STATS;
804 print_debug (vty, DEBUG_SPF_STATS, 1);
805
806 return CMD_SUCCESS;
807}
808
809DEFUN (no_debug_isis_spfstats,
810 no_debug_isis_spfstats_cmd,
811 "no debug isis spf-statistics",
812 UNDEBUG_STR
813 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000814 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +0000815{
816 isis->debugs &= ~DEBUG_SPF_STATS;
817 print_debug (vty, DEBUG_SPF_STATS, 0);
hassof390d2c2004-09-10 20:48:21 +0000818
jardineb5d44e2003-12-23 08:09:43 +0000819 return CMD_SUCCESS;
820}
821
822DEFUN (debug_isis_spftrigg,
823 debug_isis_spftrigg_cmd,
824 "debug isis spf-triggers",
825 DEBUG_STR
826 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000827 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +0000828{
829 isis->debugs |= DEBUG_SPF_TRIGGERS;
830 print_debug (vty, DEBUG_SPF_TRIGGERS, 1);
831
832 return CMD_SUCCESS;
833}
834
835DEFUN (no_debug_isis_spftrigg,
836 no_debug_isis_spftrigg_cmd,
837 "no debug isis spf-triggers",
838 UNDEBUG_STR
839 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000840 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +0000841{
842 isis->debugs &= ~DEBUG_SPF_TRIGGERS;
843 print_debug (vty, DEBUG_SPF_TRIGGERS, 0);
hassof390d2c2004-09-10 20:48:21 +0000844
jardineb5d44e2003-12-23 08:09:43 +0000845 return CMD_SUCCESS;
846}
847
848DEFUN (debug_isis_rtevents,
849 debug_isis_rtevents_cmd,
850 "debug isis route-events",
851 DEBUG_STR
852 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000853 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +0000854{
855 isis->debugs |= DEBUG_RTE_EVENTS;
856 print_debug (vty, DEBUG_RTE_EVENTS, 1);
857
858 return CMD_SUCCESS;
859}
860
861DEFUN (no_debug_isis_rtevents,
862 no_debug_isis_rtevents_cmd,
863 "no debug isis route-events",
864 UNDEBUG_STR
865 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000866 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +0000867{
868 isis->debugs &= ~DEBUG_RTE_EVENTS;
869 print_debug (vty, DEBUG_RTE_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +0000870
jardineb5d44e2003-12-23 08:09:43 +0000871 return CMD_SUCCESS;
872}
873
874DEFUN (debug_isis_events,
875 debug_isis_events_cmd,
876 "debug isis events",
877 DEBUG_STR
878 "IS-IS information\n"
hassof1082d12005-09-19 04:23:34 +0000879 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000880{
881 isis->debugs |= DEBUG_EVENTS;
882 print_debug (vty, DEBUG_EVENTS, 1);
883
884 return CMD_SUCCESS;
885}
886
887DEFUN (no_debug_isis_events,
888 no_debug_isis_events_cmd,
889 "no debug isis events",
890 UNDEBUG_STR
891 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000892 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000893{
894 isis->debugs &= ~DEBUG_EVENTS;
895 print_debug (vty, DEBUG_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +0000896
jardineb5d44e2003-12-23 08:09:43 +0000897 return CMD_SUCCESS;
898}
899
jardineb5d44e2003-12-23 08:09:43 +0000900DEFUN (show_hostname,
901 show_hostname_cmd,
902 "show isis hostname",
903 SHOW_STR
904 "IS-IS information\n"
905 "IS-IS Dynamic hostname mapping\n")
906{
907 dynhn_print_all (vty);
hassof390d2c2004-09-10 20:48:21 +0000908
jardineb5d44e2003-12-23 08:09:43 +0000909 return CMD_SUCCESS;
910}
911
jardineb5d44e2003-12-23 08:09:43 +0000912DEFUN (show_database,
913 show_database_cmd,
914 "show isis database",
hassof390d2c2004-09-10 20:48:21 +0000915 SHOW_STR "IS-IS information\n" "IS-IS link state database\n")
jardineb5d44e2003-12-23 08:09:43 +0000916{
hasso3fdb2dd2005-09-28 18:45:54 +0000917 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000918 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000919 int level, lsp_count;
jardineb5d44e2003-12-23 08:09:43 +0000920
921 if (isis->area_list->count == 0)
922 return CMD_SUCCESS;
jardineb5d44e2003-12-23 08:09:43 +0000923
hasso3fdb2dd2005-09-28 18:45:54 +0000924 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +0000925 {
hassof390d2c2004-09-10 20:48:21 +0000926 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
927 VTY_NEWLINE);
928 for (level = 0; level < ISIS_LEVELS; level++)
929 {
930 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
931 {
932 vty_out (vty, "IS-IS Level-%d link-state database:%s",
933 level + 1, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000934
hassof390d2c2004-09-10 20:48:21 +0000935 lsp_count = lsp_print_all (vty, area->lspdb[level],
936 ISIS_UI_LEVEL_BRIEF,
937 area->dynhostname);
938
939 vty_out (vty, "%s %u LSPs%s%s",
940 VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE);
941 }
942 }
jardineb5d44e2003-12-23 08:09:43 +0000943 }
jardineb5d44e2003-12-23 08:09:43 +0000944
945 return CMD_SUCCESS;
946}
947
jardineb5d44e2003-12-23 08:09:43 +0000948DEFUN (show_database_detail,
949 show_database_detail_cmd,
950 "show isis database detail",
951 SHOW_STR
952 "IS-IS information\n"
953 "IS-IS link state database\n")
954{
hasso3fdb2dd2005-09-28 18:45:54 +0000955 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000956 struct isis_area *area;
957 int level, lsp_count;
958
959 if (isis->area_list->count == 0)
960 return CMD_SUCCESS;
961
hasso3fdb2dd2005-09-28 18:45:54 +0000962 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +0000963 {
hassof390d2c2004-09-10 20:48:21 +0000964 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
965 VTY_NEWLINE);
966 for (level = 0; level < ISIS_LEVELS; level++)
967 {
968 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
969 {
970 vty_out (vty, "IS-IS Level-%d Link State Database:%s",
971 level + 1, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000972
hassof390d2c2004-09-10 20:48:21 +0000973 lsp_count = lsp_print_all (vty, area->lspdb[level],
974 ISIS_UI_LEVEL_DETAIL,
975 area->dynhostname);
jardineb5d44e2003-12-23 08:09:43 +0000976
hassof390d2c2004-09-10 20:48:21 +0000977 vty_out (vty, "%s %u LSPs%s%s",
978 VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE);
979 }
980 }
jardineb5d44e2003-12-23 08:09:43 +0000981 }
jardineb5d44e2003-12-23 08:09:43 +0000982
983 return CMD_SUCCESS;
984}
985
986/*
987 * 'router isis' command
988 */
989DEFUN (router_isis,
990 router_isis_cmd,
991 "router isis WORD",
hassof390d2c2004-09-10 20:48:21 +0000992 ROUTER_STR
jardineb5d44e2003-12-23 08:09:43 +0000993 "ISO IS-IS\n"
994 "ISO Routing area tag")
995{
jardineb5d44e2003-12-23 08:09:43 +0000996 return isis_area_get (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +0000997}
998
999/*
1000 *'no router isis' command
1001 */
1002DEFUN (no_router_isis,
1003 no_router_isis_cmd,
1004 "no router isis WORD",
hassof390d2c2004-09-10 20:48:21 +00001005 "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag")
jardineb5d44e2003-12-23 08:09:43 +00001006{
1007 return isis_area_destroy (vty, argv[0]);
1008}
1009
1010/*
1011 * 'net' command
1012 */
1013DEFUN (net,
1014 net_cmd,
1015 "net WORD",
1016 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001017 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001018{
Paul Jakma41b36e92006-12-08 01:09:50 +00001019 return area_net_title (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001020}
1021
jardineb5d44e2003-12-23 08:09:43 +00001022/*
1023 * 'no net' command
1024 */
1025DEFUN (no_net,
1026 no_net_cmd,
1027 "no net WORD",
1028 NO_STR
1029 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001030 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001031{
Paul Jakma41b36e92006-12-08 01:09:50 +00001032 return area_clear_net_title (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001033}
1034
1035DEFUN (area_passwd,
1036 area_passwd_cmd,
1037 "area-password WORD",
1038 "Configure the authentication password for an area\n"
hassof390d2c2004-09-10 20:48:21 +00001039 "Area password\n")
jardineb5d44e2003-12-23 08:09:43 +00001040{
1041 struct isis_area *area;
1042 int len;
1043
1044 area = vty->index;
1045
hassof390d2c2004-09-10 20:48:21 +00001046 if (!area)
1047 {
1048 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1049 return CMD_WARNING;
1050 }
1051
jardineb5d44e2003-12-23 08:09:43 +00001052 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001053 if (len > 254)
1054 {
1055 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1056 return CMD_WARNING;
1057 }
1058 area->area_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001059 area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001060 strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001061
hasso1cbc5622005-01-01 10:29:51 +00001062 if (argc > 1)
1063 {
1064 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1065 if (strncmp(argv[1], "v", 1) == 0)
1066 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1067 else
1068 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1069 }
1070 else
1071 {
1072 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1073 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1074 }
1075
jardineb5d44e2003-12-23 08:09:43 +00001076 return CMD_SUCCESS;
1077}
1078
hasso1cbc5622005-01-01 10:29:51 +00001079ALIAS (area_passwd,
1080 area_passwd_snpauth_cmd,
1081 "area-password WORD authenticate snp (send-only|validate)",
1082 "Configure the authentication password for an area\n"
1083 "Area password\n"
1084 "Authentication\n"
1085 "SNP PDUs\n"
1086 "Send but do not check PDUs on receiving\n"
1087 "Send and check PDUs on receiving\n");
1088
jardineb5d44e2003-12-23 08:09:43 +00001089DEFUN (no_area_passwd,
1090 no_area_passwd_cmd,
1091 "no area-password",
1092 NO_STR
1093 "Configure the authentication password for an area\n")
1094{
1095 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001096
jardineb5d44e2003-12-23 08:09:43 +00001097 area = vty->index;
1098
hassof390d2c2004-09-10 20:48:21 +00001099 if (!area)
1100 {
1101 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1102 return CMD_WARNING;
1103 }
1104
jardineb5d44e2003-12-23 08:09:43 +00001105 memset (&area->area_passwd, 0, sizeof (struct isis_passwd));
1106
1107 return CMD_SUCCESS;
1108}
1109
jardineb5d44e2003-12-23 08:09:43 +00001110DEFUN (domain_passwd,
1111 domain_passwd_cmd,
1112 "domain-password WORD",
1113 "Set the authentication password for a routing domain\n"
hassof390d2c2004-09-10 20:48:21 +00001114 "Routing domain password\n")
jardineb5d44e2003-12-23 08:09:43 +00001115{
1116 struct isis_area *area;
1117 int len;
1118
1119 area = vty->index;
1120
hassof390d2c2004-09-10 20:48:21 +00001121 if (!area)
1122 {
1123 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1124 return CMD_WARNING;
1125 }
1126
jardineb5d44e2003-12-23 08:09:43 +00001127 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001128 if (len > 254)
1129 {
1130 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1131 return CMD_WARNING;
1132 }
1133 area->domain_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001134 area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001135 strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001136
hasso1cbc5622005-01-01 10:29:51 +00001137 if (argc > 1)
1138 {
1139 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1140 if (strncmp(argv[1], "v", 1) == 0)
1141 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1142 else
1143 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1144 }
1145 else
1146 {
1147 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1148 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1149 }
1150
jardineb5d44e2003-12-23 08:09:43 +00001151 return CMD_SUCCESS;
1152}
1153
hasso1cbc5622005-01-01 10:29:51 +00001154ALIAS (domain_passwd,
1155 domain_passwd_snpauth_cmd,
1156 "domain-password WORD authenticate snp (send-only|validate)",
1157 "Set the authentication password for a routing domain\n"
1158 "Routing domain password\n"
1159 "Authentication\n"
1160 "SNP PDUs\n"
1161 "Send but do not check PDUs on receiving\n"
1162 "Send and check PDUs on receiving\n");
1163
jardineb5d44e2003-12-23 08:09:43 +00001164DEFUN (no_domain_passwd,
1165 no_domain_passwd_cmd,
1166 "no domain-password WORD",
1167 NO_STR
1168 "Set the authentication password for a routing domain\n")
1169{
1170 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001171
jardineb5d44e2003-12-23 08:09:43 +00001172 area = vty->index;
1173
hassof390d2c2004-09-10 20:48:21 +00001174 if (!area)
1175 {
1176 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1177 return CMD_WARNING;
1178 }
1179
jardineb5d44e2003-12-23 08:09:43 +00001180 memset (&area->domain_passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001181
jardineb5d44e2003-12-23 08:09:43 +00001182 return CMD_SUCCESS;
1183}
1184
1185DEFUN (is_type,
1186 is_type_cmd,
1187 "is-type (level-1|level-1-2|level-2-only)",
1188 "IS Level for this routing process (OSI only)\n"
1189 "Act as a station router only\n"
1190 "Act as both a station router and an area router\n"
1191 "Act as an area router only\n")
1192{
1193 struct isis_area *area;
1194 int type;
1195
1196 area = vty->index;
1197
hassof390d2c2004-09-10 20:48:21 +00001198 if (!area)
1199 {
1200 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1201 return CMD_WARNING;
1202 }
jardineb5d44e2003-12-23 08:09:43 +00001203
Paul Jakma41b36e92006-12-08 01:09:50 +00001204 type = string2circuit_t (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001205 if (!type)
1206 {
1207 vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
1208 return CMD_SUCCESS;
1209 }
jardineb5d44e2003-12-23 08:09:43 +00001210
1211 isis_event_system_type_change (area, type);
hassof390d2c2004-09-10 20:48:21 +00001212
jardineb5d44e2003-12-23 08:09:43 +00001213 return CMD_SUCCESS;
1214}
1215
1216DEFUN (no_is_type,
1217 no_is_type_cmd,
1218 "no is-type (level-1|level-1-2|level-2-only)",
1219 NO_STR
1220 "IS Level for this routing process (OSI only)\n"
1221 "Act as a station router only\n"
1222 "Act as both a station router and an area router\n"
1223 "Act as an area router only\n")
1224{
jardineb5d44e2003-12-23 08:09:43 +00001225 struct isis_area *area;
1226 int type;
1227
1228 area = vty->index;
1229 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001230
jardineb5d44e2003-12-23 08:09:43 +00001231 /*
1232 * Put the is-type back to default. Which is level-1-2 on first
1233 * circuit for the area level-1 for the rest
1234 */
paul1eb8ef22005-04-07 07:30:20 +00001235 if (listgetdata (listhead (isis->area_list)) == area)
jardineb5d44e2003-12-23 08:09:43 +00001236 type = IS_LEVEL_1_AND_2;
1237 else
1238 type = IS_LEVEL_1;
1239
1240 isis_event_system_type_change (area, type);
1241
1242 return CMD_SUCCESS;
1243}
1244
1245DEFUN (lsp_gen_interval,
1246 lsp_gen_interval_cmd,
1247 "lsp-gen-interval <1-120>",
1248 "Minimum interval between regenerating same LSP\n"
1249 "Minimum interval in seconds\n")
1250{
1251 struct isis_area *area;
1252 uint16_t interval;
1253
1254 area = vty->index;
1255 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001256
jardineb5d44e2003-12-23 08:09:43 +00001257 interval = atoi (argv[0]);
1258 area->lsp_gen_interval[0] = interval;
1259 area->lsp_gen_interval[1] = interval;
1260
1261 return CMD_SUCCESS;
1262}
1263
1264DEFUN (no_lsp_gen_interval,
1265 no_lsp_gen_interval_cmd,
1266 "no lsp-gen-interval",
1267 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001268 "Minimum interval between regenerating same LSP\n")
jardineb5d44e2003-12-23 08:09:43 +00001269{
1270 struct isis_area *area;
1271
1272 area = vty->index;
1273 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001274
jardineb5d44e2003-12-23 08:09:43 +00001275 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
1276 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
1277
1278 return CMD_SUCCESS;
1279}
1280
1281ALIAS (no_lsp_gen_interval,
1282 no_lsp_gen_interval_arg_cmd,
1283 "no lsp-gen-interval <1-120>",
1284 NO_STR
1285 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001286 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001287
1288DEFUN (lsp_gen_interval_l1,
1289 lsp_gen_interval_l1_cmd,
1290 "lsp-gen-interval level-1 <1-120>",
1291 "Minimum interval between regenerating same LSP\n"
1292 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001293 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001294{
1295 struct isis_area *area;
1296 uint16_t interval;
1297
1298 area = vty->index;
1299 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001300
jardineb5d44e2003-12-23 08:09:43 +00001301 interval = atoi (argv[0]);
1302 area->lsp_gen_interval[0] = interval;
1303
1304 return CMD_SUCCESS;
1305}
1306
1307DEFUN (no_lsp_gen_interval_l1,
1308 no_lsp_gen_interval_l1_cmd,
1309 "no lsp-gen-interval level-1",
1310 NO_STR
1311 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001312 "Set interval for level 1 only\n")
jardineb5d44e2003-12-23 08:09:43 +00001313{
1314 struct isis_area *area;
1315
1316 area = vty->index;
1317 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001318
jardineb5d44e2003-12-23 08:09:43 +00001319 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
1320
1321 return CMD_SUCCESS;
1322}
1323
1324ALIAS (no_lsp_gen_interval_l1,
1325 no_lsp_gen_interval_l1_arg_cmd,
1326 "no lsp-gen-interval level-1 <1-120>",
1327 NO_STR
1328 "Minimum interval between regenerating same LSP\n"
1329 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001330 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001331
1332DEFUN (lsp_gen_interval_l2,
1333 lsp_gen_interval_l2_cmd,
1334 "lsp-gen-interval level-2 <1-120>",
1335 "Minimum interval between regenerating same LSP\n"
1336 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001337 "Minimum interval in seconds\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] = interval;
1347
1348 return CMD_SUCCESS;
1349}
1350
1351DEFUN (no_lsp_gen_interval_l2,
1352 no_lsp_gen_interval_l2_cmd,
1353 "no lsp-gen-interval level-2",
1354 NO_STR
1355 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001356 "Set interval for level 2 only\n")
jardineb5d44e2003-12-23 08:09:43 +00001357{
1358 struct isis_area *area;
1359 int interval;
1360
1361 area = vty->index;
1362 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001363
jardineb5d44e2003-12-23 08:09:43 +00001364 interval = atoi (argv[0]);
1365 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
1366
1367 return CMD_SUCCESS;
1368}
1369
1370ALIAS (no_lsp_gen_interval_l2,
1371 no_lsp_gen_interval_l2_arg_cmd,
1372 "no lsp-gen-interval level-2 <1-120>",
1373 NO_STR
1374 "Minimum interval between regenerating same LSP\n"
1375 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001376 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001377
1378DEFUN (metric_style,
1379 metric_style_cmd,
hasso2984d262005-09-26 16:49:07 +00001380 "metric-style (narrow|transition|wide)",
jardineb5d44e2003-12-23 08:09:43 +00001381 "Use old-style (ISO 10589) or new-style packet formats\n"
1382 "Use old style of TLVs with narrow metric\n"
hasso2984d262005-09-26 16:49:07 +00001383 "Send and accept both styles of TLVs during transition\n"
jardineb5d44e2003-12-23 08:09:43 +00001384 "Use new style of TLVs to carry wider metric\n")
1385{
1386 struct isis_area *area;
1387
1388 area = vty->index;
1389 assert (area);
hasso2984d262005-09-26 16:49:07 +00001390
1391 if (strncmp (argv[0], "w", 1) == 0)
1392 {
1393 area->newmetric = 1;
1394 area->oldmetric = 0;
1395 }
1396 else if (strncmp (argv[0], "t", 1) == 0)
1397 {
1398 area->newmetric = 1;
1399 area->oldmetric = 1;
1400 }
1401 else if (strncmp (argv[0], "n", 1) == 0)
1402 {
1403 area->newmetric = 0;
1404 area->oldmetric = 1;
1405 }
jardineb5d44e2003-12-23 08:09:43 +00001406
1407 return CMD_SUCCESS;
1408}
1409
1410DEFUN (no_metric_style,
1411 no_metric_style_cmd,
hasso2984d262005-09-26 16:49:07 +00001412 "no metric-style",
jardineb5d44e2003-12-23 08:09:43 +00001413 NO_STR
hasso2984d262005-09-26 16:49:07 +00001414 "Use old-style (ISO 10589) or new-style packet formats\n")
jardineb5d44e2003-12-23 08:09:43 +00001415{
1416 struct isis_area *area;
1417
1418 area = vty->index;
1419 assert (area);
1420
hasso2984d262005-09-26 16:49:07 +00001421 /* Default is narrow metric. */
1422 area->newmetric = 0;
1423 area->oldmetric = 1;
jardineb5d44e2003-12-23 08:09:43 +00001424
1425 return CMD_SUCCESS;
1426}
1427
1428DEFUN (dynamic_hostname,
1429 dynamic_hostname_cmd,
1430 "hostname dynamic",
1431 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00001432 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00001433{
1434 struct isis_area *area;
1435
1436 area = vty->index;
1437 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001438
jardineb5d44e2003-12-23 08:09:43 +00001439 area->dynhostname = 1;
hassof390d2c2004-09-10 20:48:21 +00001440
jardineb5d44e2003-12-23 08:09:43 +00001441 return CMD_SUCCESS;
1442}
1443
1444DEFUN (no_dynamic_hostname,
1445 no_dynamic_hostname_cmd,
1446 "no hostname dynamic",
1447 NO_STR
1448 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00001449 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00001450{
1451 struct isis_area *area;
1452
1453 area = vty->index;
1454 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001455
jardineb5d44e2003-12-23 08:09:43 +00001456 area->dynhostname = 0;
hassof390d2c2004-09-10 20:48:21 +00001457
jardineb5d44e2003-12-23 08:09:43 +00001458 return CMD_SUCCESS;
1459}
1460
1461DEFUN (spf_interval,
1462 spf_interval_cmd,
1463 "spf-interval <1-120>",
hasso2097cd82003-12-23 11:51:08 +00001464 "Minimum interval between SPF calculations\n"
jardineb5d44e2003-12-23 08:09:43 +00001465 "Minimum interval between consecutive SPFs in seconds\n")
1466{
1467 struct isis_area *area;
1468 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001469
jardineb5d44e2003-12-23 08:09:43 +00001470 area = vty->index;
1471 interval = atoi (argv[0]);
1472 area->min_spf_interval[0] = interval;
1473 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001474
jardineb5d44e2003-12-23 08:09:43 +00001475 return CMD_SUCCESS;
1476}
1477
1478DEFUN (no_spf_interval,
1479 no_spf_interval_cmd,
1480 "no spf-interval",
1481 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001482 "Minimum interval between SPF calculations\n")
jardineb5d44e2003-12-23 08:09:43 +00001483{
1484 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001485
jardineb5d44e2003-12-23 08:09:43 +00001486 area = vty->index;
1487
1488 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
1489 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001490
jardineb5d44e2003-12-23 08:09:43 +00001491 return CMD_SUCCESS;
1492}
1493
1494ALIAS (no_spf_interval,
1495 no_spf_interval_arg_cmd,
1496 "no spf-interval <1-120>",
1497 NO_STR
1498 "Minimum interval between SPF calculations\n"
hassof390d2c2004-09-10 20:48:21 +00001499 "Minimum interval between consecutive SPFs in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001500
1501DEFUN (spf_interval_l1,
1502 spf_interval_l1_cmd,
1503 "spf-interval level-1 <1-120>",
1504 "Minimum interval between SPF calculations\n"
1505 "Set interval for level 1 only\n"
1506 "Minimum interval between consecutive SPFs in seconds\n")
1507{
1508 struct isis_area *area;
1509 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001510
jardineb5d44e2003-12-23 08:09:43 +00001511 area = vty->index;
1512 interval = atoi (argv[0]);
1513 area->min_spf_interval[0] = interval;
hassof390d2c2004-09-10 20:48:21 +00001514
jardineb5d44e2003-12-23 08:09:43 +00001515 return CMD_SUCCESS;
1516}
1517
1518DEFUN (no_spf_interval_l1,
1519 no_spf_interval_l1_cmd,
1520 "no spf-interval level-1",
1521 NO_STR
1522 "Minimum interval between SPF calculations\n"
1523 "Set interval for level 1 only\n")
1524{
1525 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001526
jardineb5d44e2003-12-23 08:09:43 +00001527 area = vty->index;
1528
1529 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001530
jardineb5d44e2003-12-23 08:09:43 +00001531 return CMD_SUCCESS;
1532}
1533
1534ALIAS (no_spf_interval,
1535 no_spf_interval_l1_arg_cmd,
1536 "no spf-interval level-1 <1-120>",
1537 NO_STR
1538 "Minimum interval between SPF calculations\n"
1539 "Set interval for level 1 only\n"
1540 "Minimum interval between consecutive SPFs in seconds\n")
1541
1542DEFUN (spf_interval_l2,
1543 spf_interval_l2_cmd,
1544 "spf-interval level-2 <1-120>",
1545 "Minimum interval between SPF calculations\n"
1546 "Set interval for level 2 only\n"
1547 "Minimum interval between consecutive SPFs in seconds\n")
1548{
1549 struct isis_area *area;
1550 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001551
jardineb5d44e2003-12-23 08:09:43 +00001552 area = vty->index;
1553 interval = atoi (argv[0]);
1554 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001555
jardineb5d44e2003-12-23 08:09:43 +00001556 return CMD_SUCCESS;
1557}
1558
1559DEFUN (no_spf_interval_l2,
1560 no_spf_interval_l2_cmd,
1561 "no spf-interval level-2",
1562 NO_STR
1563 "Minimum interval between SPF calculations\n"
1564 "Set interval for level 2 only\n")
1565{
1566 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001567
jardineb5d44e2003-12-23 08:09:43 +00001568 area = vty->index;
1569
1570 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001571
jardineb5d44e2003-12-23 08:09:43 +00001572 return CMD_SUCCESS;
1573}
1574
1575ALIAS (no_spf_interval,
1576 no_spf_interval_l2_arg_cmd,
1577 "no spf-interval level-2 <1-120>",
1578 NO_STR
1579 "Minimum interval between SPF calculations\n"
1580 "Set interval for level 2 only\n"
1581 "Minimum interval between consecutive SPFs in seconds\n")
1582
jardineb5d44e2003-12-23 08:09:43 +00001583#ifdef TOPOLOGY_GENERATE
1584DEFUN (topology_generate_grid,
1585 topology_generate_grid_cmd,
1586 "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "
1587 "[param]",
hassof1082d12005-09-19 04:23:34 +00001588 "Topology generation for IS-IS\n"
1589 "Topology generation\n"
1590 "Grid topology\n"
jardineb5d44e2003-12-23 08:09:43 +00001591 "X parameter of the grid\n"
1592 "Y parameter of the grid\n"
1593 "Random seed\n"
1594 "Optional param 1\n"
1595 "Optional param 2\n"
1596 "Optional param 3\n"
1597 "Topology\n")
1598{
1599 struct isis_area *area;
1600
1601 area = vty->index;
1602 assert (area);
1603
hassof390d2c2004-09-10 20:48:21 +00001604 if (!spgrid_check_params (vty, argc, argv))
1605 {
1606 if (area->topology)
1607 list_delete (area->topology);
1608 area->topology = list_new ();
1609 memcpy (area->top_params, vty->buf, 200);
1610 gen_spgrid_topology (vty, area->topology);
1611 remove_topology_lsps (area);
1612 generate_topology_lsps (area);
hassof1082d12005-09-19 04:23:34 +00001613 /* Regenerate L1 LSP to get two way connection to the generated
1614 * topology. */
1615 lsp_regenerate_schedule (area);
hassof390d2c2004-09-10 20:48:21 +00001616 }
jardineb5d44e2003-12-23 08:09:43 +00001617
1618 return CMD_SUCCESS;
1619}
1620
hassof695b012005-04-02 19:03:39 +00001621DEFUN (show_isis_generated_topology,
1622 show_isis_generated_topology_cmd,
hassof1082d12005-09-19 04:23:34 +00001623 "show isis generated-topologies",
jardineb5d44e2003-12-23 08:09:43 +00001624 SHOW_STR
hassof1082d12005-09-19 04:23:34 +00001625 "CLNS network information\n"
1626 "Show generated topologies\n")
jardineb5d44e2003-12-23 08:09:43 +00001627{
1628 struct isis_area *area;
paul92c9f222005-05-25 12:21:13 +00001629 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +00001630 struct listnode *node2;
1631 struct arc *arc;
hassof1082d12005-09-19 04:23:34 +00001632
paul92c9f222005-05-25 12:21:13 +00001633 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof1082d12005-09-19 04:23:34 +00001634 {
1635 if (!area->topology)
1636 continue;
1637
1638 vty_out (vty, "Topology for isis area: %s%s", area->area_tag,
1639 VTY_NEWLINE);
1640 vty_out (vty, "From node To node Distance%s", VTY_NEWLINE);
1641
1642 for (ALL_LIST_ELEMENTS_RO (area->topology, node2, arc))
1643 vty_out (vty, "%9ld %11ld %12ld%s", arc->from_node, arc->to_node,
1644 arc->distance, VTY_NEWLINE);
1645 }
jardineb5d44e2003-12-23 08:09:43 +00001646 return CMD_SUCCESS;
1647}
1648
hassof1082d12005-09-19 04:23:34 +00001649/* Base IS for topology generation. */
hassof390d2c2004-09-10 20:48:21 +00001650DEFUN (topology_baseis,
jardineb5d44e2003-12-23 08:09:43 +00001651 topology_baseis_cmd,
1652 "topology base-is WORD",
hassof1082d12005-09-19 04:23:34 +00001653 "Topology generation for IS-IS\n"
1654 "A Network IS Base for this topology\n"
1655 "XXXX.XXXX.XXXX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001656{
1657 struct isis_area *area;
1658 u_char buff[ISIS_SYS_ID_LEN];
1659
1660 area = vty->index;
1661 assert (area);
1662
hassof390d2c2004-09-10 20:48:21 +00001663 if (sysid2buff (buff, argv[0]))
hassof1082d12005-09-19 04:23:34 +00001664 sysid2buff (area->topology_baseis, argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001665
jardineb5d44e2003-12-23 08:09:43 +00001666 return CMD_SUCCESS;
1667}
1668
jardineb5d44e2003-12-23 08:09:43 +00001669DEFUN (no_topology_baseis,
1670 no_topology_baseis_cmd,
1671 "no topology base-is WORD",
1672 NO_STR
hassof1082d12005-09-19 04:23:34 +00001673 "Topology generation for IS-IS\n"
1674 "A Network IS Base for this topology\n"
1675 "XXXX.XXXX.XXXX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001676{
1677 struct isis_area *area;
1678
1679 area = vty->index;
1680 assert (area);
1681
hassof390d2c2004-09-10 20:48:21 +00001682 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
jardineb5d44e2003-12-23 08:09:43 +00001683 return CMD_SUCCESS;
1684}
1685
hassof1082d12005-09-19 04:23:34 +00001686ALIAS (no_topology_baseis,
1687 no_topology_baseis_noid_cmd,
1688 "no topology base-is",
1689 NO_STR
1690 "Topology generation for IS-IS\n"
1691 "A Network IS Base for this topology\n")
1692
1693DEFUN (topology_basedynh,
1694 topology_basedynh_cmd,
1695 "topology base-dynh WORD",
1696 "Topology generation for IS-IS\n"
1697 "Dynamic hostname base for this topology\n"
1698 "Dynamic hostname base\n")
1699{
1700 struct isis_area *area;
1701
1702 area = vty->index;
1703 assert (area);
1704
1705 /* I hope that it's enough. */
1706 area->topology_basedynh = strndup (argv[0], 16);
1707 return CMD_SUCCESS;
1708}
jardineb5d44e2003-12-23 08:09:43 +00001709#endif /* TOPOLOGY_GENERATE */
1710
1711DEFUN (lsp_lifetime,
1712 lsp_lifetime_cmd,
1713 "lsp-lifetime <380-65535>",
1714 "Maximum LSP lifetime\n"
hassof390d2c2004-09-10 20:48:21 +00001715 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001716{
1717 struct isis_area *area;
1718 uint16_t interval;
1719
1720 area = vty->index;
1721 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001722
jardineb5d44e2003-12-23 08:09:43 +00001723 interval = atoi (argv[0]);
1724
hassof390d2c2004-09-10 20:48:21 +00001725 if (interval < ISIS_MIN_LSP_LIFETIME)
1726 {
1727 vty_out (vty, "LSP lifetime (%us) below %us%s",
1728 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001729
hassof390d2c2004-09-10 20:48:21 +00001730 return CMD_WARNING;
1731 }
jardineb5d44e2003-12-23 08:09:43 +00001732
1733
1734 area->max_lsp_lifetime[0] = interval;
1735 area->max_lsp_lifetime[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001736 area->lsp_refresh[0] = interval - 300;
1737 area->lsp_refresh[1] = interval - 300;
jardineb5d44e2003-12-23 08:09:43 +00001738
hassof390d2c2004-09-10 20:48:21 +00001739 if (area->t_lsp_refresh[0])
1740 {
1741 thread_cancel (area->t_lsp_refresh[0]);
1742 thread_execute (master, lsp_refresh_l1, area, 0);
1743 }
jardineb5d44e2003-12-23 08:09:43 +00001744
hassof390d2c2004-09-10 20:48:21 +00001745 if (area->t_lsp_refresh[1])
1746 {
1747 thread_cancel (area->t_lsp_refresh[1]);
1748 thread_execute (master, lsp_refresh_l2, area, 0);
1749 }
jardineb5d44e2003-12-23 08:09:43 +00001750
1751
1752 return CMD_SUCCESS;
1753}
1754
1755DEFUN (no_lsp_lifetime,
1756 no_lsp_lifetime_cmd,
1757 "no lsp-lifetime",
1758 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001759 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001760{
1761 struct isis_area *area;
1762
1763 area = vty->index;
1764 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001765
1766 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */
1767 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */
1768 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */
1769 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001770
1771 return CMD_SUCCESS;
1772}
1773
1774ALIAS (no_lsp_lifetime,
1775 no_lsp_lifetime_arg_cmd,
1776 "no lsp-lifetime <380-65535>",
1777 NO_STR
1778 "Maximum LSP lifetime\n"
hassof390d2c2004-09-10 20:48:21 +00001779 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001780
1781DEFUN (lsp_lifetime_l1,
1782 lsp_lifetime_l1_cmd,
1783 "lsp-lifetime level-1 <380-65535>",
1784 "Maximum LSP lifetime for Level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001785 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001786{
1787 struct isis_area *area;
1788 uint16_t interval;
1789
1790 area = vty->index;
1791 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001792
jardineb5d44e2003-12-23 08:09:43 +00001793 interval = atoi (argv[0]);
1794
hassof390d2c2004-09-10 20:48:21 +00001795 if (interval < ISIS_MIN_LSP_LIFETIME)
1796 {
1797 vty_out (vty, "Level-1 LSP lifetime (%us) below %us%s",
1798 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001799
hassof390d2c2004-09-10 20:48:21 +00001800 return CMD_WARNING;
1801 }
jardineb5d44e2003-12-23 08:09:43 +00001802
1803
1804 area->max_lsp_lifetime[0] = interval;
hassof390d2c2004-09-10 20:48:21 +00001805 area->lsp_refresh[0] = interval - 300;
jardineb5d44e2003-12-23 08:09:43 +00001806
1807 return CMD_SUCCESS;
1808}
1809
1810DEFUN (no_lsp_lifetime_l1,
1811 no_lsp_lifetime_l1_cmd,
1812 "no lsp-lifetime level-1",
1813 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001814 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001815{
1816 struct isis_area *area;
1817
1818 area = vty->index;
1819 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001820
1821 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */
1822 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001823
1824 return CMD_SUCCESS;
1825}
1826
1827ALIAS (no_lsp_lifetime_l1,
1828 no_lsp_lifetime_l1_arg_cmd,
1829 "no lsp-lifetime level-1 <380-65535>",
1830 NO_STR
1831 "Maximum LSP lifetime for Level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001832 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001833
1834DEFUN (lsp_lifetime_l2,
1835 lsp_lifetime_l2_cmd,
1836 "lsp-lifetime level-2 <380-65535>",
1837 "Maximum LSP lifetime for Level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001838 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001839{
1840 struct isis_area *area;
1841 uint16_t interval;
1842
1843 area = vty->index;
1844 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001845
jardineb5d44e2003-12-23 08:09:43 +00001846 interval = atoi (argv[0]);
1847
hassof390d2c2004-09-10 20:48:21 +00001848 if (interval < ISIS_MIN_LSP_LIFETIME)
1849 {
1850 vty_out (vty, "Level-2 LSP lifetime (%us) below %us%s",
1851 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001852
hassof390d2c2004-09-10 20:48:21 +00001853 return CMD_WARNING;
1854 }
jardineb5d44e2003-12-23 08:09:43 +00001855
1856 area->max_lsp_lifetime[1] = interval;
1857 area->lsp_refresh[1] = interval - 300;
1858
1859 return CMD_SUCCESS;
1860}
1861
1862DEFUN (no_lsp_lifetime_l2,
1863 no_lsp_lifetime_l2_cmd,
1864 "no lsp-lifetime level-2",
1865 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001866 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001867{
1868 struct isis_area *area;
1869
1870 area = vty->index;
1871 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001872
1873 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */
1874 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001875
1876 return CMD_SUCCESS;
1877}
1878
1879ALIAS (no_lsp_lifetime_l2,
1880 no_lsp_lifetime_l2_arg_cmd,
1881 "no lsp-lifetime level-2 <380-65535>",
1882 NO_STR
1883 "Maximum LSP lifetime for Level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001884 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001885
1886/* IS-IS configuration write function */
1887int
1888isis_config_write (struct vty *vty)
1889{
1890 int write = 0;
jardineb5d44e2003-12-23 08:09:43 +00001891
hassof390d2c2004-09-10 20:48:21 +00001892 if (isis != NULL)
1893 {
1894 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +00001895 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +00001896
hasso3fdb2dd2005-09-28 18:45:54 +00001897 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +00001898 {
1899 /* ISIS - Area name */
1900 vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE);
1901 write++;
1902 /* ISIS - Net */
1903 if (listcount (area->area_addrs) > 0)
1904 {
1905 struct area_addr *area_addr;
hasso3fdb2dd2005-09-28 18:45:54 +00001906 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
1907 {
1908 vty_out (vty, " net %s%s",
1909 isonet_print (area_addr->area_addr,
1910 area_addr->addr_len + ISIS_SYS_ID_LEN +
1911 1), VTY_NEWLINE);
1912 write++;
1913 }
hassof390d2c2004-09-10 20:48:21 +00001914 }
hasso3fdb2dd2005-09-28 18:45:54 +00001915 /* ISIS - Dynamic hostname - Defaults to true so only display if
1916 * false. */
hassof390d2c2004-09-10 20:48:21 +00001917 if (!area->dynhostname)
1918 {
1919 vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);
1920 write++;
1921 }
1922 /* ISIS - Metric-Style - when true displays wide */
1923 if (area->newmetric)
1924 {
hasso2984d262005-09-26 16:49:07 +00001925 if (!area->oldmetric)
1926 vty_out (vty, " metric-style wide%s", VTY_NEWLINE);
1927 else
1928 vty_out (vty, " metric-style transition%s", VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +00001929 write++;
1930 }
hasso2984d262005-09-26 16:49:07 +00001931
hassof390d2c2004-09-10 20:48:21 +00001932 /* ISIS - Area is-type (level-1-2 is default) */
1933 if (area->is_type == IS_LEVEL_1)
1934 {
1935 vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
1936 write++;
1937 }
1938 else
1939 {
1940 if (area->is_type == IS_LEVEL_2)
1941 {
1942 vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
1943 write++;
1944 }
1945 }
1946 /* ISIS - Lsp generation interval */
1947 if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1])
1948 {
1949 if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT)
1950 {
1951 vty_out (vty, " lsp-gen-interval %d%s",
1952 area->lsp_gen_interval[0], VTY_NEWLINE);
1953 write++;
1954 }
1955 }
1956 else
1957 {
1958 if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT)
1959 {
1960 vty_out (vty, " lsp-gen-interval level-1 %d%s",
1961 area->lsp_gen_interval[0], VTY_NEWLINE);
1962 write++;
1963 }
1964 if (area->lsp_gen_interval[1] != LSP_GEN_INTERVAL_DEFAULT)
1965 {
1966 vty_out (vty, " lsp-gen-interval level-2 %d%s",
1967 area->lsp_gen_interval[1], VTY_NEWLINE);
1968 write++;
1969 }
1970 }
1971 /* ISIS - LSP lifetime */
1972 if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1])
1973 {
1974 if (area->max_lsp_lifetime[0] != MAX_AGE)
1975 {
1976 vty_out (vty, " lsp-lifetime %u%s", area->max_lsp_lifetime[0],
1977 VTY_NEWLINE);
1978 write++;
1979 }
1980 }
1981 else
1982 {
1983 if (area->max_lsp_lifetime[0] != MAX_AGE)
1984 {
1985 vty_out (vty, " lsp-lifetime level-1 %u%s",
1986 area->max_lsp_lifetime[0], VTY_NEWLINE);
1987 write++;
1988 }
1989 if (area->max_lsp_lifetime[1] != MAX_AGE)
1990 {
1991 vty_out (vty, " lsp-lifetime level-2 %u%s",
1992 area->max_lsp_lifetime[1], VTY_NEWLINE);
1993 write++;
1994 }
1995 }
hasso13fb40a2005-10-01 06:03:04 +00001996 /* Minimum SPF interval. */
1997 if (area->min_spf_interval[0] == area->min_spf_interval[1])
1998 {
1999 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
2000 {
2001 vty_out (vty, " spf-interval %d%s",
2002 area->min_spf_interval[0], VTY_NEWLINE);
2003 write++;
2004 }
2005 }
2006 else
2007 {
2008 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
2009 {
2010 vty_out (vty, " spf-interval level-1 %d%s",
2011 area->min_spf_interval[0], VTY_NEWLINE);
2012 write++;
2013 }
2014 if (area->min_spf_interval[1] != MINIMUM_SPF_INTERVAL)
2015 {
2016 vty_out (vty, " spf-interval level-2 %d%s",
2017 area->min_spf_interval[1], VTY_NEWLINE);
2018 write++;
2019 }
2020 }
hasso53c997c2004-09-15 16:21:59 +00002021 /* Authentication passwords. */
2022 if (area->area_passwd.len > 0)
2023 {
hasso1cbc5622005-01-01 10:29:51 +00002024 vty_out(vty, " area-password %s", area->area_passwd.passwd);
2025 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
2026 {
2027 vty_out(vty, " authenticate snp ");
2028 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
2029 vty_out(vty, "validate");
2030 else
2031 vty_out(vty, "send-only");
2032 }
2033 vty_out(vty, "%s", VTY_NEWLINE);
hasso53c997c2004-09-15 16:21:59 +00002034 write++;
2035 }
2036 if (area->domain_passwd.len > 0)
2037 {
hasso1cbc5622005-01-01 10:29:51 +00002038 vty_out(vty, " domain-password %s", area->domain_passwd.passwd);
2039 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
2040 {
2041 vty_out(vty, " authenticate snp ");
2042 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
2043 vty_out(vty, "validate");
2044 else
2045 vty_out(vty, "send-only");
2046 }
2047 vty_out(vty, "%s", VTY_NEWLINE);
hasso53c997c2004-09-15 16:21:59 +00002048 write++;
2049 }
hassof1082d12005-09-19 04:23:34 +00002050
hassof390d2c2004-09-10 20:48:21 +00002051#ifdef TOPOLOGY_GENERATE
hassof1082d12005-09-19 04:23:34 +00002052 if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,
2053 ISIS_SYS_ID_LEN))
2054 {
2055 vty_out (vty, " topology base-is %s%s",
2056 sysid_print (area->topology_baseis), VTY_NEWLINE);
2057 write++;
2058 }
2059 if (area->topology_basedynh)
2060 {
2061 vty_out (vty, " topology base-dynh %s%s",
2062 area->topology_basedynh, VTY_NEWLINE);
2063 write++;
2064 }
2065 /* We save the whole command line here. */
2066 if (strlen(area->top_params))
hassof390d2c2004-09-10 20:48:21 +00002067 {
2068 vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE);
2069 write++;
2070 }
hassof390d2c2004-09-10 20:48:21 +00002071#endif /* TOPOLOGY_GENERATE */
hassof1082d12005-09-19 04:23:34 +00002072
hassof390d2c2004-09-10 20:48:21 +00002073 }
jardineb5d44e2003-12-23 08:09:43 +00002074 }
hassof390d2c2004-09-10 20:48:21 +00002075
jardineb5d44e2003-12-23 08:09:43 +00002076 return write;
2077}
2078
hassof390d2c2004-09-10 20:48:21 +00002079struct cmd_node isis_node = {
jardineb5d44e2003-12-23 08:09:43 +00002080 ISIS_NODE,
hasso2097cd82003-12-23 11:51:08 +00002081 "%s(config-router)# ",
jardineb5d44e2003-12-23 08:09:43 +00002082 1
2083};
2084
hassof390d2c2004-09-10 20:48:21 +00002085void
jardineb5d44e2003-12-23 08:09:43 +00002086isis_init ()
2087{
jardineb5d44e2003-12-23 08:09:43 +00002088 /* Install IS-IS top node */
2089 install_node (&isis_node, isis_config_write);
hassof390d2c2004-09-10 20:48:21 +00002090
jardineb5d44e2003-12-23 08:09:43 +00002091 install_element (VIEW_NODE, &show_clns_neighbors_cmd);
2092 install_element (VIEW_NODE, &show_isis_neighbors_cmd);
2093 install_element (VIEW_NODE, &show_clns_neighbors_detail_cmd);
2094 install_element (VIEW_NODE, &show_isis_neighbors_detail_cmd);
2095
2096 install_element (VIEW_NODE, &show_hostname_cmd);
2097 install_element (VIEW_NODE, &show_database_cmd);
2098 install_element (VIEW_NODE, &show_database_detail_cmd);
2099
2100 install_element (ENABLE_NODE, &show_clns_neighbors_cmd);
2101 install_element (ENABLE_NODE, &show_isis_neighbors_cmd);
2102 install_element (ENABLE_NODE, &show_clns_neighbors_detail_cmd);
2103 install_element (ENABLE_NODE, &show_isis_neighbors_detail_cmd);
2104
2105 install_element (ENABLE_NODE, &show_hostname_cmd);
2106 install_element (ENABLE_NODE, &show_database_cmd);
2107 install_element (ENABLE_NODE, &show_database_detail_cmd);
2108 install_element (ENABLE_NODE, &show_debugging_cmd);
2109
hassof390d2c2004-09-10 20:48:21 +00002110 install_node (&debug_node, config_write_debug);
jardin9e867fe2003-12-23 08:56:18 +00002111
jardineb5d44e2003-12-23 08:09:43 +00002112 install_element (ENABLE_NODE, &debug_isis_adj_cmd);
2113 install_element (ENABLE_NODE, &no_debug_isis_adj_cmd);
2114 install_element (ENABLE_NODE, &debug_isis_csum_cmd);
2115 install_element (ENABLE_NODE, &no_debug_isis_csum_cmd);
2116 install_element (ENABLE_NODE, &debug_isis_lupd_cmd);
2117 install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd);
2118 install_element (ENABLE_NODE, &debug_isis_err_cmd);
2119 install_element (ENABLE_NODE, &no_debug_isis_err_cmd);
2120 install_element (ENABLE_NODE, &debug_isis_snp_cmd);
2121 install_element (ENABLE_NODE, &no_debug_isis_snp_cmd);
2122 install_element (ENABLE_NODE, &debug_isis_upd_cmd);
2123 install_element (ENABLE_NODE, &no_debug_isis_upd_cmd);
2124 install_element (ENABLE_NODE, &debug_isis_spfevents_cmd);
2125 install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd);
2126 install_element (ENABLE_NODE, &debug_isis_spfstats_cmd);
2127 install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd);
2128 install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd);
2129 install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd);
2130 install_element (ENABLE_NODE, &debug_isis_rtevents_cmd);
2131 install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);
2132 install_element (ENABLE_NODE, &debug_isis_events_cmd);
2133 install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
2134
jardin9e867fe2003-12-23 08:56:18 +00002135 install_element (CONFIG_NODE, &debug_isis_adj_cmd);
2136 install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);
2137 install_element (CONFIG_NODE, &debug_isis_csum_cmd);
2138 install_element (CONFIG_NODE, &no_debug_isis_csum_cmd);
2139 install_element (CONFIG_NODE, &debug_isis_lupd_cmd);
2140 install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd);
2141 install_element (CONFIG_NODE, &debug_isis_err_cmd);
2142 install_element (CONFIG_NODE, &no_debug_isis_err_cmd);
2143 install_element (CONFIG_NODE, &debug_isis_snp_cmd);
2144 install_element (CONFIG_NODE, &no_debug_isis_snp_cmd);
2145 install_element (CONFIG_NODE, &debug_isis_upd_cmd);
2146 install_element (CONFIG_NODE, &no_debug_isis_upd_cmd);
2147 install_element (CONFIG_NODE, &debug_isis_spfevents_cmd);
2148 install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd);
2149 install_element (CONFIG_NODE, &debug_isis_spfstats_cmd);
2150 install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd);
2151 install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd);
2152 install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd);
2153 install_element (CONFIG_NODE, &debug_isis_rtevents_cmd);
2154 install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);
2155 install_element (CONFIG_NODE, &debug_isis_events_cmd);
2156 install_element (CONFIG_NODE, &no_debug_isis_events_cmd);
2157
jardineb5d44e2003-12-23 08:09:43 +00002158 install_element (CONFIG_NODE, &router_isis_cmd);
2159 install_element (CONFIG_NODE, &no_router_isis_cmd);
2160
2161 install_default (ISIS_NODE);
2162
2163 install_element (ISIS_NODE, &net_cmd);
2164 install_element (ISIS_NODE, &no_net_cmd);
2165
2166 install_element (ISIS_NODE, &is_type_cmd);
2167 install_element (ISIS_NODE, &no_is_type_cmd);
2168
2169 install_element (ISIS_NODE, &area_passwd_cmd);
hasso1cbc5622005-01-01 10:29:51 +00002170 install_element (ISIS_NODE, &area_passwd_snpauth_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002171 install_element (ISIS_NODE, &no_area_passwd_cmd);
2172
2173 install_element (ISIS_NODE, &domain_passwd_cmd);
hasso1cbc5622005-01-01 10:29:51 +00002174 install_element (ISIS_NODE, &domain_passwd_snpauth_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002175 install_element (ISIS_NODE, &no_domain_passwd_cmd);
2176
2177 install_element (ISIS_NODE, &lsp_gen_interval_cmd);
2178 install_element (ISIS_NODE, &no_lsp_gen_interval_cmd);
2179 install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd);
2180 install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd);
2181 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd);
2182 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd);
2183 install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd);
2184 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd);
2185 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd);
2186
2187 install_element (ISIS_NODE, &spf_interval_cmd);
2188 install_element (ISIS_NODE, &no_spf_interval_cmd);
2189 install_element (ISIS_NODE, &no_spf_interval_arg_cmd);
2190 install_element (ISIS_NODE, &spf_interval_l1_cmd);
2191 install_element (ISIS_NODE, &no_spf_interval_l1_cmd);
2192 install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd);
2193 install_element (ISIS_NODE, &spf_interval_l2_cmd);
2194 install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
2195 install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
hassof390d2c2004-09-10 20:48:21 +00002196
jardineb5d44e2003-12-23 08:09:43 +00002197 install_element (ISIS_NODE, &lsp_lifetime_cmd);
2198 install_element (ISIS_NODE, &no_lsp_lifetime_cmd);
2199 install_element (ISIS_NODE, &no_lsp_lifetime_arg_cmd);
2200 install_element (ISIS_NODE, &lsp_lifetime_l1_cmd);
2201 install_element (ISIS_NODE, &no_lsp_lifetime_l1_cmd);
2202 install_element (ISIS_NODE, &no_lsp_lifetime_l1_arg_cmd);
2203 install_element (ISIS_NODE, &lsp_lifetime_l2_cmd);
2204 install_element (ISIS_NODE, &no_lsp_lifetime_l2_cmd);
2205 install_element (ISIS_NODE, &no_lsp_lifetime_l2_arg_cmd);
2206
2207 install_element (ISIS_NODE, &dynamic_hostname_cmd);
2208 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
2209
2210 install_element (ISIS_NODE, &metric_style_cmd);
2211 install_element (ISIS_NODE, &no_metric_style_cmd);
2212#ifdef TOPOLOGY_GENERATE
2213 install_element (ISIS_NODE, &topology_generate_grid_cmd);
2214 install_element (ISIS_NODE, &topology_baseis_cmd);
hassof1082d12005-09-19 04:23:34 +00002215 install_element (ISIS_NODE, &topology_basedynh_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002216 install_element (ISIS_NODE, &no_topology_baseis_cmd);
hassof1082d12005-09-19 04:23:34 +00002217 install_element (ISIS_NODE, &no_topology_baseis_noid_cmd);
hassof695b012005-04-02 19:03:39 +00002218 install_element (VIEW_NODE, &show_isis_generated_topology_cmd);
2219 install_element (ENABLE_NODE, &show_isis_generated_topology_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002220#endif /* TOPOLOGY_GENERATE */
2221
hassof390d2c2004-09-10 20:48:21 +00002222 isis_new (0);
jardineb5d44e2003-12-23 08:09:43 +00002223 isis_circuit_init ();
2224 isis_zebra_init ();
2225 isis_spf_cmds_init ();
2226}