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