]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_vty_isisd.c
Merge pull request #2944 from thbtcllt/master
[mirror_frr.git] / isisd / isis_vty_isisd.c
1 /*
2 * IS-IS Rout(e)ing protocol - isis_vty_isisd.c
3 *
4 * This file contains the CLI that is specific to IS-IS
5 *
6 * Copyright (C) 2001,2002 Sampo Saaristo
7 * Tampere University of Technology
8 * Institute of Communications Engineering
9 * Copyright (C) 2016 David Lamparter, for NetDEF, Inc.
10 * Copyright (C) 2018 Christian Franke, for NetDEF, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public Licenseas published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
20 * more details.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; see the file COPYING; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 */
26
27 #include <zebra.h>
28
29 #include "command.h"
30
31 #include "isis_circuit.h"
32 #include "isis_csm.h"
33 #include "isis_misc.h"
34 #include "isis_mt.h"
35 #include "isisd.h"
36 #include "isis_vty_common.h"
37
38 static int level_for_arg(const char *arg)
39 {
40 if (!strcmp(arg, "level-1"))
41 return IS_LEVEL_1;
42 else
43 return IS_LEVEL_2;
44 }
45
46 DEFUN (isis_circuit_type,
47 isis_circuit_type_cmd,
48 "isis circuit-type <level-1|level-1-2|level-2-only>",
49 "IS-IS routing protocol\n"
50 "Configure circuit type for interface\n"
51 "Level-1 only adjacencies are formed\n"
52 "Level-1-2 adjacencies are formed\n"
53 "Level-2 only adjacencies are formed\n")
54 {
55 int idx_level = 2;
56 int is_type;
57 struct isis_circuit *circuit = isis_circuit_lookup(vty);
58 if (!circuit)
59 return CMD_ERR_NO_MATCH;
60
61 is_type = string2circuit_t(argv[idx_level]->arg);
62 if (!is_type) {
63 vty_out(vty, "Unknown circuit-type \n");
64 return CMD_WARNING_CONFIG_FAILED;
65 }
66
67 if (circuit->state == C_STATE_UP
68 && circuit->area->is_type != IS_LEVEL_1_AND_2
69 && circuit->area->is_type != is_type) {
70 vty_out(vty, "Invalid circuit level for area %s.\n",
71 circuit->area->area_tag);
72 return CMD_WARNING_CONFIG_FAILED;
73 }
74 isis_circuit_is_type_set(circuit, is_type);
75
76 return CMD_SUCCESS;
77 }
78
79 DEFUN (no_isis_circuit_type,
80 no_isis_circuit_type_cmd,
81 "no isis circuit-type <level-1|level-1-2|level-2-only>",
82 NO_STR
83 "IS-IS routing protocol\n"
84 "Configure circuit type for interface\n"
85 "Level-1 only adjacencies are formed\n"
86 "Level-1-2 adjacencies are formed\n"
87 "Level-2 only adjacencies are formed\n")
88 {
89 int is_type;
90 struct isis_circuit *circuit = isis_circuit_lookup(vty);
91 if (!circuit)
92 return CMD_ERR_NO_MATCH;
93
94 /*
95 * Set the circuits level to its default value
96 */
97 if (circuit->state == C_STATE_UP)
98 is_type = circuit->area->is_type;
99 else
100 is_type = IS_LEVEL_1_AND_2;
101 isis_circuit_is_type_set(circuit, is_type);
102
103 return CMD_SUCCESS;
104 }
105
106 DEFUN (isis_network,
107 isis_network_cmd,
108 "isis network point-to-point",
109 "IS-IS routing protocol\n"
110 "Set network type\n"
111 "point-to-point network type\n")
112 {
113 struct isis_circuit *circuit = isis_circuit_lookup(vty);
114 if (!circuit)
115 return CMD_ERR_NO_MATCH;
116
117 if (isis_circuit_circ_type_set(circuit, CIRCUIT_T_P2P)) {
118 vty_out(vty,
119 "isis network point-to-point is valid only on broadcast interfaces\n");
120 return CMD_WARNING_CONFIG_FAILED;
121 }
122
123 return CMD_SUCCESS;
124 }
125
126 DEFUN (no_isis_network,
127 no_isis_network_cmd,
128 "no isis network point-to-point",
129 NO_STR
130 "IS-IS routing protocol\n"
131 "Set network type for circuit\n"
132 "point-to-point network type\n")
133 {
134 struct isis_circuit *circuit = isis_circuit_lookup(vty);
135 if (!circuit)
136 return CMD_ERR_NO_MATCH;
137
138 if (isis_circuit_circ_type_set(circuit, CIRCUIT_T_BROADCAST)) {
139 vty_out(vty,
140 "isis network point-to-point is valid only on broadcast interfaces\n");
141 return CMD_WARNING_CONFIG_FAILED;
142 }
143
144 return CMD_SUCCESS;
145 }
146
147 DEFUN (isis_priority,
148 isis_priority_cmd,
149 "isis priority (0-127)",
150 "IS-IS routing protocol\n"
151 "Set priority for Designated Router election\n"
152 "Priority value\n")
153 {
154 uint8_t prio = atoi(argv[2]->arg);
155 struct isis_circuit *circuit = isis_circuit_lookup(vty);
156 if (!circuit)
157 return CMD_ERR_NO_MATCH;
158
159 circuit->priority[0] = prio;
160 circuit->priority[1] = prio;
161
162 return CMD_SUCCESS;
163 }
164
165 DEFUN (no_isis_priority,
166 no_isis_priority_cmd,
167 "no isis priority [(0-127)]",
168 NO_STR
169 "IS-IS routing protocol\n"
170 "Set priority for Designated Router election\n"
171 "Priority value\n")
172 {
173 struct isis_circuit *circuit = isis_circuit_lookup(vty);
174 if (!circuit)
175 return CMD_ERR_NO_MATCH;
176
177 circuit->priority[0] = DEFAULT_PRIORITY;
178 circuit->priority[1] = DEFAULT_PRIORITY;
179
180 return CMD_SUCCESS;
181 }
182
183 DEFUN (isis_priority_level,
184 isis_priority_level_cmd,
185 "isis priority (0-127) <level-1|level-2>",
186 "IS-IS routing protocol\n"
187 "Set priority for Designated Router election\n"
188 "Priority value\n"
189 "Specify priority for level-1 routing\n"
190 "Specify priority for level-2 routing\n")
191 {
192 uint8_t prio = atoi(argv[2]->arg);
193 struct isis_circuit *circuit = isis_circuit_lookup(vty);
194 if (!circuit)
195 return CMD_ERR_NO_MATCH;
196
197 circuit->priority[level_for_arg(argv[3]->text)] = prio;
198
199 return CMD_SUCCESS;
200 }
201
202 DEFUN (no_isis_priority_level,
203 no_isis_priority_level_cmd,
204 "no isis priority [(0-127)] <level-1|level-2>",
205 NO_STR
206 "IS-IS routing protocol\n"
207 "Set priority for Designated Router election\n"
208 "Priority value\n"
209 "Specify priority for level-1 routing\n"
210 "Specify priority for level-2 routing\n")
211 {
212 struct isis_circuit *circuit = isis_circuit_lookup(vty);
213 int level = level_for_arg(argv[argc - 1]->text);
214 if (!circuit)
215 return CMD_ERR_NO_MATCH;
216
217 circuit->priority[level] = DEFAULT_PRIORITY;
218
219 return CMD_SUCCESS;
220 }
221
222 DEFUN (isis_metric_level,
223 isis_metric_level_cmd,
224 "isis metric (0-16777215) <level-1|level-2>",
225 "IS-IS routing protocol\n"
226 "Set default metric for circuit\n"
227 "Default metric value\n"
228 "Specify metric for level-1 routing\n"
229 "Specify metric for level-2 routing\n")
230 {
231 uint32_t met = atoi(argv[2]->arg);
232 struct isis_circuit *circuit = isis_circuit_lookup(vty);
233 if (!circuit)
234 return CMD_ERR_NO_MATCH;
235
236 CMD_FERR_RETURN(isis_circuit_metric_set(circuit,
237 level_for_arg(argv[3]->text),
238 met),
239 "Failed to set metric: $ERR");
240 return CMD_SUCCESS;
241 }
242
243 DEFUN (no_isis_metric_level,
244 no_isis_metric_level_cmd,
245 "no isis metric [(0-16777215)] <level-1|level-2>",
246 NO_STR
247 "IS-IS routing protocol\n"
248 "Set default metric for circuit\n"
249 "Default metric value\n"
250 "Specify metric for level-1 routing\n"
251 "Specify metric for level-2 routing\n")
252 {
253 struct isis_circuit *circuit = isis_circuit_lookup(vty);
254 int level = level_for_arg(argv[argc - 1]->text);
255 if (!circuit)
256 return CMD_ERR_NO_MATCH;
257
258 CMD_FERR_RETURN(isis_circuit_metric_set(circuit, level,
259 DEFAULT_CIRCUIT_METRIC),
260 "Failed to set L1 metric: $ERR");
261 return CMD_SUCCESS;
262 }
263
264 DEFUN (isis_hello_interval_level,
265 isis_hello_interval_level_cmd,
266 "isis hello-interval (1-600) <level-1|level-2>",
267 "IS-IS routing protocol\n"
268 "Set Hello interval\n"
269 "Holdtime 1 second, interval depends on multiplier\n"
270 "Specify hello-interval for level-1 IIHs\n"
271 "Specify hello-interval for level-2 IIHs\n")
272 {
273 uint32_t interval = atoi(argv[2]->arg);
274 struct isis_circuit *circuit = isis_circuit_lookup(vty);
275 if (!circuit)
276 return CMD_ERR_NO_MATCH;
277
278 circuit->hello_interval[level_for_arg(argv[3]->text)] = interval;
279
280 return CMD_SUCCESS;
281 }
282
283 DEFUN (no_isis_hello_interval_level,
284 no_isis_hello_interval_level_cmd,
285 "no isis hello-interval [(1-600)] <level-1|level-2>",
286 NO_STR
287 "IS-IS routing protocol\n"
288 "Set Hello interval\n"
289 "Holdtime 1 second, interval depends on multiplier\n"
290 "Specify hello-interval for level-1 IIHs\n"
291 "Specify hello-interval for level-2 IIHs\n")
292 {
293 struct isis_circuit *circuit = isis_circuit_lookup(vty);
294 int level = level_for_arg(argv[argc - 1]->text);
295 if (!circuit)
296 return CMD_ERR_NO_MATCH;
297
298 circuit->hello_interval[level] = DEFAULT_HELLO_INTERVAL;
299
300 return CMD_SUCCESS;
301 }
302
303 DEFUN (isis_hello_multiplier_level,
304 isis_hello_multiplier_level_cmd,
305 "isis hello-multiplier (2-100) <level-1|level-2>",
306 "IS-IS routing protocol\n"
307 "Set multiplier for Hello holding time\n"
308 "Hello multiplier value\n"
309 "Specify hello multiplier for level-1 IIHs\n"
310 "Specify hello multiplier for level-2 IIHs\n")
311 {
312 uint16_t mult = atoi(argv[2]->arg);
313 struct isis_circuit *circuit = isis_circuit_lookup(vty);
314 if (!circuit)
315 return CMD_ERR_NO_MATCH;
316
317 circuit->hello_multiplier[level_for_arg(argv[3]->text)] = mult;
318
319 return CMD_SUCCESS;
320 }
321
322 DEFUN (no_isis_hello_multiplier_level,
323 no_isis_hello_multiplier_level_cmd,
324 "no isis hello-multiplier [(2-100)] <level-1|level-2>",
325 NO_STR
326 "IS-IS routing protocol\n"
327 "Set multiplier for Hello holding time\n"
328 "Hello multiplier value\n"
329 "Specify hello multiplier for level-1 IIHs\n"
330 "Specify hello multiplier for level-2 IIHs\n")
331 {
332 struct isis_circuit *circuit = isis_circuit_lookup(vty);
333 int level = level_for_arg(argv[argc - 1]->text);
334 if (!circuit)
335 return CMD_ERR_NO_MATCH;
336
337 circuit->hello_multiplier[level] = DEFAULT_HELLO_MULTIPLIER;
338
339 return CMD_SUCCESS;
340 }
341
342 DEFUN (isis_threeway_adj,
343 isis_threeway_adj_cmd,
344 "[no] isis three-way-handshake",
345 NO_STR
346 "IS-IS commands\n"
347 "Enable/Disable three-way handshake\n")
348 {
349 struct isis_circuit *circuit = isis_circuit_lookup(vty);
350 if (!circuit)
351 return CMD_ERR_NO_MATCH;
352
353 circuit->disable_threeway_adj = !strcmp(argv[0]->text, "no");
354 return CMD_SUCCESS;
355 }
356
357 DEFUN (isis_hello_padding,
358 isis_hello_padding_cmd,
359 "isis hello padding",
360 "IS-IS routing protocol\n"
361 "Add padding to IS-IS hello packets\n"
362 "Pad hello packets\n")
363 {
364 struct isis_circuit *circuit = isis_circuit_lookup(vty);
365 if (!circuit)
366 return CMD_ERR_NO_MATCH;
367
368 circuit->pad_hellos = 1;
369
370 return CMD_SUCCESS;
371 }
372
373 DEFUN (no_isis_hello_padding,
374 no_isis_hello_padding_cmd,
375 "no isis hello padding",
376 NO_STR
377 "IS-IS routing protocol\n"
378 "Add padding to IS-IS hello packets\n"
379 "Pad hello packets\n")
380 {
381 struct isis_circuit *circuit = isis_circuit_lookup(vty);
382 if (!circuit)
383 return CMD_ERR_NO_MATCH;
384
385 circuit->pad_hellos = 0;
386
387 return CMD_SUCCESS;
388 }
389
390 DEFUN (csnp_interval_level,
391 csnp_interval_level_cmd,
392 "isis csnp-interval (1-600) <level-1|level-2>",
393 "IS-IS routing protocol\n"
394 "Set CSNP interval in seconds\n"
395 "CSNP interval value\n"
396 "Specify interval for level-1 CSNPs\n"
397 "Specify interval for level-2 CSNPs\n")
398 {
399 uint16_t interval = atoi(argv[2]->arg);
400 struct isis_circuit *circuit = isis_circuit_lookup(vty);
401 if (!circuit)
402 return CMD_ERR_NO_MATCH;
403
404 circuit->csnp_interval[level_for_arg(argv[3]->text)] = interval;
405
406 return CMD_SUCCESS;
407 }
408
409 DEFUN (no_csnp_interval_level,
410 no_csnp_interval_level_cmd,
411 "no isis csnp-interval [(1-600)] <level-1|level-2>",
412 NO_STR
413 "IS-IS routing protocol\n"
414 "Set CSNP interval in seconds\n"
415 "CSNP interval value\n"
416 "Specify interval for level-1 CSNPs\n"
417 "Specify interval for level-2 CSNPs\n")
418 {
419 struct isis_circuit *circuit = isis_circuit_lookup(vty);
420 int level = level_for_arg(argv[argc - 1]->text);
421 if (!circuit)
422 return CMD_ERR_NO_MATCH;
423
424 circuit->csnp_interval[level] = DEFAULT_CSNP_INTERVAL;
425
426 return CMD_SUCCESS;
427 }
428
429 DEFUN (psnp_interval_level,
430 psnp_interval_level_cmd,
431 "isis psnp-interval (1-120) <level-1|level-2>",
432 "IS-IS routing protocol\n"
433 "Set PSNP interval in seconds\n"
434 "PSNP interval value\n"
435 "Specify interval for level-1 PSNPs\n"
436 "Specify interval for level-2 PSNPs\n")
437 {
438 uint16_t interval = atoi(argv[2]->arg);
439 struct isis_circuit *circuit = isis_circuit_lookup(vty);
440 if (!circuit)
441 return CMD_ERR_NO_MATCH;
442
443 circuit->psnp_interval[level_for_arg(argv[3]->text)] = (uint16_t)interval;
444
445 return CMD_SUCCESS;
446 }
447
448 DEFUN (no_psnp_interval_level,
449 no_psnp_interval_level_cmd,
450 "no isis psnp-interval [(1-120)] <level-1|level-2>",
451 NO_STR
452 "IS-IS routing protocol\n"
453 "Set PSNP interval in seconds\n"
454 "PSNP interval value\n"
455 "Specify interval for level-1 PSNPs\n"
456 "Specify interval for level-2 PSNPs\n")
457 {
458 struct isis_circuit *circuit = isis_circuit_lookup(vty);
459 int level = level_for_arg(argv[argc - 1]->text);
460 if (!circuit)
461 return CMD_ERR_NO_MATCH;
462
463 circuit->psnp_interval[level] = DEFAULT_PSNP_INTERVAL;
464
465 return CMD_SUCCESS;
466 }
467
468 static int validate_metric_style_narrow(struct vty *vty, struct isis_area *area)
469 {
470 struct isis_circuit *circuit;
471 struct listnode *node;
472
473 if (!vty)
474 return CMD_WARNING_CONFIG_FAILED;
475
476 if (!area) {
477 vty_out(vty, "ISIS area is invalid\n");
478 return CMD_WARNING_CONFIG_FAILED;
479 }
480
481 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) {
482 if ((area->is_type & IS_LEVEL_1)
483 && (circuit->is_type & IS_LEVEL_1)
484 && (circuit->te_metric[0] > MAX_NARROW_LINK_METRIC)) {
485 vty_out(vty, "ISIS circuit %s metric is invalid\n",
486 circuit->interface->name);
487 return CMD_WARNING_CONFIG_FAILED;
488 }
489 if ((area->is_type & IS_LEVEL_2)
490 && (circuit->is_type & IS_LEVEL_2)
491 && (circuit->te_metric[1] > MAX_NARROW_LINK_METRIC)) {
492 vty_out(vty, "ISIS circuit %s metric is invalid\n",
493 circuit->interface->name);
494 return CMD_WARNING_CONFIG_FAILED;
495 }
496 }
497
498 return CMD_SUCCESS;
499 }
500
501 DEFUN (metric_style,
502 metric_style_cmd,
503 "metric-style <narrow|transition|wide>",
504 "Use old-style (ISO 10589) or new-style packet formats\n"
505 "Use old style of TLVs with narrow metric\n"
506 "Send and accept both styles of TLVs during transition\n"
507 "Use new style of TLVs to carry wider metric\n")
508 {
509 int idx_metric_style = 1;
510 VTY_DECLVAR_CONTEXT(isis_area, area);
511 int ret;
512
513 if (strncmp(argv[idx_metric_style]->arg, "w", 1) == 0) {
514 isis_area_metricstyle_set(area, false, true);
515 return CMD_SUCCESS;
516 }
517
518 if (area_is_mt(area)) {
519 vty_out(vty,
520 "Narrow metrics cannot be used while multi topology IS-IS is active\n");
521 return CMD_WARNING_CONFIG_FAILED;
522 }
523
524 ret = validate_metric_style_narrow(vty, area);
525 if (ret != CMD_SUCCESS)
526 return ret;
527
528 if (strncmp(argv[idx_metric_style]->arg, "t", 1) == 0)
529 isis_area_metricstyle_set(area, true, true);
530 else if (strncmp(argv[idx_metric_style]->arg, "n", 1) == 0)
531 isis_area_metricstyle_set(area, true, false);
532 return CMD_SUCCESS;
533
534 return CMD_SUCCESS;
535 }
536
537 DEFUN (no_metric_style,
538 no_metric_style_cmd,
539 "no metric-style",
540 NO_STR
541 "Use old-style (ISO 10589) or new-style packet formats\n")
542 {
543 VTY_DECLVAR_CONTEXT(isis_area, area);
544 int ret;
545
546 if (area_is_mt(area)) {
547 vty_out(vty,
548 "Narrow metrics cannot be used while multi topology IS-IS is active\n");
549 return CMD_WARNING_CONFIG_FAILED;
550 }
551
552 ret = validate_metric_style_narrow(vty, area);
553 if (ret != CMD_SUCCESS)
554 return ret;
555
556 isis_area_metricstyle_set(area, true, false);
557 return CMD_SUCCESS;
558 }
559
560 DEFUN (set_attached_bit,
561 set_attached_bit_cmd,
562 "set-attached-bit",
563 "Set attached bit to identify as L1/L2 router for inter-area traffic\n")
564 {
565 VTY_DECLVAR_CONTEXT(isis_area, area);
566
567 isis_area_attached_bit_set(area, true);
568 return CMD_SUCCESS;
569 }
570
571 DEFUN (no_set_attached_bit,
572 no_set_attached_bit_cmd,
573 "no set-attached-bit",
574 NO_STR
575 "Reset attached bit\n")
576 {
577 VTY_DECLVAR_CONTEXT(isis_area, area);
578
579 isis_area_attached_bit_set(area, false);
580 return CMD_SUCCESS;
581 }
582
583 DEFUN (dynamic_hostname,
584 dynamic_hostname_cmd,
585 "hostname dynamic",
586 "Dynamic hostname for IS-IS\n"
587 "Dynamic hostname\n")
588 {
589 VTY_DECLVAR_CONTEXT(isis_area, area);
590
591 isis_area_dynhostname_set(area, true);
592 return CMD_SUCCESS;
593 }
594
595 DEFUN (no_dynamic_hostname,
596 no_dynamic_hostname_cmd,
597 "no hostname dynamic",
598 NO_STR
599 "Dynamic hostname for IS-IS\n"
600 "Dynamic hostname\n")
601 {
602 VTY_DECLVAR_CONTEXT(isis_area, area);
603
604 isis_area_dynhostname_set(area, false);
605 return CMD_SUCCESS;
606 }
607
608 DEFUN (is_type,
609 is_type_cmd,
610 "is-type <level-1|level-1-2|level-2-only>",
611 "IS Level for this routing process (OSI only)\n"
612 "Act as a station router only\n"
613 "Act as both a station router and an area router\n"
614 "Act as an area router only\n")
615 {
616 int idx_level = 1;
617 VTY_DECLVAR_CONTEXT(isis_area, area);
618 int type;
619
620 type = string2circuit_t(argv[idx_level]->arg);
621 if (!type) {
622 vty_out(vty, "Unknown IS level \n");
623 return CMD_SUCCESS;
624 }
625
626 isis_area_is_type_set(area, type);
627
628 return CMD_SUCCESS;
629 }
630
631 DEFUN (no_is_type,
632 no_is_type_cmd,
633 "no is-type <level-1|level-1-2|level-2-only>",
634 NO_STR
635 "IS Level for this routing process (OSI only)\n"
636 "Act as a station router only\n"
637 "Act as both a station router and an area router\n"
638 "Act as an area router only\n")
639 {
640 VTY_DECLVAR_CONTEXT(isis_area, area);
641 int type;
642
643 /*
644 * Put the is-type back to defaults:
645 * - level-1-2 on first area
646 * - level-1 for the rest
647 */
648 if (listgetdata(listhead(isis->area_list)) == area)
649 type = IS_LEVEL_1_AND_2;
650 else
651 type = IS_LEVEL_1;
652
653 isis_area_is_type_set(area, type);
654
655 return CMD_SUCCESS;
656 }
657
658 DEFUN (lsp_gen_interval_level,
659 lsp_gen_interval_level_cmd,
660 "lsp-gen-interval <level-1|level-2> (1-120)",
661 "Minimum interval between regenerating same LSP\n"
662 "Set interval for level 1 only\n"
663 "Set interval for level 2 only\n"
664 "Minimum interval in seconds\n")
665 {
666 uint16_t interval = atoi(argv[2]->arg);
667
668 return isis_vty_lsp_gen_interval_set(vty, level_for_arg(argv[1]->text),
669 interval);
670 }
671
672 DEFUN (no_lsp_gen_interval_level,
673 no_lsp_gen_interval_level_cmd,
674 "no lsp-gen-interval <level-1|level-2> [(1-120)]",
675 NO_STR
676 "Minimum interval between regenerating same LSP\n"
677 "Set interval for level 1 only\n"
678 "Set interval for level 2 only\n"
679 "Minimum interval in seconds\n")
680 {
681 VTY_DECLVAR_CONTEXT(isis_area, area);
682
683 return isis_vty_lsp_gen_interval_set(vty, level_for_arg(argv[2]->text),
684 DEFAULT_MIN_LSP_GEN_INTERVAL);
685 }
686
687 DEFUN (max_lsp_lifetime_level,
688 max_lsp_lifetime_level_cmd,
689 "max-lsp-lifetime <level-1|level-2> (350-65535)",
690 "Maximum LSP lifetime\n"
691 "Maximum LSP lifetime for Level 1 only\n"
692 "Maximum LSP lifetime for Level 2 only\n"
693 "LSP lifetime in seconds\n")
694 {
695 uint16_t lifetime = atoi(argv[2]->arg);
696
697 return isis_vty_max_lsp_lifetime_set(vty, level_for_arg(argv[1]->text),
698 lifetime);
699 }
700
701 DEFUN (no_max_lsp_lifetime_level,
702 no_max_lsp_lifetime_level_cmd,
703 "no max-lsp-lifetime <level-1|level-2> [(350-65535)]",
704 NO_STR
705 "Maximum LSP lifetime\n"
706 "Maximum LSP lifetime for Level 1 only\n"
707 "Maximum LSP lifetime for Level 2 only\n"
708 "LSP lifetime in seconds\n")
709 {
710 return isis_vty_max_lsp_lifetime_set(vty, level_for_arg(argv[1]->text),
711 DEFAULT_LSP_LIFETIME);
712 }
713
714 DEFUN (spf_interval_level,
715 spf_interval_level_cmd,
716 "spf-interval <level-1|level-2> (1-120)",
717 "Minimum interval between SPF calculations\n"
718 "Set interval for level 1 only\n"
719 "Set interval for level 2 only\n"
720 "Minimum interval between consecutive SPFs in seconds\n")
721 {
722 VTY_DECLVAR_CONTEXT(isis_area, area);
723 uint16_t interval = atoi(argv[2]->arg);
724
725 area->min_spf_interval[level_for_arg(argv[1]->text)] = interval;
726
727 return CMD_SUCCESS;
728 }
729
730 DEFUN (no_spf_interval_level,
731 no_spf_interval_level_cmd,
732 "no spf-interval <level-1|level-2> [(1-120)]",
733 NO_STR
734 "Minimum interval between SPF calculations\n"
735 "Set interval for level 1 only\n"
736 "Set interval for level 2 only\n"
737 "Minimum interval between consecutive SPFs in seconds\n")
738 {
739 VTY_DECLVAR_CONTEXT(isis_area, area);
740 int level = level_for_arg(argv[1]->text);
741
742 area->min_spf_interval[level] = MINIMUM_SPF_INTERVAL;
743
744 return CMD_SUCCESS;
745 }
746
747 DEFUN (lsp_refresh_interval_level,
748 lsp_refresh_interval_level_cmd,
749 "lsp-refresh-interval <level-1|level-2> (1-65235)",
750 "LSP refresh interval\n"
751 "LSP refresh interval for Level 1 only\n"
752 "LSP refresh interval for Level 2 only\n"
753 "LSP refresh interval in seconds\n")
754 {
755 uint16_t interval = atoi(argv[2]->arg);
756 return isis_vty_lsp_refresh_set(vty, level_for_arg(argv[1]->text),
757 interval);
758 }
759
760 DEFUN (no_lsp_refresh_interval_level,
761 no_lsp_refresh_interval_level_cmd,
762 "no lsp-refresh-interval <level-1|level-2> [(1-65235)]",
763 NO_STR
764 "LSP refresh interval\n"
765 "LSP refresh interval for Level 1 only\n"
766 "LSP refresh interval for Level 2 only\n"
767 "LSP refresh interval in seconds\n")
768 {
769 return isis_vty_lsp_refresh_set(vty, level_for_arg(argv[2]->text),
770 DEFAULT_MAX_LSP_GEN_INTERVAL);
771 }
772
773 DEFUN (area_passwd,
774 area_passwd_cmd,
775 "area-password <clear|md5> WORD [authenticate snp <send-only|validate>]",
776 "Configure the authentication password for an area\n"
777 "Authentication type\n"
778 "Authentication type\n"
779 "Area password\n"
780 "Authentication\n"
781 "SNP PDUs\n"
782 "Send but do not check PDUs on receiving\n"
783 "Send and check PDUs on receiving\n")
784 {
785 return isis_vty_password_set(vty, argc, argv, IS_LEVEL_1);
786 }
787
788 DEFUN (no_area_passwd,
789 no_area_passwd_cmd,
790 "no area-password",
791 NO_STR
792 "Configure the authentication password for an area\n")
793 {
794 VTY_DECLVAR_CONTEXT(isis_area, area);
795
796 return isis_area_passwd_unset(area, IS_LEVEL_1);
797 }
798
799 void isis_vty_daemon_init(void)
800 {
801 install_element(INTERFACE_NODE, &isis_circuit_type_cmd);
802 install_element(INTERFACE_NODE, &no_isis_circuit_type_cmd);
803
804 install_element(INTERFACE_NODE, &isis_network_cmd);
805 install_element(INTERFACE_NODE, &no_isis_network_cmd);
806
807 install_element(INTERFACE_NODE, &isis_priority_cmd);
808 install_element(INTERFACE_NODE, &no_isis_priority_cmd);
809 install_element(INTERFACE_NODE, &isis_priority_level_cmd);
810 install_element(INTERFACE_NODE, &no_isis_priority_level_cmd);
811
812 install_element(INTERFACE_NODE, &isis_metric_level_cmd);
813 install_element(INTERFACE_NODE, &no_isis_metric_level_cmd);
814
815 install_element(INTERFACE_NODE, &isis_hello_interval_level_cmd);
816 install_element(INTERFACE_NODE, &no_isis_hello_interval_level_cmd);
817
818 install_element(INTERFACE_NODE, &isis_hello_multiplier_level_cmd);
819 install_element(INTERFACE_NODE, &no_isis_hello_multiplier_level_cmd);
820
821 install_element(INTERFACE_NODE, &isis_threeway_adj_cmd);
822
823 install_element(INTERFACE_NODE, &isis_hello_padding_cmd);
824 install_element(INTERFACE_NODE, &no_isis_hello_padding_cmd);
825
826 install_element(INTERFACE_NODE, &csnp_interval_level_cmd);
827 install_element(INTERFACE_NODE, &no_csnp_interval_level_cmd);
828
829 install_element(INTERFACE_NODE, &psnp_interval_level_cmd);
830 install_element(INTERFACE_NODE, &no_psnp_interval_level_cmd);
831
832 install_element(ROUTER_NODE, &metric_style_cmd);
833 install_element(ROUTER_NODE, &no_metric_style_cmd);
834
835 install_element(ROUTER_NODE, &set_attached_bit_cmd);
836 install_element(ROUTER_NODE, &no_set_attached_bit_cmd);
837
838 install_element(ROUTER_NODE, &dynamic_hostname_cmd);
839 install_element(ROUTER_NODE, &no_dynamic_hostname_cmd);
840
841 install_element(ROUTER_NODE, &is_type_cmd);
842 install_element(ROUTER_NODE, &no_is_type_cmd);
843
844 install_element(ROUTER_NODE, &lsp_gen_interval_level_cmd);
845 install_element(ROUTER_NODE, &no_lsp_gen_interval_level_cmd);
846
847 install_element(ROUTER_NODE, &max_lsp_lifetime_level_cmd);
848 install_element(ROUTER_NODE, &no_max_lsp_lifetime_level_cmd);
849
850 install_element(ROUTER_NODE, &spf_interval_level_cmd);
851 install_element(ROUTER_NODE, &no_spf_interval_level_cmd);
852
853 install_element(ROUTER_NODE, &lsp_refresh_interval_level_cmd);
854 install_element(ROUTER_NODE, &no_lsp_refresh_interval_level_cmd);
855
856 install_element(ROUTER_NODE, &area_passwd_cmd);
857 install_element(ROUTER_NODE, &no_area_passwd_cmd);
858 }