]>
Commit | Line | Data |
---|---|---|
ef020087 CF |
1 | /* |
2 | * IS-IS Rout(e)ing protocol - isis_vty_fabricd.c | |
3 | * | |
4 | * This file contains the CLI that is specific to OpenFabric | |
5 | * | |
6 | * Copyright (C) 2018 Christian Franke, for NetDEF, Inc. | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify it | |
9 | * under the terms of the GNU General Public Licenseas published by the Free | |
10 | * Software Foundation; either version 2 of the License, or (at your option) | |
11 | * any later version. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful,but WITHOUT | |
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
16 | * more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License along | |
19 | * with this program; see the file COPYING; if not, write to the Free Software | |
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
21 | */ | |
22 | #include <zebra.h> | |
23 | ||
24 | #include "command.h" | |
25 | ||
f2971ce3 RZ |
26 | #include "lib/bfd.h" |
27 | #include "isisd/isis_bfd.h" | |
1eb7c3a1 | 28 | #include "isisd/isisd.h" |
1eb7c3a1 CF |
29 | #include "isisd/fabricd.h" |
30 | #include "isisd/isis_tlvs.h" | |
31 | #include "isisd/isis_misc.h" | |
32 | #include "isisd/isis_lsp.h" | |
aaf2fd21 | 33 | #include "isisd/isis_csm.h" |
f084ea55 | 34 | #include "isisd/isis_circuit.h" |
5336ba30 | 35 | #include "lib/spf_backoff.h" |
83d043f6 | 36 | #include "isisd/isis_mt.h" |
92ed0cde | 37 | |
f2971ce3 RZ |
38 | static struct isis_circuit *isis_circuit_lookup(struct vty *vty) |
39 | { | |
40 | struct interface *ifp = VTY_GET_CONTEXT(interface); | |
41 | struct isis_circuit *circuit; | |
42 | ||
43 | if (!ifp) { | |
44 | vty_out(vty, "Invalid interface \n"); | |
45 | return NULL; | |
46 | } | |
47 | ||
48 | circuit = circuit_scan_by_ifp(ifp); | |
49 | if (!circuit) { | |
50 | vty_out(vty, "ISIS is not enabled on circuit %s\n", ifp->name); | |
51 | return NULL; | |
52 | } | |
53 | ||
54 | return circuit; | |
55 | } | |
56 | ||
92ed0cde CF |
57 | DEFUN (fabric_tier, |
58 | fabric_tier_cmd, | |
59 | "fabric-tier (0-14)", | |
60 | "Statically configure the tier to advertise\n" | |
61 | "Tier to advertise\n") | |
62 | { | |
63 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
64 | ||
65 | uint8_t tier = atoi(argv[1]->arg); | |
66 | ||
67 | fabricd_configure_tier(area, tier); | |
68 | return CMD_SUCCESS; | |
69 | } | |
70 | ||
71 | DEFUN (no_fabric_tier, | |
72 | no_fabric_tier_cmd, | |
73 | "no fabric-tier [(0-14)]", | |
74 | NO_STR | |
75 | "Statically configure the tier to advertise\n" | |
76 | "Tier to advertise\n") | |
77 | { | |
78 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
79 | ||
80 | fabricd_configure_tier(area, ISIS_TIER_UNDEFINED); | |
81 | return CMD_SUCCESS; | |
82 | } | |
ef020087 | 83 | |
e923107c CF |
84 | DEFUN (triggered_csnp, |
85 | triggered_csnp_cmd, | |
86 | "triggered-csnp-delay (100-10000) [always]", | |
87 | "Configure the delay for triggered CSNPs\n" | |
88 | "Delay in milliseconds\n" | |
89 | "Trigger CSNP for all LSPs, not only circuit-scoped\n") | |
90 | { | |
91 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
92 | ||
93 | int csnp_delay = atoi(argv[1]->arg); | |
94 | bool always_send_csnp = (argc == 3); | |
95 | ||
96 | fabricd_configure_triggered_csnp(area, csnp_delay, always_send_csnp); | |
97 | return CMD_SUCCESS; | |
98 | } | |
99 | ||
100 | DEFUN (no_triggered_csnp, | |
101 | no_triggered_csnp_cmd, | |
102 | "no triggered-csnp-delay [(100-10000) [always]]", | |
103 | NO_STR | |
104 | "Configure the delay for triggered CSNPs\n" | |
105 | "Delay in milliseconds\n" | |
106 | "Trigger CSNP for all LSPs, not only circuit-scoped\n") | |
107 | { | |
108 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
109 | ||
110 | fabricd_configure_triggered_csnp(area, FABRICD_DEFAULT_CSNP_DELAY, | |
111 | false); | |
112 | return CMD_SUCCESS; | |
113 | } | |
114 | ||
1eb7c3a1 CF |
115 | static void lsp_print_flooding(struct vty *vty, struct isis_lsp *lsp) |
116 | { | |
117 | char lspid[255]; | |
118 | ||
119 | lspid_print(lsp->hdr.lsp_id, lspid, true, true); | |
120 | vty_out(vty, "Flooding information for %s\n", lspid); | |
121 | ||
122 | if (!lsp->flooding_neighbors[TX_LSP_NORMAL]) { | |
a6b60da9 | 123 | vty_out(vty, " Never received.\n"); |
1eb7c3a1 CF |
124 | return; |
125 | } | |
126 | ||
a6b60da9 | 127 | vty_out(vty, " Last received on: %s (", |
1eb7c3a1 CF |
128 | lsp->flooding_interface ? |
129 | lsp->flooding_interface : "(null)"); | |
130 | ||
a6b60da9 CF |
131 | time_t uptime = time(NULL) - lsp->flooding_time; |
132 | struct tm *tm = gmtime(&uptime); | |
133 | ||
134 | if (uptime < ONE_DAY_SECOND) | |
135 | vty_out(vty, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, | |
136 | tm->tm_sec); | |
137 | else if (uptime < ONE_WEEK_SECOND) | |
138 | vty_out(vty, "%dd%02dh%02dm", tm->tm_yday, tm->tm_hour, | |
139 | tm->tm_min); | |
140 | else | |
141 | vty_out(vty, "%02dw%dd%02dh", tm->tm_yday / 7, | |
142 | tm->tm_yday - ((tm->tm_yday / 7) * 7), | |
143 | tm->tm_hour); | |
144 | vty_out(vty, " ago)\n"); | |
145 | ||
146 | if (lsp->flooding_circuit_scoped) { | |
89cdc4df RM |
147 | vty_out(vty, " Received as circuit-scoped LSP, so not " |
148 | "flooded.\n"); | |
a6b60da9 CF |
149 | return; |
150 | } | |
151 | ||
1eb7c3a1 CF |
152 | for (enum isis_tx_type type = TX_LSP_NORMAL; |
153 | type <= TX_LSP_CIRCUIT_SCOPED; type++) { | |
154 | struct listnode *node; | |
155 | uint8_t *neighbor_id; | |
156 | ||
157 | vty_out(vty, " %s:\n", | |
158 | (type == TX_LSP_NORMAL) ? "RF" : "DNR"); | |
159 | for (ALL_LIST_ELEMENTS_RO(lsp->flooding_neighbors[type], | |
160 | node, neighbor_id)) { | |
161 | vty_out(vty, " %s\n", | |
162 | print_sys_hostname(neighbor_id)); | |
163 | } | |
164 | } | |
165 | } | |
166 | ||
167 | DEFUN (show_lsp_flooding, | |
168 | show_lsp_flooding_cmd, | |
169 | "show openfabric flooding [WORD]", | |
170 | SHOW_STR | |
171 | PROTO_HELP | |
172 | "Flooding information\n" | |
173 | "LSP ID\n") | |
174 | { | |
175 | const char *lspid = NULL; | |
176 | ||
89cdc4df | 177 | if (argc == 4) |
1eb7c3a1 | 178 | lspid = argv[3]->arg; |
1eb7c3a1 CF |
179 | |
180 | struct listnode *node; | |
181 | struct isis_area *area; | |
182 | ||
183 | for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { | |
4bef0ec4 DL |
184 | struct lspdb_head *head = &area->lspdb[ISIS_LEVEL2 - 1]; |
185 | struct isis_lsp *lsp; | |
1eb7c3a1 CF |
186 | |
187 | vty_out(vty, "Area %s:\n", area->area_tag ? | |
188 | area->area_tag : "null"); | |
189 | ||
190 | if (lspid) { | |
637b00ca | 191 | lsp = lsp_for_arg(head, lspid); |
1eb7c3a1 CF |
192 | |
193 | if (lsp) | |
194 | lsp_print_flooding(vty, lsp); | |
195 | ||
196 | continue; | |
197 | } | |
198 | ||
81fddbe7 | 199 | frr_each (lspdb, head, lsp) { |
4bef0ec4 | 200 | lsp_print_flooding(vty, lsp); |
1eb7c3a1 CF |
201 | vty_out(vty, "\n"); |
202 | } | |
203 | } | |
204 | ||
205 | return CMD_SUCCESS; | |
206 | } | |
207 | ||
aaf2fd21 EDP |
208 | DEFUN (ip_router_isis, |
209 | ip_router_isis_cmd, | |
210 | "ip router " PROTO_NAME " WORD", | |
211 | "Interface Internet Protocol config commands\n" | |
212 | "IP router interface commands\n" | |
213 | PROTO_HELP | |
214 | "Routing process tag\n") | |
215 | { | |
216 | int idx_afi = 0; | |
217 | int idx_word = 3; | |
218 | VTY_DECLVAR_CONTEXT(interface, ifp); | |
219 | struct isis_circuit *circuit; | |
220 | struct isis_area *area; | |
221 | const char *af = argv[idx_afi]->arg; | |
222 | const char *area_tag = argv[idx_word]->arg; | |
223 | ||
224 | /* Prevent more than one area per circuit */ | |
225 | circuit = circuit_scan_by_ifp(ifp); | |
226 | if (circuit && circuit->area) { | |
227 | if (strcmp(circuit->area->area_tag, area_tag)) { | |
228 | vty_out(vty, "ISIS circuit is already defined on %s\n", | |
229 | circuit->area->area_tag); | |
230 | return CMD_ERR_NOTHING_TODO; | |
231 | } | |
232 | } | |
233 | ||
234 | area = isis_area_lookup(area_tag); | |
235 | if (!area) | |
236 | area = isis_area_create(area_tag); | |
237 | ||
238 | if (!circuit || !circuit->area) { | |
239 | circuit = isis_circuit_create(area, ifp); | |
240 | ||
241 | if (circuit->state != C_STATE_CONF | |
242 | && circuit->state != C_STATE_UP) { | |
243 | vty_out(vty, | |
244 | "Couldn't bring up interface, please check log.\n"); | |
245 | return CMD_WARNING_CONFIG_FAILED; | |
246 | } | |
247 | } | |
248 | ||
249 | bool ip = circuit->ip_router, ipv6 = circuit->ipv6_router; | |
250 | if (af[2] != '\0') | |
251 | ipv6 = true; | |
252 | else | |
253 | ip = true; | |
254 | ||
255 | isis_circuit_af_set(circuit, ip, ipv6); | |
256 | return CMD_SUCCESS; | |
257 | } | |
258 | ||
259 | DEFUN (ip6_router_isis, | |
260 | ip6_router_isis_cmd, | |
261 | "ipv6 router " PROTO_NAME " WORD", | |
262 | "Interface Internet Protocol config commands\n" | |
263 | "IP router interface commands\n" | |
264 | PROTO_HELP | |
265 | "Routing process tag\n") | |
266 | { | |
267 | return ip_router_isis(self, vty, argc, argv); | |
268 | } | |
269 | ||
270 | DEFUN (no_ip_router_isis, | |
271 | no_ip_router_isis_cmd, | |
272 | "no <ip|ipv6> router " PROTO_NAME " WORD", | |
273 | NO_STR | |
274 | "Interface Internet Protocol config commands\n" | |
275 | "IP router interface commands\n" | |
276 | "IP router interface commands\n" | |
277 | PROTO_HELP | |
278 | "Routing process tag\n") | |
279 | { | |
280 | int idx_afi = 1; | |
281 | int idx_word = 4; | |
282 | VTY_DECLVAR_CONTEXT(interface, ifp); | |
283 | struct isis_area *area; | |
284 | struct isis_circuit *circuit; | |
285 | const char *af = argv[idx_afi]->arg; | |
286 | const char *area_tag = argv[idx_word]->arg; | |
287 | ||
288 | area = isis_area_lookup(area_tag); | |
289 | if (!area) { | |
290 | vty_out(vty, "Can't find ISIS instance %s\n", | |
291 | area_tag); | |
292 | return CMD_ERR_NO_MATCH; | |
293 | } | |
294 | ||
295 | circuit = circuit_lookup_by_ifp(ifp, area->circuit_list); | |
296 | if (!circuit) { | |
297 | vty_out(vty, "ISIS is not enabled on circuit %s\n", ifp->name); | |
298 | return CMD_ERR_NO_MATCH; | |
299 | } | |
300 | ||
301 | bool ip = circuit->ip_router, ipv6 = circuit->ipv6_router; | |
302 | if (af[2] != '\0') | |
303 | ipv6 = false; | |
304 | else | |
305 | ip = false; | |
306 | ||
307 | isis_circuit_af_set(circuit, ip, ipv6); | |
308 | return CMD_SUCCESS; | |
309 | } | |
310 | ||
f2971ce3 RZ |
311 | DEFUN (isis_bfd, |
312 | isis_bfd_cmd, | |
313 | PROTO_NAME " bfd", | |
314 | PROTO_HELP | |
315 | "Enable BFD support\n") | |
316 | { | |
317 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
318 | ||
319 | if (!circuit) | |
320 | return CMD_ERR_NO_MATCH; | |
321 | ||
322 | if (circuit->bfd_info | |
323 | && CHECK_FLAG(circuit->bfd_info->flags, BFD_FLAG_PARAM_CFG)) { | |
324 | return CMD_SUCCESS; | |
325 | } | |
326 | ||
327 | isis_bfd_circuit_param_set(circuit, BFD_DEF_MIN_RX, | |
328 | BFD_DEF_MIN_TX, BFD_DEF_DETECT_MULT, true); | |
329 | ||
330 | return CMD_SUCCESS; | |
331 | } | |
332 | ||
333 | DEFUN (no_isis_bfd, | |
334 | no_isis_bfd_cmd, | |
335 | "no " PROTO_NAME " bfd", | |
336 | NO_STR | |
337 | PROTO_HELP | |
338 | "Disables BFD support\n" | |
339 | ) | |
340 | { | |
341 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
342 | ||
343 | if (!circuit) | |
344 | return CMD_ERR_NO_MATCH; | |
345 | ||
346 | if (!circuit->bfd_info) | |
347 | return CMD_SUCCESS; | |
348 | ||
349 | isis_bfd_circuit_cmd(circuit, ZEBRA_BFD_DEST_DEREGISTER); | |
350 | bfd_info_free(&circuit->bfd_info); | |
351 | return CMD_SUCCESS; | |
352 | } | |
353 | ||
05a3f9f0 EDP |
354 | DEFUN (set_overload_bit, |
355 | set_overload_bit_cmd, | |
356 | "set-overload-bit", | |
357 | "Set overload bit to avoid any transit traffic\n") | |
358 | { | |
359 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
360 | ||
361 | isis_area_overload_bit_set(area, true); | |
362 | return CMD_SUCCESS; | |
363 | } | |
364 | ||
365 | DEFUN (no_set_overload_bit, | |
366 | no_set_overload_bit_cmd, | |
367 | "no set-overload-bit", | |
368 | "Reset overload bit to accept transit traffic\n" | |
369 | "Reset overload bit\n") | |
370 | { | |
371 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
372 | ||
373 | isis_area_overload_bit_set(area, false); | |
374 | return CMD_SUCCESS; | |
375 | } | |
376 | ||
933536e3 EDP |
377 | static int isis_vty_password_set(struct vty *vty, int argc, |
378 | struct cmd_token *argv[], int level) | |
379 | { | |
380 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
381 | ||
382 | int idx_algo = 1; | |
383 | int idx_password = 2; | |
384 | int idx_snp_auth = 5; | |
385 | uint8_t snp_auth = 0; | |
386 | ||
387 | const char *passwd = argv[idx_password]->arg; | |
388 | if (strlen(passwd) > 254) { | |
389 | vty_out(vty, "Too long area password (>254)\n"); | |
390 | return CMD_WARNING_CONFIG_FAILED; | |
391 | } | |
392 | ||
393 | if (argc > idx_snp_auth) { | |
394 | snp_auth = SNP_AUTH_SEND; | |
395 | if (strmatch(argv[idx_snp_auth]->text, "validate")) | |
396 | snp_auth |= SNP_AUTH_RECV; | |
397 | } | |
398 | ||
399 | if (strmatch(argv[idx_algo]->text, "clear")) { | |
400 | return isis_area_passwd_cleartext_set(area, level, | |
401 | passwd, snp_auth); | |
402 | } else if (strmatch(argv[idx_algo]->text, "md5")) { | |
403 | return isis_area_passwd_hmac_md5_set(area, level, | |
404 | passwd, snp_auth); | |
405 | } | |
406 | ||
407 | return CMD_WARNING_CONFIG_FAILED; | |
408 | } | |
409 | ||
410 | DEFUN (domain_passwd, | |
411 | domain_passwd_cmd, | |
412 | "domain-password <clear|md5> WORD [authenticate snp <send-only|validate>]", | |
413 | "Set the authentication password for a routing domain\n" | |
414 | "Authentication type\n" | |
415 | "Authentication type\n" | |
416 | "Level-wide password\n" | |
417 | "Authentication\n" | |
418 | "SNP PDUs\n" | |
419 | "Send but do not check PDUs on receiving\n" | |
420 | "Send and check PDUs on receiving\n") | |
421 | { | |
422 | return isis_vty_password_set(vty, argc, argv, IS_LEVEL_2); | |
423 | } | |
424 | ||
425 | DEFUN (no_domain_passwd, | |
426 | no_domain_passwd_cmd, | |
427 | "no domain-password", | |
428 | NO_STR | |
429 | "Set the authentication password for a routing domain\n") | |
430 | { | |
431 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
432 | ||
433 | return isis_area_passwd_unset(area, IS_LEVEL_2); | |
434 | } | |
435 | ||
1d6fe72e EDP |
436 | static int |
437 | isis_vty_lsp_gen_interval_set(struct vty *vty, int level, uint16_t interval) | |
438 | { | |
439 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
440 | int lvl; | |
441 | ||
442 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl) { | |
443 | if (!(lvl & level)) | |
444 | continue; | |
445 | ||
446 | if (interval >= area->lsp_refresh[lvl - 1]) { | |
447 | vty_out(vty, | |
448 | "LSP gen interval %us must be less than " | |
449 | "the LSP refresh interval %us\n", | |
450 | interval, area->lsp_refresh[lvl - 1]); | |
451 | return CMD_WARNING_CONFIG_FAILED; | |
452 | } | |
453 | } | |
454 | ||
455 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl) { | |
456 | if (!(lvl & level)) | |
457 | continue; | |
458 | area->lsp_gen_interval[lvl - 1] = interval; | |
459 | } | |
460 | ||
461 | return CMD_SUCCESS; | |
462 | } | |
463 | ||
464 | DEFUN (lsp_gen_interval, | |
465 | lsp_gen_interval_cmd, | |
466 | "lsp-gen-interval (1-120)", | |
467 | "Minimum interval between regenerating same LSP\n" | |
468 | "Minimum interval in seconds\n") | |
469 | { | |
470 | uint16_t interval = atoi(argv[1]->arg); | |
471 | ||
472 | return isis_vty_lsp_gen_interval_set(vty, IS_LEVEL_1_AND_2, interval); | |
473 | } | |
474 | ||
475 | DEFUN (no_lsp_gen_interval, | |
476 | no_lsp_gen_interval_cmd, | |
477 | "no lsp-gen-interval [(1-120)]", | |
478 | NO_STR | |
479 | "Minimum interval between regenerating same LSP\n" | |
480 | "Minimum interval in seconds\n") | |
481 | { | |
482 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
483 | ||
484 | return isis_vty_lsp_gen_interval_set(vty, IS_LEVEL_1_AND_2, | |
485 | DEFAULT_MIN_LSP_GEN_INTERVAL); | |
486 | } | |
7e869004 EDP |
487 | |
488 | static int | |
489 | isis_vty_lsp_refresh_set(struct vty *vty, int level, uint16_t interval) | |
490 | { | |
491 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
492 | int lvl; | |
493 | ||
494 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl) { | |
495 | if (!(lvl & level)) | |
496 | continue; | |
497 | if (interval <= area->lsp_gen_interval[lvl - 1]) { | |
498 | vty_out(vty, | |
499 | "LSP refresh interval %us must be greater than " | |
500 | "the configured LSP gen interval %us\n", | |
501 | interval, area->lsp_gen_interval[lvl - 1]); | |
502 | return CMD_WARNING_CONFIG_FAILED; | |
503 | } | |
504 | if (interval > (area->max_lsp_lifetime[lvl - 1] - 300)) { | |
505 | vty_out(vty, | |
506 | "LSP refresh interval %us must be less than " | |
507 | "the configured LSP lifetime %us less 300\n", | |
508 | interval, area->max_lsp_lifetime[lvl - 1]); | |
509 | return CMD_WARNING_CONFIG_FAILED; | |
510 | } | |
511 | } | |
512 | ||
513 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl) { | |
514 | if (!(lvl & level)) | |
515 | continue; | |
516 | isis_area_lsp_refresh_set(area, lvl, interval); | |
517 | } | |
518 | ||
519 | return CMD_SUCCESS; | |
520 | } | |
521 | ||
522 | DEFUN (lsp_refresh_interval, | |
523 | lsp_refresh_interval_cmd, | |
524 | "lsp-refresh-interval (1-65235)", | |
525 | "LSP refresh interval\n" | |
526 | "LSP refresh interval in seconds\n") | |
527 | { | |
528 | unsigned int interval = atoi(argv[1]->arg); | |
529 | return isis_vty_lsp_refresh_set(vty, IS_LEVEL_1_AND_2, interval); | |
530 | } | |
531 | ||
532 | DEFUN (no_lsp_refresh_interval, | |
533 | no_lsp_refresh_interval_cmd, | |
534 | "no lsp-refresh-interval [(1-65235)]", | |
535 | NO_STR | |
536 | "LSP refresh interval\n" | |
537 | "LSP refresh interval in seconds\n") | |
538 | { | |
539 | return isis_vty_lsp_refresh_set(vty, IS_LEVEL_1_AND_2, | |
540 | DEFAULT_MAX_LSP_GEN_INTERVAL); | |
541 | } | |
542 | ||
ea120aa0 EDP |
543 | static int |
544 | isis_vty_max_lsp_lifetime_set(struct vty *vty, int level, uint16_t interval) | |
545 | { | |
546 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
547 | int lvl; | |
548 | uint16_t refresh_interval = interval - 300; | |
549 | int set_refresh_interval[ISIS_LEVELS] = {0, 0}; | |
550 | ||
551 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++) { | |
552 | if (!(lvl & level)) | |
553 | continue; | |
554 | ||
555 | if (refresh_interval < area->lsp_refresh[lvl - 1]) { | |
556 | vty_out(vty, | |
557 | "Level %d Max LSP lifetime %us must be 300s greater than " | |
558 | "the configured LSP refresh interval %us\n", | |
559 | lvl, interval, area->lsp_refresh[lvl - 1]); | |
560 | vty_out(vty, | |
561 | "Automatically reducing level %d LSP refresh interval " | |
562 | "to %us\n", | |
563 | lvl, refresh_interval); | |
564 | set_refresh_interval[lvl - 1] = 1; | |
565 | ||
566 | if (refresh_interval | |
567 | <= area->lsp_gen_interval[lvl - 1]) { | |
568 | vty_out(vty, | |
569 | "LSP refresh interval %us must be greater than " | |
570 | "the configured LSP gen interval %us\n", | |
571 | refresh_interval, | |
572 | area->lsp_gen_interval[lvl - 1]); | |
573 | return CMD_WARNING_CONFIG_FAILED; | |
574 | } | |
575 | } | |
576 | } | |
577 | ||
578 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++) { | |
579 | if (!(lvl & level)) | |
580 | continue; | |
581 | isis_area_max_lsp_lifetime_set(area, lvl, interval); | |
582 | if (set_refresh_interval[lvl - 1]) | |
583 | isis_area_lsp_refresh_set(area, lvl, refresh_interval); | |
584 | } | |
585 | ||
586 | return CMD_SUCCESS; | |
587 | } | |
588 | ||
589 | DEFUN (max_lsp_lifetime, | |
590 | max_lsp_lifetime_cmd, | |
591 | "max-lsp-lifetime (350-65535)", | |
592 | "Maximum LSP lifetime\n" | |
593 | "LSP lifetime in seconds\n") | |
594 | { | |
595 | int lifetime = atoi(argv[1]->arg); | |
596 | ||
597 | return isis_vty_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, lifetime); | |
598 | } | |
599 | ||
600 | ||
601 | DEFUN (no_max_lsp_lifetime, | |
602 | no_max_lsp_lifetime_cmd, | |
603 | "no max-lsp-lifetime [(350-65535)]", | |
604 | NO_STR | |
605 | "Maximum LSP lifetime\n" | |
606 | "LSP lifetime in seconds\n") | |
607 | { | |
608 | return isis_vty_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, | |
609 | DEFAULT_LSP_LIFETIME); | |
610 | } | |
611 | ||
dcb1dcd6 EDP |
612 | DEFUN (spf_interval, |
613 | spf_interval_cmd, | |
614 | "spf-interval (1-120)", | |
615 | "Minimum interval between SPF calculations\n" | |
616 | "Minimum interval between consecutive SPFs in seconds\n") | |
617 | { | |
618 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
619 | uint16_t interval = atoi(argv[1]->arg); | |
620 | ||
621 | area->min_spf_interval[0] = interval; | |
622 | area->min_spf_interval[1] = interval; | |
623 | ||
624 | return CMD_SUCCESS; | |
625 | } | |
626 | ||
627 | DEFUN (no_spf_interval, | |
628 | no_spf_interval_cmd, | |
629 | "no spf-interval [(1-120)]", | |
630 | NO_STR | |
631 | "Minimum interval between SPF calculations\n" | |
632 | "Minimum interval between consecutive SPFs in seconds\n") | |
633 | { | |
634 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
635 | ||
636 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; | |
637 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; | |
638 | ||
639 | return CMD_SUCCESS; | |
640 | } | |
27a45d16 EDP |
641 | |
642 | static int isis_vty_lsp_mtu_set(struct vty *vty, unsigned int lsp_mtu) | |
643 | { | |
644 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
645 | struct listnode *node; | |
646 | struct isis_circuit *circuit; | |
647 | ||
648 | for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) { | |
649 | if (circuit->state != C_STATE_INIT | |
650 | && circuit->state != C_STATE_UP) | |
651 | continue; | |
652 | if (lsp_mtu > isis_circuit_pdu_size(circuit)) { | |
653 | vty_out(vty, | |
654 | "ISIS area contains circuit %s, which has a maximum PDU size of %zu.\n", | |
655 | circuit->interface->name, | |
656 | isis_circuit_pdu_size(circuit)); | |
657 | return CMD_WARNING_CONFIG_FAILED; | |
658 | } | |
659 | } | |
660 | ||
661 | isis_area_lsp_mtu_set(area, lsp_mtu); | |
662 | return CMD_SUCCESS; | |
663 | } | |
664 | ||
665 | DEFUN (area_lsp_mtu, | |
666 | area_lsp_mtu_cmd, | |
667 | "lsp-mtu (128-4352)", | |
668 | "Configure the maximum size of generated LSPs\n" | |
669 | "Maximum size of generated LSPs\n") | |
670 | { | |
671 | int idx_number = 1; | |
672 | unsigned int lsp_mtu; | |
673 | ||
674 | lsp_mtu = strtoul(argv[idx_number]->arg, NULL, 10); | |
675 | ||
676 | return isis_vty_lsp_mtu_set(vty, lsp_mtu); | |
677 | } | |
678 | ||
679 | DEFUN (no_area_lsp_mtu, | |
680 | no_area_lsp_mtu_cmd, | |
681 | "no lsp-mtu [(128-4352)]", | |
682 | NO_STR | |
683 | "Configure the maximum size of generated LSPs\n" | |
684 | "Maximum size of generated LSPs\n") | |
685 | { | |
686 | return isis_vty_lsp_mtu_set(vty, DEFAULT_LSP_MTU); | |
687 | } | |
688 | ||
5336ba30 EDP |
689 | DEFUN (no_spf_delay_ietf, |
690 | no_spf_delay_ietf_cmd, | |
691 | "no spf-delay-ietf", | |
692 | NO_STR | |
693 | "IETF SPF delay algorithm\n") | |
694 | { | |
695 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
696 | ||
697 | spf_backoff_free(area->spf_delay_ietf[0]); | |
698 | spf_backoff_free(area->spf_delay_ietf[1]); | |
699 | area->spf_delay_ietf[0] = NULL; | |
700 | area->spf_delay_ietf[1] = NULL; | |
701 | ||
702 | return CMD_SUCCESS; | |
703 | } | |
704 | ||
705 | DEFUN (spf_delay_ietf, | |
706 | spf_delay_ietf_cmd, | |
707 | "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)", | |
708 | "IETF SPF delay algorithm\n" | |
709 | "Delay used while in QUIET state\n" | |
710 | "Delay used while in QUIET state in milliseconds\n" | |
711 | "Delay used while in SHORT_WAIT state\n" | |
712 | "Delay used while in SHORT_WAIT state in milliseconds\n" | |
713 | "Delay used while in LONG_WAIT\n" | |
714 | "Delay used while in LONG_WAIT state in milliseconds\n" | |
715 | "Time with no received IGP events before considering IGP stable\n" | |
716 | "Time with no received IGP events before considering IGP stable (in milliseconds)\n" | |
717 | "Maximum duration needed to learn all the events related to a single failure\n" | |
718 | "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n") | |
719 | { | |
720 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
721 | ||
722 | long init_delay = atol(argv[2]->arg); | |
723 | long short_delay = atol(argv[4]->arg); | |
724 | long long_delay = atol(argv[6]->arg); | |
725 | long holddown = atol(argv[8]->arg); | |
726 | long timetolearn = atol(argv[10]->arg); | |
727 | ||
728 | size_t bufsiz = strlen(area->area_tag) + sizeof("IS-IS Lx"); | |
729 | char *buf = XCALLOC(MTYPE_TMP, bufsiz); | |
730 | ||
731 | snprintf(buf, bufsiz, "IS-IS %s L1", area->area_tag); | |
732 | spf_backoff_free(area->spf_delay_ietf[0]); | |
733 | area->spf_delay_ietf[0] = | |
734 | spf_backoff_new(master, buf, init_delay, short_delay, | |
735 | long_delay, holddown, timetolearn); | |
736 | ||
737 | snprintf(buf, bufsiz, "IS-IS %s L2", area->area_tag); | |
738 | spf_backoff_free(area->spf_delay_ietf[1]); | |
739 | area->spf_delay_ietf[1] = | |
740 | spf_backoff_new(master, buf, init_delay, short_delay, | |
741 | long_delay, holddown, timetolearn); | |
742 | ||
743 | XFREE(MTYPE_TMP, buf); | |
744 | return CMD_SUCCESS; | |
745 | } | |
746 | ||
66e45e10 EDP |
747 | DEFUN (area_purge_originator, |
748 | area_purge_originator_cmd, | |
749 | "[no] purge-originator", | |
750 | NO_STR | |
751 | "Use the RFC 6232 purge-originator\n") | |
752 | { | |
753 | VTY_DECLVAR_CONTEXT(isis_area, area); | |
754 | ||
755 | area->purge_originator = !!strcmp(argv[0]->text, "no"); | |
756 | return CMD_SUCCESS; | |
757 | } | |
758 | ||
a6a36c41 EDP |
759 | DEFUN (isis_passive, |
760 | isis_passive_cmd, | |
761 | PROTO_NAME " passive", | |
762 | PROTO_HELP | |
763 | "Configure the passive mode for interface\n") | |
764 | { | |
765 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
766 | if (!circuit) | |
767 | return CMD_ERR_NO_MATCH; | |
768 | ||
769 | CMD_FERR_RETURN(isis_circuit_passive_set(circuit, 1), | |
770 | "Cannot set passive: $ERR"); | |
771 | return CMD_SUCCESS; | |
772 | } | |
773 | ||
774 | DEFUN (no_isis_passive, | |
775 | no_isis_passive_cmd, | |
776 | "no " PROTO_NAME " passive", | |
777 | NO_STR | |
778 | PROTO_HELP | |
779 | "Configure the passive mode for interface\n") | |
780 | { | |
781 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
782 | if (!circuit) | |
783 | return CMD_ERR_NO_MATCH; | |
784 | ||
785 | CMD_FERR_RETURN(isis_circuit_passive_set(circuit, 0), | |
786 | "Cannot set no passive: $ERR"); | |
787 | return CMD_SUCCESS; | |
788 | } | |
789 | ||
3e20c83a EDP |
790 | DEFUN (isis_passwd, |
791 | isis_passwd_cmd, | |
792 | PROTO_NAME " password <md5|clear> WORD", | |
793 | PROTO_HELP | |
794 | "Configure the authentication password for a circuit\n" | |
795 | "HMAC-MD5 authentication\n" | |
796 | "Cleartext password\n" | |
797 | "Circuit password\n") | |
798 | { | |
799 | int idx_encryption = 2; | |
800 | int idx_word = 3; | |
801 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
802 | ferr_r rv; | |
803 | ||
804 | if (!circuit) | |
805 | return CMD_ERR_NO_MATCH; | |
806 | ||
807 | if (argv[idx_encryption]->arg[0] == 'm') | |
808 | rv = isis_circuit_passwd_hmac_md5_set(circuit, | |
809 | argv[idx_word]->arg); | |
810 | else | |
811 | rv = isis_circuit_passwd_cleartext_set(circuit, | |
812 | argv[idx_word]->arg); | |
813 | ||
814 | CMD_FERR_RETURN(rv, "Failed to set circuit password: $ERR"); | |
815 | return CMD_SUCCESS; | |
816 | } | |
817 | ||
818 | DEFUN (no_isis_passwd, | |
819 | no_isis_passwd_cmd, | |
820 | "no " PROTO_NAME " password [<md5|clear> WORD]", | |
821 | NO_STR | |
822 | PROTO_HELP | |
823 | "Configure the authentication password for a circuit\n" | |
824 | "HMAC-MD5 authentication\n" | |
825 | "Cleartext password\n" | |
826 | "Circuit password\n") | |
827 | { | |
828 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
829 | if (!circuit) | |
830 | return CMD_ERR_NO_MATCH; | |
831 | ||
832 | CMD_FERR_RETURN(isis_circuit_passwd_unset(circuit), | |
833 | "Failed to unset circuit password: $ERR"); | |
834 | return CMD_SUCCESS; | |
835 | } | |
836 | ||
be49219c EDP |
837 | DEFUN (isis_metric, |
838 | isis_metric_cmd, | |
839 | PROTO_NAME " metric (0-16777215)", | |
840 | PROTO_HELP | |
841 | "Set default metric for circuit\n" | |
842 | "Default metric value\n") | |
843 | { | |
844 | int idx_number = 2; | |
845 | int met; | |
846 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
847 | if (!circuit) | |
848 | return CMD_ERR_NO_MATCH; | |
849 | ||
850 | met = atoi(argv[idx_number]->arg); | |
851 | ||
852 | /* RFC3787 section 5.1 */ | |
853 | if (circuit->area && circuit->area->oldmetric == 1 | |
854 | && met > MAX_NARROW_LINK_METRIC) { | |
855 | vty_out(vty, | |
856 | "Invalid metric %d - should be <0-63> " | |
857 | "when narrow metric type enabled\n", | |
858 | met); | |
859 | return CMD_WARNING_CONFIG_FAILED; | |
860 | } | |
861 | ||
862 | /* RFC4444 */ | |
863 | if (circuit->area && circuit->area->newmetric == 1 | |
864 | && met > MAX_WIDE_LINK_METRIC) { | |
865 | vty_out(vty, | |
866 | "Invalid metric %d - should be <0-16777215> " | |
867 | "when wide metric type enabled\n", | |
868 | met); | |
869 | return CMD_WARNING_CONFIG_FAILED; | |
870 | } | |
871 | ||
872 | CMD_FERR_RETURN(isis_circuit_metric_set(circuit, IS_LEVEL_1, met), | |
873 | "Failed to set L1 metric: $ERR"); | |
874 | CMD_FERR_RETURN(isis_circuit_metric_set(circuit, IS_LEVEL_2, met), | |
875 | "Failed to set L2 metric: $ERR"); | |
876 | return CMD_SUCCESS; | |
877 | } | |
878 | ||
879 | DEFUN (no_isis_metric, | |
880 | no_isis_metric_cmd, | |
881 | "no " PROTO_NAME " metric [(0-16777215)]", | |
882 | NO_STR | |
883 | PROTO_HELP | |
884 | "Set default metric for circuit\n" | |
885 | "Default metric value\n") | |
886 | { | |
887 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
888 | if (!circuit) | |
889 | return CMD_ERR_NO_MATCH; | |
890 | ||
891 | CMD_FERR_RETURN(isis_circuit_metric_set(circuit, IS_LEVEL_1, | |
892 | DEFAULT_CIRCUIT_METRIC), | |
893 | "Failed to set L1 metric: $ERR"); | |
894 | CMD_FERR_RETURN(isis_circuit_metric_set(circuit, IS_LEVEL_2, | |
895 | DEFAULT_CIRCUIT_METRIC), | |
896 | "Failed to set L2 metric: $ERR"); | |
897 | return CMD_SUCCESS; | |
898 | } | |
899 | ||
356a2e3c EDP |
900 | DEFUN (isis_hello_interval, |
901 | isis_hello_interval_cmd, | |
902 | PROTO_NAME " hello-interval (1-600)", | |
903 | PROTO_HELP | |
904 | "Set Hello interval\n" | |
905 | "Holdtime 1 seconds, interval depends on multiplier\n") | |
906 | { | |
907 | uint32_t interval = atoi(argv[2]->arg); | |
908 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
909 | if (!circuit) | |
910 | return CMD_ERR_NO_MATCH; | |
911 | ||
912 | circuit->hello_interval[0] = interval; | |
913 | circuit->hello_interval[1] = interval; | |
914 | ||
915 | return CMD_SUCCESS; | |
916 | } | |
917 | ||
918 | DEFUN (no_isis_hello_interval, | |
919 | no_isis_hello_interval_cmd, | |
920 | "no " PROTO_NAME " hello-interval [(1-600)]", | |
921 | NO_STR | |
922 | PROTO_HELP | |
923 | "Set Hello interval\n" | |
924 | "Holdtime 1 second, interval depends on multiplier\n") | |
925 | { | |
926 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
927 | if (!circuit) | |
928 | return CMD_ERR_NO_MATCH; | |
929 | ||
930 | circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL; | |
931 | circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL; | |
932 | ||
933 | return CMD_SUCCESS; | |
934 | } | |
935 | ||
4e75a67d EDP |
936 | DEFUN (isis_hello_multiplier, |
937 | isis_hello_multiplier_cmd, | |
938 | PROTO_NAME " hello-multiplier (2-100)", | |
939 | PROTO_HELP | |
940 | "Set multiplier for Hello holding time\n" | |
941 | "Hello multiplier value\n") | |
942 | { | |
943 | uint16_t mult = atoi(argv[2]->arg); | |
944 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
945 | if (!circuit) | |
946 | return CMD_ERR_NO_MATCH; | |
947 | ||
948 | circuit->hello_multiplier[0] = mult; | |
949 | circuit->hello_multiplier[1] = mult; | |
950 | ||
951 | return CMD_SUCCESS; | |
952 | } | |
953 | ||
954 | DEFUN (no_isis_hello_multiplier, | |
955 | no_isis_hello_multiplier_cmd, | |
956 | "no " PROTO_NAME " hello-multiplier [(2-100)]", | |
957 | NO_STR | |
958 | PROTO_HELP | |
959 | "Set multiplier for Hello holding time\n" | |
960 | "Hello multiplier value\n") | |
961 | { | |
962 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
963 | if (!circuit) | |
964 | return CMD_ERR_NO_MATCH; | |
965 | ||
966 | circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER; | |
967 | circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER; | |
968 | ||
969 | return CMD_SUCCESS; | |
970 | } | |
971 | ||
9ce808b9 EDP |
972 | DEFUN (csnp_interval, |
973 | csnp_interval_cmd, | |
974 | PROTO_NAME " csnp-interval (1-600)", | |
975 | PROTO_HELP | |
976 | "Set CSNP interval in seconds\n" | |
977 | "CSNP interval value\n") | |
978 | { | |
979 | uint16_t interval = atoi(argv[2]->arg); | |
980 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
981 | if (!circuit) | |
982 | return CMD_ERR_NO_MATCH; | |
983 | ||
984 | circuit->csnp_interval[0] = interval; | |
985 | circuit->csnp_interval[1] = interval; | |
986 | ||
987 | return CMD_SUCCESS; | |
988 | } | |
989 | ||
990 | DEFUN (no_csnp_interval, | |
991 | no_csnp_interval_cmd, | |
992 | "no " PROTO_NAME " csnp-interval [(1-600)]", | |
993 | NO_STR | |
994 | PROTO_HELP | |
995 | "Set CSNP interval in seconds\n" | |
996 | "CSNP interval value\n") | |
997 | { | |
998 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
999 | if (!circuit) | |
1000 | return CMD_ERR_NO_MATCH; | |
1001 | ||
1002 | circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL; | |
1003 | circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL; | |
1004 | ||
1005 | return CMD_SUCCESS; | |
1006 | } | |
1007 | ||
1008 | DEFUN (psnp_interval, | |
1009 | psnp_interval_cmd, | |
1010 | PROTO_NAME " psnp-interval (1-120)", | |
1011 | PROTO_HELP | |
1012 | "Set PSNP interval in seconds\n" | |
1013 | "PSNP interval value\n") | |
1014 | { | |
1015 | uint16_t interval = atoi(argv[2]->arg); | |
1016 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
1017 | if (!circuit) | |
1018 | return CMD_ERR_NO_MATCH; | |
1019 | ||
1020 | circuit->psnp_interval[0] = interval; | |
1021 | circuit->psnp_interval[1] = interval; | |
1022 | ||
1023 | return CMD_SUCCESS; | |
1024 | } | |
1025 | ||
1026 | DEFUN (no_psnp_interval, | |
1027 | no_psnp_interval_cmd, | |
1028 | "no " PROTO_NAME " psnp-interval [(1-120)]", | |
1029 | NO_STR | |
1030 | PROTO_HELP | |
1031 | "Set PSNP interval in seconds\n" | |
1032 | "PSNP interval value\n") | |
1033 | { | |
1034 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
1035 | if (!circuit) | |
1036 | return CMD_ERR_NO_MATCH; | |
1037 | ||
1038 | circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL; | |
1039 | circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL; | |
1040 | ||
1041 | return CMD_SUCCESS; | |
1042 | } | |
1043 | ||
83d043f6 EDP |
1044 | DEFUN (circuit_topology, |
1045 | circuit_topology_cmd, | |
1046 | PROTO_NAME " topology " ISIS_MT_NAMES, | |
1047 | PROTO_HELP | |
1048 | "Configure interface IS-IS topologies\n" | |
1049 | ISIS_MT_DESCRIPTIONS) | |
1050 | { | |
1051 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
1052 | if (!circuit) | |
1053 | return CMD_ERR_NO_MATCH; | |
1054 | const char *arg = argv[2]->arg; | |
1055 | uint16_t mtid = isis_str2mtid(arg); | |
1056 | ||
1057 | if (circuit->area && circuit->area->oldmetric) { | |
1058 | vty_out(vty, | |
1059 | "Multi topology IS-IS can only be used with wide metrics\n"); | |
1060 | return CMD_WARNING_CONFIG_FAILED; | |
1061 | } | |
1062 | ||
1063 | if (mtid == (uint16_t)-1) { | |
1064 | vty_out(vty, "Don't know topology '%s'\n", arg); | |
1065 | return CMD_WARNING_CONFIG_FAILED; | |
1066 | } | |
1067 | ||
1068 | return isis_circuit_mt_enabled_set(circuit, mtid, true); | |
1069 | } | |
1070 | ||
1071 | DEFUN (no_circuit_topology, | |
1072 | no_circuit_topology_cmd, | |
1073 | "no " PROTO_NAME " topology " ISIS_MT_NAMES, | |
1074 | NO_STR | |
1075 | PROTO_HELP | |
1076 | "Configure interface IS-IS topologies\n" | |
1077 | ISIS_MT_DESCRIPTIONS) | |
1078 | { | |
1079 | struct isis_circuit *circuit = isis_circuit_lookup(vty); | |
1080 | if (!circuit) | |
1081 | return CMD_ERR_NO_MATCH; | |
1082 | const char *arg = argv[3]->arg; | |
1083 | uint16_t mtid = isis_str2mtid(arg); | |
1084 | ||
1085 | if (circuit->area && circuit->area->oldmetric) { | |
1086 | vty_out(vty, | |
1087 | "Multi topology IS-IS can only be used with wide metrics\n"); | |
1088 | return CMD_WARNING_CONFIG_FAILED; | |
1089 | } | |
1090 | ||
1091 | if (mtid == (uint16_t)-1) { | |
1092 | vty_out(vty, "Don't know topology '%s'\n", arg); | |
1093 | return CMD_WARNING_CONFIG_FAILED; | |
1094 | } | |
1095 | ||
1096 | return isis_circuit_mt_enabled_set(circuit, mtid, false); | |
1097 | } | |
1098 | ||
ef020087 CF |
1099 | void isis_vty_daemon_init(void) |
1100 | { | |
92ed0cde CF |
1101 | install_element(ROUTER_NODE, &fabric_tier_cmd); |
1102 | install_element(ROUTER_NODE, &no_fabric_tier_cmd); | |
e923107c CF |
1103 | install_element(ROUTER_NODE, &triggered_csnp_cmd); |
1104 | install_element(ROUTER_NODE, &no_triggered_csnp_cmd); | |
1eb7c3a1 CF |
1105 | |
1106 | install_element(ENABLE_NODE, &show_lsp_flooding_cmd); | |
aaf2fd21 EDP |
1107 | |
1108 | install_element(INTERFACE_NODE, &ip_router_isis_cmd); | |
1109 | install_element(INTERFACE_NODE, &ip6_router_isis_cmd); | |
1110 | install_element(INTERFACE_NODE, &no_ip_router_isis_cmd); | |
f2971ce3 RZ |
1111 | install_element(INTERFACE_NODE, &isis_bfd_cmd); |
1112 | install_element(INTERFACE_NODE, &no_isis_bfd_cmd); | |
05a3f9f0 EDP |
1113 | |
1114 | install_element(ROUTER_NODE, &set_overload_bit_cmd); | |
1115 | install_element(ROUTER_NODE, &no_set_overload_bit_cmd); | |
933536e3 EDP |
1116 | |
1117 | install_element(ROUTER_NODE, &domain_passwd_cmd); | |
1118 | install_element(ROUTER_NODE, &no_domain_passwd_cmd); | |
1d6fe72e EDP |
1119 | |
1120 | install_element(ROUTER_NODE, &lsp_gen_interval_cmd); | |
1121 | install_element(ROUTER_NODE, &no_lsp_gen_interval_cmd); | |
7e869004 EDP |
1122 | |
1123 | install_element(ROUTER_NODE, &lsp_refresh_interval_cmd); | |
1124 | install_element(ROUTER_NODE, &no_lsp_refresh_interval_cmd); | |
ea120aa0 EDP |
1125 | |
1126 | install_element(ROUTER_NODE, &max_lsp_lifetime_cmd); | |
1127 | install_element(ROUTER_NODE, &no_max_lsp_lifetime_cmd); | |
27a45d16 EDP |
1128 | |
1129 | install_element(ROUTER_NODE, &area_lsp_mtu_cmd); | |
1130 | install_element(ROUTER_NODE, &no_area_lsp_mtu_cmd); | |
dcb1dcd6 EDP |
1131 | |
1132 | install_element(ROUTER_NODE, &spf_interval_cmd); | |
1133 | install_element(ROUTER_NODE, &no_spf_interval_cmd); | |
5336ba30 EDP |
1134 | |
1135 | install_element(ROUTER_NODE, &spf_delay_ietf_cmd); | |
1136 | install_element(ROUTER_NODE, &no_spf_delay_ietf_cmd); | |
66e45e10 EDP |
1137 | |
1138 | install_element(ROUTER_NODE, &area_purge_originator_cmd); | |
a6a36c41 EDP |
1139 | |
1140 | install_element(INTERFACE_NODE, &isis_passive_cmd); | |
1141 | install_element(INTERFACE_NODE, &no_isis_passive_cmd); | |
3e20c83a EDP |
1142 | |
1143 | install_element(INTERFACE_NODE, &isis_passwd_cmd); | |
1144 | install_element(INTERFACE_NODE, &no_isis_passwd_cmd); | |
be49219c EDP |
1145 | |
1146 | install_element(INTERFACE_NODE, &isis_metric_cmd); | |
1147 | install_element(INTERFACE_NODE, &no_isis_metric_cmd); | |
356a2e3c EDP |
1148 | |
1149 | install_element(INTERFACE_NODE, &isis_hello_interval_cmd); | |
1150 | install_element(INTERFACE_NODE, &no_isis_hello_interval_cmd); | |
4e75a67d EDP |
1151 | |
1152 | install_element(INTERFACE_NODE, &isis_hello_multiplier_cmd); | |
1153 | install_element(INTERFACE_NODE, &no_isis_hello_multiplier_cmd); | |
9ce808b9 EDP |
1154 | |
1155 | install_element(INTERFACE_NODE, &csnp_interval_cmd); | |
1156 | install_element(INTERFACE_NODE, &no_csnp_interval_cmd); | |
1157 | ||
1158 | install_element(INTERFACE_NODE, &psnp_interval_cmd); | |
1159 | install_element(INTERFACE_NODE, &no_psnp_interval_cmd); | |
83d043f6 EDP |
1160 | |
1161 | install_element(INTERFACE_NODE, &circuit_topology_cmd); | |
1162 | install_element(INTERFACE_NODE, &no_circuit_topology_cmd); | |
ef020087 | 1163 | } |