blob: 0a5286e342f2c349a1a0ab99bb40e663bb3b512b [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"
Josh Bailey3f045a02012-03-24 08:35:20 -070030#include "time.h"
jardineb5d44e2003-12-23 08:09:43 +000031#include "linklist.h"
32#include "if.h"
33#include "hash.h"
34#include "stream.h"
35#include "prefix.h"
36#include "table.h"
37
38#include "isisd/dict.h"
39#include "isisd/include-netbsd/iso.h"
40#include "isisd/isis_constants.h"
41#include "isisd/isis_common.h"
jardineb5d44e2003-12-23 08:09:43 +000042#include "isisd/isis_flags.h"
Josh Bailey3f045a02012-03-24 08:35:20 -070043#include "isisd/isis_circuit.h"
44#include "isisd/isis_csm.h"
jardineb5d44e2003-12-23 08:09:43 +000045#include "isisd/isisd.h"
46#include "isisd/isis_dynhn.h"
47#include "isisd/isis_adjacency.h"
48#include "isisd/isis_pdu.h"
49#include "isisd/isis_misc.h"
50#include "isisd/isis_constants.h"
51#include "isisd/isis_tlv.h"
52#include "isisd/isis_lsp.h"
53#include "isisd/isis_spf.h"
54#include "isisd/isis_route.h"
55#include "isisd/isis_zebra.h"
56#include "isisd/isis_events.h"
57
58#ifdef TOPOLOGY_GENERATE
59#include "spgrid.h"
hassof390d2c2004-09-10 20:48:21 +000060u_char DEFAULT_TOPOLOGY_BASEIS[6] = { 0xFE, 0xED, 0xFE, 0xED, 0x00, 0x00 };
jardineb5d44e2003-12-23 08:09:43 +000061#endif /* TOPOLOGY_GENERATE */
62
jardineb5d44e2003-12-23 08:09:43 +000063struct isis *isis = NULL;
jardineb5d44e2003-12-23 08:09:43 +000064
Paul Jakma41b36e92006-12-08 01:09:50 +000065/*
66 * Prototypes.
67 */
Paul Jakma41b36e92006-12-08 01:09:50 +000068int isis_area_get(struct vty *, const char *);
69int isis_area_destroy(struct vty *, const char *);
Josh Bailey3f045a02012-03-24 08:35:20 -070070int area_net_title(struct vty *, const char *);
71int area_clear_net_title(struct vty *, const char *);
72int show_isis_interface_common(struct vty *, const char *ifname, char);
73int show_isis_neighbor_common(struct vty *, const char *id, char);
74int clear_isis_neighbor_common(struct vty *, const char *id);
Paul Jakma41b36e92006-12-08 01:09:50 +000075int 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;
jardineb5d44e2003-12-23 08:09:43 +000087 isis->process_id = process_id;
Josh Bailey3f045a02012-03-24 08:35:20 -070088 isis->router_id = 0;
jardineb5d44e2003-12-23 08:09:43 +000089 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 */
Josh Bailey3f045a02012-03-24 08:35:20 -070096 dyn_cache_init ();
jardineb5d44e2003-12-23 08:09:43 +000097 /*
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 *
Josh Bailey3f045a02012-03-24 08:35:20 -0700104isis_area_create (const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000105{
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;
Josh Bailey3f045a02012-03-24 08:35:20 -0700118
jardineb5d44e2003-12-23 08:09:43 +0000119 /*
120 * intialize the databases
121 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700122 if (area->is_type & IS_LEVEL_1)
123 {
124 area->lspdb[0] = lsp_db_init ();
125 area->route_table[0] = route_table_init ();
126#ifdef HAVE_IPV6
127 area->route_table6[0] = route_table_init ();
128#endif /* HAVE_IPV6 */
129 }
130 if (area->is_type & IS_LEVEL_2)
131 {
132 area->lspdb[1] = lsp_db_init ();
133 area->route_table[1] = route_table_init ();
134#ifdef HAVE_IPV6
135 area->route_table6[1] = route_table_init ();
136#endif /* HAVE_IPV6 */
137 }
hassof390d2c2004-09-10 20:48:21 +0000138
jardineb5d44e2003-12-23 08:09:43 +0000139 spftree_area_init (area);
Josh Bailey3f045a02012-03-24 08:35:20 -0700140
jardineb5d44e2003-12-23 08:09:43 +0000141 area->circuit_list = list_new ();
142 area->area_addrs = list_new ();
hassof390d2c2004-09-10 20:48:21 +0000143 THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1);
Paul Jakmac7350c42008-01-29 19:29:44 +0000144 flags_initialize (&area->flags);
Josh Bailey3f045a02012-03-24 08:35:20 -0700145
jardineb5d44e2003-12-23 08:09:43 +0000146 /*
147 * Default values
148 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700149 area->max_lsp_lifetime[0] = DEFAULT_LSP_LIFETIME; /* 1200 */
150 area->max_lsp_lifetime[1] = DEFAULT_LSP_LIFETIME; /* 1200 */
151 area->lsp_refresh[0] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
152 area->lsp_refresh[1] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
153 area->lsp_gen_interval[0] = DEFAULT_MIN_LSP_GEN_INTERVAL;
154 area->lsp_gen_interval[1] = DEFAULT_MIN_LSP_GEN_INTERVAL;
jardineb5d44e2003-12-23 08:09:43 +0000155 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
156 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
157 area->dynhostname = 1;
Josh Bailey3f045a02012-03-24 08:35:20 -0700158 area->oldmetric = 0;
159 area->newmetric = 1;
jardineb5d44e2003-12-23 08:09:43 +0000160 area->lsp_frag_threshold = 90;
Christian Frankef1fc1db2015-11-10 18:43:31 +0100161 area->lsp_mtu = DEFAULT_LSP_MTU;
jardineb5d44e2003-12-23 08:09:43 +0000162#ifdef TOPOLOGY_GENERATE
163 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
164#endif /* TOPOLOGY_GENERATE */
165
Josh Bailey3f045a02012-03-24 08:35:20 -0700166 area->area_tag = strdup (area_tag);
167 listnode_add (isis->area_list, area);
168 area->isis = isis;
169
jardineb5d44e2003-12-23 08:09:43 +0000170 return area;
171}
172
173struct isis_area *
hassof90a5f62004-10-11 13:11:56 +0000174isis_area_lookup (const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000175{
176 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +0000177 struct listnode *node;
hassof390d2c2004-09-10 20:48:21 +0000178
hasso3fdb2dd2005-09-28 18:45:54 +0000179 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
jardineb5d44e2003-12-23 08:09:43 +0000180 if ((area->area_tag == NULL && area_tag == NULL) ||
hassof390d2c2004-09-10 20:48:21 +0000181 (area->area_tag && area_tag
182 && strcmp (area->area_tag, area_tag) == 0))
183 return area;
184
jardineb5d44e2003-12-23 08:09:43 +0000185 return NULL;
186}
187
hassof390d2c2004-09-10 20:48:21 +0000188int
hassof90a5f62004-10-11 13:11:56 +0000189isis_area_get (struct vty *vty, const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000190{
jardineb5d44e2003-12-23 08:09:43 +0000191 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000192
jardineb5d44e2003-12-23 08:09:43 +0000193 area = isis_area_lookup (area_tag);
hassof390d2c2004-09-10 20:48:21 +0000194
195 if (area)
196 {
197 vty->node = ISIS_NODE;
198 vty->index = area;
199 return CMD_SUCCESS;
200 }
201
Josh Bailey3f045a02012-03-24 08:35:20 -0700202 area = isis_area_create (area_tag);
hassof390d2c2004-09-10 20:48:21 +0000203
hassoc89c05d2005-09-04 21:36:36 +0000204 if (isis->debugs & DEBUG_EVENTS)
205 zlog_debug ("New IS-IS area instance %s", area->area_tag);
jardineb5d44e2003-12-23 08:09:43 +0000206
207 vty->node = ISIS_NODE;
208 vty->index = area;
hassof390d2c2004-09-10 20:48:21 +0000209
jardineb5d44e2003-12-23 08:09:43 +0000210 return CMD_SUCCESS;
211}
212
213int
hassof90a5f62004-10-11 13:11:56 +0000214isis_area_destroy (struct vty *vty, const char *area_tag)
jardineb5d44e2003-12-23 08:09:43 +0000215{
jardineb5d44e2003-12-23 08:09:43 +0000216 struct isis_area *area;
paul1eb8ef22005-04-07 07:30:20 +0000217 struct listnode *node, *nnode;
jardineb5d44e2003-12-23 08:09:43 +0000218 struct isis_circuit *circuit;
Josh Bailey3f045a02012-03-24 08:35:20 -0700219 struct area_addr *addr;
jardineb5d44e2003-12-23 08:09:43 +0000220
221 area = isis_area_lookup (area_tag);
jardineb5d44e2003-12-23 08:09:43 +0000222
hassof390d2c2004-09-10 20:48:21 +0000223 if (area == NULL)
224 {
225 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700226 return CMD_ERR_NO_MATCH;
jardineb5d44e2003-12-23 08:09:43 +0000227 }
hassof390d2c2004-09-10 20:48:21 +0000228
229 if (area->circuit_list)
230 {
paul1eb8ef22005-04-07 07:30:20 +0000231 for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))
Josh Bailey3f045a02012-03-24 08:35:20 -0700232 {
233 circuit->ip_router = 0;
234#ifdef HAVE_IPV6
235 circuit->ipv6_router = 0;
236#endif
237 isis_csm_state_change (ISIS_DISABLE, circuit, area);
238 }
hassof390d2c2004-09-10 20:48:21 +0000239 list_delete (area->circuit_list);
Josh Bailey3f045a02012-03-24 08:35:20 -0700240 area->circuit_list = NULL;
hassof390d2c2004-09-10 20:48:21 +0000241 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700242
243 if (area->lspdb[0] != NULL)
244 {
245 lsp_db_destroy (area->lspdb[0]);
246 area->lspdb[0] = NULL;
247 }
248 if (area->lspdb[1] != NULL)
249 {
250 lsp_db_destroy (area->lspdb[1]);
251 area->lspdb[1] = NULL;
252 }
253
254 spftree_area_del (area);
255
256 /* invalidate and validate would delete all routes from zebra */
257 isis_route_invalidate (area);
258 isis_route_validate (area);
259
260 if (area->route_table[0])
261 {
262 route_table_finish (area->route_table[0]);
263 area->route_table[0] = NULL;
264 }
265 if (area->route_table[1])
266 {
267 route_table_finish (area->route_table[1]);
268 area->route_table[1] = NULL;
269 }
270#ifdef HAVE_IPV6
271 if (area->route_table6[0])
272 {
273 route_table_finish (area->route_table6[0]);
274 area->route_table6[0] = NULL;
275 }
276 if (area->route_table6[1])
277 {
278 route_table_finish (area->route_table6[1]);
279 area->route_table6[1] = NULL;
280 }
281#endif /* HAVE_IPV6 */
282
283 for (ALL_LIST_ELEMENTS (area->area_addrs, node, nnode, addr))
284 {
285 list_delete_node (area->area_addrs, node);
286 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
287 }
288 area->area_addrs = NULL;
289
hassof390d2c2004-09-10 20:48:21 +0000290 THREAD_TIMER_OFF (area->t_tick);
hassof390d2c2004-09-10 20:48:21 +0000291 THREAD_TIMER_OFF (area->t_lsp_refresh[0]);
292 THREAD_TIMER_OFF (area->t_lsp_refresh[1]);
jardineb5d44e2003-12-23 08:09:43 +0000293
Josh Bailey3f045a02012-03-24 08:35:20 -0700294 thread_cancel_event (master, area);
295
296 listnode_delete (isis->area_list, area);
297
298 free (area->area_tag);
299
jardineb5d44e2003-12-23 08:09:43 +0000300 XFREE (MTYPE_ISIS_AREA, area);
hassof390d2c2004-09-10 20:48:21 +0000301
Josh Bailey3f045a02012-03-24 08:35:20 -0700302 if (listcount (isis->area_list) == 0)
303 {
304 memset (isis->sysid, 0, ISIS_SYS_ID_LEN);
305 isis->sysid_set = 0;
306 }
307
jardineb5d44e2003-12-23 08:09:43 +0000308 return CMD_SUCCESS;
309}
310
hassof390d2c2004-09-10 20:48:21 +0000311int
Josh Bailey3f045a02012-03-24 08:35:20 -0700312area_net_title (struct vty *vty, const char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000313{
jardineb5d44e2003-12-23 08:09:43 +0000314 struct isis_area *area;
315 struct area_addr *addr;
316 struct area_addr *addrp;
hasso3fdb2dd2005-09-28 18:45:54 +0000317 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000318
319 u_char buff[255];
320 area = vty->index;
321
hassof390d2c2004-09-10 20:48:21 +0000322 if (!area)
323 {
324 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700325 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +0000326 }
jardineb5d44e2003-12-23 08:09:43 +0000327
328 /* We check that we are not over the maximal number of addresses */
hassof390d2c2004-09-10 20:48:21 +0000329 if (listcount (area->area_addrs) >= isis->max_area_addrs)
330 {
331 vty_out (vty, "Maximum of area addresses (%d) already reached %s",
332 isis->max_area_addrs, VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700333 return CMD_ERR_NOTHING_TODO;
hassof390d2c2004-09-10 20:48:21 +0000334 }
jardineb5d44e2003-12-23 08:09:43 +0000335
336 addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));
337 addr->addr_len = dotformat2buff (buff, net_title);
338 memcpy (addr->area_addr, buff, addr->addr_len);
339#ifdef EXTREME_DEBUG
hasso529d65b2004-12-24 00:14:50 +0000340 zlog_debug ("added area address %s for area %s (address length %d)",
jardineb5d44e2003-12-23 08:09:43 +0000341 net_title, area->area_tag, addr->addr_len);
342#endif /* EXTREME_DEBUG */
hassof390d2c2004-09-10 20:48:21 +0000343 if (addr->addr_len < 8 || addr->addr_len > 20)
344 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700345 vty_out (vty, "area address must be at least 8..20 octets long (%d)%s",
346 addr->addr_len, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000347 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
Josh Bailey3f045a02012-03-24 08:35:20 -0700348 return CMD_ERR_AMBIGUOUS;
349 }
350
351 if (addr->area_addr[addr->addr_len-1] != 0)
352 {
353 vty_out (vty, "nsel byte (last byte) in area address must be 0%s",
354 VTY_NEWLINE);
355 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
356 return CMD_ERR_AMBIGUOUS;
jardineb5d44e2003-12-23 08:09:43 +0000357 }
358
hassof390d2c2004-09-10 20:48:21 +0000359 if (isis->sysid_set == 0)
360 {
361 /*
362 * First area address - get the SystemID for this router
363 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700364 memcpy (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN);
hassof390d2c2004-09-10 20:48:21 +0000365 isis->sysid_set = 1;
hassoc89c05d2005-09-04 21:36:36 +0000366 if (isis->debugs & DEBUG_EVENTS)
367 zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid));
jardineb5d44e2003-12-23 08:09:43 +0000368 }
hassof390d2c2004-09-10 20:48:21 +0000369 else
370 {
371 /*
372 * Check that the SystemID portions match
373 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700374 if (memcmp (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN))
hassof390d2c2004-09-10 20:48:21 +0000375 {
376 vty_out (vty,
377 "System ID must not change when defining additional area"
378 " addresses%s", VTY_NEWLINE);
379 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
Josh Bailey3f045a02012-03-24 08:35:20 -0700380 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +0000381 }
jardineb5d44e2003-12-23 08:09:43 +0000382
hassof390d2c2004-09-10 20:48:21 +0000383 /* now we see that we don't already have this address */
hasso3fdb2dd2005-09-28 18:45:54 +0000384 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
385 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700386 if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN) != (addr->addr_len))
hasso3fdb2dd2005-09-28 18:45:54 +0000387 continue;
388 if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
389 {
390 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
391 return CMD_SUCCESS; /* silent fail */
392 }
393 }
hassof390d2c2004-09-10 20:48:21 +0000394 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700395
jardineb5d44e2003-12-23 08:09:43 +0000396 /*
397 * Forget the systemID part of the address
398 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700399 addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN);
jardineb5d44e2003-12-23 08:09:43 +0000400 listnode_add (area->area_addrs, addr);
401
402 /* only now we can safely generate our LSPs for this area */
hassof390d2c2004-09-10 20:48:21 +0000403 if (listcount (area->area_addrs) > 0)
404 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700405 if (area->is_type & IS_LEVEL_1)
406 lsp_generate (area, IS_LEVEL_1);
407 if (area->is_type & IS_LEVEL_2)
408 lsp_generate (area, IS_LEVEL_2);
hassof390d2c2004-09-10 20:48:21 +0000409 }
jardineb5d44e2003-12-23 08:09:43 +0000410
411 return CMD_SUCCESS;
412}
413
414int
Josh Bailey3f045a02012-03-24 08:35:20 -0700415area_clear_net_title (struct vty *vty, const char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000416{
417 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000418 struct area_addr addr, *addrp = NULL;
hasso3fdb2dd2005-09-28 18:45:54 +0000419 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000420 u_char buff[255];
421
422 area = vty->index;
hassof390d2c2004-09-10 20:48:21 +0000423 if (!area)
424 {
425 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700426 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +0000427 }
428
jardineb5d44e2003-12-23 08:09:43 +0000429 addr.addr_len = dotformat2buff (buff, net_title);
hassof390d2c2004-09-10 20:48:21 +0000430 if (addr.addr_len < 8 || addr.addr_len > 20)
431 {
432 vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
433 addr.addr_len, VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700434 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +0000435 }
436
437 memcpy (addr.area_addr, buff, (int) addr.addr_len);
438
hasso3fdb2dd2005-09-28 18:45:54 +0000439 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
Josh Bailey3f045a02012-03-24 08:35:20 -0700440 if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len &&
jardineb5d44e2003-12-23 08:09:43 +0000441 !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
hassof390d2c2004-09-10 20:48:21 +0000442 break;
443
444 if (!addrp)
445 {
446 vty_out (vty, "No area address %s for area %s %s", net_title,
447 area->area_tag, VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700448 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +0000449 }
450
jardineb5d44e2003-12-23 08:09:43 +0000451 listnode_delete (area->area_addrs, addrp);
Josh Bailey3f045a02012-03-24 08:35:20 -0700452 XFREE (MTYPE_ISIS_AREA_ADDR, addrp);
453
454 /*
455 * Last area address - reset the SystemID for this router
456 */
457 if (listcount (area->area_addrs) == 0)
458 {
459 memset (isis->sysid, 0, ISIS_SYS_ID_LEN);
460 isis->sysid_set = 0;
461 if (isis->debugs & DEBUG_EVENTS)
462 zlog_debug ("Router has no SystemID");
463 }
hassof390d2c2004-09-10 20:48:21 +0000464
jardineb5d44e2003-12-23 08:09:43 +0000465 return CMD_SUCCESS;
466}
467
jardineb5d44e2003-12-23 08:09:43 +0000468/*
Josh Bailey3f045a02012-03-24 08:35:20 -0700469 * 'show isis interface' command
jardineb5d44e2003-12-23 08:09:43 +0000470 */
471
472int
Josh Bailey3f045a02012-03-24 08:35:20 -0700473show_isis_interface_common (struct vty *vty, const char *ifname, char detail)
jardineb5d44e2003-12-23 08:09:43 +0000474{
hasso3fdb2dd2005-09-28 18:45:54 +0000475 struct listnode *anode, *cnode;
jardineb5d44e2003-12-23 08:09:43 +0000476 struct isis_area *area;
477 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +0000478
hassof390d2c2004-09-10 20:48:21 +0000479 if (!isis)
480 {
481 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
482 return CMD_SUCCESS;
483 }
jardineb5d44e2003-12-23 08:09:43 +0000484
hasso3fdb2dd2005-09-28 18:45:54 +0000485 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
hassof390d2c2004-09-10 20:48:21 +0000486 {
hassof390d2c2004-09-10 20:48:21 +0000487 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000488
hassof390d2c2004-09-10 20:48:21 +0000489 if (detail == ISIS_UI_LEVEL_BRIEF)
Josh Bailey3f045a02012-03-24 08:35:20 -0700490 vty_out (vty, " Interface CircId State Type Level%s",
491 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000492
hasso3fdb2dd2005-09-28 18:45:54 +0000493 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
Josh Bailey3f045a02012-03-24 08:35:20 -0700494 if (!ifname)
495 isis_circuit_print_vty (circuit, vty, detail);
496 else if (strcmp(circuit->interface->name, ifname) == 0)
497 isis_circuit_print_vty (circuit, vty, detail);
jardineb5d44e2003-12-23 08:09:43 +0000498 }
hassof390d2c2004-09-10 20:48:21 +0000499
jardineb5d44e2003-12-23 08:09:43 +0000500 return CMD_SUCCESS;
501}
502
Josh Bailey3f045a02012-03-24 08:35:20 -0700503DEFUN (show_isis_interface,
504 show_isis_interface_cmd,
505 "show isis interface",
jardineb5d44e2003-12-23 08:09:43 +0000506 SHOW_STR
Josh Bailey3f045a02012-03-24 08:35:20 -0700507 "ISIS network information\n"
508 "ISIS interface\n")
jardineb5d44e2003-12-23 08:09:43 +0000509{
Josh Bailey3f045a02012-03-24 08:35:20 -0700510 return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_BRIEF);
jardineb5d44e2003-12-23 08:09:43 +0000511}
512
Josh Bailey3f045a02012-03-24 08:35:20 -0700513DEFUN (show_isis_interface_detail,
514 show_isis_interface_detail_cmd,
515 "show isis interface detail",
jardineb5d44e2003-12-23 08:09:43 +0000516 SHOW_STR
Josh Bailey3f045a02012-03-24 08:35:20 -0700517 "ISIS network information\n"
518 "ISIS interface\n"
jardineb5d44e2003-12-23 08:09:43 +0000519 "show detailed information\n")
520{
Josh Bailey3f045a02012-03-24 08:35:20 -0700521 return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_DETAIL);
jardineb5d44e2003-12-23 08:09:43 +0000522}
523
Josh Bailey3f045a02012-03-24 08:35:20 -0700524DEFUN (show_isis_interface_arg,
525 show_isis_interface_arg_cmd,
526 "show isis interface WORD",
jardineb5d44e2003-12-23 08:09:43 +0000527 SHOW_STR
Josh Bailey3f045a02012-03-24 08:35:20 -0700528 "ISIS network information\n"
529 "ISIS interface\n"
530 "ISIS interface name\n")
531{
532 return show_isis_interface_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
533}
534
535/*
536 * 'show isis neighbor' command
537 */
538
539int
540show_isis_neighbor_common (struct vty *vty, const char *id, char detail)
541{
542 struct listnode *anode, *cnode, *node;
543 struct isis_area *area;
544 struct isis_circuit *circuit;
545 struct list *adjdb;
546 struct isis_adjacency *adj;
547 struct isis_dynhn *dynhn;
548 u_char sysid[ISIS_SYS_ID_LEN];
549 int i;
550
551 if (!isis)
552 {
553 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
554 return CMD_SUCCESS;
555 }
556
557 memset (sysid, 0, ISIS_SYS_ID_LEN);
558 if (id)
559 {
560 if (sysid2buff (sysid, id) == 0)
561 {
562 dynhn = dynhn_find_by_name (id);
563 if (dynhn == NULL)
564 {
565 vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
566 return CMD_SUCCESS;
567 }
568 memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
569 }
570 }
571
572 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
573 {
574 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
575
576 if (detail == ISIS_UI_LEVEL_BRIEF)
577 vty_out (vty, " System Id Interface L State"
578 " Holdtime SNPA%s", VTY_NEWLINE);
579
580 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
581 {
582 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
583 {
584 for (i = 0; i < 2; i++)
585 {
586 adjdb = circuit->u.bc.adjdb[i];
587 if (adjdb && adjdb->count)
588 {
589 for (ALL_LIST_ELEMENTS_RO (adjdb, node, adj))
590 if (!id || !memcmp (adj->sysid, sysid,
591 ISIS_SYS_ID_LEN))
592 isis_adj_print_vty (adj, vty, detail);
593 }
594 }
595 }
596 else if (circuit->circ_type == CIRCUIT_T_P2P &&
597 circuit->u.p2p.neighbor)
598 {
599 adj = circuit->u.p2p.neighbor;
600 if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
601 isis_adj_print_vty (adj, vty, detail);
602 }
603 }
604 }
605
606 return CMD_SUCCESS;
607}
608
609/*
610 * 'clear isis neighbor' command
611 */
612int
613clear_isis_neighbor_common (struct vty *vty, const char *id)
614{
615 struct listnode *anode, *cnode, *cnextnode, *node, *nnode;
616 struct isis_area *area;
617 struct isis_circuit *circuit;
618 struct list *adjdb;
619 struct isis_adjacency *adj;
620 struct isis_dynhn *dynhn;
621 u_char sysid[ISIS_SYS_ID_LEN];
622 int i;
623
624 if (!isis)
625 {
626 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
627 return CMD_SUCCESS;
628 }
629
630 memset (sysid, 0, ISIS_SYS_ID_LEN);
631 if (id)
632 {
633 if (sysid2buff (sysid, id) == 0)
634 {
635 dynhn = dynhn_find_by_name (id);
636 if (dynhn == NULL)
637 {
638 vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
639 return CMD_SUCCESS;
640 }
641 memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
642 }
643 }
644
645 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
646 {
647 for (ALL_LIST_ELEMENTS (area->circuit_list, cnode, cnextnode, circuit))
648 {
649 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
650 {
651 for (i = 0; i < 2; i++)
652 {
653 adjdb = circuit->u.bc.adjdb[i];
654 if (adjdb && adjdb->count)
655 {
656 for (ALL_LIST_ELEMENTS (adjdb, node, nnode, adj))
657 if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
658 isis_adj_state_change (adj, ISIS_ADJ_DOWN,
659 "clear user request");
660 }
661 }
662 }
663 else if (circuit->circ_type == CIRCUIT_T_P2P &&
664 circuit->u.p2p.neighbor)
665 {
666 adj = circuit->u.p2p.neighbor;
667 if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
668 isis_adj_state_change (adj, ISIS_ADJ_DOWN,
669 "clear user request");
670 }
671 }
672 }
673
674 return CMD_SUCCESS;
675}
676
677DEFUN (show_isis_neighbor,
678 show_isis_neighbor_cmd,
679 "show isis neighbor",
680 SHOW_STR
681 "ISIS network information\n"
682 "ISIS neighbor adjacencies\n")
683{
684 return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_BRIEF);
685}
686
687DEFUN (show_isis_neighbor_detail,
688 show_isis_neighbor_detail_cmd,
689 "show isis neighbor detail",
690 SHOW_STR
691 "ISIS network information\n"
692 "ISIS neighbor adjacencies\n"
jardineb5d44e2003-12-23 08:09:43 +0000693 "show detailed information\n")
Josh Bailey3f045a02012-03-24 08:35:20 -0700694{
695 return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_DETAIL);
696}
697
698DEFUN (show_isis_neighbor_arg,
699 show_isis_neighbor_arg_cmd,
700 "show isis neighbor WORD",
701 SHOW_STR
702 "ISIS network information\n"
703 "ISIS neighbor adjacencies\n"
704 "System id\n")
705{
706 return show_isis_neighbor_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
707}
708
709DEFUN (clear_isis_neighbor,
710 clear_isis_neighbor_cmd,
711 "clear isis neighbor",
712 CLEAR_STR
713 "Reset ISIS network information\n"
714 "Reset ISIS neighbor adjacencies\n")
715{
716 return clear_isis_neighbor_common (vty, NULL);
717}
718
719DEFUN (clear_isis_neighbor_arg,
720 clear_isis_neighbor_arg_cmd,
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -0700721 "clear isis neighbor WORD",
Josh Bailey3f045a02012-03-24 08:35:20 -0700722 CLEAR_STR
723 "ISIS network information\n"
724 "ISIS neighbor adjacencies\n"
725 "System id\n")
726{
727 return clear_isis_neighbor_common (vty, argv[0]);
728}
729
jardineb5d44e2003-12-23 08:09:43 +0000730/*
731 * 'isis debug', 'show debugging'
732 */
jardineb5d44e2003-12-23 08:09:43 +0000733void
734print_debug (struct vty *vty, int flags, int onoff)
735{
736 char onoffs[4];
737 if (onoff)
hassof390d2c2004-09-10 20:48:21 +0000738 strcpy (onoffs, "on");
jardineb5d44e2003-12-23 08:09:43 +0000739 else
hassof390d2c2004-09-10 20:48:21 +0000740 strcpy (onoffs, "off");
jardineb5d44e2003-12-23 08:09:43 +0000741
742 if (flags & DEBUG_ADJ_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000743 vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs,
744 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000745 if (flags & DEBUG_CHECKSUM_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000746 vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs,
747 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000748 if (flags & DEBUG_LOCAL_UPDATES)
hassof390d2c2004-09-10 20:48:21 +0000749 vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs,
750 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000751 if (flags & DEBUG_PROTOCOL_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000752 vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs,
753 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000754 if (flags & DEBUG_SNP_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000755 vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs,
756 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000757 if (flags & DEBUG_SPF_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000758 vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000759 if (flags & DEBUG_SPF_STATS)
hassof390d2c2004-09-10 20:48:21 +0000760 vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s",
761 onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000762 if (flags & DEBUG_SPF_TRIGGERS)
hassof390d2c2004-09-10 20:48:21 +0000763 vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs,
764 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000765 if (flags & DEBUG_UPDATE_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000766 vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs,
767 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000768 if (flags & DEBUG_RTE_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000769 vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs,
770 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000771 if (flags & DEBUG_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000772 vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700773 if (flags & DEBUG_PACKET_DUMP)
774 vty_out (vty, "IS-IS Packet dump debugging is %s%s", onoffs, VTY_NEWLINE);
Christian Franke80a8f722015-11-12 14:21:47 +0100775 if (flags & DEBUG_LSP_GEN)
776 vty_out (vty, "IS-IS LSP generation debugging is %s%s", onoffs, VTY_NEWLINE);
Christian Franke61010c32015-11-10 18:43:34 +0100777 if (flags & DEBUG_LSP_SCHED)
778 vty_out (vty, "IS-IS LSP scheduling debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000779}
780
781DEFUN (show_debugging,
782 show_debugging_cmd,
783 "show debugging",
784 SHOW_STR
785 "State of each debugging option\n")
786{
hassof390d2c2004-09-10 20:48:21 +0000787 vty_out (vty, "IS-IS:%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000788 print_debug (vty, isis->debugs, 1);
789 return CMD_SUCCESS;
790}
791
jardin9e867fe2003-12-23 08:56:18 +0000792/* Debug node. */
hassof390d2c2004-09-10 20:48:21 +0000793static struct cmd_node debug_node = {
jardin9e867fe2003-12-23 08:56:18 +0000794 DEBUG_NODE,
hassof390d2c2004-09-10 20:48:21 +0000795 "",
796 1
jardin9e867fe2003-12-23 08:56:18 +0000797};
798
799static int
800config_write_debug (struct vty *vty)
801{
802 int write = 0;
803 int flags = isis->debugs;
804
hassof390d2c2004-09-10 20:48:21 +0000805 if (flags & DEBUG_ADJ_PACKETS)
806 {
807 vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE);
808 write++;
809 }
810 if (flags & DEBUG_CHECKSUM_ERRORS)
811 {
812 vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE);
813 write++;
814 }
815 if (flags & DEBUG_LOCAL_UPDATES)
816 {
817 vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE);
818 write++;
819 }
820 if (flags & DEBUG_PROTOCOL_ERRORS)
821 {
822 vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE);
823 write++;
824 }
825 if (flags & DEBUG_SNP_PACKETS)
826 {
827 vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE);
828 write++;
829 }
830 if (flags & DEBUG_SPF_EVENTS)
831 {
832 vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE);
833 write++;
834 }
835 if (flags & DEBUG_SPF_STATS)
836 {
837 vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE);
838 write++;
839 }
840 if (flags & DEBUG_SPF_TRIGGERS)
841 {
842 vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE);
843 write++;
844 }
845 if (flags & DEBUG_UPDATE_PACKETS)
846 {
847 vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE);
848 write++;
849 }
850 if (flags & DEBUG_RTE_EVENTS)
851 {
852 vty_out (vty, "debug isis route-events%s", VTY_NEWLINE);
853 write++;
854 }
855 if (flags & DEBUG_EVENTS)
856 {
857 vty_out (vty, "debug isis events%s", VTY_NEWLINE);
858 write++;
859 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700860 if (flags & DEBUG_PACKET_DUMP)
861 {
862 vty_out (vty, "debug isis packet-dump%s", VTY_NEWLINE);
863 write++;
864 }
Christian Franke80a8f722015-11-12 14:21:47 +0100865 if (flags & DEBUG_LSP_GEN)
866 {
867 vty_out (vty, "debug isis lsp-gen%s", VTY_NEWLINE);
868 write++;
869 }
Christian Franke61010c32015-11-10 18:43:34 +0100870 if (flags & DEBUG_LSP_SCHED)
871 {
872 vty_out (vty, "debug isis lsp-sched%s", VTY_NEWLINE);
873 write++;
874 }
jardin9e867fe2003-12-23 08:56:18 +0000875
876 return write;
877}
878
jardineb5d44e2003-12-23 08:09:43 +0000879DEFUN (debug_isis_adj,
880 debug_isis_adj_cmd,
881 "debug isis adj-packets",
882 DEBUG_STR
883 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000884 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000885{
886 isis->debugs |= DEBUG_ADJ_PACKETS;
hassof390d2c2004-09-10 20:48:21 +0000887 print_debug (vty, DEBUG_ADJ_PACKETS, 1);
jardineb5d44e2003-12-23 08:09:43 +0000888
889 return CMD_SUCCESS;
890}
891
892DEFUN (no_debug_isis_adj,
893 no_debug_isis_adj_cmd,
894 "no debug isis adj-packets",
895 UNDEBUG_STR
896 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000897 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000898{
jardineb5d44e2003-12-23 08:09:43 +0000899 isis->debugs &= ~DEBUG_ADJ_PACKETS;
900 print_debug (vty, DEBUG_ADJ_PACKETS, 0);
901
902 return CMD_SUCCESS;
903}
904
jardineb5d44e2003-12-23 08:09:43 +0000905DEFUN (debug_isis_csum,
906 debug_isis_csum_cmd,
907 "debug isis checksum-errors",
908 DEBUG_STR
909 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000910 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000911{
912 isis->debugs |= DEBUG_CHECKSUM_ERRORS;
913 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1);
914
915 return CMD_SUCCESS;
916}
917
918DEFUN (no_debug_isis_csum,
919 no_debug_isis_csum_cmd,
920 "no debug isis checksum-errors",
921 UNDEBUG_STR
922 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000923 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000924{
925 isis->debugs &= ~DEBUG_CHECKSUM_ERRORS;
926 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000927
jardineb5d44e2003-12-23 08:09:43 +0000928 return CMD_SUCCESS;
929}
930
931DEFUN (debug_isis_lupd,
932 debug_isis_lupd_cmd,
933 "debug isis local-updates",
934 DEBUG_STR
935 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000936 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000937{
938 isis->debugs |= DEBUG_LOCAL_UPDATES;
939 print_debug (vty, DEBUG_LOCAL_UPDATES, 1);
940
941 return CMD_SUCCESS;
942}
943
944DEFUN (no_debug_isis_lupd,
945 no_debug_isis_lupd_cmd,
946 "no debug isis local-updates",
947 UNDEBUG_STR
948 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000949 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000950{
951 isis->debugs &= ~DEBUG_LOCAL_UPDATES;
hassof390d2c2004-09-10 20:48:21 +0000952 print_debug (vty, DEBUG_LOCAL_UPDATES, 0);
953
jardineb5d44e2003-12-23 08:09:43 +0000954 return CMD_SUCCESS;
955}
956
957DEFUN (debug_isis_err,
958 debug_isis_err_cmd,
hassof390d2c2004-09-10 20:48:21 +0000959 "debug isis protocol-errors",
jardineb5d44e2003-12-23 08:09:43 +0000960 DEBUG_STR
961 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000962 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000963{
964 isis->debugs |= DEBUG_PROTOCOL_ERRORS;
965 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1);
966
967 return CMD_SUCCESS;
968}
969
970DEFUN (no_debug_isis_err,
971 no_debug_isis_err_cmd,
972 "no debug isis protocol-errors",
973 UNDEBUG_STR
974 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000975 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000976{
977 isis->debugs &= ~DEBUG_PROTOCOL_ERRORS;
978 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000979
jardineb5d44e2003-12-23 08:09:43 +0000980 return CMD_SUCCESS;
981}
982
983DEFUN (debug_isis_snp,
984 debug_isis_snp_cmd,
985 "debug isis snp-packets",
986 DEBUG_STR
987 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000988 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000989{
990 isis->debugs |= DEBUG_SNP_PACKETS;
991 print_debug (vty, DEBUG_SNP_PACKETS, 1);
992
993 return CMD_SUCCESS;
994}
995
996DEFUN (no_debug_isis_snp,
997 no_debug_isis_snp_cmd,
998 "no debug isis snp-packets",
999 UNDEBUG_STR
1000 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001001 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +00001002{
hassof390d2c2004-09-10 20:48:21 +00001003 isis->debugs &= ~DEBUG_SNP_PACKETS;
jardineb5d44e2003-12-23 08:09:43 +00001004 print_debug (vty, DEBUG_SNP_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +00001005
jardineb5d44e2003-12-23 08:09:43 +00001006 return CMD_SUCCESS;
1007}
1008
jardineb5d44e2003-12-23 08:09:43 +00001009DEFUN (debug_isis_upd,
1010 debug_isis_upd_cmd,
1011 "debug isis update-packets",
1012 DEBUG_STR
1013 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001014 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +00001015{
1016 isis->debugs |= DEBUG_UPDATE_PACKETS;
1017 print_debug (vty, DEBUG_UPDATE_PACKETS, 1);
1018
1019 return CMD_SUCCESS;
1020}
1021
1022DEFUN (no_debug_isis_upd,
1023 no_debug_isis_upd_cmd,
1024 "no debug isis update-packets",
1025 UNDEBUG_STR
1026 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001027 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +00001028{
1029 isis->debugs &= ~DEBUG_UPDATE_PACKETS;
1030 print_debug (vty, DEBUG_UPDATE_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +00001031
jardineb5d44e2003-12-23 08:09:43 +00001032 return CMD_SUCCESS;
1033}
1034
jardineb5d44e2003-12-23 08:09:43 +00001035DEFUN (debug_isis_spfevents,
1036 debug_isis_spfevents_cmd,
1037 "debug isis spf-events",
1038 DEBUG_STR
1039 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001040 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +00001041{
1042 isis->debugs |= DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +00001043 print_debug (vty, DEBUG_SPF_EVENTS, 1);
jardineb5d44e2003-12-23 08:09:43 +00001044
1045 return CMD_SUCCESS;
1046}
1047
1048DEFUN (no_debug_isis_spfevents,
1049 no_debug_isis_spfevents_cmd,
1050 "no debug isis spf-events",
1051 UNDEBUG_STR
1052 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001053 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +00001054{
1055 isis->debugs &= ~DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +00001056 print_debug (vty, DEBUG_SPF_EVENTS, 0);
1057
jardineb5d44e2003-12-23 08:09:43 +00001058 return CMD_SUCCESS;
1059}
1060
jardineb5d44e2003-12-23 08:09:43 +00001061DEFUN (debug_isis_spfstats,
1062 debug_isis_spfstats_cmd,
1063 "debug isis spf-statistics ",
1064 DEBUG_STR
1065 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001066 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +00001067{
1068 isis->debugs |= DEBUG_SPF_STATS;
1069 print_debug (vty, DEBUG_SPF_STATS, 1);
1070
1071 return CMD_SUCCESS;
1072}
1073
1074DEFUN (no_debug_isis_spfstats,
1075 no_debug_isis_spfstats_cmd,
1076 "no debug isis spf-statistics",
1077 UNDEBUG_STR
1078 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001079 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +00001080{
1081 isis->debugs &= ~DEBUG_SPF_STATS;
1082 print_debug (vty, DEBUG_SPF_STATS, 0);
hassof390d2c2004-09-10 20:48:21 +00001083
jardineb5d44e2003-12-23 08:09:43 +00001084 return CMD_SUCCESS;
1085}
1086
1087DEFUN (debug_isis_spftrigg,
1088 debug_isis_spftrigg_cmd,
1089 "debug isis spf-triggers",
1090 DEBUG_STR
1091 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001092 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +00001093{
1094 isis->debugs |= DEBUG_SPF_TRIGGERS;
1095 print_debug (vty, DEBUG_SPF_TRIGGERS, 1);
1096
1097 return CMD_SUCCESS;
1098}
1099
1100DEFUN (no_debug_isis_spftrigg,
1101 no_debug_isis_spftrigg_cmd,
1102 "no debug isis spf-triggers",
1103 UNDEBUG_STR
1104 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001105 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +00001106{
1107 isis->debugs &= ~DEBUG_SPF_TRIGGERS;
1108 print_debug (vty, DEBUG_SPF_TRIGGERS, 0);
hassof390d2c2004-09-10 20:48:21 +00001109
jardineb5d44e2003-12-23 08:09:43 +00001110 return CMD_SUCCESS;
1111}
1112
1113DEFUN (debug_isis_rtevents,
1114 debug_isis_rtevents_cmd,
1115 "debug isis route-events",
1116 DEBUG_STR
1117 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001118 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +00001119{
1120 isis->debugs |= DEBUG_RTE_EVENTS;
1121 print_debug (vty, DEBUG_RTE_EVENTS, 1);
1122
1123 return CMD_SUCCESS;
1124}
1125
1126DEFUN (no_debug_isis_rtevents,
1127 no_debug_isis_rtevents_cmd,
1128 "no debug isis route-events",
1129 UNDEBUG_STR
1130 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001131 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +00001132{
1133 isis->debugs &= ~DEBUG_RTE_EVENTS;
1134 print_debug (vty, DEBUG_RTE_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +00001135
jardineb5d44e2003-12-23 08:09:43 +00001136 return CMD_SUCCESS;
1137}
1138
1139DEFUN (debug_isis_events,
1140 debug_isis_events_cmd,
1141 "debug isis events",
1142 DEBUG_STR
1143 "IS-IS information\n"
hassof1082d12005-09-19 04:23:34 +00001144 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +00001145{
1146 isis->debugs |= DEBUG_EVENTS;
1147 print_debug (vty, DEBUG_EVENTS, 1);
1148
1149 return CMD_SUCCESS;
1150}
1151
1152DEFUN (no_debug_isis_events,
1153 no_debug_isis_events_cmd,
1154 "no debug isis events",
1155 UNDEBUG_STR
1156 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001157 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +00001158{
1159 isis->debugs &= ~DEBUG_EVENTS;
1160 print_debug (vty, DEBUG_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +00001161
jardineb5d44e2003-12-23 08:09:43 +00001162 return CMD_SUCCESS;
1163}
1164
Josh Bailey3f045a02012-03-24 08:35:20 -07001165DEFUN (debug_isis_packet_dump,
1166 debug_isis_packet_dump_cmd,
1167 "debug isis packet-dump",
1168 DEBUG_STR
1169 "IS-IS information\n"
1170 "IS-IS packet dump\n")
1171{
1172 isis->debugs |= DEBUG_PACKET_DUMP;
1173 print_debug (vty, DEBUG_PACKET_DUMP, 1);
1174
1175 return CMD_SUCCESS;
1176}
1177
1178DEFUN (no_debug_isis_packet_dump,
1179 no_debug_isis_packet_dump_cmd,
1180 "no debug isis packet-dump",
1181 UNDEBUG_STR
1182 "IS-IS information\n"
1183 "IS-IS packet dump\n")
1184{
1185 isis->debugs &= ~DEBUG_PACKET_DUMP;
1186 print_debug (vty, DEBUG_PACKET_DUMP, 0);
1187
1188 return CMD_SUCCESS;
1189}
1190
Christian Franke80a8f722015-11-12 14:21:47 +01001191DEFUN (debug_isis_lsp_gen,
1192 debug_isis_lsp_gen_cmd,
1193 "debug isis lsp-gen",
1194 DEBUG_STR
1195 "IS-IS information\n"
1196 "IS-IS generation of own LSPs\n")
1197{
1198 isis->debugs |= DEBUG_LSP_GEN;
1199 print_debug (vty, DEBUG_LSP_GEN, 1);
1200
1201 return CMD_SUCCESS;
1202}
1203
1204DEFUN (no_debug_isis_lsp_gen,
1205 no_debug_isis_lsp_gen_cmd,
1206 "no debug isis lsp-gen",
1207 UNDEBUG_STR
1208 "IS-IS information\n"
1209 "IS-IS generation of own LSPs\n")
1210{
1211 isis->debugs &= ~DEBUG_LSP_GEN;
1212 print_debug (vty, DEBUG_LSP_GEN, 0);
1213
1214 return CMD_SUCCESS;
1215}
1216
Christian Franke61010c32015-11-10 18:43:34 +01001217DEFUN (debug_isis_lsp_sched,
1218 debug_isis_lsp_sched_cmd,
1219 "debug isis lsp-sched",
1220 DEBUG_STR
1221 "IS-IS information\n"
1222 "IS-IS scheduling of LSP generation\n")
1223{
1224 isis->debugs |= DEBUG_LSP_SCHED;
1225 print_debug (vty, DEBUG_LSP_SCHED, 1);
1226
1227 return CMD_SUCCESS;
1228}
1229
1230DEFUN (no_debug_isis_lsp_sched,
1231 no_debug_isis_lsp_sched_cmd,
1232 "no debug isis lsp-gen",
1233 UNDEBUG_STR
1234 "IS-IS information\n"
1235 "IS-IS scheduling of LSP generation\n")
1236{
1237 isis->debugs &= ~DEBUG_LSP_SCHED;
1238 print_debug (vty, DEBUG_LSP_SCHED, 0);
1239
1240 return CMD_SUCCESS;
1241}
1242
jardineb5d44e2003-12-23 08:09:43 +00001243DEFUN (show_hostname,
1244 show_hostname_cmd,
1245 "show isis hostname",
1246 SHOW_STR
1247 "IS-IS information\n"
1248 "IS-IS Dynamic hostname mapping\n")
1249{
1250 dynhn_print_all (vty);
hassof390d2c2004-09-10 20:48:21 +00001251
jardineb5d44e2003-12-23 08:09:43 +00001252 return CMD_SUCCESS;
1253}
1254
Josh Bailey3f045a02012-03-24 08:35:20 -07001255static void
1256vty_out_timestr(struct vty *vty, time_t uptime)
1257{
1258 struct tm *tm;
1259 time_t difftime = time (NULL);
1260 difftime -= uptime;
1261 tm = gmtime (&difftime);
1262
1263#define ONE_DAY_SECOND 60*60*24
1264#define ONE_WEEK_SECOND 60*60*24*7
1265 if (difftime < ONE_DAY_SECOND)
1266 vty_out (vty, "%02d:%02d:%02d",
1267 tm->tm_hour, tm->tm_min, tm->tm_sec);
1268 else if (difftime < ONE_WEEK_SECOND)
1269 vty_out (vty, "%dd%02dh%02dm",
1270 tm->tm_yday, tm->tm_hour, tm->tm_min);
1271 else
1272 vty_out (vty, "%02dw%dd%02dh",
1273 tm->tm_yday/7,
1274 tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
1275 vty_out (vty, " ago");
1276}
1277
1278DEFUN (show_isis_summary,
1279 show_isis_summary_cmd,
1280 "show isis summary",
1281 SHOW_STR "IS-IS information\n" "IS-IS summary\n")
1282{
1283 struct listnode *node, *node2;
1284 struct isis_area *area;
1285 struct isis_spftree *spftree;
1286 int level;
1287
1288 if (isis == NULL)
1289 {
1290 vty_out (vty, "ISIS is not running%s", VTY_NEWLINE);
1291 return CMD_SUCCESS;
1292 }
1293
1294 vty_out (vty, "Process Id : %ld%s", isis->process_id,
1295 VTY_NEWLINE);
1296 if (isis->sysid_set)
1297 vty_out (vty, "System Id : %s%s", sysid_print (isis->sysid),
1298 VTY_NEWLINE);
1299
1300 vty_out (vty, "Up time : ");
1301 vty_out_timestr(vty, isis->uptime);
1302 vty_out (vty, "%s", VTY_NEWLINE);
1303
1304 if (isis->area_list)
1305 vty_out (vty, "Number of areas : %d%s", isis->area_list->count,
1306 VTY_NEWLINE);
1307
1308 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
1309 {
1310 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
1311 VTY_NEWLINE);
1312
1313 if (listcount (area->area_addrs) > 0)
1314 {
1315 struct area_addr *area_addr;
1316 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
1317 {
1318 vty_out (vty, " Net: %s%s",
1319 isonet_print (area_addr->area_addr,
1320 area_addr->addr_len + ISIS_SYS_ID_LEN +
1321 1), VTY_NEWLINE);
1322 }
1323 }
1324
1325 for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++)
1326 {
1327 if ((area->is_type & level) == 0)
1328 continue;
1329
1330 vty_out (vty, " Level-%d:%s", level, VTY_NEWLINE);
1331 spftree = area->spftree[level - 1];
1332 if (spftree->pending)
1333 vty_out (vty, " IPv4 SPF: (pending)%s", VTY_NEWLINE);
1334 else
1335 vty_out (vty, " IPv4 SPF:%s", VTY_NEWLINE);
1336
1337 vty_out (vty, " minimum interval : %d%s",
1338 area->min_spf_interval[level - 1], VTY_NEWLINE);
1339
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001340 vty_out (vty, " last run elapsed : ");
1341 vty_out_timestr(vty, spftree->last_run_timestamp);
Josh Bailey3f045a02012-03-24 08:35:20 -07001342 vty_out (vty, "%s", VTY_NEWLINE);
1343
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001344 vty_out (vty, " last run duration : %u usec%s",
1345 (u_int32_t)spftree->last_run_duration, VTY_NEWLINE);
1346
Josh Bailey3f045a02012-03-24 08:35:20 -07001347 vty_out (vty, " run count : %d%s",
1348 spftree->runcount, VTY_NEWLINE);
1349
1350#ifdef HAVE_IPV6
1351 spftree = area->spftree6[level - 1];
1352 if (spftree->pending)
1353 vty_out (vty, " IPv6 SPF: (pending)%s", VTY_NEWLINE);
1354 else
1355 vty_out (vty, " IPv6 SPF:%s", VTY_NEWLINE);
1356
1357 vty_out (vty, " minimum interval : %d%s",
1358 area->min_spf_interval[level - 1], VTY_NEWLINE);
1359
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001360 vty_out (vty, " last run elapsed : ");
1361 vty_out_timestr(vty, spftree->last_run_timestamp);
Josh Bailey3f045a02012-03-24 08:35:20 -07001362 vty_out (vty, "%s", VTY_NEWLINE);
1363
David Lamparteref008d22015-03-03 08:48:11 +01001364 vty_out (vty, " last run duration : %llu msec%s",
1365 (unsigned long long)spftree->last_run_duration, VTY_NEWLINE);
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001366
Josh Bailey3f045a02012-03-24 08:35:20 -07001367 vty_out (vty, " run count : %d%s",
1368 spftree->runcount, VTY_NEWLINE);
1369#endif
1370 }
1371 }
1372 vty_out (vty, "%s", VTY_NEWLINE);
1373
1374 return CMD_SUCCESS;
1375}
1376
1377/*
1378 * This function supports following display options:
1379 * [ show isis database [detail] ]
1380 * [ show isis database <sysid> [detail] ]
1381 * [ show isis database <hostname> [detail] ]
1382 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1383 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1384 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1385 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1386 * [ show isis database detail <sysid> ]
1387 * [ show isis database detail <hostname> ]
1388 * [ show isis database detail <sysid>.<pseudo-id> ]
1389 * [ show isis database detail <hostname>.<pseudo-id> ]
1390 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1391 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1392 */
1393static int
1394show_isis_database (struct vty *vty, const char *argv, int ui_level)
jardineb5d44e2003-12-23 08:09:43 +00001395{
hasso3fdb2dd2005-09-28 18:45:54 +00001396 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +00001397 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001398 struct isis_lsp *lsp;
1399 struct isis_dynhn *dynhn;
1400 const char *pos = argv;
1401 u_char lspid[ISIS_SYS_ID_LEN+2];
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001402 char sysid[255];
Josh Bailey3f045a02012-03-24 08:35:20 -07001403 u_char number[3];
hassof390d2c2004-09-10 20:48:21 +00001404 int level, lsp_count;
jardineb5d44e2003-12-23 08:09:43 +00001405
1406 if (isis->area_list->count == 0)
1407 return CMD_SUCCESS;
jardineb5d44e2003-12-23 08:09:43 +00001408
Josh Bailey3f045a02012-03-24 08:35:20 -07001409 memset (&lspid, 0, ISIS_SYS_ID_LEN);
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001410 memset (&sysid, 0, 255);
Josh Bailey3f045a02012-03-24 08:35:20 -07001411
1412 /*
1413 * extract fragment and pseudo id from the string argv
1414 * in the forms:
1415 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1416 * (b) <systemid/hostname>.<pseudo-id> or
1417 * (c) <systemid/hostname> or
1418 * Where systemid is in the form:
1419 * xxxx.xxxx.xxxx
1420 */
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001421 if (argv)
1422 strncpy (sysid, argv, 254);
Josh Bailey3f045a02012-03-24 08:35:20 -07001423 if (argv && strlen (argv) > 3)
1424 {
1425 pos = argv + strlen (argv) - 3;
1426 if (strncmp (pos, "-", 1) == 0)
1427 {
1428 memcpy (number, ++pos, 2);
1429 lspid[ISIS_SYS_ID_LEN+1] = (u_char) strtol ((char *)number, NULL, 16);
1430 pos -= 4;
1431 if (strncmp (pos, ".", 1) != 0)
1432 return CMD_ERR_AMBIGUOUS;
1433 }
1434 if (strncmp (pos, ".", 1) == 0)
1435 {
1436 memcpy (number, ++pos, 2);
1437 lspid[ISIS_SYS_ID_LEN] = (u_char) strtol ((char *)number, NULL, 16);
1438 sysid[pos - argv - 1] = '\0';
1439 }
1440 }
1441
hasso3fdb2dd2005-09-28 18:45:54 +00001442 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +00001443 {
hassof390d2c2004-09-10 20:48:21 +00001444 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
Josh Bailey3f045a02012-03-24 08:35:20 -07001445 VTY_NEWLINE);
1446
hassof390d2c2004-09-10 20:48:21 +00001447 for (level = 0; level < ISIS_LEVELS; level++)
Josh Bailey3f045a02012-03-24 08:35:20 -07001448 {
1449 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
1450 {
1451 lsp = NULL;
1452 if (argv != NULL)
1453 {
1454 /*
1455 * Try to find the lsp-id if the argv string is in
1456 * the form hostname.<pseudo-id>-<fragment>
1457 */
1458 if (sysid2buff (lspid, sysid))
1459 {
1460 lsp = lsp_search (lspid, area->lspdb[level]);
1461 }
1462 else if ((dynhn = dynhn_find_by_name (sysid)))
1463 {
1464 memcpy (lspid, dynhn->id, ISIS_SYS_ID_LEN);
1465 lsp = lsp_search (lspid, area->lspdb[level]);
1466 }
1467 else if (strncmp(unix_hostname (), sysid, 15) == 0)
1468 {
1469 memcpy (lspid, isis->sysid, ISIS_SYS_ID_LEN);
1470 lsp = lsp_search (lspid, area->lspdb[level]);
1471 }
1472 }
jardineb5d44e2003-12-23 08:09:43 +00001473
Josh Bailey3f045a02012-03-24 08:35:20 -07001474 if (lsp != NULL || argv == NULL)
1475 {
1476 vty_out (vty, "IS-IS Level-%d link-state database:%s",
1477 level + 1, VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +00001478
Josh Bailey3f045a02012-03-24 08:35:20 -07001479 /* print the title in all cases */
1480 vty_out (vty, "LSP ID PduLen "
1481 "SeqNumber Chksum Holdtime ATT/P/OL%s",
1482 VTY_NEWLINE);
1483 }
1484
1485 if (lsp)
1486 {
1487 if (ui_level == ISIS_UI_LEVEL_DETAIL)
1488 lsp_print_detail (lsp, vty, area->dynhostname);
1489 else
1490 lsp_print (lsp, vty, area->dynhostname);
1491 }
1492 else if (argv == NULL)
1493 {
1494 lsp_count = lsp_print_all (vty, area->lspdb[level],
1495 ui_level,
1496 area->dynhostname);
1497
1498 vty_out (vty, " %u LSPs%s%s",
1499 lsp_count, VTY_NEWLINE, VTY_NEWLINE);
1500 }
1501 }
1502 }
jardineb5d44e2003-12-23 08:09:43 +00001503 }
jardineb5d44e2003-12-23 08:09:43 +00001504
1505 return CMD_SUCCESS;
1506}
1507
Josh Bailey3f045a02012-03-24 08:35:20 -07001508DEFUN (show_database_brief,
1509 show_database_cmd,
1510 "show isis database",
1511 SHOW_STR
1512 "IS-IS information\n"
1513 "IS-IS link state database\n")
1514{
1515 return show_isis_database (vty, NULL, ISIS_UI_LEVEL_BRIEF);
1516}
1517
1518DEFUN (show_database_lsp_brief,
1519 show_database_arg_cmd,
1520 "show isis database WORD",
1521 SHOW_STR
1522 "IS-IS information\n"
1523 "IS-IS link state database\n"
1524 "LSP ID\n")
1525{
1526 return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_BRIEF);
1527}
1528
1529DEFUN (show_database_lsp_detail,
1530 show_database_arg_detail_cmd,
1531 "show isis database WORD detail",
1532 SHOW_STR
1533 "IS-IS information\n"
1534 "IS-IS link state database\n"
1535 "LSP ID\n"
1536 "Detailed information\n")
1537{
1538 return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
1539}
1540
jardineb5d44e2003-12-23 08:09:43 +00001541DEFUN (show_database_detail,
1542 show_database_detail_cmd,
1543 "show isis database detail",
1544 SHOW_STR
1545 "IS-IS information\n"
1546 "IS-IS link state database\n")
1547{
Josh Bailey3f045a02012-03-24 08:35:20 -07001548 return show_isis_database (vty, NULL, ISIS_UI_LEVEL_DETAIL);
1549}
jardineb5d44e2003-12-23 08:09:43 +00001550
Josh Bailey3f045a02012-03-24 08:35:20 -07001551DEFUN (show_database_detail_lsp,
1552 show_database_detail_arg_cmd,
1553 "show isis database detail WORD",
1554 SHOW_STR
1555 "IS-IS information\n"
1556 "IS-IS link state database\n"
1557 "Detailed information\n"
1558 "LSP ID\n")
1559{
1560 return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
jardineb5d44e2003-12-23 08:09:43 +00001561}
1562
1563/*
1564 * 'router isis' command
1565 */
1566DEFUN (router_isis,
1567 router_isis_cmd,
1568 "router isis WORD",
hassof390d2c2004-09-10 20:48:21 +00001569 ROUTER_STR
jardineb5d44e2003-12-23 08:09:43 +00001570 "ISO IS-IS\n"
1571 "ISO Routing area tag")
1572{
jardineb5d44e2003-12-23 08:09:43 +00001573 return isis_area_get (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001574}
1575
1576/*
1577 *'no router isis' command
1578 */
1579DEFUN (no_router_isis,
1580 no_router_isis_cmd,
1581 "no router isis WORD",
hassof390d2c2004-09-10 20:48:21 +00001582 "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag")
jardineb5d44e2003-12-23 08:09:43 +00001583{
1584 return isis_area_destroy (vty, argv[0]);
1585}
1586
1587/*
1588 * 'net' command
1589 */
1590DEFUN (net,
1591 net_cmd,
1592 "net WORD",
1593 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001594 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001595{
Paul Jakma41b36e92006-12-08 01:09:50 +00001596 return area_net_title (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001597}
1598
jardineb5d44e2003-12-23 08:09:43 +00001599/*
1600 * 'no net' command
1601 */
1602DEFUN (no_net,
1603 no_net_cmd,
1604 "no net WORD",
1605 NO_STR
1606 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001607 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001608{
Paul Jakma41b36e92006-12-08 01:09:50 +00001609 return area_clear_net_title (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001610}
1611
Christian Frankef1fc1db2015-11-10 18:43:31 +01001612static
1613int area_set_lsp_mtu(struct vty *vty, struct isis_area *area, unsigned int lsp_mtu)
1614{
1615 struct isis_circuit *circuit;
1616 struct listnode *node;
1617
1618 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit))
1619 {
1620 if(lsp_mtu > isis_circuit_pdu_size(circuit))
1621 {
1622 vty_out(vty, "ISIS area contains circuit %s, which has a maximum PDU size of %zu.%s",
1623 circuit->interface->name, isis_circuit_pdu_size(circuit),
1624 VTY_NEWLINE);
1625 return CMD_ERR_AMBIGUOUS;
1626 }
1627 }
1628
1629 area->lsp_mtu = lsp_mtu;
1630 lsp_regenerate_schedule(area, IS_LEVEL_1_AND_2, 1);
1631
1632 return CMD_SUCCESS;
1633}
1634
1635DEFUN (area_lsp_mtu,
1636 area_lsp_mtu_cmd,
1637 "lsp-mtu <128-4352>",
1638 "Configure the maximum size of generated LSPs\n"
1639 "Maximum size of generated LSPs\n")
1640{
1641 struct isis_area *area;
1642
1643 area = vty->index;
1644 if (!area)
1645 {
1646 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1647 return CMD_ERR_NO_MATCH;
1648 }
1649
1650 unsigned int lsp_mtu;
1651
1652 VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0], 128, 4352);
1653
1654 return area_set_lsp_mtu(vty, area, lsp_mtu);
1655}
1656
1657DEFUN(no_area_lsp_mtu,
1658 no_area_lsp_mtu_cmd,
1659 "no lsp-mtu",
1660 NO_STR
1661 "Configure the maximum size of generated LSPs\n")
1662{
1663 struct isis_area *area;
1664
1665 area = vty->index;
1666 if (!area)
1667 {
1668 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1669 return CMD_ERR_NO_MATCH;
1670 }
1671
1672 return area_set_lsp_mtu(vty, area, DEFAULT_LSP_MTU);
1673}
1674
1675ALIAS(no_area_lsp_mtu,
1676 no_area_lsp_mtu_arg_cmd,
1677 "no lsp-mtu <128-4352>",
1678 NO_STR
1679 "Configure the maximum size of generated LSPs\n"
1680 "Maximum size of generated LSPs\n");
1681
Josh Bailey3f045a02012-03-24 08:35:20 -07001682DEFUN (area_passwd_md5,
1683 area_passwd_md5_cmd,
1684 "area-password md5 WORD",
jardineb5d44e2003-12-23 08:09:43 +00001685 "Configure the authentication password for an area\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001686 "Authentication type\n"
hassof390d2c2004-09-10 20:48:21 +00001687 "Area password\n")
jardineb5d44e2003-12-23 08:09:43 +00001688{
1689 struct isis_area *area;
1690 int len;
1691
1692 area = vty->index;
1693
hassof390d2c2004-09-10 20:48:21 +00001694 if (!area)
1695 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001696 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1697 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001698 }
1699
jardineb5d44e2003-12-23 08:09:43 +00001700 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001701 if (len > 254)
1702 {
1703 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001704 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001705 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001706
1707 area->area_passwd.len = (u_char) len;
1708 area->area_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1709 strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
1710
1711 if (argc > 1)
1712 {
1713 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1714 if (strncmp(argv[1], "v", 1) == 0)
1715 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1716 else
1717 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1718 }
1719 else
1720 {
1721 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1722 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1723 }
1724 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1725
1726 return CMD_SUCCESS;
1727}
1728
1729ALIAS (area_passwd_md5,
1730 area_passwd_md5_snpauth_cmd,
1731 "area-password md5 WORD authenticate snp (send-only|validate)",
1732 "Configure the authentication password for an area\n"
1733 "Authentication type\n"
1734 "Area password\n"
1735 "Authentication\n"
1736 "SNP PDUs\n"
1737 "Send but do not check PDUs on receiving\n"
David Lamparterb7d50212015-03-03 08:53:18 +01001738 "Send and check PDUs on receiving\n")
Josh Bailey3f045a02012-03-24 08:35:20 -07001739
1740DEFUN (area_passwd_clear,
1741 area_passwd_clear_cmd,
1742 "area-password clear WORD",
1743 "Configure the authentication password for an area\n"
1744 "Authentication type\n"
1745 "Area password\n")
1746{
1747 struct isis_area *area;
1748 int len;
1749
1750 area = vty->index;
1751
1752 if (!area)
1753 {
1754 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1755 return CMD_ERR_NO_MATCH;
1756 }
1757
1758 len = strlen (argv[0]);
1759 if (len > 254)
1760 {
1761 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1762 return CMD_ERR_AMBIGUOUS;
1763 }
1764
hassof390d2c2004-09-10 20:48:21 +00001765 area->area_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001766 area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001767 strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001768
hasso1cbc5622005-01-01 10:29:51 +00001769 if (argc > 1)
1770 {
1771 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1772 if (strncmp(argv[1], "v", 1) == 0)
1773 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1774 else
1775 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1776 }
1777 else
1778 {
1779 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1780 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1781 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001782 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
hasso1cbc5622005-01-01 10:29:51 +00001783
jardineb5d44e2003-12-23 08:09:43 +00001784 return CMD_SUCCESS;
1785}
1786
Josh Bailey3f045a02012-03-24 08:35:20 -07001787ALIAS (area_passwd_clear,
1788 area_passwd_clear_snpauth_cmd,
1789 "area-password clear WORD authenticate snp (send-only|validate)",
hasso1cbc5622005-01-01 10:29:51 +00001790 "Configure the authentication password for an area\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001791 "Authentication type\n"
hasso1cbc5622005-01-01 10:29:51 +00001792 "Area password\n"
1793 "Authentication\n"
1794 "SNP PDUs\n"
1795 "Send but do not check PDUs on receiving\n"
David Lamparterb7d50212015-03-03 08:53:18 +01001796 "Send and check PDUs on receiving\n")
hasso1cbc5622005-01-01 10:29:51 +00001797
jardineb5d44e2003-12-23 08:09:43 +00001798DEFUN (no_area_passwd,
1799 no_area_passwd_cmd,
1800 "no area-password",
1801 NO_STR
1802 "Configure the authentication password for an area\n")
1803{
1804 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001805
jardineb5d44e2003-12-23 08:09:43 +00001806 area = vty->index;
1807
hassof390d2c2004-09-10 20:48:21 +00001808 if (!area)
1809 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001810 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1811 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001812 }
1813
jardineb5d44e2003-12-23 08:09:43 +00001814 memset (&area->area_passwd, 0, sizeof (struct isis_passwd));
Josh Bailey3f045a02012-03-24 08:35:20 -07001815 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
jardineb5d44e2003-12-23 08:09:43 +00001816
1817 return CMD_SUCCESS;
1818}
1819
Josh Bailey3f045a02012-03-24 08:35:20 -07001820DEFUN (domain_passwd_md5,
1821 domain_passwd_md5_cmd,
1822 "domain-password md5 WORD",
jardineb5d44e2003-12-23 08:09:43 +00001823 "Set the authentication password for a routing domain\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001824 "Authentication type\n"
hassof390d2c2004-09-10 20:48:21 +00001825 "Routing domain password\n")
jardineb5d44e2003-12-23 08:09:43 +00001826{
1827 struct isis_area *area;
1828 int len;
1829
1830 area = vty->index;
1831
hassof390d2c2004-09-10 20:48:21 +00001832 if (!area)
1833 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001834 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1835 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001836 }
1837
jardineb5d44e2003-12-23 08:09:43 +00001838 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001839 if (len > 254)
1840 {
1841 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001842 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001843 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001844
1845 area->domain_passwd.len = (u_char) len;
1846 area->domain_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1847 strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
1848
1849 if (argc > 1)
1850 {
1851 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1852 if (strncmp(argv[1], "v", 1) == 0)
1853 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1854 else
1855 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1856 }
1857 else
1858 {
1859 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1860 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1861 }
1862 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1863
1864 return CMD_SUCCESS;
1865}
1866
1867ALIAS (domain_passwd_md5,
1868 domain_passwd_md5_snpauth_cmd,
1869 "domain-password md5 WORD authenticate snp (send-only|validate)",
1870 "Set the authentication password for a routing domain\n"
1871 "Authentication type\n"
1872 "Routing domain password\n"
1873 "Authentication\n"
1874 "SNP PDUs\n"
1875 "Send but do not check PDUs on receiving\n"
David Lamparterb7d50212015-03-03 08:53:18 +01001876 "Send and check PDUs on receiving\n")
Josh Bailey3f045a02012-03-24 08:35:20 -07001877
1878DEFUN (domain_passwd_clear,
1879 domain_passwd_clear_cmd,
1880 "domain-password clear WORD",
1881 "Set the authentication password for a routing domain\n"
1882 "Authentication type\n"
1883 "Routing domain password\n")
1884{
1885 struct isis_area *area;
1886 int len;
1887
1888 area = vty->index;
1889
1890 if (!area)
1891 {
1892 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1893 return CMD_ERR_NO_MATCH;
1894 }
1895
1896 len = strlen (argv[0]);
1897 if (len > 254)
1898 {
1899 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1900 return CMD_ERR_AMBIGUOUS;
1901 }
1902
hassof390d2c2004-09-10 20:48:21 +00001903 area->domain_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001904 area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001905 strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001906
hasso1cbc5622005-01-01 10:29:51 +00001907 if (argc > 1)
1908 {
1909 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1910 if (strncmp(argv[1], "v", 1) == 0)
1911 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1912 else
1913 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1914 }
1915 else
1916 {
1917 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1918 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1919 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001920 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
hasso1cbc5622005-01-01 10:29:51 +00001921
jardineb5d44e2003-12-23 08:09:43 +00001922 return CMD_SUCCESS;
1923}
1924
Josh Bailey3f045a02012-03-24 08:35:20 -07001925ALIAS (domain_passwd_clear,
1926 domain_passwd_clear_snpauth_cmd,
1927 "domain-password clear WORD authenticate snp (send-only|validate)",
hasso1cbc5622005-01-01 10:29:51 +00001928 "Set the authentication password for a routing domain\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001929 "Authentication type\n"
hasso1cbc5622005-01-01 10:29:51 +00001930 "Routing domain password\n"
1931 "Authentication\n"
1932 "SNP PDUs\n"
1933 "Send but do not check PDUs on receiving\n"
David Lamparterb7d50212015-03-03 08:53:18 +01001934 "Send and check PDUs on receiving\n")
hasso1cbc5622005-01-01 10:29:51 +00001935
jardineb5d44e2003-12-23 08:09:43 +00001936DEFUN (no_domain_passwd,
1937 no_domain_passwd_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07001938 "no domain-password",
jardineb5d44e2003-12-23 08:09:43 +00001939 NO_STR
1940 "Set the authentication password for a routing domain\n")
1941{
1942 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001943
jardineb5d44e2003-12-23 08:09:43 +00001944 area = vty->index;
1945
hassof390d2c2004-09-10 20:48:21 +00001946 if (!area)
1947 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001948 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1949 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001950 }
1951
jardineb5d44e2003-12-23 08:09:43 +00001952 memset (&area->domain_passwd, 0, sizeof (struct isis_passwd));
Josh Bailey3f045a02012-03-24 08:35:20 -07001953 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
hassof390d2c2004-09-10 20:48:21 +00001954
jardineb5d44e2003-12-23 08:09:43 +00001955 return CMD_SUCCESS;
1956}
1957
1958DEFUN (is_type,
1959 is_type_cmd,
1960 "is-type (level-1|level-1-2|level-2-only)",
1961 "IS Level for this routing process (OSI only)\n"
1962 "Act as a station router only\n"
1963 "Act as both a station router and an area router\n"
1964 "Act as an area router only\n")
1965{
1966 struct isis_area *area;
1967 int type;
1968
1969 area = vty->index;
1970
hassof390d2c2004-09-10 20:48:21 +00001971 if (!area)
1972 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001973 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1974 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001975 }
jardineb5d44e2003-12-23 08:09:43 +00001976
Paul Jakma41b36e92006-12-08 01:09:50 +00001977 type = string2circuit_t (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001978 if (!type)
1979 {
1980 vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
1981 return CMD_SUCCESS;
1982 }
jardineb5d44e2003-12-23 08:09:43 +00001983
1984 isis_event_system_type_change (area, type);
hassof390d2c2004-09-10 20:48:21 +00001985
jardineb5d44e2003-12-23 08:09:43 +00001986 return CMD_SUCCESS;
1987}
1988
1989DEFUN (no_is_type,
1990 no_is_type_cmd,
1991 "no is-type (level-1|level-1-2|level-2-only)",
1992 NO_STR
1993 "IS Level for this routing process (OSI only)\n"
1994 "Act as a station router only\n"
1995 "Act as both a station router and an area router\n"
1996 "Act as an area router only\n")
1997{
jardineb5d44e2003-12-23 08:09:43 +00001998 struct isis_area *area;
1999 int type;
2000
2001 area = vty->index;
2002 assert (area);
hassof390d2c2004-09-10 20:48:21 +00002003
jardineb5d44e2003-12-23 08:09:43 +00002004 /*
Josh Bailey3f045a02012-03-24 08:35:20 -07002005 * Put the is-type back to defaults:
2006 * - level-1-2 on first area
2007 * - level-1 for the rest
jardineb5d44e2003-12-23 08:09:43 +00002008 */
paul1eb8ef22005-04-07 07:30:20 +00002009 if (listgetdata (listhead (isis->area_list)) == area)
jardineb5d44e2003-12-23 08:09:43 +00002010 type = IS_LEVEL_1_AND_2;
2011 else
2012 type = IS_LEVEL_1;
2013
2014 isis_event_system_type_change (area, type);
2015
2016 return CMD_SUCCESS;
2017}
2018
Josh Bailey3f045a02012-03-24 08:35:20 -07002019static int
2020set_lsp_gen_interval (struct vty *vty, struct isis_area *area,
2021 uint16_t interval, int level)
2022{
2023 int lvl;
2024
2025 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2026 {
2027 if (!(lvl & level))
2028 continue;
2029
2030 if (interval >= area->lsp_refresh[lvl-1])
2031 {
2032 vty_out (vty, "LSP gen interval %us must be less than "
2033 "the LSP refresh interval %us%s",
2034 interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
2035 return CMD_ERR_AMBIGUOUS;
2036 }
2037 }
2038
2039 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2040 {
2041 if (!(lvl & level))
2042 continue;
2043 area->lsp_gen_interval[lvl-1] = interval;
2044 }
2045
2046 return CMD_SUCCESS;
2047}
2048
jardineb5d44e2003-12-23 08:09:43 +00002049DEFUN (lsp_gen_interval,
2050 lsp_gen_interval_cmd,
2051 "lsp-gen-interval <1-120>",
2052 "Minimum interval between regenerating same LSP\n"
2053 "Minimum interval in seconds\n")
2054{
2055 struct isis_area *area;
2056 uint16_t interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002057 int level;
jardineb5d44e2003-12-23 08:09:43 +00002058
2059 area = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002060 interval = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002061 level = IS_LEVEL_1 | IS_LEVEL_2;
2062 return set_lsp_gen_interval (vty, area, interval, level);
jardineb5d44e2003-12-23 08:09:43 +00002063}
2064
2065DEFUN (no_lsp_gen_interval,
2066 no_lsp_gen_interval_cmd,
2067 "no lsp-gen-interval",
2068 NO_STR
hassof390d2c2004-09-10 20:48:21 +00002069 "Minimum interval between regenerating same LSP\n")
jardineb5d44e2003-12-23 08:09:43 +00002070{
2071 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07002072 uint16_t interval;
2073 int level;
jardineb5d44e2003-12-23 08:09:43 +00002074
2075 area = vty->index;
Josh Bailey3f045a02012-03-24 08:35:20 -07002076 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
2077 level = IS_LEVEL_1 | IS_LEVEL_2;
2078 return set_lsp_gen_interval (vty, area, interval, level);
jardineb5d44e2003-12-23 08:09:43 +00002079}
2080
2081ALIAS (no_lsp_gen_interval,
2082 no_lsp_gen_interval_arg_cmd,
2083 "no lsp-gen-interval <1-120>",
2084 NO_STR
2085 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00002086 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002087
2088DEFUN (lsp_gen_interval_l1,
2089 lsp_gen_interval_l1_cmd,
2090 "lsp-gen-interval level-1 <1-120>",
2091 "Minimum interval between regenerating same LSP\n"
2092 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00002093 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002094{
2095 struct isis_area *area;
2096 uint16_t interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002097 int level;
jardineb5d44e2003-12-23 08:09:43 +00002098
2099 area = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002100 interval = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002101 level = IS_LEVEL_1;
2102 return set_lsp_gen_interval (vty, area, interval, level);
jardineb5d44e2003-12-23 08:09:43 +00002103}
2104
2105DEFUN (no_lsp_gen_interval_l1,
2106 no_lsp_gen_interval_l1_cmd,
2107 "no lsp-gen-interval level-1",
2108 NO_STR
2109 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00002110 "Set interval for level 1 only\n")
jardineb5d44e2003-12-23 08:09:43 +00002111{
2112 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07002113 uint16_t interval;
2114 int level;
jardineb5d44e2003-12-23 08:09:43 +00002115
2116 area = vty->index;
Josh Bailey3f045a02012-03-24 08:35:20 -07002117 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
2118 level = IS_LEVEL_1;
2119 return set_lsp_gen_interval (vty, area, interval, level);
jardineb5d44e2003-12-23 08:09:43 +00002120}
2121
2122ALIAS (no_lsp_gen_interval_l1,
2123 no_lsp_gen_interval_l1_arg_cmd,
2124 "no lsp-gen-interval level-1 <1-120>",
2125 NO_STR
2126 "Minimum interval between regenerating same LSP\n"
2127 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00002128 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002129
2130DEFUN (lsp_gen_interval_l2,
2131 lsp_gen_interval_l2_cmd,
2132 "lsp-gen-interval level-2 <1-120>",
2133 "Minimum interval between regenerating same LSP\n"
2134 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00002135 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002136{
2137 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07002138 uint16_t interval;
2139 int level;
jardineb5d44e2003-12-23 08:09:43 +00002140
2141 area = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002142 interval = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002143 level = IS_LEVEL_2;
2144 return set_lsp_gen_interval (vty, area, interval, level);
jardineb5d44e2003-12-23 08:09:43 +00002145}
2146
2147DEFUN (no_lsp_gen_interval_l2,
2148 no_lsp_gen_interval_l2_cmd,
2149 "no lsp-gen-interval level-2",
2150 NO_STR
2151 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00002152 "Set interval for level 2 only\n")
jardineb5d44e2003-12-23 08:09:43 +00002153{
2154 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07002155 uint16_t interval;
2156 int level;
jardineb5d44e2003-12-23 08:09:43 +00002157
2158 area = vty->index;
Josh Bailey3f045a02012-03-24 08:35:20 -07002159 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
2160 level = IS_LEVEL_2;
2161 return set_lsp_gen_interval (vty, area, interval, level);
jardineb5d44e2003-12-23 08:09:43 +00002162}
2163
2164ALIAS (no_lsp_gen_interval_l2,
2165 no_lsp_gen_interval_l2_arg_cmd,
2166 "no lsp-gen-interval level-2 <1-120>",
2167 NO_STR
2168 "Minimum interval between regenerating same LSP\n"
2169 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00002170 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002171
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002172static int
2173validate_metric_style_narrow (struct vty *vty, struct isis_area *area)
2174{
2175 struct isis_circuit *circuit;
2176 struct listnode *node;
2177
2178 if (! vty)
2179 return CMD_ERR_AMBIGUOUS;
2180
2181 if (! area)
2182 {
2183 vty_out (vty, "ISIS area is invalid%s", VTY_NEWLINE);
2184 return CMD_ERR_AMBIGUOUS;
2185 }
2186
2187 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
2188 {
2189 if ((area->is_type & IS_LEVEL_1) &&
2190 (circuit->is_type & IS_LEVEL_1) &&
Christian Franke4fb7c842012-11-27 19:51:59 +00002191 (circuit->te_metric[0] > MAX_NARROW_LINK_METRIC))
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002192 {
2193 vty_out (vty, "ISIS circuit %s metric is invalid%s",
2194 circuit->interface->name, VTY_NEWLINE);
2195 return CMD_ERR_AMBIGUOUS;
2196 }
2197 if ((area->is_type & IS_LEVEL_2) &&
2198 (circuit->is_type & IS_LEVEL_2) &&
Christian Franke4fb7c842012-11-27 19:51:59 +00002199 (circuit->te_metric[1] > MAX_NARROW_LINK_METRIC))
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002200 {
2201 vty_out (vty, "ISIS circuit %s metric is invalid%s",
2202 circuit->interface->name, VTY_NEWLINE);
2203 return CMD_ERR_AMBIGUOUS;
2204 }
2205 }
2206
2207 return CMD_SUCCESS;
2208}
2209
jardineb5d44e2003-12-23 08:09:43 +00002210DEFUN (metric_style,
2211 metric_style_cmd,
hasso2984d262005-09-26 16:49:07 +00002212 "metric-style (narrow|transition|wide)",
jardineb5d44e2003-12-23 08:09:43 +00002213 "Use old-style (ISO 10589) or new-style packet formats\n"
2214 "Use old style of TLVs with narrow metric\n"
hasso2984d262005-09-26 16:49:07 +00002215 "Send and accept both styles of TLVs during transition\n"
jardineb5d44e2003-12-23 08:09:43 +00002216 "Use new style of TLVs to carry wider metric\n")
2217{
2218 struct isis_area *area;
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002219 int ret;
jardineb5d44e2003-12-23 08:09:43 +00002220
2221 area = vty->index;
2222 assert (area);
hasso2984d262005-09-26 16:49:07 +00002223
2224 if (strncmp (argv[0], "w", 1) == 0)
2225 {
2226 area->newmetric = 1;
2227 area->oldmetric = 0;
2228 }
Christian Franke478c1122012-11-27 19:52:00 +00002229 else
hasso2984d262005-09-26 16:49:07 +00002230 {
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002231 ret = validate_metric_style_narrow (vty, area);
2232 if (ret != CMD_SUCCESS)
2233 return ret;
2234
Christian Franke478c1122012-11-27 19:52:00 +00002235 if (strncmp (argv[0], "t", 1) == 0)
2236 {
2237 area->newmetric = 1;
2238 area->oldmetric = 1;
2239 }
2240 else if (strncmp (argv[0], "n", 1) == 0)
2241 {
2242 area->newmetric = 0;
2243 area->oldmetric = 1;
2244 }
hasso2984d262005-09-26 16:49:07 +00002245 }
jardineb5d44e2003-12-23 08:09:43 +00002246
2247 return CMD_SUCCESS;
2248}
2249
2250DEFUN (no_metric_style,
2251 no_metric_style_cmd,
hasso2984d262005-09-26 16:49:07 +00002252 "no metric-style",
jardineb5d44e2003-12-23 08:09:43 +00002253 NO_STR
hasso2984d262005-09-26 16:49:07 +00002254 "Use old-style (ISO 10589) or new-style packet formats\n")
jardineb5d44e2003-12-23 08:09:43 +00002255{
2256 struct isis_area *area;
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002257 int ret;
jardineb5d44e2003-12-23 08:09:43 +00002258
2259 area = vty->index;
2260 assert (area);
2261
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002262 ret = validate_metric_style_narrow (vty, area);
2263 if (ret != CMD_SUCCESS)
2264 return ret;
2265
hasso2984d262005-09-26 16:49:07 +00002266 /* Default is narrow metric. */
2267 area->newmetric = 0;
2268 area->oldmetric = 1;
jardineb5d44e2003-12-23 08:09:43 +00002269
2270 return CMD_SUCCESS;
2271}
2272
Josh Bailey3f045a02012-03-24 08:35:20 -07002273DEFUN (set_overload_bit,
2274 set_overload_bit_cmd,
2275 "set-overload-bit",
2276 "Set overload bit to avoid any transit traffic\n"
2277 "Set overload bit\n")
2278{
2279 struct isis_area *area;
2280
2281 area = vty->index;
2282 assert (area);
2283
2284 area->overload_bit = LSPBIT_OL;
2285 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2286
2287 return CMD_SUCCESS;
2288}
2289
2290DEFUN (no_set_overload_bit,
2291 no_set_overload_bit_cmd,
2292 "no set-overload-bit",
2293 "Reset overload bit to accept transit traffic\n"
2294 "Reset overload bit\n")
2295{
2296 struct isis_area *area;
2297
2298 area = vty->index;
2299 assert (area);
2300
2301 area->overload_bit = 0;
2302 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2303
2304 return CMD_SUCCESS;
2305}
2306
Amritha Nambiarc8ee9402015-08-24 16:40:14 -07002307DEFUN (set_attached_bit,
2308 set_attached_bit_cmd,
2309 "set-attached-bit",
2310 "Set attached bit to identify as L1/L2 router for inter-area traffic\n"
2311 "Set attached bit\n")
2312{
2313 struct isis_area *area;
2314
2315 area = vty->index;
2316 assert (area);
2317
2318 area->attached_bit = LSPBIT_ATT;
2319 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2320
2321 return CMD_SUCCESS;
2322}
2323
2324DEFUN (no_set_attached_bit,
2325 no_set_attached_bit_cmd,
2326 "no set-attached-bit",
2327 "Reset attached bit\n")
2328{
2329 struct isis_area *area;
2330
2331 area = vty->index;
2332 assert (area);
2333
2334 area->attached_bit = 0;
2335 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2336
2337 return CMD_SUCCESS;
2338}
2339
jardineb5d44e2003-12-23 08:09:43 +00002340DEFUN (dynamic_hostname,
2341 dynamic_hostname_cmd,
2342 "hostname dynamic",
2343 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00002344 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00002345{
2346 struct isis_area *area;
2347
2348 area = vty->index;
2349 assert (area);
hassof390d2c2004-09-10 20:48:21 +00002350
Josh Bailey3f045a02012-03-24 08:35:20 -07002351 if (!area->dynhostname)
2352 {
2353 area->dynhostname = 1;
2354 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0);
2355 }
hassof390d2c2004-09-10 20:48:21 +00002356
jardineb5d44e2003-12-23 08:09:43 +00002357 return CMD_SUCCESS;
2358}
2359
2360DEFUN (no_dynamic_hostname,
2361 no_dynamic_hostname_cmd,
2362 "no hostname dynamic",
2363 NO_STR
2364 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00002365 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00002366{
2367 struct isis_area *area;
2368
2369 area = vty->index;
2370 assert (area);
hassof390d2c2004-09-10 20:48:21 +00002371
Josh Bailey3f045a02012-03-24 08:35:20 -07002372 if (area->dynhostname)
2373 {
2374 area->dynhostname = 0;
2375 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0);
2376 }
hassof390d2c2004-09-10 20:48:21 +00002377
jardineb5d44e2003-12-23 08:09:43 +00002378 return CMD_SUCCESS;
2379}
2380
2381DEFUN (spf_interval,
2382 spf_interval_cmd,
2383 "spf-interval <1-120>",
hasso2097cd82003-12-23 11:51:08 +00002384 "Minimum interval between SPF calculations\n"
jardineb5d44e2003-12-23 08:09:43 +00002385 "Minimum interval between consecutive SPFs in seconds\n")
2386{
2387 struct isis_area *area;
2388 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00002389
jardineb5d44e2003-12-23 08:09:43 +00002390 area = vty->index;
2391 interval = atoi (argv[0]);
2392 area->min_spf_interval[0] = interval;
2393 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00002394
jardineb5d44e2003-12-23 08:09:43 +00002395 return CMD_SUCCESS;
2396}
2397
2398DEFUN (no_spf_interval,
2399 no_spf_interval_cmd,
2400 "no spf-interval",
2401 NO_STR
hassof390d2c2004-09-10 20:48:21 +00002402 "Minimum interval between SPF calculations\n")
jardineb5d44e2003-12-23 08:09:43 +00002403{
2404 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00002405
jardineb5d44e2003-12-23 08:09:43 +00002406 area = vty->index;
2407
2408 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
2409 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002410
jardineb5d44e2003-12-23 08:09:43 +00002411 return CMD_SUCCESS;
2412}
2413
2414ALIAS (no_spf_interval,
2415 no_spf_interval_arg_cmd,
2416 "no spf-interval <1-120>",
2417 NO_STR
2418 "Minimum interval between SPF calculations\n"
hassof390d2c2004-09-10 20:48:21 +00002419 "Minimum interval between consecutive SPFs in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002420
2421DEFUN (spf_interval_l1,
2422 spf_interval_l1_cmd,
2423 "spf-interval level-1 <1-120>",
2424 "Minimum interval between SPF calculations\n"
2425 "Set interval for level 1 only\n"
2426 "Minimum interval between consecutive SPFs in seconds\n")
2427{
2428 struct isis_area *area;
2429 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00002430
jardineb5d44e2003-12-23 08:09:43 +00002431 area = vty->index;
2432 interval = atoi (argv[0]);
2433 area->min_spf_interval[0] = interval;
hassof390d2c2004-09-10 20:48:21 +00002434
jardineb5d44e2003-12-23 08:09:43 +00002435 return CMD_SUCCESS;
2436}
2437
2438DEFUN (no_spf_interval_l1,
2439 no_spf_interval_l1_cmd,
2440 "no spf-interval level-1",
2441 NO_STR
2442 "Minimum interval between SPF calculations\n"
2443 "Set interval for level 1 only\n")
2444{
2445 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00002446
jardineb5d44e2003-12-23 08:09:43 +00002447 area = vty->index;
2448
2449 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002450
jardineb5d44e2003-12-23 08:09:43 +00002451 return CMD_SUCCESS;
2452}
2453
2454ALIAS (no_spf_interval,
2455 no_spf_interval_l1_arg_cmd,
2456 "no spf-interval level-1 <1-120>",
2457 NO_STR
2458 "Minimum interval between SPF calculations\n"
2459 "Set interval for level 1 only\n"
2460 "Minimum interval between consecutive SPFs in seconds\n")
2461
2462DEFUN (spf_interval_l2,
2463 spf_interval_l2_cmd,
2464 "spf-interval level-2 <1-120>",
2465 "Minimum interval between SPF calculations\n"
2466 "Set interval for level 2 only\n"
2467 "Minimum interval between consecutive SPFs in seconds\n")
2468{
2469 struct isis_area *area;
2470 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00002471
jardineb5d44e2003-12-23 08:09:43 +00002472 area = vty->index;
2473 interval = atoi (argv[0]);
2474 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00002475
jardineb5d44e2003-12-23 08:09:43 +00002476 return CMD_SUCCESS;
2477}
2478
2479DEFUN (no_spf_interval_l2,
2480 no_spf_interval_l2_cmd,
2481 "no spf-interval level-2",
2482 NO_STR
2483 "Minimum interval between SPF calculations\n"
2484 "Set interval for level 2 only\n")
2485{
2486 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00002487
jardineb5d44e2003-12-23 08:09:43 +00002488 area = vty->index;
2489
2490 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002491
jardineb5d44e2003-12-23 08:09:43 +00002492 return CMD_SUCCESS;
2493}
2494
2495ALIAS (no_spf_interval,
2496 no_spf_interval_l2_arg_cmd,
2497 "no spf-interval level-2 <1-120>",
2498 NO_STR
2499 "Minimum interval between SPF calculations\n"
2500 "Set interval for level 2 only\n"
2501 "Minimum interval between consecutive SPFs in seconds\n")
2502
Josh Bailey3f045a02012-03-24 08:35:20 -07002503static int
2504set_lsp_max_lifetime (struct vty *vty, struct isis_area *area,
2505 uint16_t interval, int level)
2506{
2507 int lvl;
2508 int set_refresh_interval[ISIS_LEVELS] = {0, 0};
2509 uint16_t refresh_interval;
2510
2511 refresh_interval = interval - 300;
2512
2513 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
2514 {
2515 if (!(lvl & level))
2516 continue;
2517 if (refresh_interval < area->lsp_refresh[lvl-1])
2518 {
2519 vty_out (vty, "Level %d Max LSP lifetime %us must be 300s greater than "
2520 "the configured LSP refresh interval %us%s",
2521 lvl, interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
2522 vty_out (vty, "Automatically reducing level %d LSP refresh interval "
2523 "to %us%s", lvl, refresh_interval, VTY_NEWLINE);
2524 set_refresh_interval[lvl-1] = 1;
2525
2526 if (refresh_interval <= area->lsp_gen_interval[lvl-1])
2527 {
2528 vty_out (vty, "LSP refresh interval %us must be greater than "
2529 "the configured LSP gen interval %us%s",
2530 refresh_interval, area->lsp_gen_interval[lvl-1],
2531 VTY_NEWLINE);
2532 return CMD_ERR_AMBIGUOUS;
2533 }
2534 }
2535 }
2536
2537 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
2538 {
2539 if (!(lvl & level))
2540 continue;
2541 area->max_lsp_lifetime[lvl-1] = interval;
2542 /* Automatically reducing lsp_refresh_interval to interval - 300 */
2543 if (set_refresh_interval[lvl-1])
2544 area->lsp_refresh[lvl-1] = refresh_interval;
2545 }
2546
2547 lsp_regenerate_schedule (area, level, 1);
2548
2549 return CMD_SUCCESS;
2550}
2551
2552DEFUN (max_lsp_lifetime,
2553 max_lsp_lifetime_cmd,
2554 "max-lsp-lifetime <350-65535>",
2555 "Maximum LSP lifetime\n"
2556 "LSP lifetime in seconds\n")
2557{
2558 struct isis_area *area;
2559 uint16_t interval;
2560 int level;
2561
2562 area = vty->index;
2563 interval = atoi (argv[0]);
2564 level = IS_LEVEL_1 | IS_LEVEL_2;
2565 return set_lsp_max_lifetime (vty, area, interval, level);
2566}
2567
2568DEFUN (no_max_lsp_lifetime,
2569 no_max_lsp_lifetime_cmd,
2570 "no max-lsp-lifetime",
2571 NO_STR
2572 "LSP lifetime in seconds\n")
2573{
2574 struct isis_area *area;
2575 uint16_t interval;
2576 int level;
2577
2578 area = vty->index;
2579 interval = DEFAULT_LSP_LIFETIME;
2580 level = IS_LEVEL_1 | IS_LEVEL_2;
2581 return set_lsp_max_lifetime (vty, area, interval, level);
2582}
2583
2584ALIAS (no_max_lsp_lifetime,
2585 no_max_lsp_lifetime_arg_cmd,
2586 "no max-lsp-lifetime <350-65535>",
2587 NO_STR
2588 "Maximum LSP lifetime\n"
2589 "LSP lifetime in seconds\n")
2590
2591DEFUN (max_lsp_lifetime_l1,
2592 max_lsp_lifetime_l1_cmd,
2593 "max-lsp-lifetime level-1 <350-65535>",
2594 "Maximum LSP lifetime for Level 1 only\n"
2595 "LSP lifetime for Level 1 only in seconds\n")
2596{
2597 struct isis_area *area;
2598 uint16_t interval;
2599 int level;
2600
2601 area = vty->index;
2602 interval = atoi (argv[0]);
2603 level = IS_LEVEL_1;
2604 return set_lsp_max_lifetime (vty, area, interval, level);
2605}
2606
2607DEFUN (no_max_lsp_lifetime_l1,
2608 no_max_lsp_lifetime_l1_cmd,
2609 "no max-lsp-lifetime level-1",
2610 NO_STR
2611 "LSP lifetime for Level 1 only in seconds\n")
2612{
2613 struct isis_area *area;
2614 uint16_t interval;
2615 int level;
2616
2617 area = vty->index;
2618 interval = DEFAULT_LSP_LIFETIME;
2619 level = IS_LEVEL_1;
2620 return set_lsp_max_lifetime (vty, area, interval, level);
2621}
2622
2623ALIAS (no_max_lsp_lifetime_l1,
2624 no_max_lsp_lifetime_l1_arg_cmd,
2625 "no max-lsp-lifetime level-1 <350-65535>",
2626 NO_STR
2627 "Maximum LSP lifetime for Level 1 only\n"
2628 "LSP lifetime for Level 1 only in seconds\n")
2629
2630DEFUN (max_lsp_lifetime_l2,
2631 max_lsp_lifetime_l2_cmd,
2632 "max-lsp-lifetime level-2 <350-65535>",
2633 "Maximum LSP lifetime for Level 2 only\n"
2634 "LSP lifetime for Level 2 only in seconds\n")
2635{
2636 struct isis_area *area;
2637 uint16_t interval;
2638 int level;
2639
2640 area = vty->index;
2641 interval = atoi (argv[0]);
2642 level = IS_LEVEL_2;
2643 return set_lsp_max_lifetime (vty, area, interval, level);
2644}
2645
2646DEFUN (no_max_lsp_lifetime_l2,
2647 no_max_lsp_lifetime_l2_cmd,
2648 "no max-lsp-lifetime level-2",
2649 NO_STR
2650 "LSP lifetime for Level 2 only in seconds\n")
2651{
2652 struct isis_area *area;
2653 uint16_t interval;
2654 int level;
2655
2656 area = vty->index;
2657 interval = DEFAULT_LSP_LIFETIME;
2658 level = IS_LEVEL_2;
2659 return set_lsp_max_lifetime (vty, area, interval, level);
2660}
2661
2662ALIAS (no_max_lsp_lifetime_l2,
2663 no_max_lsp_lifetime_l2_arg_cmd,
2664 "no max-lsp-lifetime level-2 <350-65535>",
2665 NO_STR
2666 "Maximum LSP lifetime for Level 2 only\n"
2667 "LSP lifetime for Level 2 only in seconds\n")
2668
2669static int
2670set_lsp_refresh_interval (struct vty *vty, struct isis_area *area,
2671 uint16_t interval, int level)
2672{
2673 int lvl;
2674
2675 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2676 {
2677 if (!(lvl & level))
2678 continue;
2679 if (interval <= area->lsp_gen_interval[lvl-1])
2680 {
2681 vty_out (vty, "LSP refresh interval %us must be greater than "
2682 "the configured LSP gen interval %us%s",
2683 interval, area->lsp_gen_interval[lvl-1],
2684 VTY_NEWLINE);
2685 return CMD_ERR_AMBIGUOUS;
2686 }
2687 if (interval > (area->max_lsp_lifetime[lvl-1] - 300))
2688 {
2689 vty_out (vty, "LSP refresh interval %us must be less than "
2690 "the configured LSP lifetime %us less 300%s",
2691 interval, area->max_lsp_lifetime[lvl-1],
2692 VTY_NEWLINE);
2693 return CMD_ERR_AMBIGUOUS;
2694 }
2695 }
2696
2697 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2698 {
2699 if (!(lvl & level))
2700 continue;
2701 area->lsp_refresh[lvl-1] = interval;
2702 }
2703 lsp_regenerate_schedule (area, level, 1);
2704
2705 return CMD_SUCCESS;
2706}
2707
2708DEFUN (lsp_refresh_interval,
2709 lsp_refresh_interval_cmd,
2710 "lsp-refresh-interval <1-65235>",
2711 "LSP refresh interval\n"
2712 "LSP refresh interval in seconds\n")
2713{
2714 struct isis_area *area;
2715 uint16_t interval;
2716 int level;
2717
2718 area = vty->index;
2719 interval = atoi (argv[0]);
2720 level = IS_LEVEL_1 | IS_LEVEL_2;
2721 return set_lsp_refresh_interval (vty, area, interval, level);
2722}
2723
2724DEFUN (no_lsp_refresh_interval,
2725 no_lsp_refresh_interval_cmd,
2726 "no lsp-refresh-interval",
2727 NO_STR
2728 "LSP refresh interval in seconds\n")
2729{
2730 struct isis_area *area;
2731 uint16_t interval;
2732 int level;
2733
2734 area = vty->index;
2735 interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
2736 level = IS_LEVEL_1 | IS_LEVEL_2;
2737 return set_lsp_refresh_interval (vty, area, interval, level);
2738}
2739
2740ALIAS (no_lsp_refresh_interval,
2741 no_lsp_refresh_interval_arg_cmd,
2742 "no lsp-refresh-interval <1-65235>",
2743 NO_STR
2744 "LSP refresh interval\n"
2745 "LSP refresh interval in seconds\n")
2746
2747DEFUN (lsp_refresh_interval_l1,
2748 lsp_refresh_interval_l1_cmd,
2749 "lsp-refresh-interval level-1 <1-65235>",
2750 "LSP refresh interval for Level 1 only\n"
2751 "LSP refresh interval for Level 1 only in seconds\n")
2752{
2753 struct isis_area *area;
2754 uint16_t interval;
2755 int level;
2756
2757 area = vty->index;
2758 interval = atoi (argv[0]);
2759 level = IS_LEVEL_1;
2760 return set_lsp_refresh_interval (vty, area, interval, level);
2761}
2762
2763DEFUN (no_lsp_refresh_interval_l1,
2764 no_lsp_refresh_interval_l1_cmd,
2765 "no lsp-refresh-interval level-1",
2766 NO_STR
2767 "LSP refresh interval for Level 1 only in seconds\n")
2768{
2769 struct isis_area *area;
2770 uint16_t interval;
2771 int level;
2772
2773 area = vty->index;
2774 interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
2775 level = IS_LEVEL_1;
2776 return set_lsp_refresh_interval (vty, area, interval, level);
2777}
2778
2779ALIAS (no_lsp_refresh_interval_l1,
2780 no_lsp_refresh_interval_l1_arg_cmd,
2781 "no lsp-refresh-interval level-1 <1-65235>",
2782 NO_STR
2783 "LSP refresh interval for Level 1 only\n"
2784 "LSP refresh interval for Level 1 only in seconds\n")
2785
2786DEFUN (lsp_refresh_interval_l2,
2787 lsp_refresh_interval_l2_cmd,
2788 "lsp-refresh-interval level-2 <1-65235>",
2789 "LSP refresh interval for Level 2 only\n"
2790 "LSP refresh interval for Level 2 only in seconds\n")
2791{
2792 struct isis_area *area;
2793 uint16_t interval;
2794 int level;
2795
2796 area = vty->index;
2797 interval = atoi (argv[0]);
2798 level = IS_LEVEL_2;
2799 return set_lsp_refresh_interval (vty, area, interval, level);
2800}
2801
2802DEFUN (no_lsp_refresh_interval_l2,
2803 no_lsp_refresh_interval_l2_cmd,
2804 "no lsp-refresh-interval level-2",
2805 NO_STR
2806 "LSP refresh interval for Level 2 only in seconds\n")
2807{
2808 struct isis_area *area;
2809 uint16_t interval;
2810 int level;
2811
2812 area = vty->index;
2813 interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
2814 level = IS_LEVEL_2;
2815 return set_lsp_refresh_interval (vty, area, interval, level);
2816}
2817
2818ALIAS (no_lsp_refresh_interval_l2,
2819 no_lsp_refresh_interval_l2_arg_cmd,
2820 "no lsp-refresh-interval level-2 <1-65235>",
2821 NO_STR
2822 "LSP refresh interval for Level 2 only\n"
2823 "LSP refresh interval for Level 2 only in seconds\n")
2824
2825DEFUN (log_adj_changes,
2826 log_adj_changes_cmd,
2827 "log-adjacency-changes",
2828 "Log changes in adjacency state\n")
2829{
2830 struct isis_area *area;
2831
2832 area = vty->index;
2833 assert (area);
2834
2835 area->log_adj_changes = 1;
2836
2837 return CMD_SUCCESS;
2838}
2839
2840DEFUN (no_log_adj_changes,
2841 no_log_adj_changes_cmd,
2842 "no log-adjacency-changes",
2843 "Stop logging changes in adjacency state\n")
2844{
2845 struct isis_area *area;
2846
2847 area = vty->index;
2848 assert (area);
2849
2850 area->log_adj_changes = 0;
2851
2852 return CMD_SUCCESS;
2853}
2854
jardineb5d44e2003-12-23 08:09:43 +00002855#ifdef TOPOLOGY_GENERATE
Josh Bailey3f045a02012-03-24 08:35:20 -07002856
jardineb5d44e2003-12-23 08:09:43 +00002857DEFUN (topology_generate_grid,
2858 topology_generate_grid_cmd,
2859 "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "
2860 "[param]",
hassof1082d12005-09-19 04:23:34 +00002861 "Topology generation for IS-IS\n"
2862 "Topology generation\n"
2863 "Grid topology\n"
jardineb5d44e2003-12-23 08:09:43 +00002864 "X parameter of the grid\n"
2865 "Y parameter of the grid\n"
2866 "Random seed\n"
2867 "Optional param 1\n"
2868 "Optional param 2\n"
2869 "Optional param 3\n"
2870 "Topology\n")
2871{
2872 struct isis_area *area;
2873
2874 area = vty->index;
2875 assert (area);
2876
hassof390d2c2004-09-10 20:48:21 +00002877 if (!spgrid_check_params (vty, argc, argv))
2878 {
2879 if (area->topology)
2880 list_delete (area->topology);
2881 area->topology = list_new ();
2882 memcpy (area->top_params, vty->buf, 200);
2883 gen_spgrid_topology (vty, area->topology);
2884 remove_topology_lsps (area);
2885 generate_topology_lsps (area);
hassof1082d12005-09-19 04:23:34 +00002886 /* Regenerate L1 LSP to get two way connection to the generated
2887 * topology. */
Josh Bailey3f045a02012-03-24 08:35:20 -07002888 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
hassof390d2c2004-09-10 20:48:21 +00002889 }
jardineb5d44e2003-12-23 08:09:43 +00002890
2891 return CMD_SUCCESS;
2892}
2893
hassof695b012005-04-02 19:03:39 +00002894DEFUN (show_isis_generated_topology,
2895 show_isis_generated_topology_cmd,
hassof1082d12005-09-19 04:23:34 +00002896 "show isis generated-topologies",
jardineb5d44e2003-12-23 08:09:43 +00002897 SHOW_STR
Josh Bailey3f045a02012-03-24 08:35:20 -07002898 "ISIS network information\n"
hassof1082d12005-09-19 04:23:34 +00002899 "Show generated topologies\n")
jardineb5d44e2003-12-23 08:09:43 +00002900{
2901 struct isis_area *area;
paul92c9f222005-05-25 12:21:13 +00002902 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +00002903 struct listnode *node2;
2904 struct arc *arc;
hassof1082d12005-09-19 04:23:34 +00002905
paul92c9f222005-05-25 12:21:13 +00002906 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof1082d12005-09-19 04:23:34 +00002907 {
2908 if (!area->topology)
2909 continue;
2910
2911 vty_out (vty, "Topology for isis area: %s%s", area->area_tag,
2912 VTY_NEWLINE);
2913 vty_out (vty, "From node To node Distance%s", VTY_NEWLINE);
2914
2915 for (ALL_LIST_ELEMENTS_RO (area->topology, node2, arc))
2916 vty_out (vty, "%9ld %11ld %12ld%s", arc->from_node, arc->to_node,
2917 arc->distance, VTY_NEWLINE);
2918 }
jardineb5d44e2003-12-23 08:09:43 +00002919 return CMD_SUCCESS;
2920}
2921
hassof1082d12005-09-19 04:23:34 +00002922/* Base IS for topology generation. */
hassof390d2c2004-09-10 20:48:21 +00002923DEFUN (topology_baseis,
jardineb5d44e2003-12-23 08:09:43 +00002924 topology_baseis_cmd,
2925 "topology base-is WORD",
hassof1082d12005-09-19 04:23:34 +00002926 "Topology generation for IS-IS\n"
2927 "A Network IS Base for this topology\n"
2928 "XXXX.XXXX.XXXX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00002929{
2930 struct isis_area *area;
2931 u_char buff[ISIS_SYS_ID_LEN];
2932
2933 area = vty->index;
2934 assert (area);
2935
hassof390d2c2004-09-10 20:48:21 +00002936 if (sysid2buff (buff, argv[0]))
hassof1082d12005-09-19 04:23:34 +00002937 sysid2buff (area->topology_baseis, argv[0]);
hassof390d2c2004-09-10 20:48:21 +00002938
jardineb5d44e2003-12-23 08:09:43 +00002939 return CMD_SUCCESS;
2940}
2941
jardineb5d44e2003-12-23 08:09:43 +00002942DEFUN (no_topology_baseis,
2943 no_topology_baseis_cmd,
2944 "no topology base-is WORD",
2945 NO_STR
hassof1082d12005-09-19 04:23:34 +00002946 "Topology generation for IS-IS\n"
2947 "A Network IS Base for this topology\n"
2948 "XXXX.XXXX.XXXX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00002949{
2950 struct isis_area *area;
2951
2952 area = vty->index;
2953 assert (area);
2954
hassof390d2c2004-09-10 20:48:21 +00002955 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
jardineb5d44e2003-12-23 08:09:43 +00002956 return CMD_SUCCESS;
2957}
2958
hassof1082d12005-09-19 04:23:34 +00002959ALIAS (no_topology_baseis,
2960 no_topology_baseis_noid_cmd,
2961 "no topology base-is",
2962 NO_STR
2963 "Topology generation for IS-IS\n"
2964 "A Network IS Base for this topology\n")
2965
2966DEFUN (topology_basedynh,
2967 topology_basedynh_cmd,
2968 "topology base-dynh WORD",
2969 "Topology generation for IS-IS\n"
2970 "Dynamic hostname base for this topology\n"
2971 "Dynamic hostname base\n")
2972{
2973 struct isis_area *area;
2974
2975 area = vty->index;
2976 assert (area);
2977
2978 /* I hope that it's enough. */
2979 area->topology_basedynh = strndup (argv[0], 16);
2980 return CMD_SUCCESS;
2981}
Josh Bailey3f045a02012-03-24 08:35:20 -07002982
jardineb5d44e2003-12-23 08:09:43 +00002983#endif /* TOPOLOGY_GENERATE */
2984
jardineb5d44e2003-12-23 08:09:43 +00002985/* IS-IS configuration write function */
2986int
2987isis_config_write (struct vty *vty)
2988{
2989 int write = 0;
jardineb5d44e2003-12-23 08:09:43 +00002990
hassof390d2c2004-09-10 20:48:21 +00002991 if (isis != NULL)
2992 {
2993 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +00002994 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +00002995
hasso3fdb2dd2005-09-28 18:45:54 +00002996 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +00002997 {
2998 /* ISIS - Area name */
2999 vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE);
3000 write++;
3001 /* ISIS - Net */
3002 if (listcount (area->area_addrs) > 0)
3003 {
3004 struct area_addr *area_addr;
hasso3fdb2dd2005-09-28 18:45:54 +00003005 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
3006 {
3007 vty_out (vty, " net %s%s",
3008 isonet_print (area_addr->area_addr,
3009 area_addr->addr_len + ISIS_SYS_ID_LEN +
3010 1), VTY_NEWLINE);
3011 write++;
3012 }
hassof390d2c2004-09-10 20:48:21 +00003013 }
hasso3fdb2dd2005-09-28 18:45:54 +00003014 /* ISIS - Dynamic hostname - Defaults to true so only display if
3015 * false. */
hassof390d2c2004-09-10 20:48:21 +00003016 if (!area->dynhostname)
3017 {
3018 vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);
3019 write++;
3020 }
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07003021 /* ISIS - Metric-Style - when true displays wide */
3022 if (area->newmetric)
hassof390d2c2004-09-10 20:48:21 +00003023 {
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07003024 if (!area->oldmetric)
3025 vty_out (vty, " metric-style wide%s", VTY_NEWLINE);
hasso2984d262005-09-26 16:49:07 +00003026 else
3027 vty_out (vty, " metric-style transition%s", VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +00003028 write++;
3029 }
Christian Frankef818c8f2012-11-27 01:10:28 +00003030 else
3031 {
3032 vty_out (vty, " metric-style narrow%s", VTY_NEWLINE);
3033 write++;
3034 }
Josh Bailey3f045a02012-03-24 08:35:20 -07003035 /* ISIS - overload-bit */
3036 if (area->overload_bit)
3037 {
3038 vty_out (vty, " set-overload-bit%s", VTY_NEWLINE);
3039 write++;
3040 }
hassof390d2c2004-09-10 20:48:21 +00003041 /* ISIS - Area is-type (level-1-2 is default) */
3042 if (area->is_type == IS_LEVEL_1)
3043 {
3044 vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
3045 write++;
3046 }
Josh Bailey3f045a02012-03-24 08:35:20 -07003047 else if (area->is_type == IS_LEVEL_2)
hassof390d2c2004-09-10 20:48:21 +00003048 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003049 vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
3050 write++;
hassof390d2c2004-09-10 20:48:21 +00003051 }
3052 /* ISIS - Lsp generation interval */
3053 if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1])
3054 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003055 if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00003056 {
3057 vty_out (vty, " lsp-gen-interval %d%s",
3058 area->lsp_gen_interval[0], VTY_NEWLINE);
3059 write++;
3060 }
3061 }
3062 else
3063 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003064 if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00003065 {
3066 vty_out (vty, " lsp-gen-interval level-1 %d%s",
3067 area->lsp_gen_interval[0], VTY_NEWLINE);
3068 write++;
3069 }
Josh Bailey3f045a02012-03-24 08:35:20 -07003070 if (area->lsp_gen_interval[1] != DEFAULT_MIN_LSP_GEN_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00003071 {
3072 vty_out (vty, " lsp-gen-interval level-2 %d%s",
3073 area->lsp_gen_interval[1], VTY_NEWLINE);
3074 write++;
3075 }
3076 }
3077 /* ISIS - LSP lifetime */
3078 if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1])
3079 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003080 if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
hassof390d2c2004-09-10 20:48:21 +00003081 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003082 vty_out (vty, " max-lsp-lifetime %u%s", area->max_lsp_lifetime[0],
hassof390d2c2004-09-10 20:48:21 +00003083 VTY_NEWLINE);
3084 write++;
3085 }
3086 }
3087 else
3088 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003089 if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
hassof390d2c2004-09-10 20:48:21 +00003090 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003091 vty_out (vty, " max-lsp-lifetime level-1 %u%s",
hassof390d2c2004-09-10 20:48:21 +00003092 area->max_lsp_lifetime[0], VTY_NEWLINE);
3093 write++;
3094 }
Josh Bailey3f045a02012-03-24 08:35:20 -07003095 if (area->max_lsp_lifetime[1] != DEFAULT_LSP_LIFETIME)
hassof390d2c2004-09-10 20:48:21 +00003096 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003097 vty_out (vty, " max-lsp-lifetime level-2 %u%s",
hassof390d2c2004-09-10 20:48:21 +00003098 area->max_lsp_lifetime[1], VTY_NEWLINE);
3099 write++;
3100 }
3101 }
Josh Bailey3f045a02012-03-24 08:35:20 -07003102 /* ISIS - LSP refresh interval */
3103 if (area->lsp_refresh[0] == area->lsp_refresh[1])
3104 {
3105 if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
3106 {
3107 vty_out (vty, " lsp-refresh-interval %u%s", area->lsp_refresh[0],
3108 VTY_NEWLINE);
3109 write++;
3110 }
3111 }
3112 else
3113 {
3114 if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
3115 {
3116 vty_out (vty, " lsp-refresh-interval level-1 %u%s",
3117 area->lsp_refresh[0], VTY_NEWLINE);
3118 write++;
3119 }
3120 if (area->lsp_refresh[1] != DEFAULT_MAX_LSP_GEN_INTERVAL)
3121 {
3122 vty_out (vty, " lsp-refresh-interval level-2 %u%s",
3123 area->lsp_refresh[1], VTY_NEWLINE);
3124 write++;
3125 }
3126 }
Christian Frankef1fc1db2015-11-10 18:43:31 +01003127 if (area->lsp_mtu != DEFAULT_LSP_MTU)
3128 {
3129 vty_out(vty, " lsp-mtu %u%s", area->lsp_mtu, VTY_NEWLINE);
3130 write++;
3131 }
3132
hasso13fb40a2005-10-01 06:03:04 +00003133 /* Minimum SPF interval. */
3134 if (area->min_spf_interval[0] == area->min_spf_interval[1])
3135 {
3136 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
3137 {
3138 vty_out (vty, " spf-interval %d%s",
3139 area->min_spf_interval[0], VTY_NEWLINE);
3140 write++;
3141 }
3142 }
3143 else
3144 {
3145 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
3146 {
3147 vty_out (vty, " spf-interval level-1 %d%s",
3148 area->min_spf_interval[0], VTY_NEWLINE);
3149 write++;
3150 }
3151 if (area->min_spf_interval[1] != MINIMUM_SPF_INTERVAL)
3152 {
3153 vty_out (vty, " spf-interval level-2 %d%s",
3154 area->min_spf_interval[1], VTY_NEWLINE);
3155 write++;
3156 }
3157 }
hasso53c997c2004-09-15 16:21:59 +00003158 /* Authentication passwords. */
Josh Bailey3f045a02012-03-24 08:35:20 -07003159 if (area->area_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
hasso53c997c2004-09-15 16:21:59 +00003160 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003161 vty_out(vty, " area-password md5 %s", area->area_passwd.passwd);
hasso1cbc5622005-01-01 10:29:51 +00003162 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
3163 {
3164 vty_out(vty, " authenticate snp ");
3165 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
3166 vty_out(vty, "validate");
3167 else
3168 vty_out(vty, "send-only");
3169 }
3170 vty_out(vty, "%s", VTY_NEWLINE);
hasso53c997c2004-09-15 16:21:59 +00003171 write++;
Josh Bailey3f045a02012-03-24 08:35:20 -07003172 }
3173 else if (area->area_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
3174 {
3175 vty_out(vty, " area-password clear %s", area->area_passwd.passwd);
3176 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
3177 {
3178 vty_out(vty, " authenticate snp ");
3179 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
3180 vty_out(vty, "validate");
3181 else
3182 vty_out(vty, "send-only");
3183 }
3184 vty_out(vty, "%s", VTY_NEWLINE);
3185 write++;
3186 }
3187 if (area->domain_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
hasso53c997c2004-09-15 16:21:59 +00003188 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003189 vty_out(vty, " domain-password md5 %s",
3190 area->domain_passwd.passwd);
3191 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
3192 {
3193 vty_out(vty, " authenticate snp ");
3194 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
3195 vty_out(vty, "validate");
3196 else
3197 vty_out(vty, "send-only");
3198 }
3199 vty_out(vty, "%s", VTY_NEWLINE);
3200 write++;
3201 }
3202 else if (area->domain_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
3203 {
3204 vty_out(vty, " domain-password clear %s",
3205 area->domain_passwd.passwd);
hasso1cbc5622005-01-01 10:29:51 +00003206 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
3207 {
3208 vty_out(vty, " authenticate snp ");
3209 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
3210 vty_out(vty, "validate");
3211 else
3212 vty_out(vty, "send-only");
3213 }
3214 vty_out(vty, "%s", VTY_NEWLINE);
hasso53c997c2004-09-15 16:21:59 +00003215 write++;
3216 }
hassof1082d12005-09-19 04:23:34 +00003217
Josh Bailey3f045a02012-03-24 08:35:20 -07003218 if (area->log_adj_changes)
3219 {
3220 vty_out (vty, " log-adjacency-changes%s", VTY_NEWLINE);
3221 write++;
3222 }
3223
hassof390d2c2004-09-10 20:48:21 +00003224#ifdef TOPOLOGY_GENERATE
hassof1082d12005-09-19 04:23:34 +00003225 if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,
3226 ISIS_SYS_ID_LEN))
3227 {
3228 vty_out (vty, " topology base-is %s%s",
Josh Bailey3f045a02012-03-24 08:35:20 -07003229 sysid_print ((u_char *)area->topology_baseis), VTY_NEWLINE);
hassof1082d12005-09-19 04:23:34 +00003230 write++;
3231 }
3232 if (area->topology_basedynh)
3233 {
3234 vty_out (vty, " topology base-dynh %s%s",
3235 area->topology_basedynh, VTY_NEWLINE);
3236 write++;
3237 }
3238 /* We save the whole command line here. */
3239 if (strlen(area->top_params))
hassof390d2c2004-09-10 20:48:21 +00003240 {
3241 vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE);
3242 write++;
3243 }
hassof390d2c2004-09-10 20:48:21 +00003244#endif /* TOPOLOGY_GENERATE */
hassof1082d12005-09-19 04:23:34 +00003245
hassof390d2c2004-09-10 20:48:21 +00003246 }
jardineb5d44e2003-12-23 08:09:43 +00003247 }
hassof390d2c2004-09-10 20:48:21 +00003248
jardineb5d44e2003-12-23 08:09:43 +00003249 return write;
3250}
3251
Josh Bailey3f045a02012-03-24 08:35:20 -07003252struct cmd_node isis_node = {
jardineb5d44e2003-12-23 08:09:43 +00003253 ISIS_NODE,
hasso2097cd82003-12-23 11:51:08 +00003254 "%s(config-router)# ",
jardineb5d44e2003-12-23 08:09:43 +00003255 1
3256};
3257
hassof390d2c2004-09-10 20:48:21 +00003258void
jardineb5d44e2003-12-23 08:09:43 +00003259isis_init ()
3260{
jardineb5d44e2003-12-23 08:09:43 +00003261 /* Install IS-IS top node */
3262 install_node (&isis_node, isis_config_write);
hassof390d2c2004-09-10 20:48:21 +00003263
Josh Bailey3f045a02012-03-24 08:35:20 -07003264 install_element (VIEW_NODE, &show_isis_summary_cmd);
3265
3266 install_element (VIEW_NODE, &show_isis_interface_cmd);
3267 install_element (VIEW_NODE, &show_isis_interface_detail_cmd);
3268 install_element (VIEW_NODE, &show_isis_interface_arg_cmd);
3269
3270 install_element (VIEW_NODE, &show_isis_neighbor_cmd);
3271 install_element (VIEW_NODE, &show_isis_neighbor_detail_cmd);
3272 install_element (VIEW_NODE, &show_isis_neighbor_arg_cmd);
3273 install_element (VIEW_NODE, &clear_isis_neighbor_cmd);
3274 install_element (VIEW_NODE, &clear_isis_neighbor_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003275
3276 install_element (VIEW_NODE, &show_hostname_cmd);
3277 install_element (VIEW_NODE, &show_database_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003278 install_element (VIEW_NODE, &show_database_arg_cmd);
3279 install_element (VIEW_NODE, &show_database_arg_detail_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003280 install_element (VIEW_NODE, &show_database_detail_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003281 install_element (VIEW_NODE, &show_database_detail_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003282
Josh Bailey3f045a02012-03-24 08:35:20 -07003283 install_element (ENABLE_NODE, &show_isis_summary_cmd);
3284
3285 install_element (ENABLE_NODE, &show_isis_interface_cmd);
3286 install_element (ENABLE_NODE, &show_isis_interface_detail_cmd);
3287 install_element (ENABLE_NODE, &show_isis_interface_arg_cmd);
3288
3289 install_element (ENABLE_NODE, &show_isis_neighbor_cmd);
3290 install_element (ENABLE_NODE, &show_isis_neighbor_detail_cmd);
3291 install_element (ENABLE_NODE, &show_isis_neighbor_arg_cmd);
3292 install_element (ENABLE_NODE, &clear_isis_neighbor_cmd);
3293 install_element (ENABLE_NODE, &clear_isis_neighbor_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003294
3295 install_element (ENABLE_NODE, &show_hostname_cmd);
3296 install_element (ENABLE_NODE, &show_database_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003297 install_element (ENABLE_NODE, &show_database_arg_cmd);
3298 install_element (ENABLE_NODE, &show_database_arg_detail_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003299 install_element (ENABLE_NODE, &show_database_detail_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003300 install_element (ENABLE_NODE, &show_database_detail_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003301 install_element (ENABLE_NODE, &show_debugging_cmd);
3302
hassof390d2c2004-09-10 20:48:21 +00003303 install_node (&debug_node, config_write_debug);
jardin9e867fe2003-12-23 08:56:18 +00003304
jardineb5d44e2003-12-23 08:09:43 +00003305 install_element (ENABLE_NODE, &debug_isis_adj_cmd);
3306 install_element (ENABLE_NODE, &no_debug_isis_adj_cmd);
3307 install_element (ENABLE_NODE, &debug_isis_csum_cmd);
3308 install_element (ENABLE_NODE, &no_debug_isis_csum_cmd);
3309 install_element (ENABLE_NODE, &debug_isis_lupd_cmd);
3310 install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd);
3311 install_element (ENABLE_NODE, &debug_isis_err_cmd);
3312 install_element (ENABLE_NODE, &no_debug_isis_err_cmd);
3313 install_element (ENABLE_NODE, &debug_isis_snp_cmd);
3314 install_element (ENABLE_NODE, &no_debug_isis_snp_cmd);
3315 install_element (ENABLE_NODE, &debug_isis_upd_cmd);
3316 install_element (ENABLE_NODE, &no_debug_isis_upd_cmd);
3317 install_element (ENABLE_NODE, &debug_isis_spfevents_cmd);
3318 install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd);
3319 install_element (ENABLE_NODE, &debug_isis_spfstats_cmd);
3320 install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd);
3321 install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd);
3322 install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd);
3323 install_element (ENABLE_NODE, &debug_isis_rtevents_cmd);
3324 install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);
3325 install_element (ENABLE_NODE, &debug_isis_events_cmd);
3326 install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003327 install_element (ENABLE_NODE, &debug_isis_packet_dump_cmd);
3328 install_element (ENABLE_NODE, &no_debug_isis_packet_dump_cmd);
Christian Franke80a8f722015-11-12 14:21:47 +01003329 install_element (ENABLE_NODE, &debug_isis_lsp_gen_cmd);
3330 install_element (ENABLE_NODE, &no_debug_isis_lsp_gen_cmd);
Christian Franke61010c32015-11-10 18:43:34 +01003331 install_element (ENABLE_NODE, &debug_isis_lsp_sched_cmd);
3332 install_element (ENABLE_NODE, &no_debug_isis_lsp_sched_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003333
jardin9e867fe2003-12-23 08:56:18 +00003334 install_element (CONFIG_NODE, &debug_isis_adj_cmd);
3335 install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);
3336 install_element (CONFIG_NODE, &debug_isis_csum_cmd);
3337 install_element (CONFIG_NODE, &no_debug_isis_csum_cmd);
3338 install_element (CONFIG_NODE, &debug_isis_lupd_cmd);
3339 install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd);
3340 install_element (CONFIG_NODE, &debug_isis_err_cmd);
3341 install_element (CONFIG_NODE, &no_debug_isis_err_cmd);
3342 install_element (CONFIG_NODE, &debug_isis_snp_cmd);
3343 install_element (CONFIG_NODE, &no_debug_isis_snp_cmd);
3344 install_element (CONFIG_NODE, &debug_isis_upd_cmd);
3345 install_element (CONFIG_NODE, &no_debug_isis_upd_cmd);
3346 install_element (CONFIG_NODE, &debug_isis_spfevents_cmd);
3347 install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd);
3348 install_element (CONFIG_NODE, &debug_isis_spfstats_cmd);
3349 install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd);
3350 install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd);
3351 install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd);
3352 install_element (CONFIG_NODE, &debug_isis_rtevents_cmd);
3353 install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);
3354 install_element (CONFIG_NODE, &debug_isis_events_cmd);
3355 install_element (CONFIG_NODE, &no_debug_isis_events_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003356 install_element (CONFIG_NODE, &debug_isis_packet_dump_cmd);
3357 install_element (CONFIG_NODE, &no_debug_isis_packet_dump_cmd);
Christian Franke80a8f722015-11-12 14:21:47 +01003358 install_element (CONFIG_NODE, &debug_isis_lsp_gen_cmd);
3359 install_element (CONFIG_NODE, &no_debug_isis_lsp_gen_cmd);
Christian Franke61010c32015-11-10 18:43:34 +01003360 install_element (CONFIG_NODE, &debug_isis_lsp_sched_cmd);
3361 install_element (CONFIG_NODE, &no_debug_isis_lsp_sched_cmd);
jardin9e867fe2003-12-23 08:56:18 +00003362
jardineb5d44e2003-12-23 08:09:43 +00003363 install_element (CONFIG_NODE, &router_isis_cmd);
3364 install_element (CONFIG_NODE, &no_router_isis_cmd);
3365
3366 install_default (ISIS_NODE);
3367
3368 install_element (ISIS_NODE, &net_cmd);
3369 install_element (ISIS_NODE, &no_net_cmd);
3370
3371 install_element (ISIS_NODE, &is_type_cmd);
3372 install_element (ISIS_NODE, &no_is_type_cmd);
3373
Christian Frankef1fc1db2015-11-10 18:43:31 +01003374 install_element (ISIS_NODE, &area_lsp_mtu_cmd);
3375 install_element (ISIS_NODE, &no_area_lsp_mtu_cmd);
3376 install_element (ISIS_NODE, &no_area_lsp_mtu_arg_cmd);
3377
Josh Bailey3f045a02012-03-24 08:35:20 -07003378 install_element (ISIS_NODE, &area_passwd_md5_cmd);
3379 install_element (ISIS_NODE, &area_passwd_md5_snpauth_cmd);
3380 install_element (ISIS_NODE, &area_passwd_clear_cmd);
3381 install_element (ISIS_NODE, &area_passwd_clear_snpauth_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003382 install_element (ISIS_NODE, &no_area_passwd_cmd);
3383
Josh Bailey3f045a02012-03-24 08:35:20 -07003384 install_element (ISIS_NODE, &domain_passwd_md5_cmd);
3385 install_element (ISIS_NODE, &domain_passwd_md5_snpauth_cmd);
3386 install_element (ISIS_NODE, &domain_passwd_clear_cmd);
3387 install_element (ISIS_NODE, &domain_passwd_clear_snpauth_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003388 install_element (ISIS_NODE, &no_domain_passwd_cmd);
3389
3390 install_element (ISIS_NODE, &lsp_gen_interval_cmd);
3391 install_element (ISIS_NODE, &no_lsp_gen_interval_cmd);
3392 install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd);
3393 install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd);
3394 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd);
3395 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd);
3396 install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd);
3397 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd);
3398 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd);
3399
3400 install_element (ISIS_NODE, &spf_interval_cmd);
3401 install_element (ISIS_NODE, &no_spf_interval_cmd);
3402 install_element (ISIS_NODE, &no_spf_interval_arg_cmd);
3403 install_element (ISIS_NODE, &spf_interval_l1_cmd);
3404 install_element (ISIS_NODE, &no_spf_interval_l1_cmd);
3405 install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd);
3406 install_element (ISIS_NODE, &spf_interval_l2_cmd);
3407 install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
3408 install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
hassof390d2c2004-09-10 20:48:21 +00003409
Josh Bailey3f045a02012-03-24 08:35:20 -07003410 install_element (ISIS_NODE, &max_lsp_lifetime_cmd);
3411 install_element (ISIS_NODE, &no_max_lsp_lifetime_cmd);
3412 install_element (ISIS_NODE, &no_max_lsp_lifetime_arg_cmd);
3413 install_element (ISIS_NODE, &max_lsp_lifetime_l1_cmd);
3414 install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_cmd);
3415 install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_arg_cmd);
3416 install_element (ISIS_NODE, &max_lsp_lifetime_l2_cmd);
3417 install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_cmd);
3418 install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_arg_cmd);
3419
3420 install_element (ISIS_NODE, &lsp_refresh_interval_cmd);
3421 install_element (ISIS_NODE, &no_lsp_refresh_interval_cmd);
3422 install_element (ISIS_NODE, &no_lsp_refresh_interval_arg_cmd);
3423 install_element (ISIS_NODE, &lsp_refresh_interval_l1_cmd);
3424 install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_cmd);
3425 install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_arg_cmd);
3426 install_element (ISIS_NODE, &lsp_refresh_interval_l2_cmd);
3427 install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_cmd);
3428 install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_arg_cmd);
3429
3430 install_element (ISIS_NODE, &set_overload_bit_cmd);
3431 install_element (ISIS_NODE, &no_set_overload_bit_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003432
Amritha Nambiarc8ee9402015-08-24 16:40:14 -07003433 install_element (ISIS_NODE, &set_attached_bit_cmd);
3434 install_element (ISIS_NODE, &no_set_attached_bit_cmd);
3435
jardineb5d44e2003-12-23 08:09:43 +00003436 install_element (ISIS_NODE, &dynamic_hostname_cmd);
3437 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
3438
3439 install_element (ISIS_NODE, &metric_style_cmd);
3440 install_element (ISIS_NODE, &no_metric_style_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003441
3442 install_element (ISIS_NODE, &log_adj_changes_cmd);
3443 install_element (ISIS_NODE, &no_log_adj_changes_cmd);
3444
jardineb5d44e2003-12-23 08:09:43 +00003445#ifdef TOPOLOGY_GENERATE
3446 install_element (ISIS_NODE, &topology_generate_grid_cmd);
3447 install_element (ISIS_NODE, &topology_baseis_cmd);
hassof1082d12005-09-19 04:23:34 +00003448 install_element (ISIS_NODE, &topology_basedynh_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003449 install_element (ISIS_NODE, &no_topology_baseis_cmd);
hassof1082d12005-09-19 04:23:34 +00003450 install_element (ISIS_NODE, &no_topology_baseis_noid_cmd);
hassof695b012005-04-02 19:03:39 +00003451 install_element (VIEW_NODE, &show_isis_generated_topology_cmd);
3452 install_element (ENABLE_NODE, &show_isis_generated_topology_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003453#endif /* TOPOLOGY_GENERATE */
jardineb5d44e2003-12-23 08:09:43 +00003454}