blob: 48ea47afa2d314132ec333bb6c6377c0bfbded00 [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);
jardineb5d44e2003-12-23 08:09:43 +0000133 area->flags.maxindex = -1;
134 /*
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))
218 isis_circuit_del (circuit);
219
hassof390d2c2004-09-10 20:48:21 +0000220 list_delete (area->circuit_list);
221 }
jardineb5d44e2003-12-23 08:09:43 +0000222 listnode_delete (isis->area_list, area);
hassof390d2c2004-09-10 20:48:21 +0000223 THREAD_TIMER_OFF (area->t_tick);
jardineb5d44e2003-12-23 08:09:43 +0000224 if (area->t_remove_aged)
225 thread_cancel (area->t_remove_aged);
hassof390d2c2004-09-10 20:48:21 +0000226 THREAD_TIMER_OFF (area->t_lsp_refresh[0]);
227 THREAD_TIMER_OFF (area->t_lsp_refresh[1]);
jardineb5d44e2003-12-23 08:09:43 +0000228
229 XFREE (MTYPE_ISIS_AREA, area);
hassof390d2c2004-09-10 20:48:21 +0000230
jardineb5d44e2003-12-23 08:09:43 +0000231 return CMD_SUCCESS;
232}
233
hassof390d2c2004-09-10 20:48:21 +0000234int
Paul Jakma41b36e92006-12-08 01:09:50 +0000235area_net_title (struct vty *vty, const u_char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000236{
jardineb5d44e2003-12-23 08:09:43 +0000237 struct isis_area *area;
238 struct area_addr *addr;
239 struct area_addr *addrp;
hasso3fdb2dd2005-09-28 18:45:54 +0000240 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000241
242 u_char buff[255];
243 area = vty->index;
244
hassof390d2c2004-09-10 20:48:21 +0000245 if (!area)
246 {
247 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
248 return CMD_WARNING;
249 }
jardineb5d44e2003-12-23 08:09:43 +0000250
251 /* We check that we are not over the maximal number of addresses */
hassof390d2c2004-09-10 20:48:21 +0000252 if (listcount (area->area_addrs) >= isis->max_area_addrs)
253 {
254 vty_out (vty, "Maximum of area addresses (%d) already reached %s",
255 isis->max_area_addrs, VTY_NEWLINE);
256 return CMD_WARNING;
257 }
jardineb5d44e2003-12-23 08:09:43 +0000258
259 addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));
260 addr->addr_len = dotformat2buff (buff, net_title);
261 memcpy (addr->area_addr, buff, addr->addr_len);
262#ifdef EXTREME_DEBUG
hasso529d65b2004-12-24 00:14:50 +0000263 zlog_debug ("added area address %s for area %s (address length %d)",
jardineb5d44e2003-12-23 08:09:43 +0000264 net_title, area->area_tag, addr->addr_len);
265#endif /* EXTREME_DEBUG */
hassof390d2c2004-09-10 20:48:21 +0000266 if (addr->addr_len < 8 || addr->addr_len > 20)
267 {
268 zlog_warn ("area address must be at least 8..20 octets long (%d)",
269 addr->addr_len);
jardineb5d44e2003-12-23 08:09:43 +0000270 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
271 return CMD_WARNING;
272 }
273
hassof390d2c2004-09-10 20:48:21 +0000274 if (isis->sysid_set == 0)
275 {
276 /*
277 * First area address - get the SystemID for this router
278 */
279 memcpy (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN), ISIS_SYS_ID_LEN);
280 isis->sysid_set = 1;
hassoc89c05d2005-09-04 21:36:36 +0000281 if (isis->debugs & DEBUG_EVENTS)
282 zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid));
jardineb5d44e2003-12-23 08:09:43 +0000283 }
hassof390d2c2004-09-10 20:48:21 +0000284 else
285 {
286 /*
287 * Check that the SystemID portions match
288 */
289 if (memcmp (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN),
290 ISIS_SYS_ID_LEN))
291 {
292 vty_out (vty,
293 "System ID must not change when defining additional area"
294 " addresses%s", VTY_NEWLINE);
295 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
296 return CMD_WARNING;
297 }
jardineb5d44e2003-12-23 08:09:43 +0000298
hassof390d2c2004-09-10 20:48:21 +0000299 /* now we see that we don't already have this address */
hasso3fdb2dd2005-09-28 18:45:54 +0000300 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
301 {
302 if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) != (addr->addr_len))
303 continue;
304 if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
305 {
306 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
307 return CMD_SUCCESS; /* silent fail */
308 }
309 }
hassof390d2c2004-09-10 20:48:21 +0000310
311 }
jardineb5d44e2003-12-23 08:09:43 +0000312 /*
313 * Forget the systemID part of the address
314 */
315 addr->addr_len -= (ISIS_SYS_ID_LEN + 1);
316 listnode_add (area->area_addrs, addr);
317
318 /* only now we can safely generate our LSPs for this area */
hassof390d2c2004-09-10 20:48:21 +0000319 if (listcount (area->area_addrs) > 0)
320 {
321 lsp_l1_generate (area);
322 lsp_l2_generate (area);
323 }
jardineb5d44e2003-12-23 08:09:43 +0000324
325 return CMD_SUCCESS;
326}
327
328int
Paul Jakma41b36e92006-12-08 01:09:50 +0000329area_clear_net_title (struct vty *vty, const u_char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000330{
331 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000332 struct area_addr addr, *addrp = NULL;
hasso3fdb2dd2005-09-28 18:45:54 +0000333 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000334 u_char buff[255];
335
336 area = vty->index;
hassof390d2c2004-09-10 20:48:21 +0000337 if (!area)
338 {
339 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
340 return CMD_WARNING;
341 }
342
jardineb5d44e2003-12-23 08:09:43 +0000343 addr.addr_len = dotformat2buff (buff, net_title);
hassof390d2c2004-09-10 20:48:21 +0000344 if (addr.addr_len < 8 || addr.addr_len > 20)
345 {
346 vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
347 addr.addr_len, VTY_NEWLINE);
348 return CMD_WARNING;
349 }
350
351 memcpy (addr.area_addr, buff, (int) addr.addr_len);
352
hasso3fdb2dd2005-09-28 18:45:54 +0000353 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
jardineb5d44e2003-12-23 08:09:43 +0000354 if (addrp->addr_len == addr.addr_len &&
355 !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
hassof390d2c2004-09-10 20:48:21 +0000356 break;
357
358 if (!addrp)
359 {
360 vty_out (vty, "No area address %s for area %s %s", net_title,
361 area->area_tag, VTY_NEWLINE);
362 return CMD_WARNING;
363 }
364
jardineb5d44e2003-12-23 08:09:43 +0000365 listnode_delete (area->area_addrs, addrp);
hassof390d2c2004-09-10 20:48:21 +0000366
jardineb5d44e2003-12-23 08:09:43 +0000367 return CMD_SUCCESS;
368}
369
jardineb5d44e2003-12-23 08:09:43 +0000370/*
371 * 'show clns neighbors' command
372 */
373
374int
hassof390d2c2004-09-10 20:48:21 +0000375show_clns_neigh (struct vty *vty, char detail)
jardineb5d44e2003-12-23 08:09:43 +0000376{
hasso3fdb2dd2005-09-28 18:45:54 +0000377 struct listnode *anode, *cnode;
jardineb5d44e2003-12-23 08:09:43 +0000378 struct isis_area *area;
379 struct isis_circuit *circuit;
380 struct list *db;
381 int i;
382
hassof390d2c2004-09-10 20:48:21 +0000383 if (!isis)
384 {
385 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
386 return CMD_SUCCESS;
387 }
jardineb5d44e2003-12-23 08:09:43 +0000388
hasso3fdb2dd2005-09-28 18:45:54 +0000389 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
hassof390d2c2004-09-10 20:48:21 +0000390 {
hassof390d2c2004-09-10 20:48:21 +0000391 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000392
hassof390d2c2004-09-10 20:48:21 +0000393 if (detail == ISIS_UI_LEVEL_BRIEF)
394 vty_out (vty, " System Id Interface L State "
395 "Holdtime SNPA%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000396
hasso3fdb2dd2005-09-28 18:45:54 +0000397 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
hassof390d2c2004-09-10 20:48:21 +0000398 {
hassof390d2c2004-09-10 20:48:21 +0000399 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
400 {
401 for (i = 0; i < 2; i++)
402 {
403 db = circuit->u.bc.adjdb[i];
404 if (db && db->count)
405 {
406 if (detail == ISIS_UI_LEVEL_BRIEF)
407 isis_adjdb_iterate (db,
408 (void (*)
409 (struct isis_adjacency *,
410 void *)) isis_adj_print_vty,
411 vty);
412 if (detail == ISIS_UI_LEVEL_DETAIL)
413 isis_adjdb_iterate (db,
414 (void (*)
415 (struct isis_adjacency *,
416 void *))
417 isis_adj_print_vty_detail, vty);
418 if (detail == ISIS_UI_LEVEL_EXTENSIVE)
419 isis_adjdb_iterate (db,
420 (void (*)
421 (struct isis_adjacency *,
422 void *))
423 isis_adj_print_vty_extensive,
424 vty);
425 }
426 }
427 }
428 else if (circuit->circ_type == CIRCUIT_T_P2P &&
429 circuit->u.p2p.neighbor)
430 {
431 if (detail == ISIS_UI_LEVEL_BRIEF)
432 isis_adj_p2p_print_vty (circuit->u.p2p.neighbor, vty);
433 if (detail == ISIS_UI_LEVEL_DETAIL)
434 isis_adj_p2p_print_vty_detail (circuit->u.p2p.neighbor, vty);
435 if (detail == ISIS_UI_LEVEL_EXTENSIVE)
436 isis_adj_p2p_print_vty_extensive (circuit->u.p2p.neighbor,
437 vty);
438 }
439 }
jardineb5d44e2003-12-23 08:09:43 +0000440 }
hassof390d2c2004-09-10 20:48:21 +0000441
jardineb5d44e2003-12-23 08:09:43 +0000442 return CMD_SUCCESS;
443}
444
445DEFUN (show_clns_neighbors,
446 show_clns_neighbors_cmd,
447 "show clns neighbors",
448 SHOW_STR
449 "clns network information\n"
450 "CLNS neighbor adjacencies\n")
451{
hassof390d2c2004-09-10 20:48:21 +0000452 return show_clns_neigh (vty, ISIS_UI_LEVEL_BRIEF);
jardineb5d44e2003-12-23 08:09:43 +0000453}
454
455ALIAS (show_clns_neighbors,
456 show_isis_neighbors_cmd,
457 "show isis neighbors",
458 SHOW_STR
459 "IS-IS network information\n"
460 "IS-IS neighbor adjacencies\n")
461
462DEFUN (show_clns_neighbors_detail,
463 show_clns_neighbors_detail_cmd,
464 "show clns neighbors detail",
465 SHOW_STR
466 "clns network information\n"
467 "CLNS neighbor adjacencies\n"
468 "show detailed information\n")
469{
hassof390d2c2004-09-10 20:48:21 +0000470 return show_clns_neigh (vty, ISIS_UI_LEVEL_DETAIL);
jardineb5d44e2003-12-23 08:09:43 +0000471}
472
473ALIAS (show_clns_neighbors_detail,
474 show_isis_neighbors_detail_cmd,
475 "show isis neighbors detail",
476 SHOW_STR
477 "IS-IS network information\n"
478 "IS-IS neighbor adjacencies\n"
479 "show detailed information\n")
jardineb5d44e2003-12-23 08:09:43 +0000480/*
481 * 'isis debug', 'show debugging'
482 */
jardineb5d44e2003-12-23 08:09:43 +0000483void
484print_debug (struct vty *vty, int flags, int onoff)
485{
486 char onoffs[4];
487 if (onoff)
hassof390d2c2004-09-10 20:48:21 +0000488 strcpy (onoffs, "on");
jardineb5d44e2003-12-23 08:09:43 +0000489 else
hassof390d2c2004-09-10 20:48:21 +0000490 strcpy (onoffs, "off");
jardineb5d44e2003-12-23 08:09:43 +0000491
492 if (flags & DEBUG_ADJ_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000493 vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs,
494 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000495 if (flags & DEBUG_CHECKSUM_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000496 vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs,
497 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000498 if (flags & DEBUG_LOCAL_UPDATES)
hassof390d2c2004-09-10 20:48:21 +0000499 vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs,
500 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000501 if (flags & DEBUG_PROTOCOL_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000502 vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs,
503 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000504 if (flags & DEBUG_SNP_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000505 vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs,
506 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000507 if (flags & DEBUG_SPF_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000508 vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000509 if (flags & DEBUG_SPF_STATS)
hassof390d2c2004-09-10 20:48:21 +0000510 vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s",
511 onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000512 if (flags & DEBUG_SPF_TRIGGERS)
hassof390d2c2004-09-10 20:48:21 +0000513 vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs,
514 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000515 if (flags & DEBUG_UPDATE_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000516 vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs,
517 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000518 if (flags & DEBUG_RTE_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000519 vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs,
520 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000521 if (flags & DEBUG_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000522 vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000523
524}
525
526DEFUN (show_debugging,
527 show_debugging_cmd,
528 "show debugging",
529 SHOW_STR
530 "State of each debugging option\n")
531{
hassof390d2c2004-09-10 20:48:21 +0000532 vty_out (vty, "IS-IS:%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000533 print_debug (vty, isis->debugs, 1);
534 return CMD_SUCCESS;
535}
536
jardin9e867fe2003-12-23 08:56:18 +0000537/* Debug node. */
hassof390d2c2004-09-10 20:48:21 +0000538static struct cmd_node debug_node = {
jardin9e867fe2003-12-23 08:56:18 +0000539 DEBUG_NODE,
hassof390d2c2004-09-10 20:48:21 +0000540 "",
541 1
jardin9e867fe2003-12-23 08:56:18 +0000542};
543
544static int
545config_write_debug (struct vty *vty)
546{
547 int write = 0;
548 int flags = isis->debugs;
549
hassof390d2c2004-09-10 20:48:21 +0000550 if (flags & DEBUG_ADJ_PACKETS)
551 {
552 vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE);
553 write++;
554 }
555 if (flags & DEBUG_CHECKSUM_ERRORS)
556 {
557 vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE);
558 write++;
559 }
560 if (flags & DEBUG_LOCAL_UPDATES)
561 {
562 vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE);
563 write++;
564 }
565 if (flags & DEBUG_PROTOCOL_ERRORS)
566 {
567 vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE);
568 write++;
569 }
570 if (flags & DEBUG_SNP_PACKETS)
571 {
572 vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE);
573 write++;
574 }
575 if (flags & DEBUG_SPF_EVENTS)
576 {
577 vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE);
578 write++;
579 }
580 if (flags & DEBUG_SPF_STATS)
581 {
582 vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE);
583 write++;
584 }
585 if (flags & DEBUG_SPF_TRIGGERS)
586 {
587 vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE);
588 write++;
589 }
590 if (flags & DEBUG_UPDATE_PACKETS)
591 {
592 vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE);
593 write++;
594 }
595 if (flags & DEBUG_RTE_EVENTS)
596 {
597 vty_out (vty, "debug isis route-events%s", VTY_NEWLINE);
598 write++;
599 }
600 if (flags & DEBUG_EVENTS)
601 {
602 vty_out (vty, "debug isis events%s", VTY_NEWLINE);
603 write++;
604 }
jardin9e867fe2003-12-23 08:56:18 +0000605
606 return write;
607}
608
jardineb5d44e2003-12-23 08:09:43 +0000609DEFUN (debug_isis_adj,
610 debug_isis_adj_cmd,
611 "debug isis adj-packets",
612 DEBUG_STR
613 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000614 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000615{
616 isis->debugs |= DEBUG_ADJ_PACKETS;
hassof390d2c2004-09-10 20:48:21 +0000617 print_debug (vty, DEBUG_ADJ_PACKETS, 1);
jardineb5d44e2003-12-23 08:09:43 +0000618
619 return CMD_SUCCESS;
620}
621
622DEFUN (no_debug_isis_adj,
623 no_debug_isis_adj_cmd,
624 "no debug isis adj-packets",
625 UNDEBUG_STR
626 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000627 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000628{
jardineb5d44e2003-12-23 08:09:43 +0000629 isis->debugs &= ~DEBUG_ADJ_PACKETS;
630 print_debug (vty, DEBUG_ADJ_PACKETS, 0);
631
632 return CMD_SUCCESS;
633}
634
jardineb5d44e2003-12-23 08:09:43 +0000635DEFUN (debug_isis_csum,
636 debug_isis_csum_cmd,
637 "debug isis checksum-errors",
638 DEBUG_STR
639 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000640 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000641{
642 isis->debugs |= DEBUG_CHECKSUM_ERRORS;
643 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1);
644
645 return CMD_SUCCESS;
646}
647
648DEFUN (no_debug_isis_csum,
649 no_debug_isis_csum_cmd,
650 "no debug isis checksum-errors",
651 UNDEBUG_STR
652 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000653 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000654{
655 isis->debugs &= ~DEBUG_CHECKSUM_ERRORS;
656 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000657
jardineb5d44e2003-12-23 08:09:43 +0000658 return CMD_SUCCESS;
659}
660
661DEFUN (debug_isis_lupd,
662 debug_isis_lupd_cmd,
663 "debug isis local-updates",
664 DEBUG_STR
665 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000666 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000667{
668 isis->debugs |= DEBUG_LOCAL_UPDATES;
669 print_debug (vty, DEBUG_LOCAL_UPDATES, 1);
670
671 return CMD_SUCCESS;
672}
673
674DEFUN (no_debug_isis_lupd,
675 no_debug_isis_lupd_cmd,
676 "no debug isis local-updates",
677 UNDEBUG_STR
678 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000679 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000680{
681 isis->debugs &= ~DEBUG_LOCAL_UPDATES;
hassof390d2c2004-09-10 20:48:21 +0000682 print_debug (vty, DEBUG_LOCAL_UPDATES, 0);
683
jardineb5d44e2003-12-23 08:09:43 +0000684 return CMD_SUCCESS;
685}
686
687DEFUN (debug_isis_err,
688 debug_isis_err_cmd,
hassof390d2c2004-09-10 20:48:21 +0000689 "debug isis protocol-errors",
jardineb5d44e2003-12-23 08:09:43 +0000690 DEBUG_STR
691 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000692 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000693{
694 isis->debugs |= DEBUG_PROTOCOL_ERRORS;
695 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1);
696
697 return CMD_SUCCESS;
698}
699
700DEFUN (no_debug_isis_err,
701 no_debug_isis_err_cmd,
702 "no debug isis protocol-errors",
703 UNDEBUG_STR
704 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000705 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000706{
707 isis->debugs &= ~DEBUG_PROTOCOL_ERRORS;
708 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000709
jardineb5d44e2003-12-23 08:09:43 +0000710 return CMD_SUCCESS;
711}
712
713DEFUN (debug_isis_snp,
714 debug_isis_snp_cmd,
715 "debug isis snp-packets",
716 DEBUG_STR
717 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000718 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000719{
720 isis->debugs |= DEBUG_SNP_PACKETS;
721 print_debug (vty, DEBUG_SNP_PACKETS, 1);
722
723 return CMD_SUCCESS;
724}
725
726DEFUN (no_debug_isis_snp,
727 no_debug_isis_snp_cmd,
728 "no debug isis snp-packets",
729 UNDEBUG_STR
730 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000731 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000732{
hassof390d2c2004-09-10 20:48:21 +0000733 isis->debugs &= ~DEBUG_SNP_PACKETS;
jardineb5d44e2003-12-23 08:09:43 +0000734 print_debug (vty, DEBUG_SNP_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +0000735
jardineb5d44e2003-12-23 08:09:43 +0000736 return CMD_SUCCESS;
737}
738
jardineb5d44e2003-12-23 08:09:43 +0000739DEFUN (debug_isis_upd,
740 debug_isis_upd_cmd,
741 "debug isis update-packets",
742 DEBUG_STR
743 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000744 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000745{
746 isis->debugs |= DEBUG_UPDATE_PACKETS;
747 print_debug (vty, DEBUG_UPDATE_PACKETS, 1);
748
749 return CMD_SUCCESS;
750}
751
752DEFUN (no_debug_isis_upd,
753 no_debug_isis_upd_cmd,
754 "no debug isis update-packets",
755 UNDEBUG_STR
756 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000757 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000758{
759 isis->debugs &= ~DEBUG_UPDATE_PACKETS;
760 print_debug (vty, DEBUG_UPDATE_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +0000761
jardineb5d44e2003-12-23 08:09:43 +0000762 return CMD_SUCCESS;
763}
764
jardineb5d44e2003-12-23 08:09:43 +0000765DEFUN (debug_isis_spfevents,
766 debug_isis_spfevents_cmd,
767 "debug isis spf-events",
768 DEBUG_STR
769 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000770 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000771{
772 isis->debugs |= DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +0000773 print_debug (vty, DEBUG_SPF_EVENTS, 1);
jardineb5d44e2003-12-23 08:09:43 +0000774
775 return CMD_SUCCESS;
776}
777
778DEFUN (no_debug_isis_spfevents,
779 no_debug_isis_spfevents_cmd,
780 "no debug isis spf-events",
781 UNDEBUG_STR
782 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000783 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000784{
785 isis->debugs &= ~DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +0000786 print_debug (vty, DEBUG_SPF_EVENTS, 0);
787
jardineb5d44e2003-12-23 08:09:43 +0000788 return CMD_SUCCESS;
789}
790
791
792DEFUN (debug_isis_spfstats,
793 debug_isis_spfstats_cmd,
794 "debug isis spf-statistics ",
795 DEBUG_STR
796 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000797 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +0000798{
799 isis->debugs |= DEBUG_SPF_STATS;
800 print_debug (vty, DEBUG_SPF_STATS, 1);
801
802 return CMD_SUCCESS;
803}
804
805DEFUN (no_debug_isis_spfstats,
806 no_debug_isis_spfstats_cmd,
807 "no debug isis spf-statistics",
808 UNDEBUG_STR
809 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000810 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +0000811{
812 isis->debugs &= ~DEBUG_SPF_STATS;
813 print_debug (vty, DEBUG_SPF_STATS, 0);
hassof390d2c2004-09-10 20:48:21 +0000814
jardineb5d44e2003-12-23 08:09:43 +0000815 return CMD_SUCCESS;
816}
817
818DEFUN (debug_isis_spftrigg,
819 debug_isis_spftrigg_cmd,
820 "debug isis spf-triggers",
821 DEBUG_STR
822 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000823 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +0000824{
825 isis->debugs |= DEBUG_SPF_TRIGGERS;
826 print_debug (vty, DEBUG_SPF_TRIGGERS, 1);
827
828 return CMD_SUCCESS;
829}
830
831DEFUN (no_debug_isis_spftrigg,
832 no_debug_isis_spftrigg_cmd,
833 "no debug isis spf-triggers",
834 UNDEBUG_STR
835 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000836 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +0000837{
838 isis->debugs &= ~DEBUG_SPF_TRIGGERS;
839 print_debug (vty, DEBUG_SPF_TRIGGERS, 0);
hassof390d2c2004-09-10 20:48:21 +0000840
jardineb5d44e2003-12-23 08:09:43 +0000841 return CMD_SUCCESS;
842}
843
844DEFUN (debug_isis_rtevents,
845 debug_isis_rtevents_cmd,
846 "debug isis route-events",
847 DEBUG_STR
848 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000849 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +0000850{
851 isis->debugs |= DEBUG_RTE_EVENTS;
852 print_debug (vty, DEBUG_RTE_EVENTS, 1);
853
854 return CMD_SUCCESS;
855}
856
857DEFUN (no_debug_isis_rtevents,
858 no_debug_isis_rtevents_cmd,
859 "no debug isis route-events",
860 UNDEBUG_STR
861 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000862 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +0000863{
864 isis->debugs &= ~DEBUG_RTE_EVENTS;
865 print_debug (vty, DEBUG_RTE_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +0000866
jardineb5d44e2003-12-23 08:09:43 +0000867 return CMD_SUCCESS;
868}
869
870DEFUN (debug_isis_events,
871 debug_isis_events_cmd,
872 "debug isis events",
873 DEBUG_STR
874 "IS-IS information\n"
hassof1082d12005-09-19 04:23:34 +0000875 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000876{
877 isis->debugs |= DEBUG_EVENTS;
878 print_debug (vty, DEBUG_EVENTS, 1);
879
880 return CMD_SUCCESS;
881}
882
883DEFUN (no_debug_isis_events,
884 no_debug_isis_events_cmd,
885 "no debug isis events",
886 UNDEBUG_STR
887 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000888 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000889{
890 isis->debugs &= ~DEBUG_EVENTS;
891 print_debug (vty, DEBUG_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +0000892
jardineb5d44e2003-12-23 08:09:43 +0000893 return CMD_SUCCESS;
894}
895
jardineb5d44e2003-12-23 08:09:43 +0000896DEFUN (show_hostname,
897 show_hostname_cmd,
898 "show isis hostname",
899 SHOW_STR
900 "IS-IS information\n"
901 "IS-IS Dynamic hostname mapping\n")
902{
903 dynhn_print_all (vty);
hassof390d2c2004-09-10 20:48:21 +0000904
jardineb5d44e2003-12-23 08:09:43 +0000905 return CMD_SUCCESS;
906}
907
jardineb5d44e2003-12-23 08:09:43 +0000908DEFUN (show_database,
909 show_database_cmd,
910 "show isis database",
hassof390d2c2004-09-10 20:48:21 +0000911 SHOW_STR "IS-IS information\n" "IS-IS link state database\n")
jardineb5d44e2003-12-23 08:09:43 +0000912{
hasso3fdb2dd2005-09-28 18:45:54 +0000913 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000914 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000915 int level, lsp_count;
jardineb5d44e2003-12-23 08:09:43 +0000916
917 if (isis->area_list->count == 0)
918 return CMD_SUCCESS;
jardineb5d44e2003-12-23 08:09:43 +0000919
hasso3fdb2dd2005-09-28 18:45:54 +0000920 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +0000921 {
hassof390d2c2004-09-10 20:48:21 +0000922 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
923 VTY_NEWLINE);
924 for (level = 0; level < ISIS_LEVELS; level++)
925 {
926 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
927 {
928 vty_out (vty, "IS-IS Level-%d link-state database:%s",
929 level + 1, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000930
hassof390d2c2004-09-10 20:48:21 +0000931 lsp_count = lsp_print_all (vty, area->lspdb[level],
932 ISIS_UI_LEVEL_BRIEF,
933 area->dynhostname);
934
935 vty_out (vty, "%s %u LSPs%s%s",
936 VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE);
937 }
938 }
jardineb5d44e2003-12-23 08:09:43 +0000939 }
jardineb5d44e2003-12-23 08:09:43 +0000940
941 return CMD_SUCCESS;
942}
943
jardineb5d44e2003-12-23 08:09:43 +0000944DEFUN (show_database_detail,
945 show_database_detail_cmd,
946 "show isis database detail",
947 SHOW_STR
948 "IS-IS information\n"
949 "IS-IS link state database\n")
950{
hasso3fdb2dd2005-09-28 18:45:54 +0000951 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000952 struct isis_area *area;
953 int level, lsp_count;
954
955 if (isis->area_list->count == 0)
956 return CMD_SUCCESS;
957
hasso3fdb2dd2005-09-28 18:45:54 +0000958 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +0000959 {
hassof390d2c2004-09-10 20:48:21 +0000960 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
961 VTY_NEWLINE);
962 for (level = 0; level < ISIS_LEVELS; level++)
963 {
964 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
965 {
966 vty_out (vty, "IS-IS Level-%d Link State Database:%s",
967 level + 1, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000968
hassof390d2c2004-09-10 20:48:21 +0000969 lsp_count = lsp_print_all (vty, area->lspdb[level],
970 ISIS_UI_LEVEL_DETAIL,
971 area->dynhostname);
jardineb5d44e2003-12-23 08:09:43 +0000972
hassof390d2c2004-09-10 20:48:21 +0000973 vty_out (vty, "%s %u LSPs%s%s",
974 VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE);
975 }
976 }
jardineb5d44e2003-12-23 08:09:43 +0000977 }
jardineb5d44e2003-12-23 08:09:43 +0000978
979 return CMD_SUCCESS;
980}
981
982/*
983 * 'router isis' command
984 */
985DEFUN (router_isis,
986 router_isis_cmd,
987 "router isis WORD",
hassof390d2c2004-09-10 20:48:21 +0000988 ROUTER_STR
jardineb5d44e2003-12-23 08:09:43 +0000989 "ISO IS-IS\n"
990 "ISO Routing area tag")
991{
jardineb5d44e2003-12-23 08:09:43 +0000992 return isis_area_get (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +0000993}
994
995/*
996 *'no router isis' command
997 */
998DEFUN (no_router_isis,
999 no_router_isis_cmd,
1000 "no router isis WORD",
hassof390d2c2004-09-10 20:48:21 +00001001 "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag")
jardineb5d44e2003-12-23 08:09:43 +00001002{
1003 return isis_area_destroy (vty, argv[0]);
1004}
1005
1006/*
1007 * 'net' command
1008 */
1009DEFUN (net,
1010 net_cmd,
1011 "net WORD",
1012 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001013 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001014{
Paul Jakma41b36e92006-12-08 01:09:50 +00001015 return area_net_title (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001016}
1017
jardineb5d44e2003-12-23 08:09:43 +00001018/*
1019 * 'no net' command
1020 */
1021DEFUN (no_net,
1022 no_net_cmd,
1023 "no net WORD",
1024 NO_STR
1025 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001026 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001027{
Paul Jakma41b36e92006-12-08 01:09:50 +00001028 return area_clear_net_title (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001029}
1030
1031DEFUN (area_passwd,
1032 area_passwd_cmd,
1033 "area-password WORD",
1034 "Configure the authentication password for an area\n"
hassof390d2c2004-09-10 20:48:21 +00001035 "Area password\n")
jardineb5d44e2003-12-23 08:09:43 +00001036{
1037 struct isis_area *area;
1038 int len;
1039
1040 area = vty->index;
1041
hassof390d2c2004-09-10 20:48:21 +00001042 if (!area)
1043 {
1044 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1045 return CMD_WARNING;
1046 }
1047
jardineb5d44e2003-12-23 08:09:43 +00001048 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001049 if (len > 254)
1050 {
1051 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1052 return CMD_WARNING;
1053 }
1054 area->area_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001055 area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001056 strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001057
hasso1cbc5622005-01-01 10:29:51 +00001058 if (argc > 1)
1059 {
1060 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1061 if (strncmp(argv[1], "v", 1) == 0)
1062 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1063 else
1064 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1065 }
1066 else
1067 {
1068 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1069 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1070 }
1071
jardineb5d44e2003-12-23 08:09:43 +00001072 return CMD_SUCCESS;
1073}
1074
hasso1cbc5622005-01-01 10:29:51 +00001075ALIAS (area_passwd,
1076 area_passwd_snpauth_cmd,
1077 "area-password WORD authenticate snp (send-only|validate)",
1078 "Configure the authentication password for an area\n"
1079 "Area password\n"
1080 "Authentication\n"
1081 "SNP PDUs\n"
1082 "Send but do not check PDUs on receiving\n"
1083 "Send and check PDUs on receiving\n");
1084
jardineb5d44e2003-12-23 08:09:43 +00001085DEFUN (no_area_passwd,
1086 no_area_passwd_cmd,
1087 "no area-password",
1088 NO_STR
1089 "Configure the authentication password for an area\n")
1090{
1091 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001092
jardineb5d44e2003-12-23 08:09:43 +00001093 area = vty->index;
1094
hassof390d2c2004-09-10 20:48:21 +00001095 if (!area)
1096 {
1097 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1098 return CMD_WARNING;
1099 }
1100
jardineb5d44e2003-12-23 08:09:43 +00001101 memset (&area->area_passwd, 0, sizeof (struct isis_passwd));
1102
1103 return CMD_SUCCESS;
1104}
1105
jardineb5d44e2003-12-23 08:09:43 +00001106DEFUN (domain_passwd,
1107 domain_passwd_cmd,
1108 "domain-password WORD",
1109 "Set the authentication password for a routing domain\n"
hassof390d2c2004-09-10 20:48:21 +00001110 "Routing domain password\n")
jardineb5d44e2003-12-23 08:09:43 +00001111{
1112 struct isis_area *area;
1113 int len;
1114
1115 area = vty->index;
1116
hassof390d2c2004-09-10 20:48:21 +00001117 if (!area)
1118 {
1119 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1120 return CMD_WARNING;
1121 }
1122
jardineb5d44e2003-12-23 08:09:43 +00001123 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001124 if (len > 254)
1125 {
1126 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1127 return CMD_WARNING;
1128 }
1129 area->domain_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001130 area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001131 strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001132
hasso1cbc5622005-01-01 10:29:51 +00001133 if (argc > 1)
1134 {
1135 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1136 if (strncmp(argv[1], "v", 1) == 0)
1137 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1138 else
1139 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1140 }
1141 else
1142 {
1143 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1144 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1145 }
1146
jardineb5d44e2003-12-23 08:09:43 +00001147 return CMD_SUCCESS;
1148}
1149
hasso1cbc5622005-01-01 10:29:51 +00001150ALIAS (domain_passwd,
1151 domain_passwd_snpauth_cmd,
1152 "domain-password WORD authenticate snp (send-only|validate)",
1153 "Set the authentication password for a routing domain\n"
1154 "Routing domain password\n"
1155 "Authentication\n"
1156 "SNP PDUs\n"
1157 "Send but do not check PDUs on receiving\n"
1158 "Send and check PDUs on receiving\n");
1159
jardineb5d44e2003-12-23 08:09:43 +00001160DEFUN (no_domain_passwd,
1161 no_domain_passwd_cmd,
1162 "no domain-password WORD",
1163 NO_STR
1164 "Set the authentication password for a routing domain\n")
1165{
1166 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001167
jardineb5d44e2003-12-23 08:09:43 +00001168 area = vty->index;
1169
hassof390d2c2004-09-10 20:48:21 +00001170 if (!area)
1171 {
1172 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1173 return CMD_WARNING;
1174 }
1175
jardineb5d44e2003-12-23 08:09:43 +00001176 memset (&area->domain_passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001177
jardineb5d44e2003-12-23 08:09:43 +00001178 return CMD_SUCCESS;
1179}
1180
1181DEFUN (is_type,
1182 is_type_cmd,
1183 "is-type (level-1|level-1-2|level-2-only)",
1184 "IS Level for this routing process (OSI only)\n"
1185 "Act as a station router only\n"
1186 "Act as both a station router and an area router\n"
1187 "Act as an area router only\n")
1188{
1189 struct isis_area *area;
1190 int type;
1191
1192 area = vty->index;
1193
hassof390d2c2004-09-10 20:48:21 +00001194 if (!area)
1195 {
1196 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1197 return CMD_WARNING;
1198 }
jardineb5d44e2003-12-23 08:09:43 +00001199
Paul Jakma41b36e92006-12-08 01:09:50 +00001200 type = string2circuit_t (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001201 if (!type)
1202 {
1203 vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
1204 return CMD_SUCCESS;
1205 }
jardineb5d44e2003-12-23 08:09:43 +00001206
1207 isis_event_system_type_change (area, type);
hassof390d2c2004-09-10 20:48:21 +00001208
jardineb5d44e2003-12-23 08:09:43 +00001209 return CMD_SUCCESS;
1210}
1211
1212DEFUN (no_is_type,
1213 no_is_type_cmd,
1214 "no is-type (level-1|level-1-2|level-2-only)",
1215 NO_STR
1216 "IS Level for this routing process (OSI only)\n"
1217 "Act as a station router only\n"
1218 "Act as both a station router and an area router\n"
1219 "Act as an area router only\n")
1220{
jardineb5d44e2003-12-23 08:09:43 +00001221 struct isis_area *area;
1222 int type;
1223
1224 area = vty->index;
1225 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001226
jardineb5d44e2003-12-23 08:09:43 +00001227 /*
1228 * Put the is-type back to default. Which is level-1-2 on first
1229 * circuit for the area level-1 for the rest
1230 */
paul1eb8ef22005-04-07 07:30:20 +00001231 if (listgetdata (listhead (isis->area_list)) == area)
jardineb5d44e2003-12-23 08:09:43 +00001232 type = IS_LEVEL_1_AND_2;
1233 else
1234 type = IS_LEVEL_1;
1235
1236 isis_event_system_type_change (area, type);
1237
1238 return CMD_SUCCESS;
1239}
1240
1241DEFUN (lsp_gen_interval,
1242 lsp_gen_interval_cmd,
1243 "lsp-gen-interval <1-120>",
1244 "Minimum interval between regenerating same LSP\n"
1245 "Minimum interval in seconds\n")
1246{
1247 struct isis_area *area;
1248 uint16_t interval;
1249
1250 area = vty->index;
1251 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001252
jardineb5d44e2003-12-23 08:09:43 +00001253 interval = atoi (argv[0]);
1254 area->lsp_gen_interval[0] = interval;
1255 area->lsp_gen_interval[1] = interval;
1256
1257 return CMD_SUCCESS;
1258}
1259
1260DEFUN (no_lsp_gen_interval,
1261 no_lsp_gen_interval_cmd,
1262 "no lsp-gen-interval",
1263 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001264 "Minimum interval between regenerating same LSP\n")
jardineb5d44e2003-12-23 08:09:43 +00001265{
1266 struct isis_area *area;
1267
1268 area = vty->index;
1269 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001270
jardineb5d44e2003-12-23 08:09:43 +00001271 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
1272 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
1273
1274 return CMD_SUCCESS;
1275}
1276
1277ALIAS (no_lsp_gen_interval,
1278 no_lsp_gen_interval_arg_cmd,
1279 "no lsp-gen-interval <1-120>",
1280 NO_STR
1281 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001282 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001283
1284DEFUN (lsp_gen_interval_l1,
1285 lsp_gen_interval_l1_cmd,
1286 "lsp-gen-interval level-1 <1-120>",
1287 "Minimum interval between regenerating same LSP\n"
1288 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001289 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001290{
1291 struct isis_area *area;
1292 uint16_t interval;
1293
1294 area = vty->index;
1295 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001296
jardineb5d44e2003-12-23 08:09:43 +00001297 interval = atoi (argv[0]);
1298 area->lsp_gen_interval[0] = interval;
1299
1300 return CMD_SUCCESS;
1301}
1302
1303DEFUN (no_lsp_gen_interval_l1,
1304 no_lsp_gen_interval_l1_cmd,
1305 "no lsp-gen-interval level-1",
1306 NO_STR
1307 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001308 "Set interval for level 1 only\n")
jardineb5d44e2003-12-23 08:09:43 +00001309{
1310 struct isis_area *area;
1311
1312 area = vty->index;
1313 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001314
jardineb5d44e2003-12-23 08:09:43 +00001315 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
1316
1317 return CMD_SUCCESS;
1318}
1319
1320ALIAS (no_lsp_gen_interval_l1,
1321 no_lsp_gen_interval_l1_arg_cmd,
1322 "no lsp-gen-interval level-1 <1-120>",
1323 NO_STR
1324 "Minimum interval between regenerating same LSP\n"
1325 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001326 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001327
1328DEFUN (lsp_gen_interval_l2,
1329 lsp_gen_interval_l2_cmd,
1330 "lsp-gen-interval level-2 <1-120>",
1331 "Minimum interval between regenerating same LSP\n"
1332 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001333 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001334{
1335 struct isis_area *area;
1336 int interval;
1337
1338 area = vty->index;
1339 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001340
jardineb5d44e2003-12-23 08:09:43 +00001341 interval = atoi (argv[0]);
1342 area->lsp_gen_interval[1] = interval;
1343
1344 return CMD_SUCCESS;
1345}
1346
1347DEFUN (no_lsp_gen_interval_l2,
1348 no_lsp_gen_interval_l2_cmd,
1349 "no lsp-gen-interval level-2",
1350 NO_STR
1351 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001352 "Set interval for level 2 only\n")
jardineb5d44e2003-12-23 08:09:43 +00001353{
1354 struct isis_area *area;
1355 int interval;
1356
1357 area = vty->index;
1358 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001359
jardineb5d44e2003-12-23 08:09:43 +00001360 interval = atoi (argv[0]);
1361 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
1362
1363 return CMD_SUCCESS;
1364}
1365
1366ALIAS (no_lsp_gen_interval_l2,
1367 no_lsp_gen_interval_l2_arg_cmd,
1368 "no lsp-gen-interval level-2 <1-120>",
1369 NO_STR
1370 "Minimum interval between regenerating same LSP\n"
1371 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001372 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001373
1374DEFUN (metric_style,
1375 metric_style_cmd,
hasso2984d262005-09-26 16:49:07 +00001376 "metric-style (narrow|transition|wide)",
jardineb5d44e2003-12-23 08:09:43 +00001377 "Use old-style (ISO 10589) or new-style packet formats\n"
1378 "Use old style of TLVs with narrow metric\n"
hasso2984d262005-09-26 16:49:07 +00001379 "Send and accept both styles of TLVs during transition\n"
jardineb5d44e2003-12-23 08:09:43 +00001380 "Use new style of TLVs to carry wider metric\n")
1381{
1382 struct isis_area *area;
1383
1384 area = vty->index;
1385 assert (area);
hasso2984d262005-09-26 16:49:07 +00001386
1387 if (strncmp (argv[0], "w", 1) == 0)
1388 {
1389 area->newmetric = 1;
1390 area->oldmetric = 0;
1391 }
1392 else if (strncmp (argv[0], "t", 1) == 0)
1393 {
1394 area->newmetric = 1;
1395 area->oldmetric = 1;
1396 }
1397 else if (strncmp (argv[0], "n", 1) == 0)
1398 {
1399 area->newmetric = 0;
1400 area->oldmetric = 1;
1401 }
jardineb5d44e2003-12-23 08:09:43 +00001402
1403 return CMD_SUCCESS;
1404}
1405
1406DEFUN (no_metric_style,
1407 no_metric_style_cmd,
hasso2984d262005-09-26 16:49:07 +00001408 "no metric-style",
jardineb5d44e2003-12-23 08:09:43 +00001409 NO_STR
hasso2984d262005-09-26 16:49:07 +00001410 "Use old-style (ISO 10589) or new-style packet formats\n")
jardineb5d44e2003-12-23 08:09:43 +00001411{
1412 struct isis_area *area;
1413
1414 area = vty->index;
1415 assert (area);
1416
hasso2984d262005-09-26 16:49:07 +00001417 /* Default is narrow metric. */
1418 area->newmetric = 0;
1419 area->oldmetric = 1;
jardineb5d44e2003-12-23 08:09:43 +00001420
1421 return CMD_SUCCESS;
1422}
1423
1424DEFUN (dynamic_hostname,
1425 dynamic_hostname_cmd,
1426 "hostname dynamic",
1427 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00001428 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00001429{
1430 struct isis_area *area;
1431
1432 area = vty->index;
1433 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001434
jardineb5d44e2003-12-23 08:09:43 +00001435 area->dynhostname = 1;
hassof390d2c2004-09-10 20:48:21 +00001436
jardineb5d44e2003-12-23 08:09:43 +00001437 return CMD_SUCCESS;
1438}
1439
1440DEFUN (no_dynamic_hostname,
1441 no_dynamic_hostname_cmd,
1442 "no hostname dynamic",
1443 NO_STR
1444 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00001445 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00001446{
1447 struct isis_area *area;
1448
1449 area = vty->index;
1450 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001451
jardineb5d44e2003-12-23 08:09:43 +00001452 area->dynhostname = 0;
hassof390d2c2004-09-10 20:48:21 +00001453
jardineb5d44e2003-12-23 08:09:43 +00001454 return CMD_SUCCESS;
1455}
1456
1457DEFUN (spf_interval,
1458 spf_interval_cmd,
1459 "spf-interval <1-120>",
hasso2097cd82003-12-23 11:51:08 +00001460 "Minimum interval between SPF calculations\n"
jardineb5d44e2003-12-23 08:09:43 +00001461 "Minimum interval between consecutive SPFs in seconds\n")
1462{
1463 struct isis_area *area;
1464 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001465
jardineb5d44e2003-12-23 08:09:43 +00001466 area = vty->index;
1467 interval = atoi (argv[0]);
1468 area->min_spf_interval[0] = interval;
1469 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001470
jardineb5d44e2003-12-23 08:09:43 +00001471 return CMD_SUCCESS;
1472}
1473
1474DEFUN (no_spf_interval,
1475 no_spf_interval_cmd,
1476 "no spf-interval",
1477 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001478 "Minimum interval between SPF calculations\n")
jardineb5d44e2003-12-23 08:09:43 +00001479{
1480 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001481
jardineb5d44e2003-12-23 08:09:43 +00001482 area = vty->index;
1483
1484 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
1485 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001486
jardineb5d44e2003-12-23 08:09:43 +00001487 return CMD_SUCCESS;
1488}
1489
1490ALIAS (no_spf_interval,
1491 no_spf_interval_arg_cmd,
1492 "no spf-interval <1-120>",
1493 NO_STR
1494 "Minimum interval between SPF calculations\n"
hassof390d2c2004-09-10 20:48:21 +00001495 "Minimum interval between consecutive SPFs in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001496
1497DEFUN (spf_interval_l1,
1498 spf_interval_l1_cmd,
1499 "spf-interval level-1 <1-120>",
1500 "Minimum interval between SPF calculations\n"
1501 "Set interval for level 1 only\n"
1502 "Minimum interval between consecutive SPFs in seconds\n")
1503{
1504 struct isis_area *area;
1505 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001506
jardineb5d44e2003-12-23 08:09:43 +00001507 area = vty->index;
1508 interval = atoi (argv[0]);
1509 area->min_spf_interval[0] = interval;
hassof390d2c2004-09-10 20:48:21 +00001510
jardineb5d44e2003-12-23 08:09:43 +00001511 return CMD_SUCCESS;
1512}
1513
1514DEFUN (no_spf_interval_l1,
1515 no_spf_interval_l1_cmd,
1516 "no spf-interval level-1",
1517 NO_STR
1518 "Minimum interval between SPF calculations\n"
1519 "Set interval for level 1 only\n")
1520{
1521 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001522
jardineb5d44e2003-12-23 08:09:43 +00001523 area = vty->index;
1524
1525 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001526
jardineb5d44e2003-12-23 08:09:43 +00001527 return CMD_SUCCESS;
1528}
1529
1530ALIAS (no_spf_interval,
1531 no_spf_interval_l1_arg_cmd,
1532 "no spf-interval level-1 <1-120>",
1533 NO_STR
1534 "Minimum interval between SPF calculations\n"
1535 "Set interval for level 1 only\n"
1536 "Minimum interval between consecutive SPFs in seconds\n")
1537
1538DEFUN (spf_interval_l2,
1539 spf_interval_l2_cmd,
1540 "spf-interval level-2 <1-120>",
1541 "Minimum interval between SPF calculations\n"
1542 "Set interval for level 2 only\n"
1543 "Minimum interval between consecutive SPFs in seconds\n")
1544{
1545 struct isis_area *area;
1546 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001547
jardineb5d44e2003-12-23 08:09:43 +00001548 area = vty->index;
1549 interval = atoi (argv[0]);
1550 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001551
jardineb5d44e2003-12-23 08:09:43 +00001552 return CMD_SUCCESS;
1553}
1554
1555DEFUN (no_spf_interval_l2,
1556 no_spf_interval_l2_cmd,
1557 "no spf-interval level-2",
1558 NO_STR
1559 "Minimum interval between SPF calculations\n"
1560 "Set interval for level 2 only\n")
1561{
1562 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001563
jardineb5d44e2003-12-23 08:09:43 +00001564 area = vty->index;
1565
1566 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001567
jardineb5d44e2003-12-23 08:09:43 +00001568 return CMD_SUCCESS;
1569}
1570
1571ALIAS (no_spf_interval,
1572 no_spf_interval_l2_arg_cmd,
1573 "no spf-interval level-2 <1-120>",
1574 NO_STR
1575 "Minimum interval between SPF calculations\n"
1576 "Set interval for level 2 only\n"
1577 "Minimum interval between consecutive SPFs in seconds\n")
1578
jardineb5d44e2003-12-23 08:09:43 +00001579#ifdef TOPOLOGY_GENERATE
1580DEFUN (topology_generate_grid,
1581 topology_generate_grid_cmd,
1582 "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "
1583 "[param]",
hassof1082d12005-09-19 04:23:34 +00001584 "Topology generation for IS-IS\n"
1585 "Topology generation\n"
1586 "Grid topology\n"
jardineb5d44e2003-12-23 08:09:43 +00001587 "X parameter of the grid\n"
1588 "Y parameter of the grid\n"
1589 "Random seed\n"
1590 "Optional param 1\n"
1591 "Optional param 2\n"
1592 "Optional param 3\n"
1593 "Topology\n")
1594{
1595 struct isis_area *area;
1596
1597 area = vty->index;
1598 assert (area);
1599
hassof390d2c2004-09-10 20:48:21 +00001600 if (!spgrid_check_params (vty, argc, argv))
1601 {
1602 if (area->topology)
1603 list_delete (area->topology);
1604 area->topology = list_new ();
1605 memcpy (area->top_params, vty->buf, 200);
1606 gen_spgrid_topology (vty, area->topology);
1607 remove_topology_lsps (area);
1608 generate_topology_lsps (area);
hassof1082d12005-09-19 04:23:34 +00001609 /* Regenerate L1 LSP to get two way connection to the generated
1610 * topology. */
1611 lsp_regenerate_schedule (area);
hassof390d2c2004-09-10 20:48:21 +00001612 }
jardineb5d44e2003-12-23 08:09:43 +00001613
1614 return CMD_SUCCESS;
1615}
1616
hassof695b012005-04-02 19:03:39 +00001617DEFUN (show_isis_generated_topology,
1618 show_isis_generated_topology_cmd,
hassof1082d12005-09-19 04:23:34 +00001619 "show isis generated-topologies",
jardineb5d44e2003-12-23 08:09:43 +00001620 SHOW_STR
hassof1082d12005-09-19 04:23:34 +00001621 "CLNS network information\n"
1622 "Show generated topologies\n")
jardineb5d44e2003-12-23 08:09:43 +00001623{
1624 struct isis_area *area;
paul92c9f222005-05-25 12:21:13 +00001625 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +00001626 struct listnode *node2;
1627 struct arc *arc;
hassof1082d12005-09-19 04:23:34 +00001628
paul92c9f222005-05-25 12:21:13 +00001629 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof1082d12005-09-19 04:23:34 +00001630 {
1631 if (!area->topology)
1632 continue;
1633
1634 vty_out (vty, "Topology for isis area: %s%s", area->area_tag,
1635 VTY_NEWLINE);
1636 vty_out (vty, "From node To node Distance%s", VTY_NEWLINE);
1637
1638 for (ALL_LIST_ELEMENTS_RO (area->topology, node2, arc))
1639 vty_out (vty, "%9ld %11ld %12ld%s", arc->from_node, arc->to_node,
1640 arc->distance, VTY_NEWLINE);
1641 }
jardineb5d44e2003-12-23 08:09:43 +00001642 return CMD_SUCCESS;
1643}
1644
hassof1082d12005-09-19 04:23:34 +00001645/* Base IS for topology generation. */
hassof390d2c2004-09-10 20:48:21 +00001646DEFUN (topology_baseis,
jardineb5d44e2003-12-23 08:09:43 +00001647 topology_baseis_cmd,
1648 "topology base-is WORD",
hassof1082d12005-09-19 04:23:34 +00001649 "Topology generation for IS-IS\n"
1650 "A Network IS Base for this topology\n"
1651 "XXXX.XXXX.XXXX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001652{
1653 struct isis_area *area;
1654 u_char buff[ISIS_SYS_ID_LEN];
1655
1656 area = vty->index;
1657 assert (area);
1658
hassof390d2c2004-09-10 20:48:21 +00001659 if (sysid2buff (buff, argv[0]))
hassof1082d12005-09-19 04:23:34 +00001660 sysid2buff (area->topology_baseis, argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001661
jardineb5d44e2003-12-23 08:09:43 +00001662 return CMD_SUCCESS;
1663}
1664
jardineb5d44e2003-12-23 08:09:43 +00001665DEFUN (no_topology_baseis,
1666 no_topology_baseis_cmd,
1667 "no topology base-is WORD",
1668 NO_STR
hassof1082d12005-09-19 04:23:34 +00001669 "Topology generation for IS-IS\n"
1670 "A Network IS Base for this topology\n"
1671 "XXXX.XXXX.XXXX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001672{
1673 struct isis_area *area;
1674
1675 area = vty->index;
1676 assert (area);
1677
hassof390d2c2004-09-10 20:48:21 +00001678 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
jardineb5d44e2003-12-23 08:09:43 +00001679 return CMD_SUCCESS;
1680}
1681
hassof1082d12005-09-19 04:23:34 +00001682ALIAS (no_topology_baseis,
1683 no_topology_baseis_noid_cmd,
1684 "no topology base-is",
1685 NO_STR
1686 "Topology generation for IS-IS\n"
1687 "A Network IS Base for this topology\n")
1688
1689DEFUN (topology_basedynh,
1690 topology_basedynh_cmd,
1691 "topology base-dynh WORD",
1692 "Topology generation for IS-IS\n"
1693 "Dynamic hostname base for this topology\n"
1694 "Dynamic hostname base\n")
1695{
1696 struct isis_area *area;
1697
1698 area = vty->index;
1699 assert (area);
1700
1701 /* I hope that it's enough. */
1702 area->topology_basedynh = strndup (argv[0], 16);
1703 return CMD_SUCCESS;
1704}
jardineb5d44e2003-12-23 08:09:43 +00001705#endif /* TOPOLOGY_GENERATE */
1706
1707DEFUN (lsp_lifetime,
1708 lsp_lifetime_cmd,
1709 "lsp-lifetime <380-65535>",
1710 "Maximum LSP lifetime\n"
hassof390d2c2004-09-10 20:48:21 +00001711 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001712{
1713 struct isis_area *area;
1714 uint16_t interval;
1715
1716 area = vty->index;
1717 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001718
jardineb5d44e2003-12-23 08:09:43 +00001719 interval = atoi (argv[0]);
1720
hassof390d2c2004-09-10 20:48:21 +00001721 if (interval < ISIS_MIN_LSP_LIFETIME)
1722 {
1723 vty_out (vty, "LSP lifetime (%us) below %us%s",
1724 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001725
hassof390d2c2004-09-10 20:48:21 +00001726 return CMD_WARNING;
1727 }
jardineb5d44e2003-12-23 08:09:43 +00001728
1729
1730 area->max_lsp_lifetime[0] = interval;
1731 area->max_lsp_lifetime[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001732 area->lsp_refresh[0] = interval - 300;
1733 area->lsp_refresh[1] = interval - 300;
jardineb5d44e2003-12-23 08:09:43 +00001734
hassof390d2c2004-09-10 20:48:21 +00001735 if (area->t_lsp_refresh[0])
1736 {
1737 thread_cancel (area->t_lsp_refresh[0]);
1738 thread_execute (master, lsp_refresh_l1, area, 0);
1739 }
jardineb5d44e2003-12-23 08:09:43 +00001740
hassof390d2c2004-09-10 20:48:21 +00001741 if (area->t_lsp_refresh[1])
1742 {
1743 thread_cancel (area->t_lsp_refresh[1]);
1744 thread_execute (master, lsp_refresh_l2, area, 0);
1745 }
jardineb5d44e2003-12-23 08:09:43 +00001746
1747
1748 return CMD_SUCCESS;
1749}
1750
1751DEFUN (no_lsp_lifetime,
1752 no_lsp_lifetime_cmd,
1753 "no lsp-lifetime",
1754 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001755 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001756{
1757 struct isis_area *area;
1758
1759 area = vty->index;
1760 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001761
1762 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */
1763 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */
1764 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */
1765 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001766
1767 return CMD_SUCCESS;
1768}
1769
1770ALIAS (no_lsp_lifetime,
1771 no_lsp_lifetime_arg_cmd,
1772 "no lsp-lifetime <380-65535>",
1773 NO_STR
1774 "Maximum LSP lifetime\n"
hassof390d2c2004-09-10 20:48:21 +00001775 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001776
1777DEFUN (lsp_lifetime_l1,
1778 lsp_lifetime_l1_cmd,
1779 "lsp-lifetime level-1 <380-65535>",
1780 "Maximum LSP lifetime for Level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001781 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001782{
1783 struct isis_area *area;
1784 uint16_t interval;
1785
1786 area = vty->index;
1787 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001788
jardineb5d44e2003-12-23 08:09:43 +00001789 interval = atoi (argv[0]);
1790
hassof390d2c2004-09-10 20:48:21 +00001791 if (interval < ISIS_MIN_LSP_LIFETIME)
1792 {
1793 vty_out (vty, "Level-1 LSP lifetime (%us) below %us%s",
1794 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001795
hassof390d2c2004-09-10 20:48:21 +00001796 return CMD_WARNING;
1797 }
jardineb5d44e2003-12-23 08:09:43 +00001798
1799
1800 area->max_lsp_lifetime[0] = interval;
hassof390d2c2004-09-10 20:48:21 +00001801 area->lsp_refresh[0] = interval - 300;
jardineb5d44e2003-12-23 08:09:43 +00001802
1803 return CMD_SUCCESS;
1804}
1805
1806DEFUN (no_lsp_lifetime_l1,
1807 no_lsp_lifetime_l1_cmd,
1808 "no lsp-lifetime level-1",
1809 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001810 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001811{
1812 struct isis_area *area;
1813
1814 area = vty->index;
1815 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001816
1817 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */
1818 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001819
1820 return CMD_SUCCESS;
1821}
1822
1823ALIAS (no_lsp_lifetime_l1,
1824 no_lsp_lifetime_l1_arg_cmd,
1825 "no lsp-lifetime level-1 <380-65535>",
1826 NO_STR
1827 "Maximum LSP lifetime for Level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001828 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001829
1830DEFUN (lsp_lifetime_l2,
1831 lsp_lifetime_l2_cmd,
1832 "lsp-lifetime level-2 <380-65535>",
1833 "Maximum LSP lifetime for Level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001834 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001835{
1836 struct isis_area *area;
1837 uint16_t interval;
1838
1839 area = vty->index;
1840 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001841
jardineb5d44e2003-12-23 08:09:43 +00001842 interval = atoi (argv[0]);
1843
hassof390d2c2004-09-10 20:48:21 +00001844 if (interval < ISIS_MIN_LSP_LIFETIME)
1845 {
1846 vty_out (vty, "Level-2 LSP lifetime (%us) below %us%s",
1847 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001848
hassof390d2c2004-09-10 20:48:21 +00001849 return CMD_WARNING;
1850 }
jardineb5d44e2003-12-23 08:09:43 +00001851
1852 area->max_lsp_lifetime[1] = interval;
1853 area->lsp_refresh[1] = interval - 300;
1854
1855 return CMD_SUCCESS;
1856}
1857
1858DEFUN (no_lsp_lifetime_l2,
1859 no_lsp_lifetime_l2_cmd,
1860 "no lsp-lifetime level-2",
1861 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001862 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001863{
1864 struct isis_area *area;
1865
1866 area = vty->index;
1867 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001868
1869 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */
1870 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001871
1872 return CMD_SUCCESS;
1873}
1874
1875ALIAS (no_lsp_lifetime_l2,
1876 no_lsp_lifetime_l2_arg_cmd,
1877 "no lsp-lifetime level-2 <380-65535>",
1878 NO_STR
1879 "Maximum LSP lifetime for Level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001880 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001881
1882/* IS-IS configuration write function */
1883int
1884isis_config_write (struct vty *vty)
1885{
1886 int write = 0;
jardineb5d44e2003-12-23 08:09:43 +00001887
hassof390d2c2004-09-10 20:48:21 +00001888 if (isis != NULL)
1889 {
1890 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +00001891 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +00001892
hasso3fdb2dd2005-09-28 18:45:54 +00001893 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +00001894 {
1895 /* ISIS - Area name */
1896 vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE);
1897 write++;
1898 /* ISIS - Net */
1899 if (listcount (area->area_addrs) > 0)
1900 {
1901 struct area_addr *area_addr;
hasso3fdb2dd2005-09-28 18:45:54 +00001902 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
1903 {
1904 vty_out (vty, " net %s%s",
1905 isonet_print (area_addr->area_addr,
1906 area_addr->addr_len + ISIS_SYS_ID_LEN +
1907 1), VTY_NEWLINE);
1908 write++;
1909 }
hassof390d2c2004-09-10 20:48:21 +00001910 }
hasso3fdb2dd2005-09-28 18:45:54 +00001911 /* ISIS - Dynamic hostname - Defaults to true so only display if
1912 * false. */
hassof390d2c2004-09-10 20:48:21 +00001913 if (!area->dynhostname)
1914 {
1915 vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);
1916 write++;
1917 }
1918 /* ISIS - Metric-Style - when true displays wide */
1919 if (area->newmetric)
1920 {
hasso2984d262005-09-26 16:49:07 +00001921 if (!area->oldmetric)
1922 vty_out (vty, " metric-style wide%s", VTY_NEWLINE);
1923 else
1924 vty_out (vty, " metric-style transition%s", VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +00001925 write++;
1926 }
hasso2984d262005-09-26 16:49:07 +00001927
hassof390d2c2004-09-10 20:48:21 +00001928 /* ISIS - Area is-type (level-1-2 is default) */
1929 if (area->is_type == IS_LEVEL_1)
1930 {
1931 vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
1932 write++;
1933 }
1934 else
1935 {
1936 if (area->is_type == IS_LEVEL_2)
1937 {
1938 vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
1939 write++;
1940 }
1941 }
1942 /* ISIS - Lsp generation interval */
1943 if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1])
1944 {
1945 if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT)
1946 {
1947 vty_out (vty, " lsp-gen-interval %d%s",
1948 area->lsp_gen_interval[0], VTY_NEWLINE);
1949 write++;
1950 }
1951 }
1952 else
1953 {
1954 if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT)
1955 {
1956 vty_out (vty, " lsp-gen-interval level-1 %d%s",
1957 area->lsp_gen_interval[0], VTY_NEWLINE);
1958 write++;
1959 }
1960 if (area->lsp_gen_interval[1] != LSP_GEN_INTERVAL_DEFAULT)
1961 {
1962 vty_out (vty, " lsp-gen-interval level-2 %d%s",
1963 area->lsp_gen_interval[1], VTY_NEWLINE);
1964 write++;
1965 }
1966 }
1967 /* ISIS - LSP lifetime */
1968 if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1])
1969 {
1970 if (area->max_lsp_lifetime[0] != MAX_AGE)
1971 {
1972 vty_out (vty, " lsp-lifetime %u%s", area->max_lsp_lifetime[0],
1973 VTY_NEWLINE);
1974 write++;
1975 }
1976 }
1977 else
1978 {
1979 if (area->max_lsp_lifetime[0] != MAX_AGE)
1980 {
1981 vty_out (vty, " lsp-lifetime level-1 %u%s",
1982 area->max_lsp_lifetime[0], VTY_NEWLINE);
1983 write++;
1984 }
1985 if (area->max_lsp_lifetime[1] != MAX_AGE)
1986 {
1987 vty_out (vty, " lsp-lifetime level-2 %u%s",
1988 area->max_lsp_lifetime[1], VTY_NEWLINE);
1989 write++;
1990 }
1991 }
hasso13fb40a2005-10-01 06:03:04 +00001992 /* Minimum SPF interval. */
1993 if (area->min_spf_interval[0] == area->min_spf_interval[1])
1994 {
1995 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
1996 {
1997 vty_out (vty, " spf-interval %d%s",
1998 area->min_spf_interval[0], VTY_NEWLINE);
1999 write++;
2000 }
2001 }
2002 else
2003 {
2004 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
2005 {
2006 vty_out (vty, " spf-interval level-1 %d%s",
2007 area->min_spf_interval[0], VTY_NEWLINE);
2008 write++;
2009 }
2010 if (area->min_spf_interval[1] != MINIMUM_SPF_INTERVAL)
2011 {
2012 vty_out (vty, " spf-interval level-2 %d%s",
2013 area->min_spf_interval[1], VTY_NEWLINE);
2014 write++;
2015 }
2016 }
hasso53c997c2004-09-15 16:21:59 +00002017 /* Authentication passwords. */
2018 if (area->area_passwd.len > 0)
2019 {
hasso1cbc5622005-01-01 10:29:51 +00002020 vty_out(vty, " area-password %s", area->area_passwd.passwd);
2021 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
2022 {
2023 vty_out(vty, " authenticate snp ");
2024 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
2025 vty_out(vty, "validate");
2026 else
2027 vty_out(vty, "send-only");
2028 }
2029 vty_out(vty, "%s", VTY_NEWLINE);
hasso53c997c2004-09-15 16:21:59 +00002030 write++;
2031 }
2032 if (area->domain_passwd.len > 0)
2033 {
hasso1cbc5622005-01-01 10:29:51 +00002034 vty_out(vty, " domain-password %s", area->domain_passwd.passwd);
2035 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
2036 {
2037 vty_out(vty, " authenticate snp ");
2038 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
2039 vty_out(vty, "validate");
2040 else
2041 vty_out(vty, "send-only");
2042 }
2043 vty_out(vty, "%s", VTY_NEWLINE);
hasso53c997c2004-09-15 16:21:59 +00002044 write++;
2045 }
hassof1082d12005-09-19 04:23:34 +00002046
hassof390d2c2004-09-10 20:48:21 +00002047#ifdef TOPOLOGY_GENERATE
hassof1082d12005-09-19 04:23:34 +00002048 if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,
2049 ISIS_SYS_ID_LEN))
2050 {
2051 vty_out (vty, " topology base-is %s%s",
2052 sysid_print (area->topology_baseis), VTY_NEWLINE);
2053 write++;
2054 }
2055 if (area->topology_basedynh)
2056 {
2057 vty_out (vty, " topology base-dynh %s%s",
2058 area->topology_basedynh, VTY_NEWLINE);
2059 write++;
2060 }
2061 /* We save the whole command line here. */
2062 if (strlen(area->top_params))
hassof390d2c2004-09-10 20:48:21 +00002063 {
2064 vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE);
2065 write++;
2066 }
hassof390d2c2004-09-10 20:48:21 +00002067#endif /* TOPOLOGY_GENERATE */
hassof1082d12005-09-19 04:23:34 +00002068
hassof390d2c2004-09-10 20:48:21 +00002069 }
jardineb5d44e2003-12-23 08:09:43 +00002070 }
hassof390d2c2004-09-10 20:48:21 +00002071
jardineb5d44e2003-12-23 08:09:43 +00002072 return write;
2073}
2074
hassof390d2c2004-09-10 20:48:21 +00002075struct cmd_node isis_node = {
jardineb5d44e2003-12-23 08:09:43 +00002076 ISIS_NODE,
hasso2097cd82003-12-23 11:51:08 +00002077 "%s(config-router)# ",
jardineb5d44e2003-12-23 08:09:43 +00002078 1
2079};
2080
hassof390d2c2004-09-10 20:48:21 +00002081void
jardineb5d44e2003-12-23 08:09:43 +00002082isis_init ()
2083{
jardineb5d44e2003-12-23 08:09:43 +00002084 /* Install IS-IS top node */
2085 install_node (&isis_node, isis_config_write);
hassof390d2c2004-09-10 20:48:21 +00002086
jardineb5d44e2003-12-23 08:09:43 +00002087 install_element (VIEW_NODE, &show_clns_neighbors_cmd);
2088 install_element (VIEW_NODE, &show_isis_neighbors_cmd);
2089 install_element (VIEW_NODE, &show_clns_neighbors_detail_cmd);
2090 install_element (VIEW_NODE, &show_isis_neighbors_detail_cmd);
2091
2092 install_element (VIEW_NODE, &show_hostname_cmd);
2093 install_element (VIEW_NODE, &show_database_cmd);
2094 install_element (VIEW_NODE, &show_database_detail_cmd);
2095
2096 install_element (ENABLE_NODE, &show_clns_neighbors_cmd);
2097 install_element (ENABLE_NODE, &show_isis_neighbors_cmd);
2098 install_element (ENABLE_NODE, &show_clns_neighbors_detail_cmd);
2099 install_element (ENABLE_NODE, &show_isis_neighbors_detail_cmd);
2100
2101 install_element (ENABLE_NODE, &show_hostname_cmd);
2102 install_element (ENABLE_NODE, &show_database_cmd);
2103 install_element (ENABLE_NODE, &show_database_detail_cmd);
2104 install_element (ENABLE_NODE, &show_debugging_cmd);
2105
hassof390d2c2004-09-10 20:48:21 +00002106 install_node (&debug_node, config_write_debug);
jardin9e867fe2003-12-23 08:56:18 +00002107
jardineb5d44e2003-12-23 08:09:43 +00002108 install_element (ENABLE_NODE, &debug_isis_adj_cmd);
2109 install_element (ENABLE_NODE, &no_debug_isis_adj_cmd);
2110 install_element (ENABLE_NODE, &debug_isis_csum_cmd);
2111 install_element (ENABLE_NODE, &no_debug_isis_csum_cmd);
2112 install_element (ENABLE_NODE, &debug_isis_lupd_cmd);
2113 install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd);
2114 install_element (ENABLE_NODE, &debug_isis_err_cmd);
2115 install_element (ENABLE_NODE, &no_debug_isis_err_cmd);
2116 install_element (ENABLE_NODE, &debug_isis_snp_cmd);
2117 install_element (ENABLE_NODE, &no_debug_isis_snp_cmd);
2118 install_element (ENABLE_NODE, &debug_isis_upd_cmd);
2119 install_element (ENABLE_NODE, &no_debug_isis_upd_cmd);
2120 install_element (ENABLE_NODE, &debug_isis_spfevents_cmd);
2121 install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd);
2122 install_element (ENABLE_NODE, &debug_isis_spfstats_cmd);
2123 install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd);
2124 install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd);
2125 install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd);
2126 install_element (ENABLE_NODE, &debug_isis_rtevents_cmd);
2127 install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);
2128 install_element (ENABLE_NODE, &debug_isis_events_cmd);
2129 install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
2130
jardin9e867fe2003-12-23 08:56:18 +00002131 install_element (CONFIG_NODE, &debug_isis_adj_cmd);
2132 install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);
2133 install_element (CONFIG_NODE, &debug_isis_csum_cmd);
2134 install_element (CONFIG_NODE, &no_debug_isis_csum_cmd);
2135 install_element (CONFIG_NODE, &debug_isis_lupd_cmd);
2136 install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd);
2137 install_element (CONFIG_NODE, &debug_isis_err_cmd);
2138 install_element (CONFIG_NODE, &no_debug_isis_err_cmd);
2139 install_element (CONFIG_NODE, &debug_isis_snp_cmd);
2140 install_element (CONFIG_NODE, &no_debug_isis_snp_cmd);
2141 install_element (CONFIG_NODE, &debug_isis_upd_cmd);
2142 install_element (CONFIG_NODE, &no_debug_isis_upd_cmd);
2143 install_element (CONFIG_NODE, &debug_isis_spfevents_cmd);
2144 install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd);
2145 install_element (CONFIG_NODE, &debug_isis_spfstats_cmd);
2146 install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd);
2147 install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd);
2148 install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd);
2149 install_element (CONFIG_NODE, &debug_isis_rtevents_cmd);
2150 install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);
2151 install_element (CONFIG_NODE, &debug_isis_events_cmd);
2152 install_element (CONFIG_NODE, &no_debug_isis_events_cmd);
2153
jardineb5d44e2003-12-23 08:09:43 +00002154 install_element (CONFIG_NODE, &router_isis_cmd);
2155 install_element (CONFIG_NODE, &no_router_isis_cmd);
2156
2157 install_default (ISIS_NODE);
2158
2159 install_element (ISIS_NODE, &net_cmd);
2160 install_element (ISIS_NODE, &no_net_cmd);
2161
2162 install_element (ISIS_NODE, &is_type_cmd);
2163 install_element (ISIS_NODE, &no_is_type_cmd);
2164
2165 install_element (ISIS_NODE, &area_passwd_cmd);
hasso1cbc5622005-01-01 10:29:51 +00002166 install_element (ISIS_NODE, &area_passwd_snpauth_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002167 install_element (ISIS_NODE, &no_area_passwd_cmd);
2168
2169 install_element (ISIS_NODE, &domain_passwd_cmd);
hasso1cbc5622005-01-01 10:29:51 +00002170 install_element (ISIS_NODE, &domain_passwd_snpauth_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002171 install_element (ISIS_NODE, &no_domain_passwd_cmd);
2172
2173 install_element (ISIS_NODE, &lsp_gen_interval_cmd);
2174 install_element (ISIS_NODE, &no_lsp_gen_interval_cmd);
2175 install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd);
2176 install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd);
2177 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd);
2178 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd);
2179 install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd);
2180 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd);
2181 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd);
2182
2183 install_element (ISIS_NODE, &spf_interval_cmd);
2184 install_element (ISIS_NODE, &no_spf_interval_cmd);
2185 install_element (ISIS_NODE, &no_spf_interval_arg_cmd);
2186 install_element (ISIS_NODE, &spf_interval_l1_cmd);
2187 install_element (ISIS_NODE, &no_spf_interval_l1_cmd);
2188 install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd);
2189 install_element (ISIS_NODE, &spf_interval_l2_cmd);
2190 install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
2191 install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
hassof390d2c2004-09-10 20:48:21 +00002192
jardineb5d44e2003-12-23 08:09:43 +00002193 install_element (ISIS_NODE, &lsp_lifetime_cmd);
2194 install_element (ISIS_NODE, &no_lsp_lifetime_cmd);
2195 install_element (ISIS_NODE, &no_lsp_lifetime_arg_cmd);
2196 install_element (ISIS_NODE, &lsp_lifetime_l1_cmd);
2197 install_element (ISIS_NODE, &no_lsp_lifetime_l1_cmd);
2198 install_element (ISIS_NODE, &no_lsp_lifetime_l1_arg_cmd);
2199 install_element (ISIS_NODE, &lsp_lifetime_l2_cmd);
2200 install_element (ISIS_NODE, &no_lsp_lifetime_l2_cmd);
2201 install_element (ISIS_NODE, &no_lsp_lifetime_l2_arg_cmd);
2202
2203 install_element (ISIS_NODE, &dynamic_hostname_cmd);
2204 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
2205
2206 install_element (ISIS_NODE, &metric_style_cmd);
2207 install_element (ISIS_NODE, &no_metric_style_cmd);
2208#ifdef TOPOLOGY_GENERATE
2209 install_element (ISIS_NODE, &topology_generate_grid_cmd);
2210 install_element (ISIS_NODE, &topology_baseis_cmd);
hassof1082d12005-09-19 04:23:34 +00002211 install_element (ISIS_NODE, &topology_basedynh_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002212 install_element (ISIS_NODE, &no_topology_baseis_cmd);
hassof1082d12005-09-19 04:23:34 +00002213 install_element (ISIS_NODE, &no_topology_baseis_noid_cmd);
hassof695b012005-04-02 19:03:39 +00002214 install_element (VIEW_NODE, &show_isis_generated_topology_cmd);
2215 install_element (ENABLE_NODE, &show_isis_generated_topology_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002216#endif /* TOPOLOGY_GENERATE */
2217
hassof390d2c2004-09-10 20:48:21 +00002218 isis_new (0);
jardineb5d44e2003-12-23 08:09:43 +00002219 isis_circuit_init ();
2220 isis_zebra_init ();
2221 isis_spf_cmds_init ();
2222}