blob: 3fbed0beac3be00faa142d22af96da61f7f48cf0 [file] [log] [blame]
jardineb5d44e2003-12-23 08:09:43 +00001/*
2 * IS-IS Rout(e)ing protocol - isisd.c
3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public Licenseas published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23#include <string.h>
24#include <zebra.h>
jardineb5d44e2003-12-23 08:09:43 +000025
26#include "thread.h"
27#include "vty.h"
28#include "command.h"
29#include "log.h"
30#include "memory.h"
31#include "linklist.h"
32#include "if.h"
33#include "hash.h"
34#include "stream.h"
35#include "prefix.h"
36#include "table.h"
37
38#include "isisd/dict.h"
39#include "isisd/include-netbsd/iso.h"
40#include "isisd/isis_constants.h"
41#include "isisd/isis_common.h"
42#include "isisd/isis_circuit.h"
43#include "isisd/isis_flags.h"
44#include "isisd/isisd.h"
45#include "isisd/isis_dynhn.h"
46#include "isisd/isis_adjacency.h"
47#include "isisd/isis_pdu.h"
48#include "isisd/isis_misc.h"
49#include "isisd/isis_constants.h"
50#include "isisd/isis_tlv.h"
51#include "isisd/isis_lsp.h"
52#include "isisd/isis_spf.h"
53#include "isisd/isis_route.h"
54#include "isisd/isis_zebra.h"
55#include "isisd/isis_events.h"
56
57#ifdef TOPOLOGY_GENERATE
58#include "spgrid.h"
hassof390d2c2004-09-10 20:48:21 +000059u_char DEFAULT_TOPOLOGY_BASEIS[6] = { 0xFE, 0xED, 0xFE, 0xED, 0x00, 0x00 };
jardineb5d44e2003-12-23 08:09:43 +000060#endif /* TOPOLOGY_GENERATE */
61
jardineb5d44e2003-12-23 08:09:43 +000062struct isis *isis = NULL;
63struct thread_master *master;
64
jardineb5d44e2003-12-23 08:09:43 +000065void
66isis_new (unsigned long process_id)
67{
hassof390d2c2004-09-10 20:48:21 +000068 isis = XMALLOC (MTYPE_ISIS, sizeof (struct isis));
jardineb5d44e2003-12-23 08:09:43 +000069 bzero (isis, sizeof (struct isis));
70 /*
71 * Default values
72 */
73 isis->max_area_addrs = 3;
74
75 isis->process_id = process_id;
76 isis->area_list = list_new ();
77 isis->init_circ_list = list_new ();
78 isis->uptime = time (NULL);
79 isis->nexthops = list_new ();
80#ifdef HAVE_IPV6
81 isis->nexthops6 = list_new ();
82#endif /* HAVE_IPV6 */
83 /*
84 * uncomment the next line for full debugs
85 */
hassof390d2c2004-09-10 20:48:21 +000086 /* isis->debugs = 0xFFFF; */
jardineb5d44e2003-12-23 08:09:43 +000087}
88
89struct isis_area *
90isis_area_create ()
91{
jardineb5d44e2003-12-23 08:09:43 +000092 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +000093
jardineb5d44e2003-12-23 08:09:43 +000094 area = XMALLOC (MTYPE_ISIS_AREA, sizeof (struct isis_area));
95 memset (area, 0, sizeof (struct isis_area));
96
97 /*
98 * The first instance is level-1-2 rest are level-1, unless otherwise
99 * configured
100 */
101 if (listcount (isis->area_list) > 0)
102 area->is_type = IS_LEVEL_1;
103 else
104 area->is_type = IS_LEVEL_1_AND_2;
105 /*
106 * intialize the databases
107 */
108 area->lspdb[0] = lsp_db_init ();
109 area->lspdb[1] = lsp_db_init ();
hassof390d2c2004-09-10 20:48:21 +0000110
jardineb5d44e2003-12-23 08:09:43 +0000111 spftree_area_init (area);
112 area->route_table = route_table_init ();
113#ifdef HAVE_IPV6
114 area->route_table6 = route_table_init ();
115#endif /* HAVE_IPV6 */
116 area->circuit_list = list_new ();
117 area->area_addrs = list_new ();
hassof390d2c2004-09-10 20:48:21 +0000118 THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1);
jardineb5d44e2003-12-23 08:09:43 +0000119 area->flags.maxindex = -1;
120 /*
121 * Default values
122 */
hassof390d2c2004-09-10 20:48:21 +0000123 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200 */
124 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200 */
jardineb5d44e2003-12-23 08:09:43 +0000125 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
126 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
hassof390d2c2004-09-10 20:48:21 +0000127 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900 */
128 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900 */
jardineb5d44e2003-12-23 08:09:43 +0000129 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
130 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
131 area->dynhostname = 1;
132 area->lsp_frag_threshold = 90;
133#ifdef TOPOLOGY_GENERATE
134 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
135#endif /* TOPOLOGY_GENERATE */
136
137 /* FIXME: Think of a better way... */
138 area->min_bcast_mtu = 1497;
139
140 return area;
141}
142
143struct isis_area *
144isis_area_lookup (char *area_tag)
145{
146 struct isis_area *area;
147 struct listnode *node;
hassof390d2c2004-09-10 20:48:21 +0000148
jardineb5d44e2003-12-23 08:09:43 +0000149 LIST_LOOP (isis->area_list, area, node)
150 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
jardineb5d44e2003-12-23 08:09:43 +0000159isis_area_get (struct vty *vty, char *area_tag)
160{
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
jardineb5d44e2003-12-23 08:09:43 +0000176 zlog_info ("new IS-IS area instance %s", area->area_tag);
177
178 vty->node = ISIS_NODE;
179 vty->index = area;
hassof390d2c2004-09-10 20:48:21 +0000180
jardineb5d44e2003-12-23 08:09:43 +0000181 return CMD_SUCCESS;
182}
183
184int
185isis_area_destroy (struct vty *vty, char *area_tag)
186{
jardineb5d44e2003-12-23 08:09:43 +0000187 struct isis_area *area;
188 struct listnode *node;
189 struct isis_circuit *circuit;
190
191 area = isis_area_lookup (area_tag);
jardineb5d44e2003-12-23 08:09:43 +0000192
hassof390d2c2004-09-10 20:48:21 +0000193 if (area == NULL)
194 {
195 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
196 return CMD_WARNING;
jardineb5d44e2003-12-23 08:09:43 +0000197 }
hassof390d2c2004-09-10 20:48:21 +0000198
199 if (area->circuit_list)
200 {
201 node = listhead (area->circuit_list);
202 while (node)
203 {
204 circuit = getdata (node);
205 nextnode (node);
206 isis_circuit_del (circuit);
207 }
208 list_delete (area->circuit_list);
209 }
jardineb5d44e2003-12-23 08:09:43 +0000210 listnode_delete (isis->area_list, area);
hassof390d2c2004-09-10 20:48:21 +0000211 THREAD_TIMER_OFF (area->t_tick);
jardineb5d44e2003-12-23 08:09:43 +0000212 if (area->t_remove_aged)
213 thread_cancel (area->t_remove_aged);
hassof390d2c2004-09-10 20:48:21 +0000214 THREAD_TIMER_OFF (area->t_lsp_refresh[0]);
215 THREAD_TIMER_OFF (area->t_lsp_refresh[1]);
jardineb5d44e2003-12-23 08:09:43 +0000216
217 XFREE (MTYPE_ISIS_AREA, area);
hassof390d2c2004-09-10 20:48:21 +0000218
jardineb5d44e2003-12-23 08:09:43 +0000219 return CMD_SUCCESS;
220}
221
hassof390d2c2004-09-10 20:48:21 +0000222int
223area_net_title (struct vty *vty, char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000224{
jardineb5d44e2003-12-23 08:09:43 +0000225 struct isis_area *area;
226 struct area_addr *addr;
227 struct area_addr *addrp;
228 struct listnode *node;
229
230 u_char buff[255];
231 area = vty->index;
232
hassof390d2c2004-09-10 20:48:21 +0000233 if (!area)
234 {
235 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
236 return CMD_WARNING;
237 }
jardineb5d44e2003-12-23 08:09:43 +0000238
239 /* We check that we are not over the maximal number of addresses */
hassof390d2c2004-09-10 20:48:21 +0000240 if (listcount (area->area_addrs) >= isis->max_area_addrs)
241 {
242 vty_out (vty, "Maximum of area addresses (%d) already reached %s",
243 isis->max_area_addrs, VTY_NEWLINE);
244 return CMD_WARNING;
245 }
jardineb5d44e2003-12-23 08:09:43 +0000246
247 addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));
248 addr->addr_len = dotformat2buff (buff, net_title);
249 memcpy (addr->area_addr, buff, addr->addr_len);
250#ifdef EXTREME_DEBUG
hassof390d2c2004-09-10 20:48:21 +0000251 zlog_info ("added area address %s for area %s (address length %d)",
jardineb5d44e2003-12-23 08:09:43 +0000252 net_title, area->area_tag, addr->addr_len);
253#endif /* EXTREME_DEBUG */
hassof390d2c2004-09-10 20:48:21 +0000254 if (addr->addr_len < 8 || addr->addr_len > 20)
255 {
256 zlog_warn ("area address must be at least 8..20 octets long (%d)",
257 addr->addr_len);
jardineb5d44e2003-12-23 08:09:43 +0000258 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
259 return CMD_WARNING;
260 }
261
hassof390d2c2004-09-10 20:48:21 +0000262 if (isis->sysid_set == 0)
263 {
264 /*
265 * First area address - get the SystemID for this router
266 */
267 memcpy (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN), ISIS_SYS_ID_LEN);
268 isis->sysid_set = 1;
269 zlog_info ("Router has SystemID %s", sysid_print (isis->sysid));
jardineb5d44e2003-12-23 08:09:43 +0000270 }
hassof390d2c2004-09-10 20:48:21 +0000271 else
272 {
273 /*
274 * Check that the SystemID portions match
275 */
276 if (memcmp (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN),
277 ISIS_SYS_ID_LEN))
278 {
279 vty_out (vty,
280 "System ID must not change when defining additional area"
281 " addresses%s", VTY_NEWLINE);
282 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
283 return CMD_WARNING;
284 }
jardineb5d44e2003-12-23 08:09:43 +0000285
hassof390d2c2004-09-10 20:48:21 +0000286 /* now we see that we don't already have this address */
287 LIST_LOOP (area->area_addrs, addrp, node)
288 {
289 if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == (addr->addr_len))
290 {
291 if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
292 {
293 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
294 return CMD_SUCCESS; /* silent fail */
295 }
296 }
297 }
298
299 }
jardineb5d44e2003-12-23 08:09:43 +0000300 /*
301 * Forget the systemID part of the address
302 */
303 addr->addr_len -= (ISIS_SYS_ID_LEN + 1);
304 listnode_add (area->area_addrs, addr);
305
306 /* only now we can safely generate our LSPs for this area */
hassof390d2c2004-09-10 20:48:21 +0000307 if (listcount (area->area_addrs) > 0)
308 {
309 lsp_l1_generate (area);
310 lsp_l2_generate (area);
311 }
jardineb5d44e2003-12-23 08:09:43 +0000312
313 return CMD_SUCCESS;
314}
315
316int
317area_clear_net_title (struct vty *vty, char *net_title)
318{
319 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000320 struct area_addr addr, *addrp = NULL;
jardineb5d44e2003-12-23 08:09:43 +0000321 struct listnode *node;
322 u_char buff[255];
323
324 area = vty->index;
hassof390d2c2004-09-10 20:48:21 +0000325 if (!area)
326 {
327 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
328 return CMD_WARNING;
329 }
330
jardineb5d44e2003-12-23 08:09:43 +0000331 addr.addr_len = dotformat2buff (buff, net_title);
hassof390d2c2004-09-10 20:48:21 +0000332 if (addr.addr_len < 8 || addr.addr_len > 20)
333 {
334 vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
335 addr.addr_len, VTY_NEWLINE);
336 return CMD_WARNING;
337 }
338
339 memcpy (addr.area_addr, buff, (int) addr.addr_len);
340
jardineb5d44e2003-12-23 08:09:43 +0000341 LIST_LOOP (area->area_addrs, addrp, node)
342 if (addrp->addr_len == addr.addr_len &&
343 !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
hassof390d2c2004-09-10 20:48:21 +0000344 break;
345
346 if (!addrp)
347 {
348 vty_out (vty, "No area address %s for area %s %s", net_title,
349 area->area_tag, VTY_NEWLINE);
350 return CMD_WARNING;
351 }
352
jardineb5d44e2003-12-23 08:09:43 +0000353 listnode_delete (area->area_addrs, addrp);
hassof390d2c2004-09-10 20:48:21 +0000354
jardineb5d44e2003-12-23 08:09:43 +0000355 return CMD_SUCCESS;
356}
357
jardineb5d44e2003-12-23 08:09:43 +0000358/*
359 * 'show clns neighbors' command
360 */
361
362int
hassof390d2c2004-09-10 20:48:21 +0000363show_clns_neigh (struct vty *vty, char detail)
jardineb5d44e2003-12-23 08:09:43 +0000364{
365 struct listnode *node_area, *node_circ;
366 struct isis_area *area;
367 struct isis_circuit *circuit;
368 struct list *db;
369 int i;
370
hassof390d2c2004-09-10 20:48:21 +0000371 if (!isis)
372 {
373 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
374 return CMD_SUCCESS;
375 }
jardineb5d44e2003-12-23 08:09:43 +0000376
377 for (node_area = listhead (isis->area_list); node_area;
hassof390d2c2004-09-10 20:48:21 +0000378 nextnode (node_area))
379 {
380 area = getdata (node_area);
381 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000382
hassof390d2c2004-09-10 20:48:21 +0000383 if (detail == ISIS_UI_LEVEL_BRIEF)
384 vty_out (vty, " System Id Interface L State "
385 "Holdtime SNPA%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000386
hassof390d2c2004-09-10 20:48:21 +0000387 for (node_circ = listhead (area->circuit_list); node_circ;
388 nextnode (node_circ))
389 {
390 circuit = getdata (node_circ);
391 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
392 {
393 for (i = 0; i < 2; i++)
394 {
395 db = circuit->u.bc.adjdb[i];
396 if (db && db->count)
397 {
398 if (detail == ISIS_UI_LEVEL_BRIEF)
399 isis_adjdb_iterate (db,
400 (void (*)
401 (struct isis_adjacency *,
402 void *)) isis_adj_print_vty,
403 vty);
404 if (detail == ISIS_UI_LEVEL_DETAIL)
405 isis_adjdb_iterate (db,
406 (void (*)
407 (struct isis_adjacency *,
408 void *))
409 isis_adj_print_vty_detail, vty);
410 if (detail == ISIS_UI_LEVEL_EXTENSIVE)
411 isis_adjdb_iterate (db,
412 (void (*)
413 (struct isis_adjacency *,
414 void *))
415 isis_adj_print_vty_extensive,
416 vty);
417 }
418 }
419 }
420 else if (circuit->circ_type == CIRCUIT_T_P2P &&
421 circuit->u.p2p.neighbor)
422 {
423 if (detail == ISIS_UI_LEVEL_BRIEF)
424 isis_adj_p2p_print_vty (circuit->u.p2p.neighbor, vty);
425 if (detail == ISIS_UI_LEVEL_DETAIL)
426 isis_adj_p2p_print_vty_detail (circuit->u.p2p.neighbor, vty);
427 if (detail == ISIS_UI_LEVEL_EXTENSIVE)
428 isis_adj_p2p_print_vty_extensive (circuit->u.p2p.neighbor,
429 vty);
430 }
431 }
jardineb5d44e2003-12-23 08:09:43 +0000432 }
hassof390d2c2004-09-10 20:48:21 +0000433
jardineb5d44e2003-12-23 08:09:43 +0000434 return CMD_SUCCESS;
435}
436
437DEFUN (show_clns_neighbors,
438 show_clns_neighbors_cmd,
439 "show clns neighbors",
440 SHOW_STR
441 "clns network information\n"
442 "CLNS neighbor adjacencies\n")
443{
hassof390d2c2004-09-10 20:48:21 +0000444 return show_clns_neigh (vty, ISIS_UI_LEVEL_BRIEF);
jardineb5d44e2003-12-23 08:09:43 +0000445}
446
447ALIAS (show_clns_neighbors,
448 show_isis_neighbors_cmd,
449 "show isis neighbors",
450 SHOW_STR
451 "IS-IS network information\n"
452 "IS-IS neighbor adjacencies\n")
453
454DEFUN (show_clns_neighbors_detail,
455 show_clns_neighbors_detail_cmd,
456 "show clns neighbors detail",
457 SHOW_STR
458 "clns network information\n"
459 "CLNS neighbor adjacencies\n"
460 "show detailed information\n")
461{
hassof390d2c2004-09-10 20:48:21 +0000462 return show_clns_neigh (vty, ISIS_UI_LEVEL_DETAIL);
jardineb5d44e2003-12-23 08:09:43 +0000463}
464
465ALIAS (show_clns_neighbors_detail,
466 show_isis_neighbors_detail_cmd,
467 "show isis neighbors detail",
468 SHOW_STR
469 "IS-IS network information\n"
470 "IS-IS neighbor adjacencies\n"
471 "show detailed information\n")
jardineb5d44e2003-12-23 08:09:43 +0000472/*
473 * 'isis debug', 'show debugging'
474 */
jardineb5d44e2003-12-23 08:09:43 +0000475void
476print_debug (struct vty *vty, int flags, int onoff)
477{
478 char onoffs[4];
479 if (onoff)
hassof390d2c2004-09-10 20:48:21 +0000480 strcpy (onoffs, "on");
jardineb5d44e2003-12-23 08:09:43 +0000481 else
hassof390d2c2004-09-10 20:48:21 +0000482 strcpy (onoffs, "off");
jardineb5d44e2003-12-23 08:09:43 +0000483
484 if (flags & DEBUG_ADJ_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000485 vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs,
486 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000487 if (flags & DEBUG_CHECKSUM_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000488 vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs,
489 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000490 if (flags & DEBUG_LOCAL_UPDATES)
hassof390d2c2004-09-10 20:48:21 +0000491 vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs,
492 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000493 if (flags & DEBUG_PROTOCOL_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000494 vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs,
495 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000496 if (flags & DEBUG_SNP_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000497 vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs,
498 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000499 if (flags & DEBUG_SPF_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000500 vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000501 if (flags & DEBUG_SPF_STATS)
hassof390d2c2004-09-10 20:48:21 +0000502 vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s",
503 onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000504 if (flags & DEBUG_SPF_TRIGGERS)
hassof390d2c2004-09-10 20:48:21 +0000505 vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs,
506 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000507 if (flags & DEBUG_UPDATE_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000508 vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs,
509 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000510 if (flags & DEBUG_RTE_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000511 vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs,
512 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000513 if (flags & DEBUG_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000514 vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000515
516}
517
518DEFUN (show_debugging,
519 show_debugging_cmd,
520 "show debugging",
521 SHOW_STR
522 "State of each debugging option\n")
523{
hassof390d2c2004-09-10 20:48:21 +0000524 vty_out (vty, "IS-IS:%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000525 print_debug (vty, isis->debugs, 1);
526 return CMD_SUCCESS;
527}
528
jardin9e867fe2003-12-23 08:56:18 +0000529/* Debug node. */
hassof390d2c2004-09-10 20:48:21 +0000530static struct cmd_node debug_node = {
jardin9e867fe2003-12-23 08:56:18 +0000531 DEBUG_NODE,
hassof390d2c2004-09-10 20:48:21 +0000532 "",
533 1
jardin9e867fe2003-12-23 08:56:18 +0000534};
535
536static int
537config_write_debug (struct vty *vty)
538{
539 int write = 0;
540 int flags = isis->debugs;
541
hassof390d2c2004-09-10 20:48:21 +0000542 if (flags & DEBUG_ADJ_PACKETS)
543 {
544 vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE);
545 write++;
546 }
547 if (flags & DEBUG_CHECKSUM_ERRORS)
548 {
549 vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE);
550 write++;
551 }
552 if (flags & DEBUG_LOCAL_UPDATES)
553 {
554 vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE);
555 write++;
556 }
557 if (flags & DEBUG_PROTOCOL_ERRORS)
558 {
559 vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE);
560 write++;
561 }
562 if (flags & DEBUG_SNP_PACKETS)
563 {
564 vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE);
565 write++;
566 }
567 if (flags & DEBUG_SPF_EVENTS)
568 {
569 vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE);
570 write++;
571 }
572 if (flags & DEBUG_SPF_STATS)
573 {
574 vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE);
575 write++;
576 }
577 if (flags & DEBUG_SPF_TRIGGERS)
578 {
579 vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE);
580 write++;
581 }
582 if (flags & DEBUG_UPDATE_PACKETS)
583 {
584 vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE);
585 write++;
586 }
587 if (flags & DEBUG_RTE_EVENTS)
588 {
589 vty_out (vty, "debug isis route-events%s", VTY_NEWLINE);
590 write++;
591 }
592 if (flags & DEBUG_EVENTS)
593 {
594 vty_out (vty, "debug isis events%s", VTY_NEWLINE);
595 write++;
596 }
jardin9e867fe2003-12-23 08:56:18 +0000597
598 return write;
599}
600
jardineb5d44e2003-12-23 08:09:43 +0000601DEFUN (debug_isis_adj,
602 debug_isis_adj_cmd,
603 "debug isis adj-packets",
604 DEBUG_STR
605 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000606 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000607{
608 isis->debugs |= DEBUG_ADJ_PACKETS;
hassof390d2c2004-09-10 20:48:21 +0000609 print_debug (vty, DEBUG_ADJ_PACKETS, 1);
jardineb5d44e2003-12-23 08:09:43 +0000610
611 return CMD_SUCCESS;
612}
613
614DEFUN (no_debug_isis_adj,
615 no_debug_isis_adj_cmd,
616 "no debug isis adj-packets",
617 UNDEBUG_STR
618 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000619 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000620{
jardineb5d44e2003-12-23 08:09:43 +0000621 isis->debugs &= ~DEBUG_ADJ_PACKETS;
622 print_debug (vty, DEBUG_ADJ_PACKETS, 0);
623
624 return CMD_SUCCESS;
625}
626
jardineb5d44e2003-12-23 08:09:43 +0000627DEFUN (debug_isis_csum,
628 debug_isis_csum_cmd,
629 "debug isis checksum-errors",
630 DEBUG_STR
631 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000632 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000633{
634 isis->debugs |= DEBUG_CHECKSUM_ERRORS;
635 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1);
636
637 return CMD_SUCCESS;
638}
639
640DEFUN (no_debug_isis_csum,
641 no_debug_isis_csum_cmd,
642 "no debug isis checksum-errors",
643 UNDEBUG_STR
644 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000645 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000646{
647 isis->debugs &= ~DEBUG_CHECKSUM_ERRORS;
648 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000649
jardineb5d44e2003-12-23 08:09:43 +0000650 return CMD_SUCCESS;
651}
652
653DEFUN (debug_isis_lupd,
654 debug_isis_lupd_cmd,
655 "debug isis local-updates",
656 DEBUG_STR
657 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000658 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000659{
660 isis->debugs |= DEBUG_LOCAL_UPDATES;
661 print_debug (vty, DEBUG_LOCAL_UPDATES, 1);
662
663 return CMD_SUCCESS;
664}
665
666DEFUN (no_debug_isis_lupd,
667 no_debug_isis_lupd_cmd,
668 "no debug isis local-updates",
669 UNDEBUG_STR
670 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000671 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000672{
673 isis->debugs &= ~DEBUG_LOCAL_UPDATES;
hassof390d2c2004-09-10 20:48:21 +0000674 print_debug (vty, DEBUG_LOCAL_UPDATES, 0);
675
jardineb5d44e2003-12-23 08:09:43 +0000676 return CMD_SUCCESS;
677}
678
679DEFUN (debug_isis_err,
680 debug_isis_err_cmd,
hassof390d2c2004-09-10 20:48:21 +0000681 "debug isis protocol-errors",
jardineb5d44e2003-12-23 08:09:43 +0000682 DEBUG_STR
683 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000684 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000685{
686 isis->debugs |= DEBUG_PROTOCOL_ERRORS;
687 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1);
688
689 return CMD_SUCCESS;
690}
691
692DEFUN (no_debug_isis_err,
693 no_debug_isis_err_cmd,
694 "no debug isis protocol-errors",
695 UNDEBUG_STR
696 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000697 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000698{
699 isis->debugs &= ~DEBUG_PROTOCOL_ERRORS;
700 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000701
jardineb5d44e2003-12-23 08:09:43 +0000702 return CMD_SUCCESS;
703}
704
705DEFUN (debug_isis_snp,
706 debug_isis_snp_cmd,
707 "debug isis snp-packets",
708 DEBUG_STR
709 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000710 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000711{
712 isis->debugs |= DEBUG_SNP_PACKETS;
713 print_debug (vty, DEBUG_SNP_PACKETS, 1);
714
715 return CMD_SUCCESS;
716}
717
718DEFUN (no_debug_isis_snp,
719 no_debug_isis_snp_cmd,
720 "no debug isis snp-packets",
721 UNDEBUG_STR
722 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000723 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000724{
hassof390d2c2004-09-10 20:48:21 +0000725 isis->debugs &= ~DEBUG_SNP_PACKETS;
jardineb5d44e2003-12-23 08:09:43 +0000726 print_debug (vty, DEBUG_SNP_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +0000727
jardineb5d44e2003-12-23 08:09:43 +0000728 return CMD_SUCCESS;
729}
730
jardineb5d44e2003-12-23 08:09:43 +0000731DEFUN (debug_isis_upd,
732 debug_isis_upd_cmd,
733 "debug isis update-packets",
734 DEBUG_STR
735 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000736 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000737{
738 isis->debugs |= DEBUG_UPDATE_PACKETS;
739 print_debug (vty, DEBUG_UPDATE_PACKETS, 1);
740
741 return CMD_SUCCESS;
742}
743
744DEFUN (no_debug_isis_upd,
745 no_debug_isis_upd_cmd,
746 "no debug isis update-packets",
747 UNDEBUG_STR
748 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000749 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000750{
751 isis->debugs &= ~DEBUG_UPDATE_PACKETS;
752 print_debug (vty, DEBUG_UPDATE_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +0000753
jardineb5d44e2003-12-23 08:09:43 +0000754 return CMD_SUCCESS;
755}
756
jardineb5d44e2003-12-23 08:09:43 +0000757DEFUN (debug_isis_spfevents,
758 debug_isis_spfevents_cmd,
759 "debug isis spf-events",
760 DEBUG_STR
761 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000762 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000763{
764 isis->debugs |= DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +0000765 print_debug (vty, DEBUG_SPF_EVENTS, 1);
jardineb5d44e2003-12-23 08:09:43 +0000766
767 return CMD_SUCCESS;
768}
769
770DEFUN (no_debug_isis_spfevents,
771 no_debug_isis_spfevents_cmd,
772 "no debug isis spf-events",
773 UNDEBUG_STR
774 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000775 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000776{
777 isis->debugs &= ~DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +0000778 print_debug (vty, DEBUG_SPF_EVENTS, 0);
779
jardineb5d44e2003-12-23 08:09:43 +0000780 return CMD_SUCCESS;
781}
782
783
784DEFUN (debug_isis_spfstats,
785 debug_isis_spfstats_cmd,
786 "debug isis spf-statistics ",
787 DEBUG_STR
788 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000789 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +0000790{
791 isis->debugs |= DEBUG_SPF_STATS;
792 print_debug (vty, DEBUG_SPF_STATS, 1);
793
794 return CMD_SUCCESS;
795}
796
797DEFUN (no_debug_isis_spfstats,
798 no_debug_isis_spfstats_cmd,
799 "no debug isis spf-statistics",
800 UNDEBUG_STR
801 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000802 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +0000803{
804 isis->debugs &= ~DEBUG_SPF_STATS;
805 print_debug (vty, DEBUG_SPF_STATS, 0);
hassof390d2c2004-09-10 20:48:21 +0000806
jardineb5d44e2003-12-23 08:09:43 +0000807 return CMD_SUCCESS;
808}
809
810DEFUN (debug_isis_spftrigg,
811 debug_isis_spftrigg_cmd,
812 "debug isis spf-triggers",
813 DEBUG_STR
814 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000815 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +0000816{
817 isis->debugs |= DEBUG_SPF_TRIGGERS;
818 print_debug (vty, DEBUG_SPF_TRIGGERS, 1);
819
820 return CMD_SUCCESS;
821}
822
823DEFUN (no_debug_isis_spftrigg,
824 no_debug_isis_spftrigg_cmd,
825 "no debug isis spf-triggers",
826 UNDEBUG_STR
827 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000828 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +0000829{
830 isis->debugs &= ~DEBUG_SPF_TRIGGERS;
831 print_debug (vty, DEBUG_SPF_TRIGGERS, 0);
hassof390d2c2004-09-10 20:48:21 +0000832
jardineb5d44e2003-12-23 08:09:43 +0000833 return CMD_SUCCESS;
834}
835
836DEFUN (debug_isis_rtevents,
837 debug_isis_rtevents_cmd,
838 "debug isis route-events",
839 DEBUG_STR
840 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000841 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +0000842{
843 isis->debugs |= DEBUG_RTE_EVENTS;
844 print_debug (vty, DEBUG_RTE_EVENTS, 1);
845
846 return CMD_SUCCESS;
847}
848
849DEFUN (no_debug_isis_rtevents,
850 no_debug_isis_rtevents_cmd,
851 "no debug isis route-events",
852 UNDEBUG_STR
853 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000854 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +0000855{
856 isis->debugs &= ~DEBUG_RTE_EVENTS;
857 print_debug (vty, DEBUG_RTE_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +0000858
jardineb5d44e2003-12-23 08:09:43 +0000859 return CMD_SUCCESS;
860}
861
862DEFUN (debug_isis_events,
863 debug_isis_events_cmd,
864 "debug isis events",
865 DEBUG_STR
866 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000867 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000868{
869 isis->debugs |= DEBUG_EVENTS;
870 print_debug (vty, DEBUG_EVENTS, 1);
871
872 return CMD_SUCCESS;
873}
874
875DEFUN (no_debug_isis_events,
876 no_debug_isis_events_cmd,
877 "no debug isis events",
878 UNDEBUG_STR
879 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000880 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000881{
882 isis->debugs &= ~DEBUG_EVENTS;
883 print_debug (vty, DEBUG_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +0000884
jardineb5d44e2003-12-23 08:09:43 +0000885 return CMD_SUCCESS;
886}
887
jardineb5d44e2003-12-23 08:09:43 +0000888DEFUN (show_hostname,
889 show_hostname_cmd,
890 "show isis hostname",
891 SHOW_STR
892 "IS-IS information\n"
893 "IS-IS Dynamic hostname mapping\n")
894{
895 dynhn_print_all (vty);
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_database,
901 show_database_cmd,
902 "show isis database",
hassof390d2c2004-09-10 20:48:21 +0000903 SHOW_STR "IS-IS information\n" "IS-IS link state database\n")
jardineb5d44e2003-12-23 08:09:43 +0000904{
905 struct listnode *node;
906 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000907 int level, lsp_count;
jardineb5d44e2003-12-23 08:09:43 +0000908
909 if (isis->area_list->count == 0)
910 return CMD_SUCCESS;
jardineb5d44e2003-12-23 08:09:43 +0000911
hassof390d2c2004-09-10 20:48:21 +0000912 for (node = listhead (isis->area_list); node; nextnode (node))
913 {
914 area = getdata (node);
915 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
916 VTY_NEWLINE);
917 for (level = 0; level < ISIS_LEVELS; level++)
918 {
919 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
920 {
921 vty_out (vty, "IS-IS Level-%d link-state database:%s",
922 level + 1, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000923
hassof390d2c2004-09-10 20:48:21 +0000924 lsp_count = lsp_print_all (vty, area->lspdb[level],
925 ISIS_UI_LEVEL_BRIEF,
926 area->dynhostname);
927
928 vty_out (vty, "%s %u LSPs%s%s",
929 VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE);
930 }
931 }
jardineb5d44e2003-12-23 08:09:43 +0000932 }
jardineb5d44e2003-12-23 08:09:43 +0000933
934 return CMD_SUCCESS;
935}
936
jardineb5d44e2003-12-23 08:09:43 +0000937DEFUN (show_database_detail,
938 show_database_detail_cmd,
939 "show isis database detail",
940 SHOW_STR
941 "IS-IS information\n"
942 "IS-IS link state database\n")
943{
944 struct listnode *node;
945 struct isis_area *area;
946 int level, lsp_count;
947
948 if (isis->area_list->count == 0)
949 return CMD_SUCCESS;
950
hassof390d2c2004-09-10 20:48:21 +0000951 for (node = listhead (isis->area_list); node; nextnode (node))
952 {
953 area = getdata (node);
954 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
955 VTY_NEWLINE);
956 for (level = 0; level < ISIS_LEVELS; level++)
957 {
958 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
959 {
960 vty_out (vty, "IS-IS Level-%d Link State Database:%s",
961 level + 1, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000962
hassof390d2c2004-09-10 20:48:21 +0000963 lsp_count = lsp_print_all (vty, area->lspdb[level],
964 ISIS_UI_LEVEL_DETAIL,
965 area->dynhostname);
jardineb5d44e2003-12-23 08:09:43 +0000966
hassof390d2c2004-09-10 20:48:21 +0000967 vty_out (vty, "%s %u LSPs%s%s",
968 VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE);
969 }
970 }
jardineb5d44e2003-12-23 08:09:43 +0000971 }
jardineb5d44e2003-12-23 08:09:43 +0000972
973 return CMD_SUCCESS;
974}
975
976/*
977 * 'router isis' command
978 */
979DEFUN (router_isis,
980 router_isis_cmd,
981 "router isis WORD",
hassof390d2c2004-09-10 20:48:21 +0000982 ROUTER_STR
jardineb5d44e2003-12-23 08:09:43 +0000983 "ISO IS-IS\n"
984 "ISO Routing area tag")
985{
jardineb5d44e2003-12-23 08:09:43 +0000986 return isis_area_get (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +0000987}
988
989/*
990 *'no router isis' command
991 */
992DEFUN (no_router_isis,
993 no_router_isis_cmd,
994 "no router isis WORD",
hassof390d2c2004-09-10 20:48:21 +0000995 "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag")
jardineb5d44e2003-12-23 08:09:43 +0000996{
997 return isis_area_destroy (vty, argv[0]);
998}
999
1000/*
1001 * 'net' command
1002 */
1003DEFUN (net,
1004 net_cmd,
1005 "net WORD",
1006 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001007 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001008{
1009 return area_net_title (vty, argv[0]);
1010}
1011
jardineb5d44e2003-12-23 08:09:43 +00001012/*
1013 * 'no net' command
1014 */
1015DEFUN (no_net,
1016 no_net_cmd,
1017 "no net WORD",
1018 NO_STR
1019 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001020 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001021{
1022 return area_clear_net_title (vty, argv[0]);
1023}
1024
1025DEFUN (area_passwd,
1026 area_passwd_cmd,
1027 "area-password WORD",
1028 "Configure the authentication password for an area\n"
hassof390d2c2004-09-10 20:48:21 +00001029 "Area password\n")
jardineb5d44e2003-12-23 08:09:43 +00001030{
1031 struct isis_area *area;
1032 int len;
1033
1034 area = vty->index;
1035
hassof390d2c2004-09-10 20:48:21 +00001036 if (!area)
1037 {
1038 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1039 return CMD_WARNING;
1040 }
1041
jardineb5d44e2003-12-23 08:09:43 +00001042 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001043 if (len > 254)
1044 {
1045 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1046 return CMD_WARNING;
1047 }
1048 area->area_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001049 area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
1050 strncpy (area->area_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001051
jardineb5d44e2003-12-23 08:09:43 +00001052 return CMD_SUCCESS;
1053}
1054
1055DEFUN (no_area_passwd,
1056 no_area_passwd_cmd,
1057 "no area-password",
1058 NO_STR
1059 "Configure the authentication password for an area\n")
1060{
1061 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001062
jardineb5d44e2003-12-23 08:09:43 +00001063 area = vty->index;
1064
hassof390d2c2004-09-10 20:48:21 +00001065 if (!area)
1066 {
1067 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1068 return CMD_WARNING;
1069 }
1070
jardineb5d44e2003-12-23 08:09:43 +00001071 memset (&area->area_passwd, 0, sizeof (struct isis_passwd));
1072
1073 return CMD_SUCCESS;
1074}
1075
jardineb5d44e2003-12-23 08:09:43 +00001076DEFUN (domain_passwd,
1077 domain_passwd_cmd,
1078 "domain-password WORD",
1079 "Set the authentication password for a routing domain\n"
hassof390d2c2004-09-10 20:48:21 +00001080 "Routing domain password\n")
jardineb5d44e2003-12-23 08:09:43 +00001081{
1082 struct isis_area *area;
1083 int len;
1084
1085 area = vty->index;
1086
hassof390d2c2004-09-10 20:48:21 +00001087 if (!area)
1088 {
1089 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1090 return CMD_WARNING;
1091 }
1092
jardineb5d44e2003-12-23 08:09:43 +00001093 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001094 if (len > 254)
1095 {
1096 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1097 return CMD_WARNING;
1098 }
1099 area->domain_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001100 area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
1101 strncpy (area->domain_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001102
jardineb5d44e2003-12-23 08:09:43 +00001103 return CMD_SUCCESS;
1104}
1105
jardineb5d44e2003-12-23 08:09:43 +00001106DEFUN (no_domain_passwd,
1107 no_domain_passwd_cmd,
1108 "no domain-password WORD",
1109 NO_STR
1110 "Set the authentication password for a routing domain\n")
1111{
1112 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001113
jardineb5d44e2003-12-23 08:09:43 +00001114 area = vty->index;
1115
hassof390d2c2004-09-10 20:48:21 +00001116 if (!area)
1117 {
1118 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1119 return CMD_WARNING;
1120 }
1121
jardineb5d44e2003-12-23 08:09:43 +00001122 memset (&area->domain_passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001123
jardineb5d44e2003-12-23 08:09:43 +00001124 return CMD_SUCCESS;
1125}
1126
1127DEFUN (is_type,
1128 is_type_cmd,
1129 "is-type (level-1|level-1-2|level-2-only)",
1130 "IS Level for this routing process (OSI only)\n"
1131 "Act as a station router only\n"
1132 "Act as both a station router and an area router\n"
1133 "Act as an area router only\n")
1134{
1135 struct isis_area *area;
1136 int type;
1137
1138 area = vty->index;
1139
hassof390d2c2004-09-10 20:48:21 +00001140 if (!area)
1141 {
1142 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1143 return CMD_WARNING;
1144 }
jardineb5d44e2003-12-23 08:09:43 +00001145
hassof390d2c2004-09-10 20:48:21 +00001146 type = string2circuit_t (argv[0]);
1147 if (!type)
1148 {
1149 vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
1150 return CMD_SUCCESS;
1151 }
jardineb5d44e2003-12-23 08:09:43 +00001152
1153 isis_event_system_type_change (area, type);
hassof390d2c2004-09-10 20:48:21 +00001154
jardineb5d44e2003-12-23 08:09:43 +00001155 return CMD_SUCCESS;
1156}
1157
1158DEFUN (no_is_type,
1159 no_is_type_cmd,
1160 "no is-type (level-1|level-1-2|level-2-only)",
1161 NO_STR
1162 "IS Level for this routing process (OSI only)\n"
1163 "Act as a station router only\n"
1164 "Act as both a station router and an area router\n"
1165 "Act as an area router only\n")
1166{
jardineb5d44e2003-12-23 08:09:43 +00001167 struct isis_area *area;
1168 int type;
1169
1170 area = vty->index;
1171 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001172
jardineb5d44e2003-12-23 08:09:43 +00001173 /*
1174 * Put the is-type back to default. Which is level-1-2 on first
1175 * circuit for the area level-1 for the rest
1176 */
hassof390d2c2004-09-10 20:48:21 +00001177 if (getdata (listhead (isis->area_list)) == area)
jardineb5d44e2003-12-23 08:09:43 +00001178 type = IS_LEVEL_1_AND_2;
1179 else
1180 type = IS_LEVEL_1;
1181
1182 isis_event_system_type_change (area, type);
1183
1184 return CMD_SUCCESS;
1185}
1186
1187DEFUN (lsp_gen_interval,
1188 lsp_gen_interval_cmd,
1189 "lsp-gen-interval <1-120>",
1190 "Minimum interval between regenerating same LSP\n"
1191 "Minimum interval in seconds\n")
1192{
1193 struct isis_area *area;
1194 uint16_t interval;
1195
1196 area = vty->index;
1197 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001198
jardineb5d44e2003-12-23 08:09:43 +00001199 interval = atoi (argv[0]);
1200 area->lsp_gen_interval[0] = interval;
1201 area->lsp_gen_interval[1] = interval;
1202
1203 return CMD_SUCCESS;
1204}
1205
1206DEFUN (no_lsp_gen_interval,
1207 no_lsp_gen_interval_cmd,
1208 "no lsp-gen-interval",
1209 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001210 "Minimum interval between regenerating same LSP\n")
jardineb5d44e2003-12-23 08:09:43 +00001211{
1212 struct isis_area *area;
1213
1214 area = vty->index;
1215 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001216
jardineb5d44e2003-12-23 08:09:43 +00001217 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
1218 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
1219
1220 return CMD_SUCCESS;
1221}
1222
1223ALIAS (no_lsp_gen_interval,
1224 no_lsp_gen_interval_arg_cmd,
1225 "no lsp-gen-interval <1-120>",
1226 NO_STR
1227 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001228 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001229
1230DEFUN (lsp_gen_interval_l1,
1231 lsp_gen_interval_l1_cmd,
1232 "lsp-gen-interval level-1 <1-120>",
1233 "Minimum interval between regenerating same LSP\n"
1234 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001235 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001236{
1237 struct isis_area *area;
1238 uint16_t interval;
1239
1240 area = vty->index;
1241 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001242
jardineb5d44e2003-12-23 08:09:43 +00001243 interval = atoi (argv[0]);
1244 area->lsp_gen_interval[0] = interval;
1245
1246 return CMD_SUCCESS;
1247}
1248
1249DEFUN (no_lsp_gen_interval_l1,
1250 no_lsp_gen_interval_l1_cmd,
1251 "no lsp-gen-interval level-1",
1252 NO_STR
1253 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001254 "Set interval for level 1 only\n")
jardineb5d44e2003-12-23 08:09:43 +00001255{
1256 struct isis_area *area;
1257
1258 area = vty->index;
1259 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001260
jardineb5d44e2003-12-23 08:09:43 +00001261 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
1262
1263 return CMD_SUCCESS;
1264}
1265
1266ALIAS (no_lsp_gen_interval_l1,
1267 no_lsp_gen_interval_l1_arg_cmd,
1268 "no lsp-gen-interval level-1 <1-120>",
1269 NO_STR
1270 "Minimum interval between regenerating same LSP\n"
1271 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001272 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001273
1274DEFUN (lsp_gen_interval_l2,
1275 lsp_gen_interval_l2_cmd,
1276 "lsp-gen-interval level-2 <1-120>",
1277 "Minimum interval between regenerating same LSP\n"
1278 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001279 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001280{
1281 struct isis_area *area;
1282 int interval;
1283
1284 area = vty->index;
1285 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001286
jardineb5d44e2003-12-23 08:09:43 +00001287 interval = atoi (argv[0]);
1288 area->lsp_gen_interval[1] = interval;
1289
1290 return CMD_SUCCESS;
1291}
1292
1293DEFUN (no_lsp_gen_interval_l2,
1294 no_lsp_gen_interval_l2_cmd,
1295 "no lsp-gen-interval level-2",
1296 NO_STR
1297 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001298 "Set interval for level 2 only\n")
jardineb5d44e2003-12-23 08:09:43 +00001299{
1300 struct isis_area *area;
1301 int interval;
1302
1303 area = vty->index;
1304 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001305
jardineb5d44e2003-12-23 08:09:43 +00001306 interval = atoi (argv[0]);
1307 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
1308
1309 return CMD_SUCCESS;
1310}
1311
1312ALIAS (no_lsp_gen_interval_l2,
1313 no_lsp_gen_interval_l2_arg_cmd,
1314 "no lsp-gen-interval level-2 <1-120>",
1315 NO_STR
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
1320DEFUN (metric_style,
1321 metric_style_cmd,
1322 "metric-style (narrow|wide)",
1323 "Use old-style (ISO 10589) or new-style packet formats\n"
1324 "Use old style of TLVs with narrow metric\n"
1325 "Use new style of TLVs to carry wider metric\n")
1326{
1327 struct isis_area *area;
1328
1329 area = vty->index;
1330 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001331 if (!strcmp (argv[0], "wide"))
jardineb5d44e2003-12-23 08:09:43 +00001332 area->newmetric = 1;
1333 else
1334 area->newmetric = 0;
1335
1336 return CMD_SUCCESS;
1337}
1338
1339DEFUN (no_metric_style,
1340 no_metric_style_cmd,
1341 "no metric-style (narrow|wide)",
1342 NO_STR
1343 "Use old-style (ISO 10589) or new-style packet formats\n"
1344 "Use old style of TLVs with narrow metric\n"
1345 "Use new style of TLVs to carry wider metric\n")
1346{
1347 struct isis_area *area;
1348
1349 area = vty->index;
1350 assert (area);
1351
hassof390d2c2004-09-10 20:48:21 +00001352 if (!strcmp (argv[0], "wide"))
jardineb5d44e2003-12-23 08:09:43 +00001353 area->newmetric = 0;
1354 else
1355 area->newmetric = 1;
1356
1357 return CMD_SUCCESS;
1358}
1359
1360DEFUN (dynamic_hostname,
1361 dynamic_hostname_cmd,
1362 "hostname dynamic",
1363 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00001364 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00001365{
1366 struct isis_area *area;
1367
1368 area = vty->index;
1369 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001370
jardineb5d44e2003-12-23 08:09:43 +00001371 area->dynhostname = 1;
hassof390d2c2004-09-10 20:48:21 +00001372
jardineb5d44e2003-12-23 08:09:43 +00001373 return CMD_SUCCESS;
1374}
1375
1376DEFUN (no_dynamic_hostname,
1377 no_dynamic_hostname_cmd,
1378 "no hostname dynamic",
1379 NO_STR
1380 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00001381 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00001382{
1383 struct isis_area *area;
1384
1385 area = vty->index;
1386 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001387
jardineb5d44e2003-12-23 08:09:43 +00001388 area->dynhostname = 0;
hassof390d2c2004-09-10 20:48:21 +00001389
jardineb5d44e2003-12-23 08:09:43 +00001390 return CMD_SUCCESS;
1391}
1392
1393DEFUN (spf_interval,
1394 spf_interval_cmd,
1395 "spf-interval <1-120>",
hasso2097cd82003-12-23 11:51:08 +00001396 "Minimum interval between SPF calculations\n"
jardineb5d44e2003-12-23 08:09:43 +00001397 "Minimum interval between consecutive SPFs in seconds\n")
1398{
1399 struct isis_area *area;
1400 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001401
jardineb5d44e2003-12-23 08:09:43 +00001402 area = vty->index;
1403 interval = atoi (argv[0]);
1404 area->min_spf_interval[0] = interval;
1405 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001406
jardineb5d44e2003-12-23 08:09:43 +00001407 return CMD_SUCCESS;
1408}
1409
1410DEFUN (no_spf_interval,
1411 no_spf_interval_cmd,
1412 "no spf-interval",
1413 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001414 "Minimum interval between SPF calculations\n")
jardineb5d44e2003-12-23 08:09:43 +00001415{
1416 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001417
jardineb5d44e2003-12-23 08:09:43 +00001418 area = vty->index;
1419
1420 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
1421 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001422
jardineb5d44e2003-12-23 08:09:43 +00001423 return CMD_SUCCESS;
1424}
1425
1426ALIAS (no_spf_interval,
1427 no_spf_interval_arg_cmd,
1428 "no spf-interval <1-120>",
1429 NO_STR
1430 "Minimum interval between SPF calculations\n"
hassof390d2c2004-09-10 20:48:21 +00001431 "Minimum interval between consecutive SPFs in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001432
1433DEFUN (spf_interval_l1,
1434 spf_interval_l1_cmd,
1435 "spf-interval level-1 <1-120>",
1436 "Minimum interval between SPF calculations\n"
1437 "Set interval for level 1 only\n"
1438 "Minimum interval between consecutive SPFs in seconds\n")
1439{
1440 struct isis_area *area;
1441 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001442
jardineb5d44e2003-12-23 08:09:43 +00001443 area = vty->index;
1444 interval = atoi (argv[0]);
1445 area->min_spf_interval[0] = interval;
hassof390d2c2004-09-10 20:48:21 +00001446
jardineb5d44e2003-12-23 08:09:43 +00001447 return CMD_SUCCESS;
1448}
1449
1450DEFUN (no_spf_interval_l1,
1451 no_spf_interval_l1_cmd,
1452 "no spf-interval level-1",
1453 NO_STR
1454 "Minimum interval between SPF calculations\n"
1455 "Set interval for level 1 only\n")
1456{
1457 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001458
jardineb5d44e2003-12-23 08:09:43 +00001459 area = vty->index;
1460
1461 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001462
jardineb5d44e2003-12-23 08:09:43 +00001463 return CMD_SUCCESS;
1464}
1465
1466ALIAS (no_spf_interval,
1467 no_spf_interval_l1_arg_cmd,
1468 "no spf-interval level-1 <1-120>",
1469 NO_STR
1470 "Minimum interval between SPF calculations\n"
1471 "Set interval for level 1 only\n"
1472 "Minimum interval between consecutive SPFs in seconds\n")
1473
1474DEFUN (spf_interval_l2,
1475 spf_interval_l2_cmd,
1476 "spf-interval level-2 <1-120>",
1477 "Minimum interval between SPF calculations\n"
1478 "Set interval for level 2 only\n"
1479 "Minimum interval between consecutive SPFs in seconds\n")
1480{
1481 struct isis_area *area;
1482 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001483
jardineb5d44e2003-12-23 08:09:43 +00001484 area = vty->index;
1485 interval = atoi (argv[0]);
1486 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001487
jardineb5d44e2003-12-23 08:09:43 +00001488 return CMD_SUCCESS;
1489}
1490
1491DEFUN (no_spf_interval_l2,
1492 no_spf_interval_l2_cmd,
1493 "no spf-interval level-2",
1494 NO_STR
1495 "Minimum interval between SPF calculations\n"
1496 "Set interval for level 2 only\n")
1497{
1498 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001499
jardineb5d44e2003-12-23 08:09:43 +00001500 area = vty->index;
1501
1502 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001503
jardineb5d44e2003-12-23 08:09:43 +00001504 return CMD_SUCCESS;
1505}
1506
1507ALIAS (no_spf_interval,
1508 no_spf_interval_l2_arg_cmd,
1509 "no spf-interval level-2 <1-120>",
1510 NO_STR
1511 "Minimum interval between SPF calculations\n"
1512 "Set interval for level 2 only\n"
1513 "Minimum interval between consecutive SPFs in seconds\n")
1514
jardineb5d44e2003-12-23 08:09:43 +00001515#ifdef TOPOLOGY_GENERATE
1516DEFUN (topology_generate_grid,
1517 topology_generate_grid_cmd,
1518 "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "
1519 "[param]",
1520 "Topology for IS-IS\n"
1521 "Topology for IS-IS\n"
1522 "Topology grid for IS-IS\n"
1523 "X parameter of the grid\n"
1524 "Y parameter of the grid\n"
1525 "Random seed\n"
1526 "Optional param 1\n"
1527 "Optional param 2\n"
1528 "Optional param 3\n"
1529 "Topology\n")
1530{
1531 struct isis_area *area;
1532
1533 area = vty->index;
1534 assert (area);
1535
hassof390d2c2004-09-10 20:48:21 +00001536 if (!spgrid_check_params (vty, argc, argv))
1537 {
1538 if (area->topology)
1539 list_delete (area->topology);
1540 area->topology = list_new ();
1541 memcpy (area->top_params, vty->buf, 200);
1542 gen_spgrid_topology (vty, area->topology);
1543 remove_topology_lsps (area);
1544 generate_topology_lsps (area);
1545 }
jardineb5d44e2003-12-23 08:09:43 +00001546
1547 return CMD_SUCCESS;
1548}
1549
1550DEFUN (show_isis_topology,
1551 show_isis_topology_cmd,
1552 "show isis topology",
1553 SHOW_STR
1554 "clns network information\n"
1555 "CLNS neighbor adjacencies\n")
1556{
1557 struct isis_area *area;
1558 struct listnode *node;
1559 struct listnode *node2;
1560 struct arc *arc;
hassof390d2c2004-09-10 20:48:21 +00001561 LIST_LOOP (isis->area_list, area, node)
1562 {
1563 if (area->topology)
1564 {
1565 vty_out (vty, "Topology for isis area:%s%s", area->area_tag,
1566 VTY_NEWLINE);
1567 LIST_LOOP (area->topology, arc, node2)
1568 {
1569 vty_out (vty, "a %ld %ld %ld%s", arc->from_node, arc->to_node,
1570 arc->distance, VTY_NEWLINE);
1571 }
jardineb5d44e2003-12-23 08:09:43 +00001572 }
jardineb5d44e2003-12-23 08:09:43 +00001573 }
1574 return CMD_SUCCESS;
1575}
1576
1577/*
1578 * 'topology base-is' command
1579 */
hassof390d2c2004-09-10 20:48:21 +00001580DEFUN (topology_baseis,
jardineb5d44e2003-12-23 08:09:43 +00001581 topology_baseis_cmd,
1582 "topology base-is WORD",
1583 "Topology for IS-IS\n"
1584 "Topology for IS-IS\n"
1585 "A Network IS Base for this topology"
hassof390d2c2004-09-10 20:48:21 +00001586 "XX.XXXX.XXXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001587{
1588 struct isis_area *area;
1589 u_char buff[ISIS_SYS_ID_LEN];
1590
1591 area = vty->index;
1592 assert (area);
1593
hassof390d2c2004-09-10 20:48:21 +00001594 if (sysid2buff (buff, argv[0]))
1595 {
1596 sysid2buff (area->topology_baseis, argv[0]);
1597 }
1598
jardineb5d44e2003-12-23 08:09:43 +00001599 return CMD_SUCCESS;
1600}
1601
1602/*
1603 * 'no net' command
1604 */
1605DEFUN (no_topology_baseis,
1606 no_topology_baseis_cmd,
1607 "no topology base-is WORD",
1608 NO_STR
1609 "A Network Entity Title for this process (OSI only)"
hassof390d2c2004-09-10 20:48:21 +00001610 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001611{
1612 struct isis_area *area;
1613
1614 area = vty->index;
1615 assert (area);
1616
hassof390d2c2004-09-10 20:48:21 +00001617 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
jardineb5d44e2003-12-23 08:09:43 +00001618 return CMD_SUCCESS;
1619}
1620
1621#endif /* TOPOLOGY_GENERATE */
1622
1623DEFUN (lsp_lifetime,
1624 lsp_lifetime_cmd,
1625 "lsp-lifetime <380-65535>",
1626 "Maximum LSP lifetime\n"
hassof390d2c2004-09-10 20:48:21 +00001627 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001628{
1629 struct isis_area *area;
1630 uint16_t interval;
1631
1632 area = vty->index;
1633 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001634
jardineb5d44e2003-12-23 08:09:43 +00001635 interval = atoi (argv[0]);
1636
hassof390d2c2004-09-10 20:48:21 +00001637 if (interval < ISIS_MIN_LSP_LIFETIME)
1638 {
1639 vty_out (vty, "LSP lifetime (%us) below %us%s",
1640 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001641
hassof390d2c2004-09-10 20:48:21 +00001642 return CMD_WARNING;
1643 }
jardineb5d44e2003-12-23 08:09:43 +00001644
1645
1646 area->max_lsp_lifetime[0] = interval;
1647 area->max_lsp_lifetime[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001648 area->lsp_refresh[0] = interval - 300;
1649 area->lsp_refresh[1] = interval - 300;
jardineb5d44e2003-12-23 08:09:43 +00001650
hassof390d2c2004-09-10 20:48:21 +00001651 if (area->t_lsp_refresh[0])
1652 {
1653 thread_cancel (area->t_lsp_refresh[0]);
1654 thread_execute (master, lsp_refresh_l1, area, 0);
1655 }
jardineb5d44e2003-12-23 08:09:43 +00001656
hassof390d2c2004-09-10 20:48:21 +00001657 if (area->t_lsp_refresh[1])
1658 {
1659 thread_cancel (area->t_lsp_refresh[1]);
1660 thread_execute (master, lsp_refresh_l2, area, 0);
1661 }
jardineb5d44e2003-12-23 08:09:43 +00001662
1663
1664 return CMD_SUCCESS;
1665}
1666
1667DEFUN (no_lsp_lifetime,
1668 no_lsp_lifetime_cmd,
1669 "no lsp-lifetime",
1670 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001671 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001672{
1673 struct isis_area *area;
1674
1675 area = vty->index;
1676 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001677
1678 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */
1679 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */
1680 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */
1681 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001682
1683 return CMD_SUCCESS;
1684}
1685
1686ALIAS (no_lsp_lifetime,
1687 no_lsp_lifetime_arg_cmd,
1688 "no lsp-lifetime <380-65535>",
1689 NO_STR
1690 "Maximum LSP lifetime\n"
hassof390d2c2004-09-10 20:48:21 +00001691 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001692
1693DEFUN (lsp_lifetime_l1,
1694 lsp_lifetime_l1_cmd,
1695 "lsp-lifetime level-1 <380-65535>",
1696 "Maximum LSP lifetime for Level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001697 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001698{
1699 struct isis_area *area;
1700 uint16_t interval;
1701
1702 area = vty->index;
1703 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001704
jardineb5d44e2003-12-23 08:09:43 +00001705 interval = atoi (argv[0]);
1706
hassof390d2c2004-09-10 20:48:21 +00001707 if (interval < ISIS_MIN_LSP_LIFETIME)
1708 {
1709 vty_out (vty, "Level-1 LSP lifetime (%us) below %us%s",
1710 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001711
hassof390d2c2004-09-10 20:48:21 +00001712 return CMD_WARNING;
1713 }
jardineb5d44e2003-12-23 08:09:43 +00001714
1715
1716 area->max_lsp_lifetime[0] = interval;
hassof390d2c2004-09-10 20:48:21 +00001717 area->lsp_refresh[0] = interval - 300;
jardineb5d44e2003-12-23 08:09:43 +00001718
1719 return CMD_SUCCESS;
1720}
1721
1722DEFUN (no_lsp_lifetime_l1,
1723 no_lsp_lifetime_l1_cmd,
1724 "no lsp-lifetime level-1",
1725 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001726 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001727{
1728 struct isis_area *area;
1729
1730 area = vty->index;
1731 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001732
1733 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */
1734 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001735
1736 return CMD_SUCCESS;
1737}
1738
1739ALIAS (no_lsp_lifetime_l1,
1740 no_lsp_lifetime_l1_arg_cmd,
1741 "no lsp-lifetime level-1 <380-65535>",
1742 NO_STR
1743 "Maximum LSP lifetime for Level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001744 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001745
1746DEFUN (lsp_lifetime_l2,
1747 lsp_lifetime_l2_cmd,
1748 "lsp-lifetime level-2 <380-65535>",
1749 "Maximum LSP lifetime for Level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001750 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001751{
1752 struct isis_area *area;
1753 uint16_t interval;
1754
1755 area = vty->index;
1756 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001757
jardineb5d44e2003-12-23 08:09:43 +00001758 interval = atoi (argv[0]);
1759
hassof390d2c2004-09-10 20:48:21 +00001760 if (interval < ISIS_MIN_LSP_LIFETIME)
1761 {
1762 vty_out (vty, "Level-2 LSP lifetime (%us) below %us%s",
1763 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001764
hassof390d2c2004-09-10 20:48:21 +00001765 return CMD_WARNING;
1766 }
jardineb5d44e2003-12-23 08:09:43 +00001767
1768 area->max_lsp_lifetime[1] = interval;
1769 area->lsp_refresh[1] = interval - 300;
1770
1771 return CMD_SUCCESS;
1772}
1773
1774DEFUN (no_lsp_lifetime_l2,
1775 no_lsp_lifetime_l2_cmd,
1776 "no lsp-lifetime level-2",
1777 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001778 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001779{
1780 struct isis_area *area;
1781
1782 area = vty->index;
1783 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001784
1785 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */
1786 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001787
1788 return CMD_SUCCESS;
1789}
1790
1791ALIAS (no_lsp_lifetime_l2,
1792 no_lsp_lifetime_l2_arg_cmd,
1793 "no lsp-lifetime level-2 <380-65535>",
1794 NO_STR
1795 "Maximum LSP lifetime for Level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001796 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001797
1798/* IS-IS configuration write function */
1799int
1800isis_config_write (struct vty *vty)
1801{
1802 int write = 0;
jardineb5d44e2003-12-23 08:09:43 +00001803
hassof390d2c2004-09-10 20:48:21 +00001804 if (isis != NULL)
1805 {
1806 struct isis_area *area;
1807 struct listnode *node;
1808 struct listnode *node2;
jardineb5d44e2003-12-23 08:09:43 +00001809
hassof390d2c2004-09-10 20:48:21 +00001810 LIST_LOOP (isis->area_list, area, node)
1811 {
1812 /* ISIS - Area name */
1813 vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE);
1814 write++;
1815 /* ISIS - Net */
1816 if (listcount (area->area_addrs) > 0)
1817 {
1818 struct area_addr *area_addr;
1819 LIST_LOOP (area->area_addrs, area_addr, node2)
1820 {
1821 vty_out (vty, " net %s%s",
1822 isonet_print (area_addr->area_addr,
1823 area_addr->addr_len + ISIS_SYS_ID_LEN +
1824 1), VTY_NEWLINE);
1825 write++;
1826 }
1827 }
1828 /* ISIS - Dynamic hostname - Defaults to true so only display if false */
1829 if (!area->dynhostname)
1830 {
1831 vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);
1832 write++;
1833 }
1834 /* ISIS - Metric-Style - when true displays wide */
1835 if (area->newmetric)
1836 {
1837 vty_out (vty, " metric-style wide%s", VTY_NEWLINE);
1838 write++;
1839 }
1840 /* ISIS - Area is-type (level-1-2 is default) */
1841 if (area->is_type == IS_LEVEL_1)
1842 {
1843 vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
1844 write++;
1845 }
1846 else
1847 {
1848 if (area->is_type == IS_LEVEL_2)
1849 {
1850 vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
1851 write++;
1852 }
1853 }
1854 /* ISIS - Lsp generation interval */
1855 if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1])
1856 {
1857 if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT)
1858 {
1859 vty_out (vty, " lsp-gen-interval %d%s",
1860 area->lsp_gen_interval[0], VTY_NEWLINE);
1861 write++;
1862 }
1863 }
1864 else
1865 {
1866 if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT)
1867 {
1868 vty_out (vty, " lsp-gen-interval level-1 %d%s",
1869 area->lsp_gen_interval[0], VTY_NEWLINE);
1870 write++;
1871 }
1872 if (area->lsp_gen_interval[1] != LSP_GEN_INTERVAL_DEFAULT)
1873 {
1874 vty_out (vty, " lsp-gen-interval level-2 %d%s",
1875 area->lsp_gen_interval[1], VTY_NEWLINE);
1876 write++;
1877 }
1878 }
1879 /* ISIS - LSP lifetime */
1880 if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1])
1881 {
1882 if (area->max_lsp_lifetime[0] != MAX_AGE)
1883 {
1884 vty_out (vty, " lsp-lifetime %u%s", area->max_lsp_lifetime[0],
1885 VTY_NEWLINE);
1886 write++;
1887 }
1888 }
1889 else
1890 {
1891 if (area->max_lsp_lifetime[0] != MAX_AGE)
1892 {
1893 vty_out (vty, " lsp-lifetime level-1 %u%s",
1894 area->max_lsp_lifetime[0], VTY_NEWLINE);
1895 write++;
1896 }
1897 if (area->max_lsp_lifetime[1] != MAX_AGE)
1898 {
1899 vty_out (vty, " lsp-lifetime level-2 %u%s",
1900 area->max_lsp_lifetime[1], VTY_NEWLINE);
1901 write++;
1902 }
1903 }
hasso53c997c2004-09-15 16:21:59 +00001904 /* Authentication passwords. */
1905 if (area->area_passwd.len > 0)
1906 {
1907 vty_out(vty, " area-password %s%s",
1908 area->area_passwd.passwd, VTY_NEWLINE);
1909 write++;
1910 }
1911 if (area->domain_passwd.len > 0)
1912 {
1913 vty_out(vty, " domain-password %s%s",
1914 area->domain_passwd.passwd, VTY_NEWLINE);
1915 write++;
1916 }
hassof390d2c2004-09-10 20:48:21 +00001917#ifdef TOPOLOGY_GENERATE
1918 /* seems we save the whole command line here */
1919 if (area->top_params)
1920 {
1921 vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE);
1922 write++;
1923 }
jardineb5d44e2003-12-23 08:09:43 +00001924
hassof390d2c2004-09-10 20:48:21 +00001925 if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,
1926 ISIS_SYS_ID_LEN))
1927 {
1928 vty_out (vty, " topology base_is %s%s",
1929 sysid_print (area->topology_baseis), VTY_NEWLINE);
1930 write++;
1931 }
1932
1933#endif /* TOPOLOGY_GENERATE */
1934 }
jardineb5d44e2003-12-23 08:09:43 +00001935 }
hassof390d2c2004-09-10 20:48:21 +00001936
jardineb5d44e2003-12-23 08:09:43 +00001937 return write;
1938}
1939
hassof390d2c2004-09-10 20:48:21 +00001940struct cmd_node isis_node = {
jardineb5d44e2003-12-23 08:09:43 +00001941 ISIS_NODE,
hasso2097cd82003-12-23 11:51:08 +00001942 "%s(config-router)# ",
jardineb5d44e2003-12-23 08:09:43 +00001943 1
1944};
1945
hassof390d2c2004-09-10 20:48:21 +00001946void
jardineb5d44e2003-12-23 08:09:43 +00001947isis_init ()
1948{
jardineb5d44e2003-12-23 08:09:43 +00001949 /* Install IS-IS top node */
1950 install_node (&isis_node, isis_config_write);
hassof390d2c2004-09-10 20:48:21 +00001951
jardineb5d44e2003-12-23 08:09:43 +00001952 install_element (VIEW_NODE, &show_clns_neighbors_cmd);
1953 install_element (VIEW_NODE, &show_isis_neighbors_cmd);
1954 install_element (VIEW_NODE, &show_clns_neighbors_detail_cmd);
1955 install_element (VIEW_NODE, &show_isis_neighbors_detail_cmd);
1956
1957 install_element (VIEW_NODE, &show_hostname_cmd);
1958 install_element (VIEW_NODE, &show_database_cmd);
1959 install_element (VIEW_NODE, &show_database_detail_cmd);
1960
1961 install_element (ENABLE_NODE, &show_clns_neighbors_cmd);
1962 install_element (ENABLE_NODE, &show_isis_neighbors_cmd);
1963 install_element (ENABLE_NODE, &show_clns_neighbors_detail_cmd);
1964 install_element (ENABLE_NODE, &show_isis_neighbors_detail_cmd);
1965
1966 install_element (ENABLE_NODE, &show_hostname_cmd);
1967 install_element (ENABLE_NODE, &show_database_cmd);
1968 install_element (ENABLE_NODE, &show_database_detail_cmd);
1969 install_element (ENABLE_NODE, &show_debugging_cmd);
1970
hassof390d2c2004-09-10 20:48:21 +00001971 install_node (&debug_node, config_write_debug);
jardin9e867fe2003-12-23 08:56:18 +00001972
jardineb5d44e2003-12-23 08:09:43 +00001973 install_element (ENABLE_NODE, &debug_isis_adj_cmd);
1974 install_element (ENABLE_NODE, &no_debug_isis_adj_cmd);
1975 install_element (ENABLE_NODE, &debug_isis_csum_cmd);
1976 install_element (ENABLE_NODE, &no_debug_isis_csum_cmd);
1977 install_element (ENABLE_NODE, &debug_isis_lupd_cmd);
1978 install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd);
1979 install_element (ENABLE_NODE, &debug_isis_err_cmd);
1980 install_element (ENABLE_NODE, &no_debug_isis_err_cmd);
1981 install_element (ENABLE_NODE, &debug_isis_snp_cmd);
1982 install_element (ENABLE_NODE, &no_debug_isis_snp_cmd);
1983 install_element (ENABLE_NODE, &debug_isis_upd_cmd);
1984 install_element (ENABLE_NODE, &no_debug_isis_upd_cmd);
1985 install_element (ENABLE_NODE, &debug_isis_spfevents_cmd);
1986 install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd);
1987 install_element (ENABLE_NODE, &debug_isis_spfstats_cmd);
1988 install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd);
1989 install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd);
1990 install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd);
1991 install_element (ENABLE_NODE, &debug_isis_rtevents_cmd);
1992 install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);
1993 install_element (ENABLE_NODE, &debug_isis_events_cmd);
1994 install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
1995
jardin9e867fe2003-12-23 08:56:18 +00001996 install_element (CONFIG_NODE, &debug_isis_adj_cmd);
1997 install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);
1998 install_element (CONFIG_NODE, &debug_isis_csum_cmd);
1999 install_element (CONFIG_NODE, &no_debug_isis_csum_cmd);
2000 install_element (CONFIG_NODE, &debug_isis_lupd_cmd);
2001 install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd);
2002 install_element (CONFIG_NODE, &debug_isis_err_cmd);
2003 install_element (CONFIG_NODE, &no_debug_isis_err_cmd);
2004 install_element (CONFIG_NODE, &debug_isis_snp_cmd);
2005 install_element (CONFIG_NODE, &no_debug_isis_snp_cmd);
2006 install_element (CONFIG_NODE, &debug_isis_upd_cmd);
2007 install_element (CONFIG_NODE, &no_debug_isis_upd_cmd);
2008 install_element (CONFIG_NODE, &debug_isis_spfevents_cmd);
2009 install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd);
2010 install_element (CONFIG_NODE, &debug_isis_spfstats_cmd);
2011 install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd);
2012 install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd);
2013 install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd);
2014 install_element (CONFIG_NODE, &debug_isis_rtevents_cmd);
2015 install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);
2016 install_element (CONFIG_NODE, &debug_isis_events_cmd);
2017 install_element (CONFIG_NODE, &no_debug_isis_events_cmd);
2018
jardineb5d44e2003-12-23 08:09:43 +00002019 install_element (CONFIG_NODE, &router_isis_cmd);
2020 install_element (CONFIG_NODE, &no_router_isis_cmd);
2021
2022 install_default (ISIS_NODE);
2023
2024 install_element (ISIS_NODE, &net_cmd);
2025 install_element (ISIS_NODE, &no_net_cmd);
2026
2027 install_element (ISIS_NODE, &is_type_cmd);
2028 install_element (ISIS_NODE, &no_is_type_cmd);
2029
2030 install_element (ISIS_NODE, &area_passwd_cmd);
2031 install_element (ISIS_NODE, &no_area_passwd_cmd);
2032
2033 install_element (ISIS_NODE, &domain_passwd_cmd);
2034 install_element (ISIS_NODE, &no_domain_passwd_cmd);
2035
2036 install_element (ISIS_NODE, &lsp_gen_interval_cmd);
2037 install_element (ISIS_NODE, &no_lsp_gen_interval_cmd);
2038 install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd);
2039 install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd);
2040 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd);
2041 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd);
2042 install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd);
2043 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd);
2044 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd);
2045
2046 install_element (ISIS_NODE, &spf_interval_cmd);
2047 install_element (ISIS_NODE, &no_spf_interval_cmd);
2048 install_element (ISIS_NODE, &no_spf_interval_arg_cmd);
2049 install_element (ISIS_NODE, &spf_interval_l1_cmd);
2050 install_element (ISIS_NODE, &no_spf_interval_l1_cmd);
2051 install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd);
2052 install_element (ISIS_NODE, &spf_interval_l2_cmd);
2053 install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
2054 install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
hassof390d2c2004-09-10 20:48:21 +00002055
jardineb5d44e2003-12-23 08:09:43 +00002056 install_element (ISIS_NODE, &lsp_lifetime_cmd);
2057 install_element (ISIS_NODE, &no_lsp_lifetime_cmd);
2058 install_element (ISIS_NODE, &no_lsp_lifetime_arg_cmd);
2059 install_element (ISIS_NODE, &lsp_lifetime_l1_cmd);
2060 install_element (ISIS_NODE, &no_lsp_lifetime_l1_cmd);
2061 install_element (ISIS_NODE, &no_lsp_lifetime_l1_arg_cmd);
2062 install_element (ISIS_NODE, &lsp_lifetime_l2_cmd);
2063 install_element (ISIS_NODE, &no_lsp_lifetime_l2_cmd);
2064 install_element (ISIS_NODE, &no_lsp_lifetime_l2_arg_cmd);
2065
2066 install_element (ISIS_NODE, &dynamic_hostname_cmd);
2067 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
2068
2069 install_element (ISIS_NODE, &metric_style_cmd);
2070 install_element (ISIS_NODE, &no_metric_style_cmd);
2071#ifdef TOPOLOGY_GENERATE
2072 install_element (ISIS_NODE, &topology_generate_grid_cmd);
2073 install_element (ISIS_NODE, &topology_baseis_cmd);
2074 install_element (ISIS_NODE, &no_topology_baseis_cmd);
2075 install_element (VIEW_NODE, &show_isis_topology_cmd);
2076 install_element (ENABLE_NODE, &show_isis_topology_cmd);
2077#endif /* TOPOLOGY_GENERATE */
2078
hassof390d2c2004-09-10 20:48:21 +00002079 isis_new (0);
jardineb5d44e2003-12-23 08:09:43 +00002080 isis_circuit_init ();
2081 isis_zebra_init ();
2082 isis_spf_cmds_init ();
2083}