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