]>
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" |
65251ce8 | 38 | #include "zclient.h" |
eab88f36 | 39 | #include "vrf.h" |
03f7e182 | 40 | #include "spf_backoff.h" |
aaf2fd21 | 41 | #include "lib/northbound_cli.h" |
eb5d44eb | 42 | |
eb5d44eb | 43 | #include "isisd/isis_constants.h" |
44 | #include "isisd/isis_common.h" | |
eb5d44eb | 45 | #include "isisd/isis_flags.h" |
3f045a08 JB |
46 | #include "isisd/isis_circuit.h" |
47 | #include "isisd/isis_csm.h" | |
eb5d44eb | 48 | #include "isisd/isisd.h" |
49 | #include "isisd/isis_dynhn.h" | |
50 | #include "isisd/isis_adjacency.h" | |
51 | #include "isisd/isis_pdu.h" | |
52 | #include "isisd/isis_misc.h" | |
53 | #include "isisd/isis_constants.h" | |
eb5d44eb | 54 | #include "isisd/isis_lsp.h" |
55 | #include "isisd/isis_spf.h" | |
56 | #include "isisd/isis_route.h" | |
57 | #include "isisd/isis_zebra.h" | |
58 | #include "isisd/isis_events.h" | |
f8c06e2c | 59 | #include "isisd/isis_te.h" |
064f4896 | 60 | #include "isisd/isis_mt.h" |
26f6acaf | 61 | #include "isisd/isis_sr.h" |
8e6fb83b | 62 | #include "isisd/fabricd.h" |
2a1c520e | 63 | #include "isisd/isis_nb.h" |
eb5d44eb | 64 | |
e740f9c1 | 65 | /* For debug statement. */ |
66 | unsigned long debug_adj_pkt; | |
67 | unsigned long debug_snp_pkt; | |
68 | unsigned long debug_update_pkt; | |
69 | unsigned long debug_spf_events; | |
70 | unsigned long debug_rte_events; | |
71 | unsigned long debug_events; | |
72 | unsigned long debug_pkt_dump; | |
73 | unsigned long debug_lsp_gen; | |
74 | unsigned long debug_lsp_sched; | |
75 | unsigned long debug_flooding; | |
76 | unsigned long debug_bfd; | |
77 | unsigned long debug_tx_queue; | |
78 | unsigned long debug_sr; | |
1cbf96a8 | 79 | unsigned long debug_ldp_sync; |
c951ee6e | 80 | unsigned long debug_tilfa; |
e740f9c1 | 81 | |
676a4ea3 DL |
82 | DEFINE_QOBJ_TYPE(isis_area) |
83 | ||
eab88f36 K |
84 | /* ISIS process wide configuration. */ |
85 | static struct isis_master isis_master; | |
86 | ||
87 | /* ISIS process wide configuration pointer to export. */ | |
88 | struct isis_master *im; | |
89 | ||
41b36e90 PJ |
90 | /* |
91 | * Prototypes. | |
92 | */ | |
41b36e90 | 93 | int isis_area_get(struct vty *, const char *); |
3f045a08 JB |
94 | int area_net_title(struct vty *, const char *); |
95 | int area_clear_net_title(struct vty *, const char *); | |
eab88f36 K |
96 | int show_isis_interface_common(struct vty *, const char *ifname, char, |
97 | const char *vrf_name, bool all_vrf); | |
98 | int show_isis_neighbor_common(struct vty *, const char *id, char, | |
99 | const char *vrf_name, bool all_vrf); | |
100 | int clear_isis_neighbor_common(struct vty *, const char *id, const char *vrf_name, | |
101 | bool all_vrf); | |
102 | ||
103 | static void isis_add(struct isis *isis) | |
104 | { | |
105 | listnode_add(im->isis, isis); | |
106 | } | |
107 | ||
108 | static void isis_delete(struct isis *isis) | |
109 | { | |
110 | listnode_delete(im->isis, isis); | |
111 | } | |
112 | ||
113 | /* Link ISIS instance to VRF. */ | |
114 | void isis_vrf_link(struct isis *isis, struct vrf *vrf) | |
115 | { | |
116 | isis->vrf_id = vrf->vrf_id; | |
117 | if (vrf->info != (void *)isis) | |
118 | vrf->info = (void *)isis; | |
119 | } | |
120 | ||
121 | /* Unlink ISIS instance to VRF. */ | |
122 | void isis_vrf_unlink(struct isis *isis, struct vrf *vrf) | |
123 | { | |
124 | if (vrf->info == (void *)isis) | |
125 | vrf->info = NULL; | |
126 | isis->vrf_id = VRF_UNKNOWN; | |
127 | } | |
128 | ||
129 | struct isis *isis_lookup_by_vrfid(vrf_id_t vrf_id) | |
130 | { | |
36944791 RW |
131 | struct isis *isis; |
132 | struct listnode *node; | |
41b36e90 | 133 | |
36944791 | 134 | for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) |
eab88f36 K |
135 | if (isis->vrf_id == vrf_id) |
136 | return isis; | |
36944791 | 137 | |
eab88f36 K |
138 | return NULL; |
139 | } | |
140 | ||
141 | struct isis *isis_lookup_by_vrfname(const char *vrfname) | |
142 | { | |
36944791 RW |
143 | struct isis *isis; |
144 | struct listnode *node; | |
eab88f36 | 145 | |
36944791 | 146 | for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) |
eab88f36 K |
147 | if (isis->name && vrfname && strcmp(isis->name, vrfname) == 0) |
148 | return isis; | |
36944791 | 149 | |
eab88f36 K |
150 | return NULL; |
151 | } | |
152 | ||
36944791 | 153 | struct isis *isis_lookup_by_sysid(const uint8_t *sysid) |
eab88f36 | 154 | { |
36944791 RW |
155 | struct isis *isis; |
156 | struct listnode *node; | |
157 | ||
158 | for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) | |
eab88f36 K |
159 | if (!memcmp(isis->sysid, sysid, ISIS_SYS_ID_LEN)) |
160 | return isis; | |
36944791 | 161 | |
eab88f36 K |
162 | return NULL; |
163 | } | |
164 | ||
165 | void isis_master_init(struct thread_master *master) | |
166 | { | |
167 | memset(&isis_master, 0, sizeof(struct isis_master)); | |
168 | im = &isis_master; | |
169 | im->isis = list_new(); | |
170 | im->master = master; | |
171 | } | |
41b36e90 | 172 | |
65251ce8 | 173 | void isis_global_instance_create(const char *vrf_name) |
d62a17ae | 174 | { |
36944791 | 175 | struct isis *isis; |
eab88f36 | 176 | |
65251ce8 | 177 | isis = isis_lookup_by_vrfname(vrf_name); |
eab88f36 | 178 | if (isis == NULL) { |
65251ce8 | 179 | isis = isis_new(vrf_name); |
eab88f36 K |
180 | isis_add(isis); |
181 | } | |
182 | } | |
183 | ||
65251ce8 | 184 | struct isis *isis_new(const char *vrf_name) |
eab88f36 | 185 | { |
36944791 RW |
186 | struct vrf *vrf; |
187 | struct isis *isis; | |
eab88f36 | 188 | |
d62a17ae | 189 | isis = XCALLOC(MTYPE_ISIS, sizeof(struct isis)); |
65251ce8 | 190 | vrf = vrf_lookup_by_name(vrf_name); |
eab88f36 K |
191 | |
192 | if (vrf) { | |
65251ce8 | 193 | isis->vrf_id = vrf->vrf_id; |
eab88f36 K |
194 | isis_vrf_link(isis, vrf); |
195 | isis->name = XSTRDUP(MTYPE_ISIS, vrf->name); | |
65251ce8 | 196 | } else { |
197 | isis->vrf_id = VRF_UNKNOWN; | |
198 | isis->name = XSTRDUP(MTYPE_ISIS, vrf_name); | |
eab88f36 K |
199 | } |
200 | ||
201 | if (IS_DEBUG_EVENTS) | |
202 | zlog_debug( | |
203 | "%s: Create new isis instance with vrf_name %s vrf_id %u", | |
204 | __func__, isis->name, isis->vrf_id); | |
205 | ||
d62a17ae | 206 | /* |
207 | * Default values | |
208 | */ | |
209 | isis->max_area_addrs = 3; | |
eab88f36 | 210 | isis->process_id = getpid(); |
d62a17ae | 211 | isis->router_id = 0; |
212 | isis->area_list = list_new(); | |
213 | isis->init_circ_list = list_new(); | |
214 | isis->uptime = time(NULL); | |
eab88f36 K |
215 | dyn_cache_init(isis); |
216 | ||
217 | return isis; | |
d62a17ae | 218 | } |
219 | ||
eab88f36 | 220 | struct isis_area *isis_area_create(const char *area_tag, const char *vrf_name) |
d62a17ae | 221 | { |
222 | struct isis_area *area; | |
eab88f36 K |
223 | struct isis *isis = NULL; |
224 | struct vrf *vrf = NULL; | |
d62a17ae | 225 | area = XCALLOC(MTYPE_ISIS_AREA, sizeof(struct isis_area)); |
226 | ||
7b36d36e RW |
227 | if (vrf_name) { |
228 | vrf = vrf_lookup_by_name(vrf_name); | |
229 | if (vrf) { | |
230 | isis = isis_lookup_by_vrfid(vrf->vrf_id); | |
231 | if (isis == NULL) { | |
65251ce8 | 232 | isis = isis_new(vrf_name); |
233 | isis_add(isis); | |
234 | } | |
235 | } else { | |
236 | isis = isis_lookup_by_vrfid(VRF_UNKNOWN); | |
237 | if (isis == NULL) { | |
238 | isis = isis_new(vrf_name); | |
7b36d36e RW |
239 | isis_add(isis); |
240 | } | |
65251ce8 | 241 | } |
7b36d36e RW |
242 | } else { |
243 | isis = isis_lookup_by_vrfid(VRF_DEFAULT); | |
244 | if (isis == NULL) { | |
65251ce8 | 245 | isis = isis_new(VRF_DEFAULT_NAME); |
7b36d36e RW |
246 | isis_add(isis); |
247 | } | |
248 | } | |
249 | ||
250 | listnode_add(isis->area_list, area); | |
251 | area->isis = isis; | |
252 | ||
d62a17ae | 253 | /* |
65f18157 | 254 | * Fabricd runs only as level-2. |
26eb18e2 | 255 | * For IS-IS, the default is level-1-2 |
d62a17ae | 256 | */ |
26eb18e2 | 257 | if (fabricd) |
65f18157 | 258 | area->is_type = IS_LEVEL_2; |
cc50ddb2 EDP |
259 | else |
260 | area->is_type = yang_get_default_enum( | |
261 | "/frr-isisd:isis/instance/is-type"); | |
d62a17ae | 262 | |
263 | /* | |
264 | * intialize the databases | |
265 | */ | |
4bef0ec4 DL |
266 | if (area->is_type & IS_LEVEL_1) |
267 | lsp_db_init(&area->lspdb[0]); | |
268 | if (area->is_type & IS_LEVEL_2) | |
269 | lsp_db_init(&area->lspdb[1]); | |
d62a17ae | 270 | |
271 | spftree_area_init(area); | |
272 | ||
273 | area->circuit_list = list_new(); | |
75eddbc3 | 274 | area->adjacency_list = list_new(); |
d62a17ae | 275 | area->area_addrs = list_new(); |
52a7c25e RW |
276 | if (!CHECK_FLAG(im->options, F_ISIS_UNIT_TEST)) |
277 | thread_add_timer(master, lsp_tick, area, 1, &area->t_tick); | |
d62a17ae | 278 | flags_initialize(&area->flags); |
279 | ||
26f6acaf RW |
280 | isis_sr_area_init(area); |
281 | ||
d62a17ae | 282 | /* |
283 | * Default values | |
284 | */ | |
cc50ddb2 EDP |
285 | #ifndef FABRICD |
286 | enum isis_metric_style default_style; | |
287 | ||
288 | area->max_lsp_lifetime[0] = yang_get_default_uint16( | |
d2c970ff | 289 | "/frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime"); |
cc50ddb2 | 290 | area->max_lsp_lifetime[1] = yang_get_default_uint16( |
d2c970ff | 291 | "/frr-isisd:isis/instance/lsp/timers/level-2/maximum-lifetime"); |
cc50ddb2 | 292 | area->lsp_refresh[0] = yang_get_default_uint16( |
d2c970ff | 293 | "/frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval"); |
cc50ddb2 | 294 | area->lsp_refresh[1] = yang_get_default_uint16( |
d2c970ff | 295 | "/frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval"); |
cc50ddb2 | 296 | area->lsp_gen_interval[0] = yang_get_default_uint16( |
d2c970ff | 297 | "/frr-isisd:isis/instance/lsp/timers/level-1/generation-interval"); |
cc50ddb2 | 298 | area->lsp_gen_interval[1] = yang_get_default_uint16( |
d2c970ff | 299 | "/frr-isisd:isis/instance/lsp/timers/level-2/generation-interval"); |
cc50ddb2 EDP |
300 | area->min_spf_interval[0] = yang_get_default_uint16( |
301 | "/frr-isisd:isis/instance/spf/minimum-interval/level-1"); | |
302 | area->min_spf_interval[1] = yang_get_default_uint16( | |
303 | "/frr-isisd:isis/instance/spf/minimum-interval/level-1"); | |
304 | area->dynhostname = yang_get_default_bool( | |
305 | "/frr-isisd:isis/instance/dynamic-hostname"); | |
306 | default_style = | |
307 | yang_get_default_enum("/frr-isisd:isis/instance/metric-style"); | |
308 | area->oldmetric = default_style == ISIS_WIDE_METRIC ? 0 : 1; | |
309 | area->newmetric = default_style == ISIS_NARROW_METRIC ? 0 : 1; | |
310 | area->lsp_frag_threshold = 90; /* not currently configurable */ | |
311 | area->lsp_mtu = | |
312 | yang_get_default_uint16("/frr-isisd:isis/instance/lsp/mtu"); | |
313 | #else | |
d62a17ae | 314 | area->max_lsp_lifetime[0] = DEFAULT_LSP_LIFETIME; /* 1200 */ |
315 | area->max_lsp_lifetime[1] = DEFAULT_LSP_LIFETIME; /* 1200 */ | |
316 | area->lsp_refresh[0] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */ | |
317 | area->lsp_refresh[1] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */ | |
318 | area->lsp_gen_interval[0] = DEFAULT_MIN_LSP_GEN_INTERVAL; | |
319 | area->lsp_gen_interval[1] = DEFAULT_MIN_LSP_GEN_INTERVAL; | |
320 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; | |
321 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; | |
322 | area->dynhostname = 1; | |
323 | area->oldmetric = 0; | |
324 | area->newmetric = 1; | |
325 | area->lsp_frag_threshold = 90; | |
326 | area->lsp_mtu = DEFAULT_LSP_MTU; | |
cc50ddb2 | 327 | #endif /* ifndef FABRICD */ |
d62a17ae | 328 | |
329 | area_mt_init(area); | |
41b36e90 | 330 | |
d62a17ae | 331 | area->area_tag = strdup(area_tag); |
eab88f36 | 332 | |
8e6fb83b | 333 | if (fabricd) |
b30e837b | 334 | area->fabricd = fabricd_new(area); |
9196731f CF |
335 | |
336 | area->lsp_refresh_arg[0].area = area; | |
337 | area->lsp_refresh_arg[0].level = IS_LEVEL_1; | |
338 | area->lsp_refresh_arg[1].area = area; | |
339 | area->lsp_refresh_arg[1].level = IS_LEVEL_2; | |
340 | ||
690497fb G |
341 | area->bfd_signalled_down = false; |
342 | area->bfd_force_spf_refresh = false; | |
343 | ||
9196731f | 344 | |
d62a17ae | 345 | QOBJ_REG(area, isis_area); |
eb5d44eb | 346 | |
d62a17ae | 347 | return area; |
348 | } | |
3f045a08 | 349 | |
65251ce8 | 350 | struct isis_area *isis_area_lookup_by_vrf(const char *area_tag, |
351 | const char *vrf_name) | |
352 | { | |
353 | struct isis_area *area; | |
354 | struct listnode *node; | |
355 | struct isis *isis = NULL; | |
356 | ||
357 | isis = isis_lookup_by_vrfname(vrf_name); | |
358 | if (isis == NULL) | |
359 | return NULL; | |
360 | ||
361 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) | |
362 | if (strcmp(area->area_tag, area_tag) == 0) | |
363 | return area; | |
364 | ||
365 | return NULL; | |
366 | } | |
367 | ||
eab88f36 | 368 | struct isis_area *isis_area_lookup(const char *area_tag, vrf_id_t vrf_id) |
d62a17ae | 369 | { |
370 | struct isis_area *area; | |
371 | struct listnode *node; | |
36944791 | 372 | struct isis *isis; |
eab88f36 K |
373 | |
374 | isis = isis_lookup_by_vrfid(vrf_id); | |
375 | if (isis == NULL) | |
376 | return NULL; | |
3f045a08 | 377 | |
d62a17ae | 378 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) |
379 | if ((area->area_tag == NULL && area_tag == NULL) | |
380 | || (area->area_tag && area_tag | |
381 | && strcmp(area->area_tag, area_tag) == 0)) | |
382 | return area; | |
3f045a08 | 383 | |
d62a17ae | 384 | return NULL; |
385 | } | |
3f045a08 | 386 | |
d62a17ae | 387 | int isis_area_get(struct vty *vty, const char *area_tag) |
388 | { | |
389 | struct isis_area *area; | |
5475ecf7 | 390 | |
eab88f36 | 391 | area = isis_area_lookup(area_tag, VRF_DEFAULT); |
03f7e182 | 392 | |
d62a17ae | 393 | if (area) { |
7c0cbd0e | 394 | VTY_PUSH_CONTEXT(ROUTER_NODE, area); |
d62a17ae | 395 | return CMD_SUCCESS; |
396 | } | |
397 | ||
eab88f36 | 398 | area = isis_area_create(area_tag, VRF_DEFAULT_NAME); |
3f045a08 | 399 | |
e740f9c1 | 400 | if (IS_DEBUG_EVENTS) |
d62a17ae | 401 | zlog_debug("New IS-IS area instance %s", area->area_tag); |
3f045a08 | 402 | |
7c0cbd0e | 403 | VTY_PUSH_CONTEXT(ROUTER_NODE, area); |
f3ccedaa | 404 | |
d62a17ae | 405 | return CMD_SUCCESS; |
406 | } | |
3f045a08 | 407 | |
14c6e772 | 408 | void isis_area_destroy(struct isis_area *area) |
eb5d44eb | 409 | { |
d62a17ae | 410 | struct listnode *node, *nnode; |
411 | struct isis_circuit *circuit; | |
412 | struct area_addr *addr; | |
eb5d44eb | 413 | |
d62a17ae | 414 | QOBJ_UNREG(area); |
415 | ||
b30e837b CF |
416 | if (fabricd) |
417 | fabricd_finish(area->fabricd); | |
418 | ||
2e2a8b91 OD |
419 | /* Disable MPLS if necessary before flooding LSP */ |
420 | if (IS_MPLS_TE(area->mta)) | |
421 | area->mta->status = disable; | |
422 | ||
d62a17ae | 423 | if (area->circuit_list) { |
424 | for (ALL_LIST_ELEMENTS(area->circuit_list, node, nnode, | |
425 | circuit)) { | |
426 | circuit->ip_router = 0; | |
427 | circuit->ipv6_router = 0; | |
428 | isis_csm_state_change(ISIS_DISABLE, circuit, area); | |
429 | } | |
6a154c88 | 430 | list_delete(&area->circuit_list); |
d62a17ae | 431 | } |
75eddbc3 | 432 | list_delete(&area->adjacency_list); |
d62a17ae | 433 | |
4bef0ec4 DL |
434 | lsp_db_fini(&area->lspdb[0]); |
435 | lsp_db_fini(&area->lspdb[1]); | |
d62a17ae | 436 | |
3dace42d | 437 | /* invalidate and verify to delete all routes from zebra */ |
688ea1cb | 438 | isis_area_invalidate_routes(area, area->is_type); |
3dace42d CF |
439 | isis_area_verify_routes(area); |
440 | ||
26f6acaf RW |
441 | isis_sr_area_term(area); |
442 | ||
d62a17ae | 443 | spftree_area_del(area); |
444 | ||
50478845 MS |
445 | thread_cancel(&area->spf_timer[0]); |
446 | thread_cancel(&area->spf_timer[1]); | |
d62a17ae | 447 | |
448 | spf_backoff_free(area->spf_delay_ietf[0]); | |
449 | spf_backoff_free(area->spf_delay_ietf[1]); | |
450 | ||
52a7c25e RW |
451 | if (!CHECK_FLAG(im->options, F_ISIS_UNIT_TEST)) |
452 | isis_redist_area_finish(area); | |
d62a17ae | 453 | |
454 | for (ALL_LIST_ELEMENTS(area->area_addrs, node, nnode, addr)) { | |
455 | list_delete_node(area->area_addrs, node); | |
456 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
457 | } | |
458 | area->area_addrs = NULL; | |
459 | ||
50478845 MS |
460 | thread_cancel(&area->t_tick); |
461 | thread_cancel(&area->t_lsp_refresh[0]); | |
462 | thread_cancel(&area->t_lsp_refresh[1]); | |
d62a17ae | 463 | |
464 | thread_cancel_event(master, area); | |
465 | ||
eab88f36 | 466 | listnode_delete(area->isis->area_list, area); |
d62a17ae | 467 | |
468 | free(area->area_tag); | |
469 | ||
470 | area_mt_finish(area); | |
471 | ||
eab88f36 K |
472 | if (listcount(area->isis->area_list) == 0) { |
473 | memset(area->isis->sysid, 0, ISIS_SYS_ID_LEN); | |
474 | area->isis->sysid_set = 0; | |
475 | } | |
476 | ||
d62a17ae | 477 | XFREE(MTYPE_ISIS_AREA, area); |
478 | ||
eab88f36 K |
479 | } |
480 | ||
65251ce8 | 481 | /* This is hook function for vrf create called as part of vrf_init */ |
482 | static int isis_vrf_new(struct vrf *vrf) | |
483 | { | |
484 | if (IS_DEBUG_EVENTS) | |
485 | zlog_debug("%s: VRF Created: %s(%u)", __func__, vrf->name, | |
486 | vrf->vrf_id); | |
487 | ||
488 | return 0; | |
489 | } | |
490 | ||
491 | /* This is hook function for vrf delete call as part of vrf_init */ | |
492 | static int isis_vrf_delete(struct vrf *vrf) | |
493 | { | |
494 | if (IS_DEBUG_EVENTS) | |
495 | zlog_debug("%s: VRF Deletion: %s(%u)", __func__, vrf->name, | |
496 | vrf->vrf_id); | |
497 | ||
498 | return 0; | |
499 | } | |
500 | ||
501 | static int isis_vrf_enable(struct vrf *vrf) | |
502 | { | |
503 | struct isis *isis; | |
504 | vrf_id_t old_vrf_id; | |
505 | ||
506 | if (IS_DEBUG_EVENTS) | |
507 | zlog_debug("%s: VRF %s id %u enabled", __func__, vrf->name, | |
508 | vrf->vrf_id); | |
509 | ||
510 | isis = isis_lookup_by_vrfname(vrf->name); | |
511 | if (isis) { | |
512 | if (isis->name && strmatch(vrf->name, VRF_DEFAULT_NAME)) { | |
513 | XFREE(MTYPE_ISIS, isis->name); | |
514 | isis->name = NULL; | |
515 | } | |
516 | old_vrf_id = isis->vrf_id; | |
517 | /* We have instance configured, link to VRF and make it "up". */ | |
518 | isis_vrf_link(isis, vrf); | |
519 | if (IS_DEBUG_EVENTS) | |
520 | zlog_debug( | |
521 | "%s: isis linked to vrf %s vrf_id %u (old id %u)", | |
522 | __func__, vrf->name, isis->vrf_id, old_vrf_id); | |
523 | if (old_vrf_id != isis->vrf_id) { | |
524 | frr_with_privs (&isisd_privs) { | |
525 | /* stop zebra redist to us for old vrf */ | |
526 | zclient_send_dereg_requests(zclient, | |
527 | old_vrf_id); | |
528 | /* start zebra redist to us for new vrf */ | |
529 | isis_zebra_vrf_register(isis); | |
530 | } | |
531 | } | |
532 | } | |
533 | ||
534 | return 0; | |
535 | } | |
536 | ||
537 | static int isis_vrf_disable(struct vrf *vrf) | |
538 | { | |
539 | struct isis *isis; | |
540 | vrf_id_t old_vrf_id = VRF_UNKNOWN; | |
541 | ||
542 | if (vrf->vrf_id == VRF_DEFAULT) | |
543 | return 0; | |
544 | ||
545 | if (IS_DEBUG_EVENTS) | |
546 | zlog_debug("%s: VRF %s id %d disabled.", __func__, vrf->name, | |
547 | vrf->vrf_id); | |
548 | isis = isis_lookup_by_vrfname(vrf->name); | |
549 | if (isis) { | |
550 | old_vrf_id = isis->vrf_id; | |
551 | ||
552 | /* We have instance configured, unlink | |
553 | * from VRF and make it "down". | |
554 | */ | |
555 | isis_vrf_unlink(isis, vrf); | |
556 | if (IS_DEBUG_EVENTS) | |
557 | zlog_debug("%s: isis old_vrf_id %d unlinked", __func__, | |
558 | old_vrf_id); | |
559 | } | |
560 | ||
561 | return 0; | |
562 | } | |
563 | ||
564 | void isis_vrf_init(void) | |
565 | { | |
566 | vrf_init(isis_vrf_new, isis_vrf_enable, isis_vrf_disable, | |
567 | isis_vrf_delete, isis_vrf_enable); | |
568 | } | |
569 | ||
eab88f36 K |
570 | void isis_finish(struct isis *isis) |
571 | { | |
572 | struct vrf *vrf = NULL; | |
573 | ||
574 | isis_delete(isis); | |
575 | if (isis->name) { | |
576 | vrf = vrf_lookup_by_name(isis->name); | |
577 | if (vrf) | |
578 | isis_vrf_unlink(isis, vrf); | |
579 | XFREE(MTYPE_ISIS, isis->name); | |
580 | } else { | |
581 | vrf = vrf_lookup_by_id(VRF_DEFAULT); | |
582 | if (vrf) | |
583 | isis_vrf_unlink(isis, vrf); | |
d62a17ae | 584 | } |
eab88f36 | 585 | |
e76731cf DS |
586 | list_delete(&isis->area_list); |
587 | list_delete(&isis->init_circ_list); | |
eab88f36 K |
588 | XFREE(MTYPE_ISIS, isis); |
589 | } | |
590 | ||
591 | void isis_terminate() | |
592 | { | |
36944791 | 593 | struct isis *isis; |
eab88f36 K |
594 | struct listnode *node, *nnode; |
595 | ||
596 | if (listcount(im->isis) == 0) | |
597 | return; | |
598 | ||
599 | for (ALL_LIST_ELEMENTS(im->isis, node, nnode, isis)) | |
600 | isis_finish(isis); | |
d62a17ae | 601 | } |
602 | ||
22af6a80 | 603 | #ifdef FABRICD |
d62a17ae | 604 | static void area_set_mt_enabled(struct isis_area *area, uint16_t mtid, |
605 | bool enabled) | |
606 | { | |
607 | struct isis_area_mt_setting *setting; | |
608 | ||
609 | setting = area_get_mt_setting(area, mtid); | |
610 | if (setting->enabled != enabled) { | |
611 | setting->enabled = enabled; | |
612 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0); | |
613 | } | |
614 | } | |
615 | ||
616 | static void area_set_mt_overload(struct isis_area *area, uint16_t mtid, | |
617 | bool overload) | |
618 | { | |
619 | struct isis_area_mt_setting *setting; | |
620 | ||
621 | setting = area_get_mt_setting(area, mtid); | |
622 | if (setting->overload != overload) { | |
623 | setting->overload = overload; | |
624 | if (setting->enabled) | |
625 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, | |
626 | 0); | |
627 | } | |
628 | } | |
22af6a80 | 629 | #endif /* ifdef FABRICD */ |
d62a17ae | 630 | |
631 | int area_net_title(struct vty *vty, const char *net_title) | |
632 | { | |
633 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
634 | struct area_addr *addr; | |
635 | struct area_addr *addrp; | |
636 | struct listnode *node; | |
eb5d44eb | 637 | |
d7c0a89a | 638 | uint8_t buff[255]; |
d62a17ae | 639 | |
640 | /* We check that we are not over the maximal number of addresses */ | |
eab88f36 | 641 | if (listcount(area->area_addrs) >= area->isis->max_area_addrs) { |
d62a17ae | 642 | vty_out(vty, |
643 | "Maximum of area addresses (%d) already reached \n", | |
eab88f36 | 644 | area->isis->max_area_addrs); |
d62a17ae | 645 | return CMD_ERR_NOTHING_TODO; |
646 | } | |
647 | ||
648 | addr = XMALLOC(MTYPE_ISIS_AREA_ADDR, sizeof(struct area_addr)); | |
649 | addr->addr_len = dotformat2buff(buff, net_title); | |
650 | memcpy(addr->area_addr, buff, addr->addr_len); | |
eb5d44eb | 651 | #ifdef EXTREME_DEBUG |
d62a17ae | 652 | zlog_debug("added area address %s for area %s (address length %d)", |
653 | net_title, area->area_tag, addr->addr_len); | |
eb5d44eb | 654 | #endif /* EXTREME_DEBUG */ |
d62a17ae | 655 | if (addr->addr_len < 8 || addr->addr_len > 20) { |
656 | vty_out(vty, | |
657 | "area address must be at least 8..20 octets long (%d)\n", | |
658 | addr->addr_len); | |
659 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
a5fdb4c5 | 660 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 661 | } |
662 | ||
663 | if (addr->area_addr[addr->addr_len - 1] != 0) { | |
664 | vty_out(vty, | |
665 | "nsel byte (last byte) in area address must be 0\n"); | |
666 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
a5fdb4c5 | 667 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 668 | } |
669 | ||
eab88f36 | 670 | if (area->isis->sysid_set == 0) { |
d62a17ae | 671 | /* |
672 | * First area address - get the SystemID for this router | |
673 | */ | |
eab88f36 K |
674 | memcpy(area->isis->sysid, GETSYSID(addr), ISIS_SYS_ID_LEN); |
675 | area->isis->sysid_set = 1; | |
e740f9c1 | 676 | if (IS_DEBUG_EVENTS) |
d62a17ae | 677 | zlog_debug("Router has SystemID %s", |
eab88f36 | 678 | sysid_print(area->isis->sysid)); |
d62a17ae | 679 | } else { |
680 | /* | |
681 | * Check that the SystemID portions match | |
682 | */ | |
eab88f36 K |
683 | if (memcmp(area->isis->sysid, GETSYSID(addr), |
684 | ISIS_SYS_ID_LEN)) { | |
d62a17ae | 685 | vty_out(vty, |
686 | "System ID must not change when defining additional area addresses\n"); | |
687 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
a5fdb4c5 | 688 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 689 | } |
690 | ||
691 | /* now we see that we don't already have this address */ | |
692 | for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node, addrp)) { | |
693 | if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN) | |
694 | != (addr->addr_len)) | |
695 | continue; | |
696 | if (!memcmp(addrp->area_addr, addr->area_addr, | |
697 | addr->addr_len)) { | |
698 | XFREE(MTYPE_ISIS_AREA_ADDR, addr); | |
699 | return CMD_SUCCESS; /* silent fail */ | |
700 | } | |
701 | } | |
702 | } | |
703 | ||
704 | /* | |
705 | * Forget the systemID part of the address | |
706 | */ | |
707 | addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN); | |
708 | listnode_add(area->area_addrs, addr); | |
709 | ||
710 | /* only now we can safely generate our LSPs for this area */ | |
711 | if (listcount(area->area_addrs) > 0) { | |
712 | if (area->is_type & IS_LEVEL_1) | |
713 | lsp_generate(area, IS_LEVEL_1); | |
714 | if (area->is_type & IS_LEVEL_2) | |
715 | lsp_generate(area, IS_LEVEL_2); | |
716 | } | |
717 | ||
718 | return CMD_SUCCESS; | |
719 | } | |
720 | ||
721 | int area_clear_net_title(struct vty *vty, const char *net_title) | |
722 | { | |
723 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
724 | struct area_addr addr, *addrp = NULL; | |
725 | struct listnode *node; | |
d7c0a89a | 726 | uint8_t buff[255]; |
d62a17ae | 727 | |
728 | addr.addr_len = dotformat2buff(buff, net_title); | |
729 | if (addr.addr_len < 8 || addr.addr_len > 20) { | |
730 | vty_out(vty, | |
731 | "Unsupported area address length %d, should be 8...20 \n", | |
732 | addr.addr_len); | |
a5fdb4c5 | 733 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 734 | } |
735 | ||
736 | memcpy(addr.area_addr, buff, (int)addr.addr_len); | |
737 | ||
738 | for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node, addrp)) | |
739 | if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len | |
740 | && !memcmp(addrp->area_addr, addr.area_addr, addr.addr_len)) | |
741 | break; | |
742 | ||
743 | if (!addrp) { | |
744 | vty_out(vty, "No area address %s for area %s \n", net_title, | |
745 | area->area_tag); | |
746 | return CMD_ERR_NO_MATCH; | |
747 | } | |
748 | ||
749 | listnode_delete(area->area_addrs, addrp); | |
750 | XFREE(MTYPE_ISIS_AREA_ADDR, addrp); | |
751 | ||
752 | /* | |
753 | * Last area address - reset the SystemID for this router | |
754 | */ | |
755 | if (listcount(area->area_addrs) == 0) { | |
eab88f36 K |
756 | memset(area->isis->sysid, 0, ISIS_SYS_ID_LEN); |
757 | area->isis->sysid_set = 0; | |
e740f9c1 | 758 | if (IS_DEBUG_EVENTS) |
d62a17ae | 759 | zlog_debug("Router has no SystemID"); |
760 | } | |
761 | ||
762 | return CMD_SUCCESS; | |
eb5d44eb | 763 | } |
764 | ||
eb5d44eb | 765 | /* |
3f045a08 | 766 | * 'show isis interface' command |
eb5d44eb | 767 | */ |
768 | ||
eab88f36 K |
769 | int show_isis_interface_common(struct vty *vty, const char *ifname, char detail, |
770 | const char *vrf_name, bool all_vrf) | |
eb5d44eb | 771 | { |
36944791 | 772 | struct listnode *anode, *cnode, *inode; |
d62a17ae | 773 | struct isis_area *area; |
774 | struct isis_circuit *circuit; | |
36944791 | 775 | struct isis *isis; |
eb5d44eb | 776 | |
eab88f36 | 777 | if (!im) { |
d62a17ae | 778 | vty_out(vty, "IS-IS Routing Process not enabled\n"); |
779 | return CMD_SUCCESS; | |
780 | } | |
eab88f36 K |
781 | if (vrf_name) { |
782 | if (all_vrf) { | |
36944791 | 783 | for (ALL_LIST_ELEMENTS_RO(im->isis, inode, isis)) { |
eab88f36 K |
784 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, |
785 | anode, area)) { | |
786 | vty_out(vty, "Area %s:\n", | |
787 | area->area_tag); | |
788 | ||
789 | if (detail == ISIS_UI_LEVEL_BRIEF) | |
790 | vty_out(vty, | |
791 | " Interface CircId State Type Level\n"); | |
792 | ||
793 | for (ALL_LIST_ELEMENTS_RO( | |
794 | area->circuit_list, cnode, | |
795 | circuit)) | |
796 | if (!ifname) | |
797 | isis_circuit_print_vty( | |
798 | circuit, vty, | |
799 | detail); | |
800 | else if (strcmp(circuit->interface->name, ifname) == 0) | |
801 | isis_circuit_print_vty( | |
802 | circuit, vty, | |
803 | detail); | |
804 | } | |
805 | } | |
36944791 | 806 | return CMD_SUCCESS; |
eab88f36 K |
807 | } |
808 | isis = isis_lookup_by_vrfname(vrf_name); | |
809 | if (isis != NULL) { | |
810 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, | |
811 | area)) { | |
812 | vty_out(vty, "Area %s:\n", area->area_tag); | |
eb5d44eb | 813 | |
eab88f36 K |
814 | if (detail == ISIS_UI_LEVEL_BRIEF) |
815 | vty_out(vty, | |
816 | " Interface CircId State Type Level\n"); | |
817 | ||
818 | for (ALL_LIST_ELEMENTS_RO(area->circuit_list, | |
819 | cnode, circuit)) | |
820 | if (!ifname) | |
821 | isis_circuit_print_vty( | |
822 | circuit, vty, detail); | |
823 | else if ( | |
824 | strcmp(circuit->interface->name, | |
825 | ifname) | |
826 | == 0) | |
827 | isis_circuit_print_vty( | |
828 | circuit, vty, detail); | |
829 | } | |
830 | } | |
d62a17ae | 831 | } |
f390d2c7 | 832 | |
d62a17ae | 833 | return CMD_SUCCESS; |
eb5d44eb | 834 | } |
835 | ||
eab88f36 K |
836 | DEFUN(show_isis_interface, |
837 | show_isis_interface_cmd, | |
838 | "show " PROTO_NAME " [vrf <NAME|all>] interface", | |
839 | SHOW_STR | |
840 | PROTO_HELP | |
841 | VRF_CMD_HELP_STR | |
842 | "All VRFs\n" | |
843 | "IS-IS interface\n") | |
eb5d44eb | 844 | { |
eab88f36 K |
845 | const char *vrf_name = VRF_DEFAULT_NAME; |
846 | bool all_vrf = false; | |
847 | int idx_vrf = 0; | |
848 | ||
849 | ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); | |
850 | return show_isis_interface_common(vty, NULL, ISIS_UI_LEVEL_BRIEF, | |
851 | vrf_name, all_vrf); | |
eb5d44eb | 852 | } |
853 | ||
eab88f36 K |
854 | DEFUN(show_isis_interface_detail, |
855 | show_isis_interface_detail_cmd, | |
856 | "show " PROTO_NAME " [vrf <NAME|all>] interface detail", | |
857 | SHOW_STR | |
858 | PROTO_HELP | |
859 | VRF_CMD_HELP_STR | |
860 | "All VRFs\n" | |
861 | "IS-IS interface\n" | |
862 | "show detailed information\n") | |
3f045a08 | 863 | { |
eab88f36 K |
864 | const char *vrf_name = VRF_DEFAULT_NAME; |
865 | bool all_vrf = false; | |
866 | int idx_vrf = 0; | |
867 | ||
868 | ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); | |
869 | return show_isis_interface_common(vty, NULL, ISIS_UI_LEVEL_DETAIL, | |
870 | vrf_name, all_vrf); | |
3f045a08 | 871 | } |
eb5d44eb | 872 | |
eab88f36 K |
873 | DEFUN(show_isis_interface_arg, |
874 | show_isis_interface_arg_cmd, | |
875 | "show " PROTO_NAME " [vrf <NAME|all>] interface WORD", | |
876 | SHOW_STR | |
877 | PROTO_HELP | |
878 | VRF_CMD_HELP_STR | |
879 | "All VRFs\n" | |
880 | "IS-IS interface\n" | |
881 | "IS-IS interface name\n") | |
3f045a08 | 882 | { |
eab88f36 K |
883 | int idx_word = 0; |
884 | const char *vrf_name = VRF_DEFAULT_NAME; | |
885 | bool all_vrf = false; | |
886 | int idx_vrf = 0; | |
3f045a08 | 887 | |
eab88f36 K |
888 | ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); |
889 | ||
890 | char *ifname = argv_find(argv, argc, "WORD", &idx_word) | |
891 | ? argv[idx_word]->arg | |
892 | : NULL; | |
893 | return show_isis_interface_common(vty, ifname, ISIS_UI_LEVEL_DETAIL, | |
894 | vrf_name, all_vrf); | |
895 | } | |
3f045a08 | 896 | |
eab88f36 K |
897 | static void isis_neighbor_common(struct vty *vty, const char *id, char detail, |
898 | struct isis *isis, uint8_t *sysid) | |
d62a17ae | 899 | { |
900 | struct listnode *anode, *cnode, *node; | |
901 | struct isis_area *area; | |
902 | struct isis_circuit *circuit; | |
903 | struct list *adjdb; | |
904 | struct isis_adjacency *adj; | |
d62a17ae | 905 | int i; |
906 | ||
d62a17ae | 907 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) { |
908 | vty_out(vty, "Area %s:\n", area->area_tag); | |
909 | ||
910 | if (detail == ISIS_UI_LEVEL_BRIEF) | |
911 | vty_out(vty, | |
912 | " System Id Interface L State Holdtime SNPA\n"); | |
913 | ||
914 | for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) { | |
915 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) { | |
916 | for (i = 0; i < 2; i++) { | |
917 | adjdb = circuit->u.bc.adjdb[i]; | |
918 | if (adjdb && adjdb->count) { | |
919 | for (ALL_LIST_ELEMENTS_RO( | |
920 | adjdb, node, adj)) | |
921 | if (!id | |
eab88f36 K |
922 | || !memcmp( |
923 | adj->sysid, | |
924 | sysid, | |
925 | ISIS_SYS_ID_LEN)) | |
d62a17ae | 926 | isis_adj_print_vty( |
927 | adj, | |
928 | vty, | |
929 | detail); | |
930 | } | |
931 | } | |
932 | } else if (circuit->circ_type == CIRCUIT_T_P2P | |
933 | && circuit->u.p2p.neighbor) { | |
934 | adj = circuit->u.p2p.neighbor; | |
935 | if (!id | |
936 | || !memcmp(adj->sysid, sysid, | |
937 | ISIS_SYS_ID_LEN)) | |
938 | isis_adj_print_vty(adj, vty, detail); | |
939 | } | |
940 | } | |
941 | } | |
942 | ||
3f045a08 | 943 | } |
3f045a08 | 944 | /* |
eab88f36 | 945 | * 'show isis neighbor' command |
3f045a08 | 946 | */ |
eab88f36 K |
947 | |
948 | int show_isis_neighbor_common(struct vty *vty, const char *id, char detail, | |
949 | const char *vrf_name, bool all_vrf) | |
d62a17ae | 950 | { |
36944791 | 951 | struct listnode *node; |
d62a17ae | 952 | struct isis_dynhn *dynhn; |
d7c0a89a | 953 | uint8_t sysid[ISIS_SYS_ID_LEN]; |
36944791 | 954 | struct isis *isis; |
d62a17ae | 955 | |
eab88f36 | 956 | if (!im) { |
d62a17ae | 957 | vty_out(vty, "IS-IS Routing Process not enabled\n"); |
958 | return CMD_SUCCESS; | |
959 | } | |
960 | ||
961 | memset(sysid, 0, ISIS_SYS_ID_LEN); | |
962 | if (id) { | |
963 | if (sysid2buff(sysid, id) == 0) { | |
964 | dynhn = dynhn_find_by_name(id); | |
965 | if (dynhn == NULL) { | |
966 | vty_out(vty, "Invalid system id %s\n", id); | |
967 | return CMD_SUCCESS; | |
968 | } | |
969 | memcpy(sysid, dynhn->id, ISIS_SYS_ID_LEN); | |
970 | } | |
971 | } | |
972 | ||
eab88f36 K |
973 | if (vrf_name) { |
974 | if (all_vrf) { | |
36944791 | 975 | for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) { |
eab88f36 K |
976 | isis_neighbor_common(vty, id, detail, isis, |
977 | sysid); | |
978 | } | |
36944791 | 979 | return CMD_SUCCESS; |
eab88f36 K |
980 | } |
981 | isis = isis_lookup_by_vrfname(vrf_name); | |
982 | if (isis != NULL) | |
983 | isis_neighbor_common(vty, id, detail, isis, sysid); | |
984 | } | |
985 | ||
986 | return CMD_SUCCESS; | |
987 | } | |
988 | ||
989 | static void isis_neighbor_common_clear(struct vty *vty, const char *id, | |
990 | uint8_t *sysid, struct isis *isis) | |
991 | { | |
36944791 | 992 | struct listnode *anode, *cnode, *node, *nnode; |
eab88f36 K |
993 | struct isis_area *area; |
994 | struct isis_circuit *circuit; | |
995 | struct list *adjdb; | |
996 | struct isis_adjacency *adj; | |
997 | int i; | |
998 | ||
d62a17ae | 999 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) { |
36944791 | 1000 | for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) { |
d62a17ae | 1001 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) { |
1002 | for (i = 0; i < 2; i++) { | |
1003 | adjdb = circuit->u.bc.adjdb[i]; | |
1004 | if (adjdb && adjdb->count) { | |
1005 | for (ALL_LIST_ELEMENTS( | |
1006 | adjdb, node, nnode, | |
1007 | adj)) | |
1008 | if (!id | |
eab88f36 K |
1009 | || !memcmp( |
1010 | adj->sysid, | |
1011 | sysid, | |
1012 | ISIS_SYS_ID_LEN)) | |
d62a17ae | 1013 | isis_adj_state_change( |
16167b31 | 1014 | &adj, |
d62a17ae | 1015 | ISIS_ADJ_DOWN, |
1016 | "clear user request"); | |
1017 | } | |
1018 | } | |
1019 | } else if (circuit->circ_type == CIRCUIT_T_P2P | |
1020 | && circuit->u.p2p.neighbor) { | |
1021 | adj = circuit->u.p2p.neighbor; | |
1022 | if (!id | |
1023 | || !memcmp(adj->sysid, sysid, | |
1024 | ISIS_SYS_ID_LEN)) | |
1025 | isis_adj_state_change( | |
16167b31 | 1026 | &adj, ISIS_ADJ_DOWN, |
d62a17ae | 1027 | "clear user request"); |
1028 | } | |
1029 | } | |
1030 | } | |
3f045a08 | 1031 | } |
eab88f36 K |
1032 | /* |
1033 | * 'clear isis neighbor' command | |
1034 | */ | |
1035 | int clear_isis_neighbor_common(struct vty *vty, const char *id, const char *vrf_name, | |
1036 | bool all_vrf) | |
eb5d44eb | 1037 | { |
36944791 | 1038 | struct listnode *node; |
eab88f36 K |
1039 | struct isis_dynhn *dynhn; |
1040 | uint8_t sysid[ISIS_SYS_ID_LEN]; | |
36944791 | 1041 | struct isis *isis; |
eb5d44eb | 1042 | |
eab88f36 K |
1043 | if (!im) { |
1044 | vty_out(vty, "IS-IS Routing Process not enabled\n"); | |
1045 | return CMD_SUCCESS; | |
1046 | } | |
3f045a08 | 1047 | |
eab88f36 K |
1048 | memset(sysid, 0, ISIS_SYS_ID_LEN); |
1049 | if (id) { | |
1050 | if (sysid2buff(sysid, id) == 0) { | |
1051 | dynhn = dynhn_find_by_name(id); | |
1052 | if (dynhn == NULL) { | |
1053 | vty_out(vty, "Invalid system id %s\n", id); | |
1054 | return CMD_SUCCESS; | |
1055 | } | |
1056 | memcpy(sysid, dynhn->id, ISIS_SYS_ID_LEN); | |
1057 | } | |
1058 | } | |
1059 | if (vrf_name) { | |
1060 | if (all_vrf) { | |
36944791 | 1061 | for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) |
eab88f36 K |
1062 | isis_neighbor_common_clear(vty, id, sysid, |
1063 | isis); | |
36944791 | 1064 | return CMD_SUCCESS; |
eab88f36 K |
1065 | } |
1066 | isis = isis_lookup_by_vrfname(vrf_name); | |
1067 | if (isis != NULL) | |
1068 | isis_neighbor_common_clear(vty, id, sysid, isis); | |
1069 | } | |
3f045a08 | 1070 | |
eab88f36 | 1071 | return CMD_SUCCESS; |
3f045a08 JB |
1072 | } |
1073 | ||
eab88f36 K |
1074 | DEFUN(show_isis_neighbor, |
1075 | show_isis_neighbor_cmd, | |
1076 | "show " PROTO_NAME " [vrf <NAME|all>] neighbor", | |
1077 | SHOW_STR | |
1078 | PROTO_HELP | |
1079 | VRF_CMD_HELP_STR | |
1080 | "All vrfs\n" | |
1081 | "IS-IS neighbor adjacencies\n") | |
1082 | { | |
1083 | const char *vrf_name = VRF_DEFAULT_NAME; | |
1084 | bool all_vrf = false; | |
1085 | int idx_vrf = 0; | |
1086 | ||
1087 | ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); | |
1088 | return show_isis_neighbor_common(vty, NULL, ISIS_UI_LEVEL_BRIEF, | |
1089 | vrf_name, all_vrf); | |
1090 | } | |
1091 | ||
1092 | DEFUN(show_isis_neighbor_detail, | |
1093 | show_isis_neighbor_detail_cmd, | |
1094 | "show " PROTO_NAME " [vrf <NAME|all>] neighbor detail", | |
1095 | SHOW_STR | |
1096 | PROTO_HELP | |
1097 | VRF_CMD_HELP_STR | |
1098 | "all vrfs\n" | |
1099 | "IS-IS neighbor adjacencies\n" | |
1100 | "show detailed information\n") | |
1101 | { | |
1102 | const char *vrf_name = VRF_DEFAULT_NAME; | |
1103 | bool all_vrf = false; | |
1104 | int idx_vrf = 0; | |
1105 | ||
1106 | ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); | |
1107 | ||
1108 | return show_isis_neighbor_common(vty, NULL, ISIS_UI_LEVEL_DETAIL, | |
1109 | vrf_name, all_vrf); | |
1110 | } | |
1111 | ||
1112 | DEFUN(show_isis_neighbor_arg, | |
1113 | show_isis_neighbor_arg_cmd, | |
1114 | "show " PROTO_NAME " [vrf <NAME|all>] neighbor WORD", | |
1115 | SHOW_STR | |
1116 | PROTO_HELP | |
1117 | VRF_CMD_HELP_STR | |
1118 | "All vrfs\n" | |
1119 | "IS-IS neighbor adjacencies\n" | |
1120 | "System id\n") | |
1121 | { | |
1122 | int idx_word = 0; | |
1123 | const char *vrf_name = VRF_DEFAULT_NAME; | |
1124 | bool all_vrf = false; | |
1125 | int idx_vrf = 0; | |
1126 | ||
1127 | ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); | |
1128 | char *id = argv_find(argv, argc, "WORD", &idx_word) | |
1129 | ? argv[idx_word]->arg | |
1130 | : NULL; | |
1131 | ||
1132 | return show_isis_neighbor_common(vty, id, ISIS_UI_LEVEL_DETAIL, | |
1133 | vrf_name, all_vrf); | |
1134 | } | |
1135 | ||
1136 | DEFUN(clear_isis_neighbor, | |
1137 | clear_isis_neighbor_cmd, | |
1138 | "clear " PROTO_NAME " [vrf <NAME|all>] neighbor", | |
1139 | CLEAR_STR | |
1140 | PROTO_HELP | |
1141 | VRF_CMD_HELP_STR | |
1142 | "All vrfs\n" | |
1143 | "IS-IS neighbor adjacencies\n") | |
1144 | { | |
1145 | const char *vrf_name = VRF_DEFAULT_NAME; | |
1146 | bool all_vrf = false; | |
1147 | int idx_vrf = 0; | |
1148 | ||
1149 | ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); | |
1150 | return clear_isis_neighbor_common(vty, NULL, vrf_name, all_vrf); | |
1151 | } | |
1152 | ||
1153 | DEFUN(clear_isis_neighbor_arg, | |
1154 | clear_isis_neighbor_arg_cmd, | |
1155 | "clear " PROTO_NAME " [vrf <NAME|all>] neighbor WORD", | |
1156 | CLEAR_STR | |
1157 | PROTO_HELP | |
1158 | VRF_CMD_HELP_STR | |
1159 | "All vrfs\n" | |
1160 | "IS-IS neighbor adjacencies\n" | |
1161 | "System id\n") | |
1162 | { | |
1163 | int idx_word = 0; | |
1164 | const char *vrf_name = VRF_DEFAULT_NAME; | |
1165 | bool all_vrf = false; | |
1166 | int idx_vrf = 0; | |
1167 | ||
1168 | char *id = argv_find(argv, argc, "WORD", &idx_word) | |
1169 | ? argv[idx_word]->arg | |
1170 | : NULL; | |
1171 | ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); | |
1172 | return clear_isis_neighbor_common(vty, id, vrf_name, all_vrf); | |
3f045a08 JB |
1173 | } |
1174 | ||
eb5d44eb | 1175 | /* |
1176 | * 'isis debug', 'show debugging' | |
1177 | */ | |
d62a17ae | 1178 | void print_debug(struct vty *vty, int flags, int onoff) |
1179 | { | |
5627d3fe | 1180 | const char *onoffs = onoff ? "on" : "off"; |
d62a17ae | 1181 | |
1182 | if (flags & DEBUG_ADJ_PACKETS) | |
1183 | vty_out(vty, | |
1184 | "IS-IS Adjacency related packets debugging is %s\n", | |
1185 | onoffs); | |
161fa356 CF |
1186 | if (flags & DEBUG_TX_QUEUE) |
1187 | vty_out(vty, "IS-IS TX queue debugging is %s\n", | |
1188 | onoffs); | |
d62a17ae | 1189 | if (flags & DEBUG_SNP_PACKETS) |
1190 | vty_out(vty, "IS-IS CSNP/PSNP packets debugging is %s\n", | |
1191 | onoffs); | |
1192 | if (flags & DEBUG_SPF_EVENTS) | |
1193 | vty_out(vty, "IS-IS SPF events debugging is %s\n", onoffs); | |
26f6acaf RW |
1194 | if (flags & DEBUG_SR) |
1195 | vty_out(vty, "IS-IS Segment Routing events debugging is %s\n", | |
1196 | onoffs); | |
c951ee6e RW |
1197 | if (flags & DEBUG_TILFA) |
1198 | vty_out(vty, "IS-IS TI-LFA events debugging is %s\n", onoffs); | |
d62a17ae | 1199 | if (flags & DEBUG_UPDATE_PACKETS) |
1200 | vty_out(vty, "IS-IS Update related packet debugging is %s\n", | |
1201 | onoffs); | |
1202 | if (flags & DEBUG_RTE_EVENTS) | |
1203 | vty_out(vty, "IS-IS Route related debuggin is %s\n", onoffs); | |
1204 | if (flags & DEBUG_EVENTS) | |
1205 | vty_out(vty, "IS-IS Event debugging is %s\n", onoffs); | |
1206 | if (flags & DEBUG_PACKET_DUMP) | |
1207 | vty_out(vty, "IS-IS Packet dump debugging is %s\n", onoffs); | |
1208 | if (flags & DEBUG_LSP_GEN) | |
1209 | vty_out(vty, "IS-IS LSP generation debugging is %s\n", onoffs); | |
1210 | if (flags & DEBUG_LSP_SCHED) | |
1211 | vty_out(vty, "IS-IS LSP scheduling debugging is %s\n", onoffs); | |
ddb33326 CF |
1212 | if (flags & DEBUG_FLOODING) |
1213 | vty_out(vty, "IS-IS Flooding debugging is %s\n", onoffs); | |
2815f817 CF |
1214 | if (flags & DEBUG_BFD) |
1215 | vty_out(vty, "IS-IS BFD debugging is %s\n", onoffs); | |
1cbf96a8 | 1216 | if (flags & DEBUG_LDP_SYNC) |
1217 | vty_out(vty, "IS-IS ldp-sync debugging is %s\n", onoffs); | |
eb5d44eb | 1218 | } |
1219 | ||
87f6dc50 DS |
1220 | DEFUN_NOSH (show_debugging, |
1221 | show_debugging_isis_cmd, | |
7c0cbd0e | 1222 | "show debugging [" PROTO_NAME "]", |
87f6dc50 DS |
1223 | SHOW_STR |
1224 | "State of each debugging option\n" | |
7c0cbd0e | 1225 | PROTO_HELP) |
eb5d44eb | 1226 | { |
7c0cbd0e | 1227 | vty_out(vty, PROTO_NAME " debugging status:\n"); |
87f6dc50 | 1228 | |
e740f9c1 | 1229 | if (IS_DEBUG_ADJ_PACKETS) |
1230 | print_debug(vty, DEBUG_ADJ_PACKETS, 1); | |
1231 | if (IS_DEBUG_TX_QUEUE) | |
1232 | print_debug(vty, DEBUG_TX_QUEUE, 1); | |
1233 | if (IS_DEBUG_SNP_PACKETS) | |
1234 | print_debug(vty, DEBUG_SNP_PACKETS, 1); | |
1235 | if (IS_DEBUG_SPF_EVENTS) | |
1236 | print_debug(vty, DEBUG_SPF_EVENTS, 1); | |
1237 | if (IS_DEBUG_SR) | |
1238 | print_debug(vty, DEBUG_SR, 1); | |
1239 | if (IS_DEBUG_UPDATE_PACKETS) | |
1240 | print_debug(vty, DEBUG_UPDATE_PACKETS, 1); | |
1241 | if (IS_DEBUG_RTE_EVENTS) | |
1242 | print_debug(vty, DEBUG_RTE_EVENTS, 1); | |
1243 | if (IS_DEBUG_EVENTS) | |
1244 | print_debug(vty, DEBUG_EVENTS, 1); | |
1245 | if (IS_DEBUG_PACKET_DUMP) | |
1246 | print_debug(vty, DEBUG_PACKET_DUMP, 1); | |
1247 | if (IS_DEBUG_LSP_GEN) | |
1248 | print_debug(vty, DEBUG_LSP_GEN, 1); | |
1249 | if (IS_DEBUG_LSP_SCHED) | |
1250 | print_debug(vty, DEBUG_LSP_SCHED, 1); | |
1251 | if (IS_DEBUG_FLOODING) | |
1252 | print_debug(vty, DEBUG_FLOODING, 1); | |
1253 | if (IS_DEBUG_BFD) | |
1254 | print_debug(vty, DEBUG_BFD, 1); | |
1cbf96a8 | 1255 | if (IS_DEBUG_LDP_SYNC) |
1256 | print_debug(vty, DEBUG_LDP_SYNC, 1); | |
d62a17ae | 1257 | return CMD_SUCCESS; |
eb5d44eb | 1258 | } |
1259 | ||
612c2c15 | 1260 | static int config_write_debug(struct vty *vty); |
9e867fe6 | 1261 | /* Debug node. */ |
62b346ee | 1262 | static struct cmd_node debug_node = { |
f4b8291f | 1263 | .name = "debug", |
62b346ee DL |
1264 | .node = DEBUG_NODE, |
1265 | .prompt = "", | |
612c2c15 | 1266 | .config_write = config_write_debug, |
62b346ee | 1267 | }; |
d62a17ae | 1268 | |
1269 | static int config_write_debug(struct vty *vty) | |
1270 | { | |
1271 | int write = 0; | |
d62a17ae | 1272 | |
e740f9c1 | 1273 | if (IS_DEBUG_ADJ_PACKETS) { |
7c0cbd0e | 1274 | vty_out(vty, "debug " PROTO_NAME " adj-packets\n"); |
d62a17ae | 1275 | write++; |
1276 | } | |
e740f9c1 | 1277 | if (IS_DEBUG_TX_QUEUE) { |
161fa356 CF |
1278 | vty_out(vty, "debug " PROTO_NAME " tx-queue\n"); |
1279 | write++; | |
1280 | } | |
e740f9c1 | 1281 | if (IS_DEBUG_SNP_PACKETS) { |
7c0cbd0e | 1282 | vty_out(vty, "debug " PROTO_NAME " snp-packets\n"); |
d62a17ae | 1283 | write++; |
1284 | } | |
e740f9c1 | 1285 | if (IS_DEBUG_SPF_EVENTS) { |
7c0cbd0e | 1286 | vty_out(vty, "debug " PROTO_NAME " spf-events\n"); |
d62a17ae | 1287 | write++; |
1288 | } | |
e740f9c1 | 1289 | if (IS_DEBUG_SR) { |
26f6acaf RW |
1290 | vty_out(vty, "debug " PROTO_NAME " sr-events\n"); |
1291 | write++; | |
1292 | } | |
c951ee6e RW |
1293 | if (IS_DEBUG_TILFA) { |
1294 | vty_out(vty, "debug " PROTO_NAME " ti-lfa\n"); | |
1295 | write++; | |
1296 | } | |
e740f9c1 | 1297 | if (IS_DEBUG_UPDATE_PACKETS) { |
7c0cbd0e | 1298 | vty_out(vty, "debug " PROTO_NAME " update-packets\n"); |
d62a17ae | 1299 | write++; |
1300 | } | |
e740f9c1 | 1301 | if (IS_DEBUG_RTE_EVENTS) { |
7c0cbd0e | 1302 | vty_out(vty, "debug " PROTO_NAME " route-events\n"); |
d62a17ae | 1303 | write++; |
1304 | } | |
e740f9c1 | 1305 | if (IS_DEBUG_EVENTS) { |
7c0cbd0e | 1306 | vty_out(vty, "debug " PROTO_NAME " events\n"); |
d62a17ae | 1307 | write++; |
1308 | } | |
e740f9c1 | 1309 | if (IS_DEBUG_PACKET_DUMP) { |
7c0cbd0e | 1310 | vty_out(vty, "debug " PROTO_NAME " packet-dump\n"); |
d62a17ae | 1311 | write++; |
1312 | } | |
e740f9c1 | 1313 | if (IS_DEBUG_LSP_GEN) { |
7c0cbd0e | 1314 | vty_out(vty, "debug " PROTO_NAME " lsp-gen\n"); |
d62a17ae | 1315 | write++; |
1316 | } | |
e740f9c1 | 1317 | if (IS_DEBUG_LSP_SCHED) { |
7c0cbd0e | 1318 | vty_out(vty, "debug " PROTO_NAME " lsp-sched\n"); |
d62a17ae | 1319 | write++; |
1320 | } | |
e740f9c1 | 1321 | if (IS_DEBUG_FLOODING) { |
d4cff91a CF |
1322 | vty_out(vty, "debug " PROTO_NAME " flooding\n"); |
1323 | write++; | |
1324 | } | |
e740f9c1 | 1325 | if (IS_DEBUG_BFD) { |
2815f817 CF |
1326 | vty_out(vty, "debug " PROTO_NAME " bfd\n"); |
1327 | write++; | |
1328 | } | |
1cbf96a8 | 1329 | if (IS_DEBUG_LDP_SYNC) { |
1330 | vty_out(vty, "debug " PROTO_NAME " ldp-sync\n"); | |
1331 | write++; | |
1332 | } | |
d62a17ae | 1333 | write += spf_backoff_write_config(vty); |
1334 | ||
1335 | return write; | |
9e867fe6 | 1336 | } |
1337 | ||
eb5d44eb | 1338 | DEFUN (debug_isis_adj, |
1339 | debug_isis_adj_cmd, | |
7c0cbd0e | 1340 | "debug " PROTO_NAME " adj-packets", |
eb5d44eb | 1341 | DEBUG_STR |
7c0cbd0e | 1342 | PROTO_HELP |
f390d2c7 | 1343 | "IS-IS Adjacency related packets\n") |
eb5d44eb | 1344 | { |
e740f9c1 | 1345 | debug_adj_pkt |= DEBUG_ADJ_PACKETS; |
d62a17ae | 1346 | print_debug(vty, DEBUG_ADJ_PACKETS, 1); |
eb5d44eb | 1347 | |
d62a17ae | 1348 | return CMD_SUCCESS; |
eb5d44eb | 1349 | } |
1350 | ||
1351 | DEFUN (no_debug_isis_adj, | |
1352 | no_debug_isis_adj_cmd, | |
7c0cbd0e | 1353 | "no debug " PROTO_NAME " adj-packets", |
16cedbb0 | 1354 | NO_STR |
eb5d44eb | 1355 | UNDEBUG_STR |
7c0cbd0e | 1356 | PROTO_HELP |
f390d2c7 | 1357 | "IS-IS Adjacency related packets\n") |
eb5d44eb | 1358 | { |
e740f9c1 | 1359 | debug_adj_pkt &= ~DEBUG_ADJ_PACKETS; |
d62a17ae | 1360 | print_debug(vty, DEBUG_ADJ_PACKETS, 0); |
eb5d44eb | 1361 | |
d62a17ae | 1362 | return CMD_SUCCESS; |
eb5d44eb | 1363 | } |
1364 | ||
161fa356 CF |
1365 | DEFUN (debug_isis_tx_queue, |
1366 | debug_isis_tx_queue_cmd, | |
1367 | "debug " PROTO_NAME " tx-queue", | |
1368 | DEBUG_STR | |
1369 | PROTO_HELP | |
1370 | "IS-IS TX queues\n") | |
1371 | { | |
e740f9c1 | 1372 | debug_tx_queue |= DEBUG_TX_QUEUE; |
161fa356 CF |
1373 | print_debug(vty, DEBUG_TX_QUEUE, 1); |
1374 | ||
1375 | return CMD_SUCCESS; | |
1376 | } | |
1377 | ||
1378 | DEFUN (no_debug_isis_tx_queue, | |
1379 | no_debug_isis_tx_queue_cmd, | |
1380 | "no debug " PROTO_NAME " tx-queue", | |
1381 | NO_STR | |
1382 | UNDEBUG_STR | |
1383 | PROTO_HELP | |
1384 | "IS-IS TX queues\n") | |
1385 | { | |
e740f9c1 | 1386 | debug_tx_queue &= ~DEBUG_TX_QUEUE; |
161fa356 CF |
1387 | print_debug(vty, DEBUG_TX_QUEUE, 0); |
1388 | ||
1389 | return CMD_SUCCESS; | |
1390 | } | |
1391 | ||
ddb33326 CF |
1392 | DEFUN (debug_isis_flooding, |
1393 | debug_isis_flooding_cmd, | |
1394 | "debug " PROTO_NAME " flooding", | |
1395 | DEBUG_STR | |
1396 | PROTO_HELP | |
1397 | "Flooding algorithm\n") | |
1398 | { | |
e740f9c1 | 1399 | debug_flooding |= DEBUG_FLOODING; |
ddb33326 CF |
1400 | print_debug(vty, DEBUG_FLOODING, 1); |
1401 | ||
1402 | return CMD_SUCCESS; | |
1403 | } | |
1404 | ||
1405 | DEFUN (no_debug_isis_flooding, | |
1406 | no_debug_isis_flooding_cmd, | |
1407 | "no debug " PROTO_NAME " flooding", | |
1408 | NO_STR | |
1409 | UNDEBUG_STR | |
1410 | PROTO_HELP | |
1411 | "Flooding algorithm\n") | |
1412 | { | |
e740f9c1 | 1413 | debug_flooding &= ~DEBUG_FLOODING; |
ddb33326 CF |
1414 | print_debug(vty, DEBUG_FLOODING, 0); |
1415 | ||
1416 | return CMD_SUCCESS; | |
1417 | } | |
1418 | ||
eb5d44eb | 1419 | DEFUN (debug_isis_snp, |
1420 | debug_isis_snp_cmd, | |
7c0cbd0e | 1421 | "debug " PROTO_NAME " snp-packets", |
eb5d44eb | 1422 | DEBUG_STR |
7c0cbd0e | 1423 | PROTO_HELP |
f390d2c7 | 1424 | "IS-IS CSNP/PSNP packets\n") |
eb5d44eb | 1425 | { |
e740f9c1 | 1426 | debug_snp_pkt |= DEBUG_SNP_PACKETS; |
d62a17ae | 1427 | print_debug(vty, DEBUG_SNP_PACKETS, 1); |
eb5d44eb | 1428 | |
d62a17ae | 1429 | return CMD_SUCCESS; |
eb5d44eb | 1430 | } |
1431 | ||
1432 | DEFUN (no_debug_isis_snp, | |
1433 | no_debug_isis_snp_cmd, | |
7c0cbd0e | 1434 | "no debug " PROTO_NAME " snp-packets", |
16cedbb0 | 1435 | NO_STR |
eb5d44eb | 1436 | UNDEBUG_STR |
7c0cbd0e | 1437 | PROTO_HELP |
f390d2c7 | 1438 | "IS-IS CSNP/PSNP packets\n") |
eb5d44eb | 1439 | { |
e740f9c1 | 1440 | debug_snp_pkt &= ~DEBUG_SNP_PACKETS; |
d62a17ae | 1441 | print_debug(vty, DEBUG_SNP_PACKETS, 0); |
f390d2c7 | 1442 | |
d62a17ae | 1443 | return CMD_SUCCESS; |
eb5d44eb | 1444 | } |
1445 | ||
eb5d44eb | 1446 | DEFUN (debug_isis_upd, |
1447 | debug_isis_upd_cmd, | |
7c0cbd0e | 1448 | "debug " PROTO_NAME " update-packets", |
eb5d44eb | 1449 | DEBUG_STR |
7c0cbd0e | 1450 | PROTO_HELP |
f390d2c7 | 1451 | "IS-IS Update related packets\n") |
eb5d44eb | 1452 | { |
e740f9c1 | 1453 | debug_update_pkt |= DEBUG_UPDATE_PACKETS; |
d62a17ae | 1454 | print_debug(vty, DEBUG_UPDATE_PACKETS, 1); |
eb5d44eb | 1455 | |
d62a17ae | 1456 | return CMD_SUCCESS; |
eb5d44eb | 1457 | } |
1458 | ||
1459 | DEFUN (no_debug_isis_upd, | |
1460 | no_debug_isis_upd_cmd, | |
7c0cbd0e | 1461 | "no debug " PROTO_NAME " update-packets", |
16cedbb0 | 1462 | NO_STR |
eb5d44eb | 1463 | UNDEBUG_STR |
7c0cbd0e | 1464 | PROTO_HELP |
f390d2c7 | 1465 | "IS-IS Update related packets\n") |
eb5d44eb | 1466 | { |
e740f9c1 | 1467 | debug_update_pkt &= ~DEBUG_UPDATE_PACKETS; |
d62a17ae | 1468 | print_debug(vty, DEBUG_UPDATE_PACKETS, 0); |
f390d2c7 | 1469 | |
d62a17ae | 1470 | return CMD_SUCCESS; |
eb5d44eb | 1471 | } |
1472 | ||
eb5d44eb | 1473 | DEFUN (debug_isis_spfevents, |
1474 | debug_isis_spfevents_cmd, | |
7c0cbd0e | 1475 | "debug " PROTO_NAME " spf-events", |
eb5d44eb | 1476 | DEBUG_STR |
7c0cbd0e | 1477 | PROTO_HELP |
f390d2c7 | 1478 | "IS-IS Shortest Path First Events\n") |
eb5d44eb | 1479 | { |
e740f9c1 | 1480 | debug_spf_events |= DEBUG_SPF_EVENTS; |
d62a17ae | 1481 | print_debug(vty, DEBUG_SPF_EVENTS, 1); |
eb5d44eb | 1482 | |
d62a17ae | 1483 | return CMD_SUCCESS; |
eb5d44eb | 1484 | } |
1485 | ||
1486 | DEFUN (no_debug_isis_spfevents, | |
1487 | no_debug_isis_spfevents_cmd, | |
7c0cbd0e | 1488 | "no debug " PROTO_NAME " spf-events", |
16cedbb0 | 1489 | NO_STR |
eb5d44eb | 1490 | UNDEBUG_STR |
7c0cbd0e | 1491 | PROTO_HELP |
f390d2c7 | 1492 | "IS-IS Shortest Path First Events\n") |
eb5d44eb | 1493 | { |
e740f9c1 | 1494 | debug_spf_events &= ~DEBUG_SPF_EVENTS; |
d62a17ae | 1495 | print_debug(vty, DEBUG_SPF_EVENTS, 0); |
f390d2c7 | 1496 | |
d62a17ae | 1497 | return CMD_SUCCESS; |
eb5d44eb | 1498 | } |
1499 | ||
26f6acaf RW |
1500 | DEFUN (debug_isis_srevents, |
1501 | debug_isis_srevents_cmd, | |
1502 | "debug " PROTO_NAME " sr-events", | |
1503 | DEBUG_STR | |
1504 | PROTO_HELP | |
1505 | "IS-IS Segment Routing Events\n") | |
1506 | { | |
e740f9c1 | 1507 | debug_sr |= DEBUG_SR; |
26f6acaf RW |
1508 | print_debug(vty, DEBUG_SR, 1); |
1509 | ||
1510 | return CMD_SUCCESS; | |
1511 | } | |
1512 | ||
1513 | DEFUN (no_debug_isis_srevents, | |
1514 | no_debug_isis_srevents_cmd, | |
1515 | "no debug " PROTO_NAME " sr-events", | |
1516 | NO_STR | |
1517 | UNDEBUG_STR | |
1518 | PROTO_HELP | |
1519 | "IS-IS Segment Routing Events\n") | |
1520 | { | |
e740f9c1 | 1521 | debug_sr &= ~DEBUG_SR; |
26f6acaf RW |
1522 | print_debug(vty, DEBUG_SR, 0); |
1523 | ||
1524 | return CMD_SUCCESS; | |
1525 | } | |
1526 | ||
c951ee6e RW |
1527 | DEFUN (debug_isis_tilfa, |
1528 | debug_isis_tilfa_cmd, | |
1529 | "debug " PROTO_NAME " ti-lfa", | |
1530 | DEBUG_STR | |
1531 | PROTO_HELP | |
1532 | "IS-IS TI-LFA Events\n") | |
1533 | { | |
1534 | debug_tilfa |= DEBUG_TILFA; | |
1535 | print_debug(vty, DEBUG_TILFA, 1); | |
1536 | ||
1537 | return CMD_SUCCESS; | |
1538 | } | |
1539 | ||
1540 | DEFUN (no_debug_isis_tilfa, | |
1541 | no_debug_isis_tilfa_cmd, | |
1542 | "no debug " PROTO_NAME " ti-lfa", | |
1543 | NO_STR | |
1544 | UNDEBUG_STR | |
1545 | PROTO_HELP | |
1546 | "IS-IS TI-LFA Events\n") | |
1547 | { | |
1548 | debug_tilfa &= ~DEBUG_TILFA; | |
1549 | print_debug(vty, DEBUG_TILFA, 0); | |
1550 | ||
1551 | return CMD_SUCCESS; | |
1552 | } | |
1553 | ||
eb5d44eb | 1554 | DEFUN (debug_isis_rtevents, |
1555 | debug_isis_rtevents_cmd, | |
7c0cbd0e | 1556 | "debug " PROTO_NAME " route-events", |
eb5d44eb | 1557 | DEBUG_STR |
7c0cbd0e | 1558 | PROTO_HELP |
f390d2c7 | 1559 | "IS-IS Route related events\n") |
eb5d44eb | 1560 | { |
e740f9c1 | 1561 | debug_rte_events |= DEBUG_RTE_EVENTS; |
d62a17ae | 1562 | print_debug(vty, DEBUG_RTE_EVENTS, 1); |
eb5d44eb | 1563 | |
d62a17ae | 1564 | return CMD_SUCCESS; |
eb5d44eb | 1565 | } |
1566 | ||
1567 | DEFUN (no_debug_isis_rtevents, | |
1568 | no_debug_isis_rtevents_cmd, | |
7c0cbd0e | 1569 | "no debug " PROTO_NAME " route-events", |
16cedbb0 | 1570 | NO_STR |
eb5d44eb | 1571 | UNDEBUG_STR |
7c0cbd0e | 1572 | PROTO_HELP |
f390d2c7 | 1573 | "IS-IS Route related events\n") |
eb5d44eb | 1574 | { |
e740f9c1 | 1575 | debug_rte_events &= ~DEBUG_RTE_EVENTS; |
d62a17ae | 1576 | print_debug(vty, DEBUG_RTE_EVENTS, 0); |
f390d2c7 | 1577 | |
d62a17ae | 1578 | return CMD_SUCCESS; |
eb5d44eb | 1579 | } |
1580 | ||
1581 | DEFUN (debug_isis_events, | |
1582 | debug_isis_events_cmd, | |
7c0cbd0e | 1583 | "debug " PROTO_NAME " events", |
eb5d44eb | 1584 | DEBUG_STR |
7c0cbd0e | 1585 | PROTO_HELP |
f1082d19 | 1586 | "IS-IS Events\n") |
eb5d44eb | 1587 | { |
e740f9c1 | 1588 | debug_events |= DEBUG_EVENTS; |
d62a17ae | 1589 | print_debug(vty, DEBUG_EVENTS, 1); |
eb5d44eb | 1590 | |
d62a17ae | 1591 | return CMD_SUCCESS; |
eb5d44eb | 1592 | } |
1593 | ||
1594 | DEFUN (no_debug_isis_events, | |
1595 | no_debug_isis_events_cmd, | |
7c0cbd0e | 1596 | "no debug " PROTO_NAME " events", |
16cedbb0 | 1597 | NO_STR |
eb5d44eb | 1598 | UNDEBUG_STR |
7c0cbd0e | 1599 | PROTO_HELP |
f390d2c7 | 1600 | "IS-IS Events\n") |
eb5d44eb | 1601 | { |
e740f9c1 | 1602 | debug_events &= ~DEBUG_EVENTS; |
d62a17ae | 1603 | print_debug(vty, DEBUG_EVENTS, 0); |
f390d2c7 | 1604 | |
d62a17ae | 1605 | return CMD_SUCCESS; |
eb5d44eb | 1606 | } |
1607 | ||
3f045a08 JB |
1608 | DEFUN (debug_isis_packet_dump, |
1609 | debug_isis_packet_dump_cmd, | |
7c0cbd0e | 1610 | "debug " PROTO_NAME " packet-dump", |
3f045a08 | 1611 | DEBUG_STR |
7c0cbd0e | 1612 | PROTO_HELP |
3f045a08 JB |
1613 | "IS-IS packet dump\n") |
1614 | { | |
e740f9c1 | 1615 | debug_pkt_dump |= DEBUG_PACKET_DUMP; |
d62a17ae | 1616 | print_debug(vty, DEBUG_PACKET_DUMP, 1); |
3f045a08 | 1617 | |
d62a17ae | 1618 | return CMD_SUCCESS; |
3f045a08 JB |
1619 | } |
1620 | ||
1621 | DEFUN (no_debug_isis_packet_dump, | |
1622 | no_debug_isis_packet_dump_cmd, | |
7c0cbd0e | 1623 | "no debug " PROTO_NAME " packet-dump", |
16cedbb0 | 1624 | NO_STR |
3f045a08 | 1625 | UNDEBUG_STR |
7c0cbd0e | 1626 | PROTO_HELP |
3f045a08 JB |
1627 | "IS-IS packet dump\n") |
1628 | { | |
e740f9c1 | 1629 | debug_pkt_dump &= ~DEBUG_PACKET_DUMP; |
d62a17ae | 1630 | print_debug(vty, DEBUG_PACKET_DUMP, 0); |
3f045a08 | 1631 | |
d62a17ae | 1632 | return CMD_SUCCESS; |
3f045a08 JB |
1633 | } |
1634 | ||
14872644 CF |
1635 | DEFUN (debug_isis_lsp_gen, |
1636 | debug_isis_lsp_gen_cmd, | |
7c0cbd0e | 1637 | "debug " PROTO_NAME " lsp-gen", |
14872644 | 1638 | DEBUG_STR |
7c0cbd0e | 1639 | PROTO_HELP |
14872644 CF |
1640 | "IS-IS generation of own LSPs\n") |
1641 | { | |
e740f9c1 | 1642 | debug_lsp_gen |= DEBUG_LSP_GEN; |
d62a17ae | 1643 | print_debug(vty, DEBUG_LSP_GEN, 1); |
14872644 | 1644 | |
d62a17ae | 1645 | return CMD_SUCCESS; |
14872644 CF |
1646 | } |
1647 | ||
1648 | DEFUN (no_debug_isis_lsp_gen, | |
1649 | no_debug_isis_lsp_gen_cmd, | |
7c0cbd0e | 1650 | "no debug " PROTO_NAME " lsp-gen", |
16cedbb0 | 1651 | NO_STR |
14872644 | 1652 | UNDEBUG_STR |
7c0cbd0e | 1653 | PROTO_HELP |
14872644 CF |
1654 | "IS-IS generation of own LSPs\n") |
1655 | { | |
e740f9c1 | 1656 | debug_lsp_gen &= ~DEBUG_LSP_GEN; |
d62a17ae | 1657 | print_debug(vty, DEBUG_LSP_GEN, 0); |
14872644 | 1658 | |
d62a17ae | 1659 | return CMD_SUCCESS; |
14872644 CF |
1660 | } |
1661 | ||
414766a1 CF |
1662 | DEFUN (debug_isis_lsp_sched, |
1663 | debug_isis_lsp_sched_cmd, | |
7c0cbd0e | 1664 | "debug " PROTO_NAME " lsp-sched", |
414766a1 | 1665 | DEBUG_STR |
7c0cbd0e | 1666 | PROTO_HELP |
414766a1 CF |
1667 | "IS-IS scheduling of LSP generation\n") |
1668 | { | |
e740f9c1 | 1669 | debug_lsp_sched |= DEBUG_LSP_SCHED; |
d62a17ae | 1670 | print_debug(vty, DEBUG_LSP_SCHED, 1); |
414766a1 | 1671 | |
d62a17ae | 1672 | return CMD_SUCCESS; |
414766a1 CF |
1673 | } |
1674 | ||
49d41a26 DS |
1675 | DEFUN (no_debug_isis_lsp_sched, |
1676 | no_debug_isis_lsp_sched_cmd, | |
7c0cbd0e | 1677 | "no debug " PROTO_NAME " lsp-sched", |
16cedbb0 | 1678 | NO_STR |
49d41a26 | 1679 | UNDEBUG_STR |
7c0cbd0e | 1680 | PROTO_HELP |
49d41a26 DS |
1681 | "IS-IS scheduling of LSP generation\n") |
1682 | { | |
e740f9c1 | 1683 | debug_lsp_sched &= ~DEBUG_LSP_SCHED; |
d62a17ae | 1684 | print_debug(vty, DEBUG_LSP_SCHED, 0); |
49d41a26 | 1685 | |
d62a17ae | 1686 | return CMD_SUCCESS; |
49d41a26 DS |
1687 | } |
1688 | ||
2815f817 CF |
1689 | DEFUN (debug_isis_bfd, |
1690 | debug_isis_bfd_cmd, | |
1691 | "debug " PROTO_NAME " bfd", | |
1692 | DEBUG_STR | |
1693 | PROTO_HELP | |
1694 | PROTO_NAME " interaction with BFD\n") | |
1695 | { | |
e740f9c1 | 1696 | debug_bfd |= DEBUG_BFD; |
2815f817 CF |
1697 | print_debug(vty, DEBUG_BFD, 1); |
1698 | ||
1699 | return CMD_SUCCESS; | |
1700 | } | |
1701 | ||
1702 | DEFUN (no_debug_isis_bfd, | |
1703 | no_debug_isis_bfd_cmd, | |
1704 | "no debug " PROTO_NAME " bfd", | |
1705 | NO_STR | |
1706 | UNDEBUG_STR | |
1707 | PROTO_HELP | |
1708 | PROTO_NAME " interaction with BFD\n") | |
1709 | { | |
e740f9c1 | 1710 | debug_bfd &= ~DEBUG_BFD; |
2815f817 CF |
1711 | print_debug(vty, DEBUG_BFD, 0); |
1712 | ||
1713 | return CMD_SUCCESS; | |
1714 | } | |
1715 | ||
1cbf96a8 | 1716 | DEFUN(debug_isis_ldp_sync, debug_isis_ldp_sync_cmd, |
1717 | "debug " PROTO_NAME " ldp-sync", | |
1718 | DEBUG_STR PROTO_HELP PROTO_NAME " interaction with LDP-Sync\n") | |
1719 | { | |
1720 | debug_ldp_sync |= DEBUG_LDP_SYNC; | |
1721 | print_debug(vty, DEBUG_LDP_SYNC, 1); | |
1722 | ||
1723 | return CMD_SUCCESS; | |
1724 | } | |
1725 | ||
1726 | DEFUN(no_debug_isis_ldp_sync, no_debug_isis_ldp_sync_cmd, | |
1727 | "no debug " PROTO_NAME " ldp-sync", | |
1728 | NO_STR UNDEBUG_STR PROTO_HELP PROTO_NAME " interaction with LDP-Sync\n") | |
1729 | { | |
1730 | debug_ldp_sync &= ~DEBUG_LDP_SYNC; | |
1731 | print_debug(vty, DEBUG_LDP_SYNC, 0); | |
1732 | ||
1733 | return CMD_SUCCESS; | |
1734 | } | |
1735 | ||
1736 | DEFUN (show_hostname, | |
1737 | show_hostname_cmd, | |
1738 | "show " PROTO_NAME " hostname", | |
1739 | SHOW_STR | |
1740 | PROTO_HELP | |
1741 | "IS-IS Dynamic hostname mapping\n") | |
eb5d44eb | 1742 | { |
36944791 | 1743 | struct listnode *node; |
eab88f36 K |
1744 | const char *vrf_name = VRF_DEFAULT_NAME; |
1745 | bool all_vrf = false; | |
1746 | int idx_vrf = 0; | |
36944791 | 1747 | struct isis *isis; |
eab88f36 K |
1748 | |
1749 | ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); | |
1750 | if (vrf_name) { | |
1751 | if (all_vrf) { | |
36944791 | 1752 | for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) |
eab88f36 | 1753 | dynhn_print_all(vty, isis); |
36944791 RW |
1754 | |
1755 | return CMD_SUCCESS; | |
eab88f36 K |
1756 | } |
1757 | isis = isis_lookup_by_vrfname(vrf_name); | |
1758 | if (isis != NULL) | |
1759 | dynhn_print_all(vty, isis); | |
1760 | } | |
f390d2c7 | 1761 | |
d62a17ae | 1762 | return CMD_SUCCESS; |
eb5d44eb | 1763 | } |
1764 | ||
eab88f36 | 1765 | static void isis_spf_ietf_common(struct vty *vty, struct isis *isis) |
03f7e182 | 1766 | { |
d62a17ae | 1767 | struct listnode *node; |
1768 | struct isis_area *area; | |
d62a17ae | 1769 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { |
eab88f36 K |
1770 | |
1771 | vty_out(vty, "vrf : %s\n", isis->name); | |
d62a17ae | 1772 | vty_out(vty, "Area %s:\n", |
1773 | area->area_tag ? area->area_tag : "null"); | |
1774 | ||
1775 | for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) { | |
1776 | if ((area->is_type & level) == 0) | |
1777 | continue; | |
1778 | ||
1779 | vty_out(vty, " Level-%d:\n", level); | |
1780 | vty_out(vty, " SPF delay status: "); | |
1781 | if (area->spf_timer[level - 1]) { | |
1782 | struct timeval remain = thread_timer_remain( | |
1783 | area->spf_timer[level - 1]); | |
a97986ff DL |
1784 | vty_out(vty, "Pending, due in %lld msec\n", |
1785 | (long long)remain.tv_sec * 1000 | |
d62a17ae | 1786 | + remain.tv_usec / 1000); |
1787 | } else { | |
1788 | vty_out(vty, "Not scheduled\n"); | |
1789 | } | |
1790 | ||
1791 | if (area->spf_delay_ietf[level - 1]) { | |
1792 | vty_out(vty, | |
1793 | " Using draft-ietf-rtgwg-backoff-algo-04\n"); | |
1794 | spf_backoff_show( | |
1795 | area->spf_delay_ietf[level - 1], vty, | |
1796 | " "); | |
1797 | } else { | |
1798 | vty_out(vty, " Using legacy backoff algo\n"); | |
1799 | } | |
1800 | } | |
1801 | } | |
eab88f36 K |
1802 | } |
1803 | ||
1804 | DEFUN(show_isis_spf_ietf, show_isis_spf_ietf_cmd, | |
1805 | "show " PROTO_NAME " [vrf <NAME|all>] spf-delay-ietf", | |
1806 | SHOW_STR PROTO_HELP VRF_CMD_HELP_STR | |
1807 | "All VRFs\n" | |
1808 | "SPF delay IETF information\n") | |
1809 | { | |
36944791 RW |
1810 | struct listnode *node; |
1811 | struct isis *isis; | |
eab88f36 K |
1812 | int idx_vrf = 0; |
1813 | const char *vrf_name = VRF_DEFAULT_NAME; | |
1814 | bool all_vrf = false; | |
1815 | ||
1816 | ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf) | |
1817 | ||
1818 | if (!im) { | |
1819 | vty_out(vty, "ISIS is not running\n"); | |
1820 | return CMD_SUCCESS; | |
1821 | } | |
1822 | ||
1823 | if (vrf_name) { | |
1824 | if (all_vrf) { | |
36944791 | 1825 | for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) |
eab88f36 | 1826 | isis_spf_ietf_common(vty, isis); |
36944791 RW |
1827 | |
1828 | return CMD_SUCCESS; | |
eab88f36 K |
1829 | } |
1830 | isis = isis_lookup_by_vrfname(vrf_name); | |
1831 | if (isis != NULL) | |
1832 | isis_spf_ietf_common(vty, isis); | |
1833 | } | |
1834 | ||
d62a17ae | 1835 | return CMD_SUCCESS; |
03f7e182 SL |
1836 | } |
1837 | ||
eab88f36 | 1838 | static void common_isis_summary(struct vty *vty, struct isis *isis) |
3f045a08 | 1839 | { |
d62a17ae | 1840 | struct listnode *node, *node2; |
1841 | struct isis_area *area; | |
d62a17ae | 1842 | int level; |
1843 | ||
eab88f36 | 1844 | vty_out(vty, "vrf : %s\n", isis->name); |
d62a17ae | 1845 | vty_out(vty, "Process Id : %ld\n", isis->process_id); |
1846 | if (isis->sysid_set) | |
1847 | vty_out(vty, "System Id : %s\n", | |
1848 | sysid_print(isis->sysid)); | |
1849 | ||
1850 | vty_out(vty, "Up time : "); | |
1851 | vty_out_timestr(vty, isis->uptime); | |
1852 | vty_out(vty, "\n"); | |
1853 | ||
1854 | if (isis->area_list) | |
1855 | vty_out(vty, "Number of areas : %d\n", isis->area_list->count); | |
1856 | ||
1857 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { | |
1858 | vty_out(vty, "Area %s:\n", | |
1859 | area->area_tag ? area->area_tag : "null"); | |
1860 | ||
92ed0cde CF |
1861 | if (fabricd) { |
1862 | uint8_t tier = fabricd_tier(area); | |
1863 | if (tier == ISIS_TIER_UNDEFINED) | |
1864 | vty_out(vty, " Tier: undefined\n"); | |
1865 | else | |
6cde4b45 | 1866 | vty_out(vty, " Tier: %hhu\n", tier); |
92ed0cde CF |
1867 | } |
1868 | ||
d62a17ae | 1869 | if (listcount(area->area_addrs) > 0) { |
1870 | struct area_addr *area_addr; | |
1871 | for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node2, | |
1872 | area_addr)) { | |
1873 | vty_out(vty, " Net: %s\n", | |
1874 | isonet_print(area_addr->area_addr, | |
1875 | area_addr->addr_len | |
1876 | + ISIS_SYS_ID_LEN | |
1877 | + 1)); | |
1878 | } | |
1879 | } | |
1880 | ||
39bb53d6 CF |
1881 | vty_out(vty, " TX counters per PDU type:\n"); |
1882 | pdu_counter_print(vty, " ", area->pdu_tx_counters); | |
86d6f80d CF |
1883 | vty_out(vty, " LSP RXMT: %" PRIu64 "\n", |
1884 | area->lsp_rxmt_count); | |
39bb53d6 CF |
1885 | vty_out(vty, " RX counters per PDU type:\n"); |
1886 | pdu_counter_print(vty, " ", area->pdu_rx_counters); | |
1887 | ||
d62a17ae | 1888 | for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) { |
1889 | if ((area->is_type & level) == 0) | |
1890 | continue; | |
1891 | ||
1892 | vty_out(vty, " Level-%d:\n", level); | |
062f4d36 CF |
1893 | |
1894 | vty_out(vty, " LSP0 regenerated: %" PRIu64 "\n", | |
1895 | area->lsp_gen_count[level - 1]); | |
1896 | ||
6f004b60 CF |
1897 | vty_out(vty, " LSPs purged: %" PRIu64 "\n", |
1898 | area->lsp_purge_count[level - 1]); | |
1899 | ||
d62a17ae | 1900 | if (area->spf_timer[level - 1]) |
1901 | vty_out(vty, " SPF: (pending)\n"); | |
1902 | else | |
1903 | vty_out(vty, " SPF:\n"); | |
1904 | ||
1905 | vty_out(vty, " minimum interval : %d", | |
1906 | area->min_spf_interval[level - 1]); | |
1907 | if (area->spf_delay_ietf[level - 1]) | |
1908 | vty_out(vty, | |
1909 | " (not used, IETF SPF delay activated)"); | |
1910 | vty_out(vty, "\n"); | |
1911 | ||
a6f71d37 RW |
1912 | if (area->ip_circuits) { |
1913 | vty_out(vty, " IPv4 route computation:\n"); | |
1914 | isis_spf_print( | |
1915 | area->spftree[SPFTREE_IPV4][level - 1], | |
1916 | vty); | |
1917 | } | |
d62a17ae | 1918 | |
a6f71d37 RW |
1919 | if (area->ipv6_circuits) { |
1920 | vty_out(vty, " IPv6 route computation:\n"); | |
1921 | isis_spf_print( | |
1922 | area->spftree[SPFTREE_IPV6][level - 1], | |
1923 | vty); | |
1924 | } | |
321c1bbb | 1925 | |
a6f71d37 RW |
1926 | if (area->ipv6_circuits |
1927 | && isis_area_ipv6_dstsrc_enabled(area)) { | |
1928 | vty_out(vty, | |
1929 | " IPv6 dst-src route computation:\n"); | |
1930 | isis_spf_print(area->spftree[SPFTREE_DSTSRC] | |
1931 | [level - 1], | |
1932 | vty); | |
1933 | } | |
d62a17ae | 1934 | } |
1935 | } | |
eab88f36 K |
1936 | } |
1937 | ||
1938 | DEFUN(show_isis_summary, show_isis_summary_cmd, | |
1939 | "show " PROTO_NAME " [vrf <NAME|all>] summary", | |
1940 | SHOW_STR PROTO_HELP VRF_CMD_HELP_STR | |
1941 | "All VRFs\n" | |
1942 | "summary\n") | |
1943 | { | |
36944791 | 1944 | struct listnode *node; |
eab88f36 | 1945 | int idx_vrf = 0; |
36944791 | 1946 | struct isis *isis; |
eab88f36 K |
1947 | const char *vrf_name = VRF_DEFAULT_NAME; |
1948 | bool all_vrf = false; | |
1949 | ||
1950 | ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf) | |
1951 | if (!im) { | |
1952 | vty_out(vty, PROTO_NAME " is not running\n"); | |
1953 | return CMD_SUCCESS; | |
1954 | } | |
1955 | if (vrf_name) { | |
1956 | if (all_vrf) { | |
36944791 | 1957 | for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) |
eab88f36 | 1958 | common_isis_summary(vty, isis); |
36944791 RW |
1959 | |
1960 | return CMD_SUCCESS; | |
eab88f36 K |
1961 | } |
1962 | isis = isis_lookup_by_vrfname(vrf_name); | |
1963 | if (isis != NULL) | |
1964 | common_isis_summary(vty, isis); | |
1965 | } | |
1966 | ||
d62a17ae | 1967 | vty_out(vty, "\n"); |
1968 | ||
1969 | return CMD_SUCCESS; | |
eb5d44eb | 1970 | } |
1971 | ||
eab88f36 K |
1972 | struct isis_lsp *lsp_for_arg(struct lspdb_head *head, const char *argv, |
1973 | struct isis *isis) | |
d62a17ae | 1974 | { |
eb2bcb28 | 1975 | char sysid[255] = {0}; |
d7c0a89a | 1976 | uint8_t number[3]; |
eb2bcb28 CF |
1977 | const char *pos; |
1978 | uint8_t lspid[ISIS_SYS_ID_LEN + 2] = {0}; | |
1979 | struct isis_dynhn *dynhn; | |
1980 | struct isis_lsp *lsp = NULL; | |
d62a17ae | 1981 | |
eb2bcb28 CF |
1982 | if (!argv) |
1983 | return NULL; | |
d62a17ae | 1984 | |
1985 | /* | |
1986 | * extract fragment and pseudo id from the string argv | |
1987 | * in the forms: | |
1988 | * (a) <systemid/hostname>.<pseudo-id>-<framenent> or | |
1989 | * (b) <systemid/hostname>.<pseudo-id> or | |
1990 | * (c) <systemid/hostname> or | |
1991 | * Where systemid is in the form: | |
1992 | * xxxx.xxxx.xxxx | |
1993 | */ | |
1994 | if (argv) | |
e28544ed | 1995 | strlcpy(sysid, argv, sizeof(sysid)); |
d62a17ae | 1996 | if (argv && strlen(argv) > 3) { |
1997 | pos = argv + strlen(argv) - 3; | |
1998 | if (strncmp(pos, "-", 1) == 0) { | |
1999 | memcpy(number, ++pos, 2); | |
2000 | lspid[ISIS_SYS_ID_LEN + 1] = | |
d7c0a89a | 2001 | (uint8_t)strtol((char *)number, NULL, 16); |
d62a17ae | 2002 | pos -= 4; |
2003 | if (strncmp(pos, ".", 1) != 0) | |
eb2bcb28 | 2004 | return NULL; |
d62a17ae | 2005 | } |
2006 | if (strncmp(pos, ".", 1) == 0) { | |
2007 | memcpy(number, ++pos, 2); | |
2008 | lspid[ISIS_SYS_ID_LEN] = | |
d7c0a89a | 2009 | (uint8_t)strtol((char *)number, NULL, 16); |
d62a17ae | 2010 | sysid[pos - argv - 1] = '\0'; |
2011 | } | |
2012 | } | |
2013 | ||
eb2bcb28 CF |
2014 | /* |
2015 | * Try to find the lsp-id if the argv | |
2016 | * string is in | |
2017 | * the form | |
2018 | * hostname.<pseudo-id>-<fragment> | |
2019 | */ | |
2020 | if (sysid2buff(lspid, sysid)) { | |
4bef0ec4 | 2021 | lsp = lsp_search(head, lspid); |
eb2bcb28 CF |
2022 | } else if ((dynhn = dynhn_find_by_name(sysid))) { |
2023 | memcpy(lspid, dynhn->id, ISIS_SYS_ID_LEN); | |
4bef0ec4 | 2024 | lsp = lsp_search(head, lspid); |
eb2bcb28 CF |
2025 | } else if (strncmp(cmd_hostname_get(), sysid, 15) == 0) { |
2026 | memcpy(lspid, isis->sysid, ISIS_SYS_ID_LEN); | |
4bef0ec4 | 2027 | lsp = lsp_search(head, lspid); |
eb2bcb28 CF |
2028 | } |
2029 | ||
2030 | return lsp; | |
2031 | } | |
2032 | ||
52a7c25e RW |
2033 | void show_isis_database_lspdb(struct vty *vty, struct isis_area *area, |
2034 | int level, struct lspdb_head *lspdb, | |
2035 | const char *argv, int ui_level) | |
2036 | { | |
2037 | struct isis_lsp *lsp; | |
2038 | int lsp_count; | |
2039 | ||
2040 | if (lspdb_count(lspdb) > 0) { | |
2041 | lsp = lsp_for_arg(lspdb, argv, area->isis); | |
2042 | ||
2043 | if (lsp != NULL || argv == NULL) { | |
2044 | vty_out(vty, "IS-IS Level-%d link-state database:\n", | |
2045 | level + 1); | |
2046 | ||
2047 | /* print the title in all cases */ | |
2048 | vty_out(vty, | |
2049 | "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n"); | |
2050 | } | |
2051 | ||
2052 | if (lsp) { | |
2053 | if (ui_level == ISIS_UI_LEVEL_DETAIL) | |
2054 | lsp_print_detail(lsp, vty, area->dynhostname, | |
2055 | area->isis); | |
2056 | else | |
2057 | lsp_print(lsp, vty, area->dynhostname, | |
2058 | area->isis); | |
2059 | } else if (argv == NULL) { | |
2060 | lsp_count = | |
2061 | lsp_print_all(vty, lspdb, ui_level, | |
2062 | area->dynhostname, area->isis); | |
2063 | ||
2064 | vty_out(vty, " %u LSPs\n\n", lsp_count); | |
2065 | } | |
2066 | } | |
2067 | } | |
2068 | ||
2069 | static void show_isis_database_common(struct vty *vty, const char *argv, | |
2070 | int ui_level, struct isis *isis) | |
eb2bcb28 CF |
2071 | { |
2072 | struct listnode *node; | |
2073 | struct isis_area *area; | |
52a7c25e | 2074 | int level; |
eb2bcb28 CF |
2075 | |
2076 | if (isis->area_list->count == 0) | |
52a7c25e | 2077 | return; |
eb2bcb28 | 2078 | |
d62a17ae | 2079 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { |
2080 | vty_out(vty, "Area %s:\n", | |
2081 | area->area_tag ? area->area_tag : "null"); | |
2082 | ||
52a7c25e RW |
2083 | for (level = 0; level < ISIS_LEVELS; level++) |
2084 | show_isis_database_lspdb(vty, area, level, | |
2085 | &area->lspdb[level], argv, | |
2086 | ui_level); | |
d62a17ae | 2087 | } |
eab88f36 K |
2088 | } |
2089 | /* | |
2090 | * This function supports following display options: | |
2091 | * [ show isis database [detail] ] | |
2092 | * [ show isis database <sysid> [detail] ] | |
2093 | * [ show isis database <hostname> [detail] ] | |
2094 | * [ show isis database <sysid>.<pseudo-id> [detail] ] | |
2095 | * [ show isis database <hostname>.<pseudo-id> [detail] ] | |
2096 | * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ] | |
2097 | * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ] | |
2098 | * [ show isis database detail <sysid> ] | |
2099 | * [ show isis database detail <hostname> ] | |
2100 | * [ show isis database detail <sysid>.<pseudo-id> ] | |
2101 | * [ show isis database detail <hostname>.<pseudo-id> ] | |
2102 | * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ] | |
2103 | * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ] | |
2104 | */ | |
2105 | static int show_isis_database(struct vty *vty, const char *argv, int ui_level, | |
2106 | const char *vrf_name, bool all_vrf) | |
2107 | { | |
36944791 RW |
2108 | struct listnode *node; |
2109 | struct isis *isis; | |
eab88f36 K |
2110 | |
2111 | if (vrf_name) { | |
2112 | if (all_vrf) { | |
36944791 | 2113 | for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) |
eab88f36 K |
2114 | show_isis_database_common(vty, argv, ui_level, |
2115 | isis); | |
36944791 RW |
2116 | |
2117 | return CMD_SUCCESS; | |
eab88f36 K |
2118 | } |
2119 | isis = isis_lookup_by_vrfname(vrf_name); | |
36944791 | 2120 | if (isis) |
eab88f36 K |
2121 | show_isis_database_common(vty, argv, ui_level, isis); |
2122 | } | |
d62a17ae | 2123 | |
2124 | return CMD_SUCCESS; | |
eb5d44eb | 2125 | } |
2126 | ||
eab88f36 K |
2127 | DEFUN(show_database, show_database_cmd, |
2128 | "show " PROTO_NAME " [vrf <NAME|all>] database [detail] [WORD]", | |
2129 | SHOW_STR PROTO_HELP VRF_CMD_HELP_STR | |
2130 | "All VRFs\n" | |
2131 | "Link state database\n" | |
2132 | "Detailed information\n" | |
2133 | "LSP ID\n") | |
3f045a08 | 2134 | { |
d62a17ae | 2135 | int idx = 0; |
eab88f36 K |
2136 | int idx_vrf = 0; |
2137 | const char *vrf_name = VRF_DEFAULT_NAME; | |
2138 | bool all_vrf = false; | |
d62a17ae | 2139 | int uilevel = argv_find(argv, argc, "detail", &idx) |
2140 | ? ISIS_UI_LEVEL_DETAIL | |
2141 | : ISIS_UI_LEVEL_BRIEF; | |
2142 | char *id = argv_find(argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL; | |
eab88f36 K |
2143 | ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); |
2144 | return show_isis_database(vty, id, uilevel, vrf_name, all_vrf); | |
3f045a08 JB |
2145 | } |
2146 | ||
aaf2fd21 | 2147 | #ifdef FABRICD |
d62a17ae | 2148 | /* |
aaf2fd21 | 2149 | * 'router openfabric' command |
3f045a08 | 2150 | */ |
aaf2fd21 EDP |
2151 | DEFUN_NOSH (router_openfabric, |
2152 | router_openfabric_cmd, | |
2153 | "router openfabric WORD", | |
3f045a08 | 2154 | ROUTER_STR |
7c0cbd0e | 2155 | PROTO_HELP |
efd7904e | 2156 | "ISO Routing area tag\n") |
3f045a08 | 2157 | { |
d62a17ae | 2158 | int idx_word = 2; |
2159 | return isis_area_get(vty, argv[idx_word]->arg); | |
3f045a08 JB |
2160 | } |
2161 | ||
d62a17ae | 2162 | /* |
aaf2fd21 | 2163 | *'no router openfabric' command |
3f045a08 | 2164 | */ |
aaf2fd21 EDP |
2165 | DEFUN (no_router_openfabric, |
2166 | no_router_openfabric_cmd, | |
2167 | "no router openfabric WORD", | |
7c0cbd0e CF |
2168 | NO_STR |
2169 | ROUTER_STR | |
2170 | PROTO_HELP | |
2171 | "ISO Routing area tag\n") | |
eb5d44eb | 2172 | { |
14c6e772 RW |
2173 | struct isis_area *area; |
2174 | const char *area_tag; | |
d62a17ae | 2175 | int idx_word = 3; |
14c6e772 RW |
2176 | |
2177 | area_tag = argv[idx_word]->arg; | |
eab88f36 | 2178 | area = isis_area_lookup(area_tag, VRF_DEFAULT); |
14c6e772 RW |
2179 | if (area == NULL) { |
2180 | zlog_warn("%s: could not find area with area-tag %s", | |
2181 | __func__, area_tag); | |
2182 | return CMD_ERR_NO_MATCH; | |
2183 | } | |
2184 | ||
2185 | isis_area_destroy(area); | |
2186 | return CMD_SUCCESS; | |
eb5d44eb | 2187 | } |
aaf2fd21 | 2188 | #endif /* ifdef FABRICD */ |
f084ea55 | 2189 | #ifdef FABRICD |
eb5d44eb | 2190 | /* |
2191 | * 'net' command | |
2192 | */ | |
2193 | DEFUN (net, | |
2194 | net_cmd, | |
2195 | "net WORD", | |
2196 | "A Network Entity Title for this process (OSI only)\n" | |
f390d2c7 | 2197 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") |
eb5d44eb | 2198 | { |
d62a17ae | 2199 | int idx_word = 1; |
2200 | return area_net_title(vty, argv[idx_word]->arg); | |
eb5d44eb | 2201 | } |
2202 | ||
eb5d44eb | 2203 | /* |
2204 | * 'no net' command | |
2205 | */ | |
2206 | DEFUN (no_net, | |
2207 | no_net_cmd, | |
2208 | "no net WORD", | |
2209 | NO_STR | |
2210 | "A Network Entity Title for this process (OSI only)\n" | |
f390d2c7 | 2211 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") |
eb5d44eb | 2212 | { |
d62a17ae | 2213 | int idx_word = 2; |
2214 | return area_clear_net_title(vty, argv[idx_word]->arg); | |
eb5d44eb | 2215 | } |
f084ea55 | 2216 | #endif /* ifdef FABRICD */ |
22af6a80 | 2217 | #ifdef FABRICD |
064f4896 CF |
2218 | DEFUN (isis_topology, |
2219 | isis_topology_cmd, | |
2220 | "topology " ISIS_MT_NAMES " [overload]", | |
2221 | "Configure IS-IS topologies\n" | |
2222 | ISIS_MT_DESCRIPTIONS | |
2223 | "Set overload bit for topology\n") | |
2224 | { | |
d62a17ae | 2225 | VTY_DECLVAR_CONTEXT(isis_area, area); |
064f4896 | 2226 | |
d62a17ae | 2227 | const char *arg = argv[1]->arg; |
2228 | uint16_t mtid = isis_str2mtid(arg); | |
c3ea3906 | 2229 | |
d62a17ae | 2230 | if (area->oldmetric) { |
2231 | vty_out(vty, | |
2232 | "Multi topology IS-IS can only be used with wide metrics\n"); | |
a5fdb4c5 | 2233 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 2234 | } |
c3ea3906 | 2235 | |
d62a17ae | 2236 | if (mtid == (uint16_t)-1) { |
2237 | vty_out(vty, "Don't know topology '%s'\n", arg); | |
a5fdb4c5 | 2238 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 2239 | } |
2240 | if (mtid == ISIS_MT_IPV4_UNICAST) { | |
2241 | vty_out(vty, "Cannot configure IPv4 unicast topology\n"); | |
a5fdb4c5 | 2242 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 2243 | } |
064f4896 | 2244 | |
d62a17ae | 2245 | area_set_mt_enabled(area, mtid, true); |
2246 | area_set_mt_overload(area, mtid, (argc == 3)); | |
2247 | return CMD_SUCCESS; | |
064f4896 CF |
2248 | } |
2249 | ||
2250 | DEFUN (no_isis_topology, | |
2251 | no_isis_topology_cmd, | |
2252 | "no topology " ISIS_MT_NAMES " [overload]", | |
2253 | NO_STR | |
2254 | "Configure IS-IS topologies\n" | |
2255 | ISIS_MT_DESCRIPTIONS | |
2256 | "Set overload bit for topology\n") | |
2257 | { | |
d62a17ae | 2258 | VTY_DECLVAR_CONTEXT(isis_area, area); |
064f4896 | 2259 | |
d62a17ae | 2260 | const char *arg = argv[2]->arg; |
2261 | uint16_t mtid = isis_str2mtid(arg); | |
c3ea3906 | 2262 | |
d62a17ae | 2263 | if (area->oldmetric) { |
2264 | vty_out(vty, | |
2265 | "Multi topology IS-IS can only be used with wide metrics\n"); | |
a5fdb4c5 | 2266 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 2267 | } |
c3ea3906 | 2268 | |
d62a17ae | 2269 | if (mtid == (uint16_t)-1) { |
2270 | vty_out(vty, "Don't know topology '%s'\n", arg); | |
a5fdb4c5 | 2271 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 2272 | } |
2273 | if (mtid == ISIS_MT_IPV4_UNICAST) { | |
2274 | vty_out(vty, "Cannot configure IPv4 unicast topology\n"); | |
a5fdb4c5 | 2275 | return CMD_WARNING_CONFIG_FAILED; |
d62a17ae | 2276 | } |
064f4896 | 2277 | |
d62a17ae | 2278 | area_set_mt_enabled(area, mtid, false); |
2279 | area_set_mt_overload(area, mtid, false); | |
2280 | return CMD_SUCCESS; | |
064f4896 | 2281 | } |
22af6a80 | 2282 | #endif /* ifdef FABRICD */ |
064f4896 | 2283 | |
6754fc66 | 2284 | void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu) |
b20ccb3a | 2285 | { |
d62a17ae | 2286 | area->lsp_mtu = lsp_mtu; |
2287 | lsp_regenerate_schedule(area, IS_LEVEL_1_AND_2, 1); | |
2288 | } | |
2289 | ||
2290 | static int isis_area_passwd_set(struct isis_area *area, int level, | |
d7c0a89a QY |
2291 | uint8_t passwd_type, const char *passwd, |
2292 | uint8_t snp_auth) | |
d62a17ae | 2293 | { |
2294 | struct isis_passwd *dest; | |
2295 | struct isis_passwd modified; | |
2296 | int len; | |
2297 | ||
2298 | assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2)); | |
2299 | dest = (level == IS_LEVEL_1) ? &area->area_passwd | |
2300 | : &area->domain_passwd; | |
2301 | memset(&modified, 0, sizeof(modified)); | |
2302 | ||
2303 | if (passwd_type != ISIS_PASSWD_TYPE_UNUSED) { | |
2304 | if (!passwd) | |
2305 | return -1; | |
2306 | ||
2307 | len = strlen(passwd); | |
2308 | if (len > 254) | |
2309 | return -1; | |
2310 | ||
2311 | modified.len = len; | |
e28544ed QY |
2312 | strlcpy((char *)modified.passwd, passwd, |
2313 | sizeof(modified.passwd)); | |
d62a17ae | 2314 | modified.type = passwd_type; |
2315 | modified.snp_auth = snp_auth; | |
2316 | } | |
2317 | ||
2318 | if (memcmp(&modified, dest, sizeof(modified))) { | |
2319 | memcpy(dest, &modified, sizeof(modified)); | |
2320 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
2321 | } | |
2322 | ||
2323 | return 0; | |
2324 | } | |
2325 | ||
2326 | int isis_area_passwd_unset(struct isis_area *area, int level) | |
2327 | { | |
2328 | return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_UNUSED, NULL, | |
2329 | 0); | |
2330 | } | |
2331 | ||
2332 | int isis_area_passwd_cleartext_set(struct isis_area *area, int level, | |
d7c0a89a | 2333 | const char *passwd, uint8_t snp_auth) |
d62a17ae | 2334 | { |
2335 | return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_CLEARTXT, | |
2336 | passwd, snp_auth); | |
2337 | } | |
2338 | ||
2339 | int isis_area_passwd_hmac_md5_set(struct isis_area *area, int level, | |
d7c0a89a | 2340 | const char *passwd, uint8_t snp_auth) |
d62a17ae | 2341 | { |
2342 | return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_HMAC_MD5, | |
2343 | passwd, snp_auth); | |
b20ccb3a CF |
2344 | } |
2345 | ||
3dace42d CF |
2346 | void isis_area_invalidate_routes(struct isis_area *area, int levels) |
2347 | { | |
2348 | for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) { | |
2349 | if (!(level & levels)) | |
2350 | continue; | |
be985ba0 CF |
2351 | for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) { |
2352 | isis_spf_invalidate_routes( | |
2353 | area->spftree[tree][level - 1]); | |
2354 | } | |
3dace42d CF |
2355 | } |
2356 | } | |
2357 | ||
2358 | void isis_area_verify_routes(struct isis_area *area) | |
2359 | { | |
be985ba0 CF |
2360 | for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) |
2361 | isis_spf_verify_routes(area, area->spftree[tree]); | |
3dace42d CF |
2362 | } |
2363 | ||
d62a17ae | 2364 | static void area_resign_level(struct isis_area *area, int level) |
3f045a08 | 2365 | { |
3dace42d CF |
2366 | isis_area_invalidate_routes(area, level); |
2367 | isis_area_verify_routes(area); | |
2368 | ||
4bef0ec4 | 2369 | lsp_db_fini(&area->lspdb[level - 1]); |
be985ba0 CF |
2370 | |
2371 | for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) { | |
2372 | if (area->spftree[tree][level - 1]) { | |
2373 | isis_spftree_del(area->spftree[tree][level - 1]); | |
2374 | area->spftree[tree][level - 1] = NULL; | |
2375 | } | |
d62a17ae | 2376 | } |
be985ba0 | 2377 | |
50478845 | 2378 | thread_cancel(&area->spf_timer[level - 1]); |
3f045a08 | 2379 | |
d62a17ae | 2380 | sched_debug( |
2381 | "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.", | |
2382 | area->area_tag, level); | |
50478845 | 2383 | thread_cancel(&area->t_lsp_refresh[level - 1]); |
d62a17ae | 2384 | area->lsp_regenerate_pending[level - 1] = 0; |
2385 | } | |
3f045a08 | 2386 | |
d62a17ae | 2387 | void isis_area_is_type_set(struct isis_area *area, int is_type) |
2388 | { | |
2389 | struct listnode *node; | |
2390 | struct isis_circuit *circuit; | |
3f045a08 | 2391 | |
e740f9c1 | 2392 | if (IS_DEBUG_EVENTS) |
d62a17ae | 2393 | zlog_debug("ISIS-Evt (%s) system type change %s -> %s", |
2394 | area->area_tag, circuit_t2string(area->is_type), | |
2395 | circuit_t2string(is_type)); | |
f390d2c7 | 2396 | |
d62a17ae | 2397 | if (area->is_type == is_type) |
2398 | return; /* No change */ | |
2399 | ||
2400 | switch (area->is_type) { | |
2401 | case IS_LEVEL_1: | |
2402 | if (is_type == IS_LEVEL_2) | |
2403 | area_resign_level(area, IS_LEVEL_1); | |
2404 | ||
4bef0ec4 | 2405 | lsp_db_init(&area->lspdb[1]); |
d62a17ae | 2406 | break; |
2407 | ||
2408 | case IS_LEVEL_1_AND_2: | |
2409 | if (is_type == IS_LEVEL_1) | |
2410 | area_resign_level(area, IS_LEVEL_2); | |
2411 | else | |
2412 | area_resign_level(area, IS_LEVEL_1); | |
2413 | break; | |
2414 | ||
2415 | case IS_LEVEL_2: | |
2416 | if (is_type == IS_LEVEL_1) | |
2417 | area_resign_level(area, IS_LEVEL_2); | |
2418 | ||
4bef0ec4 | 2419 | lsp_db_init(&area->lspdb[0]); |
d62a17ae | 2420 | break; |
2421 | ||
2422 | default: | |
2423 | break; | |
2424 | } | |
2425 | ||
2426 | area->is_type = is_type; | |
2427 | ||
2428 | /* override circuit's is_type */ | |
2429 | if (area->is_type != IS_LEVEL_1_AND_2) { | |
2430 | for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) | |
2431 | isis_circuit_is_type_set(circuit, is_type); | |
2432 | } | |
2433 | ||
2434 | spftree_area_init(area); | |
2435 | ||
2436 | if (listcount(area->area_addrs) > 0) { | |
2437 | if (is_type & IS_LEVEL_1) | |
2438 | lsp_generate(area, IS_LEVEL_1); | |
2439 | if (is_type & IS_LEVEL_2) | |
2440 | lsp_generate(area, IS_LEVEL_2); | |
2441 | } | |
2442 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
2443 | ||
2444 | return; | |
eb5d44eb | 2445 | } |
2446 | ||
a38a72db CF |
2447 | void isis_area_metricstyle_set(struct isis_area *area, bool old_metric, |
2448 | bool new_metric) | |
e38e0df0 | 2449 | { |
e0df3206 EDP |
2450 | area->oldmetric = old_metric; |
2451 | area->newmetric = new_metric; | |
2452 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
e38e0df0 SV |
2453 | } |
2454 | ||
a38a72db | 2455 | void isis_area_overload_bit_set(struct isis_area *area, bool overload_bit) |
eb5d44eb | 2456 | { |
d62a17ae | 2457 | char new_overload_bit = overload_bit ? LSPBIT_OL : 0; |
eb5d44eb | 2458 | |
d62a17ae | 2459 | if (new_overload_bit != area->overload_bit) { |
2460 | area->overload_bit = new_overload_bit; | |
2461 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
2462 | } | |
9414b6f6 EDP |
2463 | #ifndef FABRICD |
2464 | isis_notif_db_overload(area, overload_bit); | |
2465 | #endif /* ifndef FABRICD */ | |
3f045a08 JB |
2466 | } |
2467 | ||
a38a72db | 2468 | void isis_area_attached_bit_set(struct isis_area *area, bool attached_bit) |
3f045a08 | 2469 | { |
d62a17ae | 2470 | char new_attached_bit = attached_bit ? LSPBIT_ATT : 0; |
3f045a08 | 2471 | |
d62a17ae | 2472 | if (new_attached_bit != area->attached_bit) { |
2473 | area->attached_bit = new_attached_bit; | |
2474 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1); | |
2475 | } | |
eb5d44eb | 2476 | } |
2477 | ||
a38a72db | 2478 | void isis_area_dynhostname_set(struct isis_area *area, bool dynhostname) |
eb5d44eb | 2479 | { |
d62a17ae | 2480 | if (area->dynhostname != dynhostname) { |
2481 | area->dynhostname = dynhostname; | |
2482 | lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0); | |
2483 | } | |
eb5d44eb | 2484 | } |
2485 | ||
d62a17ae | 2486 | void isis_area_max_lsp_lifetime_set(struct isis_area *area, int level, |
2487 | uint16_t max_lsp_lifetime) | |
eb5d44eb | 2488 | { |
d62a17ae | 2489 | assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2)); |
eb5d44eb | 2490 | |
d62a17ae | 2491 | if (area->max_lsp_lifetime[level - 1] == max_lsp_lifetime) |
2492 | return; | |
3f045a08 | 2493 | |
d62a17ae | 2494 | area->max_lsp_lifetime[level - 1] = max_lsp_lifetime; |
2495 | lsp_regenerate_schedule(area, level, 1); | |
3f045a08 JB |
2496 | } |
2497 | ||
d62a17ae | 2498 | void isis_area_lsp_refresh_set(struct isis_area *area, int level, |
2499 | uint16_t lsp_refresh) | |
3f045a08 | 2500 | { |
d62a17ae | 2501 | assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2)); |
eb5d44eb | 2502 | |
d62a17ae | 2503 | if (area->lsp_refresh[level - 1] == lsp_refresh) |
2504 | return; | |
eb5d44eb | 2505 | |
d62a17ae | 2506 | area->lsp_refresh[level - 1] = lsp_refresh; |
2507 | lsp_regenerate_schedule(area, level, 1); | |
3f045a08 JB |
2508 | } |
2509 | ||
2adf66ff | 2510 | #ifdef FABRICD |
3f045a08 JB |
2511 | DEFUN (log_adj_changes, |
2512 | log_adj_changes_cmd, | |
2513 | "log-adjacency-changes", | |
2514 | "Log changes in adjacency state\n") | |
2515 | { | |
d62a17ae | 2516 | VTY_DECLVAR_CONTEXT(isis_area, area); |
eb5d44eb | 2517 | |
d62a17ae | 2518 | area->log_adj_changes = 1; |
eb5d44eb | 2519 | |
d62a17ae | 2520 | return CMD_SUCCESS; |
eb5d44eb | 2521 | } |
2522 | ||
3f045a08 JB |
2523 | DEFUN (no_log_adj_changes, |
2524 | no_log_adj_changes_cmd, | |
2525 | "no log-adjacency-changes", | |
d7fa34c1 | 2526 | NO_STR |
3f045a08 | 2527 | "Stop logging changes in adjacency state\n") |
eb5d44eb | 2528 | { |
d62a17ae | 2529 | VTY_DECLVAR_CONTEXT(isis_area, area); |
f390d2c7 | 2530 | |
d62a17ae | 2531 | area->log_adj_changes = 0; |
eb5d44eb | 2532 | |
d62a17ae | 2533 | return CMD_SUCCESS; |
eb5d44eb | 2534 | } |
2adf66ff | 2535 | #endif /* ifdef FABRICD */ |
20600086 | 2536 | #ifdef FABRICD |
eb5d44eb | 2537 | /* IS-IS configuration write function */ |
612c2c15 | 2538 | static int isis_config_write(struct vty *vty) |
d62a17ae | 2539 | { |
2540 | int write = 0; | |
eab88f36 | 2541 | struct isis_area *area; |
36944791 RW |
2542 | struct listnode *node, *node2, *inode; |
2543 | struct isis *isis; | |
eab88f36 K |
2544 | |
2545 | if (!im) { | |
2546 | vty_out(vty, "IS-IS Routing Process not enabled\n"); | |
2547 | return CMD_SUCCESS; | |
2548 | } | |
d62a17ae | 2549 | |
36944791 | 2550 | for (ALL_LIST_ELEMENTS_RO(im->isis, inode, isis)) { |
d62a17ae | 2551 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { |
2552 | /* ISIS - Area name */ | |
7c0cbd0e | 2553 | vty_out(vty, "router " PROTO_NAME " %s\n", area->area_tag); |
d62a17ae | 2554 | write++; |
2555 | /* ISIS - Net */ | |
2556 | if (listcount(area->area_addrs) > 0) { | |
2557 | struct area_addr *area_addr; | |
2558 | for (ALL_LIST_ELEMENTS_RO(area->area_addrs, | |
2559 | node2, area_addr)) { | |
2560 | vty_out(vty, " net %s\n", | |
2561 | isonet_print( | |
2562 | area_addr->area_addr, | |
2563 | area_addr->addr_len | |
2564 | + ISIS_SYS_ID_LEN | |
2565 | + 1)); | |
2566 | write++; | |
2567 | } | |
2568 | } | |
2569 | /* ISIS - Dynamic hostname - Defaults to true so only | |
2570 | * display if | |
2571 | * false. */ | |
2572 | if (!area->dynhostname) { | |
2573 | vty_out(vty, " no hostname dynamic\n"); | |
2574 | write++; | |
2575 | } | |
2576 | /* ISIS - Metric-Style - when true displays wide */ | |
65f18157 CF |
2577 | if (!fabricd) { |
2578 | if (area->newmetric) { | |
2579 | if (!area->oldmetric) | |
2580 | vty_out(vty, " metric-style wide\n"); | |
2581 | else | |
2582 | vty_out(vty, | |
2583 | " metric-style transition\n"); | |
2584 | write++; | |
2585 | } else { | |
2586 | vty_out(vty, " metric-style narrow\n"); | |
2587 | write++; | |
2588 | } | |
d62a17ae | 2589 | } |
2590 | /* ISIS - overload-bit */ | |
2591 | if (area->overload_bit) { | |
2592 | vty_out(vty, " set-overload-bit\n"); | |
2593 | write++; | |
2594 | } | |
2595 | /* ISIS - Area is-type (level-1-2 is default) */ | |
65f18157 CF |
2596 | if (!fabricd) { |
2597 | if (area->is_type == IS_LEVEL_1) { | |
2598 | vty_out(vty, " is-type level-1\n"); | |
2599 | write++; | |
2600 | } else if (area->is_type == IS_LEVEL_2) { | |
2601 | vty_out(vty, " is-type level-2-only\n"); | |
2602 | write++; | |
2603 | } | |
d62a17ae | 2604 | } |
2605 | write += isis_redist_config_write(vty, area, AF_INET); | |
2606 | write += isis_redist_config_write(vty, area, AF_INET6); | |
2607 | /* ISIS - Lsp generation interval */ | |
2608 | if (area->lsp_gen_interval[0] | |
2609 | == area->lsp_gen_interval[1]) { | |
2610 | if (area->lsp_gen_interval[0] | |
2611 | != DEFAULT_MIN_LSP_GEN_INTERVAL) { | |
2612 | vty_out(vty, " lsp-gen-interval %d\n", | |
2613 | area->lsp_gen_interval[0]); | |
2614 | write++; | |
2615 | } | |
2616 | } else { | |
2617 | if (area->lsp_gen_interval[0] | |
2618 | != DEFAULT_MIN_LSP_GEN_INTERVAL) { | |
2619 | vty_out(vty, | |
2620 | " lsp-gen-interval level-1 %d\n", | |
2621 | area->lsp_gen_interval[0]); | |
2622 | write++; | |
2623 | } | |
2624 | if (area->lsp_gen_interval[1] | |
2625 | != DEFAULT_MIN_LSP_GEN_INTERVAL) { | |
2626 | vty_out(vty, | |
2627 | " lsp-gen-interval level-2 %d\n", | |
2628 | area->lsp_gen_interval[1]); | |
2629 | write++; | |
2630 | } | |
2631 | } | |
2632 | /* ISIS - LSP lifetime */ | |
2633 | if (area->max_lsp_lifetime[0] | |
2634 | == area->max_lsp_lifetime[1]) { | |
2635 | if (area->max_lsp_lifetime[0] | |
2636 | != DEFAULT_LSP_LIFETIME) { | |
2637 | vty_out(vty, " max-lsp-lifetime %u\n", | |
2638 | area->max_lsp_lifetime[0]); | |
2639 | write++; | |
2640 | } | |
2641 | } else { | |
2642 | if (area->max_lsp_lifetime[0] | |
2643 | != DEFAULT_LSP_LIFETIME) { | |
2644 | vty_out(vty, | |
2645 | " max-lsp-lifetime level-1 %u\n", | |
2646 | area->max_lsp_lifetime[0]); | |
2647 | write++; | |
2648 | } | |
2649 | if (area->max_lsp_lifetime[1] | |
2650 | != DEFAULT_LSP_LIFETIME) { | |
2651 | vty_out(vty, | |
2652 | " max-lsp-lifetime level-2 %u\n", | |
2653 | area->max_lsp_lifetime[1]); | |
2654 | write++; | |
2655 | } | |
2656 | } | |
2657 | /* ISIS - LSP refresh interval */ | |
2658 | if (area->lsp_refresh[0] == area->lsp_refresh[1]) { | |
2659 | if (area->lsp_refresh[0] | |
2660 | != DEFAULT_MAX_LSP_GEN_INTERVAL) { | |
2661 | vty_out(vty, | |
2662 | " lsp-refresh-interval %u\n", | |
2663 | area->lsp_refresh[0]); | |
2664 | write++; | |
2665 | } | |
2666 | } else { | |
2667 | if (area->lsp_refresh[0] | |
2668 | != DEFAULT_MAX_LSP_GEN_INTERVAL) { | |
2669 | vty_out(vty, | |
2670 | " lsp-refresh-interval level-1 %u\n", | |
2671 | area->lsp_refresh[0]); | |
2672 | write++; | |
2673 | } | |
2674 | if (area->lsp_refresh[1] | |
2675 | != DEFAULT_MAX_LSP_GEN_INTERVAL) { | |
2676 | vty_out(vty, | |
2677 | " lsp-refresh-interval level-2 %u\n", | |
2678 | area->lsp_refresh[1]); | |
2679 | write++; | |
2680 | } | |
2681 | } | |
2682 | if (area->lsp_mtu != DEFAULT_LSP_MTU) { | |
2683 | vty_out(vty, " lsp-mtu %u\n", area->lsp_mtu); | |
2684 | write++; | |
2685 | } | |
2c92bee4 CF |
2686 | if (area->purge_originator) { |
2687 | vty_out(vty, " purge-originator\n"); | |
2688 | write++; | |
2689 | } | |
d62a17ae | 2690 | |
2691 | /* Minimum SPF interval. */ | |
2692 | if (area->min_spf_interval[0] | |
2693 | == area->min_spf_interval[1]) { | |
2694 | if (area->min_spf_interval[0] | |
2695 | != MINIMUM_SPF_INTERVAL) { | |
2696 | vty_out(vty, " spf-interval %d\n", | |
2697 | area->min_spf_interval[0]); | |
2698 | write++; | |
2699 | } | |
2700 | } else { | |
2701 | if (area->min_spf_interval[0] | |
2702 | != MINIMUM_SPF_INTERVAL) { | |
2703 | vty_out(vty, | |
2704 | " spf-interval level-1 %d\n", | |
2705 | area->min_spf_interval[0]); | |
2706 | write++; | |
2707 | } | |
2708 | if (area->min_spf_interval[1] | |
2709 | != MINIMUM_SPF_INTERVAL) { | |
2710 | vty_out(vty, | |
2711 | " spf-interval level-2 %d\n", | |
2712 | area->min_spf_interval[1]); | |
2713 | write++; | |
2714 | } | |
2715 | } | |
2716 | ||
2717 | /* IETF SPF interval */ | |
2718 | if (area->spf_delay_ietf[0]) { | |
2719 | vty_out(vty, | |
2720 | " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n", | |
2721 | spf_backoff_init_delay( | |
2722 | area->spf_delay_ietf[0]), | |
2723 | spf_backoff_short_delay( | |
2724 | area->spf_delay_ietf[0]), | |
2725 | spf_backoff_long_delay( | |
2726 | area->spf_delay_ietf[0]), | |
2727 | spf_backoff_holddown( | |
2728 | area->spf_delay_ietf[0]), | |
2729 | spf_backoff_timetolearn( | |
2730 | area->spf_delay_ietf[0])); | |
2731 | write++; | |
2732 | } | |
2733 | ||
2734 | /* Authentication passwords. */ | |
2735 | if (area->area_passwd.type | |
2736 | == ISIS_PASSWD_TYPE_HMAC_MD5) { | |
2737 | vty_out(vty, " area-password md5 %s", | |
2738 | area->area_passwd.passwd); | |
2739 | if (CHECK_FLAG(area->area_passwd.snp_auth, | |
2740 | SNP_AUTH_SEND)) { | |
2741 | vty_out(vty, " authenticate snp "); | |
2742 | if (CHECK_FLAG( | |
2743 | area->area_passwd.snp_auth, | |
2744 | SNP_AUTH_RECV)) | |
2745 | vty_out(vty, "validate"); | |
2746 | else | |
2747 | vty_out(vty, "send-only"); | |
2748 | } | |
2749 | vty_out(vty, "\n"); | |
2750 | write++; | |
2751 | } else if (area->area_passwd.type | |
2752 | == ISIS_PASSWD_TYPE_CLEARTXT) { | |
2753 | vty_out(vty, " area-password clear %s", | |
2754 | area->area_passwd.passwd); | |
2755 | if (CHECK_FLAG(area->area_passwd.snp_auth, | |
2756 | SNP_AUTH_SEND)) { | |
2757 | vty_out(vty, " authenticate snp "); | |
2758 | if (CHECK_FLAG( | |
2759 | area->area_passwd.snp_auth, | |
2760 | SNP_AUTH_RECV)) | |
2761 | vty_out(vty, "validate"); | |
2762 | else | |
2763 | vty_out(vty, "send-only"); | |
2764 | } | |
2765 | vty_out(vty, "\n"); | |
2766 | write++; | |
2767 | } | |
2768 | if (area->domain_passwd.type | |
2769 | == ISIS_PASSWD_TYPE_HMAC_MD5) { | |
2770 | vty_out(vty, " domain-password md5 %s", | |
2771 | area->domain_passwd.passwd); | |
2772 | if (CHECK_FLAG(area->domain_passwd.snp_auth, | |
2773 | SNP_AUTH_SEND)) { | |
2774 | vty_out(vty, " authenticate snp "); | |
2775 | if (CHECK_FLAG(area->domain_passwd | |
2776 | .snp_auth, | |
2777 | SNP_AUTH_RECV)) | |
2778 | vty_out(vty, "validate"); | |
2779 | else | |
2780 | vty_out(vty, "send-only"); | |
2781 | } | |
2782 | vty_out(vty, "\n"); | |
2783 | write++; | |
2784 | } else if (area->domain_passwd.type | |
2785 | == ISIS_PASSWD_TYPE_CLEARTXT) { | |
2786 | vty_out(vty, " domain-password clear %s", | |
2787 | area->domain_passwd.passwd); | |
2788 | if (CHECK_FLAG(area->domain_passwd.snp_auth, | |
2789 | SNP_AUTH_SEND)) { | |
2790 | vty_out(vty, " authenticate snp "); | |
2791 | if (CHECK_FLAG(area->domain_passwd | |
2792 | .snp_auth, | |
2793 | SNP_AUTH_RECV)) | |
2794 | vty_out(vty, "validate"); | |
2795 | else | |
2796 | vty_out(vty, "send-only"); | |
2797 | } | |
2798 | vty_out(vty, "\n"); | |
2799 | write++; | |
2800 | } | |
2801 | ||
2802 | if (area->log_adj_changes) { | |
2803 | vty_out(vty, " log-adjacency-changes\n"); | |
2804 | write++; | |
2805 | } | |
2806 | ||
2807 | write += area_write_mt_settings(area, vty); | |
92ed0cde | 2808 | write += fabricd_write_settings(area, vty); |
d62a17ae | 2809 | } |
d62a17ae | 2810 | } |
2811 | ||
2812 | return write; | |
2813 | } | |
2814 | ||
f4b8291f DL |
2815 | struct cmd_node router_node = { |
2816 | .name = "openfabric", | |
2817 | .node = OPENFABRIC_NODE, | |
2818 | .parent_node = CONFIG_NODE, | |
2819 | .prompt = "%s(config-router)# ", | |
2820 | .config_write = isis_config_write, | |
2821 | }; | |
20600086 EDP |
2822 | #else |
2823 | /* IS-IS configuration write function */ | |
612c2c15 | 2824 | static int isis_config_write(struct vty *vty) |
20600086 EDP |
2825 | { |
2826 | int write = 0; | |
2827 | struct lyd_node *dnode; | |
2828 | ||
2829 | dnode = yang_dnode_get(running_config->dnode, "/frr-isisd:isis"); | |
cc50ddb2 | 2830 | if (dnode) { |
20600086 | 2831 | nb_cli_show_dnode_cmds(vty, dnode, false); |
cc50ddb2 EDP |
2832 | write++; |
2833 | } | |
20600086 EDP |
2834 | |
2835 | return write; | |
2836 | } | |
20600086 | 2837 | |
62b346ee | 2838 | struct cmd_node router_node = { |
f4b8291f DL |
2839 | .name = "isis", |
2840 | .node = ISIS_NODE, | |
24389580 | 2841 | .parent_node = CONFIG_NODE, |
62b346ee | 2842 | .prompt = "%s(config-router)# ", |
612c2c15 | 2843 | .config_write = isis_config_write, |
62b346ee | 2844 | }; |
f4b8291f | 2845 | #endif /* ifdef FABRICD */ |
d62a17ae | 2846 | |
4d762f26 | 2847 | void isis_init(void) |
d62a17ae | 2848 | { |
2849 | /* Install IS-IS top node */ | |
612c2c15 | 2850 | install_node(&router_node); |
d62a17ae | 2851 | |
2852 | install_element(VIEW_NODE, &show_isis_summary_cmd); | |
2853 | ||
2854 | install_element(VIEW_NODE, &show_isis_spf_ietf_cmd); | |
2855 | ||
2856 | install_element(VIEW_NODE, &show_isis_interface_cmd); | |
2857 | install_element(VIEW_NODE, &show_isis_interface_detail_cmd); | |
2858 | install_element(VIEW_NODE, &show_isis_interface_arg_cmd); | |
2859 | ||
2860 | install_element(VIEW_NODE, &show_isis_neighbor_cmd); | |
2861 | install_element(VIEW_NODE, &show_isis_neighbor_detail_cmd); | |
2862 | install_element(VIEW_NODE, &show_isis_neighbor_arg_cmd); | |
2b55d953 IR |
2863 | install_element(ENABLE_NODE, &clear_isis_neighbor_cmd); |
2864 | install_element(ENABLE_NODE, &clear_isis_neighbor_arg_cmd); | |
d62a17ae | 2865 | |
2866 | install_element(VIEW_NODE, &show_hostname_cmd); | |
2867 | install_element(VIEW_NODE, &show_database_cmd); | |
2868 | ||
2869 | install_element(ENABLE_NODE, &show_debugging_isis_cmd); | |
2870 | ||
612c2c15 | 2871 | install_node(&debug_node); |
d62a17ae | 2872 | |
2873 | install_element(ENABLE_NODE, &debug_isis_adj_cmd); | |
2874 | install_element(ENABLE_NODE, &no_debug_isis_adj_cmd); | |
161fa356 CF |
2875 | install_element(ENABLE_NODE, &debug_isis_tx_queue_cmd); |
2876 | install_element(ENABLE_NODE, &no_debug_isis_tx_queue_cmd); | |
ddb33326 CF |
2877 | install_element(ENABLE_NODE, &debug_isis_flooding_cmd); |
2878 | install_element(ENABLE_NODE, &no_debug_isis_flooding_cmd); | |
d62a17ae | 2879 | install_element(ENABLE_NODE, &debug_isis_snp_cmd); |
2880 | install_element(ENABLE_NODE, &no_debug_isis_snp_cmd); | |
2881 | install_element(ENABLE_NODE, &debug_isis_upd_cmd); | |
2882 | install_element(ENABLE_NODE, &no_debug_isis_upd_cmd); | |
2883 | install_element(ENABLE_NODE, &debug_isis_spfevents_cmd); | |
2884 | install_element(ENABLE_NODE, &no_debug_isis_spfevents_cmd); | |
26f6acaf RW |
2885 | install_element(ENABLE_NODE, &debug_isis_srevents_cmd); |
2886 | install_element(ENABLE_NODE, &no_debug_isis_srevents_cmd); | |
c951ee6e RW |
2887 | install_element(ENABLE_NODE, &debug_isis_tilfa_cmd); |
2888 | install_element(ENABLE_NODE, &no_debug_isis_tilfa_cmd); | |
d62a17ae | 2889 | install_element(ENABLE_NODE, &debug_isis_rtevents_cmd); |
2890 | install_element(ENABLE_NODE, &no_debug_isis_rtevents_cmd); | |
2891 | install_element(ENABLE_NODE, &debug_isis_events_cmd); | |
2892 | install_element(ENABLE_NODE, &no_debug_isis_events_cmd); | |
2893 | install_element(ENABLE_NODE, &debug_isis_packet_dump_cmd); | |
2894 | install_element(ENABLE_NODE, &no_debug_isis_packet_dump_cmd); | |
2895 | install_element(ENABLE_NODE, &debug_isis_lsp_gen_cmd); | |
2896 | install_element(ENABLE_NODE, &no_debug_isis_lsp_gen_cmd); | |
2897 | install_element(ENABLE_NODE, &debug_isis_lsp_sched_cmd); | |
2898 | install_element(ENABLE_NODE, &no_debug_isis_lsp_sched_cmd); | |
2815f817 CF |
2899 | install_element(ENABLE_NODE, &debug_isis_bfd_cmd); |
2900 | install_element(ENABLE_NODE, &no_debug_isis_bfd_cmd); | |
1cbf96a8 | 2901 | install_element(ENABLE_NODE, &debug_isis_ldp_sync_cmd); |
2902 | install_element(ENABLE_NODE, &no_debug_isis_ldp_sync_cmd); | |
d62a17ae | 2903 | |
2904 | install_element(CONFIG_NODE, &debug_isis_adj_cmd); | |
2905 | install_element(CONFIG_NODE, &no_debug_isis_adj_cmd); | |
161fa356 CF |
2906 | install_element(CONFIG_NODE, &debug_isis_tx_queue_cmd); |
2907 | install_element(CONFIG_NODE, &no_debug_isis_tx_queue_cmd); | |
ddb33326 CF |
2908 | install_element(CONFIG_NODE, &debug_isis_flooding_cmd); |
2909 | install_element(CONFIG_NODE, &no_debug_isis_flooding_cmd); | |
d62a17ae | 2910 | install_element(CONFIG_NODE, &debug_isis_snp_cmd); |
2911 | install_element(CONFIG_NODE, &no_debug_isis_snp_cmd); | |
2912 | install_element(CONFIG_NODE, &debug_isis_upd_cmd); | |
2913 | install_element(CONFIG_NODE, &no_debug_isis_upd_cmd); | |
2914 | install_element(CONFIG_NODE, &debug_isis_spfevents_cmd); | |
2915 | install_element(CONFIG_NODE, &no_debug_isis_spfevents_cmd); | |
26f6acaf RW |
2916 | install_element(CONFIG_NODE, &debug_isis_srevents_cmd); |
2917 | install_element(CONFIG_NODE, &no_debug_isis_srevents_cmd); | |
c951ee6e RW |
2918 | install_element(CONFIG_NODE, &debug_isis_tilfa_cmd); |
2919 | install_element(CONFIG_NODE, &no_debug_isis_tilfa_cmd); | |
d62a17ae | 2920 | install_element(CONFIG_NODE, &debug_isis_rtevents_cmd); |
2921 | install_element(CONFIG_NODE, &no_debug_isis_rtevents_cmd); | |
2922 | install_element(CONFIG_NODE, &debug_isis_events_cmd); | |
2923 | install_element(CONFIG_NODE, &no_debug_isis_events_cmd); | |
2924 | install_element(CONFIG_NODE, &debug_isis_packet_dump_cmd); | |
2925 | install_element(CONFIG_NODE, &no_debug_isis_packet_dump_cmd); | |
2926 | install_element(CONFIG_NODE, &debug_isis_lsp_gen_cmd); | |
2927 | install_element(CONFIG_NODE, &no_debug_isis_lsp_gen_cmd); | |
2928 | install_element(CONFIG_NODE, &debug_isis_lsp_sched_cmd); | |
2929 | install_element(CONFIG_NODE, &no_debug_isis_lsp_sched_cmd); | |
2815f817 CF |
2930 | install_element(CONFIG_NODE, &debug_isis_bfd_cmd); |
2931 | install_element(CONFIG_NODE, &no_debug_isis_bfd_cmd); | |
1cbf96a8 | 2932 | install_element(CONFIG_NODE, &debug_isis_ldp_sync_cmd); |
2933 | install_element(CONFIG_NODE, &no_debug_isis_ldp_sync_cmd); | |
d62a17ae | 2934 | |
7c0cbd0e | 2935 | install_default(ROUTER_NODE); |
d62a17ae | 2936 | |
aaf2fd21 EDP |
2937 | #ifdef FABRICD |
2938 | install_element(CONFIG_NODE, &router_openfabric_cmd); | |
2939 | install_element(CONFIG_NODE, &no_router_openfabric_cmd); | |
2adf66ff | 2940 | |
7c0cbd0e CF |
2941 | install_element(ROUTER_NODE, &net_cmd); |
2942 | install_element(ROUTER_NODE, &no_net_cmd); | |
2adf66ff | 2943 | |
7c0cbd0e CF |
2944 | install_element(ROUTER_NODE, &isis_topology_cmd); |
2945 | install_element(ROUTER_NODE, &no_isis_topology_cmd); | |
2adf66ff | 2946 | |
7c0cbd0e CF |
2947 | install_element(ROUTER_NODE, &log_adj_changes_cmd); |
2948 | install_element(ROUTER_NODE, &no_log_adj_changes_cmd); | |
2adf66ff | 2949 | #endif /* ifdef FABRICD */ |
d62a17ae | 2950 | |
2951 | spf_backoff_cmd_init(); | |
eb5d44eb | 2952 | } |