]>
Commit | Line | Data |
---|---|---|
eb5d44eb | 1 | /* |
2 | * IS-IS Rout(e)ing protocol - isisd.c | |
3 | * | |
4 | * Copyright (C) 2001,2002 Sampo Saaristo | |
d62a17ae | 5 | * Tampere University of Technology |
eb5d44eb | 6 | * Institute of Communications Engineering |
7 | * | |
d62a17ae | 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) | |
eb5d44eb | 11 | * any later version. |
12 | * | |
d62a17ae | 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 | |
eb5d44eb | 16 | * more details. |
896014f4 DL |
17 | * |
18 | * You should have received a copy of the GNU General Public License along | |
19 | * with this program; see the file COPYING; if not, write to the Free Software | |
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
eb5d44eb | 21 | */ |
22 | ||
eb5d44eb | 23 | #include <zebra.h> |
eb5d44eb | 24 | |
25 | #include "thread.h" | |
26 | #include "vty.h" | |
27 | #include "command.h" | |
28 | #include "log.h" | |
29 | #include "memory.h" | |
3f045a08 | 30 | #include "time.h" |
eb5d44eb | 31 | #include "linklist.h" |
32 | #include "if.h" | |
33 | #include "hash.h" | |
34 | #include "stream.h" | |
35 | #include "prefix.h" | |
36 | #include "table.h" | |
676a4ea3 | 37 | #include "qobj.h" |
03f7e182 | 38 | #include "spf_backoff.h" |
aaf2fd21 | 39 | #include "lib/northbound_cli.h" |
eb5d44eb | 40 | |
41 | #include "isisd/dict.h" | |
eb5d44eb | 42 | #include "isisd/isis_constants.h" |
43 | #include "isisd/isis_common.h" | |
eb5d44eb | 44 | #include "isisd/isis_flags.h" |
3f045a08 JB |
45 | #include "isisd/isis_circuit.h" |
46 | #include "isisd/isis_csm.h" | |
eb5d44eb | 47 | #include "isisd/isisd.h" |
48 | #include "isisd/isis_dynhn.h" | |
49 | #include "isisd/isis_adjacency.h" | |
50 | #include "isisd/isis_pdu.h" | |
51 | #include "isisd/isis_misc.h" | |
52 | #include "isisd/isis_constants.h" | |
eb5d44eb | 53 | #include "isisd/isis_lsp.h" |
54 | #include "isisd/isis_spf.h" | |
55 | #include "isisd/isis_route.h" | |
56 | #include "isisd/isis_zebra.h" | |
57 | #include "isisd/isis_events.h" | |
f8c06e2c | 58 | #include "isisd/isis_te.h" |
064f4896 | 59 | #include "isisd/isis_mt.h" |
8e6fb83b | 60 | #include "isisd/fabricd.h" |
eb5d44eb | 61 | |
eb5d44eb | 62 | struct isis *isis = NULL; |
eb5d44eb | 63 | |
676a4ea3 DL |
64 | DEFINE_QOBJ_TYPE(isis) |
65 | DEFINE_QOBJ_TYPE(isis_area) | |
66 | ||
41b36e90 PJ |
67 | /* |
68 | * Prototypes. | |
69 | */ | |
41b36e90 | 70 | int isis_area_get(struct vty *, const char *); |
3f045a08 JB |
71 | int area_net_title(struct vty *, const char *); |
72 | int area_clear_net_title(struct vty *, const char *); | |
73 | int show_isis_interface_common(struct vty *, const char *ifname, char); | |
74 | int show_isis_neighbor_common(struct vty *, const char *id, char); | |
75 | int clear_isis_neighbor_common(struct vty *, const char *id); | |
41b36e90 PJ |
76 | int isis_config_write(struct vty *); |
77 | ||
78 | ||
d62a17ae | 79 | void isis_new(unsigned long process_id) |
80 | { | |
81 | isis = XCALLOC(MTYPE_ISIS, sizeof(struct isis)); | |
82 | /* | |
83 | * Default values | |
84 | */ | |
85 | isis->max_area_addrs = 3; | |
86 | isis->process_id = process_id; | |
87 | isis->router_id = 0; | |
88 | isis->area_list = list_new(); | |
89 | isis->init_circ_list = list_new(); | |
90 | isis->uptime = time(NULL); | |
91 | isis->nexthops = list_new(); | |
92 | isis->nexthops6 = list_new(); | |
93 | dyn_cache_init(); | |
94 | /* | |
95 | * uncomment the next line for full debugs | |
96 | */ | |
97 | /* isis->debugs = 0xFFFF; */ | |
98 | isisMplsTE.status = disable; /* Only support TE metric */ | |
8e6fb83b | 99 | |
d62a17ae | 100 | QOBJ_REG(isis, isis); |
101 | } | |
102 | ||
103 | struct isis_area *isis_area_create(const char *area_tag) | |
104 | { | |
105 | struct isis_area *area; | |
106 | ||
107 | area = XCALLOC(MTYPE_ISIS_AREA, sizeof(struct isis_area)); | |
108 | ||
109 | /* | |
65f18157 CF |
110 | * Fabricd runs only as level-2. |
111 | * For IS-IS, the first instance is level-1-2 rest are level-1, | |
112 | * unless otherwise configured | |
d62a17ae | 113 | */ |
65f18157 CF |
114 | if (fabricd) { |
115 | area->is_type = IS_LEVEL_2; | |
116 | } else if (listcount(isis->area_list) > 0) | |
d62a17ae | 117 | area->is_type = IS_LEVEL_1; |
118 | else | |
119 | area->is_type = IS_LEVEL_1_AND_2; | |
120 | ||
121 | /* | |
122 | * intialize the databases | |
123 | */ | |
124 | if (area->is_type & IS_LEVEL_1) { | |
125 | area->lspdb[0] = lsp_db_init(); | |
d62a17ae | 126 | } |
127 | if (area->is_type & IS_LEVEL_2) { | |
128 | area->lspdb[1] = lsp_db_init(); | |
d62a17ae | 129 | } |
130 | ||
131 | spftree_area_init(area); | |
132 | ||
133 | area->circuit_list = list_new(); | |
134 | area->area_addrs = list_new(); | |
135 | thread_add_timer(master, lsp_tick, area, 1, &area->t_tick); | |
136 | flags_initialize(&area->flags); | |
137 | ||
138 | /* | |
139 | * Default values | |
140 | */ | |
141 | area->max_lsp_lifetime[0] = DEFAULT_LSP_LIFETIME; /* 1200 */ | |
142 | area->max_lsp_lifetime[1] = DEFAULT_LSP_LIFETIME; /* 1200 */ | |
143 | area->lsp_refresh[0] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */ | |
144 | area->lsp_refresh[1] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */ | |
145 | area->lsp_gen_interval[0] = DEFAULT_MIN_LSP_GEN_INTERVAL; | |
146 | area->lsp_gen_interval[1] = DEFAULT_MIN_LSP_GEN_INTERVAL; | |
147 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; | |
148 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; | |
149 | area->dynhostname = 1; | |
150 | area->oldmetric = 0; | |
151 | area->newmetric = 1; | |
152 | area->lsp_frag_threshold = 90; | |
153 | area->lsp_mtu = DEFAULT_LSP_MTU; | |
154 | ||
155 | area_mt_init(area); | |
41b36e90 | 156 | |
d62a17ae | 157 | area->area_tag = strdup(area_tag); |
158 | listnode_add(isis->area_list, area); | |
159 | area->isis = isis; | |
f390d2c7 | 160 | |
8e6fb83b | 161 | if (fabricd) |
b30e837b | 162 | area->fabricd = fabricd_new(area); |
9196731f CF |
163 | |
164 | area->lsp_refresh_arg[0].area = area; | |
165 | area->lsp_refresh_arg[0].level = IS_LEVEL_1; | |
166 | area->lsp_refresh_arg[1].area = area; | |
167 | area->lsp_refresh_arg[1].level = IS_LEVEL_2; | |
168 | ||
169 | ||
d62a17ae | 170 | QOBJ_REG(area, isis_area); |
eb5d44eb | 171 | |
d62a17ae | 172 | return area; |
173 | } | |
3f045a08 | 174 | |
d62a17ae | 175 | struct isis_area *isis_area_lookup(const char *area_tag) |
176 | { | |
177 | struct isis_area *area; | |
178 | struct listnode *node; | |
3f045a08 | 179 | |
d62a17ae | 180 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) |
181 | if ((area->area_tag == NULL && area_tag == NULL) | |
182 | || (area->area_tag && area_tag | |
183 | && strcmp(area->area_tag, area_tag) == 0)) | |
184 | return area; | |
3f045a08 | 185 | |
d62a17ae | 186 | return NULL; |
187 | } | |
3f045a08 | 188 | |
d62a17ae | 189 | int isis_area_get(struct vty *vty, const char *area_tag) |
190 | { | |
191 | struct isis_area *area; | |
5475ecf7 | 192 | |
d62a17ae | 193 | area = isis_area_lookup(area_tag); |
03f7e182 | 194 | |
d62a17ae | 195 | if (area) { |
7c0cbd0e | 196 | VTY_PUSH_CONTEXT(ROUTER_NODE, area); |
d62a17ae | 197 | return CMD_SUCCESS; |
198 | } | |
199 | ||
200 | area = isis_area_create(area_tag); | |
3f045a08 | 201 | |
d62a17ae | 202 | if (isis->debugs & DEBUG_EVENTS) |
203 | zlog_debug("New IS-IS area instance %s", area->area_tag); | |
3f045a08 | 204 | |
7c0cbd0e | 205 | VTY_PUSH_CONTEXT(ROUTER_NODE, area); |
f3ccedaa | 206 | |
d62a17ae | 207 | return CMD_SUCCESS; |
208 | } | |
3f045a08 | 209 | |
aaf2fd21 | 210 | int isis_area_destroy(const char *area_tag) |
eb5d44eb | 211 | { |
d62a17ae | 212 | struct isis_area *area; |
213 | struct listnode *node, *nnode; | |
214 | struct isis_circuit *circuit; | |
215 | struct area_addr *addr; | |
eb5d44eb | 216 | |
d62a17ae | 217 | area = isis_area_lookup(area_tag); |
218 | ||
219 | if (area == NULL) { | |
aaf2fd21 EDP |
220 | zlog_warn("%s: could not find area with area-tag %s", |
221 | __func__, area_tag); | |
d62a17ae | 222 | return CMD_ERR_NO_MATCH; |
223 | } | |
224 | ||
225 | QOBJ_UNREG(area); | |
226 | ||
b30e837b CF |
227 | if (fabricd) |
228 | fabricd_finish(area->fabricd); | |
229 | ||
d62a17ae | 230 | if (area->circuit_list) { |
231 | for (ALL_LIST_ELEMENTS(area->circuit_list, node, nnode, | |
232 | circuit)) { | |
233 | circuit->ip_router = 0; | |
234 | circuit->ipv6_router = 0; | |
235 | isis_csm_state_change(ISIS_DISABLE, circuit, area); | |
236 | } | |
6a154c88 | 237 | list_delete(&area->circuit_list); |
d62a17ae | 238 | } |
239 | ||
240 | if (area->lspdb[0] != NULL) { | |
241 | lsp_db_destroy(area->lspdb[0]); | |
242 | area->lspdb[0] = NULL; | |
243 | } | |
244 | if (area->lspdb[1] != NULL) { | |
245 | lsp_db_destroy(area->lspdb[1]); | |
246 | area->lspdb[1] = NULL; | |
247 | } | |
248 | ||
3dace42d CF |
249 | /* invalidate and verify to delete all routes from zebra */ |
250 | isis_area_invalidate_routes(area, ISIS_LEVEL1 & ISIS_LEVEL2); | |
251 | isis_area_verify_routes(area); | |
252 | ||
d62a17ae | 253 | spftree_area_del(area); |
254 | ||
255 | THREAD_TIMER_OFF(area->spf_timer[0]); | |
256 | THREAD_TIMER_OFF(area->spf_timer[1]); | |
257 | ||
258 | spf_backoff_free(area->spf_delay_ietf[0]); | |
259 | spf_backoff_free(area->spf_delay_ietf[1]); | |
260 | ||
d62a17ae | 261 | isis_redist_area_finish(area); |
262 | ||
263 | for (ALL_LIST_ELEMENTS(area->area_addrs, node, nnode, addr)) { | |
264 | list_delete_node(area->area_addrs, node); | |
265 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
266 | } | |
267 | area->area_addrs = NULL; | |
268 | ||
269 | THREAD_TIMER_OFF(area->t_tick); | |
270 | THREAD_TIMER_OFF(area->t_lsp_refresh[0]); | |
271 | THREAD_TIMER_OFF(area->t_lsp_refresh[1]); | |
272 | ||
273 | thread_cancel_event(master, area); | |
274 | ||
275 | listnode_delete(isis->area_list, area); | |
276 | ||
277 | free(area->area_tag); | |
278 | ||
279 | area_mt_finish(area); | |
280 | ||
281 | XFREE(MTYPE_ISIS_AREA, area); | |
282 | ||
283 | if (listcount(isis->area_list) == 0) { | |
284 | memset(isis->sysid, 0, ISIS_SYS_ID_LEN); | |
285 | isis->sysid_set = 0; | |
286 | } | |
287 | ||
288 | return CMD_SUCCESS; | |
289 | } | |
290 | ||
291 | static void area_set_mt_enabled(struct isis_area *area, uint16_t mtid, | |
292 | bool enabled) | |
293 | { | |
294 | struct isis_area_mt_setting *setting; | |
295 | ||
296 | setting = area_get_mt_setting(area, mtid); | |
297 | if (setting->enabled != enabled) { | |
298 | setting->enabled = enabled; | |
299 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0); | |
300 | } | |
301 | } | |
302 | ||
303 | static void area_set_mt_overload(struct isis_area *area, uint16_t mtid, | |
304 | bool overload) | |
305 | { | |
306 | struct isis_area_mt_setting *setting; | |
307 | ||
308 | setting = area_get_mt_setting(area, mtid); | |
309 | if (setting->overload != overload) { | |
310 | setting->overload = overload; | |
311 | if (setting->enabled) | |
312 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, | |
313 | 0); | |
314 | } | |
315 | } | |
316 | ||
317 | int area_net_title(struct vty *vty, const char *net_title) | |
318 | { | |
319 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
320 | struct area_addr *addr; | |
321 | struct area_addr *addrp; | |
322 | struct listnode *node; | |
eb5d44eb | 323 | |
d7c0a89a | 324 | uint8_t buff[255]; |
d62a17ae | 325 | |
326 | /* We check that we are not over the maximal number of addresses */ | |
327 | if (listcount(area->area_addrs) >= isis->max_area_addrs) { | |
328 | vty_out(vty, | |
329 | "Maximum of area addresses (%d) already reached \n", | |
330 | isis->max_area_addrs); | |
331 | return CMD_ERR_NOTHING_TODO; | |
332 | } | |
333 | ||
334 | addr = XMALLOC(MTYPE_ISIS_AREA_ADDR, sizeof(struct area_addr)); | |
335 | addr->addr_len = dotformat2buff(buff, net_title); | |
336 | memcpy(addr->area_addr, buff, addr->addr_len); | |
eb5d44eb | 337 | #ifdef EXTREME_DEBUG |
d62a17ae | 338 | zlog_debug("added area address %s for area %s (address length %d)", |
339 | net_title, area->area_tag, addr->addr_len); | |
eb5d44eb | 340 | #endif /* EXTREME_DEBUG */ |
d62a17ae | 341 | if (addr->addr_len < 8 || addr->addr_len > 20) { |
342 | vty_out(vty, | |
343 | "area address must be at least 8..20 octets long (%d)\n", | |
344 | addr->addr_len); | |
345 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
a5fdb4c5 | 346 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 347 | } |
348 | ||
349 | if (addr->area_addr[addr->addr_len - 1] != 0) { | |
350 | vty_out(vty, | |
351 | "nsel byte (last byte) in area address must be 0\n"); | |
352 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
a5fdb4c5 | 353 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 354 | } |
355 | ||
356 | if (isis->sysid_set == 0) { | |
357 | /* | |
358 | * First area address - get the SystemID for this router | |
359 | */ | |
360 | memcpy(isis->sysid, GETSYSID(addr), ISIS_SYS_ID_LEN); | |
361 | isis->sysid_set = 1; | |
362 | if (isis->debugs & DEBUG_EVENTS) | |
363 | zlog_debug("Router has SystemID %s", | |
364 | sysid_print(isis->sysid)); | |
365 | } else { | |
366 | /* | |
367 | * Check that the SystemID portions match | |
368 | */ | |
369 | if (memcmp(isis->sysid, GETSYSID(addr), ISIS_SYS_ID_LEN)) { | |
370 | vty_out(vty, | |
371 | "System ID must not change when defining additional area addresses\n"); | |
372 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
a5fdb4c5 | 373 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 374 | } |
375 | ||
376 | /* now we see that we don't already have this address */ | |
377 | for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node, addrp)) { | |
378 | if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN) | |
379 | != (addr->addr_len)) | |
380 | continue; | |
381 | if (!memcmp(addrp->area_addr, addr->area_addr, | |
382 | addr->addr_len)) { | |
383 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
384 | return CMD_SUCCESS; /* silent fail */ | |
385 | } | |
386 | } | |
387 | } | |
388 | ||
389 | /* | |
390 | * Forget the systemID part of the address | |
391 | */ | |
392 | addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN); | |
393 | listnode_add(area->area_addrs, addr); | |
394 | ||
395 | /* only now we can safely generate our LSPs for this area */ | |
396 | if (listcount(area->area_addrs) > 0) { | |
397 | if (area->is_type & IS_LEVEL_1) | |
398 | lsp_generate(area, IS_LEVEL_1); | |
399 | if (area->is_type & IS_LEVEL_2) | |
400 | lsp_generate(area, IS_LEVEL_2); | |
401 | } | |
402 | ||
403 | return CMD_SUCCESS; | |
404 | } | |
405 | ||
406 | int area_clear_net_title(struct vty *vty, const char *net_title) | |
407 | { | |
408 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
409 | struct area_addr addr, *addrp = NULL; | |
410 | struct listnode *node; | |
d7c0a89a | 411 | uint8_t buff[255]; |
d62a17ae | 412 | |
413 | addr.addr_len = dotformat2buff(buff, net_title); | |
414 | if (addr.addr_len < 8 || addr.addr_len > 20) { | |
415 | vty_out(vty, | |
416 | "Unsupported area address length %d, should be 8...20 \n", | |
417 | addr.addr_len); | |
a5fdb4c5 | 418 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 419 | } |
420 | ||
421 | memcpy(addr.area_addr, buff, (int)addr.addr_len); | |
422 | ||
423 | for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node, addrp)) | |
424 | if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len | |
425 | && !memcmp(addrp->area_addr, addr.area_addr, addr.addr_len)) | |
426 | break; | |
427 | ||
428 | if (!addrp) { | |
429 | vty_out(vty, "No area address %s for area %s \n", net_title, | |
430 | area->area_tag); | |
431 | return CMD_ERR_NO_MATCH; | |
432 | } | |
433 | ||
434 | listnode_delete(area->area_addrs, addrp); | |
435 | XFREE(MTYPE_ISIS_AREA_ADDR, addrp); | |
436 | ||
437 | /* | |
438 | * Last area address - reset the SystemID for this router | |
439 | */ | |
440 | if (listcount(area->area_addrs) == 0) { | |
441 | memset(isis->sysid, 0, ISIS_SYS_ID_LEN); | |
442 | isis->sysid_set = 0; | |
443 | if (isis->debugs & DEBUG_EVENTS) | |
444 | zlog_debug("Router has no SystemID"); | |
445 | } | |
446 | ||
447 | return CMD_SUCCESS; | |
eb5d44eb | 448 | } |
449 | ||
eb5d44eb | 450 | /* |
3f045a08 | 451 | * 'show isis interface' command |
eb5d44eb | 452 | */ |
453 | ||
d62a17ae | 454 | int show_isis_interface_common(struct vty *vty, const char *ifname, char detail) |
eb5d44eb | 455 | { |
d62a17ae | 456 | struct listnode *anode, *cnode; |
457 | struct isis_area *area; | |
458 | struct isis_circuit *circuit; | |
eb5d44eb | 459 | |
d62a17ae | 460 | if (!isis) { |
461 | vty_out(vty, "IS-IS Routing Process not enabled\n"); | |
462 | return CMD_SUCCESS; | |
463 | } | |
eb5d44eb | 464 | |
d62a17ae | 465 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) { |
466 | vty_out(vty, "Area %s:\n", area->area_tag); | |
f390d2c7 | 467 | |
d62a17ae | 468 | if (detail == ISIS_UI_LEVEL_BRIEF) |
469 | vty_out(vty, | |
470 | " Interface CircId State Type Level\n"); | |
f390d2c7 | 471 | |
d62a17ae | 472 | for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) |
473 | if (!ifname) | |
474 | isis_circuit_print_vty(circuit, vty, detail); | |
475 | else if (strcmp(circuit->interface->name, ifname) == 0) | |
476 | isis_circuit_print_vty(circuit, vty, detail); | |
477 | } | |
f390d2c7 | 478 | |
d62a17ae | 479 | return CMD_SUCCESS; |
eb5d44eb | 480 | } |
481 | ||
3f045a08 JB |
482 | DEFUN (show_isis_interface, |
483 | show_isis_interface_cmd, | |
7c0cbd0e | 484 | "show " PROTO_NAME " interface", |
eb5d44eb | 485 | SHOW_STR |
7c0cbd0e | 486 | PROTO_HELP |
3f045a08 | 487 | "ISIS interface\n") |
eb5d44eb | 488 | { |
d62a17ae | 489 | return show_isis_interface_common(vty, NULL, ISIS_UI_LEVEL_BRIEF); |
eb5d44eb | 490 | } |
491 | ||
3f045a08 JB |
492 | DEFUN (show_isis_interface_detail, |
493 | show_isis_interface_detail_cmd, | |
7c0cbd0e | 494 | "show " PROTO_NAME " interface detail", |
eb5d44eb | 495 | SHOW_STR |
7c0cbd0e | 496 | PROTO_HELP |
3f045a08 JB |
497 | "ISIS interface\n" |
498 | "show detailed information\n") | |
499 | { | |
d62a17ae | 500 | return show_isis_interface_common(vty, NULL, ISIS_UI_LEVEL_DETAIL); |
3f045a08 | 501 | } |
eb5d44eb | 502 | |
3f045a08 JB |
503 | DEFUN (show_isis_interface_arg, |
504 | show_isis_interface_arg_cmd, | |
7c0cbd0e | 505 | "show " PROTO_NAME " interface WORD", |
eb5d44eb | 506 | SHOW_STR |
7c0cbd0e | 507 | PROTO_HELP |
3f045a08 JB |
508 | "ISIS interface\n" |
509 | "ISIS interface name\n") | |
510 | { | |
d62a17ae | 511 | int idx_word = 3; |
512 | return show_isis_interface_common(vty, argv[idx_word]->arg, | |
513 | ISIS_UI_LEVEL_DETAIL); | |
3f045a08 JB |
514 | } |
515 | ||
516 | /* | |
517 | * 'show isis neighbor' command | |
518 | */ | |
519 | ||
d62a17ae | 520 | int show_isis_neighbor_common(struct vty *vty, const char *id, char detail) |
521 | { | |
522 | struct listnode *anode, *cnode, *node; | |
523 | struct isis_area *area; | |
524 | struct isis_circuit *circuit; | |
525 | struct list *adjdb; | |
526 | struct isis_adjacency *adj; | |
527 | struct isis_dynhn *dynhn; | |
d7c0a89a | 528 | uint8_t sysid[ISIS_SYS_ID_LEN]; |
d62a17ae | 529 | int i; |
530 | ||
531 | if (!isis) { | |
532 | vty_out(vty, "IS-IS Routing Process not enabled\n"); | |
533 | return CMD_SUCCESS; | |
534 | } | |
535 | ||
536 | memset(sysid, 0, ISIS_SYS_ID_LEN); | |
537 | if (id) { | |
538 | if (sysid2buff(sysid, id) == 0) { | |
539 | dynhn = dynhn_find_by_name(id); | |
540 | if (dynhn == NULL) { | |
541 | vty_out(vty, "Invalid system id %s\n", id); | |
542 | return CMD_SUCCESS; | |
543 | } | |
544 | memcpy(sysid, dynhn->id, ISIS_SYS_ID_LEN); | |
545 | } | |
546 | } | |
547 | ||
548 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) { | |
549 | vty_out(vty, "Area %s:\n", area->area_tag); | |
550 | ||
551 | if (detail == ISIS_UI_LEVEL_BRIEF) | |
552 | vty_out(vty, | |
553 | " System Id Interface L State Holdtime SNPA\n"); | |
554 | ||
555 | for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) { | |
556 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) { | |
557 | for (i = 0; i < 2; i++) { | |
558 | adjdb = circuit->u.bc.adjdb[i]; | |
559 | if (adjdb && adjdb->count) { | |
560 | for (ALL_LIST_ELEMENTS_RO( | |
561 | adjdb, node, adj)) | |
562 | if (!id | |
563 | || !memcmp(adj->sysid, | |
564 | sysid, | |
565 | ISIS_SYS_ID_LEN)) | |
566 | isis_adj_print_vty( | |
567 | adj, | |
568 | vty, | |
569 | detail); | |
570 | } | |
571 | } | |
572 | } else if (circuit->circ_type == CIRCUIT_T_P2P | |
573 | && circuit->u.p2p.neighbor) { | |
574 | adj = circuit->u.p2p.neighbor; | |
575 | if (!id | |
576 | || !memcmp(adj->sysid, sysid, | |
577 | ISIS_SYS_ID_LEN)) | |
578 | isis_adj_print_vty(adj, vty, detail); | |
579 | } | |
580 | } | |
581 | } | |
582 | ||
583 | return CMD_SUCCESS; | |
3f045a08 JB |
584 | } |
585 | ||
586 | /* | |
587 | * 'clear isis neighbor' command | |
588 | */ | |
d62a17ae | 589 | int clear_isis_neighbor_common(struct vty *vty, const char *id) |
590 | { | |
591 | struct listnode *anode, *cnode, *cnextnode, *node, *nnode; | |
592 | struct isis_area *area; | |
593 | struct isis_circuit *circuit; | |
594 | struct list *adjdb; | |
595 | struct isis_adjacency *adj; | |
596 | struct isis_dynhn *dynhn; | |
d7c0a89a | 597 | uint8_t sysid[ISIS_SYS_ID_LEN]; |
d62a17ae | 598 | int i; |
599 | ||
600 | if (!isis) { | |
601 | vty_out(vty, "IS-IS Routing Process not enabled\n"); | |
602 | return CMD_SUCCESS; | |
603 | } | |
604 | ||
605 | memset(sysid, 0, ISIS_SYS_ID_LEN); | |
606 | if (id) { | |
607 | if (sysid2buff(sysid, id) == 0) { | |
608 | dynhn = dynhn_find_by_name(id); | |
609 | if (dynhn == NULL) { | |
610 | vty_out(vty, "Invalid system id %s\n", id); | |
611 | return CMD_SUCCESS; | |
612 | } | |
613 | memcpy(sysid, dynhn->id, ISIS_SYS_ID_LEN); | |
614 | } | |
615 | } | |
616 | ||
617 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) { | |
618 | for (ALL_LIST_ELEMENTS(area->circuit_list, cnode, cnextnode, | |
619 | circuit)) { | |
620 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) { | |
621 | for (i = 0; i < 2; i++) { | |
622 | adjdb = circuit->u.bc.adjdb[i]; | |
623 | if (adjdb && adjdb->count) { | |
624 | for (ALL_LIST_ELEMENTS( | |
625 | adjdb, node, nnode, | |
626 | adj)) | |
627 | if (!id | |
628 | || !memcmp(adj->sysid, | |
629 | sysid, | |
630 | ISIS_SYS_ID_LEN)) | |
631 | isis_adj_state_change( | |
632 | adj, | |
633 | ISIS_ADJ_DOWN, | |
634 | "clear user request"); | |
635 | } | |
636 | } | |
637 | } else if (circuit->circ_type == CIRCUIT_T_P2P | |
638 | && circuit->u.p2p.neighbor) { | |
639 | adj = circuit->u.p2p.neighbor; | |
640 | if (!id | |
641 | || !memcmp(adj->sysid, sysid, | |
642 | ISIS_SYS_ID_LEN)) | |
643 | isis_adj_state_change( | |
644 | adj, ISIS_ADJ_DOWN, | |
645 | "clear user request"); | |
646 | } | |
647 | } | |
648 | } | |
649 | ||
650 | return CMD_SUCCESS; | |
3f045a08 JB |
651 | } |
652 | ||
653 | DEFUN (show_isis_neighbor, | |
654 | show_isis_neighbor_cmd, | |
7c0cbd0e | 655 | "show " PROTO_NAME " neighbor", |
3f045a08 | 656 | SHOW_STR |
7c0cbd0e | 657 | PROTO_HELP |
3f045a08 | 658 | "ISIS neighbor adjacencies\n") |
eb5d44eb | 659 | { |
d62a17ae | 660 | return show_isis_neighbor_common(vty, NULL, ISIS_UI_LEVEL_BRIEF); |
eb5d44eb | 661 | } |
662 | ||
3f045a08 JB |
663 | DEFUN (show_isis_neighbor_detail, |
664 | show_isis_neighbor_detail_cmd, | |
7c0cbd0e | 665 | "show " PROTO_NAME " neighbor detail", |
eb5d44eb | 666 | SHOW_STR |
7c0cbd0e | 667 | PROTO_HELP |
3f045a08 | 668 | "ISIS neighbor adjacencies\n" |
eb5d44eb | 669 | "show detailed information\n") |
3f045a08 | 670 | { |
d62a17ae | 671 | return show_isis_neighbor_common(vty, NULL, ISIS_UI_LEVEL_DETAIL); |
3f045a08 JB |
672 | } |
673 | ||
674 | DEFUN (show_isis_neighbor_arg, | |
675 | show_isis_neighbor_arg_cmd, | |
7c0cbd0e | 676 | "show " PROTO_NAME " neighbor WORD", |
3f045a08 | 677 | SHOW_STR |
7c0cbd0e | 678 | PROTO_HELP |
3f045a08 JB |
679 | "ISIS neighbor adjacencies\n" |
680 | "System id\n") | |
681 | { | |
d62a17ae | 682 | int idx_word = 3; |
683 | return show_isis_neighbor_common(vty, argv[idx_word]->arg, | |
684 | ISIS_UI_LEVEL_DETAIL); | |
3f045a08 JB |
685 | } |
686 | ||
687 | DEFUN (clear_isis_neighbor, | |
688 | clear_isis_neighbor_cmd, | |
7c0cbd0e | 689 | "clear " PROTO_NAME " neighbor", |
3f045a08 | 690 | CLEAR_STR |
7c0cbd0e CF |
691 | PROTO_HELP |
692 | "ISIS neighbor adjacencies\n") | |
3f045a08 | 693 | { |
d62a17ae | 694 | return clear_isis_neighbor_common(vty, NULL); |
3f045a08 JB |
695 | } |
696 | ||
697 | DEFUN (clear_isis_neighbor_arg, | |
698 | clear_isis_neighbor_arg_cmd, | |
7c0cbd0e | 699 | "clear " PROTO_NAME " neighbor WORD", |
3f045a08 | 700 | CLEAR_STR |
7c0cbd0e | 701 | PROTO_HELP |
3f045a08 JB |
702 | "ISIS neighbor adjacencies\n" |
703 | "System id\n") | |
704 | { | |
d62a17ae | 705 | int idx_word = 3; |
706 | return clear_isis_neighbor_common(vty, argv[idx_word]->arg); | |
3f045a08 JB |
707 | } |
708 | ||
eb5d44eb | 709 | /* |
710 | * 'isis debug', 'show debugging' | |
711 | */ | |
d62a17ae | 712 | void print_debug(struct vty *vty, int flags, int onoff) |
713 | { | |
714 | char onoffs[4]; | |
715 | if (onoff) | |
716 | strcpy(onoffs, "on"); | |
717 | else | |
718 | strcpy(onoffs, "off"); | |
719 | ||
720 | if (flags & DEBUG_ADJ_PACKETS) | |
721 | vty_out(vty, | |
722 | "IS-IS Adjacency related packets debugging is %s\n", | |
723 | onoffs); | |
161fa356 CF |
724 | if (flags & DEBUG_TX_QUEUE) |
725 | vty_out(vty, "IS-IS TX queue debugging is %s\n", | |
726 | onoffs); | |
d62a17ae | 727 | if (flags & DEBUG_SNP_PACKETS) |
728 | vty_out(vty, "IS-IS CSNP/PSNP packets debugging is %s\n", | |
729 | onoffs); | |
730 | if (flags & DEBUG_SPF_EVENTS) | |
731 | vty_out(vty, "IS-IS SPF events debugging is %s\n", onoffs); | |
d62a17ae | 732 | if (flags & DEBUG_UPDATE_PACKETS) |
733 | vty_out(vty, "IS-IS Update related packet debugging is %s\n", | |
734 | onoffs); | |
735 | if (flags & DEBUG_RTE_EVENTS) | |
736 | vty_out(vty, "IS-IS Route related debuggin is %s\n", onoffs); | |
737 | if (flags & DEBUG_EVENTS) | |
738 | vty_out(vty, "IS-IS Event debugging is %s\n", onoffs); | |
739 | if (flags & DEBUG_PACKET_DUMP) | |
740 | vty_out(vty, "IS-IS Packet dump debugging is %s\n", onoffs); | |
741 | if (flags & DEBUG_LSP_GEN) | |
742 | vty_out(vty, "IS-IS LSP generation debugging is %s\n", onoffs); | |
743 | if (flags & DEBUG_LSP_SCHED) | |
744 | vty_out(vty, "IS-IS LSP scheduling debugging is %s\n", onoffs); | |
ddb33326 CF |
745 | if (flags & DEBUG_FLOODING) |
746 | vty_out(vty, "IS-IS Flooding debugging is %s\n", onoffs); | |
2815f817 CF |
747 | if (flags & DEBUG_BFD) |
748 | vty_out(vty, "IS-IS BFD debugging is %s\n", onoffs); | |
eb5d44eb | 749 | } |
750 | ||
87f6dc50 DS |
751 | DEFUN_NOSH (show_debugging, |
752 | show_debugging_isis_cmd, | |
7c0cbd0e | 753 | "show debugging [" PROTO_NAME "]", |
87f6dc50 DS |
754 | SHOW_STR |
755 | "State of each debugging option\n" | |
7c0cbd0e | 756 | PROTO_HELP) |
eb5d44eb | 757 | { |
7c0cbd0e | 758 | vty_out(vty, PROTO_NAME " debugging status:\n"); |
87f6dc50 DS |
759 | |
760 | if (isis->debugs) | |
d62a17ae | 761 | print_debug(vty, isis->debugs, 1); |
87f6dc50 | 762 | |
d62a17ae | 763 | return CMD_SUCCESS; |
eb5d44eb | 764 | } |
765 | ||
9e867fe6 | 766 | /* Debug node. */ |
d62a17ae | 767 | static struct cmd_node debug_node = {DEBUG_NODE, "", 1}; |
768 | ||
769 | static int config_write_debug(struct vty *vty) | |
770 | { | |
771 | int write = 0; | |
772 | int flags = isis->debugs; | |
773 | ||
774 | if (flags & DEBUG_ADJ_PACKETS) { | |
7c0cbd0e | 775 | vty_out(vty, "debug " PROTO_NAME " adj-packets\n"); |
d62a17ae | 776 | write++; |
777 | } | |
161fa356 CF |
778 | if (flags & DEBUG_TX_QUEUE) { |
779 | vty_out(vty, "debug " PROTO_NAME " tx-queue\n"); | |
780 | write++; | |
781 | } | |
d62a17ae | 782 | if (flags & DEBUG_SNP_PACKETS) { |
7c0cbd0e | 783 | vty_out(vty, "debug " PROTO_NAME " snp-packets\n"); |
d62a17ae | 784 | write++; |
785 | } | |
786 | if (flags & DEBUG_SPF_EVENTS) { | |
7c0cbd0e | 787 | vty_out(vty, "debug " PROTO_NAME " spf-events\n"); |
d62a17ae | 788 | write++; |
789 | } | |
d62a17ae | 790 | if (flags & DEBUG_UPDATE_PACKETS) { |
7c0cbd0e | 791 | vty_out(vty, "debug " PROTO_NAME " update-packets\n"); |
d62a17ae | 792 | write++; |
793 | } | |
794 | if (flags & DEBUG_RTE_EVENTS) { | |
7c0cbd0e | 795 | vty_out(vty, "debug " PROTO_NAME " route-events\n"); |
d62a17ae | 796 | write++; |
797 | } | |
798 | if (flags & DEBUG_EVENTS) { | |
7c0cbd0e | 799 | vty_out(vty, "debug " PROTO_NAME " events\n"); |
d62a17ae | 800 | write++; |
801 | } | |
802 | if (flags & DEBUG_PACKET_DUMP) { | |
7c0cbd0e | 803 | vty_out(vty, "debug " PROTO_NAME " packet-dump\n"); |
d62a17ae | 804 | write++; |
805 | } | |
806 | if (flags & DEBUG_LSP_GEN) { | |
7c0cbd0e | 807 | vty_out(vty, "debug " PROTO_NAME " lsp-gen\n"); |
d62a17ae | 808 | write++; |
809 | } | |
810 | if (flags & DEBUG_LSP_SCHED) { | |
7c0cbd0e | 811 | vty_out(vty, "debug " PROTO_NAME " lsp-sched\n"); |
d62a17ae | 812 | write++; |
813 | } | |
ddb33326 | 814 | if (flags & DEBUG_FLOODING) { |
d4cff91a CF |
815 | vty_out(vty, "debug " PROTO_NAME " flooding\n"); |
816 | write++; | |
817 | } | |
2815f817 CF |
818 | if (flags & DEBUG_BFD) { |
819 | vty_out(vty, "debug " PROTO_NAME " bfd\n"); | |
820 | write++; | |
821 | } | |
d62a17ae | 822 | write += spf_backoff_write_config(vty); |
823 | ||
824 | return write; | |
9e867fe6 | 825 | } |
826 | ||
eb5d44eb | 827 | DEFUN (debug_isis_adj, |
828 | debug_isis_adj_cmd, | |
7c0cbd0e | 829 | "debug " PROTO_NAME " adj-packets", |
eb5d44eb | 830 | DEBUG_STR |
7c0cbd0e | 831 | PROTO_HELP |
f390d2c7 | 832 | "IS-IS Adjacency related packets\n") |
eb5d44eb | 833 | { |
d62a17ae | 834 | isis->debugs |= DEBUG_ADJ_PACKETS; |
835 | print_debug(vty, DEBUG_ADJ_PACKETS, 1); | |
eb5d44eb | 836 | |
d62a17ae | 837 | return CMD_SUCCESS; |
eb5d44eb | 838 | } |
839 | ||
840 | DEFUN (no_debug_isis_adj, | |
841 | no_debug_isis_adj_cmd, | |
7c0cbd0e | 842 | "no debug " PROTO_NAME " adj-packets", |
16cedbb0 | 843 | NO_STR |
eb5d44eb | 844 | UNDEBUG_STR |
7c0cbd0e | 845 | PROTO_HELP |
f390d2c7 | 846 | "IS-IS Adjacency related packets\n") |
eb5d44eb | 847 | { |
d62a17ae | 848 | isis->debugs &= ~DEBUG_ADJ_PACKETS; |
849 | print_debug(vty, DEBUG_ADJ_PACKETS, 0); | |
eb5d44eb | 850 | |
d62a17ae | 851 | return CMD_SUCCESS; |
eb5d44eb | 852 | } |
853 | ||
161fa356 CF |
854 | DEFUN (debug_isis_tx_queue, |
855 | debug_isis_tx_queue_cmd, | |
856 | "debug " PROTO_NAME " tx-queue", | |
857 | DEBUG_STR | |
858 | PROTO_HELP | |
859 | "IS-IS TX queues\n") | |
860 | { | |
861 | isis->debugs |= DEBUG_TX_QUEUE; | |
862 | print_debug(vty, DEBUG_TX_QUEUE, 1); | |
863 | ||
864 | return CMD_SUCCESS; | |
865 | } | |
866 | ||
867 | DEFUN (no_debug_isis_tx_queue, | |
868 | no_debug_isis_tx_queue_cmd, | |
869 | "no debug " PROTO_NAME " tx-queue", | |
870 | NO_STR | |
871 | UNDEBUG_STR | |
872 | PROTO_HELP | |
873 | "IS-IS TX queues\n") | |
874 | { | |
875 | isis->debugs &= ~DEBUG_TX_QUEUE; | |
876 | print_debug(vty, DEBUG_TX_QUEUE, 0); | |
877 | ||
878 | return CMD_SUCCESS; | |
879 | } | |
880 | ||
ddb33326 CF |
881 | DEFUN (debug_isis_flooding, |
882 | debug_isis_flooding_cmd, | |
883 | "debug " PROTO_NAME " flooding", | |
884 | DEBUG_STR | |
885 | PROTO_HELP | |
886 | "Flooding algorithm\n") | |
887 | { | |
888 | isis->debugs |= DEBUG_FLOODING; | |
889 | print_debug(vty, DEBUG_FLOODING, 1); | |
890 | ||
891 | return CMD_SUCCESS; | |
892 | } | |
893 | ||
894 | DEFUN (no_debug_isis_flooding, | |
895 | no_debug_isis_flooding_cmd, | |
896 | "no debug " PROTO_NAME " flooding", | |
897 | NO_STR | |
898 | UNDEBUG_STR | |
899 | PROTO_HELP | |
900 | "Flooding algorithm\n") | |
901 | { | |
902 | isis->debugs &= ~DEBUG_FLOODING; | |
903 | print_debug(vty, DEBUG_FLOODING, 0); | |
904 | ||
905 | return CMD_SUCCESS; | |
906 | } | |
907 | ||
eb5d44eb | 908 | DEFUN (debug_isis_snp, |
909 | debug_isis_snp_cmd, | |
7c0cbd0e | 910 | "debug " PROTO_NAME " snp-packets", |
eb5d44eb | 911 | DEBUG_STR |
7c0cbd0e | 912 | PROTO_HELP |
f390d2c7 | 913 | "IS-IS CSNP/PSNP packets\n") |
eb5d44eb | 914 | { |
d62a17ae | 915 | isis->debugs |= DEBUG_SNP_PACKETS; |
916 | print_debug(vty, DEBUG_SNP_PACKETS, 1); | |
eb5d44eb | 917 | |
d62a17ae | 918 | return CMD_SUCCESS; |
eb5d44eb | 919 | } |
920 | ||
921 | DEFUN (no_debug_isis_snp, | |
922 | no_debug_isis_snp_cmd, | |
7c0cbd0e | 923 | "no debug " PROTO_NAME " snp-packets", |
16cedbb0 | 924 | NO_STR |
eb5d44eb | 925 | UNDEBUG_STR |
7c0cbd0e | 926 | PROTO_HELP |
f390d2c7 | 927 | "IS-IS CSNP/PSNP packets\n") |
eb5d44eb | 928 | { |
d62a17ae | 929 | isis->debugs &= ~DEBUG_SNP_PACKETS; |
930 | print_debug(vty, DEBUG_SNP_PACKETS, 0); | |
f390d2c7 | 931 | |
d62a17ae | 932 | return CMD_SUCCESS; |
eb5d44eb | 933 | } |
934 | ||
eb5d44eb | 935 | DEFUN (debug_isis_upd, |
936 | debug_isis_upd_cmd, | |
7c0cbd0e | 937 | "debug " PROTO_NAME " update-packets", |
eb5d44eb | 938 | DEBUG_STR |
7c0cbd0e | 939 | PROTO_HELP |
f390d2c7 | 940 | "IS-IS Update related packets\n") |
eb5d44eb | 941 | { |
d62a17ae | 942 | isis->debugs |= DEBUG_UPDATE_PACKETS; |
943 | print_debug(vty, DEBUG_UPDATE_PACKETS, 1); | |
eb5d44eb | 944 | |
d62a17ae | 945 | return CMD_SUCCESS; |
eb5d44eb | 946 | } |
947 | ||
948 | DEFUN (no_debug_isis_upd, | |
949 | no_debug_isis_upd_cmd, | |
7c0cbd0e | 950 | "no debug " PROTO_NAME " update-packets", |
16cedbb0 | 951 | NO_STR |
eb5d44eb | 952 | UNDEBUG_STR |
7c0cbd0e | 953 | PROTO_HELP |
f390d2c7 | 954 | "IS-IS Update related packets\n") |
eb5d44eb | 955 | { |
d62a17ae | 956 | isis->debugs &= ~DEBUG_UPDATE_PACKETS; |
957 | print_debug(vty, DEBUG_UPDATE_PACKETS, 0); | |
f390d2c7 | 958 | |
d62a17ae | 959 | return CMD_SUCCESS; |
eb5d44eb | 960 | } |
961 | ||
eb5d44eb | 962 | DEFUN (debug_isis_spfevents, |
963 | debug_isis_spfevents_cmd, | |
7c0cbd0e | 964 | "debug " PROTO_NAME " spf-events", |
eb5d44eb | 965 | DEBUG_STR |
7c0cbd0e | 966 | PROTO_HELP |
f390d2c7 | 967 | "IS-IS Shortest Path First Events\n") |
eb5d44eb | 968 | { |
d62a17ae | 969 | isis->debugs |= DEBUG_SPF_EVENTS; |
970 | print_debug(vty, DEBUG_SPF_EVENTS, 1); | |
eb5d44eb | 971 | |
d62a17ae | 972 | return CMD_SUCCESS; |
eb5d44eb | 973 | } |
974 | ||
975 | DEFUN (no_debug_isis_spfevents, | |
976 | no_debug_isis_spfevents_cmd, | |
7c0cbd0e | 977 | "no debug " PROTO_NAME " spf-events", |
16cedbb0 | 978 | NO_STR |
eb5d44eb | 979 | UNDEBUG_STR |
7c0cbd0e | 980 | PROTO_HELP |
f390d2c7 | 981 | "IS-IS Shortest Path First Events\n") |
eb5d44eb | 982 | { |
d62a17ae | 983 | isis->debugs &= ~DEBUG_SPF_EVENTS; |
984 | print_debug(vty, DEBUG_SPF_EVENTS, 0); | |
f390d2c7 | 985 | |
d62a17ae | 986 | return CMD_SUCCESS; |
eb5d44eb | 987 | } |
988 | ||
eb5d44eb | 989 | DEFUN (debug_isis_rtevents, |
990 | debug_isis_rtevents_cmd, | |
7c0cbd0e | 991 | "debug " PROTO_NAME " route-events", |
eb5d44eb | 992 | DEBUG_STR |
7c0cbd0e | 993 | PROTO_HELP |
f390d2c7 | 994 | "IS-IS Route related events\n") |
eb5d44eb | 995 | { |
d62a17ae | 996 | isis->debugs |= DEBUG_RTE_EVENTS; |
997 | print_debug(vty, DEBUG_RTE_EVENTS, 1); | |
eb5d44eb | 998 | |
d62a17ae | 999 | return CMD_SUCCESS; |
eb5d44eb | 1000 | } |
1001 | ||
1002 | DEFUN (no_debug_isis_rtevents, | |
1003 | no_debug_isis_rtevents_cmd, | |
7c0cbd0e | 1004 | "no debug " PROTO_NAME " route-events", |
16cedbb0 | 1005 | NO_STR |
eb5d44eb | 1006 | UNDEBUG_STR |
7c0cbd0e | 1007 | PROTO_HELP |
f390d2c7 | 1008 | "IS-IS Route related events\n") |
eb5d44eb | 1009 | { |
d62a17ae | 1010 | isis->debugs &= ~DEBUG_RTE_EVENTS; |
1011 | print_debug(vty, DEBUG_RTE_EVENTS, 0); | |
f390d2c7 | 1012 | |
d62a17ae | 1013 | return CMD_SUCCESS; |
eb5d44eb | 1014 | } |
1015 | ||
1016 | DEFUN (debug_isis_events, | |
1017 | debug_isis_events_cmd, | |
7c0cbd0e | 1018 | "debug " PROTO_NAME " events", |
eb5d44eb | 1019 | DEBUG_STR |
7c0cbd0e | 1020 | PROTO_HELP |
f1082d19 | 1021 | "IS-IS Events\n") |
eb5d44eb | 1022 | { |
d62a17ae | 1023 | isis->debugs |= DEBUG_EVENTS; |
1024 | print_debug(vty, DEBUG_EVENTS, 1); | |
eb5d44eb | 1025 | |
d62a17ae | 1026 | return CMD_SUCCESS; |
eb5d44eb | 1027 | } |
1028 | ||
1029 | DEFUN (no_debug_isis_events, | |
1030 | no_debug_isis_events_cmd, | |
7c0cbd0e | 1031 | "no debug " PROTO_NAME " events", |
16cedbb0 | 1032 | NO_STR |
eb5d44eb | 1033 | UNDEBUG_STR |
7c0cbd0e | 1034 | PROTO_HELP |
f390d2c7 | 1035 | "IS-IS Events\n") |
eb5d44eb | 1036 | { |
d62a17ae | 1037 | isis->debugs &= ~DEBUG_EVENTS; |
1038 | print_debug(vty, DEBUG_EVENTS, 0); | |
f390d2c7 | 1039 | |
d62a17ae | 1040 | return CMD_SUCCESS; |
eb5d44eb | 1041 | } |
1042 | ||
3f045a08 JB |
1043 | DEFUN (debug_isis_packet_dump, |
1044 | debug_isis_packet_dump_cmd, | |
7c0cbd0e | 1045 | "debug " PROTO_NAME " packet-dump", |
3f045a08 | 1046 | DEBUG_STR |
7c0cbd0e | 1047 | PROTO_HELP |
3f045a08 JB |
1048 | "IS-IS packet dump\n") |
1049 | { | |
d62a17ae | 1050 | isis->debugs |= DEBUG_PACKET_DUMP; |
1051 | print_debug(vty, DEBUG_PACKET_DUMP, 1); | |
3f045a08 | 1052 | |
d62a17ae | 1053 | return CMD_SUCCESS; |
3f045a08 JB |
1054 | } |
1055 | ||
1056 | DEFUN (no_debug_isis_packet_dump, | |
1057 | no_debug_isis_packet_dump_cmd, | |
7c0cbd0e | 1058 | "no debug " PROTO_NAME " packet-dump", |
16cedbb0 | 1059 | NO_STR |
3f045a08 | 1060 | UNDEBUG_STR |
7c0cbd0e | 1061 | PROTO_HELP |
3f045a08 JB |
1062 | "IS-IS packet dump\n") |
1063 | { | |
d62a17ae | 1064 | isis->debugs &= ~DEBUG_PACKET_DUMP; |
1065 | print_debug(vty, DEBUG_PACKET_DUMP, 0); | |
3f045a08 | 1066 | |
d62a17ae | 1067 | return CMD_SUCCESS; |
3f045a08 JB |
1068 | } |
1069 | ||
14872644 CF |
1070 | DEFUN (debug_isis_lsp_gen, |
1071 | debug_isis_lsp_gen_cmd, | |
7c0cbd0e | 1072 | "debug " PROTO_NAME " lsp-gen", |
14872644 | 1073 | DEBUG_STR |
7c0cbd0e | 1074 | PROTO_HELP |
14872644 CF |
1075 | "IS-IS generation of own LSPs\n") |
1076 | { | |
d62a17ae | 1077 | isis->debugs |= DEBUG_LSP_GEN; |
1078 | print_debug(vty, DEBUG_LSP_GEN, 1); | |
14872644 | 1079 | |
d62a17ae | 1080 | return CMD_SUCCESS; |
14872644 CF |
1081 | } |
1082 | ||
1083 | DEFUN (no_debug_isis_lsp_gen, | |
1084 | no_debug_isis_lsp_gen_cmd, | |
7c0cbd0e | 1085 | "no debug " PROTO_NAME " lsp-gen", |
16cedbb0 | 1086 | NO_STR |
14872644 | 1087 | UNDEBUG_STR |
7c0cbd0e | 1088 | PROTO_HELP |
14872644 CF |
1089 | "IS-IS generation of own LSPs\n") |
1090 | { | |
d62a17ae | 1091 | isis->debugs &= ~DEBUG_LSP_GEN; |
1092 | print_debug(vty, DEBUG_LSP_GEN, 0); | |
14872644 | 1093 | |
d62a17ae | 1094 | return CMD_SUCCESS; |
14872644 CF |
1095 | } |
1096 | ||
414766a1 CF |
1097 | DEFUN (debug_isis_lsp_sched, |
1098 | debug_isis_lsp_sched_cmd, | |
7c0cbd0e | 1099 | "debug " PROTO_NAME " lsp-sched", |
414766a1 | 1100 | DEBUG_STR |
7c0cbd0e | 1101 | PROTO_HELP |
414766a1 CF |
1102 | "IS-IS scheduling of LSP generation\n") |
1103 | { | |
d62a17ae | 1104 | isis->debugs |= DEBUG_LSP_SCHED; |
1105 | print_debug(vty, DEBUG_LSP_SCHED, 1); | |
414766a1 | 1106 | |
d62a17ae | 1107 | return CMD_SUCCESS; |
414766a1 CF |
1108 | } |
1109 | ||
49d41a26 DS |
1110 | DEFUN (no_debug_isis_lsp_sched, |
1111 | no_debug_isis_lsp_sched_cmd, | |
7c0cbd0e | 1112 | "no debug " PROTO_NAME " lsp-sched", |
16cedbb0 | 1113 | NO_STR |
49d41a26 | 1114 | UNDEBUG_STR |
7c0cbd0e | 1115 | PROTO_HELP |
49d41a26 DS |
1116 | "IS-IS scheduling of LSP generation\n") |
1117 | { | |
d62a17ae | 1118 | isis->debugs &= ~DEBUG_LSP_SCHED; |
1119 | print_debug(vty, DEBUG_LSP_SCHED, 0); | |
49d41a26 | 1120 | |
d62a17ae | 1121 | return CMD_SUCCESS; |
49d41a26 DS |
1122 | } |
1123 | ||
2815f817 CF |
1124 | DEFUN (debug_isis_bfd, |
1125 | debug_isis_bfd_cmd, | |
1126 | "debug " PROTO_NAME " bfd", | |
1127 | DEBUG_STR | |
1128 | PROTO_HELP | |
1129 | PROTO_NAME " interaction with BFD\n") | |
1130 | { | |
1131 | isis->debugs |= DEBUG_BFD; | |
1132 | print_debug(vty, DEBUG_BFD, 1); | |
1133 | ||
1134 | return CMD_SUCCESS; | |
1135 | } | |
1136 | ||
1137 | DEFUN (no_debug_isis_bfd, | |
1138 | no_debug_isis_bfd_cmd, | |
1139 | "no debug " PROTO_NAME " bfd", | |
1140 | NO_STR | |
1141 | UNDEBUG_STR | |
1142 | PROTO_HELP | |
1143 | PROTO_NAME " interaction with BFD\n") | |
1144 | { | |
1145 | isis->debugs &= ~DEBUG_BFD; | |
1146 | print_debug(vty, DEBUG_BFD, 0); | |
1147 | ||
1148 | return CMD_SUCCESS; | |
1149 | } | |
1150 | ||
eb5d44eb | 1151 | DEFUN (show_hostname, |
1152 | show_hostname_cmd, | |
7c0cbd0e | 1153 | "show " PROTO_NAME " hostname", |
eb5d44eb | 1154 | SHOW_STR |
7c0cbd0e | 1155 | PROTO_HELP |
eb5d44eb | 1156 | "IS-IS Dynamic hostname mapping\n") |
1157 | { | |
d62a17ae | 1158 | dynhn_print_all(vty); |
f390d2c7 | 1159 | |
d62a17ae | 1160 | return CMD_SUCCESS; |
eb5d44eb | 1161 | } |
1162 | ||
03f7e182 SL |
1163 | DEFUN (show_isis_spf_ietf, |
1164 | show_isis_spf_ietf_cmd, | |
7c0cbd0e | 1165 | "show " PROTO_NAME " spf-delay-ietf", |
03f7e182 | 1166 | SHOW_STR |
7c0cbd0e CF |
1167 | PROTO_HELP |
1168 | "SPF delay IETF information\n") | |
03f7e182 | 1169 | { |
d62a17ae | 1170 | if (!isis) { |
1171 | vty_out(vty, "ISIS is not running\n"); | |
1172 | return CMD_SUCCESS; | |
1173 | } | |
1174 | ||
1175 | struct listnode *node; | |
1176 | struct isis_area *area; | |
1177 | ||
1178 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { | |
1179 | vty_out(vty, "Area %s:\n", | |
1180 | area->area_tag ? area->area_tag : "null"); | |
1181 | ||
1182 | for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) { | |
1183 | if ((area->is_type & level) == 0) | |
1184 | continue; | |
1185 | ||
1186 | vty_out(vty, " Level-%d:\n", level); | |
1187 | vty_out(vty, " SPF delay status: "); | |
1188 | if (area->spf_timer[level - 1]) { | |
1189 | struct timeval remain = thread_timer_remain( | |
1190 | area->spf_timer[level - 1]); | |
a97986ff DL |
1191 | vty_out(vty, "Pending, due in %lld msec\n", |
1192 | (long long)remain.tv_sec * 1000 | |
d62a17ae | 1193 | + remain.tv_usec / 1000); |
1194 | } else { | |
1195 | vty_out(vty, "Not scheduled\n"); | |
1196 | } | |
1197 | ||
1198 | if (area->spf_delay_ietf[level - 1]) { | |
1199 | vty_out(vty, | |
1200 | " Using draft-ietf-rtgwg-backoff-algo-04\n"); | |
1201 | spf_backoff_show( | |
1202 | area->spf_delay_ietf[level - 1], vty, | |
1203 | " "); | |
1204 | } else { | |
1205 | vty_out(vty, " Using legacy backoff algo\n"); | |
1206 | } | |
1207 | } | |
1208 | } | |
1209 | return CMD_SUCCESS; | |
03f7e182 SL |
1210 | } |
1211 | ||
3f045a08 JB |
1212 | DEFUN (show_isis_summary, |
1213 | show_isis_summary_cmd, | |
7c0cbd0e CF |
1214 | "show " PROTO_NAME " summary", |
1215 | SHOW_STR PROTO_HELP "summary\n") | |
3f045a08 | 1216 | { |
d62a17ae | 1217 | struct listnode *node, *node2; |
1218 | struct isis_area *area; | |
d62a17ae | 1219 | int level; |
1220 | ||
1221 | if (isis == NULL) { | |
7c0cbd0e | 1222 | vty_out(vty, PROTO_NAME " is not running\n"); |
d62a17ae | 1223 | return CMD_SUCCESS; |
1224 | } | |
1225 | ||
1226 | vty_out(vty, "Process Id : %ld\n", isis->process_id); | |
1227 | if (isis->sysid_set) | |
1228 | vty_out(vty, "System Id : %s\n", | |
1229 | sysid_print(isis->sysid)); | |
1230 | ||
1231 | vty_out(vty, "Up time : "); | |
1232 | vty_out_timestr(vty, isis->uptime); | |
1233 | vty_out(vty, "\n"); | |
1234 | ||
1235 | if (isis->area_list) | |
1236 | vty_out(vty, "Number of areas : %d\n", isis->area_list->count); | |
1237 | ||
1238 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { | |
1239 | vty_out(vty, "Area %s:\n", | |
1240 | area->area_tag ? area->area_tag : "null"); | |
1241 | ||
92ed0cde CF |
1242 | if (fabricd) { |
1243 | uint8_t tier = fabricd_tier(area); | |
1244 | if (tier == ISIS_TIER_UNDEFINED) | |
1245 | vty_out(vty, " Tier: undefined\n"); | |
1246 | else | |
1247 | vty_out(vty, " Tier: %" PRIu8 "\n", tier); | |
1248 | } | |
1249 | ||
d62a17ae | 1250 | if (listcount(area->area_addrs) > 0) { |
1251 | struct area_addr *area_addr; | |
1252 | for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node2, | |
1253 | area_addr)) { | |
1254 | vty_out(vty, " Net: %s\n", | |
1255 | isonet_print(area_addr->area_addr, | |
1256 | area_addr->addr_len | |
1257 | + ISIS_SYS_ID_LEN | |
1258 | + 1)); | |
1259 | } | |
1260 | } | |
1261 | ||
39bb53d6 CF |
1262 | vty_out(vty, " TX counters per PDU type:\n"); |
1263 | pdu_counter_print(vty, " ", area->pdu_tx_counters); | |
86d6f80d CF |
1264 | vty_out(vty, " LSP RXMT: %" PRIu64 "\n", |
1265 | area->lsp_rxmt_count); | |
39bb53d6 CF |
1266 | vty_out(vty, " RX counters per PDU type:\n"); |
1267 | pdu_counter_print(vty, " ", area->pdu_rx_counters); | |
1268 | ||
d62a17ae | 1269 | for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) { |
1270 | if ((area->is_type & level) == 0) | |
1271 | continue; | |
1272 | ||
1273 | vty_out(vty, " Level-%d:\n", level); | |
062f4d36 CF |
1274 | |
1275 | vty_out(vty, " LSP0 regenerated: %" PRIu64 "\n", | |
1276 | area->lsp_gen_count[level - 1]); | |
1277 | ||
6f004b60 CF |
1278 | vty_out(vty, " LSPs purged: %" PRIu64 "\n", |
1279 | area->lsp_purge_count[level - 1]); | |
1280 | ||
d62a17ae | 1281 | if (area->spf_timer[level - 1]) |
1282 | vty_out(vty, " SPF: (pending)\n"); | |
1283 | else | |
1284 | vty_out(vty, " SPF:\n"); | |
1285 | ||
1286 | vty_out(vty, " minimum interval : %d", | |
1287 | area->min_spf_interval[level - 1]); | |
1288 | if (area->spf_delay_ietf[level - 1]) | |
1289 | vty_out(vty, | |
1290 | " (not used, IETF SPF delay activated)"); | |
1291 | vty_out(vty, "\n"); | |
1292 | ||
1293 | vty_out(vty, " IPv4 route computation:\n"); | |
be985ba0 CF |
1294 | isis_spf_print(area->spftree[SPFTREE_IPV4][level - 1], |
1295 | vty); | |
d62a17ae | 1296 | |
d62a17ae | 1297 | vty_out(vty, " IPv6 route computation:\n"); |
be985ba0 CF |
1298 | isis_spf_print(area->spftree[SPFTREE_IPV6][level - 1], |
1299 | vty); | |
321c1bbb CF |
1300 | |
1301 | vty_out(vty, " IPv6 dst-src route computation:\n"); | |
1302 | isis_spf_print(area->spftree[SPFTREE_DSTSRC][level-1], | |
1303 | vty); | |
d62a17ae | 1304 | } |
1305 | } | |
1306 | vty_out(vty, "\n"); | |
1307 | ||
1308 | return CMD_SUCCESS; | |
eb5d44eb | 1309 | } |
1310 | ||
eb2bcb28 | 1311 | struct isis_lsp *lsp_for_arg(const char *argv, dict_t *lspdb) |
d62a17ae | 1312 | { |
eb2bcb28 | 1313 | char sysid[255] = {0}; |
d7c0a89a | 1314 | uint8_t number[3]; |
eb2bcb28 CF |
1315 | const char *pos; |
1316 | uint8_t lspid[ISIS_SYS_ID_LEN + 2] = {0}; | |
1317 | struct isis_dynhn *dynhn; | |
1318 | struct isis_lsp *lsp = NULL; | |
d62a17ae | 1319 | |
eb2bcb28 CF |
1320 | if (!argv) |
1321 | return NULL; | |
d62a17ae | 1322 | |
1323 | /* | |
1324 | * extract fragment and pseudo id from the string argv | |
1325 | * in the forms: | |
1326 | * (a) <systemid/hostname>.<pseudo-id>-<framenent> or | |
1327 | * (b) <systemid/hostname>.<pseudo-id> or | |
1328 | * (c) <systemid/hostname> or | |
1329 | * Where systemid is in the form: | |
1330 | * xxxx.xxxx.xxxx | |
1331 | */ | |
1332 | if (argv) | |
1333 | strncpy(sysid, argv, 254); | |
1334 | if (argv && strlen(argv) > 3) { | |
1335 | pos = argv + strlen(argv) - 3; | |
1336 | if (strncmp(pos, "-", 1) == 0) { | |
1337 | memcpy(number, ++pos, 2); | |
1338 | lspid[ISIS_SYS_ID_LEN + 1] = | |
d7c0a89a | 1339 | (uint8_t)strtol((char *)number, NULL, 16); |
d62a17ae | 1340 | pos -= 4; |
1341 | if (strncmp(pos, ".", 1) != 0) | |
eb2bcb28 | 1342 | return NULL; |
d62a17ae | 1343 | } |
1344 | if (strncmp(pos, ".", 1) == 0) { | |
1345 | memcpy(number, ++pos, 2); | |
1346 | lspid[ISIS_SYS_ID_LEN] = | |
d7c0a89a | 1347 | (uint8_t)strtol((char *)number, NULL, 16); |
d62a17ae | 1348 | sysid[pos - argv - 1] = '\0'; |
1349 | } | |
1350 | } | |
1351 | ||
eb2bcb28 CF |
1352 | /* |
1353 | * Try to find the lsp-id if the argv | |
1354 | * string is in | |
1355 | * the form | |
1356 | * hostname.<pseudo-id>-<fragment> | |
1357 | */ | |
1358 | if (sysid2buff(lspid, sysid)) { | |
1359 | lsp = lsp_search(lspid, lspdb); | |
1360 | } else if ((dynhn = dynhn_find_by_name(sysid))) { | |
1361 | memcpy(lspid, dynhn->id, ISIS_SYS_ID_LEN); | |
1362 | lsp = lsp_search(lspid, lspdb); | |
1363 | } else if (strncmp(cmd_hostname_get(), sysid, 15) == 0) { | |
1364 | memcpy(lspid, isis->sysid, ISIS_SYS_ID_LEN); | |
1365 | lsp = lsp_search(lspid, lspdb); | |
1366 | } | |
1367 | ||
1368 | return lsp; | |
1369 | } | |
1370 | ||
1371 | /* | |
1372 | * This function supports following display options: | |
1373 | * [ show isis database [detail] ] | |
1374 | * [ show isis database <sysid> [detail] ] | |
1375 | * [ show isis database <hostname> [detail] ] | |
1376 | * [ show isis database <sysid>.<pseudo-id> [detail] ] | |
1377 | * [ show isis database <hostname>.<pseudo-id> [detail] ] | |
1378 | * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ] | |
1379 | * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ] | |
1380 | * [ show isis database detail <sysid> ] | |
1381 | * [ show isis database detail <hostname> ] | |
1382 | * [ show isis database detail <sysid>.<pseudo-id> ] | |
1383 | * [ show isis database detail <hostname>.<pseudo-id> ] | |
1384 | * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ] | |
1385 | * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ] | |
1386 | */ | |
1387 | static int show_isis_database(struct vty *vty, const char *argv, int ui_level) | |
1388 | { | |
1389 | struct listnode *node; | |
1390 | struct isis_area *area; | |
1391 | struct isis_lsp *lsp; | |
1392 | int level, lsp_count; | |
1393 | ||
1394 | if (isis->area_list->count == 0) | |
1395 | return CMD_SUCCESS; | |
1396 | ||
d62a17ae | 1397 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { |
1398 | vty_out(vty, "Area %s:\n", | |
1399 | area->area_tag ? area->area_tag : "null"); | |
1400 | ||
1401 | for (level = 0; level < ISIS_LEVELS; level++) { | |
1402 | if (area->lspdb[level] | |
1403 | && dict_count(area->lspdb[level]) > 0) { | |
eb2bcb28 | 1404 | lsp = lsp_for_arg(argv, area->lspdb[level]); |
d62a17ae | 1405 | |
1406 | if (lsp != NULL || argv == NULL) { | |
1407 | vty_out(vty, | |
1408 | "IS-IS Level-%d link-state database:\n", | |
1409 | level + 1); | |
1410 | ||
1411 | /* print the title in all cases */ | |
1412 | vty_out(vty, | |
1413 | "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n"); | |
1414 | } | |
1415 | ||
1416 | if (lsp) { | |
1417 | if (ui_level == ISIS_UI_LEVEL_DETAIL) | |
1418 | lsp_print_detail( | |
1419 | lsp, vty, | |
1420 | area->dynhostname); | |
1421 | else | |
1422 | lsp_print(lsp, vty, | |
1423 | area->dynhostname); | |
1424 | } else if (argv == NULL) { | |
1425 | lsp_count = lsp_print_all( | |
1426 | vty, area->lspdb[level], | |
1427 | ui_level, area->dynhostname); | |
1428 | ||
1429 | vty_out(vty, " %u LSPs\n\n", | |
1430 | lsp_count); | |
1431 | } | |
1432 | } | |
1433 | } | |
1434 | } | |
1435 | ||
1436 | return CMD_SUCCESS; | |
eb5d44eb | 1437 | } |
1438 | ||
3a2d747c | 1439 | DEFUN (show_database, |
3f045a08 | 1440 | show_database_cmd, |
7c0cbd0e | 1441 | "show " PROTO_NAME " database [detail] [WORD]", |
3f045a08 | 1442 | SHOW_STR |
7c0cbd0e CF |
1443 | PROTO_HELP |
1444 | "Link state database\n" | |
3f045a08 JB |
1445 | "Detailed information\n" |
1446 | "LSP ID\n") | |
1447 | { | |
d62a17ae | 1448 | int idx = 0; |
1449 | int uilevel = argv_find(argv, argc, "detail", &idx) | |
1450 | ? ISIS_UI_LEVEL_DETAIL | |
1451 | : ISIS_UI_LEVEL_BRIEF; | |
1452 | char *id = argv_find(argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL; | |
1453 | return show_isis_database(vty, id, uilevel); | |
3f045a08 JB |
1454 | } |
1455 | ||
aaf2fd21 | 1456 | #ifdef FABRICD |
d62a17ae | 1457 | /* |
aaf2fd21 | 1458 | * 'router openfabric' command |
3f045a08 | 1459 | */ |
aaf2fd21 EDP |
1460 | DEFUN_NOSH (router_openfabric, |
1461 | router_openfabric_cmd, | |
1462 | "router openfabric WORD", | |
3f045a08 | 1463 | ROUTER_STR |
7c0cbd0e | 1464 | PROTO_HELP |
efd7904e | 1465 | "ISO Routing area tag\n") |
3f045a08 | 1466 | { |
d62a17ae | 1467 | int idx_word = 2; |
1468 | return isis_area_get(vty, argv[idx_word]->arg); | |
3f045a08 JB |
1469 | } |
1470 | ||
d62a17ae | 1471 | /* |
aaf2fd21 | 1472 | *'no router openfabric' command |
3f045a08 | 1473 | */ |
aaf2fd21 EDP |
1474 | DEFUN (no_router_openfabric, |
1475 | no_router_openfabric_cmd, | |
1476 | "no router openfabric WORD", | |
7c0cbd0e CF |
1477 | NO_STR |
1478 | ROUTER_STR | |
1479 | PROTO_HELP | |
1480 | "ISO Routing area tag\n") | |
eb5d44eb | 1481 | { |
d62a17ae | 1482 | int idx_word = 3; |
aaf2fd21 | 1483 | return isis_area_destroy(argv[idx_word]->arg); |
eb5d44eb | 1484 | } |
aaf2fd21 | 1485 | #endif /* ifdef FABRICD */ |
eb5d44eb | 1486 | /* |
1487 | * 'net' command | |
1488 | */ | |
1489 | DEFUN (net, | |
1490 | net_cmd, | |
1491 | "net WORD", | |
1492 | "A Network Entity Title for this process (OSI only)\n" | |
f390d2c7 | 1493 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") |
eb5d44eb | 1494 | { |
d62a17ae | 1495 | int idx_word = 1; |
1496 | return area_net_title(vty, argv[idx_word]->arg); | |
eb5d44eb | 1497 | } |
1498 | ||
eb5d44eb | 1499 | /* |
1500 | * 'no net' command | |
1501 | */ | |
1502 | DEFUN (no_net, | |
1503 | no_net_cmd, | |
1504 | "no net WORD", | |
1505 | NO_STR | |
1506 | "A Network Entity Title for this process (OSI only)\n" | |
f390d2c7 | 1507 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") |
eb5d44eb | 1508 | { |
d62a17ae | 1509 | int idx_word = 2; |
1510 | return area_clear_net_title(vty, argv[idx_word]->arg); | |
eb5d44eb | 1511 | } |
1512 | ||
064f4896 CF |
1513 | DEFUN (isis_topology, |
1514 | isis_topology_cmd, | |
1515 | "topology " ISIS_MT_NAMES " [overload]", | |
1516 | "Configure IS-IS topologies\n" | |
1517 | ISIS_MT_DESCRIPTIONS | |
1518 | "Set overload bit for topology\n") | |
1519 | { | |
d62a17ae | 1520 | VTY_DECLVAR_CONTEXT(isis_area, area); |
064f4896 | 1521 | |
d62a17ae | 1522 | const char *arg = argv[1]->arg; |
1523 | uint16_t mtid = isis_str2mtid(arg); | |
c3ea3906 | 1524 | |
d62a17ae | 1525 | if (area->oldmetric) { |
1526 | vty_out(vty, | |
1527 | "Multi topology IS-IS can only be used with wide metrics\n"); | |
a5fdb4c5 | 1528 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 1529 | } |
c3ea3906 | 1530 | |
d62a17ae | 1531 | if (mtid == (uint16_t)-1) { |
1532 | vty_out(vty, "Don't know topology '%s'\n", arg); | |
a5fdb4c5 | 1533 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 1534 | } |
1535 | if (mtid == ISIS_MT_IPV4_UNICAST) { | |
1536 | vty_out(vty, "Cannot configure IPv4 unicast topology\n"); | |
a5fdb4c5 | 1537 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 1538 | } |
064f4896 | 1539 | |
d62a17ae | 1540 | area_set_mt_enabled(area, mtid, true); |
1541 | area_set_mt_overload(area, mtid, (argc == 3)); | |
1542 | return CMD_SUCCESS; | |
064f4896 CF |
1543 | } |
1544 | ||
1545 | DEFUN (no_isis_topology, | |
1546 | no_isis_topology_cmd, | |
1547 | "no topology " ISIS_MT_NAMES " [overload]", | |
1548 | NO_STR | |
1549 | "Configure IS-IS topologies\n" | |
1550 | ISIS_MT_DESCRIPTIONS | |
1551 | "Set overload bit for topology\n") | |
1552 | { | |
d62a17ae | 1553 | VTY_DECLVAR_CONTEXT(isis_area, area); |
064f4896 | 1554 | |
d62a17ae | 1555 | const char *arg = argv[2]->arg; |
1556 | uint16_t mtid = isis_str2mtid(arg); | |
c3ea3906 | 1557 | |
d62a17ae | 1558 | if (area->oldmetric) { |
1559 | vty_out(vty, | |
1560 | "Multi topology IS-IS can only be used with wide metrics\n"); | |
a5fdb4c5 | 1561 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 1562 | } |
c3ea3906 | 1563 | |
d62a17ae | 1564 | if (mtid == (uint16_t)-1) { |
1565 | vty_out(vty, "Don't know topology '%s'\n", arg); | |
a5fdb4c5 | 1566 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 1567 | } |
1568 | if (mtid == ISIS_MT_IPV4_UNICAST) { | |
1569 | vty_out(vty, "Cannot configure IPv4 unicast topology\n"); | |
a5fdb4c5 | 1570 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 1571 | } |
064f4896 | 1572 | |
d62a17ae | 1573 | area_set_mt_enabled(area, mtid, false); |
1574 | area_set_mt_overload(area, mtid, false); | |
1575 | return CMD_SUCCESS; | |
064f4896 CF |
1576 | } |
1577 | ||
6754fc66 | 1578 | void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu) |
b20ccb3a | 1579 | { |
d62a17ae | 1580 | area->lsp_mtu = lsp_mtu; |
1581 | lsp_regenerate_schedule(area, IS_LEVEL_1_AND_2, 1); | |
1582 | } | |
1583 | ||
1584 | static int isis_area_passwd_set(struct isis_area *area, int level, | |
d7c0a89a QY |
1585 | uint8_t passwd_type, const char *passwd, |
1586 | uint8_t snp_auth) | |
d62a17ae | 1587 | { |
1588 | struct isis_passwd *dest; | |
1589 | struct isis_passwd modified; | |
1590 | int len; | |
1591 | ||
1592 | assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2)); | |
1593 | dest = (level == IS_LEVEL_1) ? &area->area_passwd | |
1594 | : &area->domain_passwd; | |
1595 | memset(&modified, 0, sizeof(modified)); | |
1596 | ||
1597 | if (passwd_type != ISIS_PASSWD_TYPE_UNUSED) { | |
1598 | if (!passwd) | |
1599 | return -1; | |
1600 | ||
1601 | len = strlen(passwd); | |
1602 | if (len > 254) | |
1603 | return -1; | |
1604 | ||
1605 | modified.len = len; | |
1606 | strncpy((char *)modified.passwd, passwd, 255); | |
1607 | modified.type = passwd_type; | |
1608 | modified.snp_auth = snp_auth; | |
1609 | } | |
1610 | ||
1611 | if (memcmp(&modified, dest, sizeof(modified))) { | |
1612 | memcpy(dest, &modified, sizeof(modified)); | |
1613 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
1614 | } | |
1615 | ||
1616 | return 0; | |
1617 | } | |
1618 | ||
1619 | int isis_area_passwd_unset(struct isis_area *area, int level) | |
1620 | { | |
1621 | return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_UNUSED, NULL, | |
1622 | 0); | |
1623 | } | |
1624 | ||
1625 | int isis_area_passwd_cleartext_set(struct isis_area *area, int level, | |
d7c0a89a | 1626 | const char *passwd, uint8_t snp_auth) |
d62a17ae | 1627 | { |
1628 | return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_CLEARTXT, | |
1629 | passwd, snp_auth); | |
1630 | } | |
1631 | ||
1632 | int isis_area_passwd_hmac_md5_set(struct isis_area *area, int level, | |
d7c0a89a | 1633 | const char *passwd, uint8_t snp_auth) |
d62a17ae | 1634 | { |
1635 | return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_HMAC_MD5, | |
1636 | passwd, snp_auth); | |
b20ccb3a CF |
1637 | } |
1638 | ||
3dace42d CF |
1639 | void isis_area_invalidate_routes(struct isis_area *area, int levels) |
1640 | { | |
1641 | for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) { | |
1642 | if (!(level & levels)) | |
1643 | continue; | |
be985ba0 CF |
1644 | for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) { |
1645 | isis_spf_invalidate_routes( | |
1646 | area->spftree[tree][level - 1]); | |
1647 | } | |
3dace42d CF |
1648 | } |
1649 | } | |
1650 | ||
1651 | void isis_area_verify_routes(struct isis_area *area) | |
1652 | { | |
be985ba0 CF |
1653 | for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) |
1654 | isis_spf_verify_routes(area, area->spftree[tree]); | |
3dace42d CF |
1655 | } |
1656 | ||
d62a17ae | 1657 | static void area_resign_level(struct isis_area *area, int level) |
3f045a08 | 1658 | { |
3dace42d CF |
1659 | isis_area_invalidate_routes(area, level); |
1660 | isis_area_verify_routes(area); | |
1661 | ||
d62a17ae | 1662 | if (area->lspdb[level - 1]) { |
1663 | lsp_db_destroy(area->lspdb[level - 1]); | |
1664 | area->lspdb[level - 1] = NULL; | |
1665 | } | |
be985ba0 CF |
1666 | |
1667 | for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) { | |
1668 | if (area->spftree[tree][level - 1]) { | |
1669 | isis_spftree_del(area->spftree[tree][level - 1]); | |
1670 | area->spftree[tree][level - 1] = NULL; | |
1671 | } | |
d62a17ae | 1672 | } |
be985ba0 | 1673 | |
d62a17ae | 1674 | THREAD_TIMER_OFF(area->spf_timer[level - 1]); |
3f045a08 | 1675 | |
d62a17ae | 1676 | sched_debug( |
1677 | "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.", | |
1678 | area->area_tag, level); | |
1679 | THREAD_TIMER_OFF(area->t_lsp_refresh[level - 1]); | |
1680 | area->lsp_regenerate_pending[level - 1] = 0; | |
1681 | } | |
3f045a08 | 1682 | |
d62a17ae | 1683 | void isis_area_is_type_set(struct isis_area *area, int is_type) |
1684 | { | |
1685 | struct listnode *node; | |
1686 | struct isis_circuit *circuit; | |
3f045a08 | 1687 | |
d62a17ae | 1688 | if (isis->debugs & DEBUG_EVENTS) |
1689 | zlog_debug("ISIS-Evt (%s) system type change %s -> %s", | |
1690 | area->area_tag, circuit_t2string(area->is_type), | |
1691 | circuit_t2string(is_type)); | |
f390d2c7 | 1692 | |
d62a17ae | 1693 | if (area->is_type == is_type) |
1694 | return; /* No change */ | |
1695 | ||
1696 | switch (area->is_type) { | |
1697 | case IS_LEVEL_1: | |
1698 | if (is_type == IS_LEVEL_2) | |
1699 | area_resign_level(area, IS_LEVEL_1); | |
1700 | ||
1701 | if (area->lspdb[1] == NULL) | |
1702 | area->lspdb[1] = lsp_db_init(); | |
d62a17ae | 1703 | break; |
1704 | ||
1705 | case IS_LEVEL_1_AND_2: | |
1706 | if (is_type == IS_LEVEL_1) | |
1707 | area_resign_level(area, IS_LEVEL_2); | |
1708 | else | |
1709 | area_resign_level(area, IS_LEVEL_1); | |
1710 | break; | |
1711 | ||
1712 | case IS_LEVEL_2: | |
1713 | if (is_type == IS_LEVEL_1) | |
1714 | area_resign_level(area, IS_LEVEL_2); | |
1715 | ||
1716 | if (area->lspdb[0] == NULL) | |
1717 | area->lspdb[0] = lsp_db_init(); | |
d62a17ae | 1718 | break; |
1719 | ||
1720 | default: | |
1721 | break; | |
1722 | } | |
1723 | ||
1724 | area->is_type = is_type; | |
1725 | ||
1726 | /* override circuit's is_type */ | |
1727 | if (area->is_type != IS_LEVEL_1_AND_2) { | |
1728 | for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) | |
1729 | isis_circuit_is_type_set(circuit, is_type); | |
1730 | } | |
1731 | ||
1732 | spftree_area_init(area); | |
1733 | ||
1734 | if (listcount(area->area_addrs) > 0) { | |
1735 | if (is_type & IS_LEVEL_1) | |
1736 | lsp_generate(area, IS_LEVEL_1); | |
1737 | if (is_type & IS_LEVEL_2) | |
1738 | lsp_generate(area, IS_LEVEL_2); | |
1739 | } | |
1740 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
1741 | ||
1742 | return; | |
eb5d44eb | 1743 | } |
1744 | ||
a38a72db CF |
1745 | void isis_area_metricstyle_set(struct isis_area *area, bool old_metric, |
1746 | bool new_metric) | |
e38e0df0 | 1747 | { |
d62a17ae | 1748 | if (area->oldmetric != old_metric || area->newmetric != new_metric) { |
1749 | area->oldmetric = old_metric; | |
1750 | area->newmetric = new_metric; | |
1751 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
1752 | } | |
e38e0df0 SV |
1753 | } |
1754 | ||
a38a72db | 1755 | void isis_area_overload_bit_set(struct isis_area *area, bool overload_bit) |
eb5d44eb | 1756 | { |
d62a17ae | 1757 | char new_overload_bit = overload_bit ? LSPBIT_OL : 0; |
eb5d44eb | 1758 | |
d62a17ae | 1759 | if (new_overload_bit != area->overload_bit) { |
1760 | area->overload_bit = new_overload_bit; | |
1761 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
1762 | } | |
3f045a08 JB |
1763 | } |
1764 | ||
a38a72db | 1765 | void isis_area_attached_bit_set(struct isis_area *area, bool attached_bit) |
3f045a08 | 1766 | { |
d62a17ae | 1767 | char new_attached_bit = attached_bit ? LSPBIT_ATT : 0; |
3f045a08 | 1768 | |
d62a17ae | 1769 | if (new_attached_bit != area->attached_bit) { |
1770 | area->attached_bit = new_attached_bit; | |
1771 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
1772 | } | |
eb5d44eb | 1773 | } |
1774 | ||
a38a72db | 1775 | void isis_area_dynhostname_set(struct isis_area *area, bool dynhostname) |
eb5d44eb | 1776 | { |
d62a17ae | 1777 | if (area->dynhostname != dynhostname) { |
1778 | area->dynhostname = dynhostname; | |
1779 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0); | |
1780 | } | |
eb5d44eb | 1781 | } |
1782 | ||
d62a17ae | 1783 | void isis_area_max_lsp_lifetime_set(struct isis_area *area, int level, |
1784 | uint16_t max_lsp_lifetime) | |
eb5d44eb | 1785 | { |
d62a17ae | 1786 | assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2)); |
eb5d44eb | 1787 | |
d62a17ae | 1788 | if (area->max_lsp_lifetime[level - 1] == max_lsp_lifetime) |
1789 | return; | |
3f045a08 | 1790 | |
d62a17ae | 1791 | area->max_lsp_lifetime[level - 1] = max_lsp_lifetime; |
1792 | lsp_regenerate_schedule(area, level, 1); | |
3f045a08 JB |
1793 | } |
1794 | ||
d62a17ae | 1795 | void isis_area_lsp_refresh_set(struct isis_area *area, int level, |
1796 | uint16_t lsp_refresh) | |
3f045a08 | 1797 | { |
d62a17ae | 1798 | assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2)); |
eb5d44eb | 1799 | |
d62a17ae | 1800 | if (area->lsp_refresh[level - 1] == lsp_refresh) |
1801 | return; | |
eb5d44eb | 1802 | |
d62a17ae | 1803 | area->lsp_refresh[level - 1] = lsp_refresh; |
1804 | lsp_regenerate_schedule(area, level, 1); | |
3f045a08 JB |
1805 | } |
1806 | ||
3f045a08 JB |
1807 | DEFUN (log_adj_changes, |
1808 | log_adj_changes_cmd, | |
1809 | "log-adjacency-changes", | |
1810 | "Log changes in adjacency state\n") | |
1811 | { | |
d62a17ae | 1812 | VTY_DECLVAR_CONTEXT(isis_area, area); |
eb5d44eb | 1813 | |
d62a17ae | 1814 | area->log_adj_changes = 1; |
eb5d44eb | 1815 | |
d62a17ae | 1816 | return CMD_SUCCESS; |
eb5d44eb | 1817 | } |
1818 | ||
3f045a08 JB |
1819 | DEFUN (no_log_adj_changes, |
1820 | no_log_adj_changes_cmd, | |
1821 | "no log-adjacency-changes", | |
d7fa34c1 | 1822 | NO_STR |
3f045a08 | 1823 | "Stop logging changes in adjacency state\n") |
eb5d44eb | 1824 | { |
d62a17ae | 1825 | VTY_DECLVAR_CONTEXT(isis_area, area); |
f390d2c7 | 1826 | |
d62a17ae | 1827 | area->log_adj_changes = 0; |
eb5d44eb | 1828 | |
d62a17ae | 1829 | return CMD_SUCCESS; |
eb5d44eb | 1830 | } |
1831 | ||
eb5d44eb | 1832 | /* IS-IS configuration write function */ |
d62a17ae | 1833 | int isis_config_write(struct vty *vty) |
1834 | { | |
1835 | int write = 0; | |
1836 | ||
1837 | if (isis != NULL) { | |
1838 | struct isis_area *area; | |
1839 | struct listnode *node, *node2; | |
1840 | ||
1841 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { | |
1842 | /* ISIS - Area name */ | |
7c0cbd0e | 1843 | vty_out(vty, "router " PROTO_NAME " %s\n", area->area_tag); |
d62a17ae | 1844 | write++; |
1845 | /* ISIS - Net */ | |
1846 | if (listcount(area->area_addrs) > 0) { | |
1847 | struct area_addr *area_addr; | |
1848 | for (ALL_LIST_ELEMENTS_RO(area->area_addrs, | |
1849 | node2, area_addr)) { | |
1850 | vty_out(vty, " net %s\n", | |
1851 | isonet_print( | |
1852 | area_addr->area_addr, | |
1853 | area_addr->addr_len | |
1854 | + ISIS_SYS_ID_LEN | |
1855 | + 1)); | |
1856 | write++; | |
1857 | } | |
1858 | } | |
1859 | /* ISIS - Dynamic hostname - Defaults to true so only | |
1860 | * display if | |
1861 | * false. */ | |
1862 | if (!area->dynhostname) { | |
1863 | vty_out(vty, " no hostname dynamic\n"); | |
1864 | write++; | |
1865 | } | |
1866 | /* ISIS - Metric-Style - when true displays wide */ | |
65f18157 CF |
1867 | if (!fabricd) { |
1868 | if (area->newmetric) { | |
1869 | if (!area->oldmetric) | |
1870 | vty_out(vty, " metric-style wide\n"); | |
1871 | else | |
1872 | vty_out(vty, | |
1873 | " metric-style transition\n"); | |
1874 | write++; | |
1875 | } else { | |
1876 | vty_out(vty, " metric-style narrow\n"); | |
1877 | write++; | |
1878 | } | |
d62a17ae | 1879 | } |
1880 | /* ISIS - overload-bit */ | |
1881 | if (area->overload_bit) { | |
1882 | vty_out(vty, " set-overload-bit\n"); | |
1883 | write++; | |
1884 | } | |
1885 | /* ISIS - Area is-type (level-1-2 is default) */ | |
65f18157 CF |
1886 | if (!fabricd) { |
1887 | if (area->is_type == IS_LEVEL_1) { | |
1888 | vty_out(vty, " is-type level-1\n"); | |
1889 | write++; | |
1890 | } else if (area->is_type == IS_LEVEL_2) { | |
1891 | vty_out(vty, " is-type level-2-only\n"); | |
1892 | write++; | |
1893 | } | |
d62a17ae | 1894 | } |
1895 | write += isis_redist_config_write(vty, area, AF_INET); | |
1896 | write += isis_redist_config_write(vty, area, AF_INET6); | |
1897 | /* ISIS - Lsp generation interval */ | |
1898 | if (area->lsp_gen_interval[0] | |
1899 | == area->lsp_gen_interval[1]) { | |
1900 | if (area->lsp_gen_interval[0] | |
1901 | != DEFAULT_MIN_LSP_GEN_INTERVAL) { | |
1902 | vty_out(vty, " lsp-gen-interval %d\n", | |
1903 | area->lsp_gen_interval[0]); | |
1904 | write++; | |
1905 | } | |
1906 | } else { | |
1907 | if (area->lsp_gen_interval[0] | |
1908 | != DEFAULT_MIN_LSP_GEN_INTERVAL) { | |
1909 | vty_out(vty, | |
1910 | " lsp-gen-interval level-1 %d\n", | |
1911 | area->lsp_gen_interval[0]); | |
1912 | write++; | |
1913 | } | |
1914 | if (area->lsp_gen_interval[1] | |
1915 | != DEFAULT_MIN_LSP_GEN_INTERVAL) { | |
1916 | vty_out(vty, | |
1917 | " lsp-gen-interval level-2 %d\n", | |
1918 | area->lsp_gen_interval[1]); | |
1919 | write++; | |
1920 | } | |
1921 | } | |
1922 | /* ISIS - LSP lifetime */ | |
1923 | if (area->max_lsp_lifetime[0] | |
1924 | == area->max_lsp_lifetime[1]) { | |
1925 | if (area->max_lsp_lifetime[0] | |
1926 | != DEFAULT_LSP_LIFETIME) { | |
1927 | vty_out(vty, " max-lsp-lifetime %u\n", | |
1928 | area->max_lsp_lifetime[0]); | |
1929 | write++; | |
1930 | } | |
1931 | } else { | |
1932 | if (area->max_lsp_lifetime[0] | |
1933 | != DEFAULT_LSP_LIFETIME) { | |
1934 | vty_out(vty, | |
1935 | " max-lsp-lifetime level-1 %u\n", | |
1936 | area->max_lsp_lifetime[0]); | |
1937 | write++; | |
1938 | } | |
1939 | if (area->max_lsp_lifetime[1] | |
1940 | != DEFAULT_LSP_LIFETIME) { | |
1941 | vty_out(vty, | |
1942 | " max-lsp-lifetime level-2 %u\n", | |
1943 | area->max_lsp_lifetime[1]); | |
1944 | write++; | |
1945 | } | |
1946 | } | |
1947 | /* ISIS - LSP refresh interval */ | |
1948 | if (area->lsp_refresh[0] == area->lsp_refresh[1]) { | |
1949 | if (area->lsp_refresh[0] | |
1950 | != DEFAULT_MAX_LSP_GEN_INTERVAL) { | |
1951 | vty_out(vty, | |
1952 | " lsp-refresh-interval %u\n", | |
1953 | area->lsp_refresh[0]); | |
1954 | write++; | |
1955 | } | |
1956 | } else { | |
1957 | if (area->lsp_refresh[0] | |
1958 | != DEFAULT_MAX_LSP_GEN_INTERVAL) { | |
1959 | vty_out(vty, | |
1960 | " lsp-refresh-interval level-1 %u\n", | |
1961 | area->lsp_refresh[0]); | |
1962 | write++; | |
1963 | } | |
1964 | if (area->lsp_refresh[1] | |
1965 | != DEFAULT_MAX_LSP_GEN_INTERVAL) { | |
1966 | vty_out(vty, | |
1967 | " lsp-refresh-interval level-2 %u\n", | |
1968 | area->lsp_refresh[1]); | |
1969 | write++; | |
1970 | } | |
1971 | } | |
1972 | if (area->lsp_mtu != DEFAULT_LSP_MTU) { | |
1973 | vty_out(vty, " lsp-mtu %u\n", area->lsp_mtu); | |
1974 | write++; | |
1975 | } | |
2c92bee4 CF |
1976 | if (area->purge_originator) { |
1977 | vty_out(vty, " purge-originator\n"); | |
1978 | write++; | |
1979 | } | |
d62a17ae | 1980 | |
1981 | /* Minimum SPF interval. */ | |
1982 | if (area->min_spf_interval[0] | |
1983 | == area->min_spf_interval[1]) { | |
1984 | if (area->min_spf_interval[0] | |
1985 | != MINIMUM_SPF_INTERVAL) { | |
1986 | vty_out(vty, " spf-interval %d\n", | |
1987 | area->min_spf_interval[0]); | |
1988 | write++; | |
1989 | } | |
1990 | } else { | |
1991 | if (area->min_spf_interval[0] | |
1992 | != MINIMUM_SPF_INTERVAL) { | |
1993 | vty_out(vty, | |
1994 | " spf-interval level-1 %d\n", | |
1995 | area->min_spf_interval[0]); | |
1996 | write++; | |
1997 | } | |
1998 | if (area->min_spf_interval[1] | |
1999 | != MINIMUM_SPF_INTERVAL) { | |
2000 | vty_out(vty, | |
2001 | " spf-interval level-2 %d\n", | |
2002 | area->min_spf_interval[1]); | |
2003 | write++; | |
2004 | } | |
2005 | } | |
2006 | ||
2007 | /* IETF SPF interval */ | |
2008 | if (area->spf_delay_ietf[0]) { | |
2009 | vty_out(vty, | |
2010 | " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n", | |
2011 | spf_backoff_init_delay( | |
2012 | area->spf_delay_ietf[0]), | |
2013 | spf_backoff_short_delay( | |
2014 | area->spf_delay_ietf[0]), | |
2015 | spf_backoff_long_delay( | |
2016 | area->spf_delay_ietf[0]), | |
2017 | spf_backoff_holddown( | |
2018 | area->spf_delay_ietf[0]), | |
2019 | spf_backoff_timetolearn( | |
2020 | area->spf_delay_ietf[0])); | |
2021 | write++; | |
2022 | } | |
2023 | ||
2024 | /* Authentication passwords. */ | |
2025 | if (area->area_passwd.type | |
2026 | == ISIS_PASSWD_TYPE_HMAC_MD5) { | |
2027 | vty_out(vty, " area-password md5 %s", | |
2028 | area->area_passwd.passwd); | |
2029 | if (CHECK_FLAG(area->area_passwd.snp_auth, | |
2030 | SNP_AUTH_SEND)) { | |
2031 | vty_out(vty, " authenticate snp "); | |
2032 | if (CHECK_FLAG( | |
2033 | area->area_passwd.snp_auth, | |
2034 | SNP_AUTH_RECV)) | |
2035 | vty_out(vty, "validate"); | |
2036 | else | |
2037 | vty_out(vty, "send-only"); | |
2038 | } | |
2039 | vty_out(vty, "\n"); | |
2040 | write++; | |
2041 | } else if (area->area_passwd.type | |
2042 | == ISIS_PASSWD_TYPE_CLEARTXT) { | |
2043 | vty_out(vty, " area-password clear %s", | |
2044 | area->area_passwd.passwd); | |
2045 | if (CHECK_FLAG(area->area_passwd.snp_auth, | |
2046 | SNP_AUTH_SEND)) { | |
2047 | vty_out(vty, " authenticate snp "); | |
2048 | if (CHECK_FLAG( | |
2049 | area->area_passwd.snp_auth, | |
2050 | SNP_AUTH_RECV)) | |
2051 | vty_out(vty, "validate"); | |
2052 | else | |
2053 | vty_out(vty, "send-only"); | |
2054 | } | |
2055 | vty_out(vty, "\n"); | |
2056 | write++; | |
2057 | } | |
2058 | if (area->domain_passwd.type | |
2059 | == ISIS_PASSWD_TYPE_HMAC_MD5) { | |
2060 | vty_out(vty, " domain-password md5 %s", | |
2061 | area->domain_passwd.passwd); | |
2062 | if (CHECK_FLAG(area->domain_passwd.snp_auth, | |
2063 | SNP_AUTH_SEND)) { | |
2064 | vty_out(vty, " authenticate snp "); | |
2065 | if (CHECK_FLAG(area->domain_passwd | |
2066 | .snp_auth, | |
2067 | SNP_AUTH_RECV)) | |
2068 | vty_out(vty, "validate"); | |
2069 | else | |
2070 | vty_out(vty, "send-only"); | |
2071 | } | |
2072 | vty_out(vty, "\n"); | |
2073 | write++; | |
2074 | } else if (area->domain_passwd.type | |
2075 | == ISIS_PASSWD_TYPE_CLEARTXT) { | |
2076 | vty_out(vty, " domain-password clear %s", | |
2077 | area->domain_passwd.passwd); | |
2078 | if (CHECK_FLAG(area->domain_passwd.snp_auth, | |
2079 | SNP_AUTH_SEND)) { | |
2080 | vty_out(vty, " authenticate snp "); | |
2081 | if (CHECK_FLAG(area->domain_passwd | |
2082 | .snp_auth, | |
2083 | SNP_AUTH_RECV)) | |
2084 | vty_out(vty, "validate"); | |
2085 | else | |
2086 | vty_out(vty, "send-only"); | |
2087 | } | |
2088 | vty_out(vty, "\n"); | |
2089 | write++; | |
2090 | } | |
2091 | ||
2092 | if (area->log_adj_changes) { | |
2093 | vty_out(vty, " log-adjacency-changes\n"); | |
2094 | write++; | |
2095 | } | |
2096 | ||
2097 | write += area_write_mt_settings(area, vty); | |
92ed0cde | 2098 | write += fabricd_write_settings(area, vty); |
d62a17ae | 2099 | } |
2100 | isis_mpls_te_config_write_router(vty); | |
2101 | } | |
2102 | ||
2103 | return write; | |
2104 | } | |
2105 | ||
7c0cbd0e | 2106 | struct cmd_node router_node = {ROUTER_NODE, "%s(config-router)# ", 1}; |
d62a17ae | 2107 | |
2108 | void isis_init() | |
2109 | { | |
2110 | /* Install IS-IS top node */ | |
7c0cbd0e | 2111 | install_node(&router_node, isis_config_write); |
d62a17ae | 2112 | |
2113 | install_element(VIEW_NODE, &show_isis_summary_cmd); | |
2114 | ||
2115 | install_element(VIEW_NODE, &show_isis_spf_ietf_cmd); | |
2116 | ||
2117 | install_element(VIEW_NODE, &show_isis_interface_cmd); | |
2118 | install_element(VIEW_NODE, &show_isis_interface_detail_cmd); | |
2119 | install_element(VIEW_NODE, &show_isis_interface_arg_cmd); | |
2120 | ||
2121 | install_element(VIEW_NODE, &show_isis_neighbor_cmd); | |
2122 | install_element(VIEW_NODE, &show_isis_neighbor_detail_cmd); | |
2123 | install_element(VIEW_NODE, &show_isis_neighbor_arg_cmd); | |
2124 | install_element(VIEW_NODE, &clear_isis_neighbor_cmd); | |
2125 | install_element(VIEW_NODE, &clear_isis_neighbor_arg_cmd); | |
2126 | ||
2127 | install_element(VIEW_NODE, &show_hostname_cmd); | |
2128 | install_element(VIEW_NODE, &show_database_cmd); | |
2129 | ||
2130 | install_element(ENABLE_NODE, &show_debugging_isis_cmd); | |
2131 | ||
2132 | install_node(&debug_node, config_write_debug); | |
2133 | ||
2134 | install_element(ENABLE_NODE, &debug_isis_adj_cmd); | |
2135 | install_element(ENABLE_NODE, &no_debug_isis_adj_cmd); | |
161fa356 CF |
2136 | install_element(ENABLE_NODE, &debug_isis_tx_queue_cmd); |
2137 | install_element(ENABLE_NODE, &no_debug_isis_tx_queue_cmd); | |
ddb33326 CF |
2138 | install_element(ENABLE_NODE, &debug_isis_flooding_cmd); |
2139 | install_element(ENABLE_NODE, &no_debug_isis_flooding_cmd); | |
d62a17ae | 2140 | install_element(ENABLE_NODE, &debug_isis_snp_cmd); |
2141 | install_element(ENABLE_NODE, &no_debug_isis_snp_cmd); | |
2142 | install_element(ENABLE_NODE, &debug_isis_upd_cmd); | |
2143 | install_element(ENABLE_NODE, &no_debug_isis_upd_cmd); | |
2144 | install_element(ENABLE_NODE, &debug_isis_spfevents_cmd); | |
2145 | install_element(ENABLE_NODE, &no_debug_isis_spfevents_cmd); | |
d62a17ae | 2146 | install_element(ENABLE_NODE, &debug_isis_rtevents_cmd); |
2147 | install_element(ENABLE_NODE, &no_debug_isis_rtevents_cmd); | |
2148 | install_element(ENABLE_NODE, &debug_isis_events_cmd); | |
2149 | install_element(ENABLE_NODE, &no_debug_isis_events_cmd); | |
2150 | install_element(ENABLE_NODE, &debug_isis_packet_dump_cmd); | |
2151 | install_element(ENABLE_NODE, &no_debug_isis_packet_dump_cmd); | |
2152 | install_element(ENABLE_NODE, &debug_isis_lsp_gen_cmd); | |
2153 | install_element(ENABLE_NODE, &no_debug_isis_lsp_gen_cmd); | |
2154 | install_element(ENABLE_NODE, &debug_isis_lsp_sched_cmd); | |
2155 | install_element(ENABLE_NODE, &no_debug_isis_lsp_sched_cmd); | |
2815f817 CF |
2156 | install_element(ENABLE_NODE, &debug_isis_bfd_cmd); |
2157 | install_element(ENABLE_NODE, &no_debug_isis_bfd_cmd); | |
d62a17ae | 2158 | |
2159 | install_element(CONFIG_NODE, &debug_isis_adj_cmd); | |
2160 | install_element(CONFIG_NODE, &no_debug_isis_adj_cmd); | |
161fa356 CF |
2161 | install_element(CONFIG_NODE, &debug_isis_tx_queue_cmd); |
2162 | install_element(CONFIG_NODE, &no_debug_isis_tx_queue_cmd); | |
ddb33326 CF |
2163 | install_element(CONFIG_NODE, &debug_isis_flooding_cmd); |
2164 | install_element(CONFIG_NODE, &no_debug_isis_flooding_cmd); | |
d62a17ae | 2165 | install_element(CONFIG_NODE, &debug_isis_snp_cmd); |
2166 | install_element(CONFIG_NODE, &no_debug_isis_snp_cmd); | |
2167 | install_element(CONFIG_NODE, &debug_isis_upd_cmd); | |
2168 | install_element(CONFIG_NODE, &no_debug_isis_upd_cmd); | |
2169 | install_element(CONFIG_NODE, &debug_isis_spfevents_cmd); | |
2170 | install_element(CONFIG_NODE, &no_debug_isis_spfevents_cmd); | |
d62a17ae | 2171 | install_element(CONFIG_NODE, &debug_isis_rtevents_cmd); |
2172 | install_element(CONFIG_NODE, &no_debug_isis_rtevents_cmd); | |
2173 | install_element(CONFIG_NODE, &debug_isis_events_cmd); | |
2174 | install_element(CONFIG_NODE, &no_debug_isis_events_cmd); | |
2175 | install_element(CONFIG_NODE, &debug_isis_packet_dump_cmd); | |
2176 | install_element(CONFIG_NODE, &no_debug_isis_packet_dump_cmd); | |
2177 | install_element(CONFIG_NODE, &debug_isis_lsp_gen_cmd); | |
2178 | install_element(CONFIG_NODE, &no_debug_isis_lsp_gen_cmd); | |
2179 | install_element(CONFIG_NODE, &debug_isis_lsp_sched_cmd); | |
2180 | install_element(CONFIG_NODE, &no_debug_isis_lsp_sched_cmd); | |
2815f817 CF |
2181 | install_element(CONFIG_NODE, &debug_isis_bfd_cmd); |
2182 | install_element(CONFIG_NODE, &no_debug_isis_bfd_cmd); | |
d62a17ae | 2183 | |
7c0cbd0e | 2184 | install_default(ROUTER_NODE); |
d62a17ae | 2185 | |
aaf2fd21 EDP |
2186 | #ifdef FABRICD |
2187 | install_element(CONFIG_NODE, &router_openfabric_cmd); | |
2188 | install_element(CONFIG_NODE, &no_router_openfabric_cmd); | |
2189 | #endif /* ifdef FABRICD */ | |
7c0cbd0e CF |
2190 | install_element(ROUTER_NODE, &net_cmd); |
2191 | install_element(ROUTER_NODE, &no_net_cmd); | |
d62a17ae | 2192 | |
7c0cbd0e CF |
2193 | install_element(ROUTER_NODE, &isis_topology_cmd); |
2194 | install_element(ROUTER_NODE, &no_isis_topology_cmd); | |
d62a17ae | 2195 | |
7c0cbd0e CF |
2196 | install_element(ROUTER_NODE, &log_adj_changes_cmd); |
2197 | install_element(ROUTER_NODE, &no_log_adj_changes_cmd); | |
d62a17ae | 2198 | |
2199 | spf_backoff_cmd_init(); | |
eb5d44eb | 2200 | } |