blob: c446e7fcd840496fa83810f05fb41e5d0b1cfd6d [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
Christian Frankeacf98652015-11-12 14:24:22 +0100283 isis_redist_area_finish(area);
284
Josh Bailey3f045a02012-03-24 08:35:20 -0700285 for (ALL_LIST_ELEMENTS (area->area_addrs, node, nnode, addr))
286 {
287 list_delete_node (area->area_addrs, node);
288 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
289 }
290 area->area_addrs = NULL;
291
hassof390d2c2004-09-10 20:48:21 +0000292 THREAD_TIMER_OFF (area->t_tick);
hassof390d2c2004-09-10 20:48:21 +0000293 THREAD_TIMER_OFF (area->t_lsp_refresh[0]);
294 THREAD_TIMER_OFF (area->t_lsp_refresh[1]);
jardineb5d44e2003-12-23 08:09:43 +0000295
Josh Bailey3f045a02012-03-24 08:35:20 -0700296 thread_cancel_event (master, area);
297
298 listnode_delete (isis->area_list, area);
299
300 free (area->area_tag);
301
jardineb5d44e2003-12-23 08:09:43 +0000302 XFREE (MTYPE_ISIS_AREA, area);
hassof390d2c2004-09-10 20:48:21 +0000303
Josh Bailey3f045a02012-03-24 08:35:20 -0700304 if (listcount (isis->area_list) == 0)
305 {
306 memset (isis->sysid, 0, ISIS_SYS_ID_LEN);
307 isis->sysid_set = 0;
308 }
309
jardineb5d44e2003-12-23 08:09:43 +0000310 return CMD_SUCCESS;
311}
312
hassof390d2c2004-09-10 20:48:21 +0000313int
Josh Bailey3f045a02012-03-24 08:35:20 -0700314area_net_title (struct vty *vty, const char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000315{
jardineb5d44e2003-12-23 08:09:43 +0000316 struct isis_area *area;
317 struct area_addr *addr;
318 struct area_addr *addrp;
hasso3fdb2dd2005-09-28 18:45:54 +0000319 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000320
321 u_char buff[255];
322 area = vty->index;
323
hassof390d2c2004-09-10 20:48:21 +0000324 if (!area)
325 {
326 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700327 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +0000328 }
jardineb5d44e2003-12-23 08:09:43 +0000329
330 /* We check that we are not over the maximal number of addresses */
hassof390d2c2004-09-10 20:48:21 +0000331 if (listcount (area->area_addrs) >= isis->max_area_addrs)
332 {
333 vty_out (vty, "Maximum of area addresses (%d) already reached %s",
334 isis->max_area_addrs, VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700335 return CMD_ERR_NOTHING_TODO;
hassof390d2c2004-09-10 20:48:21 +0000336 }
jardineb5d44e2003-12-23 08:09:43 +0000337
338 addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));
339 addr->addr_len = dotformat2buff (buff, net_title);
340 memcpy (addr->area_addr, buff, addr->addr_len);
341#ifdef EXTREME_DEBUG
hasso529d65b2004-12-24 00:14:50 +0000342 zlog_debug ("added area address %s for area %s (address length %d)",
jardineb5d44e2003-12-23 08:09:43 +0000343 net_title, area->area_tag, addr->addr_len);
344#endif /* EXTREME_DEBUG */
hassof390d2c2004-09-10 20:48:21 +0000345 if (addr->addr_len < 8 || addr->addr_len > 20)
346 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700347 vty_out (vty, "area address must be at least 8..20 octets long (%d)%s",
348 addr->addr_len, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000349 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
Josh Bailey3f045a02012-03-24 08:35:20 -0700350 return CMD_ERR_AMBIGUOUS;
351 }
352
353 if (addr->area_addr[addr->addr_len-1] != 0)
354 {
355 vty_out (vty, "nsel byte (last byte) in area address must be 0%s",
356 VTY_NEWLINE);
357 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
358 return CMD_ERR_AMBIGUOUS;
jardineb5d44e2003-12-23 08:09:43 +0000359 }
360
hassof390d2c2004-09-10 20:48:21 +0000361 if (isis->sysid_set == 0)
362 {
363 /*
364 * First area address - get the SystemID for this router
365 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700366 memcpy (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN);
hassof390d2c2004-09-10 20:48:21 +0000367 isis->sysid_set = 1;
hassoc89c05d2005-09-04 21:36:36 +0000368 if (isis->debugs & DEBUG_EVENTS)
369 zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid));
jardineb5d44e2003-12-23 08:09:43 +0000370 }
hassof390d2c2004-09-10 20:48:21 +0000371 else
372 {
373 /*
374 * Check that the SystemID portions match
375 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700376 if (memcmp (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN))
hassof390d2c2004-09-10 20:48:21 +0000377 {
378 vty_out (vty,
379 "System ID must not change when defining additional area"
380 " addresses%s", VTY_NEWLINE);
381 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
Josh Bailey3f045a02012-03-24 08:35:20 -0700382 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +0000383 }
jardineb5d44e2003-12-23 08:09:43 +0000384
hassof390d2c2004-09-10 20:48:21 +0000385 /* now we see that we don't already have this address */
hasso3fdb2dd2005-09-28 18:45:54 +0000386 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
387 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700388 if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN) != (addr->addr_len))
hasso3fdb2dd2005-09-28 18:45:54 +0000389 continue;
390 if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
391 {
392 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
393 return CMD_SUCCESS; /* silent fail */
394 }
395 }
hassof390d2c2004-09-10 20:48:21 +0000396 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700397
jardineb5d44e2003-12-23 08:09:43 +0000398 /*
399 * Forget the systemID part of the address
400 */
Josh Bailey3f045a02012-03-24 08:35:20 -0700401 addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN);
jardineb5d44e2003-12-23 08:09:43 +0000402 listnode_add (area->area_addrs, addr);
403
404 /* only now we can safely generate our LSPs for this area */
hassof390d2c2004-09-10 20:48:21 +0000405 if (listcount (area->area_addrs) > 0)
406 {
Josh Bailey3f045a02012-03-24 08:35:20 -0700407 if (area->is_type & IS_LEVEL_1)
408 lsp_generate (area, IS_LEVEL_1);
409 if (area->is_type & IS_LEVEL_2)
410 lsp_generate (area, IS_LEVEL_2);
hassof390d2c2004-09-10 20:48:21 +0000411 }
jardineb5d44e2003-12-23 08:09:43 +0000412
413 return CMD_SUCCESS;
414}
415
416int
Josh Bailey3f045a02012-03-24 08:35:20 -0700417area_clear_net_title (struct vty *vty, const char *net_title)
jardineb5d44e2003-12-23 08:09:43 +0000418{
419 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +0000420 struct area_addr addr, *addrp = NULL;
hasso3fdb2dd2005-09-28 18:45:54 +0000421 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +0000422 u_char buff[255];
423
424 area = vty->index;
hassof390d2c2004-09-10 20:48:21 +0000425 if (!area)
426 {
427 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700428 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +0000429 }
430
jardineb5d44e2003-12-23 08:09:43 +0000431 addr.addr_len = dotformat2buff (buff, net_title);
hassof390d2c2004-09-10 20:48:21 +0000432 if (addr.addr_len < 8 || addr.addr_len > 20)
433 {
434 vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
435 addr.addr_len, VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700436 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +0000437 }
438
439 memcpy (addr.area_addr, buff, (int) addr.addr_len);
440
hasso3fdb2dd2005-09-28 18:45:54 +0000441 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
Josh Bailey3f045a02012-03-24 08:35:20 -0700442 if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len &&
jardineb5d44e2003-12-23 08:09:43 +0000443 !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
hassof390d2c2004-09-10 20:48:21 +0000444 break;
445
446 if (!addrp)
447 {
448 vty_out (vty, "No area address %s for area %s %s", net_title,
449 area->area_tag, VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700450 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +0000451 }
452
jardineb5d44e2003-12-23 08:09:43 +0000453 listnode_delete (area->area_addrs, addrp);
Josh Bailey3f045a02012-03-24 08:35:20 -0700454 XFREE (MTYPE_ISIS_AREA_ADDR, addrp);
455
456 /*
457 * Last area address - reset the SystemID for this router
458 */
459 if (listcount (area->area_addrs) == 0)
460 {
461 memset (isis->sysid, 0, ISIS_SYS_ID_LEN);
462 isis->sysid_set = 0;
463 if (isis->debugs & DEBUG_EVENTS)
464 zlog_debug ("Router has no SystemID");
465 }
hassof390d2c2004-09-10 20:48:21 +0000466
jardineb5d44e2003-12-23 08:09:43 +0000467 return CMD_SUCCESS;
468}
469
jardineb5d44e2003-12-23 08:09:43 +0000470/*
Josh Bailey3f045a02012-03-24 08:35:20 -0700471 * 'show isis interface' command
jardineb5d44e2003-12-23 08:09:43 +0000472 */
473
474int
Josh Bailey3f045a02012-03-24 08:35:20 -0700475show_isis_interface_common (struct vty *vty, const char *ifname, char detail)
jardineb5d44e2003-12-23 08:09:43 +0000476{
hasso3fdb2dd2005-09-28 18:45:54 +0000477 struct listnode *anode, *cnode;
jardineb5d44e2003-12-23 08:09:43 +0000478 struct isis_area *area;
479 struct isis_circuit *circuit;
jardineb5d44e2003-12-23 08:09:43 +0000480
hassof390d2c2004-09-10 20:48:21 +0000481 if (!isis)
482 {
483 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
484 return CMD_SUCCESS;
485 }
jardineb5d44e2003-12-23 08:09:43 +0000486
hasso3fdb2dd2005-09-28 18:45:54 +0000487 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
hassof390d2c2004-09-10 20:48:21 +0000488 {
hassof390d2c2004-09-10 20:48:21 +0000489 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000490
hassof390d2c2004-09-10 20:48:21 +0000491 if (detail == ISIS_UI_LEVEL_BRIEF)
Josh Bailey3f045a02012-03-24 08:35:20 -0700492 vty_out (vty, " Interface CircId State Type Level%s",
493 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000494
hasso3fdb2dd2005-09-28 18:45:54 +0000495 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
Josh Bailey3f045a02012-03-24 08:35:20 -0700496 if (!ifname)
497 isis_circuit_print_vty (circuit, vty, detail);
498 else if (strcmp(circuit->interface->name, ifname) == 0)
499 isis_circuit_print_vty (circuit, vty, detail);
jardineb5d44e2003-12-23 08:09:43 +0000500 }
hassof390d2c2004-09-10 20:48:21 +0000501
jardineb5d44e2003-12-23 08:09:43 +0000502 return CMD_SUCCESS;
503}
504
Josh Bailey3f045a02012-03-24 08:35:20 -0700505DEFUN (show_isis_interface,
506 show_isis_interface_cmd,
507 "show isis interface",
jardineb5d44e2003-12-23 08:09:43 +0000508 SHOW_STR
Josh Bailey3f045a02012-03-24 08:35:20 -0700509 "ISIS network information\n"
510 "ISIS interface\n")
jardineb5d44e2003-12-23 08:09:43 +0000511{
Josh Bailey3f045a02012-03-24 08:35:20 -0700512 return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_BRIEF);
jardineb5d44e2003-12-23 08:09:43 +0000513}
514
Josh Bailey3f045a02012-03-24 08:35:20 -0700515DEFUN (show_isis_interface_detail,
516 show_isis_interface_detail_cmd,
517 "show isis interface detail",
jardineb5d44e2003-12-23 08:09:43 +0000518 SHOW_STR
Josh Bailey3f045a02012-03-24 08:35:20 -0700519 "ISIS network information\n"
520 "ISIS interface\n"
jardineb5d44e2003-12-23 08:09:43 +0000521 "show detailed information\n")
522{
Josh Bailey3f045a02012-03-24 08:35:20 -0700523 return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_DETAIL);
jardineb5d44e2003-12-23 08:09:43 +0000524}
525
Josh Bailey3f045a02012-03-24 08:35:20 -0700526DEFUN (show_isis_interface_arg,
527 show_isis_interface_arg_cmd,
528 "show isis interface WORD",
jardineb5d44e2003-12-23 08:09:43 +0000529 SHOW_STR
Josh Bailey3f045a02012-03-24 08:35:20 -0700530 "ISIS network information\n"
531 "ISIS interface\n"
532 "ISIS interface name\n")
533{
534 return show_isis_interface_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
535}
536
537/*
538 * 'show isis neighbor' command
539 */
540
541int
542show_isis_neighbor_common (struct vty *vty, const char *id, char detail)
543{
544 struct listnode *anode, *cnode, *node;
545 struct isis_area *area;
546 struct isis_circuit *circuit;
547 struct list *adjdb;
548 struct isis_adjacency *adj;
549 struct isis_dynhn *dynhn;
550 u_char sysid[ISIS_SYS_ID_LEN];
551 int i;
552
553 if (!isis)
554 {
555 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
556 return CMD_SUCCESS;
557 }
558
559 memset (sysid, 0, ISIS_SYS_ID_LEN);
560 if (id)
561 {
562 if (sysid2buff (sysid, id) == 0)
563 {
564 dynhn = dynhn_find_by_name (id);
565 if (dynhn == NULL)
566 {
567 vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
568 return CMD_SUCCESS;
569 }
570 memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
571 }
572 }
573
574 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
575 {
576 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
577
578 if (detail == ISIS_UI_LEVEL_BRIEF)
579 vty_out (vty, " System Id Interface L State"
580 " Holdtime SNPA%s", VTY_NEWLINE);
581
582 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
583 {
584 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
585 {
586 for (i = 0; i < 2; i++)
587 {
588 adjdb = circuit->u.bc.adjdb[i];
589 if (adjdb && adjdb->count)
590 {
591 for (ALL_LIST_ELEMENTS_RO (adjdb, node, adj))
592 if (!id || !memcmp (adj->sysid, sysid,
593 ISIS_SYS_ID_LEN))
594 isis_adj_print_vty (adj, vty, detail);
595 }
596 }
597 }
598 else if (circuit->circ_type == CIRCUIT_T_P2P &&
599 circuit->u.p2p.neighbor)
600 {
601 adj = circuit->u.p2p.neighbor;
602 if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
603 isis_adj_print_vty (adj, vty, detail);
604 }
605 }
606 }
607
608 return CMD_SUCCESS;
609}
610
611/*
612 * 'clear isis neighbor' command
613 */
614int
615clear_isis_neighbor_common (struct vty *vty, const char *id)
616{
617 struct listnode *anode, *cnode, *cnextnode, *node, *nnode;
618 struct isis_area *area;
619 struct isis_circuit *circuit;
620 struct list *adjdb;
621 struct isis_adjacency *adj;
622 struct isis_dynhn *dynhn;
623 u_char sysid[ISIS_SYS_ID_LEN];
624 int i;
625
626 if (!isis)
627 {
628 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
629 return CMD_SUCCESS;
630 }
631
632 memset (sysid, 0, ISIS_SYS_ID_LEN);
633 if (id)
634 {
635 if (sysid2buff (sysid, id) == 0)
636 {
637 dynhn = dynhn_find_by_name (id);
638 if (dynhn == NULL)
639 {
640 vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
641 return CMD_SUCCESS;
642 }
643 memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
644 }
645 }
646
647 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
648 {
649 for (ALL_LIST_ELEMENTS (area->circuit_list, cnode, cnextnode, circuit))
650 {
651 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
652 {
653 for (i = 0; i < 2; i++)
654 {
655 adjdb = circuit->u.bc.adjdb[i];
656 if (adjdb && adjdb->count)
657 {
658 for (ALL_LIST_ELEMENTS (adjdb, node, nnode, adj))
659 if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
660 isis_adj_state_change (adj, ISIS_ADJ_DOWN,
661 "clear user request");
662 }
663 }
664 }
665 else if (circuit->circ_type == CIRCUIT_T_P2P &&
666 circuit->u.p2p.neighbor)
667 {
668 adj = circuit->u.p2p.neighbor;
669 if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
670 isis_adj_state_change (adj, ISIS_ADJ_DOWN,
671 "clear user request");
672 }
673 }
674 }
675
676 return CMD_SUCCESS;
677}
678
679DEFUN (show_isis_neighbor,
680 show_isis_neighbor_cmd,
681 "show isis neighbor",
682 SHOW_STR
683 "ISIS network information\n"
684 "ISIS neighbor adjacencies\n")
685{
686 return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_BRIEF);
687}
688
689DEFUN (show_isis_neighbor_detail,
690 show_isis_neighbor_detail_cmd,
691 "show isis neighbor detail",
692 SHOW_STR
693 "ISIS network information\n"
694 "ISIS neighbor adjacencies\n"
jardineb5d44e2003-12-23 08:09:43 +0000695 "show detailed information\n")
Josh Bailey3f045a02012-03-24 08:35:20 -0700696{
697 return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_DETAIL);
698}
699
700DEFUN (show_isis_neighbor_arg,
701 show_isis_neighbor_arg_cmd,
702 "show isis neighbor WORD",
703 SHOW_STR
704 "ISIS network information\n"
705 "ISIS neighbor adjacencies\n"
706 "System id\n")
707{
708 return show_isis_neighbor_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
709}
710
711DEFUN (clear_isis_neighbor,
712 clear_isis_neighbor_cmd,
713 "clear isis neighbor",
714 CLEAR_STR
715 "Reset ISIS network information\n"
716 "Reset ISIS neighbor adjacencies\n")
717{
718 return clear_isis_neighbor_common (vty, NULL);
719}
720
721DEFUN (clear_isis_neighbor_arg,
722 clear_isis_neighbor_arg_cmd,
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -0700723 "clear isis neighbor WORD",
Josh Bailey3f045a02012-03-24 08:35:20 -0700724 CLEAR_STR
725 "ISIS network information\n"
726 "ISIS neighbor adjacencies\n"
727 "System id\n")
728{
729 return clear_isis_neighbor_common (vty, argv[0]);
730}
731
jardineb5d44e2003-12-23 08:09:43 +0000732/*
733 * 'isis debug', 'show debugging'
734 */
jardineb5d44e2003-12-23 08:09:43 +0000735void
736print_debug (struct vty *vty, int flags, int onoff)
737{
738 char onoffs[4];
739 if (onoff)
hassof390d2c2004-09-10 20:48:21 +0000740 strcpy (onoffs, "on");
jardineb5d44e2003-12-23 08:09:43 +0000741 else
hassof390d2c2004-09-10 20:48:21 +0000742 strcpy (onoffs, "off");
jardineb5d44e2003-12-23 08:09:43 +0000743
744 if (flags & DEBUG_ADJ_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000745 vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs,
746 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000747 if (flags & DEBUG_CHECKSUM_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000748 vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs,
749 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000750 if (flags & DEBUG_LOCAL_UPDATES)
hassof390d2c2004-09-10 20:48:21 +0000751 vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs,
752 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000753 if (flags & DEBUG_PROTOCOL_ERRORS)
hassof390d2c2004-09-10 20:48:21 +0000754 vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs,
755 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000756 if (flags & DEBUG_SNP_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000757 vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs,
758 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000759 if (flags & DEBUG_SPF_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000760 vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000761 if (flags & DEBUG_SPF_STATS)
hassof390d2c2004-09-10 20:48:21 +0000762 vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s",
763 onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000764 if (flags & DEBUG_SPF_TRIGGERS)
hassof390d2c2004-09-10 20:48:21 +0000765 vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs,
766 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000767 if (flags & DEBUG_UPDATE_PACKETS)
hassof390d2c2004-09-10 20:48:21 +0000768 vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs,
769 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000770 if (flags & DEBUG_RTE_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000771 vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs,
772 VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000773 if (flags & DEBUG_EVENTS)
hassof390d2c2004-09-10 20:48:21 +0000774 vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -0700775 if (flags & DEBUG_PACKET_DUMP)
776 vty_out (vty, "IS-IS Packet dump debugging is %s%s", onoffs, VTY_NEWLINE);
Christian Franke80a8f722015-11-12 14:21:47 +0100777 if (flags & DEBUG_LSP_GEN)
778 vty_out (vty, "IS-IS LSP generation debugging is %s%s", onoffs, VTY_NEWLINE);
Christian Franke61010c32015-11-10 18:43:34 +0100779 if (flags & DEBUG_LSP_SCHED)
780 vty_out (vty, "IS-IS LSP scheduling debugging is %s%s", onoffs, VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000781}
782
783DEFUN (show_debugging,
784 show_debugging_cmd,
785 "show debugging",
786 SHOW_STR
787 "State of each debugging option\n")
788{
hassof390d2c2004-09-10 20:48:21 +0000789 vty_out (vty, "IS-IS:%s", VTY_NEWLINE);
jardineb5d44e2003-12-23 08:09:43 +0000790 print_debug (vty, isis->debugs, 1);
791 return CMD_SUCCESS;
792}
793
jardin9e867fe2003-12-23 08:56:18 +0000794/* Debug node. */
hassof390d2c2004-09-10 20:48:21 +0000795static struct cmd_node debug_node = {
jardin9e867fe2003-12-23 08:56:18 +0000796 DEBUG_NODE,
hassof390d2c2004-09-10 20:48:21 +0000797 "",
798 1
jardin9e867fe2003-12-23 08:56:18 +0000799};
800
801static int
802config_write_debug (struct vty *vty)
803{
804 int write = 0;
805 int flags = isis->debugs;
806
hassof390d2c2004-09-10 20:48:21 +0000807 if (flags & DEBUG_ADJ_PACKETS)
808 {
809 vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE);
810 write++;
811 }
812 if (flags & DEBUG_CHECKSUM_ERRORS)
813 {
814 vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE);
815 write++;
816 }
817 if (flags & DEBUG_LOCAL_UPDATES)
818 {
819 vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE);
820 write++;
821 }
822 if (flags & DEBUG_PROTOCOL_ERRORS)
823 {
824 vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE);
825 write++;
826 }
827 if (flags & DEBUG_SNP_PACKETS)
828 {
829 vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE);
830 write++;
831 }
832 if (flags & DEBUG_SPF_EVENTS)
833 {
834 vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE);
835 write++;
836 }
837 if (flags & DEBUG_SPF_STATS)
838 {
839 vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE);
840 write++;
841 }
842 if (flags & DEBUG_SPF_TRIGGERS)
843 {
844 vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE);
845 write++;
846 }
847 if (flags & DEBUG_UPDATE_PACKETS)
848 {
849 vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE);
850 write++;
851 }
852 if (flags & DEBUG_RTE_EVENTS)
853 {
854 vty_out (vty, "debug isis route-events%s", VTY_NEWLINE);
855 write++;
856 }
857 if (flags & DEBUG_EVENTS)
858 {
859 vty_out (vty, "debug isis events%s", VTY_NEWLINE);
860 write++;
861 }
Josh Bailey3f045a02012-03-24 08:35:20 -0700862 if (flags & DEBUG_PACKET_DUMP)
863 {
864 vty_out (vty, "debug isis packet-dump%s", VTY_NEWLINE);
865 write++;
866 }
Christian Franke80a8f722015-11-12 14:21:47 +0100867 if (flags & DEBUG_LSP_GEN)
868 {
869 vty_out (vty, "debug isis lsp-gen%s", VTY_NEWLINE);
870 write++;
871 }
Christian Franke61010c32015-11-10 18:43:34 +0100872 if (flags & DEBUG_LSP_SCHED)
873 {
874 vty_out (vty, "debug isis lsp-sched%s", VTY_NEWLINE);
875 write++;
876 }
jardin9e867fe2003-12-23 08:56:18 +0000877
878 return write;
879}
880
jardineb5d44e2003-12-23 08:09:43 +0000881DEFUN (debug_isis_adj,
882 debug_isis_adj_cmd,
883 "debug isis adj-packets",
884 DEBUG_STR
885 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000886 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000887{
888 isis->debugs |= DEBUG_ADJ_PACKETS;
hassof390d2c2004-09-10 20:48:21 +0000889 print_debug (vty, DEBUG_ADJ_PACKETS, 1);
jardineb5d44e2003-12-23 08:09:43 +0000890
891 return CMD_SUCCESS;
892}
893
894DEFUN (no_debug_isis_adj,
895 no_debug_isis_adj_cmd,
896 "no debug isis adj-packets",
897 UNDEBUG_STR
898 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000899 "IS-IS Adjacency related packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000900{
jardineb5d44e2003-12-23 08:09:43 +0000901 isis->debugs &= ~DEBUG_ADJ_PACKETS;
902 print_debug (vty, DEBUG_ADJ_PACKETS, 0);
903
904 return CMD_SUCCESS;
905}
906
jardineb5d44e2003-12-23 08:09:43 +0000907DEFUN (debug_isis_csum,
908 debug_isis_csum_cmd,
909 "debug isis checksum-errors",
910 DEBUG_STR
911 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000912 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000913{
914 isis->debugs |= DEBUG_CHECKSUM_ERRORS;
915 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1);
916
917 return CMD_SUCCESS;
918}
919
920DEFUN (no_debug_isis_csum,
921 no_debug_isis_csum_cmd,
922 "no debug isis checksum-errors",
923 UNDEBUG_STR
924 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000925 "IS-IS LSP checksum errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000926{
927 isis->debugs &= ~DEBUG_CHECKSUM_ERRORS;
928 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000929
jardineb5d44e2003-12-23 08:09:43 +0000930 return CMD_SUCCESS;
931}
932
933DEFUN (debug_isis_lupd,
934 debug_isis_lupd_cmd,
935 "debug isis local-updates",
936 DEBUG_STR
937 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000938 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000939{
940 isis->debugs |= DEBUG_LOCAL_UPDATES;
941 print_debug (vty, DEBUG_LOCAL_UPDATES, 1);
942
943 return CMD_SUCCESS;
944}
945
946DEFUN (no_debug_isis_lupd,
947 no_debug_isis_lupd_cmd,
948 "no debug isis local-updates",
949 UNDEBUG_STR
950 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000951 "IS-IS local update packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000952{
953 isis->debugs &= ~DEBUG_LOCAL_UPDATES;
hassof390d2c2004-09-10 20:48:21 +0000954 print_debug (vty, DEBUG_LOCAL_UPDATES, 0);
955
jardineb5d44e2003-12-23 08:09:43 +0000956 return CMD_SUCCESS;
957}
958
959DEFUN (debug_isis_err,
960 debug_isis_err_cmd,
hassof390d2c2004-09-10 20:48:21 +0000961 "debug isis protocol-errors",
jardineb5d44e2003-12-23 08:09:43 +0000962 DEBUG_STR
963 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000964 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000965{
966 isis->debugs |= DEBUG_PROTOCOL_ERRORS;
967 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1);
968
969 return CMD_SUCCESS;
970}
971
972DEFUN (no_debug_isis_err,
973 no_debug_isis_err_cmd,
974 "no debug isis protocol-errors",
975 UNDEBUG_STR
976 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000977 "IS-IS LSP protocol errors\n")
jardineb5d44e2003-12-23 08:09:43 +0000978{
979 isis->debugs &= ~DEBUG_PROTOCOL_ERRORS;
980 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0);
hassof390d2c2004-09-10 20:48:21 +0000981
jardineb5d44e2003-12-23 08:09:43 +0000982 return CMD_SUCCESS;
983}
984
985DEFUN (debug_isis_snp,
986 debug_isis_snp_cmd,
987 "debug isis snp-packets",
988 DEBUG_STR
989 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +0000990 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +0000991{
992 isis->debugs |= DEBUG_SNP_PACKETS;
993 print_debug (vty, DEBUG_SNP_PACKETS, 1);
994
995 return CMD_SUCCESS;
996}
997
998DEFUN (no_debug_isis_snp,
999 no_debug_isis_snp_cmd,
1000 "no debug isis snp-packets",
1001 UNDEBUG_STR
1002 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001003 "IS-IS CSNP/PSNP packets\n")
jardineb5d44e2003-12-23 08:09:43 +00001004{
hassof390d2c2004-09-10 20:48:21 +00001005 isis->debugs &= ~DEBUG_SNP_PACKETS;
jardineb5d44e2003-12-23 08:09:43 +00001006 print_debug (vty, DEBUG_SNP_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +00001007
jardineb5d44e2003-12-23 08:09:43 +00001008 return CMD_SUCCESS;
1009}
1010
jardineb5d44e2003-12-23 08:09:43 +00001011DEFUN (debug_isis_upd,
1012 debug_isis_upd_cmd,
1013 "debug isis update-packets",
1014 DEBUG_STR
1015 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001016 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +00001017{
1018 isis->debugs |= DEBUG_UPDATE_PACKETS;
1019 print_debug (vty, DEBUG_UPDATE_PACKETS, 1);
1020
1021 return CMD_SUCCESS;
1022}
1023
1024DEFUN (no_debug_isis_upd,
1025 no_debug_isis_upd_cmd,
1026 "no debug isis update-packets",
1027 UNDEBUG_STR
1028 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001029 "IS-IS Update related packets\n")
jardineb5d44e2003-12-23 08:09:43 +00001030{
1031 isis->debugs &= ~DEBUG_UPDATE_PACKETS;
1032 print_debug (vty, DEBUG_UPDATE_PACKETS, 0);
hassof390d2c2004-09-10 20:48:21 +00001033
jardineb5d44e2003-12-23 08:09:43 +00001034 return CMD_SUCCESS;
1035}
1036
jardineb5d44e2003-12-23 08:09:43 +00001037DEFUN (debug_isis_spfevents,
1038 debug_isis_spfevents_cmd,
1039 "debug isis spf-events",
1040 DEBUG_STR
1041 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001042 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +00001043{
1044 isis->debugs |= DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +00001045 print_debug (vty, DEBUG_SPF_EVENTS, 1);
jardineb5d44e2003-12-23 08:09:43 +00001046
1047 return CMD_SUCCESS;
1048}
1049
1050DEFUN (no_debug_isis_spfevents,
1051 no_debug_isis_spfevents_cmd,
1052 "no debug isis spf-events",
1053 UNDEBUG_STR
1054 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001055 "IS-IS Shortest Path First Events\n")
jardineb5d44e2003-12-23 08:09:43 +00001056{
1057 isis->debugs &= ~DEBUG_SPF_EVENTS;
hassof390d2c2004-09-10 20:48:21 +00001058 print_debug (vty, DEBUG_SPF_EVENTS, 0);
1059
jardineb5d44e2003-12-23 08:09:43 +00001060 return CMD_SUCCESS;
1061}
1062
jardineb5d44e2003-12-23 08:09:43 +00001063DEFUN (debug_isis_spfstats,
1064 debug_isis_spfstats_cmd,
1065 "debug isis spf-statistics ",
1066 DEBUG_STR
1067 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001068 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +00001069{
1070 isis->debugs |= DEBUG_SPF_STATS;
1071 print_debug (vty, DEBUG_SPF_STATS, 1);
1072
1073 return CMD_SUCCESS;
1074}
1075
1076DEFUN (no_debug_isis_spfstats,
1077 no_debug_isis_spfstats_cmd,
1078 "no debug isis spf-statistics",
1079 UNDEBUG_STR
1080 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001081 "IS-IS SPF Timing and Statistic Data\n")
jardineb5d44e2003-12-23 08:09:43 +00001082{
1083 isis->debugs &= ~DEBUG_SPF_STATS;
1084 print_debug (vty, DEBUG_SPF_STATS, 0);
hassof390d2c2004-09-10 20:48:21 +00001085
jardineb5d44e2003-12-23 08:09:43 +00001086 return CMD_SUCCESS;
1087}
1088
1089DEFUN (debug_isis_spftrigg,
1090 debug_isis_spftrigg_cmd,
1091 "debug isis spf-triggers",
1092 DEBUG_STR
1093 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001094 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +00001095{
1096 isis->debugs |= DEBUG_SPF_TRIGGERS;
1097 print_debug (vty, DEBUG_SPF_TRIGGERS, 1);
1098
1099 return CMD_SUCCESS;
1100}
1101
1102DEFUN (no_debug_isis_spftrigg,
1103 no_debug_isis_spftrigg_cmd,
1104 "no debug isis spf-triggers",
1105 UNDEBUG_STR
1106 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001107 "IS-IS SPF triggering events\n")
jardineb5d44e2003-12-23 08:09:43 +00001108{
1109 isis->debugs &= ~DEBUG_SPF_TRIGGERS;
1110 print_debug (vty, DEBUG_SPF_TRIGGERS, 0);
hassof390d2c2004-09-10 20:48:21 +00001111
jardineb5d44e2003-12-23 08:09:43 +00001112 return CMD_SUCCESS;
1113}
1114
1115DEFUN (debug_isis_rtevents,
1116 debug_isis_rtevents_cmd,
1117 "debug isis route-events",
1118 DEBUG_STR
1119 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001120 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +00001121{
1122 isis->debugs |= DEBUG_RTE_EVENTS;
1123 print_debug (vty, DEBUG_RTE_EVENTS, 1);
1124
1125 return CMD_SUCCESS;
1126}
1127
1128DEFUN (no_debug_isis_rtevents,
1129 no_debug_isis_rtevents_cmd,
1130 "no debug isis route-events",
1131 UNDEBUG_STR
1132 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001133 "IS-IS Route related events\n")
jardineb5d44e2003-12-23 08:09:43 +00001134{
1135 isis->debugs &= ~DEBUG_RTE_EVENTS;
1136 print_debug (vty, DEBUG_RTE_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +00001137
jardineb5d44e2003-12-23 08:09:43 +00001138 return CMD_SUCCESS;
1139}
1140
1141DEFUN (debug_isis_events,
1142 debug_isis_events_cmd,
1143 "debug isis events",
1144 DEBUG_STR
1145 "IS-IS information\n"
hassof1082d12005-09-19 04:23:34 +00001146 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +00001147{
1148 isis->debugs |= DEBUG_EVENTS;
1149 print_debug (vty, DEBUG_EVENTS, 1);
1150
1151 return CMD_SUCCESS;
1152}
1153
1154DEFUN (no_debug_isis_events,
1155 no_debug_isis_events_cmd,
1156 "no debug isis events",
1157 UNDEBUG_STR
1158 "IS-IS information\n"
hassof390d2c2004-09-10 20:48:21 +00001159 "IS-IS Events\n")
jardineb5d44e2003-12-23 08:09:43 +00001160{
1161 isis->debugs &= ~DEBUG_EVENTS;
1162 print_debug (vty, DEBUG_EVENTS, 0);
hassof390d2c2004-09-10 20:48:21 +00001163
jardineb5d44e2003-12-23 08:09:43 +00001164 return CMD_SUCCESS;
1165}
1166
Josh Bailey3f045a02012-03-24 08:35:20 -07001167DEFUN (debug_isis_packet_dump,
1168 debug_isis_packet_dump_cmd,
1169 "debug isis packet-dump",
1170 DEBUG_STR
1171 "IS-IS information\n"
1172 "IS-IS packet dump\n")
1173{
1174 isis->debugs |= DEBUG_PACKET_DUMP;
1175 print_debug (vty, DEBUG_PACKET_DUMP, 1);
1176
1177 return CMD_SUCCESS;
1178}
1179
1180DEFUN (no_debug_isis_packet_dump,
1181 no_debug_isis_packet_dump_cmd,
1182 "no debug isis packet-dump",
1183 UNDEBUG_STR
1184 "IS-IS information\n"
1185 "IS-IS packet dump\n")
1186{
1187 isis->debugs &= ~DEBUG_PACKET_DUMP;
1188 print_debug (vty, DEBUG_PACKET_DUMP, 0);
1189
1190 return CMD_SUCCESS;
1191}
1192
Christian Franke80a8f722015-11-12 14:21:47 +01001193DEFUN (debug_isis_lsp_gen,
1194 debug_isis_lsp_gen_cmd,
1195 "debug isis lsp-gen",
1196 DEBUG_STR
1197 "IS-IS information\n"
1198 "IS-IS generation of own LSPs\n")
1199{
1200 isis->debugs |= DEBUG_LSP_GEN;
1201 print_debug (vty, DEBUG_LSP_GEN, 1);
1202
1203 return CMD_SUCCESS;
1204}
1205
1206DEFUN (no_debug_isis_lsp_gen,
1207 no_debug_isis_lsp_gen_cmd,
1208 "no debug isis lsp-gen",
1209 UNDEBUG_STR
1210 "IS-IS information\n"
1211 "IS-IS generation of own LSPs\n")
1212{
1213 isis->debugs &= ~DEBUG_LSP_GEN;
1214 print_debug (vty, DEBUG_LSP_GEN, 0);
1215
1216 return CMD_SUCCESS;
1217}
1218
Christian Franke61010c32015-11-10 18:43:34 +01001219DEFUN (debug_isis_lsp_sched,
1220 debug_isis_lsp_sched_cmd,
1221 "debug isis lsp-sched",
1222 DEBUG_STR
1223 "IS-IS information\n"
1224 "IS-IS scheduling of LSP generation\n")
1225{
1226 isis->debugs |= DEBUG_LSP_SCHED;
1227 print_debug (vty, DEBUG_LSP_SCHED, 1);
1228
1229 return CMD_SUCCESS;
1230}
1231
1232DEFUN (no_debug_isis_lsp_sched,
1233 no_debug_isis_lsp_sched_cmd,
1234 "no debug isis lsp-gen",
1235 UNDEBUG_STR
1236 "IS-IS information\n"
1237 "IS-IS scheduling of LSP generation\n")
1238{
1239 isis->debugs &= ~DEBUG_LSP_SCHED;
1240 print_debug (vty, DEBUG_LSP_SCHED, 0);
1241
1242 return CMD_SUCCESS;
1243}
1244
jardineb5d44e2003-12-23 08:09:43 +00001245DEFUN (show_hostname,
1246 show_hostname_cmd,
1247 "show isis hostname",
1248 SHOW_STR
1249 "IS-IS information\n"
1250 "IS-IS Dynamic hostname mapping\n")
1251{
1252 dynhn_print_all (vty);
hassof390d2c2004-09-10 20:48:21 +00001253
jardineb5d44e2003-12-23 08:09:43 +00001254 return CMD_SUCCESS;
1255}
1256
Josh Bailey3f045a02012-03-24 08:35:20 -07001257static void
1258vty_out_timestr(struct vty *vty, time_t uptime)
1259{
1260 struct tm *tm;
1261 time_t difftime = time (NULL);
1262 difftime -= uptime;
1263 tm = gmtime (&difftime);
1264
1265#define ONE_DAY_SECOND 60*60*24
1266#define ONE_WEEK_SECOND 60*60*24*7
1267 if (difftime < ONE_DAY_SECOND)
1268 vty_out (vty, "%02d:%02d:%02d",
1269 tm->tm_hour, tm->tm_min, tm->tm_sec);
1270 else if (difftime < ONE_WEEK_SECOND)
1271 vty_out (vty, "%dd%02dh%02dm",
1272 tm->tm_yday, tm->tm_hour, tm->tm_min);
1273 else
1274 vty_out (vty, "%02dw%dd%02dh",
1275 tm->tm_yday/7,
1276 tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
1277 vty_out (vty, " ago");
1278}
1279
1280DEFUN (show_isis_summary,
1281 show_isis_summary_cmd,
1282 "show isis summary",
1283 SHOW_STR "IS-IS information\n" "IS-IS summary\n")
1284{
1285 struct listnode *node, *node2;
1286 struct isis_area *area;
1287 struct isis_spftree *spftree;
1288 int level;
1289
1290 if (isis == NULL)
1291 {
1292 vty_out (vty, "ISIS is not running%s", VTY_NEWLINE);
1293 return CMD_SUCCESS;
1294 }
1295
1296 vty_out (vty, "Process Id : %ld%s", isis->process_id,
1297 VTY_NEWLINE);
1298 if (isis->sysid_set)
1299 vty_out (vty, "System Id : %s%s", sysid_print (isis->sysid),
1300 VTY_NEWLINE);
1301
1302 vty_out (vty, "Up time : ");
1303 vty_out_timestr(vty, isis->uptime);
1304 vty_out (vty, "%s", VTY_NEWLINE);
1305
1306 if (isis->area_list)
1307 vty_out (vty, "Number of areas : %d%s", isis->area_list->count,
1308 VTY_NEWLINE);
1309
1310 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
1311 {
1312 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
1313 VTY_NEWLINE);
1314
1315 if (listcount (area->area_addrs) > 0)
1316 {
1317 struct area_addr *area_addr;
1318 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
1319 {
1320 vty_out (vty, " Net: %s%s",
1321 isonet_print (area_addr->area_addr,
1322 area_addr->addr_len + ISIS_SYS_ID_LEN +
1323 1), VTY_NEWLINE);
1324 }
1325 }
1326
1327 for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++)
1328 {
1329 if ((area->is_type & level) == 0)
1330 continue;
1331
1332 vty_out (vty, " Level-%d:%s", level, VTY_NEWLINE);
1333 spftree = area->spftree[level - 1];
1334 if (spftree->pending)
1335 vty_out (vty, " IPv4 SPF: (pending)%s", VTY_NEWLINE);
1336 else
1337 vty_out (vty, " IPv4 SPF:%s", VTY_NEWLINE);
1338
1339 vty_out (vty, " minimum interval : %d%s",
1340 area->min_spf_interval[level - 1], VTY_NEWLINE);
1341
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001342 vty_out (vty, " last run elapsed : ");
1343 vty_out_timestr(vty, spftree->last_run_timestamp);
Josh Bailey3f045a02012-03-24 08:35:20 -07001344 vty_out (vty, "%s", VTY_NEWLINE);
1345
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001346 vty_out (vty, " last run duration : %u usec%s",
1347 (u_int32_t)spftree->last_run_duration, VTY_NEWLINE);
1348
Josh Bailey3f045a02012-03-24 08:35:20 -07001349 vty_out (vty, " run count : %d%s",
1350 spftree->runcount, VTY_NEWLINE);
1351
1352#ifdef HAVE_IPV6
1353 spftree = area->spftree6[level - 1];
1354 if (spftree->pending)
1355 vty_out (vty, " IPv6 SPF: (pending)%s", VTY_NEWLINE);
1356 else
1357 vty_out (vty, " IPv6 SPF:%s", VTY_NEWLINE);
1358
1359 vty_out (vty, " minimum interval : %d%s",
1360 area->min_spf_interval[level - 1], VTY_NEWLINE);
1361
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001362 vty_out (vty, " last run elapsed : ");
1363 vty_out_timestr(vty, spftree->last_run_timestamp);
Josh Bailey3f045a02012-03-24 08:35:20 -07001364 vty_out (vty, "%s", VTY_NEWLINE);
1365
David Lamparteref008d22015-03-03 08:48:11 +01001366 vty_out (vty, " last run duration : %llu msec%s",
1367 (unsigned long long)spftree->last_run_duration, VTY_NEWLINE);
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001368
Josh Bailey3f045a02012-03-24 08:35:20 -07001369 vty_out (vty, " run count : %d%s",
1370 spftree->runcount, VTY_NEWLINE);
1371#endif
1372 }
1373 }
1374 vty_out (vty, "%s", VTY_NEWLINE);
1375
1376 return CMD_SUCCESS;
1377}
1378
1379/*
1380 * This function supports following display options:
1381 * [ show isis database [detail] ]
1382 * [ show isis database <sysid> [detail] ]
1383 * [ show isis database <hostname> [detail] ]
1384 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1385 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1386 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1387 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1388 * [ show isis database detail <sysid> ]
1389 * [ show isis database detail <hostname> ]
1390 * [ show isis database detail <sysid>.<pseudo-id> ]
1391 * [ show isis database detail <hostname>.<pseudo-id> ]
1392 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1393 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1394 */
1395static int
1396show_isis_database (struct vty *vty, const char *argv, int ui_level)
jardineb5d44e2003-12-23 08:09:43 +00001397{
hasso3fdb2dd2005-09-28 18:45:54 +00001398 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +00001399 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07001400 struct isis_lsp *lsp;
1401 struct isis_dynhn *dynhn;
1402 const char *pos = argv;
1403 u_char lspid[ISIS_SYS_ID_LEN+2];
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001404 char sysid[255];
Josh Bailey3f045a02012-03-24 08:35:20 -07001405 u_char number[3];
hassof390d2c2004-09-10 20:48:21 +00001406 int level, lsp_count;
jardineb5d44e2003-12-23 08:09:43 +00001407
1408 if (isis->area_list->count == 0)
1409 return CMD_SUCCESS;
jardineb5d44e2003-12-23 08:09:43 +00001410
Josh Bailey3f045a02012-03-24 08:35:20 -07001411 memset (&lspid, 0, ISIS_SYS_ID_LEN);
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001412 memset (&sysid, 0, 255);
Josh Bailey3f045a02012-03-24 08:35:20 -07001413
1414 /*
1415 * extract fragment and pseudo id from the string argv
1416 * in the forms:
1417 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1418 * (b) <systemid/hostname>.<pseudo-id> or
1419 * (c) <systemid/hostname> or
1420 * Where systemid is in the form:
1421 * xxxx.xxxx.xxxx
1422 */
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07001423 if (argv)
1424 strncpy (sysid, argv, 254);
Josh Bailey3f045a02012-03-24 08:35:20 -07001425 if (argv && strlen (argv) > 3)
1426 {
1427 pos = argv + strlen (argv) - 3;
1428 if (strncmp (pos, "-", 1) == 0)
1429 {
1430 memcpy (number, ++pos, 2);
1431 lspid[ISIS_SYS_ID_LEN+1] = (u_char) strtol ((char *)number, NULL, 16);
1432 pos -= 4;
1433 if (strncmp (pos, ".", 1) != 0)
1434 return CMD_ERR_AMBIGUOUS;
1435 }
1436 if (strncmp (pos, ".", 1) == 0)
1437 {
1438 memcpy (number, ++pos, 2);
1439 lspid[ISIS_SYS_ID_LEN] = (u_char) strtol ((char *)number, NULL, 16);
1440 sysid[pos - argv - 1] = '\0';
1441 }
1442 }
1443
hasso3fdb2dd2005-09-28 18:45:54 +00001444 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +00001445 {
hassof390d2c2004-09-10 20:48:21 +00001446 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
Josh Bailey3f045a02012-03-24 08:35:20 -07001447 VTY_NEWLINE);
1448
hassof390d2c2004-09-10 20:48:21 +00001449 for (level = 0; level < ISIS_LEVELS; level++)
Josh Bailey3f045a02012-03-24 08:35:20 -07001450 {
1451 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
1452 {
1453 lsp = NULL;
1454 if (argv != NULL)
1455 {
1456 /*
1457 * Try to find the lsp-id if the argv string is in
1458 * the form hostname.<pseudo-id>-<fragment>
1459 */
1460 if (sysid2buff (lspid, sysid))
1461 {
1462 lsp = lsp_search (lspid, area->lspdb[level]);
1463 }
1464 else if ((dynhn = dynhn_find_by_name (sysid)))
1465 {
1466 memcpy (lspid, dynhn->id, ISIS_SYS_ID_LEN);
1467 lsp = lsp_search (lspid, area->lspdb[level]);
1468 }
1469 else if (strncmp(unix_hostname (), sysid, 15) == 0)
1470 {
1471 memcpy (lspid, isis->sysid, ISIS_SYS_ID_LEN);
1472 lsp = lsp_search (lspid, area->lspdb[level]);
1473 }
1474 }
jardineb5d44e2003-12-23 08:09:43 +00001475
Josh Bailey3f045a02012-03-24 08:35:20 -07001476 if (lsp != NULL || argv == NULL)
1477 {
1478 vty_out (vty, "IS-IS Level-%d link-state database:%s",
1479 level + 1, VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +00001480
Josh Bailey3f045a02012-03-24 08:35:20 -07001481 /* print the title in all cases */
1482 vty_out (vty, "LSP ID PduLen "
1483 "SeqNumber Chksum Holdtime ATT/P/OL%s",
1484 VTY_NEWLINE);
1485 }
1486
1487 if (lsp)
1488 {
1489 if (ui_level == ISIS_UI_LEVEL_DETAIL)
1490 lsp_print_detail (lsp, vty, area->dynhostname);
1491 else
1492 lsp_print (lsp, vty, area->dynhostname);
1493 }
1494 else if (argv == NULL)
1495 {
1496 lsp_count = lsp_print_all (vty, area->lspdb[level],
1497 ui_level,
1498 area->dynhostname);
1499
1500 vty_out (vty, " %u LSPs%s%s",
1501 lsp_count, VTY_NEWLINE, VTY_NEWLINE);
1502 }
1503 }
1504 }
jardineb5d44e2003-12-23 08:09:43 +00001505 }
jardineb5d44e2003-12-23 08:09:43 +00001506
1507 return CMD_SUCCESS;
1508}
1509
Josh Bailey3f045a02012-03-24 08:35:20 -07001510DEFUN (show_database_brief,
1511 show_database_cmd,
1512 "show isis database",
1513 SHOW_STR
1514 "IS-IS information\n"
1515 "IS-IS link state database\n")
1516{
1517 return show_isis_database (vty, NULL, ISIS_UI_LEVEL_BRIEF);
1518}
1519
1520DEFUN (show_database_lsp_brief,
1521 show_database_arg_cmd,
1522 "show isis database WORD",
1523 SHOW_STR
1524 "IS-IS information\n"
1525 "IS-IS link state database\n"
1526 "LSP ID\n")
1527{
1528 return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_BRIEF);
1529}
1530
1531DEFUN (show_database_lsp_detail,
1532 show_database_arg_detail_cmd,
1533 "show isis database WORD detail",
1534 SHOW_STR
1535 "IS-IS information\n"
1536 "IS-IS link state database\n"
1537 "LSP ID\n"
1538 "Detailed information\n")
1539{
1540 return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
1541}
1542
jardineb5d44e2003-12-23 08:09:43 +00001543DEFUN (show_database_detail,
1544 show_database_detail_cmd,
1545 "show isis database detail",
1546 SHOW_STR
1547 "IS-IS information\n"
1548 "IS-IS link state database\n")
1549{
Josh Bailey3f045a02012-03-24 08:35:20 -07001550 return show_isis_database (vty, NULL, ISIS_UI_LEVEL_DETAIL);
1551}
jardineb5d44e2003-12-23 08:09:43 +00001552
Josh Bailey3f045a02012-03-24 08:35:20 -07001553DEFUN (show_database_detail_lsp,
1554 show_database_detail_arg_cmd,
1555 "show isis database detail WORD",
1556 SHOW_STR
1557 "IS-IS information\n"
1558 "IS-IS link state database\n"
1559 "Detailed information\n"
1560 "LSP ID\n")
1561{
1562 return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
jardineb5d44e2003-12-23 08:09:43 +00001563}
1564
1565/*
1566 * 'router isis' command
1567 */
1568DEFUN (router_isis,
1569 router_isis_cmd,
1570 "router isis WORD",
hassof390d2c2004-09-10 20:48:21 +00001571 ROUTER_STR
jardineb5d44e2003-12-23 08:09:43 +00001572 "ISO IS-IS\n"
1573 "ISO Routing area tag")
1574{
jardineb5d44e2003-12-23 08:09:43 +00001575 return isis_area_get (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001576}
1577
1578/*
1579 *'no router isis' command
1580 */
1581DEFUN (no_router_isis,
1582 no_router_isis_cmd,
1583 "no router isis WORD",
hassof390d2c2004-09-10 20:48:21 +00001584 "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag")
jardineb5d44e2003-12-23 08:09:43 +00001585{
1586 return isis_area_destroy (vty, argv[0]);
1587}
1588
1589/*
1590 * 'net' command
1591 */
1592DEFUN (net,
1593 net_cmd,
1594 "net WORD",
1595 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001596 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001597{
Paul Jakma41b36e92006-12-08 01:09:50 +00001598 return area_net_title (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001599}
1600
jardineb5d44e2003-12-23 08:09:43 +00001601/*
1602 * 'no net' command
1603 */
1604DEFUN (no_net,
1605 no_net_cmd,
1606 "no net WORD",
1607 NO_STR
1608 "A Network Entity Title for this process (OSI only)\n"
hassof390d2c2004-09-10 20:48:21 +00001609 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00001610{
Paul Jakma41b36e92006-12-08 01:09:50 +00001611 return area_clear_net_title (vty, argv[0]);
jardineb5d44e2003-12-23 08:09:43 +00001612}
1613
Christian Frankef1fc1db2015-11-10 18:43:31 +01001614static
1615int area_set_lsp_mtu(struct vty *vty, struct isis_area *area, unsigned int lsp_mtu)
1616{
1617 struct isis_circuit *circuit;
1618 struct listnode *node;
1619
1620 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit))
1621 {
1622 if(lsp_mtu > isis_circuit_pdu_size(circuit))
1623 {
1624 vty_out(vty, "ISIS area contains circuit %s, which has a maximum PDU size of %zu.%s",
1625 circuit->interface->name, isis_circuit_pdu_size(circuit),
1626 VTY_NEWLINE);
1627 return CMD_ERR_AMBIGUOUS;
1628 }
1629 }
1630
1631 area->lsp_mtu = lsp_mtu;
1632 lsp_regenerate_schedule(area, IS_LEVEL_1_AND_2, 1);
1633
1634 return CMD_SUCCESS;
1635}
1636
1637DEFUN (area_lsp_mtu,
1638 area_lsp_mtu_cmd,
1639 "lsp-mtu <128-4352>",
1640 "Configure the maximum size of generated LSPs\n"
1641 "Maximum size of generated LSPs\n")
1642{
1643 struct isis_area *area;
1644
1645 area = vty->index;
1646 if (!area)
1647 {
1648 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1649 return CMD_ERR_NO_MATCH;
1650 }
1651
1652 unsigned int lsp_mtu;
1653
1654 VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0], 128, 4352);
1655
1656 return area_set_lsp_mtu(vty, area, lsp_mtu);
1657}
1658
1659DEFUN(no_area_lsp_mtu,
1660 no_area_lsp_mtu_cmd,
1661 "no lsp-mtu",
1662 NO_STR
1663 "Configure the maximum size of generated LSPs\n")
1664{
1665 struct isis_area *area;
1666
1667 area = vty->index;
1668 if (!area)
1669 {
1670 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1671 return CMD_ERR_NO_MATCH;
1672 }
1673
1674 return area_set_lsp_mtu(vty, area, DEFAULT_LSP_MTU);
1675}
1676
1677ALIAS(no_area_lsp_mtu,
1678 no_area_lsp_mtu_arg_cmd,
1679 "no lsp-mtu <128-4352>",
1680 NO_STR
1681 "Configure the maximum size of generated LSPs\n"
1682 "Maximum size of generated LSPs\n");
1683
Josh Bailey3f045a02012-03-24 08:35:20 -07001684DEFUN (area_passwd_md5,
1685 area_passwd_md5_cmd,
1686 "area-password md5 WORD",
jardineb5d44e2003-12-23 08:09:43 +00001687 "Configure the authentication password for an area\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001688 "Authentication type\n"
hassof390d2c2004-09-10 20:48:21 +00001689 "Area password\n")
jardineb5d44e2003-12-23 08:09:43 +00001690{
1691 struct isis_area *area;
1692 int len;
1693
1694 area = vty->index;
1695
hassof390d2c2004-09-10 20:48:21 +00001696 if (!area)
1697 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001698 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1699 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001700 }
1701
jardineb5d44e2003-12-23 08:09:43 +00001702 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001703 if (len > 254)
1704 {
1705 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001706 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001707 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001708
1709 area->area_passwd.len = (u_char) len;
1710 area->area_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1711 strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
1712
1713 if (argc > 1)
1714 {
1715 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1716 if (strncmp(argv[1], "v", 1) == 0)
1717 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1718 else
1719 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1720 }
1721 else
1722 {
1723 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1724 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1725 }
1726 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1727
1728 return CMD_SUCCESS;
1729}
1730
1731ALIAS (area_passwd_md5,
1732 area_passwd_md5_snpauth_cmd,
1733 "area-password md5 WORD authenticate snp (send-only|validate)",
1734 "Configure the authentication password for an area\n"
1735 "Authentication type\n"
1736 "Area password\n"
1737 "Authentication\n"
1738 "SNP PDUs\n"
1739 "Send but do not check PDUs on receiving\n"
David Lamparterb7d50212015-03-03 08:53:18 +01001740 "Send and check PDUs on receiving\n")
Josh Bailey3f045a02012-03-24 08:35:20 -07001741
1742DEFUN (area_passwd_clear,
1743 area_passwd_clear_cmd,
1744 "area-password clear WORD",
1745 "Configure the authentication password for an area\n"
1746 "Authentication type\n"
1747 "Area password\n")
1748{
1749 struct isis_area *area;
1750 int len;
1751
1752 area = vty->index;
1753
1754 if (!area)
1755 {
1756 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1757 return CMD_ERR_NO_MATCH;
1758 }
1759
1760 len = strlen (argv[0]);
1761 if (len > 254)
1762 {
1763 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1764 return CMD_ERR_AMBIGUOUS;
1765 }
1766
hassof390d2c2004-09-10 20:48:21 +00001767 area->area_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001768 area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001769 strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001770
hasso1cbc5622005-01-01 10:29:51 +00001771 if (argc > 1)
1772 {
1773 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1774 if (strncmp(argv[1], "v", 1) == 0)
1775 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1776 else
1777 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1778 }
1779 else
1780 {
1781 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1782 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1783 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001784 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
hasso1cbc5622005-01-01 10:29:51 +00001785
jardineb5d44e2003-12-23 08:09:43 +00001786 return CMD_SUCCESS;
1787}
1788
Josh Bailey3f045a02012-03-24 08:35:20 -07001789ALIAS (area_passwd_clear,
1790 area_passwd_clear_snpauth_cmd,
1791 "area-password clear WORD authenticate snp (send-only|validate)",
hasso1cbc5622005-01-01 10:29:51 +00001792 "Configure the authentication password for an area\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001793 "Authentication type\n"
hasso1cbc5622005-01-01 10:29:51 +00001794 "Area password\n"
1795 "Authentication\n"
1796 "SNP PDUs\n"
1797 "Send but do not check PDUs on receiving\n"
David Lamparterb7d50212015-03-03 08:53:18 +01001798 "Send and check PDUs on receiving\n")
hasso1cbc5622005-01-01 10:29:51 +00001799
jardineb5d44e2003-12-23 08:09:43 +00001800DEFUN (no_area_passwd,
1801 no_area_passwd_cmd,
1802 "no area-password",
1803 NO_STR
1804 "Configure the authentication password for an area\n")
1805{
1806 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001807
jardineb5d44e2003-12-23 08:09:43 +00001808 area = vty->index;
1809
hassof390d2c2004-09-10 20:48:21 +00001810 if (!area)
1811 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001812 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1813 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001814 }
1815
jardineb5d44e2003-12-23 08:09:43 +00001816 memset (&area->area_passwd, 0, sizeof (struct isis_passwd));
Josh Bailey3f045a02012-03-24 08:35:20 -07001817 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
jardineb5d44e2003-12-23 08:09:43 +00001818
1819 return CMD_SUCCESS;
1820}
1821
Josh Bailey3f045a02012-03-24 08:35:20 -07001822DEFUN (domain_passwd_md5,
1823 domain_passwd_md5_cmd,
1824 "domain-password md5 WORD",
jardineb5d44e2003-12-23 08:09:43 +00001825 "Set the authentication password for a routing domain\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001826 "Authentication type\n"
hassof390d2c2004-09-10 20:48:21 +00001827 "Routing domain password\n")
jardineb5d44e2003-12-23 08:09:43 +00001828{
1829 struct isis_area *area;
1830 int len;
1831
1832 area = vty->index;
1833
hassof390d2c2004-09-10 20:48:21 +00001834 if (!area)
1835 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001836 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1837 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001838 }
1839
jardineb5d44e2003-12-23 08:09:43 +00001840 len = strlen (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001841 if (len > 254)
1842 {
1843 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
Josh Bailey3f045a02012-03-24 08:35:20 -07001844 return CMD_ERR_AMBIGUOUS;
hassof390d2c2004-09-10 20:48:21 +00001845 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001846
1847 area->domain_passwd.len = (u_char) len;
1848 area->domain_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1849 strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
1850
1851 if (argc > 1)
1852 {
1853 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1854 if (strncmp(argv[1], "v", 1) == 0)
1855 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1856 else
1857 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1858 }
1859 else
1860 {
1861 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1862 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1863 }
1864 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1865
1866 return CMD_SUCCESS;
1867}
1868
1869ALIAS (domain_passwd_md5,
1870 domain_passwd_md5_snpauth_cmd,
1871 "domain-password md5 WORD authenticate snp (send-only|validate)",
1872 "Set the authentication password for a routing domain\n"
1873 "Authentication type\n"
1874 "Routing domain password\n"
1875 "Authentication\n"
1876 "SNP PDUs\n"
1877 "Send but do not check PDUs on receiving\n"
David Lamparterb7d50212015-03-03 08:53:18 +01001878 "Send and check PDUs on receiving\n")
Josh Bailey3f045a02012-03-24 08:35:20 -07001879
1880DEFUN (domain_passwd_clear,
1881 domain_passwd_clear_cmd,
1882 "domain-password clear WORD",
1883 "Set the authentication password for a routing domain\n"
1884 "Authentication type\n"
1885 "Routing domain password\n")
1886{
1887 struct isis_area *area;
1888 int len;
1889
1890 area = vty->index;
1891
1892 if (!area)
1893 {
1894 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1895 return CMD_ERR_NO_MATCH;
1896 }
1897
1898 len = strlen (argv[0]);
1899 if (len > 254)
1900 {
1901 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1902 return CMD_ERR_AMBIGUOUS;
1903 }
1904
hassof390d2c2004-09-10 20:48:21 +00001905 area->domain_passwd.len = (u_char) len;
jardineb5d44e2003-12-23 08:09:43 +00001906 area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
hassof7c43dc2004-09-26 16:24:14 +00001907 strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
hassof390d2c2004-09-10 20:48:21 +00001908
hasso1cbc5622005-01-01 10:29:51 +00001909 if (argc > 1)
1910 {
1911 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1912 if (strncmp(argv[1], "v", 1) == 0)
1913 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1914 else
1915 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1916 }
1917 else
1918 {
1919 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1920 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1921 }
Josh Bailey3f045a02012-03-24 08:35:20 -07001922 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
hasso1cbc5622005-01-01 10:29:51 +00001923
jardineb5d44e2003-12-23 08:09:43 +00001924 return CMD_SUCCESS;
1925}
1926
Josh Bailey3f045a02012-03-24 08:35:20 -07001927ALIAS (domain_passwd_clear,
1928 domain_passwd_clear_snpauth_cmd,
1929 "domain-password clear WORD authenticate snp (send-only|validate)",
hasso1cbc5622005-01-01 10:29:51 +00001930 "Set the authentication password for a routing domain\n"
Josh Bailey3f045a02012-03-24 08:35:20 -07001931 "Authentication type\n"
hasso1cbc5622005-01-01 10:29:51 +00001932 "Routing domain password\n"
1933 "Authentication\n"
1934 "SNP PDUs\n"
1935 "Send but do not check PDUs on receiving\n"
David Lamparterb7d50212015-03-03 08:53:18 +01001936 "Send and check PDUs on receiving\n")
hasso1cbc5622005-01-01 10:29:51 +00001937
jardineb5d44e2003-12-23 08:09:43 +00001938DEFUN (no_domain_passwd,
1939 no_domain_passwd_cmd,
Josh Bailey3f045a02012-03-24 08:35:20 -07001940 "no domain-password",
jardineb5d44e2003-12-23 08:09:43 +00001941 NO_STR
1942 "Set the authentication password for a routing domain\n")
1943{
1944 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00001945
jardineb5d44e2003-12-23 08:09:43 +00001946 area = vty->index;
1947
hassof390d2c2004-09-10 20:48:21 +00001948 if (!area)
1949 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001950 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1951 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001952 }
1953
jardineb5d44e2003-12-23 08:09:43 +00001954 memset (&area->domain_passwd, 0, sizeof (struct isis_passwd));
Josh Bailey3f045a02012-03-24 08:35:20 -07001955 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
hassof390d2c2004-09-10 20:48:21 +00001956
jardineb5d44e2003-12-23 08:09:43 +00001957 return CMD_SUCCESS;
1958}
1959
1960DEFUN (is_type,
1961 is_type_cmd,
1962 "is-type (level-1|level-1-2|level-2-only)",
1963 "IS Level for this routing process (OSI only)\n"
1964 "Act as a station router only\n"
1965 "Act as both a station router and an area router\n"
1966 "Act as an area router only\n")
1967{
1968 struct isis_area *area;
1969 int type;
1970
1971 area = vty->index;
1972
hassof390d2c2004-09-10 20:48:21 +00001973 if (!area)
1974 {
Josh Bailey3f045a02012-03-24 08:35:20 -07001975 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1976 return CMD_ERR_NO_MATCH;
hassof390d2c2004-09-10 20:48:21 +00001977 }
jardineb5d44e2003-12-23 08:09:43 +00001978
Paul Jakma41b36e92006-12-08 01:09:50 +00001979 type = string2circuit_t (argv[0]);
hassof390d2c2004-09-10 20:48:21 +00001980 if (!type)
1981 {
1982 vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
1983 return CMD_SUCCESS;
1984 }
jardineb5d44e2003-12-23 08:09:43 +00001985
1986 isis_event_system_type_change (area, type);
hassof390d2c2004-09-10 20:48:21 +00001987
jardineb5d44e2003-12-23 08:09:43 +00001988 return CMD_SUCCESS;
1989}
1990
1991DEFUN (no_is_type,
1992 no_is_type_cmd,
1993 "no is-type (level-1|level-1-2|level-2-only)",
1994 NO_STR
1995 "IS Level for this routing process (OSI only)\n"
1996 "Act as a station router only\n"
1997 "Act as both a station router and an area router\n"
1998 "Act as an area router only\n")
1999{
jardineb5d44e2003-12-23 08:09:43 +00002000 struct isis_area *area;
2001 int type;
2002
2003 area = vty->index;
2004 assert (area);
hassof390d2c2004-09-10 20:48:21 +00002005
jardineb5d44e2003-12-23 08:09:43 +00002006 /*
Josh Bailey3f045a02012-03-24 08:35:20 -07002007 * Put the is-type back to defaults:
2008 * - level-1-2 on first area
2009 * - level-1 for the rest
jardineb5d44e2003-12-23 08:09:43 +00002010 */
paul1eb8ef22005-04-07 07:30:20 +00002011 if (listgetdata (listhead (isis->area_list)) == area)
jardineb5d44e2003-12-23 08:09:43 +00002012 type = IS_LEVEL_1_AND_2;
2013 else
2014 type = IS_LEVEL_1;
2015
2016 isis_event_system_type_change (area, type);
2017
2018 return CMD_SUCCESS;
2019}
2020
Josh Bailey3f045a02012-03-24 08:35:20 -07002021static int
2022set_lsp_gen_interval (struct vty *vty, struct isis_area *area,
2023 uint16_t interval, int level)
2024{
2025 int lvl;
2026
2027 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2028 {
2029 if (!(lvl & level))
2030 continue;
2031
2032 if (interval >= area->lsp_refresh[lvl-1])
2033 {
2034 vty_out (vty, "LSP gen interval %us must be less than "
2035 "the LSP refresh interval %us%s",
2036 interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
2037 return CMD_ERR_AMBIGUOUS;
2038 }
2039 }
2040
2041 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2042 {
2043 if (!(lvl & level))
2044 continue;
2045 area->lsp_gen_interval[lvl-1] = interval;
2046 }
2047
2048 return CMD_SUCCESS;
2049}
2050
jardineb5d44e2003-12-23 08:09:43 +00002051DEFUN (lsp_gen_interval,
2052 lsp_gen_interval_cmd,
2053 "lsp-gen-interval <1-120>",
2054 "Minimum interval between regenerating same LSP\n"
2055 "Minimum interval in seconds\n")
2056{
2057 struct isis_area *area;
2058 uint16_t interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002059 int level;
jardineb5d44e2003-12-23 08:09:43 +00002060
2061 area = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002062 interval = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002063 level = IS_LEVEL_1 | IS_LEVEL_2;
2064 return set_lsp_gen_interval (vty, area, interval, level);
jardineb5d44e2003-12-23 08:09:43 +00002065}
2066
2067DEFUN (no_lsp_gen_interval,
2068 no_lsp_gen_interval_cmd,
2069 "no lsp-gen-interval",
2070 NO_STR
hassof390d2c2004-09-10 20:48:21 +00002071 "Minimum interval between regenerating same LSP\n")
jardineb5d44e2003-12-23 08:09:43 +00002072{
2073 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07002074 uint16_t interval;
2075 int level;
jardineb5d44e2003-12-23 08:09:43 +00002076
2077 area = vty->index;
Josh Bailey3f045a02012-03-24 08:35:20 -07002078 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
2079 level = IS_LEVEL_1 | IS_LEVEL_2;
2080 return set_lsp_gen_interval (vty, area, interval, level);
jardineb5d44e2003-12-23 08:09:43 +00002081}
2082
2083ALIAS (no_lsp_gen_interval,
2084 no_lsp_gen_interval_arg_cmd,
2085 "no lsp-gen-interval <1-120>",
2086 NO_STR
2087 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00002088 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002089
2090DEFUN (lsp_gen_interval_l1,
2091 lsp_gen_interval_l1_cmd,
2092 "lsp-gen-interval level-1 <1-120>",
2093 "Minimum interval between regenerating same LSP\n"
2094 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00002095 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002096{
2097 struct isis_area *area;
2098 uint16_t interval;
Josh Bailey3f045a02012-03-24 08:35:20 -07002099 int level;
jardineb5d44e2003-12-23 08:09:43 +00002100
2101 area = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002102 interval = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002103 level = IS_LEVEL_1;
2104 return set_lsp_gen_interval (vty, area, interval, level);
jardineb5d44e2003-12-23 08:09:43 +00002105}
2106
2107DEFUN (no_lsp_gen_interval_l1,
2108 no_lsp_gen_interval_l1_cmd,
2109 "no lsp-gen-interval level-1",
2110 NO_STR
2111 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00002112 "Set interval for level 1 only\n")
jardineb5d44e2003-12-23 08:09:43 +00002113{
2114 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07002115 uint16_t interval;
2116 int level;
jardineb5d44e2003-12-23 08:09:43 +00002117
2118 area = vty->index;
Josh Bailey3f045a02012-03-24 08:35:20 -07002119 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
2120 level = IS_LEVEL_1;
2121 return set_lsp_gen_interval (vty, area, interval, level);
jardineb5d44e2003-12-23 08:09:43 +00002122}
2123
2124ALIAS (no_lsp_gen_interval_l1,
2125 no_lsp_gen_interval_l1_arg_cmd,
2126 "no lsp-gen-interval level-1 <1-120>",
2127 NO_STR
2128 "Minimum interval between regenerating same LSP\n"
2129 "Set interval for level 1 only\n"
hassof390d2c2004-09-10 20:48:21 +00002130 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002131
2132DEFUN (lsp_gen_interval_l2,
2133 lsp_gen_interval_l2_cmd,
2134 "lsp-gen-interval level-2 <1-120>",
2135 "Minimum interval between regenerating same LSP\n"
2136 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00002137 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002138{
2139 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07002140 uint16_t interval;
2141 int level;
jardineb5d44e2003-12-23 08:09:43 +00002142
2143 area = vty->index;
jardineb5d44e2003-12-23 08:09:43 +00002144 interval = atoi (argv[0]);
Josh Bailey3f045a02012-03-24 08:35:20 -07002145 level = IS_LEVEL_2;
2146 return set_lsp_gen_interval (vty, area, interval, level);
jardineb5d44e2003-12-23 08:09:43 +00002147}
2148
2149DEFUN (no_lsp_gen_interval_l2,
2150 no_lsp_gen_interval_l2_cmd,
2151 "no lsp-gen-interval level-2",
2152 NO_STR
2153 "Minimum interval between regenerating same LSP\n"
hassof390d2c2004-09-10 20:48:21 +00002154 "Set interval for level 2 only\n")
jardineb5d44e2003-12-23 08:09:43 +00002155{
2156 struct isis_area *area;
Josh Bailey3f045a02012-03-24 08:35:20 -07002157 uint16_t interval;
2158 int level;
jardineb5d44e2003-12-23 08:09:43 +00002159
2160 area = vty->index;
Josh Bailey3f045a02012-03-24 08:35:20 -07002161 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
2162 level = IS_LEVEL_2;
2163 return set_lsp_gen_interval (vty, area, interval, level);
jardineb5d44e2003-12-23 08:09:43 +00002164}
2165
2166ALIAS (no_lsp_gen_interval_l2,
2167 no_lsp_gen_interval_l2_arg_cmd,
2168 "no lsp-gen-interval level-2 <1-120>",
2169 NO_STR
2170 "Minimum interval between regenerating same LSP\n"
2171 "Set interval for level 2 only\n"
hassof390d2c2004-09-10 20:48:21 +00002172 "Minimum interval in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002173
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002174static int
2175validate_metric_style_narrow (struct vty *vty, struct isis_area *area)
2176{
2177 struct isis_circuit *circuit;
2178 struct listnode *node;
2179
2180 if (! vty)
2181 return CMD_ERR_AMBIGUOUS;
2182
2183 if (! area)
2184 {
2185 vty_out (vty, "ISIS area is invalid%s", VTY_NEWLINE);
2186 return CMD_ERR_AMBIGUOUS;
2187 }
2188
2189 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
2190 {
2191 if ((area->is_type & IS_LEVEL_1) &&
2192 (circuit->is_type & IS_LEVEL_1) &&
Christian Franke4fb7c842012-11-27 19:51:59 +00002193 (circuit->te_metric[0] > MAX_NARROW_LINK_METRIC))
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002194 {
2195 vty_out (vty, "ISIS circuit %s metric is invalid%s",
2196 circuit->interface->name, VTY_NEWLINE);
2197 return CMD_ERR_AMBIGUOUS;
2198 }
2199 if ((area->is_type & IS_LEVEL_2) &&
2200 (circuit->is_type & IS_LEVEL_2) &&
Christian Franke4fb7c842012-11-27 19:51:59 +00002201 (circuit->te_metric[1] > MAX_NARROW_LINK_METRIC))
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002202 {
2203 vty_out (vty, "ISIS circuit %s metric is invalid%s",
2204 circuit->interface->name, VTY_NEWLINE);
2205 return CMD_ERR_AMBIGUOUS;
2206 }
2207 }
2208
2209 return CMD_SUCCESS;
2210}
2211
jardineb5d44e2003-12-23 08:09:43 +00002212DEFUN (metric_style,
2213 metric_style_cmd,
hasso2984d262005-09-26 16:49:07 +00002214 "metric-style (narrow|transition|wide)",
jardineb5d44e2003-12-23 08:09:43 +00002215 "Use old-style (ISO 10589) or new-style packet formats\n"
2216 "Use old style of TLVs with narrow metric\n"
hasso2984d262005-09-26 16:49:07 +00002217 "Send and accept both styles of TLVs during transition\n"
jardineb5d44e2003-12-23 08:09:43 +00002218 "Use new style of TLVs to carry wider metric\n")
2219{
2220 struct isis_area *area;
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002221 int ret;
jardineb5d44e2003-12-23 08:09:43 +00002222
2223 area = vty->index;
2224 assert (area);
hasso2984d262005-09-26 16:49:07 +00002225
2226 if (strncmp (argv[0], "w", 1) == 0)
2227 {
2228 area->newmetric = 1;
2229 area->oldmetric = 0;
2230 }
Christian Franke478c1122012-11-27 19:52:00 +00002231 else
hasso2984d262005-09-26 16:49:07 +00002232 {
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002233 ret = validate_metric_style_narrow (vty, area);
2234 if (ret != CMD_SUCCESS)
2235 return ret;
2236
Christian Franke478c1122012-11-27 19:52:00 +00002237 if (strncmp (argv[0], "t", 1) == 0)
2238 {
2239 area->newmetric = 1;
2240 area->oldmetric = 1;
2241 }
2242 else if (strncmp (argv[0], "n", 1) == 0)
2243 {
2244 area->newmetric = 0;
2245 area->oldmetric = 1;
2246 }
hasso2984d262005-09-26 16:49:07 +00002247 }
jardineb5d44e2003-12-23 08:09:43 +00002248
2249 return CMD_SUCCESS;
2250}
2251
2252DEFUN (no_metric_style,
2253 no_metric_style_cmd,
hasso2984d262005-09-26 16:49:07 +00002254 "no metric-style",
jardineb5d44e2003-12-23 08:09:43 +00002255 NO_STR
hasso2984d262005-09-26 16:49:07 +00002256 "Use old-style (ISO 10589) or new-style packet formats\n")
jardineb5d44e2003-12-23 08:09:43 +00002257{
2258 struct isis_area *area;
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002259 int ret;
jardineb5d44e2003-12-23 08:09:43 +00002260
2261 area = vty->index;
2262 assert (area);
2263
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07002264 ret = validate_metric_style_narrow (vty, area);
2265 if (ret != CMD_SUCCESS)
2266 return ret;
2267
hasso2984d262005-09-26 16:49:07 +00002268 /* Default is narrow metric. */
2269 area->newmetric = 0;
2270 area->oldmetric = 1;
jardineb5d44e2003-12-23 08:09:43 +00002271
2272 return CMD_SUCCESS;
2273}
2274
Josh Bailey3f045a02012-03-24 08:35:20 -07002275DEFUN (set_overload_bit,
2276 set_overload_bit_cmd,
2277 "set-overload-bit",
2278 "Set overload bit to avoid any transit traffic\n"
2279 "Set overload bit\n")
2280{
2281 struct isis_area *area;
2282
2283 area = vty->index;
2284 assert (area);
2285
2286 area->overload_bit = LSPBIT_OL;
2287 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2288
2289 return CMD_SUCCESS;
2290}
2291
2292DEFUN (no_set_overload_bit,
2293 no_set_overload_bit_cmd,
2294 "no set-overload-bit",
2295 "Reset overload bit to accept transit traffic\n"
2296 "Reset overload bit\n")
2297{
2298 struct isis_area *area;
2299
2300 area = vty->index;
2301 assert (area);
2302
2303 area->overload_bit = 0;
2304 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2305
2306 return CMD_SUCCESS;
2307}
2308
Amritha Nambiarc8ee9402015-08-24 16:40:14 -07002309DEFUN (set_attached_bit,
2310 set_attached_bit_cmd,
2311 "set-attached-bit",
2312 "Set attached bit to identify as L1/L2 router for inter-area traffic\n"
2313 "Set attached bit\n")
2314{
2315 struct isis_area *area;
2316
2317 area = vty->index;
2318 assert (area);
2319
2320 area->attached_bit = LSPBIT_ATT;
2321 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2322
2323 return CMD_SUCCESS;
2324}
2325
2326DEFUN (no_set_attached_bit,
2327 no_set_attached_bit_cmd,
2328 "no set-attached-bit",
2329 "Reset attached bit\n")
2330{
2331 struct isis_area *area;
2332
2333 area = vty->index;
2334 assert (area);
2335
2336 area->attached_bit = 0;
2337 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2338
2339 return CMD_SUCCESS;
2340}
2341
jardineb5d44e2003-12-23 08:09:43 +00002342DEFUN (dynamic_hostname,
2343 dynamic_hostname_cmd,
2344 "hostname dynamic",
2345 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00002346 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00002347{
2348 struct isis_area *area;
2349
2350 area = vty->index;
2351 assert (area);
hassof390d2c2004-09-10 20:48:21 +00002352
Josh Bailey3f045a02012-03-24 08:35:20 -07002353 if (!area->dynhostname)
2354 {
2355 area->dynhostname = 1;
2356 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0);
2357 }
hassof390d2c2004-09-10 20:48:21 +00002358
jardineb5d44e2003-12-23 08:09:43 +00002359 return CMD_SUCCESS;
2360}
2361
2362DEFUN (no_dynamic_hostname,
2363 no_dynamic_hostname_cmd,
2364 "no hostname dynamic",
2365 NO_STR
2366 "Dynamic hostname for IS-IS\n"
hassof390d2c2004-09-10 20:48:21 +00002367 "Dynamic hostname\n")
jardineb5d44e2003-12-23 08:09:43 +00002368{
2369 struct isis_area *area;
2370
2371 area = vty->index;
2372 assert (area);
hassof390d2c2004-09-10 20:48:21 +00002373
Josh Bailey3f045a02012-03-24 08:35:20 -07002374 if (area->dynhostname)
2375 {
2376 area->dynhostname = 0;
2377 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0);
2378 }
hassof390d2c2004-09-10 20:48:21 +00002379
jardineb5d44e2003-12-23 08:09:43 +00002380 return CMD_SUCCESS;
2381}
2382
2383DEFUN (spf_interval,
2384 spf_interval_cmd,
2385 "spf-interval <1-120>",
hasso2097cd82003-12-23 11:51:08 +00002386 "Minimum interval between SPF calculations\n"
jardineb5d44e2003-12-23 08:09:43 +00002387 "Minimum interval between consecutive SPFs in seconds\n")
2388{
2389 struct isis_area *area;
2390 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00002391
jardineb5d44e2003-12-23 08:09:43 +00002392 area = vty->index;
2393 interval = atoi (argv[0]);
2394 area->min_spf_interval[0] = interval;
2395 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00002396
jardineb5d44e2003-12-23 08:09:43 +00002397 return CMD_SUCCESS;
2398}
2399
2400DEFUN (no_spf_interval,
2401 no_spf_interval_cmd,
2402 "no spf-interval",
2403 NO_STR
hassof390d2c2004-09-10 20:48:21 +00002404 "Minimum interval between SPF calculations\n")
jardineb5d44e2003-12-23 08:09:43 +00002405{
2406 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00002407
jardineb5d44e2003-12-23 08:09:43 +00002408 area = vty->index;
2409
2410 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
2411 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002412
jardineb5d44e2003-12-23 08:09:43 +00002413 return CMD_SUCCESS;
2414}
2415
2416ALIAS (no_spf_interval,
2417 no_spf_interval_arg_cmd,
2418 "no spf-interval <1-120>",
2419 NO_STR
2420 "Minimum interval between SPF calculations\n"
hassof390d2c2004-09-10 20:48:21 +00002421 "Minimum interval between consecutive SPFs in seconds\n")
jardineb5d44e2003-12-23 08:09:43 +00002422
2423DEFUN (spf_interval_l1,
2424 spf_interval_l1_cmd,
2425 "spf-interval level-1 <1-120>",
2426 "Minimum interval between SPF calculations\n"
2427 "Set interval for level 1 only\n"
2428 "Minimum interval between consecutive SPFs in seconds\n")
2429{
2430 struct isis_area *area;
2431 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00002432
jardineb5d44e2003-12-23 08:09:43 +00002433 area = vty->index;
2434 interval = atoi (argv[0]);
2435 area->min_spf_interval[0] = interval;
hassof390d2c2004-09-10 20:48:21 +00002436
jardineb5d44e2003-12-23 08:09:43 +00002437 return CMD_SUCCESS;
2438}
2439
2440DEFUN (no_spf_interval_l1,
2441 no_spf_interval_l1_cmd,
2442 "no spf-interval level-1",
2443 NO_STR
2444 "Minimum interval between SPF calculations\n"
2445 "Set interval for level 1 only\n")
2446{
2447 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00002448
jardineb5d44e2003-12-23 08:09:43 +00002449 area = vty->index;
2450
2451 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002452
jardineb5d44e2003-12-23 08:09:43 +00002453 return CMD_SUCCESS;
2454}
2455
2456ALIAS (no_spf_interval,
2457 no_spf_interval_l1_arg_cmd,
2458 "no spf-interval level-1 <1-120>",
2459 NO_STR
2460 "Minimum interval between SPF calculations\n"
2461 "Set interval for level 1 only\n"
2462 "Minimum interval between consecutive SPFs in seconds\n")
2463
2464DEFUN (spf_interval_l2,
2465 spf_interval_l2_cmd,
2466 "spf-interval level-2 <1-120>",
2467 "Minimum interval between SPF calculations\n"
2468 "Set interval for level 2 only\n"
2469 "Minimum interval between consecutive SPFs in seconds\n")
2470{
2471 struct isis_area *area;
2472 u_int16_t interval;
hassof390d2c2004-09-10 20:48:21 +00002473
jardineb5d44e2003-12-23 08:09:43 +00002474 area = vty->index;
2475 interval = atoi (argv[0]);
2476 area->min_spf_interval[1] = interval;
hassof390d2c2004-09-10 20:48:21 +00002477
jardineb5d44e2003-12-23 08:09:43 +00002478 return CMD_SUCCESS;
2479}
2480
2481DEFUN (no_spf_interval_l2,
2482 no_spf_interval_l2_cmd,
2483 "no spf-interval level-2",
2484 NO_STR
2485 "Minimum interval between SPF calculations\n"
2486 "Set interval for level 2 only\n")
2487{
2488 struct isis_area *area;
hassof390d2c2004-09-10 20:48:21 +00002489
jardineb5d44e2003-12-23 08:09:43 +00002490 area = vty->index;
2491
2492 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
hassof390d2c2004-09-10 20:48:21 +00002493
jardineb5d44e2003-12-23 08:09:43 +00002494 return CMD_SUCCESS;
2495}
2496
2497ALIAS (no_spf_interval,
2498 no_spf_interval_l2_arg_cmd,
2499 "no spf-interval level-2 <1-120>",
2500 NO_STR
2501 "Minimum interval between SPF calculations\n"
2502 "Set interval for level 2 only\n"
2503 "Minimum interval between consecutive SPFs in seconds\n")
2504
Josh Bailey3f045a02012-03-24 08:35:20 -07002505static int
2506set_lsp_max_lifetime (struct vty *vty, struct isis_area *area,
2507 uint16_t interval, int level)
2508{
2509 int lvl;
2510 int set_refresh_interval[ISIS_LEVELS] = {0, 0};
2511 uint16_t refresh_interval;
2512
2513 refresh_interval = interval - 300;
2514
2515 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
2516 {
2517 if (!(lvl & level))
2518 continue;
2519 if (refresh_interval < area->lsp_refresh[lvl-1])
2520 {
2521 vty_out (vty, "Level %d Max LSP lifetime %us must be 300s greater than "
2522 "the configured LSP refresh interval %us%s",
2523 lvl, interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
2524 vty_out (vty, "Automatically reducing level %d LSP refresh interval "
2525 "to %us%s", lvl, refresh_interval, VTY_NEWLINE);
2526 set_refresh_interval[lvl-1] = 1;
2527
2528 if (refresh_interval <= area->lsp_gen_interval[lvl-1])
2529 {
2530 vty_out (vty, "LSP refresh interval %us must be greater than "
2531 "the configured LSP gen interval %us%s",
2532 refresh_interval, area->lsp_gen_interval[lvl-1],
2533 VTY_NEWLINE);
2534 return CMD_ERR_AMBIGUOUS;
2535 }
2536 }
2537 }
2538
2539 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
2540 {
2541 if (!(lvl & level))
2542 continue;
2543 area->max_lsp_lifetime[lvl-1] = interval;
2544 /* Automatically reducing lsp_refresh_interval to interval - 300 */
2545 if (set_refresh_interval[lvl-1])
2546 area->lsp_refresh[lvl-1] = refresh_interval;
2547 }
2548
2549 lsp_regenerate_schedule (area, level, 1);
2550
2551 return CMD_SUCCESS;
2552}
2553
2554DEFUN (max_lsp_lifetime,
2555 max_lsp_lifetime_cmd,
2556 "max-lsp-lifetime <350-65535>",
2557 "Maximum LSP lifetime\n"
2558 "LSP lifetime in seconds\n")
2559{
2560 struct isis_area *area;
2561 uint16_t interval;
2562 int level;
2563
2564 area = vty->index;
2565 interval = atoi (argv[0]);
2566 level = IS_LEVEL_1 | IS_LEVEL_2;
2567 return set_lsp_max_lifetime (vty, area, interval, level);
2568}
2569
2570DEFUN (no_max_lsp_lifetime,
2571 no_max_lsp_lifetime_cmd,
2572 "no max-lsp-lifetime",
2573 NO_STR
2574 "LSP lifetime in seconds\n")
2575{
2576 struct isis_area *area;
2577 uint16_t interval;
2578 int level;
2579
2580 area = vty->index;
2581 interval = DEFAULT_LSP_LIFETIME;
2582 level = IS_LEVEL_1 | IS_LEVEL_2;
2583 return set_lsp_max_lifetime (vty, area, interval, level);
2584}
2585
2586ALIAS (no_max_lsp_lifetime,
2587 no_max_lsp_lifetime_arg_cmd,
2588 "no max-lsp-lifetime <350-65535>",
2589 NO_STR
2590 "Maximum LSP lifetime\n"
2591 "LSP lifetime in seconds\n")
2592
2593DEFUN (max_lsp_lifetime_l1,
2594 max_lsp_lifetime_l1_cmd,
2595 "max-lsp-lifetime level-1 <350-65535>",
2596 "Maximum LSP lifetime for Level 1 only\n"
2597 "LSP lifetime for Level 1 only in seconds\n")
2598{
2599 struct isis_area *area;
2600 uint16_t interval;
2601 int level;
2602
2603 area = vty->index;
2604 interval = atoi (argv[0]);
2605 level = IS_LEVEL_1;
2606 return set_lsp_max_lifetime (vty, area, interval, level);
2607}
2608
2609DEFUN (no_max_lsp_lifetime_l1,
2610 no_max_lsp_lifetime_l1_cmd,
2611 "no max-lsp-lifetime level-1",
2612 NO_STR
2613 "LSP lifetime for Level 1 only in seconds\n")
2614{
2615 struct isis_area *area;
2616 uint16_t interval;
2617 int level;
2618
2619 area = vty->index;
2620 interval = DEFAULT_LSP_LIFETIME;
2621 level = IS_LEVEL_1;
2622 return set_lsp_max_lifetime (vty, area, interval, level);
2623}
2624
2625ALIAS (no_max_lsp_lifetime_l1,
2626 no_max_lsp_lifetime_l1_arg_cmd,
2627 "no max-lsp-lifetime level-1 <350-65535>",
2628 NO_STR
2629 "Maximum LSP lifetime for Level 1 only\n"
2630 "LSP lifetime for Level 1 only in seconds\n")
2631
2632DEFUN (max_lsp_lifetime_l2,
2633 max_lsp_lifetime_l2_cmd,
2634 "max-lsp-lifetime level-2 <350-65535>",
2635 "Maximum LSP lifetime for Level 2 only\n"
2636 "LSP lifetime for Level 2 only in seconds\n")
2637{
2638 struct isis_area *area;
2639 uint16_t interval;
2640 int level;
2641
2642 area = vty->index;
2643 interval = atoi (argv[0]);
2644 level = IS_LEVEL_2;
2645 return set_lsp_max_lifetime (vty, area, interval, level);
2646}
2647
2648DEFUN (no_max_lsp_lifetime_l2,
2649 no_max_lsp_lifetime_l2_cmd,
2650 "no max-lsp-lifetime level-2",
2651 NO_STR
2652 "LSP lifetime for Level 2 only in seconds\n")
2653{
2654 struct isis_area *area;
2655 uint16_t interval;
2656 int level;
2657
2658 area = vty->index;
2659 interval = DEFAULT_LSP_LIFETIME;
2660 level = IS_LEVEL_2;
2661 return set_lsp_max_lifetime (vty, area, interval, level);
2662}
2663
2664ALIAS (no_max_lsp_lifetime_l2,
2665 no_max_lsp_lifetime_l2_arg_cmd,
2666 "no max-lsp-lifetime level-2 <350-65535>",
2667 NO_STR
2668 "Maximum LSP lifetime for Level 2 only\n"
2669 "LSP lifetime for Level 2 only in seconds\n")
2670
2671static int
2672set_lsp_refresh_interval (struct vty *vty, struct isis_area *area,
2673 uint16_t interval, int level)
2674{
2675 int lvl;
2676
2677 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2678 {
2679 if (!(lvl & level))
2680 continue;
2681 if (interval <= area->lsp_gen_interval[lvl-1])
2682 {
2683 vty_out (vty, "LSP refresh interval %us must be greater than "
2684 "the configured LSP gen interval %us%s",
2685 interval, area->lsp_gen_interval[lvl-1],
2686 VTY_NEWLINE);
2687 return CMD_ERR_AMBIGUOUS;
2688 }
2689 if (interval > (area->max_lsp_lifetime[lvl-1] - 300))
2690 {
2691 vty_out (vty, "LSP refresh interval %us must be less than "
2692 "the configured LSP lifetime %us less 300%s",
2693 interval, area->max_lsp_lifetime[lvl-1],
2694 VTY_NEWLINE);
2695 return CMD_ERR_AMBIGUOUS;
2696 }
2697 }
2698
2699 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2700 {
2701 if (!(lvl & level))
2702 continue;
2703 area->lsp_refresh[lvl-1] = interval;
2704 }
2705 lsp_regenerate_schedule (area, level, 1);
2706
2707 return CMD_SUCCESS;
2708}
2709
2710DEFUN (lsp_refresh_interval,
2711 lsp_refresh_interval_cmd,
2712 "lsp-refresh-interval <1-65235>",
2713 "LSP refresh interval\n"
2714 "LSP refresh interval in seconds\n")
2715{
2716 struct isis_area *area;
2717 uint16_t interval;
2718 int level;
2719
2720 area = vty->index;
2721 interval = atoi (argv[0]);
2722 level = IS_LEVEL_1 | IS_LEVEL_2;
2723 return set_lsp_refresh_interval (vty, area, interval, level);
2724}
2725
2726DEFUN (no_lsp_refresh_interval,
2727 no_lsp_refresh_interval_cmd,
2728 "no lsp-refresh-interval",
2729 NO_STR
2730 "LSP refresh interval in seconds\n")
2731{
2732 struct isis_area *area;
2733 uint16_t interval;
2734 int level;
2735
2736 area = vty->index;
2737 interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
2738 level = IS_LEVEL_1 | IS_LEVEL_2;
2739 return set_lsp_refresh_interval (vty, area, interval, level);
2740}
2741
2742ALIAS (no_lsp_refresh_interval,
2743 no_lsp_refresh_interval_arg_cmd,
2744 "no lsp-refresh-interval <1-65235>",
2745 NO_STR
2746 "LSP refresh interval\n"
2747 "LSP refresh interval in seconds\n")
2748
2749DEFUN (lsp_refresh_interval_l1,
2750 lsp_refresh_interval_l1_cmd,
2751 "lsp-refresh-interval level-1 <1-65235>",
2752 "LSP refresh interval for Level 1 only\n"
2753 "LSP refresh interval for Level 1 only in seconds\n")
2754{
2755 struct isis_area *area;
2756 uint16_t interval;
2757 int level;
2758
2759 area = vty->index;
2760 interval = atoi (argv[0]);
2761 level = IS_LEVEL_1;
2762 return set_lsp_refresh_interval (vty, area, interval, level);
2763}
2764
2765DEFUN (no_lsp_refresh_interval_l1,
2766 no_lsp_refresh_interval_l1_cmd,
2767 "no lsp-refresh-interval level-1",
2768 NO_STR
2769 "LSP refresh interval for Level 1 only in seconds\n")
2770{
2771 struct isis_area *area;
2772 uint16_t interval;
2773 int level;
2774
2775 area = vty->index;
2776 interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
2777 level = IS_LEVEL_1;
2778 return set_lsp_refresh_interval (vty, area, interval, level);
2779}
2780
2781ALIAS (no_lsp_refresh_interval_l1,
2782 no_lsp_refresh_interval_l1_arg_cmd,
2783 "no lsp-refresh-interval level-1 <1-65235>",
2784 NO_STR
2785 "LSP refresh interval for Level 1 only\n"
2786 "LSP refresh interval for Level 1 only in seconds\n")
2787
2788DEFUN (lsp_refresh_interval_l2,
2789 lsp_refresh_interval_l2_cmd,
2790 "lsp-refresh-interval level-2 <1-65235>",
2791 "LSP refresh interval for Level 2 only\n"
2792 "LSP refresh interval for Level 2 only in seconds\n")
2793{
2794 struct isis_area *area;
2795 uint16_t interval;
2796 int level;
2797
2798 area = vty->index;
2799 interval = atoi (argv[0]);
2800 level = IS_LEVEL_2;
2801 return set_lsp_refresh_interval (vty, area, interval, level);
2802}
2803
2804DEFUN (no_lsp_refresh_interval_l2,
2805 no_lsp_refresh_interval_l2_cmd,
2806 "no lsp-refresh-interval level-2",
2807 NO_STR
2808 "LSP refresh interval for Level 2 only in seconds\n")
2809{
2810 struct isis_area *area;
2811 uint16_t interval;
2812 int level;
2813
2814 area = vty->index;
2815 interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
2816 level = IS_LEVEL_2;
2817 return set_lsp_refresh_interval (vty, area, interval, level);
2818}
2819
2820ALIAS (no_lsp_refresh_interval_l2,
2821 no_lsp_refresh_interval_l2_arg_cmd,
2822 "no lsp-refresh-interval level-2 <1-65235>",
2823 NO_STR
2824 "LSP refresh interval for Level 2 only\n"
2825 "LSP refresh interval for Level 2 only in seconds\n")
2826
2827DEFUN (log_adj_changes,
2828 log_adj_changes_cmd,
2829 "log-adjacency-changes",
2830 "Log changes in adjacency state\n")
2831{
2832 struct isis_area *area;
2833
2834 area = vty->index;
2835 assert (area);
2836
2837 area->log_adj_changes = 1;
2838
2839 return CMD_SUCCESS;
2840}
2841
2842DEFUN (no_log_adj_changes,
2843 no_log_adj_changes_cmd,
2844 "no log-adjacency-changes",
2845 "Stop logging changes in adjacency state\n")
2846{
2847 struct isis_area *area;
2848
2849 area = vty->index;
2850 assert (area);
2851
2852 area->log_adj_changes = 0;
2853
2854 return CMD_SUCCESS;
2855}
2856
jardineb5d44e2003-12-23 08:09:43 +00002857#ifdef TOPOLOGY_GENERATE
Josh Bailey3f045a02012-03-24 08:35:20 -07002858
jardineb5d44e2003-12-23 08:09:43 +00002859DEFUN (topology_generate_grid,
2860 topology_generate_grid_cmd,
2861 "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "
2862 "[param]",
hassof1082d12005-09-19 04:23:34 +00002863 "Topology generation for IS-IS\n"
2864 "Topology generation\n"
2865 "Grid topology\n"
jardineb5d44e2003-12-23 08:09:43 +00002866 "X parameter of the grid\n"
2867 "Y parameter of the grid\n"
2868 "Random seed\n"
2869 "Optional param 1\n"
2870 "Optional param 2\n"
2871 "Optional param 3\n"
2872 "Topology\n")
2873{
2874 struct isis_area *area;
2875
2876 area = vty->index;
2877 assert (area);
2878
hassof390d2c2004-09-10 20:48:21 +00002879 if (!spgrid_check_params (vty, argc, argv))
2880 {
2881 if (area->topology)
2882 list_delete (area->topology);
2883 area->topology = list_new ();
2884 memcpy (area->top_params, vty->buf, 200);
2885 gen_spgrid_topology (vty, area->topology);
2886 remove_topology_lsps (area);
2887 generate_topology_lsps (area);
hassof1082d12005-09-19 04:23:34 +00002888 /* Regenerate L1 LSP to get two way connection to the generated
2889 * topology. */
Josh Bailey3f045a02012-03-24 08:35:20 -07002890 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
hassof390d2c2004-09-10 20:48:21 +00002891 }
jardineb5d44e2003-12-23 08:09:43 +00002892
2893 return CMD_SUCCESS;
2894}
2895
hassof695b012005-04-02 19:03:39 +00002896DEFUN (show_isis_generated_topology,
2897 show_isis_generated_topology_cmd,
hassof1082d12005-09-19 04:23:34 +00002898 "show isis generated-topologies",
jardineb5d44e2003-12-23 08:09:43 +00002899 SHOW_STR
Josh Bailey3f045a02012-03-24 08:35:20 -07002900 "ISIS network information\n"
hassof1082d12005-09-19 04:23:34 +00002901 "Show generated topologies\n")
jardineb5d44e2003-12-23 08:09:43 +00002902{
2903 struct isis_area *area;
paul92c9f222005-05-25 12:21:13 +00002904 struct listnode *node;
jardineb5d44e2003-12-23 08:09:43 +00002905 struct listnode *node2;
2906 struct arc *arc;
hassof1082d12005-09-19 04:23:34 +00002907
paul92c9f222005-05-25 12:21:13 +00002908 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof1082d12005-09-19 04:23:34 +00002909 {
2910 if (!area->topology)
2911 continue;
2912
2913 vty_out (vty, "Topology for isis area: %s%s", area->area_tag,
2914 VTY_NEWLINE);
2915 vty_out (vty, "From node To node Distance%s", VTY_NEWLINE);
2916
2917 for (ALL_LIST_ELEMENTS_RO (area->topology, node2, arc))
2918 vty_out (vty, "%9ld %11ld %12ld%s", arc->from_node, arc->to_node,
2919 arc->distance, VTY_NEWLINE);
2920 }
jardineb5d44e2003-12-23 08:09:43 +00002921 return CMD_SUCCESS;
2922}
2923
hassof1082d12005-09-19 04:23:34 +00002924/* Base IS for topology generation. */
hassof390d2c2004-09-10 20:48:21 +00002925DEFUN (topology_baseis,
jardineb5d44e2003-12-23 08:09:43 +00002926 topology_baseis_cmd,
2927 "topology base-is WORD",
hassof1082d12005-09-19 04:23:34 +00002928 "Topology generation for IS-IS\n"
2929 "A Network IS Base for this topology\n"
2930 "XXXX.XXXX.XXXX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00002931{
2932 struct isis_area *area;
2933 u_char buff[ISIS_SYS_ID_LEN];
2934
2935 area = vty->index;
2936 assert (area);
2937
hassof390d2c2004-09-10 20:48:21 +00002938 if (sysid2buff (buff, argv[0]))
hassof1082d12005-09-19 04:23:34 +00002939 sysid2buff (area->topology_baseis, argv[0]);
hassof390d2c2004-09-10 20:48:21 +00002940
jardineb5d44e2003-12-23 08:09:43 +00002941 return CMD_SUCCESS;
2942}
2943
jardineb5d44e2003-12-23 08:09:43 +00002944DEFUN (no_topology_baseis,
2945 no_topology_baseis_cmd,
2946 "no topology base-is WORD",
2947 NO_STR
hassof1082d12005-09-19 04:23:34 +00002948 "Topology generation for IS-IS\n"
2949 "A Network IS Base for this topology\n"
2950 "XXXX.XXXX.XXXX Network entity title (NET)\n")
jardineb5d44e2003-12-23 08:09:43 +00002951{
2952 struct isis_area *area;
2953
2954 area = vty->index;
2955 assert (area);
2956
hassof390d2c2004-09-10 20:48:21 +00002957 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
jardineb5d44e2003-12-23 08:09:43 +00002958 return CMD_SUCCESS;
2959}
2960
hassof1082d12005-09-19 04:23:34 +00002961ALIAS (no_topology_baseis,
2962 no_topology_baseis_noid_cmd,
2963 "no topology base-is",
2964 NO_STR
2965 "Topology generation for IS-IS\n"
2966 "A Network IS Base for this topology\n")
2967
2968DEFUN (topology_basedynh,
2969 topology_basedynh_cmd,
2970 "topology base-dynh WORD",
2971 "Topology generation for IS-IS\n"
2972 "Dynamic hostname base for this topology\n"
2973 "Dynamic hostname base\n")
2974{
2975 struct isis_area *area;
2976
2977 area = vty->index;
2978 assert (area);
2979
2980 /* I hope that it's enough. */
2981 area->topology_basedynh = strndup (argv[0], 16);
2982 return CMD_SUCCESS;
2983}
Josh Bailey3f045a02012-03-24 08:35:20 -07002984
jardineb5d44e2003-12-23 08:09:43 +00002985#endif /* TOPOLOGY_GENERATE */
2986
jardineb5d44e2003-12-23 08:09:43 +00002987/* IS-IS configuration write function */
2988int
2989isis_config_write (struct vty *vty)
2990{
2991 int write = 0;
jardineb5d44e2003-12-23 08:09:43 +00002992
hassof390d2c2004-09-10 20:48:21 +00002993 if (isis != NULL)
2994 {
2995 struct isis_area *area;
hasso3fdb2dd2005-09-28 18:45:54 +00002996 struct listnode *node, *node2;
jardineb5d44e2003-12-23 08:09:43 +00002997
hasso3fdb2dd2005-09-28 18:45:54 +00002998 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
hassof390d2c2004-09-10 20:48:21 +00002999 {
3000 /* ISIS - Area name */
3001 vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE);
3002 write++;
3003 /* ISIS - Net */
3004 if (listcount (area->area_addrs) > 0)
3005 {
3006 struct area_addr *area_addr;
hasso3fdb2dd2005-09-28 18:45:54 +00003007 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
3008 {
3009 vty_out (vty, " net %s%s",
3010 isonet_print (area_addr->area_addr,
3011 area_addr->addr_len + ISIS_SYS_ID_LEN +
3012 1), VTY_NEWLINE);
3013 write++;
3014 }
hassof390d2c2004-09-10 20:48:21 +00003015 }
hasso3fdb2dd2005-09-28 18:45:54 +00003016 /* ISIS - Dynamic hostname - Defaults to true so only display if
3017 * false. */
hassof390d2c2004-09-10 20:48:21 +00003018 if (!area->dynhostname)
3019 {
3020 vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);
3021 write++;
3022 }
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07003023 /* ISIS - Metric-Style - when true displays wide */
3024 if (area->newmetric)
hassof390d2c2004-09-10 20:48:21 +00003025 {
Subbaiah Venkatae38e0df2012-03-27 23:48:05 -07003026 if (!area->oldmetric)
3027 vty_out (vty, " metric-style wide%s", VTY_NEWLINE);
hasso2984d262005-09-26 16:49:07 +00003028 else
3029 vty_out (vty, " metric-style transition%s", VTY_NEWLINE);
hassof390d2c2004-09-10 20:48:21 +00003030 write++;
3031 }
Christian Frankef818c8f2012-11-27 01:10:28 +00003032 else
3033 {
3034 vty_out (vty, " metric-style narrow%s", VTY_NEWLINE);
3035 write++;
3036 }
Josh Bailey3f045a02012-03-24 08:35:20 -07003037 /* ISIS - overload-bit */
3038 if (area->overload_bit)
3039 {
3040 vty_out (vty, " set-overload-bit%s", VTY_NEWLINE);
3041 write++;
3042 }
hassof390d2c2004-09-10 20:48:21 +00003043 /* ISIS - Area is-type (level-1-2 is default) */
3044 if (area->is_type == IS_LEVEL_1)
3045 {
3046 vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
3047 write++;
3048 }
Josh Bailey3f045a02012-03-24 08:35:20 -07003049 else if (area->is_type == IS_LEVEL_2)
hassof390d2c2004-09-10 20:48:21 +00003050 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003051 vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
3052 write++;
hassof390d2c2004-09-10 20:48:21 +00003053 }
Christian Frankeacf98652015-11-12 14:24:22 +01003054 write += isis_redist_config_write(vty, area, AF_INET);
3055 write += isis_redist_config_write(vty, area, AF_INET6);
hassof390d2c2004-09-10 20:48:21 +00003056 /* ISIS - Lsp generation interval */
3057 if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1])
3058 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003059 if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00003060 {
3061 vty_out (vty, " lsp-gen-interval %d%s",
3062 area->lsp_gen_interval[0], VTY_NEWLINE);
3063 write++;
3064 }
3065 }
3066 else
3067 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003068 if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00003069 {
3070 vty_out (vty, " lsp-gen-interval level-1 %d%s",
3071 area->lsp_gen_interval[0], VTY_NEWLINE);
3072 write++;
3073 }
Josh Bailey3f045a02012-03-24 08:35:20 -07003074 if (area->lsp_gen_interval[1] != DEFAULT_MIN_LSP_GEN_INTERVAL)
hassof390d2c2004-09-10 20:48:21 +00003075 {
3076 vty_out (vty, " lsp-gen-interval level-2 %d%s",
3077 area->lsp_gen_interval[1], VTY_NEWLINE);
3078 write++;
3079 }
3080 }
3081 /* ISIS - LSP lifetime */
3082 if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1])
3083 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003084 if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
hassof390d2c2004-09-10 20:48:21 +00003085 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003086 vty_out (vty, " max-lsp-lifetime %u%s", area->max_lsp_lifetime[0],
hassof390d2c2004-09-10 20:48:21 +00003087 VTY_NEWLINE);
3088 write++;
3089 }
3090 }
3091 else
3092 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003093 if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
hassof390d2c2004-09-10 20:48:21 +00003094 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003095 vty_out (vty, " max-lsp-lifetime level-1 %u%s",
hassof390d2c2004-09-10 20:48:21 +00003096 area->max_lsp_lifetime[0], VTY_NEWLINE);
3097 write++;
3098 }
Josh Bailey3f045a02012-03-24 08:35:20 -07003099 if (area->max_lsp_lifetime[1] != DEFAULT_LSP_LIFETIME)
hassof390d2c2004-09-10 20:48:21 +00003100 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003101 vty_out (vty, " max-lsp-lifetime level-2 %u%s",
hassof390d2c2004-09-10 20:48:21 +00003102 area->max_lsp_lifetime[1], VTY_NEWLINE);
3103 write++;
3104 }
3105 }
Josh Bailey3f045a02012-03-24 08:35:20 -07003106 /* ISIS - LSP refresh interval */
3107 if (area->lsp_refresh[0] == area->lsp_refresh[1])
3108 {
3109 if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
3110 {
3111 vty_out (vty, " lsp-refresh-interval %u%s", area->lsp_refresh[0],
3112 VTY_NEWLINE);
3113 write++;
3114 }
3115 }
3116 else
3117 {
3118 if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
3119 {
3120 vty_out (vty, " lsp-refresh-interval level-1 %u%s",
3121 area->lsp_refresh[0], VTY_NEWLINE);
3122 write++;
3123 }
3124 if (area->lsp_refresh[1] != DEFAULT_MAX_LSP_GEN_INTERVAL)
3125 {
3126 vty_out (vty, " lsp-refresh-interval level-2 %u%s",
3127 area->lsp_refresh[1], VTY_NEWLINE);
3128 write++;
3129 }
3130 }
Christian Frankef1fc1db2015-11-10 18:43:31 +01003131 if (area->lsp_mtu != DEFAULT_LSP_MTU)
3132 {
3133 vty_out(vty, " lsp-mtu %u%s", area->lsp_mtu, VTY_NEWLINE);
3134 write++;
3135 }
3136
hasso13fb40a2005-10-01 06:03:04 +00003137 /* Minimum SPF interval. */
3138 if (area->min_spf_interval[0] == area->min_spf_interval[1])
3139 {
3140 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
3141 {
3142 vty_out (vty, " spf-interval %d%s",
3143 area->min_spf_interval[0], VTY_NEWLINE);
3144 write++;
3145 }
3146 }
3147 else
3148 {
3149 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
3150 {
3151 vty_out (vty, " spf-interval level-1 %d%s",
3152 area->min_spf_interval[0], VTY_NEWLINE);
3153 write++;
3154 }
3155 if (area->min_spf_interval[1] != MINIMUM_SPF_INTERVAL)
3156 {
3157 vty_out (vty, " spf-interval level-2 %d%s",
3158 area->min_spf_interval[1], VTY_NEWLINE);
3159 write++;
3160 }
3161 }
hasso53c997c2004-09-15 16:21:59 +00003162 /* Authentication passwords. */
Josh Bailey3f045a02012-03-24 08:35:20 -07003163 if (area->area_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
hasso53c997c2004-09-15 16:21:59 +00003164 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003165 vty_out(vty, " area-password md5 %s", area->area_passwd.passwd);
hasso1cbc5622005-01-01 10:29:51 +00003166 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
3167 {
3168 vty_out(vty, " authenticate snp ");
3169 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
3170 vty_out(vty, "validate");
3171 else
3172 vty_out(vty, "send-only");
3173 }
3174 vty_out(vty, "%s", VTY_NEWLINE);
hasso53c997c2004-09-15 16:21:59 +00003175 write++;
Josh Bailey3f045a02012-03-24 08:35:20 -07003176 }
3177 else if (area->area_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
3178 {
3179 vty_out(vty, " area-password clear %s", area->area_passwd.passwd);
3180 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
3181 {
3182 vty_out(vty, " authenticate snp ");
3183 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
3184 vty_out(vty, "validate");
3185 else
3186 vty_out(vty, "send-only");
3187 }
3188 vty_out(vty, "%s", VTY_NEWLINE);
3189 write++;
3190 }
3191 if (area->domain_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
hasso53c997c2004-09-15 16:21:59 +00003192 {
Josh Bailey3f045a02012-03-24 08:35:20 -07003193 vty_out(vty, " domain-password md5 %s",
3194 area->domain_passwd.passwd);
3195 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
3196 {
3197 vty_out(vty, " authenticate snp ");
3198 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
3199 vty_out(vty, "validate");
3200 else
3201 vty_out(vty, "send-only");
3202 }
3203 vty_out(vty, "%s", VTY_NEWLINE);
3204 write++;
3205 }
3206 else if (area->domain_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
3207 {
3208 vty_out(vty, " domain-password clear %s",
3209 area->domain_passwd.passwd);
hasso1cbc5622005-01-01 10:29:51 +00003210 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
3211 {
3212 vty_out(vty, " authenticate snp ");
3213 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
3214 vty_out(vty, "validate");
3215 else
3216 vty_out(vty, "send-only");
3217 }
3218 vty_out(vty, "%s", VTY_NEWLINE);
hasso53c997c2004-09-15 16:21:59 +00003219 write++;
3220 }
hassof1082d12005-09-19 04:23:34 +00003221
Josh Bailey3f045a02012-03-24 08:35:20 -07003222 if (area->log_adj_changes)
3223 {
3224 vty_out (vty, " log-adjacency-changes%s", VTY_NEWLINE);
3225 write++;
3226 }
3227
hassof390d2c2004-09-10 20:48:21 +00003228#ifdef TOPOLOGY_GENERATE
hassof1082d12005-09-19 04:23:34 +00003229 if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,
3230 ISIS_SYS_ID_LEN))
3231 {
3232 vty_out (vty, " topology base-is %s%s",
Josh Bailey3f045a02012-03-24 08:35:20 -07003233 sysid_print ((u_char *)area->topology_baseis), VTY_NEWLINE);
hassof1082d12005-09-19 04:23:34 +00003234 write++;
3235 }
3236 if (area->topology_basedynh)
3237 {
3238 vty_out (vty, " topology base-dynh %s%s",
3239 area->topology_basedynh, VTY_NEWLINE);
3240 write++;
3241 }
3242 /* We save the whole command line here. */
3243 if (strlen(area->top_params))
hassof390d2c2004-09-10 20:48:21 +00003244 {
3245 vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE);
3246 write++;
3247 }
hassof390d2c2004-09-10 20:48:21 +00003248#endif /* TOPOLOGY_GENERATE */
hassof1082d12005-09-19 04:23:34 +00003249
hassof390d2c2004-09-10 20:48:21 +00003250 }
jardineb5d44e2003-12-23 08:09:43 +00003251 }
hassof390d2c2004-09-10 20:48:21 +00003252
jardineb5d44e2003-12-23 08:09:43 +00003253 return write;
3254}
3255
Josh Bailey3f045a02012-03-24 08:35:20 -07003256struct cmd_node isis_node = {
jardineb5d44e2003-12-23 08:09:43 +00003257 ISIS_NODE,
hasso2097cd82003-12-23 11:51:08 +00003258 "%s(config-router)# ",
jardineb5d44e2003-12-23 08:09:43 +00003259 1
3260};
3261
hassof390d2c2004-09-10 20:48:21 +00003262void
jardineb5d44e2003-12-23 08:09:43 +00003263isis_init ()
3264{
jardineb5d44e2003-12-23 08:09:43 +00003265 /* Install IS-IS top node */
3266 install_node (&isis_node, isis_config_write);
hassof390d2c2004-09-10 20:48:21 +00003267
Josh Bailey3f045a02012-03-24 08:35:20 -07003268 install_element (VIEW_NODE, &show_isis_summary_cmd);
3269
3270 install_element (VIEW_NODE, &show_isis_interface_cmd);
3271 install_element (VIEW_NODE, &show_isis_interface_detail_cmd);
3272 install_element (VIEW_NODE, &show_isis_interface_arg_cmd);
3273
3274 install_element (VIEW_NODE, &show_isis_neighbor_cmd);
3275 install_element (VIEW_NODE, &show_isis_neighbor_detail_cmd);
3276 install_element (VIEW_NODE, &show_isis_neighbor_arg_cmd);
3277 install_element (VIEW_NODE, &clear_isis_neighbor_cmd);
3278 install_element (VIEW_NODE, &clear_isis_neighbor_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003279
3280 install_element (VIEW_NODE, &show_hostname_cmd);
3281 install_element (VIEW_NODE, &show_database_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003282 install_element (VIEW_NODE, &show_database_arg_cmd);
3283 install_element (VIEW_NODE, &show_database_arg_detail_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003284 install_element (VIEW_NODE, &show_database_detail_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003285 install_element (VIEW_NODE, &show_database_detail_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003286
Josh Bailey3f045a02012-03-24 08:35:20 -07003287 install_element (ENABLE_NODE, &show_isis_summary_cmd);
3288
3289 install_element (ENABLE_NODE, &show_isis_interface_cmd);
3290 install_element (ENABLE_NODE, &show_isis_interface_detail_cmd);
3291 install_element (ENABLE_NODE, &show_isis_interface_arg_cmd);
3292
3293 install_element (ENABLE_NODE, &show_isis_neighbor_cmd);
3294 install_element (ENABLE_NODE, &show_isis_neighbor_detail_cmd);
3295 install_element (ENABLE_NODE, &show_isis_neighbor_arg_cmd);
3296 install_element (ENABLE_NODE, &clear_isis_neighbor_cmd);
3297 install_element (ENABLE_NODE, &clear_isis_neighbor_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003298
3299 install_element (ENABLE_NODE, &show_hostname_cmd);
3300 install_element (ENABLE_NODE, &show_database_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003301 install_element (ENABLE_NODE, &show_database_arg_cmd);
3302 install_element (ENABLE_NODE, &show_database_arg_detail_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003303 install_element (ENABLE_NODE, &show_database_detail_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003304 install_element (ENABLE_NODE, &show_database_detail_arg_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003305 install_element (ENABLE_NODE, &show_debugging_cmd);
3306
hassof390d2c2004-09-10 20:48:21 +00003307 install_node (&debug_node, config_write_debug);
jardin9e867fe2003-12-23 08:56:18 +00003308
jardineb5d44e2003-12-23 08:09:43 +00003309 install_element (ENABLE_NODE, &debug_isis_adj_cmd);
3310 install_element (ENABLE_NODE, &no_debug_isis_adj_cmd);
3311 install_element (ENABLE_NODE, &debug_isis_csum_cmd);
3312 install_element (ENABLE_NODE, &no_debug_isis_csum_cmd);
3313 install_element (ENABLE_NODE, &debug_isis_lupd_cmd);
3314 install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd);
3315 install_element (ENABLE_NODE, &debug_isis_err_cmd);
3316 install_element (ENABLE_NODE, &no_debug_isis_err_cmd);
3317 install_element (ENABLE_NODE, &debug_isis_snp_cmd);
3318 install_element (ENABLE_NODE, &no_debug_isis_snp_cmd);
3319 install_element (ENABLE_NODE, &debug_isis_upd_cmd);
3320 install_element (ENABLE_NODE, &no_debug_isis_upd_cmd);
3321 install_element (ENABLE_NODE, &debug_isis_spfevents_cmd);
3322 install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd);
3323 install_element (ENABLE_NODE, &debug_isis_spfstats_cmd);
3324 install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd);
3325 install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd);
3326 install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd);
3327 install_element (ENABLE_NODE, &debug_isis_rtevents_cmd);
3328 install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);
3329 install_element (ENABLE_NODE, &debug_isis_events_cmd);
3330 install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003331 install_element (ENABLE_NODE, &debug_isis_packet_dump_cmd);
3332 install_element (ENABLE_NODE, &no_debug_isis_packet_dump_cmd);
Christian Franke80a8f722015-11-12 14:21:47 +01003333 install_element (ENABLE_NODE, &debug_isis_lsp_gen_cmd);
3334 install_element (ENABLE_NODE, &no_debug_isis_lsp_gen_cmd);
Christian Franke61010c32015-11-10 18:43:34 +01003335 install_element (ENABLE_NODE, &debug_isis_lsp_sched_cmd);
3336 install_element (ENABLE_NODE, &no_debug_isis_lsp_sched_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003337
jardin9e867fe2003-12-23 08:56:18 +00003338 install_element (CONFIG_NODE, &debug_isis_adj_cmd);
3339 install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);
3340 install_element (CONFIG_NODE, &debug_isis_csum_cmd);
3341 install_element (CONFIG_NODE, &no_debug_isis_csum_cmd);
3342 install_element (CONFIG_NODE, &debug_isis_lupd_cmd);
3343 install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd);
3344 install_element (CONFIG_NODE, &debug_isis_err_cmd);
3345 install_element (CONFIG_NODE, &no_debug_isis_err_cmd);
3346 install_element (CONFIG_NODE, &debug_isis_snp_cmd);
3347 install_element (CONFIG_NODE, &no_debug_isis_snp_cmd);
3348 install_element (CONFIG_NODE, &debug_isis_upd_cmd);
3349 install_element (CONFIG_NODE, &no_debug_isis_upd_cmd);
3350 install_element (CONFIG_NODE, &debug_isis_spfevents_cmd);
3351 install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd);
3352 install_element (CONFIG_NODE, &debug_isis_spfstats_cmd);
3353 install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd);
3354 install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd);
3355 install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd);
3356 install_element (CONFIG_NODE, &debug_isis_rtevents_cmd);
3357 install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);
3358 install_element (CONFIG_NODE, &debug_isis_events_cmd);
3359 install_element (CONFIG_NODE, &no_debug_isis_events_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003360 install_element (CONFIG_NODE, &debug_isis_packet_dump_cmd);
3361 install_element (CONFIG_NODE, &no_debug_isis_packet_dump_cmd);
Christian Franke80a8f722015-11-12 14:21:47 +01003362 install_element (CONFIG_NODE, &debug_isis_lsp_gen_cmd);
3363 install_element (CONFIG_NODE, &no_debug_isis_lsp_gen_cmd);
Christian Franke61010c32015-11-10 18:43:34 +01003364 install_element (CONFIG_NODE, &debug_isis_lsp_sched_cmd);
3365 install_element (CONFIG_NODE, &no_debug_isis_lsp_sched_cmd);
jardin9e867fe2003-12-23 08:56:18 +00003366
jardineb5d44e2003-12-23 08:09:43 +00003367 install_element (CONFIG_NODE, &router_isis_cmd);
3368 install_element (CONFIG_NODE, &no_router_isis_cmd);
3369
3370 install_default (ISIS_NODE);
3371
3372 install_element (ISIS_NODE, &net_cmd);
3373 install_element (ISIS_NODE, &no_net_cmd);
3374
3375 install_element (ISIS_NODE, &is_type_cmd);
3376 install_element (ISIS_NODE, &no_is_type_cmd);
3377
Christian Frankef1fc1db2015-11-10 18:43:31 +01003378 install_element (ISIS_NODE, &area_lsp_mtu_cmd);
3379 install_element (ISIS_NODE, &no_area_lsp_mtu_cmd);
3380 install_element (ISIS_NODE, &no_area_lsp_mtu_arg_cmd);
3381
Josh Bailey3f045a02012-03-24 08:35:20 -07003382 install_element (ISIS_NODE, &area_passwd_md5_cmd);
3383 install_element (ISIS_NODE, &area_passwd_md5_snpauth_cmd);
3384 install_element (ISIS_NODE, &area_passwd_clear_cmd);
3385 install_element (ISIS_NODE, &area_passwd_clear_snpauth_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003386 install_element (ISIS_NODE, &no_area_passwd_cmd);
3387
Josh Bailey3f045a02012-03-24 08:35:20 -07003388 install_element (ISIS_NODE, &domain_passwd_md5_cmd);
3389 install_element (ISIS_NODE, &domain_passwd_md5_snpauth_cmd);
3390 install_element (ISIS_NODE, &domain_passwd_clear_cmd);
3391 install_element (ISIS_NODE, &domain_passwd_clear_snpauth_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003392 install_element (ISIS_NODE, &no_domain_passwd_cmd);
3393
3394 install_element (ISIS_NODE, &lsp_gen_interval_cmd);
3395 install_element (ISIS_NODE, &no_lsp_gen_interval_cmd);
3396 install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd);
3397 install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd);
3398 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd);
3399 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd);
3400 install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd);
3401 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd);
3402 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd);
3403
3404 install_element (ISIS_NODE, &spf_interval_cmd);
3405 install_element (ISIS_NODE, &no_spf_interval_cmd);
3406 install_element (ISIS_NODE, &no_spf_interval_arg_cmd);
3407 install_element (ISIS_NODE, &spf_interval_l1_cmd);
3408 install_element (ISIS_NODE, &no_spf_interval_l1_cmd);
3409 install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd);
3410 install_element (ISIS_NODE, &spf_interval_l2_cmd);
3411 install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
3412 install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
hassof390d2c2004-09-10 20:48:21 +00003413
Josh Bailey3f045a02012-03-24 08:35:20 -07003414 install_element (ISIS_NODE, &max_lsp_lifetime_cmd);
3415 install_element (ISIS_NODE, &no_max_lsp_lifetime_cmd);
3416 install_element (ISIS_NODE, &no_max_lsp_lifetime_arg_cmd);
3417 install_element (ISIS_NODE, &max_lsp_lifetime_l1_cmd);
3418 install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_cmd);
3419 install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_arg_cmd);
3420 install_element (ISIS_NODE, &max_lsp_lifetime_l2_cmd);
3421 install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_cmd);
3422 install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_arg_cmd);
3423
3424 install_element (ISIS_NODE, &lsp_refresh_interval_cmd);
3425 install_element (ISIS_NODE, &no_lsp_refresh_interval_cmd);
3426 install_element (ISIS_NODE, &no_lsp_refresh_interval_arg_cmd);
3427 install_element (ISIS_NODE, &lsp_refresh_interval_l1_cmd);
3428 install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_cmd);
3429 install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_arg_cmd);
3430 install_element (ISIS_NODE, &lsp_refresh_interval_l2_cmd);
3431 install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_cmd);
3432 install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_arg_cmd);
3433
3434 install_element (ISIS_NODE, &set_overload_bit_cmd);
3435 install_element (ISIS_NODE, &no_set_overload_bit_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003436
Amritha Nambiarc8ee9402015-08-24 16:40:14 -07003437 install_element (ISIS_NODE, &set_attached_bit_cmd);
3438 install_element (ISIS_NODE, &no_set_attached_bit_cmd);
3439
jardineb5d44e2003-12-23 08:09:43 +00003440 install_element (ISIS_NODE, &dynamic_hostname_cmd);
3441 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
3442
3443 install_element (ISIS_NODE, &metric_style_cmd);
3444 install_element (ISIS_NODE, &no_metric_style_cmd);
Josh Bailey3f045a02012-03-24 08:35:20 -07003445
3446 install_element (ISIS_NODE, &log_adj_changes_cmd);
3447 install_element (ISIS_NODE, &no_log_adj_changes_cmd);
3448
jardineb5d44e2003-12-23 08:09:43 +00003449#ifdef TOPOLOGY_GENERATE
3450 install_element (ISIS_NODE, &topology_generate_grid_cmd);
3451 install_element (ISIS_NODE, &topology_baseis_cmd);
hassof1082d12005-09-19 04:23:34 +00003452 install_element (ISIS_NODE, &topology_basedynh_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003453 install_element (ISIS_NODE, &no_topology_baseis_cmd);
hassof1082d12005-09-19 04:23:34 +00003454 install_element (ISIS_NODE, &no_topology_baseis_noid_cmd);
hassof695b012005-04-02 19:03:39 +00003455 install_element (VIEW_NODE, &show_isis_generated_topology_cmd);
3456 install_element (ENABLE_NODE, &show_isis_generated_topology_cmd);
jardineb5d44e2003-12-23 08:09:43 +00003457#endif /* TOPOLOGY_GENERATE */
jardineb5d44e2003-12-23 08:09:43 +00003458}