blob: 20a328092100c5a925c75f3c7655c7a6fbb00c78 [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"
Fritz Reichmann55749992011-09-14 19:31:51 +040055#include "isisd/isis_csm.h"
jardineb5d44e2003-12-23 08:09:43 +000056
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;
hasso73d1aea2004-09-24 10:45:28 +000063extern struct thread_master *master;
jardineb5d44e2003-12-23 08:09:43 +000064
Paul Jakma41b36e92006-12-08 01:09:50 +000065/*
66 * Prototypes.
67 */
68void isis_new(unsigned long);
69struct isis_area *isis_area_create(void);
70int isis_area_get(struct vty *, const char *);
71int isis_area_destroy(struct vty *, const char *);
72int area_net_title(struct vty *, const u_char *);
73int area_clear_net_title(struct vty *, const u_char *);
74int show_clns_neigh(struct vty *, char);
75void print_debug(struct vty *, int, int);
76int isis_config_write(struct vty *);
77
78
79
jardineb5d44e2003-12-23 08:09:43 +000080void
81isis_new (unsigned long process_id)
82{
hassoaac372f2005-09-01 17:52:33 +000083 isis = XCALLOC (MTYPE_ISIS, sizeof (struct isis));
jardineb5d44e2003-12-23 08:09:43 +000084 /*
85 * Default values
86 */
87 isis->max_area_addrs = 3;
88
89 isis->process_id = process_id;
90 isis->area_list = list_new ();
91 isis->init_circ_list = list_new ();
92 isis->uptime = time (NULL);
93 isis->nexthops = list_new ();
94#ifdef HAVE_IPV6
95 isis->nexthops6 = list_new ();
96#endif /* HAVE_IPV6 */
97 /*
98 * uncomment the next line for full debugs
99 */
hassof390d2c2004-09-10 20:48:21 +0000100 /* isis->debugs = 0xFFFF; */
jardineb5d44e2003-12-23 08:09:43 +0000101}
102
103struct isis_area *
104isis_area_create ()
105{
jardineb5d44e2003-12-23 08:09:43 +0000106 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000107
hassoaac372f2005-09-01 17:52:33 +0000108 area = XCALLOC (MTYPE_ISIS_AREA, sizeof (struct isis_area));
jardineb5d44e2003-12-23 08:09:43 +0000109
110 /*
111 * The first instance is level-1-2 rest are level-1, unless otherwise
112 * configured
113 */
114 if (listcount (isis->area_list) > 0)
115 area->is_type = IS_LEVEL_1;
116 else
117 area->is_type = IS_LEVEL_1_AND_2;
118 /*
119 * intialize the databases
120 */
121 area->lspdb[0] = lsp_db_init ();
122 area->lspdb[1] = lsp_db_init ();
hassof390d2c2004-09-10 20:48:21 +0000123
jardineb5d44e2003-12-23 08:09:43 +0000124 spftree_area_init (area);
hassofac1f7c2005-09-26 18:26:26 +0000125 area->route_table[0] = route_table_init ();
126 area->route_table[1] = route_table_init ();
jardineb5d44e2003-12-23 08:09:43 +0000127#ifdef HAVE_IPV6
hassofac1f7c2005-09-26 18:26:26 +0000128 area->route_table6[0] = route_table_init ();
129 area->route_table6[1] = route_table_init ();
jardineb5d44e2003-12-23 08:09:43 +0000130#endif /* HAVE_IPV6 */
131 area->circuit_list = list_new ();
132 area->area_addrs = list_new ();
hassof390d2c2004-09-10 20:48:21 +0000133 THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1);
Paul Jakmac7350c42008-01-29 19:29:44 +0000134 flags_initialize (&area->flags);
jardineb5d44e2003-12-23 08:09:43 +0000135 /*
136 * Default values
137 */
hassof390d2c2004-09-10 20:48:21 +0000138 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200 */
139 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200 */
jardineb5d44e2003-12-23 08:09:43 +0000140 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
141 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
hassof390d2c2004-09-10 20:48:21 +0000142 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900 */
143 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900 */
jardineb5d44e2003-12-23 08:09:43 +0000144 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
145 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
146 area->dynhostname = 1;
hasso2984d262005-09-26 16:49:07 +0000147 area->oldmetric = 1;
jardineb5d44e2003-12-23 08:09:43 +0000148 area->lsp_frag_threshold = 90;
149#ifdef TOPOLOGY_GENERATE
150 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
151#endif /* TOPOLOGY_GENERATE */
152
153 /* FIXME: Think of a better way... */
154 area->min_bcast_mtu = 1497;
155
156 return area;
157}
158
159struct isis_area *
hassof90a5f62004-10-11 13:11:56 +0000160isis_area_lookup (const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000161{
162 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +0000163 struct listnode *node;
hassof390d2c2004-09-10 20:48:21 +0000164
hasso3fdb2dd2005-09-28 18:45:54 +0000165 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
jardineb5d44e2003-12-23 08:09:43 +0000166 if ((area->area_tag == NULL && area_tag == NULL) ||
hassof390d2c2004-09-10 20:48:21 +0000167 (area->area_tag && area_tag
168 && strcmp (area->area_tag, area_tag) == 0))
169 return area;
170
jardineb5d44e2003-12-23 08:09:43 +0000171 return NULL;
172}
173
hassof390d2c2004-09-10 20:48:21 +0000174int
hassof90a5f62004-10-11 13:11:56 +0000175isis_area_get (struct vty *vty, const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000176{
jardineb5d44e2003-12-23 08:09:43 +0000177 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000178
jardineb5d44e2003-12-23 08:09:43 +0000179 area = isis_area_lookup (area_tag);
hassof390d2c2004-09-10 20:48:21 +0000180
181 if (area)
182 {
183 vty->node = ISIS_NODE;
184 vty->index = area;
185 return CMD_SUCCESS;
186 }
187
jardineb5d44e2003-12-23 08:09:43 +0000188 area = isis_area_create ();
189 area->area_tag = strdup (area_tag);
190 listnode_add (isis->area_list, area);
hassof390d2c2004-09-10 20:48:21 +0000191
hassoc89c05d2005-09-04 21:36:36 +0000192 if (isis->debugs & DEBUG_EVENTS)
193 zlog_debug ("New IS-IS area instance %s", area->area_tag);
jardineb5d44e2003-12-23 08:09:43 +0000194
195 vty->node = ISIS_NODE;
196 vty->index = area;
hassof390d2c2004-09-10 20:48:21 +0000197
jardineb5d44e2003-12-23 08:09:43 +0000198 return CMD_SUCCESS;
199}
200
201int
hassof90a5f62004-10-11 13:11:56 +0000202isis_area_destroy (struct vty *vty, const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000203{
jardineb5d44e2003-12-23 08:09:43 +0000204 struct isis_area *area;
paul1eb8ef22005-04-07 07:30:20 +0000205 struct listnode *node, *nnode;
jardineb5d44e2003-12-23 08:09:43 +0000206 struct isis_circuit *circuit;
207
208 area = isis_area_lookup (area_tag);
jardineb5d44e2003-12-23 08:09:43 +0000209
hassof390d2c2004-09-10 20:48:21 +0000210 if (area == NULL)
211 {
212 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
213 return CMD_WARNING;
jardineb5d44e2003-12-23 08:09:43 +0000214 }
hassof390d2c2004-09-10 20:48:21 +0000215
216 if (area->circuit_list)
217 {
paul1eb8ef22005-04-07 07:30:20 +0000218 for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))
Paul Jakmac7350c42008-01-29 19:29:44 +0000219 {
220 /* The fact that it's in circuit_list means that it was configured */
Fritz Reichmann55749992011-09-14 19:31:51 +0400221 isis_csm_state_change (ISIS_DISABLE, circuit, area);
222 isis_circuit_down (circuit);
Paul Jakmac7350c42008-01-29 19:29:44 +0000223 isis_circuit_deconfigure (circuit, area);
Paul Jakmac7350c42008-01-29 19:29:44 +0000224 }
paul1eb8ef22005-04-07 07:30:20 +0000225
hassof390d2c2004-09-10 20:48:21 +0000226 list_delete (area->circuit_list);
227 }
jardineb5d44e2003-12-23 08:09:43 +0000228 listnode_delete (isis->area_list, area);
Fritz Reichmann55749992011-09-14 19:31:51 +0400229
hassof390d2c2004-09-10 20:48:21 +0000230 THREAD_TIMER_OFF (area->t_tick);
jardineb5d44e2003-12-23 08:09:43 +0000231 if (area->t_remove_aged)
232 thread_cancel (area->t_remove_aged);
hassof390d2c2004-09-10 20:48:21 +0000233 THREAD_TIMER_OFF (area->t_lsp_refresh[0]);
234 THREAD_TIMER_OFF (area->t_lsp_refresh[1]);
jardineb5d44e2003-12-23 08:09:43 +0000235
Fritz Reichmann55749992011-09-14 19:31:51 +0400236 THREAD_TIMER_OFF (area->spftree[0]->t_spf);
237 THREAD_TIMER_OFF (area->spftree[1]->t_spf);
238
239 THREAD_TIMER_OFF (area->t_lsp_l1_regenerate);
240 THREAD_TIMER_OFF (area->t_lsp_l2_regenerate);
241
jardineb5d44e2003-12-23 08:09:43 +0000242 XFREE (MTYPE_ISIS_AREA, area);
hassof390d2c2004-09-10 20:48:21 +0000243
Fritz Reichmann55749992011-09-14 19:31:51 +0400244 isis->sysid_set=0;
245
jardineb5d44e2003-12-23 08:09:43 +0000246 return CMD_SUCCESS;
247}
248
hassof390d2c2004-09-10 20:48:21 +0000249int
Paul Jakma41b36e92006-12-08 01:09:50 +0000250area_net_title (struct vty *vty, const u_char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000251{
jardineb5d44e2003-12-23 08:09:43 +0000252 struct isis_area *area;
253 struct area_addr *addr;
254 struct area_addr *addrp;
hasso3fdb2dd2005-09-28 18:45:54 +0000255 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000256
257 u_char buff[255];
258 area = vty->index;
259
hassof390d2c2004-09-10 20:48:21 +0000260 if (!area)
261 {
262 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
263 return CMD_WARNING;
264 }
jardineb5d44e2003-12-23 08:09:43 +0000265
266 /* We check that we are not over the maximal number of addresses */
hassof390d2c2004-09-10 20:48:21 +0000267 if (listcount (area->area_addrs) >= isis->max_area_addrs)
268 {
269 vty_out (vty, "Maximum of area addresses (%d) already reached %s",
270 isis->max_area_addrs, VTY_NEWLINE);
271 return CMD_WARNING;
272 }
jardineb5d44e2003-12-23 08:09:43 +0000273
274 addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));
275 addr->addr_len = dotformat2buff (buff, net_title);
276 memcpy (addr->area_addr, buff, addr->addr_len);
277#ifdef EXTREME_DEBUG
hasso529d65b2004-12-24 00:14:50 +0000278 zlog_debug ("added area address %s for area %s (address length %d)",
jardineb5d44e2003-12-23 08:09:43 +0000279 net_title, area->area_tag, addr->addr_len);
280#endif /* EXTREME_DEBUG */
hassof390d2c2004-09-10 20:48:21 +0000281 if (addr->addr_len < 8 || addr->addr_len > 20)
282 {
283 zlog_warn ("area address must be at least 8..20 octets long (%d)",
284 addr->addr_len);
jardineb5d44e2003-12-23 08:09:43 +0000285 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
286 return CMD_WARNING;
287 }
288
hassof390d2c2004-09-10 20:48:21 +0000289 if (isis->sysid_set == 0)
290 {
291 /*
292 * First area address - get the SystemID for this router
293 */
294 memcpy (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN), ISIS_SYS_ID_LEN);
295 isis->sysid_set = 1;
hassoc89c05d2005-09-04 21:36:36 +0000296 if (isis->debugs & DEBUG_EVENTS)
297 zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid));
jardineb5d44e2003-12-23 08:09:43 +0000298 }
hassof390d2c2004-09-10 20:48:21 +0000299 else
300 {
301 /*
302 * Check that the SystemID portions match
303 */
304 if (memcmp (isis->sysid, GETSYSID (addr, ISIS_SYS_ID_LEN),
305 ISIS_SYS_ID_LEN))
306 {
307 vty_out (vty,
308 "System ID must not change when defining additional area"
309 " addresses%s", VTY_NEWLINE);
310 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
311 return CMD_WARNING;
312 }
jardineb5d44e2003-12-23 08:09:43 +0000313
hassof390d2c2004-09-10 20:48:21 +0000314 /* now we see that we don't already have this address */
hasso3fdb2dd2005-09-28 18:45:54 +0000315 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
316 {
317 if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) != (addr->addr_len))
318 continue;
319 if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
320 {
321 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
322 return CMD_SUCCESS; /* silent fail */
323 }
324 }
hassof390d2c2004-09-10 20:48:21 +0000325
326 }
jardineb5d44e2003-12-23 08:09:43 +0000327 /*
328 * Forget the systemID part of the address
329 */
330 addr->addr_len -= (ISIS_SYS_ID_LEN + 1);
331 listnode_add (area->area_addrs, addr);
332
333 /* only now we can safely generate our LSPs for this area */
hassof390d2c2004-09-10 20:48:21 +0000334 if (listcount (area->area_addrs) > 0)
335 {
336 lsp_l1_generate (area);
337 lsp_l2_generate (area);
338 }
jardineb5d44e2003-12-23 08:09:43 +0000339
340 return CMD_SUCCESS;
341}
342
343int
Paul Jakma41b36e92006-12-08 01:09:50 +0000344area_clear_net_title (struct vty *vty, const u_char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000345{
346 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000347 struct area_addr addr, *addrp = NULL;
hasso3fdb2dd2005-09-28 18:45:54 +0000348 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000349 u_char buff[255];
350
351 area = vty->index;
hassof390d2c2004-09-10 20:48:21 +0000352 if (!area)
353 {
354 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
355 return CMD_WARNING;
356 }
357
jardineb5d44e2003-12-23 08:09:43 +0000358 addr.addr_len = dotformat2buff (buff, net_title);
hassof390d2c2004-09-10 20:48:21 +0000359 if (addr.addr_len < 8 || addr.addr_len > 20)
360 {
361 vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
362 addr.addr_len, VTY_NEWLINE);
363 return CMD_WARNING;
364 }
365
366 memcpy (addr.area_addr, buff, (int) addr.addr_len);
367
hasso3fdb2dd2005-09-28 18:45:54 +0000368 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
jardineb5d44e2003-12-23 08:09:43 +0000369 if (addrp->addr_len == addr.addr_len &&
370 !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
hassof390d2c2004-09-10 20:48:21 +0000371 break;
372
373 if (!addrp)
374 {
375 vty_out (vty, "No area address %s for area %s %s", net_title,
376 area->area_tag, VTY_NEWLINE);
377 return CMD_WARNING;
378 }
379
jardineb5d44e2003-12-23 08:09:43 +0000380 listnode_delete (area->area_addrs, addrp);
hassof390d2c2004-09-10 20:48:21 +0000381
jardineb5d44e2003-12-23 08:09:43 +0000382 return CMD_SUCCESS;
383}
384
jardineb5d44e2003-12-23 08:09:43 +0000385/*
386 * 'show clns neighbors' command
387 */
388
389int
hassof390d2c2004-09-10 20:48:21 +0000390show_clns_neigh (struct vty *vty, char detail)
jardineb5d44e2003-12-23 08:09:43 +0000391{
hasso3fdb2dd2005-09-28 18:45:54 +0000392 struct listnode *anode, *cnode;
jardineb5d44e2003-12-23 08:09:43 +0000393 struct isis_area *area;
394 struct isis_circuit *circuit;
395 struct list *db;
396 int i;
397
hassof390d2c2004-09-10 20:48:21 +0000398 if (!isis)
399 {
400 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
401 return CMD_SUCCESS;
402 }
jardineb5d44e2003-12-23 08:09:43 +0000403
hasso3fdb2dd2005-09-28 18:45:54 +0000404 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
hassof390d2c2004-09-10 20:48:21 +0000405 {
hassof390d2c2004-09-10 20:48:21 +0000406 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000407
hassof390d2c2004-09-10 20:48:21 +0000408 if (detail == ISIS_UI_LEVEL_BRIEF)
409 vty_out (vty, " System Id Interface L State "
410 "Holdtime SNPA%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000411
hasso3fdb2dd2005-09-28 18:45:54 +0000412 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
hassof390d2c2004-09-10 20:48:21 +0000413 {
hassof390d2c2004-09-10 20:48:21 +0000414 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
415 {
416 for (i = 0; i < 2; i++)
417 {
418 db = circuit->u.bc.adjdb[i];
419 if (db && db->count)
420 {
421 if (detail == ISIS_UI_LEVEL_BRIEF)
422 isis_adjdb_iterate (db,
423 (void (*)
424 (struct isis_adjacency *,
425 void *)) isis_adj_print_vty,
426 vty);
427 if (detail == ISIS_UI_LEVEL_DETAIL)
428 isis_adjdb_iterate (db,
429 (void (*)
430 (struct isis_adjacency *,
431 void *))
432 isis_adj_print_vty_detail, vty);
433 if (detail == ISIS_UI_LEVEL_EXTENSIVE)
434 isis_adjdb_iterate (db,
435 (void (*)
436 (struct isis_adjacency *,
437 void *))
438 isis_adj_print_vty_extensive,
439 vty);
440 }
441 }
442 }
443 else if (circuit->circ_type == CIRCUIT_T_P2P &&
444 circuit->u.p2p.neighbor)
445 {
446 if (detail == ISIS_UI_LEVEL_BRIEF)
447 isis_adj_p2p_print_vty (circuit->u.p2p.neighbor, vty);
448 if (detail == ISIS_UI_LEVEL_DETAIL)
449 isis_adj_p2p_print_vty_detail (circuit->u.p2p.neighbor, vty);
450 if (detail == ISIS_UI_LEVEL_EXTENSIVE)
451 isis_adj_p2p_print_vty_extensive (circuit->u.p2p.neighbor,
452 vty);
453 }
454 }
jardineb5d44e2003-12-23 08:09:43 +0000455 }
hassof390d2c2004-09-10 20:48:21 +0000456
jardineb5d44e2003-12-23 08:09:43 +0000457 return CMD_SUCCESS;
458}
459
460DEFUN (show_clns_neighbors,
461 show_clns_neighbors_cmd,
462 "show clns neighbors",
463 SHOW_STR
464 "clns network information\n"
465 "CLNS neighbor adjacencies\n")
466{
hassof390d2c2004-09-10 20:48:21 +0000467 return show_clns_neigh (vty, ISIS_UI_LEVEL_BRIEF);
jardineb5d44e2003-12-23 08:09:43 +0000468}
469
470ALIAS (show_clns_neighbors,
471 show_isis_neighbors_cmd,
472 "show isis neighbors",
473 SHOW_STR
474 "IS-IS network information\n"
475 "IS-IS neighbor adjacencies\n")
476
477DEFUN (show_clns_neighbors_detail,
478 show_clns_neighbors_detail_cmd,
479 "show clns neighbors detail",
480 SHOW_STR
481 "clns network information\n"
482 "CLNS neighbor adjacencies\n"
483 "show detailed information\n")
484{
hassof390d2c2004-09-10 20:48:21 +0000485 return show_clns_neigh (vty, ISIS_UI_LEVEL_DETAIL);
jardineb5d44e2003-12-23 08:09:43 +0000486}
487
488ALIAS (show_clns_neighbors_detail,
489 show_isis_neighbors_detail_cmd,
490 "show isis neighbors detail",
491 SHOW_STR
492 "IS-IS network information\n"
493 "IS-IS neighbor adjacencies\n"
494 "show detailed information\n")
jardineb5d44e2003-12-23 08:09:43 +0000495/*
496 * 'isis debug', 'show debugging'
497 */
jardineb5d44e2003-12-23 08:09:43 +0000498void
499print_debug (struct vty *vty, int flags, int onoff)
500{
501 char onoffs[4];
502 if (onoff)
hassof390d2c2004-09-10 20:48:21 +0000503 strcpy (onoffs, "on");
jardineb5d44e2003-12-23 08:09:43 +0000504 else
hassof390d2c2004-09-10 20:48:21 +0000505 strcpy (onoffs, "off");
jardineb5d44e2003-12-23 08:09:43 +0000506
507 if (flags & DEBUG_ADJ_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000508 vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs,
509 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000510 if (flags & DEBUG_CHECKSUM_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000511 vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs,
512 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000513 if (flags & DEBUG_LOCAL_UPDATES)
hassof390d2c2004-09-10 20:48:21 +0000514 vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs,
515 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000516 if (flags & DEBUG_PROTOCOL_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000517 vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs,
518 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000519 if (flags & DEBUG_SNP_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000520 vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs,
521 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000522 if (flags & DEBUG_SPF_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000523 vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000524 if (flags & DEBUG_SPF_STATS)
hassof390d2c2004-09-10 20:48:21 +0000525 vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s",
526 onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000527 if (flags & DEBUG_SPF_TRIGGERS)
hassof390d2c2004-09-10 20:48:21 +0000528 vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs,
529 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000530 if (flags & DEBUG_UPDATE_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000531 vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs,
532 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000533 if (flags & DEBUG_RTE_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000534 vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs,
535 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000536 if (flags & DEBUG_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000537 vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000538
539}
540
541DEFUN (show_debugging,
542 show_debugging_cmd,
543 "show debugging",
544 SHOW_STR
545 "State of each debugging option\n")
546{
hassof390d2c2004-09-10 20:48:21 +0000547 vty_out (vty, "IS-IS:%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000548 print_debug (vty, isis->debugs, 1);
549 return CMD_SUCCESS;
550}
551
jardin9e867fe2003-12-23 08:56:18 +0000552/* Debug node. */
hassof390d2c2004-09-10 20:48:21 +0000553static struct cmd_node debug_node = {
jardin9e867fe2003-12-23 08:56:18 +0000554 DEBUG_NODE,
hassof390d2c2004-09-10 20:48:21 +0000555 "",
556 1
jardin9e867fe2003-12-23 08:56:18 +0000557};
558
559static int
560config_write_debug (struct vty *vty)
561{
562 int write = 0;
563 int flags = isis->debugs;
564
hassof390d2c2004-09-10 20:48:21 +0000565 if (flags & DEBUG_ADJ_PACKETS)
566 {
567 vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE);
568 write++;
569 }
570 if (flags & DEBUG_CHECKSUM_ERRORS)
571 {
572 vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE);
573 write++;
574 }
575 if (flags & DEBUG_LOCAL_UPDATES)
576 {
577 vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE);
578 write++;
579 }
580 if (flags & DEBUG_PROTOCOL_ERRORS)
581 {
582 vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE);
583 write++;
584 }
585 if (flags & DEBUG_SNP_PACKETS)
586 {
587 vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE);
588 write++;
589 }
590 if (flags & DEBUG_SPF_EVENTS)
591 {
592 vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE);
593 write++;
594 }
595 if (flags & DEBUG_SPF_STATS)
596 {
597 vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE);
598 write++;
599 }
600 if (flags & DEBUG_SPF_TRIGGERS)
601 {
602 vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE);
603 write++;
604 }
605 if (flags & DEBUG_UPDATE_PACKETS)
606 {
607 vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE);
608 write++;
609 }
610 if (flags & DEBUG_RTE_EVENTS)
611 {
612 vty_out (vty, "debug isis route-events%s", VTY_NEWLINE);
613 write++;
614 }
615 if (flags & DEBUG_EVENTS)
616 {
617 vty_out (vty, "debug isis events%s", VTY_NEWLINE);
618 write++;
619 }
jardin9e867fe2003-12-23 08:56:18 +0000620
621 return write;
622}
623
jardineb5d44e2003-12-23 08:09:43 +0000624DEFUN (debug_isis_adj,
625 debug_isis_adj_cmd,
626 "debug isis adj-packets",
627 DEBUG_STR
628 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000629 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000630{
631 isis->debugs |= DEBUG_ADJ_PACKETS;
hassof390d2c2004-09-10 20:48:21 +0000632 print_debug (vty, DEBUG_ADJ_PACKETS, 1);
jardineb5d44e2003-12-23 08:09:43 +0000633
634 return CMD_SUCCESS;
635}
636
637DEFUN (no_debug_isis_adj,
638 no_debug_isis_adj_cmd,
639 "no debug isis adj-packets",
640 UNDEBUG_STR
641 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000642 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000643{
jardineb5d44e2003-12-23 08:09:43 +0000644 isis->debugs &= ~DEBUG_ADJ_PACKETS;
645 print_debug (vty, DEBUG_ADJ_PACKETS, 0);
646
647 return CMD_SUCCESS;
648}
649
jardineb5d44e2003-12-23 08:09:43 +0000650DEFUN (debug_isis_csum,
651 debug_isis_csum_cmd,
652 "debug isis checksum-errors",
653 DEBUG_STR
654 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000655 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000656{
657 isis->debugs |= DEBUG_CHECKSUM_ERRORS;
658 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1);
659
660 return CMD_SUCCESS;
661}
662
663DEFUN (no_debug_isis_csum,
664 no_debug_isis_csum_cmd,
665 "no debug isis checksum-errors",
666 UNDEBUG_STR
667 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000668 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000669{
670 isis->debugs &= ~DEBUG_CHECKSUM_ERRORS;
671 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000672
jardineb5d44e2003-12-23 08:09:43 +0000673 return CMD_SUCCESS;
674}
675
676DEFUN (debug_isis_lupd,
677 debug_isis_lupd_cmd,
678 "debug isis local-updates",
679 DEBUG_STR
680 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000681 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000682{
683 isis->debugs |= DEBUG_LOCAL_UPDATES;
684 print_debug (vty, DEBUG_LOCAL_UPDATES, 1);
685
686 return CMD_SUCCESS;
687}
688
689DEFUN (no_debug_isis_lupd,
690 no_debug_isis_lupd_cmd,
691 "no debug isis local-updates",
692 UNDEBUG_STR
693 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000694 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000695{
696 isis->debugs &= ~DEBUG_LOCAL_UPDATES;
hassof390d2c2004-09-10 20:48:21 +0000697 print_debug (vty, DEBUG_LOCAL_UPDATES, 0);
698
jardineb5d44e2003-12-23 08:09:43 +0000699 return CMD_SUCCESS;
700}
701
702DEFUN (debug_isis_err,
703 debug_isis_err_cmd,
hassof390d2c2004-09-10 20:48:21 +0000704 "debug isis protocol-errors",
jardineb5d44e2003-12-23 08:09:43 +0000705 DEBUG_STR
706 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000707 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000708{
709 isis->debugs |= DEBUG_PROTOCOL_ERRORS;
710 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1);
711
712 return CMD_SUCCESS;
713}
714
715DEFUN (no_debug_isis_err,
716 no_debug_isis_err_cmd,
717 "no debug isis protocol-errors",
718 UNDEBUG_STR
719 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000720 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000721{
722 isis->debugs &= ~DEBUG_PROTOCOL_ERRORS;
723 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000724
jardineb5d44e2003-12-23 08:09:43 +0000725 return CMD_SUCCESS;
726}
727
728DEFUN (debug_isis_snp,
729 debug_isis_snp_cmd,
730 "debug isis snp-packets",
731 DEBUG_STR
732 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000733 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000734{
735 isis->debugs |= DEBUG_SNP_PACKETS;
736 print_debug (vty, DEBUG_SNP_PACKETS, 1);
737
738 return CMD_SUCCESS;
739}
740
741DEFUN (no_debug_isis_snp,
742 no_debug_isis_snp_cmd,
743 "no debug isis snp-packets",
744 UNDEBUG_STR
745 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000746 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000747{
hassof390d2c2004-09-10 20:48:21 +0000748 isis->debugs &= ~DEBUG_SNP_PACKETS;
jardineb5d44e2003-12-23 08:09:43 +0000749 print_debug (vty, DEBUG_SNP_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +0000750
jardineb5d44e2003-12-23 08:09:43 +0000751 return CMD_SUCCESS;
752}
753
jardineb5d44e2003-12-23 08:09:43 +0000754DEFUN (debug_isis_upd,
755 debug_isis_upd_cmd,
756 "debug isis update-packets",
757 DEBUG_STR
758 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000759 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000760{
761 isis->debugs |= DEBUG_UPDATE_PACKETS;
762 print_debug (vty, DEBUG_UPDATE_PACKETS, 1);
763
764 return CMD_SUCCESS;
765}
766
767DEFUN (no_debug_isis_upd,
768 no_debug_isis_upd_cmd,
769 "no debug isis update-packets",
770 UNDEBUG_STR
771 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000772 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000773{
774 isis->debugs &= ~DEBUG_UPDATE_PACKETS;
775 print_debug (vty, DEBUG_UPDATE_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +0000776
jardineb5d44e2003-12-23 08:09:43 +0000777 return CMD_SUCCESS;
778}
779
jardineb5d44e2003-12-23 08:09:43 +0000780DEFUN (debug_isis_spfevents,
781 debug_isis_spfevents_cmd,
782 "debug isis spf-events",
783 DEBUG_STR
784 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000785 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000786{
787 isis->debugs |= DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +0000788 print_debug (vty, DEBUG_SPF_EVENTS, 1);
jardineb5d44e2003-12-23 08:09:43 +0000789
790 return CMD_SUCCESS;
791}
792
793DEFUN (no_debug_isis_spfevents,
794 no_debug_isis_spfevents_cmd,
795 "no debug isis spf-events",
796 UNDEBUG_STR
797 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000798 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000799{
800 isis->debugs &= ~DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +0000801 print_debug (vty, DEBUG_SPF_EVENTS, 0);
802
jardineb5d44e2003-12-23 08:09:43 +0000803 return CMD_SUCCESS;
804}
805
806
807DEFUN (debug_isis_spfstats,
808 debug_isis_spfstats_cmd,
809 "debug isis spf-statistics ",
810 DEBUG_STR
811 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000812 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +0000813{
814 isis->debugs |= DEBUG_SPF_STATS;
815 print_debug (vty, DEBUG_SPF_STATS, 1);
816
817 return CMD_SUCCESS;
818}
819
820DEFUN (no_debug_isis_spfstats,
821 no_debug_isis_spfstats_cmd,
822 "no debug isis spf-statistics",
823 UNDEBUG_STR
824 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000825 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +0000826{
827 isis->debugs &= ~DEBUG_SPF_STATS;
828 print_debug (vty, DEBUG_SPF_STATS, 0);
hassof390d2c2004-09-10 20:48:21 +0000829
jardineb5d44e2003-12-23 08:09:43 +0000830 return CMD_SUCCESS;
831}
832
833DEFUN (debug_isis_spftrigg,
834 debug_isis_spftrigg_cmd,
835 "debug isis spf-triggers",
836 DEBUG_STR
837 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000838 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +0000839{
840 isis->debugs |= DEBUG_SPF_TRIGGERS;
841 print_debug (vty, DEBUG_SPF_TRIGGERS, 1);
842
843 return CMD_SUCCESS;
844}
845
846DEFUN (no_debug_isis_spftrigg,
847 no_debug_isis_spftrigg_cmd,
848 "no debug isis spf-triggers",
849 UNDEBUG_STR
850 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000851 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +0000852{
853 isis->debugs &= ~DEBUG_SPF_TRIGGERS;
854 print_debug (vty, DEBUG_SPF_TRIGGERS, 0);
hassof390d2c2004-09-10 20:48:21 +0000855
jardineb5d44e2003-12-23 08:09:43 +0000856 return CMD_SUCCESS;
857}
858
859DEFUN (debug_isis_rtevents,
860 debug_isis_rtevents_cmd,
861 "debug isis route-events",
862 DEBUG_STR
863 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000864 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +0000865{
866 isis->debugs |= DEBUG_RTE_EVENTS;
867 print_debug (vty, DEBUG_RTE_EVENTS, 1);
868
869 return CMD_SUCCESS;
870}
871
872DEFUN (no_debug_isis_rtevents,
873 no_debug_isis_rtevents_cmd,
874 "no debug isis route-events",
875 UNDEBUG_STR
876 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000877 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +0000878{
879 isis->debugs &= ~DEBUG_RTE_EVENTS;
880 print_debug (vty, DEBUG_RTE_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +0000881
jardineb5d44e2003-12-23 08:09:43 +0000882 return CMD_SUCCESS;
883}
884
885DEFUN (debug_isis_events,
886 debug_isis_events_cmd,
887 "debug isis events",
888 DEBUG_STR
889 "IS-IS information\n"
hassof1082d12005-09-19 04:23:34 +0000890 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000891{
892 isis->debugs |= DEBUG_EVENTS;
893 print_debug (vty, DEBUG_EVENTS, 1);
894
895 return CMD_SUCCESS;
896}
897
898DEFUN (no_debug_isis_events,
899 no_debug_isis_events_cmd,
900 "no debug isis events",
901 UNDEBUG_STR
902 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000903 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +0000904{
905 isis->debugs &= ~DEBUG_EVENTS;
906 print_debug (vty, DEBUG_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +0000907
jardineb5d44e2003-12-23 08:09:43 +0000908 return CMD_SUCCESS;
909}
910
jardineb5d44e2003-12-23 08:09:43 +0000911DEFUN (show_hostname,
912 show_hostname_cmd,
913 "show isis hostname",
914 SHOW_STR
915 "IS-IS information\n"
916 "IS-IS Dynamic hostname mapping\n")
917{
918 dynhn_print_all (vty);
hassof390d2c2004-09-10 20:48:21 +0000919
jardineb5d44e2003-12-23 08:09:43 +0000920 return CMD_SUCCESS;
921}
922
jardineb5d44e2003-12-23 08:09:43 +0000923DEFUN (show_database,
924 show_database_cmd,
925 "show isis database",
hassof390d2c2004-09-10 20:48:21 +0000926 SHOW_STR "IS-IS information\n" "IS-IS link state database\n")
jardineb5d44e2003-12-23 08:09:43 +0000927{
hasso3fdb2dd2005-09-28 18:45:54 +0000928 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000929 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000930 int level, lsp_count;
jardineb5d44e2003-12-23 08:09:43 +0000931
932 if (isis->area_list->count == 0)
933 return CMD_SUCCESS;
jardineb5d44e2003-12-23 08:09:43 +0000934
hasso3fdb2dd2005-09-28 18:45:54 +0000935 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +0000936 {
hassof390d2c2004-09-10 20:48:21 +0000937 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
938 VTY_NEWLINE);
939 for (level = 0; level < ISIS_LEVELS; level++)
940 {
941 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
942 {
943 vty_out (vty, "IS-IS Level-%d link-state database:%s",
944 level + 1, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000945
hassof390d2c2004-09-10 20:48:21 +0000946 lsp_count = lsp_print_all (vty, area->lspdb[level],
947 ISIS_UI_LEVEL_BRIEF,
948 area->dynhostname);
949
950 vty_out (vty, "%s %u LSPs%s%s",
951 VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE);
952 }
953 }
jardineb5d44e2003-12-23 08:09:43 +0000954 }
jardineb5d44e2003-12-23 08:09:43 +0000955
956 return CMD_SUCCESS;
957}
958
jardineb5d44e2003-12-23 08:09:43 +0000959DEFUN (show_database_detail,
960 show_database_detail_cmd,
961 "show isis database detail",
962 SHOW_STR
963 "IS-IS information\n"
964 "IS-IS link state database\n")
965{
hasso3fdb2dd2005-09-28 18:45:54 +0000966 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000967 struct isis_area *area;
968 int level, lsp_count;
969
970 if (isis->area_list->count == 0)
971 return CMD_SUCCESS;
972
hasso3fdb2dd2005-09-28 18:45:54 +0000973 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +0000974 {
hassof390d2c2004-09-10 20:48:21 +0000975 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
976 VTY_NEWLINE);
977 for (level = 0; level < ISIS_LEVELS; level++)
978 {
979 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
980 {
981 vty_out (vty, "IS-IS Level-%d Link State Database:%s",
982 level + 1, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000983
hassof390d2c2004-09-10 20:48:21 +0000984 lsp_count = lsp_print_all (vty, area->lspdb[level],
985 ISIS_UI_LEVEL_DETAIL,
986 area->dynhostname);
jardineb5d44e2003-12-23 08:09:43 +0000987
hassof390d2c2004-09-10 20:48:21 +0000988 vty_out (vty, "%s %u LSPs%s%s",
989 VTY_NEWLINE, lsp_count, VTY_NEWLINE, VTY_NEWLINE);
990 }
991 }
jardineb5d44e2003-12-23 08:09:43 +0000992 }
jardineb5d44e2003-12-23 08:09:43 +0000993
994 return CMD_SUCCESS;
995}
996
997/*
998 * 'router isis' command
999 */
1000DEFUN (router_isis,
1001 router_isis_cmd,
1002 "router isis WORD",
hassof390d2c2004-09-10 20:48:21 +00001003 ROUTER_STR
jardineb5d44e2003-12-23 08:09:43 +00001004 "ISO IS-IS\n"
1005 "ISO Routing area tag")
1006{
jardineb5d44e2003-12-23 08:09:43 +00001007 return isis_area_get (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001008}
1009
1010/*
1011 *'no router isis' command
1012 */
1013DEFUN (no_router_isis,
1014 no_router_isis_cmd,
1015 "no router isis WORD",
hassof390d2c2004-09-10 20:48:21 +00001016 "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag")
jardineb5d44e2003-12-23 08:09:43 +00001017{
1018 return isis_area_destroy (vty, argv[0]);
1019}
1020
1021/*
1022 * 'net' command
1023 */
1024DEFUN (net,
1025 net_cmd,
1026 "net WORD",
1027 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001028 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001029{
Paul Jakma41b36e92006-12-08 01:09:50 +00001030 return area_net_title (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001031}
1032
jardineb5d44e2003-12-23 08:09:43 +00001033/*
1034 * 'no net' command
1035 */
1036DEFUN (no_net,
1037 no_net_cmd,
1038 "no net WORD",
1039 NO_STR
1040 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001041 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001042{
Paul Jakma41b36e92006-12-08 01:09:50 +00001043 return area_clear_net_title (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001044}
1045
1046DEFUN (area_passwd,
1047 area_passwd_cmd,
1048 "area-password WORD",
1049 "Configure the authentication password for an area\n"
hassof390d2c2004-09-10 20:48:21 +00001050 "Area password\n")
jardineb5d44e2003-12-23 08:09:43 +00001051{
1052 struct isis_area *area;
1053 int len;
1054
1055 area = vty->index;
1056
hassof390d2c2004-09-10 20:48:21 +00001057 if (!area)
1058 {
1059 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1060 return CMD_WARNING;
1061 }
1062
jardineb5d44e2003-12-23 08:09:43 +00001063 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001064 if (len > 254)
1065 {
1066 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1067 return CMD_WARNING;
1068 }
1069 area->area_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001070 area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001071 strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001072
hasso1cbc5622005-01-01 10:29:51 +00001073 if (argc > 1)
1074 {
1075 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1076 if (strncmp(argv[1], "v", 1) == 0)
1077 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1078 else
1079 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1080 }
1081 else
1082 {
1083 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1084 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1085 }
1086
jardineb5d44e2003-12-23 08:09:43 +00001087 return CMD_SUCCESS;
1088}
1089
hasso1cbc5622005-01-01 10:29:51 +00001090ALIAS (area_passwd,
1091 area_passwd_snpauth_cmd,
1092 "area-password WORD authenticate snp (send-only|validate)",
1093 "Configure the authentication password for an area\n"
1094 "Area password\n"
1095 "Authentication\n"
1096 "SNP PDUs\n"
1097 "Send but do not check PDUs on receiving\n"
1098 "Send and check PDUs on receiving\n");
1099
jardineb5d44e2003-12-23 08:09:43 +00001100DEFUN (no_area_passwd,
1101 no_area_passwd_cmd,
1102 "no area-password",
1103 NO_STR
1104 "Configure the authentication password for an area\n")
1105{
1106 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001107
jardineb5d44e2003-12-23 08:09:43 +00001108 area = vty->index;
1109
hassof390d2c2004-09-10 20:48:21 +00001110 if (!area)
1111 {
1112 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1113 return CMD_WARNING;
1114 }
1115
jardineb5d44e2003-12-23 08:09:43 +00001116 memset (&area->area_passwd, 0, sizeof (struct isis_passwd));
1117
1118 return CMD_SUCCESS;
1119}
1120
jardineb5d44e2003-12-23 08:09:43 +00001121DEFUN (domain_passwd,
1122 domain_passwd_cmd,
1123 "domain-password WORD",
1124 "Set the authentication password for a routing domain\n"
hassof390d2c2004-09-10 20:48:21 +00001125 "Routing domain password\n")
jardineb5d44e2003-12-23 08:09:43 +00001126{
1127 struct isis_area *area;
1128 int len;
1129
1130 area = vty->index;
1131
hassof390d2c2004-09-10 20:48:21 +00001132 if (!area)
1133 {
1134 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1135 return CMD_WARNING;
1136 }
1137
jardineb5d44e2003-12-23 08:09:43 +00001138 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001139 if (len > 254)
1140 {
1141 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1142 return CMD_WARNING;
1143 }
1144 area->domain_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001145 area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001146 strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001147
hasso1cbc5622005-01-01 10:29:51 +00001148 if (argc > 1)
1149 {
1150 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1151 if (strncmp(argv[1], "v", 1) == 0)
1152 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1153 else
1154 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1155 }
1156 else
1157 {
1158 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1159 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1160 }
1161
jardineb5d44e2003-12-23 08:09:43 +00001162 return CMD_SUCCESS;
1163}
1164
hasso1cbc5622005-01-01 10:29:51 +00001165ALIAS (domain_passwd,
1166 domain_passwd_snpauth_cmd,
1167 "domain-password WORD authenticate snp (send-only|validate)",
1168 "Set the authentication password for a routing domain\n"
1169 "Routing domain password\n"
1170 "Authentication\n"
1171 "SNP PDUs\n"
1172 "Send but do not check PDUs on receiving\n"
1173 "Send and check PDUs on receiving\n");
1174
jardineb5d44e2003-12-23 08:09:43 +00001175DEFUN (no_domain_passwd,
1176 no_domain_passwd_cmd,
1177 "no domain-password WORD",
1178 NO_STR
1179 "Set the authentication password for a routing domain\n")
1180{
1181 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001182
jardineb5d44e2003-12-23 08:09:43 +00001183 area = vty->index;
1184
hassof390d2c2004-09-10 20:48:21 +00001185 if (!area)
1186 {
1187 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1188 return CMD_WARNING;
1189 }
1190
jardineb5d44e2003-12-23 08:09:43 +00001191 memset (&area->domain_passwd, 0, sizeof (struct isis_passwd));
hassof390d2c2004-09-10 20:48:21 +00001192
jardineb5d44e2003-12-23 08:09:43 +00001193 return CMD_SUCCESS;
1194}
1195
1196DEFUN (is_type,
1197 is_type_cmd,
1198 "is-type (level-1|level-1-2|level-2-only)",
1199 "IS Level for this routing process (OSI only)\n"
1200 "Act as a station router only\n"
1201 "Act as both a station router and an area router\n"
1202 "Act as an area router only\n")
1203{
1204 struct isis_area *area;
1205 int type;
1206
1207 area = vty->index;
1208
hassof390d2c2004-09-10 20:48:21 +00001209 if (!area)
1210 {
1211 vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE);
1212 return CMD_WARNING;
1213 }
jardineb5d44e2003-12-23 08:09:43 +00001214
Paul Jakma41b36e92006-12-08 01:09:50 +00001215 type = string2circuit_t (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001216 if (!type)
1217 {
1218 vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
1219 return CMD_SUCCESS;
1220 }
jardineb5d44e2003-12-23 08:09:43 +00001221
1222 isis_event_system_type_change (area, type);
hassof390d2c2004-09-10 20:48:21 +00001223
jardineb5d44e2003-12-23 08:09:43 +00001224 return CMD_SUCCESS;
1225}
1226
1227DEFUN (no_is_type,
1228 no_is_type_cmd,
1229 "no is-type (level-1|level-1-2|level-2-only)",
1230 NO_STR
1231 "IS Level for this routing process (OSI only)\n"
1232 "Act as a station router only\n"
1233 "Act as both a station router and an area router\n"
1234 "Act as an area router only\n")
1235{
jardineb5d44e2003-12-23 08:09:43 +00001236 struct isis_area *area;
1237 int type;
1238
1239 area = vty->index;
1240 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001241
jardineb5d44e2003-12-23 08:09:43 +00001242 /*
1243 * Put the is-type back to default. Which is level-1-2 on first
1244 * circuit for the area level-1 for the rest
1245 */
paul1eb8ef22005-04-07 07:30:20 +00001246 if (listgetdata (listhead (isis->area_list)) == area)
jardineb5d44e2003-12-23 08:09:43 +00001247 type = IS_LEVEL_1_AND_2;
1248 else
1249 type = IS_LEVEL_1;
1250
1251 isis_event_system_type_change (area, type);
1252
1253 return CMD_SUCCESS;
1254}
1255
1256DEFUN (lsp_gen_interval,
1257 lsp_gen_interval_cmd,
1258 "lsp-gen-interval <1-120>",
1259 "Minimum interval between regenerating same LSP\n"
1260 "Minimum interval in seconds\n")
1261{
1262 struct isis_area *area;
1263 uint16_t interval;
1264
1265 area = vty->index;
1266 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001267
jardineb5d44e2003-12-23 08:09:43 +00001268 interval = atoi (argv[0]);
1269 area->lsp_gen_interval[0] = interval;
1270 area->lsp_gen_interval[1] = interval;
1271
1272 return CMD_SUCCESS;
1273}
1274
1275DEFUN (no_lsp_gen_interval,
1276 no_lsp_gen_interval_cmd,
1277 "no lsp-gen-interval",
1278 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001279 "Minimum interval between regenerating same LSP\n")
jardineb5d44e2003-12-23 08:09:43 +00001280{
1281 struct isis_area *area;
1282
1283 area = vty->index;
1284 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001285
jardineb5d44e2003-12-23 08:09:43 +00001286 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
1287 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
1288
1289 return CMD_SUCCESS;
1290}
1291
1292ALIAS (no_lsp_gen_interval,
1293 no_lsp_gen_interval_arg_cmd,
1294 "no lsp-gen-interval <1-120>",
1295 NO_STR
1296 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001297 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001298
1299DEFUN (lsp_gen_interval_l1,
1300 lsp_gen_interval_l1_cmd,
1301 "lsp-gen-interval level-1 <1-120>",
1302 "Minimum interval between regenerating same LSP\n"
1303 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001304 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001305{
1306 struct isis_area *area;
1307 uint16_t interval;
1308
1309 area = vty->index;
1310 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001311
jardineb5d44e2003-12-23 08:09:43 +00001312 interval = atoi (argv[0]);
1313 area->lsp_gen_interval[0] = interval;
1314
1315 return CMD_SUCCESS;
1316}
1317
1318DEFUN (no_lsp_gen_interval_l1,
1319 no_lsp_gen_interval_l1_cmd,
1320 "no lsp-gen-interval level-1",
1321 NO_STR
1322 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001323 "Set interval for level 1 only\n")
jardineb5d44e2003-12-23 08:09:43 +00001324{
1325 struct isis_area *area;
1326
1327 area = vty->index;
1328 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001329
jardineb5d44e2003-12-23 08:09:43 +00001330 area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT;
1331
1332 return CMD_SUCCESS;
1333}
1334
1335ALIAS (no_lsp_gen_interval_l1,
1336 no_lsp_gen_interval_l1_arg_cmd,
1337 "no lsp-gen-interval level-1 <1-120>",
1338 NO_STR
1339 "Minimum interval between regenerating same LSP\n"
1340 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001341 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001342
1343DEFUN (lsp_gen_interval_l2,
1344 lsp_gen_interval_l2_cmd,
1345 "lsp-gen-interval level-2 <1-120>",
1346 "Minimum interval between regenerating same LSP\n"
1347 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001348 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001349{
1350 struct isis_area *area;
1351 int interval;
1352
1353 area = vty->index;
1354 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001355
jardineb5d44e2003-12-23 08:09:43 +00001356 interval = atoi (argv[0]);
1357 area->lsp_gen_interval[1] = interval;
1358
1359 return CMD_SUCCESS;
1360}
1361
1362DEFUN (no_lsp_gen_interval_l2,
1363 no_lsp_gen_interval_l2_cmd,
1364 "no lsp-gen-interval level-2",
1365 NO_STR
1366 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00001367 "Set interval for level 2 only\n")
jardineb5d44e2003-12-23 08:09:43 +00001368{
1369 struct isis_area *area;
1370 int interval;
1371
1372 area = vty->index;
1373 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001374
jardineb5d44e2003-12-23 08:09:43 +00001375 interval = atoi (argv[0]);
1376 area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT;
1377
1378 return CMD_SUCCESS;
1379}
1380
1381ALIAS (no_lsp_gen_interval_l2,
1382 no_lsp_gen_interval_l2_arg_cmd,
1383 "no lsp-gen-interval level-2 <1-120>",
1384 NO_STR
1385 "Minimum interval between regenerating same LSP\n"
1386 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001387 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001388
1389DEFUN (metric_style,
1390 metric_style_cmd,
hasso2984d262005-09-26 16:49:07 +00001391 "metric-style (narrow|transition|wide)",
jardineb5d44e2003-12-23 08:09:43 +00001392 "Use old-style (ISO 10589) or new-style packet formats\n"
1393 "Use old style of TLVs with narrow metric\n"
hasso2984d262005-09-26 16:49:07 +00001394 "Send and accept both styles of TLVs during transition\n"
jardineb5d44e2003-12-23 08:09:43 +00001395 "Use new style of TLVs to carry wider metric\n")
1396{
1397 struct isis_area *area;
1398
1399 area = vty->index;
1400 assert (area);
hasso2984d262005-09-26 16:49:07 +00001401
1402 if (strncmp (argv[0], "w", 1) == 0)
1403 {
1404 area->newmetric = 1;
1405 area->oldmetric = 0;
1406 }
1407 else if (strncmp (argv[0], "t", 1) == 0)
1408 {
1409 area->newmetric = 1;
1410 area->oldmetric = 1;
1411 }
1412 else if (strncmp (argv[0], "n", 1) == 0)
1413 {
1414 area->newmetric = 0;
1415 area->oldmetric = 1;
1416 }
jardineb5d44e2003-12-23 08:09:43 +00001417
1418 return CMD_SUCCESS;
1419}
1420
1421DEFUN (no_metric_style,
1422 no_metric_style_cmd,
hasso2984d262005-09-26 16:49:07 +00001423 "no metric-style",
jardineb5d44e2003-12-23 08:09:43 +00001424 NO_STR
hasso2984d262005-09-26 16:49:07 +00001425 "Use old-style (ISO 10589) or new-style packet formats\n")
jardineb5d44e2003-12-23 08:09:43 +00001426{
1427 struct isis_area *area;
1428
1429 area = vty->index;
1430 assert (area);
1431
hasso2984d262005-09-26 16:49:07 +00001432 /* Default is narrow metric. */
1433 area->newmetric = 0;
1434 area->oldmetric = 1;
jardineb5d44e2003-12-23 08:09:43 +00001435
1436 return CMD_SUCCESS;
1437}
1438
1439DEFUN (dynamic_hostname,
1440 dynamic_hostname_cmd,
1441 "hostname dynamic",
1442 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00001443 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00001444{
1445 struct isis_area *area;
1446
1447 area = vty->index;
1448 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001449
jardineb5d44e2003-12-23 08:09:43 +00001450 area->dynhostname = 1;
hassof390d2c2004-09-10 20:48:21 +00001451
jardineb5d44e2003-12-23 08:09:43 +00001452 return CMD_SUCCESS;
1453}
1454
1455DEFUN (no_dynamic_hostname,
1456 no_dynamic_hostname_cmd,
1457 "no hostname dynamic",
1458 NO_STR
1459 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00001460 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00001461{
1462 struct isis_area *area;
1463
1464 area = vty->index;
1465 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001466
jardineb5d44e2003-12-23 08:09:43 +00001467 area->dynhostname = 0;
hassof390d2c2004-09-10 20:48:21 +00001468
jardineb5d44e2003-12-23 08:09:43 +00001469 return CMD_SUCCESS;
1470}
1471
1472DEFUN (spf_interval,
1473 spf_interval_cmd,
1474 "spf-interval <1-120>",
hasso2097cd82003-12-23 11:51:08 +00001475 "Minimum interval between SPF calculations\n"
jardineb5d44e2003-12-23 08:09:43 +00001476 "Minimum interval between consecutive SPFs in seconds\n")
1477{
1478 struct isis_area *area;
1479 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001480
jardineb5d44e2003-12-23 08:09:43 +00001481 area = vty->index;
1482 interval = atoi (argv[0]);
1483 area->min_spf_interval[0] = interval;
1484 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001485
jardineb5d44e2003-12-23 08:09:43 +00001486 return CMD_SUCCESS;
1487}
1488
1489DEFUN (no_spf_interval,
1490 no_spf_interval_cmd,
1491 "no spf-interval",
1492 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001493 "Minimum interval between SPF calculations\n")
jardineb5d44e2003-12-23 08:09:43 +00001494{
1495 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001496
jardineb5d44e2003-12-23 08:09:43 +00001497 area = vty->index;
1498
1499 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
1500 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001501
jardineb5d44e2003-12-23 08:09:43 +00001502 return CMD_SUCCESS;
1503}
1504
1505ALIAS (no_spf_interval,
1506 no_spf_interval_arg_cmd,
1507 "no spf-interval <1-120>",
1508 NO_STR
1509 "Minimum interval between SPF calculations\n"
hassof390d2c2004-09-10 20:48:21 +00001510 "Minimum interval between consecutive SPFs in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001511
1512DEFUN (spf_interval_l1,
1513 spf_interval_l1_cmd,
1514 "spf-interval level-1 <1-120>",
1515 "Minimum interval between SPF calculations\n"
1516 "Set interval for level 1 only\n"
1517 "Minimum interval between consecutive SPFs in seconds\n")
1518{
1519 struct isis_area *area;
1520 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001521
jardineb5d44e2003-12-23 08:09:43 +00001522 area = vty->index;
1523 interval = atoi (argv[0]);
1524 area->min_spf_interval[0] = interval;
hassof390d2c2004-09-10 20:48:21 +00001525
jardineb5d44e2003-12-23 08:09:43 +00001526 return CMD_SUCCESS;
1527}
1528
1529DEFUN (no_spf_interval_l1,
1530 no_spf_interval_l1_cmd,
1531 "no spf-interval level-1",
1532 NO_STR
1533 "Minimum interval between SPF calculations\n"
1534 "Set interval for level 1 only\n")
1535{
1536 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001537
jardineb5d44e2003-12-23 08:09:43 +00001538 area = vty->index;
1539
1540 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001541
jardineb5d44e2003-12-23 08:09:43 +00001542 return CMD_SUCCESS;
1543}
1544
1545ALIAS (no_spf_interval,
1546 no_spf_interval_l1_arg_cmd,
1547 "no spf-interval level-1 <1-120>",
1548 NO_STR
1549 "Minimum interval between SPF calculations\n"
1550 "Set interval for level 1 only\n"
1551 "Minimum interval between consecutive SPFs in seconds\n")
1552
1553DEFUN (spf_interval_l2,
1554 spf_interval_l2_cmd,
1555 "spf-interval level-2 <1-120>",
1556 "Minimum interval between SPF calculations\n"
1557 "Set interval for level 2 only\n"
1558 "Minimum interval between consecutive SPFs in seconds\n")
1559{
1560 struct isis_area *area;
1561 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00001562
jardineb5d44e2003-12-23 08:09:43 +00001563 area = vty->index;
1564 interval = atoi (argv[0]);
1565 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001566
jardineb5d44e2003-12-23 08:09:43 +00001567 return CMD_SUCCESS;
1568}
1569
1570DEFUN (no_spf_interval_l2,
1571 no_spf_interval_l2_cmd,
1572 "no spf-interval level-2",
1573 NO_STR
1574 "Minimum interval between SPF calculations\n"
1575 "Set interval for level 2 only\n")
1576{
1577 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001578
jardineb5d44e2003-12-23 08:09:43 +00001579 area = vty->index;
1580
1581 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00001582
jardineb5d44e2003-12-23 08:09:43 +00001583 return CMD_SUCCESS;
1584}
1585
1586ALIAS (no_spf_interval,
1587 no_spf_interval_l2_arg_cmd,
1588 "no spf-interval level-2 <1-120>",
1589 NO_STR
1590 "Minimum interval between SPF calculations\n"
1591 "Set interval for level 2 only\n"
1592 "Minimum interval between consecutive SPFs in seconds\n")
1593
jardineb5d44e2003-12-23 08:09:43 +00001594#ifdef TOPOLOGY_GENERATE
1595DEFUN (topology_generate_grid,
1596 topology_generate_grid_cmd,
1597 "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "
1598 "[param]",
hassof1082d12005-09-19 04:23:34 +00001599 "Topology generation for IS-IS\n"
1600 "Topology generation\n"
1601 "Grid topology\n"
jardineb5d44e2003-12-23 08:09:43 +00001602 "X parameter of the grid\n"
1603 "Y parameter of the grid\n"
1604 "Random seed\n"
1605 "Optional param 1\n"
1606 "Optional param 2\n"
1607 "Optional param 3\n"
1608 "Topology\n")
1609{
1610 struct isis_area *area;
1611
1612 area = vty->index;
1613 assert (area);
1614
hassof390d2c2004-09-10 20:48:21 +00001615 if (!spgrid_check_params (vty, argc, argv))
1616 {
1617 if (area->topology)
1618 list_delete (area->topology);
1619 area->topology = list_new ();
1620 memcpy (area->top_params, vty->buf, 200);
1621 gen_spgrid_topology (vty, area->topology);
1622 remove_topology_lsps (area);
1623 generate_topology_lsps (area);
hassof1082d12005-09-19 04:23:34 +00001624 /* Regenerate L1 LSP to get two way connection to the generated
1625 * topology. */
1626 lsp_regenerate_schedule (area);
hassof390d2c2004-09-10 20:48:21 +00001627 }
jardineb5d44e2003-12-23 08:09:43 +00001628
1629 return CMD_SUCCESS;
1630}
1631
hassof695b012005-04-02 19:03:39 +00001632DEFUN (show_isis_generated_topology,
1633 show_isis_generated_topology_cmd,
hassof1082d12005-09-19 04:23:34 +00001634 "show isis generated-topologies",
jardineb5d44e2003-12-23 08:09:43 +00001635 SHOW_STR
hassof1082d12005-09-19 04:23:34 +00001636 "CLNS network information\n"
1637 "Show generated topologies\n")
jardineb5d44e2003-12-23 08:09:43 +00001638{
1639 struct isis_area *area;
paul92c9f222005-05-25 12:21:13 +00001640 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +00001641 struct listnode *node2;
1642 struct arc *arc;
hassof1082d12005-09-19 04:23:34 +00001643
paul92c9f222005-05-25 12:21:13 +00001644 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof1082d12005-09-19 04:23:34 +00001645 {
1646 if (!area->topology)
1647 continue;
1648
1649 vty_out (vty, "Topology for isis area: %s%s", area->area_tag,
1650 VTY_NEWLINE);
1651 vty_out (vty, "From node To node Distance%s", VTY_NEWLINE);
1652
1653 for (ALL_LIST_ELEMENTS_RO (area->topology, node2, arc))
1654 vty_out (vty, "%9ld %11ld %12ld%s", arc->from_node, arc->to_node,
1655 arc->distance, VTY_NEWLINE);
1656 }
jardineb5d44e2003-12-23 08:09:43 +00001657 return CMD_SUCCESS;
1658}
1659
hassof1082d12005-09-19 04:23:34 +00001660/* Base IS for topology generation. */
hassof390d2c2004-09-10 20:48:21 +00001661DEFUN (topology_baseis,
jardineb5d44e2003-12-23 08:09:43 +00001662 topology_baseis_cmd,
1663 "topology base-is WORD",
hassof1082d12005-09-19 04:23:34 +00001664 "Topology generation for IS-IS\n"
1665 "A Network IS Base for this topology\n"
1666 "XXXX.XXXX.XXXX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001667{
1668 struct isis_area *area;
1669 u_char buff[ISIS_SYS_ID_LEN];
1670
1671 area = vty->index;
1672 assert (area);
1673
hassof390d2c2004-09-10 20:48:21 +00001674 if (sysid2buff (buff, argv[0]))
hassof1082d12005-09-19 04:23:34 +00001675 sysid2buff (area->topology_baseis, argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001676
jardineb5d44e2003-12-23 08:09:43 +00001677 return CMD_SUCCESS;
1678}
1679
jardineb5d44e2003-12-23 08:09:43 +00001680DEFUN (no_topology_baseis,
1681 no_topology_baseis_cmd,
1682 "no topology base-is WORD",
1683 NO_STR
hassof1082d12005-09-19 04:23:34 +00001684 "Topology generation for IS-IS\n"
1685 "A Network IS Base for this topology\n"
1686 "XXXX.XXXX.XXXX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001687{
1688 struct isis_area *area;
1689
1690 area = vty->index;
1691 assert (area);
1692
hassof390d2c2004-09-10 20:48:21 +00001693 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
jardineb5d44e2003-12-23 08:09:43 +00001694 return CMD_SUCCESS;
1695}
1696
hassof1082d12005-09-19 04:23:34 +00001697ALIAS (no_topology_baseis,
1698 no_topology_baseis_noid_cmd,
1699 "no topology base-is",
1700 NO_STR
1701 "Topology generation for IS-IS\n"
1702 "A Network IS Base for this topology\n")
1703
1704DEFUN (topology_basedynh,
1705 topology_basedynh_cmd,
1706 "topology base-dynh WORD",
1707 "Topology generation for IS-IS\n"
1708 "Dynamic hostname base for this topology\n"
1709 "Dynamic hostname base\n")
1710{
1711 struct isis_area *area;
1712
1713 area = vty->index;
1714 assert (area);
1715
1716 /* I hope that it's enough. */
1717 area->topology_basedynh = strndup (argv[0], 16);
1718 return CMD_SUCCESS;
1719}
jardineb5d44e2003-12-23 08:09:43 +00001720#endif /* TOPOLOGY_GENERATE */
1721
1722DEFUN (lsp_lifetime,
1723 lsp_lifetime_cmd,
1724 "lsp-lifetime <380-65535>",
1725 "Maximum LSP lifetime\n"
hassof390d2c2004-09-10 20:48:21 +00001726 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001727{
1728 struct isis_area *area;
1729 uint16_t interval;
1730
1731 area = vty->index;
1732 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001733
jardineb5d44e2003-12-23 08:09:43 +00001734 interval = atoi (argv[0]);
1735
hassof390d2c2004-09-10 20:48:21 +00001736 if (interval < ISIS_MIN_LSP_LIFETIME)
1737 {
1738 vty_out (vty, "LSP lifetime (%us) below %us%s",
1739 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001740
hassof390d2c2004-09-10 20:48:21 +00001741 return CMD_WARNING;
1742 }
jardineb5d44e2003-12-23 08:09:43 +00001743
1744
1745 area->max_lsp_lifetime[0] = interval;
1746 area->max_lsp_lifetime[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00001747 area->lsp_refresh[0] = interval - 300;
1748 area->lsp_refresh[1] = interval - 300;
jardineb5d44e2003-12-23 08:09:43 +00001749
hassof390d2c2004-09-10 20:48:21 +00001750 if (area->t_lsp_refresh[0])
1751 {
1752 thread_cancel (area->t_lsp_refresh[0]);
1753 thread_execute (master, lsp_refresh_l1, area, 0);
1754 }
jardineb5d44e2003-12-23 08:09:43 +00001755
hassof390d2c2004-09-10 20:48:21 +00001756 if (area->t_lsp_refresh[1])
1757 {
1758 thread_cancel (area->t_lsp_refresh[1]);
1759 thread_execute (master, lsp_refresh_l2, area, 0);
1760 }
jardineb5d44e2003-12-23 08:09:43 +00001761
1762
1763 return CMD_SUCCESS;
1764}
1765
1766DEFUN (no_lsp_lifetime,
1767 no_lsp_lifetime_cmd,
1768 "no lsp-lifetime",
1769 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001770 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001771{
1772 struct isis_area *area;
1773
1774 area = vty->index;
1775 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001776
1777 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */
1778 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */
1779 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */
1780 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001781
1782 return CMD_SUCCESS;
1783}
1784
1785ALIAS (no_lsp_lifetime,
1786 no_lsp_lifetime_arg_cmd,
1787 "no lsp-lifetime <380-65535>",
1788 NO_STR
1789 "Maximum LSP lifetime\n"
hassof390d2c2004-09-10 20:48:21 +00001790 "LSP lifetime in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001791
1792DEFUN (lsp_lifetime_l1,
1793 lsp_lifetime_l1_cmd,
1794 "lsp-lifetime level-1 <380-65535>",
1795 "Maximum LSP lifetime for Level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001796 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001797{
1798 struct isis_area *area;
1799 uint16_t interval;
1800
1801 area = vty->index;
1802 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001803
jardineb5d44e2003-12-23 08:09:43 +00001804 interval = atoi (argv[0]);
1805
hassof390d2c2004-09-10 20:48:21 +00001806 if (interval < ISIS_MIN_LSP_LIFETIME)
1807 {
1808 vty_out (vty, "Level-1 LSP lifetime (%us) below %us%s",
1809 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001810
hassof390d2c2004-09-10 20:48:21 +00001811 return CMD_WARNING;
1812 }
jardineb5d44e2003-12-23 08:09:43 +00001813
1814
1815 area->max_lsp_lifetime[0] = interval;
hassof390d2c2004-09-10 20:48:21 +00001816 area->lsp_refresh[0] = interval - 300;
jardineb5d44e2003-12-23 08:09:43 +00001817
1818 return CMD_SUCCESS;
1819}
1820
1821DEFUN (no_lsp_lifetime_l1,
1822 no_lsp_lifetime_l1_cmd,
1823 "no lsp-lifetime level-1",
1824 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001825 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001826{
1827 struct isis_area *area;
1828
1829 area = vty->index;
1830 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001831
1832 area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */
1833 area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001834
1835 return CMD_SUCCESS;
1836}
1837
1838ALIAS (no_lsp_lifetime_l1,
1839 no_lsp_lifetime_l1_arg_cmd,
1840 "no lsp-lifetime level-1 <380-65535>",
1841 NO_STR
1842 "Maximum LSP lifetime for Level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00001843 "LSP lifetime for Level 1 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001844
1845DEFUN (lsp_lifetime_l2,
1846 lsp_lifetime_l2_cmd,
1847 "lsp-lifetime level-2 <380-65535>",
1848 "Maximum LSP lifetime for Level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001849 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001850{
1851 struct isis_area *area;
1852 uint16_t interval;
1853
1854 area = vty->index;
1855 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001856
jardineb5d44e2003-12-23 08:09:43 +00001857 interval = atoi (argv[0]);
1858
hassof390d2c2004-09-10 20:48:21 +00001859 if (interval < ISIS_MIN_LSP_LIFETIME)
1860 {
1861 vty_out (vty, "Level-2 LSP lifetime (%us) below %us%s",
1862 interval, ISIS_MIN_LSP_LIFETIME, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +00001863
hassof390d2c2004-09-10 20:48:21 +00001864 return CMD_WARNING;
1865 }
jardineb5d44e2003-12-23 08:09:43 +00001866
1867 area->max_lsp_lifetime[1] = interval;
1868 area->lsp_refresh[1] = interval - 300;
1869
1870 return CMD_SUCCESS;
1871}
1872
1873DEFUN (no_lsp_lifetime_l2,
1874 no_lsp_lifetime_l2_cmd,
1875 "no lsp-lifetime level-2",
1876 NO_STR
hassof390d2c2004-09-10 20:48:21 +00001877 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001878{
1879 struct isis_area *area;
1880
1881 area = vty->index;
1882 assert (area);
hassof390d2c2004-09-10 20:48:21 +00001883
1884 area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */
1885 area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */
jardineb5d44e2003-12-23 08:09:43 +00001886
1887 return CMD_SUCCESS;
1888}
1889
1890ALIAS (no_lsp_lifetime_l2,
1891 no_lsp_lifetime_l2_arg_cmd,
1892 "no lsp-lifetime level-2 <380-65535>",
1893 NO_STR
1894 "Maximum LSP lifetime for Level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00001895 "LSP lifetime for Level 2 only in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00001896
1897/* IS-IS configuration write function */
1898int
1899isis_config_write (struct vty *vty)
1900{
1901 int write = 0;
jardineb5d44e2003-12-23 08:09:43 +00001902
hassof390d2c2004-09-10 20:48:21 +00001903 if (isis != NULL)
1904 {
1905 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +00001906 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +00001907
hasso3fdb2dd2005-09-28 18:45:54 +00001908 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +00001909 {
1910 /* ISIS - Area name */
1911 vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE);
1912 write++;
1913 /* ISIS - Net */
1914 if (listcount (area->area_addrs) > 0)
1915 {
1916 struct area_addr *area_addr;
hasso3fdb2dd2005-09-28 18:45:54 +00001917 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
1918 {
1919 vty_out (vty, " net %s%s",
1920 isonet_print (area_addr->area_addr,
1921 area_addr->addr_len + ISIS_SYS_ID_LEN +
1922 1), VTY_NEWLINE);
1923 write++;
1924 }
hassof390d2c2004-09-10 20:48:21 +00001925 }
hasso3fdb2dd2005-09-28 18:45:54 +00001926 /* ISIS - Dynamic hostname - Defaults to true so only display if
1927 * false. */
hassof390d2c2004-09-10 20:48:21 +00001928 if (!area->dynhostname)
1929 {
1930 vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);
1931 write++;
1932 }
1933 /* ISIS - Metric-Style - when true displays wide */
1934 if (area->newmetric)
1935 {
hasso2984d262005-09-26 16:49:07 +00001936 if (!area->oldmetric)
1937 vty_out (vty, " metric-style wide%s", VTY_NEWLINE);
1938 else
1939 vty_out (vty, " metric-style transition%s", VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +00001940 write++;
1941 }
hasso2984d262005-09-26 16:49:07 +00001942
hassof390d2c2004-09-10 20:48:21 +00001943 /* ISIS - Area is-type (level-1-2 is default) */
1944 if (area->is_type == IS_LEVEL_1)
1945 {
1946 vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
1947 write++;
1948 }
1949 else
1950 {
1951 if (area->is_type == IS_LEVEL_2)
1952 {
1953 vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
1954 write++;
1955 }
1956 }
1957 /* ISIS - Lsp generation interval */
1958 if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1])
1959 {
1960 if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT)
1961 {
1962 vty_out (vty, " lsp-gen-interval %d%s",
1963 area->lsp_gen_interval[0], VTY_NEWLINE);
1964 write++;
1965 }
1966 }
1967 else
1968 {
1969 if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT)
1970 {
1971 vty_out (vty, " lsp-gen-interval level-1 %d%s",
1972 area->lsp_gen_interval[0], VTY_NEWLINE);
1973 write++;
1974 }
1975 if (area->lsp_gen_interval[1] != LSP_GEN_INTERVAL_DEFAULT)
1976 {
1977 vty_out (vty, " lsp-gen-interval level-2 %d%s",
1978 area->lsp_gen_interval[1], VTY_NEWLINE);
1979 write++;
1980 }
1981 }
1982 /* ISIS - LSP lifetime */
1983 if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1])
1984 {
1985 if (area->max_lsp_lifetime[0] != MAX_AGE)
1986 {
1987 vty_out (vty, " lsp-lifetime %u%s", area->max_lsp_lifetime[0],
1988 VTY_NEWLINE);
1989 write++;
1990 }
1991 }
1992 else
1993 {
1994 if (area->max_lsp_lifetime[0] != MAX_AGE)
1995 {
1996 vty_out (vty, " lsp-lifetime level-1 %u%s",
1997 area->max_lsp_lifetime[0], VTY_NEWLINE);
1998 write++;
1999 }
2000 if (area->max_lsp_lifetime[1] != MAX_AGE)
2001 {
2002 vty_out (vty, " lsp-lifetime level-2 %u%s",
2003 area->max_lsp_lifetime[1], VTY_NEWLINE);
2004 write++;
2005 }
2006 }
hasso13fb40a2005-10-01 06:03:04 +00002007 /* Minimum SPF interval. */
2008 if (area->min_spf_interval[0] == area->min_spf_interval[1])
2009 {
2010 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
2011 {
2012 vty_out (vty, " spf-interval %d%s",
2013 area->min_spf_interval[0], VTY_NEWLINE);
2014 write++;
2015 }
2016 }
2017 else
2018 {
2019 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
2020 {
2021 vty_out (vty, " spf-interval level-1 %d%s",
2022 area->min_spf_interval[0], VTY_NEWLINE);
2023 write++;
2024 }
2025 if (area->min_spf_interval[1] != MINIMUM_SPF_INTERVAL)
2026 {
2027 vty_out (vty, " spf-interval level-2 %d%s",
2028 area->min_spf_interval[1], VTY_NEWLINE);
2029 write++;
2030 }
2031 }
hasso53c997c2004-09-15 16:21:59 +00002032 /* Authentication passwords. */
2033 if (area->area_passwd.len > 0)
2034 {
hasso1cbc5622005-01-01 10:29:51 +00002035 vty_out(vty, " area-password %s", area->area_passwd.passwd);
2036 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
2037 {
2038 vty_out(vty, " authenticate snp ");
2039 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
2040 vty_out(vty, "validate");
2041 else
2042 vty_out(vty, "send-only");
2043 }
2044 vty_out(vty, "%s", VTY_NEWLINE);
hasso53c997c2004-09-15 16:21:59 +00002045 write++;
2046 }
2047 if (area->domain_passwd.len > 0)
2048 {
hasso1cbc5622005-01-01 10:29:51 +00002049 vty_out(vty, " domain-password %s", area->domain_passwd.passwd);
2050 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
2051 {
2052 vty_out(vty, " authenticate snp ");
2053 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
2054 vty_out(vty, "validate");
2055 else
2056 vty_out(vty, "send-only");
2057 }
2058 vty_out(vty, "%s", VTY_NEWLINE);
hasso53c997c2004-09-15 16:21:59 +00002059 write++;
2060 }
hassof1082d12005-09-19 04:23:34 +00002061
hassof390d2c2004-09-10 20:48:21 +00002062#ifdef TOPOLOGY_GENERATE
hassof1082d12005-09-19 04:23:34 +00002063 if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,
2064 ISIS_SYS_ID_LEN))
2065 {
2066 vty_out (vty, " topology base-is %s%s",
2067 sysid_print (area->topology_baseis), VTY_NEWLINE);
2068 write++;
2069 }
2070 if (area->topology_basedynh)
2071 {
2072 vty_out (vty, " topology base-dynh %s%s",
2073 area->topology_basedynh, VTY_NEWLINE);
2074 write++;
2075 }
2076 /* We save the whole command line here. */
2077 if (strlen(area->top_params))
hassof390d2c2004-09-10 20:48:21 +00002078 {
2079 vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE);
2080 write++;
2081 }
hassof390d2c2004-09-10 20:48:21 +00002082#endif /* TOPOLOGY_GENERATE */
hassof1082d12005-09-19 04:23:34 +00002083
hassof390d2c2004-09-10 20:48:21 +00002084 }
jardineb5d44e2003-12-23 08:09:43 +00002085 }
hassof390d2c2004-09-10 20:48:21 +00002086
jardineb5d44e2003-12-23 08:09:43 +00002087 return write;
2088}
2089
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08002090static struct cmd_node isis_node = {
jardineb5d44e2003-12-23 08:09:43 +00002091 ISIS_NODE,
hasso2097cd82003-12-23 11:51:08 +00002092 "%s(config-router)# ",
jardineb5d44e2003-12-23 08:09:43 +00002093 1
2094};
2095
hassof390d2c2004-09-10 20:48:21 +00002096void
jardineb5d44e2003-12-23 08:09:43 +00002097isis_init ()
2098{
jardineb5d44e2003-12-23 08:09:43 +00002099 /* Install IS-IS top node */
2100 install_node (&isis_node, isis_config_write);
hassof390d2c2004-09-10 20:48:21 +00002101
jardineb5d44e2003-12-23 08:09:43 +00002102 install_element (VIEW_NODE, &show_clns_neighbors_cmd);
2103 install_element (VIEW_NODE, &show_isis_neighbors_cmd);
2104 install_element (VIEW_NODE, &show_clns_neighbors_detail_cmd);
2105 install_element (VIEW_NODE, &show_isis_neighbors_detail_cmd);
2106
2107 install_element (VIEW_NODE, &show_hostname_cmd);
2108 install_element (VIEW_NODE, &show_database_cmd);
2109 install_element (VIEW_NODE, &show_database_detail_cmd);
2110
2111 install_element (ENABLE_NODE, &show_clns_neighbors_cmd);
2112 install_element (ENABLE_NODE, &show_isis_neighbors_cmd);
2113 install_element (ENABLE_NODE, &show_clns_neighbors_detail_cmd);
2114 install_element (ENABLE_NODE, &show_isis_neighbors_detail_cmd);
2115
2116 install_element (ENABLE_NODE, &show_hostname_cmd);
2117 install_element (ENABLE_NODE, &show_database_cmd);
2118 install_element (ENABLE_NODE, &show_database_detail_cmd);
2119 install_element (ENABLE_NODE, &show_debugging_cmd);
2120
hassof390d2c2004-09-10 20:48:21 +00002121 install_node (&debug_node, config_write_debug);
jardin9e867fe2003-12-23 08:56:18 +00002122
jardineb5d44e2003-12-23 08:09:43 +00002123 install_element (ENABLE_NODE, &debug_isis_adj_cmd);
2124 install_element (ENABLE_NODE, &no_debug_isis_adj_cmd);
2125 install_element (ENABLE_NODE, &debug_isis_csum_cmd);
2126 install_element (ENABLE_NODE, &no_debug_isis_csum_cmd);
2127 install_element (ENABLE_NODE, &debug_isis_lupd_cmd);
2128 install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd);
2129 install_element (ENABLE_NODE, &debug_isis_err_cmd);
2130 install_element (ENABLE_NODE, &no_debug_isis_err_cmd);
2131 install_element (ENABLE_NODE, &debug_isis_snp_cmd);
2132 install_element (ENABLE_NODE, &no_debug_isis_snp_cmd);
2133 install_element (ENABLE_NODE, &debug_isis_upd_cmd);
2134 install_element (ENABLE_NODE, &no_debug_isis_upd_cmd);
2135 install_element (ENABLE_NODE, &debug_isis_spfevents_cmd);
2136 install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd);
2137 install_element (ENABLE_NODE, &debug_isis_spfstats_cmd);
2138 install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd);
2139 install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd);
2140 install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd);
2141 install_element (ENABLE_NODE, &debug_isis_rtevents_cmd);
2142 install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);
2143 install_element (ENABLE_NODE, &debug_isis_events_cmd);
2144 install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
2145
jardin9e867fe2003-12-23 08:56:18 +00002146 install_element (CONFIG_NODE, &debug_isis_adj_cmd);
2147 install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);
2148 install_element (CONFIG_NODE, &debug_isis_csum_cmd);
2149 install_element (CONFIG_NODE, &no_debug_isis_csum_cmd);
2150 install_element (CONFIG_NODE, &debug_isis_lupd_cmd);
2151 install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd);
2152 install_element (CONFIG_NODE, &debug_isis_err_cmd);
2153 install_element (CONFIG_NODE, &no_debug_isis_err_cmd);
2154 install_element (CONFIG_NODE, &debug_isis_snp_cmd);
2155 install_element (CONFIG_NODE, &no_debug_isis_snp_cmd);
2156 install_element (CONFIG_NODE, &debug_isis_upd_cmd);
2157 install_element (CONFIG_NODE, &no_debug_isis_upd_cmd);
2158 install_element (CONFIG_NODE, &debug_isis_spfevents_cmd);
2159 install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd);
2160 install_element (CONFIG_NODE, &debug_isis_spfstats_cmd);
2161 install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd);
2162 install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd);
2163 install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd);
2164 install_element (CONFIG_NODE, &debug_isis_rtevents_cmd);
2165 install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);
2166 install_element (CONFIG_NODE, &debug_isis_events_cmd);
2167 install_element (CONFIG_NODE, &no_debug_isis_events_cmd);
2168
jardineb5d44e2003-12-23 08:09:43 +00002169 install_element (CONFIG_NODE, &router_isis_cmd);
2170 install_element (CONFIG_NODE, &no_router_isis_cmd);
2171
2172 install_default (ISIS_NODE);
2173
2174 install_element (ISIS_NODE, &net_cmd);
2175 install_element (ISIS_NODE, &no_net_cmd);
2176
2177 install_element (ISIS_NODE, &is_type_cmd);
2178 install_element (ISIS_NODE, &no_is_type_cmd);
2179
2180 install_element (ISIS_NODE, &area_passwd_cmd);
hasso1cbc5622005-01-01 10:29:51 +00002181 install_element (ISIS_NODE, &area_passwd_snpauth_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002182 install_element (ISIS_NODE, &no_area_passwd_cmd);
2183
2184 install_element (ISIS_NODE, &domain_passwd_cmd);
hasso1cbc5622005-01-01 10:29:51 +00002185 install_element (ISIS_NODE, &domain_passwd_snpauth_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002186 install_element (ISIS_NODE, &no_domain_passwd_cmd);
2187
2188 install_element (ISIS_NODE, &lsp_gen_interval_cmd);
2189 install_element (ISIS_NODE, &no_lsp_gen_interval_cmd);
2190 install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd);
2191 install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd);
2192 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd);
2193 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd);
2194 install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd);
2195 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd);
2196 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd);
2197
2198 install_element (ISIS_NODE, &spf_interval_cmd);
2199 install_element (ISIS_NODE, &no_spf_interval_cmd);
2200 install_element (ISIS_NODE, &no_spf_interval_arg_cmd);
2201 install_element (ISIS_NODE, &spf_interval_l1_cmd);
2202 install_element (ISIS_NODE, &no_spf_interval_l1_cmd);
2203 install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd);
2204 install_element (ISIS_NODE, &spf_interval_l2_cmd);
2205 install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
2206 install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
hassof390d2c2004-09-10 20:48:21 +00002207
jardineb5d44e2003-12-23 08:09:43 +00002208 install_element (ISIS_NODE, &lsp_lifetime_cmd);
2209 install_element (ISIS_NODE, &no_lsp_lifetime_cmd);
2210 install_element (ISIS_NODE, &no_lsp_lifetime_arg_cmd);
2211 install_element (ISIS_NODE, &lsp_lifetime_l1_cmd);
2212 install_element (ISIS_NODE, &no_lsp_lifetime_l1_cmd);
2213 install_element (ISIS_NODE, &no_lsp_lifetime_l1_arg_cmd);
2214 install_element (ISIS_NODE, &lsp_lifetime_l2_cmd);
2215 install_element (ISIS_NODE, &no_lsp_lifetime_l2_cmd);
2216 install_element (ISIS_NODE, &no_lsp_lifetime_l2_arg_cmd);
2217
2218 install_element (ISIS_NODE, &dynamic_hostname_cmd);
2219 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
2220
2221 install_element (ISIS_NODE, &metric_style_cmd);
2222 install_element (ISIS_NODE, &no_metric_style_cmd);
2223#ifdef TOPOLOGY_GENERATE
2224 install_element (ISIS_NODE, &topology_generate_grid_cmd);
2225 install_element (ISIS_NODE, &topology_baseis_cmd);
hassof1082d12005-09-19 04:23:34 +00002226 install_element (ISIS_NODE, &topology_basedynh_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002227 install_element (ISIS_NODE, &no_topology_baseis_cmd);
hassof1082d12005-09-19 04:23:34 +00002228 install_element (ISIS_NODE, &no_topology_baseis_noid_cmd);
hassof695b012005-04-02 19:03:39 +00002229 install_element (VIEW_NODE, &show_isis_generated_topology_cmd);
2230 install_element (ENABLE_NODE, &show_isis_generated_topology_cmd);
jardineb5d44e2003-12-23 08:09:43 +00002231#endif /* TOPOLOGY_GENERATE */
2232
hassof390d2c2004-09-10 20:48:21 +00002233 isis_new (0);
jardineb5d44e2003-12-23 08:09:43 +00002234 isis_circuit_init ();
2235 isis_zebra_init ();
2236 isis_spf_cmds_init ();
2237}