blob: be415043029bc1d5c71269b263541139135b3fc6 [file] [log] [blame]
David Lamparter3732cba2016-07-29 16:19:40 +02001/*
2 * IS-IS Rout(e)ing protocol - isis_circuit.h
3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
7 * Copyright (C) 2016 David Lamparter, for NetDEF, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public Licenseas published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#include <zebra.h>
25#include <command.h>
26
27#include "isis_circuit.h"
28#include "isis_csm.h"
29#include "isis_misc.h"
30#include "isisd.h"
31
32static struct isis_circuit *
33isis_circuit_lookup (struct vty *vty)
34{
35 struct interface *ifp;
36 struct isis_circuit *circuit;
37
38 ifp = (struct interface *) vty->index;
39 if (!ifp)
40 {
41 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
42 return NULL;
43 }
44
45 circuit = circuit_scan_by_ifp (ifp);
46 if (!circuit)
47 {
48 vty_out (vty, "ISIS is not enabled on circuit %s%s",
49 ifp->name, VTY_NEWLINE);
50 return NULL;
51 }
52
53 return circuit;
54}
55
56DEFUN (ip_router_isis,
57 ip_router_isis_cmd,
58 "(ip|ipv6) router isis WORD",
59 "Interface Internet Protocol config commands\n"
60 "IP router interface commands\n"
61 "IS-IS Routing for IP\n"
62 "Routing process tag\n")
63{
64 struct interface *ifp;
65 struct isis_circuit *circuit;
66 struct isis_area *area;
67 const char *af = argv[0];
68 const char *area_tag = argv[1];
69
70 ifp = (struct interface *) vty->index;
71 assert (ifp);
72
73 /* Prevent more than one area per circuit */
74 circuit = circuit_scan_by_ifp (ifp);
75 if (circuit)
76 {
77 if (circuit->ip_router == 1)
78 {
79 if (strcmp (circuit->area->area_tag, area_tag))
80 {
81 vty_out (vty, "ISIS circuit is already defined on %s%s",
82 circuit->area->area_tag, VTY_NEWLINE);
83 return CMD_ERR_NOTHING_TODO;
84 }
85 return CMD_SUCCESS;
86 }
87 }
88
89 area = isis_area_lookup (area_tag);
90 if (!area)
91 area = isis_area_create (area_tag);
92
93 if (!circuit)
94 circuit = isis_circuit_create (area, ifp);
95
96 bool ip = circuit->ip_router, ipv6 = circuit->ipv6_router;
97 if (af[2] != '\0')
98 ipv6 = true;
99 else
100 ip = true;
101
102 isis_circuit_af_set (circuit, ip, ipv6);
103 return CMD_SUCCESS;
104}
105
106DEFUN (no_ip_router_isis,
107 no_ip_router_isis_cmd,
108 "no (ip|ipv6) router isis WORD",
109 NO_STR
110 "Interface Internet Protocol config commands\n"
111 "IP router interface commands\n"
112 "IS-IS Routing for IP\n"
113 "Routing process tag\n")
114{
115 struct interface *ifp;
116 struct isis_area *area;
117 struct isis_circuit *circuit;
118 const char *af = argv[0];
119 const char *area_tag = argv[1];
120
121 ifp = (struct interface *) vty->index;
122 if (!ifp)
123 {
124 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
125 return CMD_ERR_NO_MATCH;
126 }
127
128 area = isis_area_lookup (area_tag);
129 if (!area)
130 {
131 vty_out (vty, "Can't find ISIS instance %s%s",
132 argv[0], VTY_NEWLINE);
133 return CMD_ERR_NO_MATCH;
134 }
135
136 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
137 if (!circuit)
138 {
139 vty_out (vty, "ISIS is not enabled on circuit %s%s",
140 ifp->name, VTY_NEWLINE);
141 return CMD_ERR_NO_MATCH;
142 }
143
144 bool ip = circuit->ip_router, ipv6 = circuit->ipv6_router;
145 if (af[2] != '\0')
146 ipv6 = false;
147 else
148 ip = false;
149
150 isis_circuit_af_set (circuit, ip, ipv6);
151 return CMD_SUCCESS;
152}
153
154DEFUN (isis_passive,
155 isis_passive_cmd,
156 "isis passive",
157 "IS-IS commands\n"
158 "Configure the passive mode for interface\n")
159{
160 struct isis_circuit *circuit = isis_circuit_lookup (vty);
161 if (!circuit)
162 return CMD_ERR_NO_MATCH;
163
164 isis_circuit_passive_set (circuit, 1);
165 return CMD_SUCCESS;
166}
167
168DEFUN (no_isis_passive,
169 no_isis_passive_cmd,
170 "no isis passive",
171 NO_STR
172 "IS-IS commands\n"
173 "Configure the passive mode for interface\n")
174{
175 struct isis_circuit *circuit = isis_circuit_lookup (vty);
176 if (!circuit)
177 return CMD_ERR_NO_MATCH;
178
179 if (if_is_loopback (circuit->interface))
180 {
181 vty_out (vty, "Can't set no passive for loopback interface%s",
182 VTY_NEWLINE);
183 return CMD_ERR_AMBIGUOUS;
184 }
185
186 isis_circuit_passive_set (circuit, 0);
187 return CMD_SUCCESS;
188}
189
190DEFUN (isis_circuit_type,
191 isis_circuit_type_cmd,
192 "isis circuit-type (level-1|level-1-2|level-2-only)",
193 "IS-IS commands\n"
194 "Configure circuit type for interface\n"
195 "Level-1 only adjacencies are formed\n"
196 "Level-1-2 adjacencies are formed\n"
197 "Level-2 only adjacencies are formed\n")
198{
199 int is_type;
200 struct isis_circuit *circuit = isis_circuit_lookup (vty);
201 if (!circuit)
202 return CMD_ERR_NO_MATCH;
203
204 is_type = string2circuit_t (argv[0]);
205 if (!is_type)
206 {
207 vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
208 return CMD_ERR_AMBIGUOUS;
209 }
210
211 if (circuit->state == C_STATE_UP &&
212 circuit->area->is_type != IS_LEVEL_1_AND_2 &&
213 circuit->area->is_type != is_type)
214 {
215 vty_out (vty, "Invalid circuit level for area %s.%s",
216 circuit->area->area_tag, VTY_NEWLINE);
217 return CMD_ERR_AMBIGUOUS;
218 }
219 isis_circuit_is_type_set (circuit, is_type);
220
221 return CMD_SUCCESS;
222}
223
224DEFUN (no_isis_circuit_type,
225 no_isis_circuit_type_cmd,
226 "no isis circuit-type (level-1|level-1-2|level-2-only)",
227 NO_STR
228 "IS-IS commands\n"
229 "Configure circuit type for interface\n"
230 "Level-1 only adjacencies are formed\n"
231 "Level-1-2 adjacencies are formed\n"
232 "Level-2 only adjacencies are formed\n")
233{
234 int is_type;
235 struct isis_circuit *circuit = isis_circuit_lookup (vty);
236 if (!circuit)
237 return CMD_ERR_NO_MATCH;
238
239 /*
240 * Set the circuits level to its default value
241 */
242 if (circuit->state == C_STATE_UP)
243 is_type = circuit->area->is_type;
244 else
245 is_type = IS_LEVEL_1_AND_2;
246 isis_circuit_is_type_set (circuit, is_type);
247
248 return CMD_SUCCESS;
249}
250
251DEFUN (isis_network,
252 isis_network_cmd,
253 "isis network point-to-point",
254 "IS-IS commands\n"
255 "Set network type\n"
256 "point-to-point network type\n")
257{
258 struct isis_circuit *circuit = isis_circuit_lookup (vty);
259 if (!circuit)
260 return CMD_ERR_NO_MATCH;
261
262 if (!isis_circuit_circ_type_set(circuit, CIRCUIT_T_P2P))
263 {
264 vty_out (vty, "isis network point-to-point "
265 "is valid only on broadcast interfaces%s",
266 VTY_NEWLINE);
267 return CMD_ERR_AMBIGUOUS;
268 }
269
270 return CMD_SUCCESS;
271}
272
273DEFUN (no_isis_network,
274 no_isis_network_cmd,
275 "no isis network point-to-point",
276 NO_STR
277 "IS-IS commands\n"
278 "Set network type for circuit\n"
279 "point-to-point network type\n")
280{
281 struct isis_circuit *circuit = isis_circuit_lookup (vty);
282 if (!circuit)
283 return CMD_ERR_NO_MATCH;
284
285 if (!isis_circuit_circ_type_set(circuit, CIRCUIT_T_BROADCAST))
286 {
287 vty_out (vty, "isis network point-to-point "
288 "is valid only on broadcast interfaces%s",
289 VTY_NEWLINE);
290 return CMD_ERR_AMBIGUOUS;
291 }
292
293 return CMD_SUCCESS;
294}
295
Christian Frankef5fbfb22016-07-28 17:23:27 +0200296DEFUN (isis_passwd,
297 isis_passwd_cmd,
298 "isis password (md5|clear) WORD",
299 "IS-IS commands\n"
300 "Configure the authentication password for a circuit\n"
301 "HMAC-MD5 authentication\n"
302 "Cleartext password\n"
303 "Circuit password\n")
304{
305 struct isis_circuit *circuit = isis_circuit_lookup (vty);
306 int rv;
307 if (!circuit)
308 return CMD_ERR_NO_MATCH;
309
310 if (argv[0][0] == 'm')
311 rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[1]);
312 else
313 rv = isis_circuit_passwd_cleartext_set(circuit, argv[1]);
314 if (rv)
315 {
316 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
317 return CMD_ERR_AMBIGUOUS;
318 }
319
320 return CMD_SUCCESS;
321}
322
323DEFUN (no_isis_passwd,
324 no_isis_passwd_cmd,
325 "no isis password",
326 NO_STR
327 "IS-IS commands\n"
328 "Configure the authentication password for a circuit\n")
329{
330 struct isis_circuit *circuit = isis_circuit_lookup (vty);
331 if (!circuit)
332 return CMD_ERR_NO_MATCH;
333
334 isis_circuit_passwd_unset(circuit);
335
336 return CMD_SUCCESS;
337}
338
339ALIAS (no_isis_passwd,
340 no_isis_passwd_arg_cmd,
341 "no isis password (md5|clear) WORD",
342 NO_STR
343 "IS-IS commands\n"
344 "Configure the authentication password for a circuit\n"
345 "HMAC-MD5 authentication\n"
346 "Cleartext password\n"
347 "Circuit password\n")
348
David Lamparter3732cba2016-07-29 16:19:40 +0200349DEFUN (isis_priority,
350 isis_priority_cmd,
351 "isis priority <0-127>",
352 "IS-IS commands\n"
353 "Set priority for Designated Router election\n"
354 "Priority value\n")
355{
356 int prio;
357 struct isis_circuit *circuit = isis_circuit_lookup (vty);
358 if (!circuit)
359 return CMD_ERR_NO_MATCH;
360
361 prio = atoi (argv[0]);
362 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
363 {
364 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
365 prio, VTY_NEWLINE);
366 return CMD_ERR_AMBIGUOUS;
367 }
368
369 circuit->priority[0] = prio;
370 circuit->priority[1] = prio;
371
372 return CMD_SUCCESS;
373}
374
375DEFUN (no_isis_priority,
376 no_isis_priority_cmd,
377 "no isis priority",
378 NO_STR
379 "IS-IS commands\n"
380 "Set priority for Designated Router election\n")
381{
382 struct isis_circuit *circuit = isis_circuit_lookup (vty);
383 if (!circuit)
384 return CMD_ERR_NO_MATCH;
385
386 circuit->priority[0] = DEFAULT_PRIORITY;
387 circuit->priority[1] = DEFAULT_PRIORITY;
388
389 return CMD_SUCCESS;
390}
391
392ALIAS (no_isis_priority,
393 no_isis_priority_arg_cmd,
394 "no isis priority <0-127>",
395 NO_STR
396 "IS-IS commands\n"
397 "Set priority for Designated Router election\n"
398 "Priority value\n")
399
400DEFUN (isis_priority_l1,
401 isis_priority_l1_cmd,
402 "isis priority <0-127> level-1",
403 "IS-IS commands\n"
404 "Set priority for Designated Router election\n"
405 "Priority value\n"
406 "Specify priority for level-1 routing\n")
407{
408 int prio;
409 struct isis_circuit *circuit = isis_circuit_lookup (vty);
410 if (!circuit)
411 return CMD_ERR_NO_MATCH;
412
413 prio = atoi (argv[0]);
414 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
415 {
416 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
417 prio, VTY_NEWLINE);
418 return CMD_ERR_AMBIGUOUS;
419 }
420
421 circuit->priority[0] = prio;
422
423 return CMD_SUCCESS;
424}
425
426DEFUN (no_isis_priority_l1,
427 no_isis_priority_l1_cmd,
428 "no isis priority level-1",
429 NO_STR
430 "IS-IS commands\n"
431 "Set priority for Designated Router election\n"
432 "Specify priority for level-1 routing\n")
433{
434 struct isis_circuit *circuit = isis_circuit_lookup (vty);
435 if (!circuit)
436 return CMD_ERR_NO_MATCH;
437
438 circuit->priority[0] = DEFAULT_PRIORITY;
439
440 return CMD_SUCCESS;
441}
442
443ALIAS (no_isis_priority_l1,
444 no_isis_priority_l1_arg_cmd,
445 "no isis priority <0-127> level-1",
446 NO_STR
447 "IS-IS commands\n"
448 "Set priority for Designated Router election\n"
449 "Priority value\n"
450 "Specify priority for level-1 routing\n")
451
452DEFUN (isis_priority_l2,
453 isis_priority_l2_cmd,
454 "isis priority <0-127> level-2",
455 "IS-IS commands\n"
456 "Set priority for Designated Router election\n"
457 "Priority value\n"
458 "Specify priority for level-2 routing\n")
459{
460 int prio;
461 struct isis_circuit *circuit = isis_circuit_lookup (vty);
462 if (!circuit)
463 return CMD_ERR_NO_MATCH;
464
465 prio = atoi (argv[0]);
466 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
467 {
468 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
469 prio, VTY_NEWLINE);
470 return CMD_ERR_AMBIGUOUS;
471 }
472
473 circuit->priority[1] = prio;
474
475 return CMD_SUCCESS;
476}
477
478DEFUN (no_isis_priority_l2,
479 no_isis_priority_l2_cmd,
480 "no isis priority level-2",
481 NO_STR
482 "IS-IS commands\n"
483 "Set priority for Designated Router election\n"
484 "Specify priority for level-2 routing\n")
485{
486 struct isis_circuit *circuit = isis_circuit_lookup (vty);
487 if (!circuit)
488 return CMD_ERR_NO_MATCH;
489
490 circuit->priority[1] = DEFAULT_PRIORITY;
491
492 return CMD_SUCCESS;
493}
494
495ALIAS (no_isis_priority_l2,
496 no_isis_priority_l2_arg_cmd,
497 "no isis priority <0-127> level-2",
498 NO_STR
499 "IS-IS commands\n"
500 "Set priority for Designated Router election\n"
501 "Priority value\n"
502 "Specify priority for level-2 routing\n")
503
504/* Metric command */
505DEFUN (isis_metric,
506 isis_metric_cmd,
507 "isis metric <0-16777215>",
508 "IS-IS commands\n"
509 "Set default metric for circuit\n"
510 "Default metric value\n")
511{
512 int met;
513 struct isis_circuit *circuit = isis_circuit_lookup (vty);
514 if (!circuit)
515 return CMD_ERR_NO_MATCH;
516
517 met = atoi (argv[0]);
518
519 /* RFC3787 section 5.1 */
520 if (circuit->area && circuit->area->oldmetric == 1 &&
521 met > MAX_NARROW_LINK_METRIC)
522 {
523 vty_out (vty, "Invalid metric %d - should be <0-63> "
524 "when narrow metric type enabled%s",
525 met, VTY_NEWLINE);
526 return CMD_ERR_AMBIGUOUS;
527 }
528
529 /* RFC4444 */
530 if (circuit->area && circuit->area->newmetric == 1 &&
531 met > MAX_WIDE_LINK_METRIC)
532 {
533 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
534 "when wide metric type enabled%s",
535 met, VTY_NEWLINE);
536 return CMD_ERR_AMBIGUOUS;
537 }
538
539 isis_circuit_metric_set (circuit, IS_LEVEL_1, met);
540 isis_circuit_metric_set (circuit, IS_LEVEL_2, met);
541 return CMD_SUCCESS;
542}
543
544DEFUN (no_isis_metric,
545 no_isis_metric_cmd,
546 "no isis metric",
547 NO_STR
548 "IS-IS commands\n"
549 "Set default metric for circuit\n")
550{
551 struct isis_circuit *circuit = isis_circuit_lookup (vty);
552 if (!circuit)
553 return CMD_ERR_NO_MATCH;
554
555 isis_circuit_metric_set (circuit, IS_LEVEL_1, DEFAULT_CIRCUIT_METRIC);
556 isis_circuit_metric_set (circuit, IS_LEVEL_2, DEFAULT_CIRCUIT_METRIC);
557 return CMD_SUCCESS;
558}
559
560ALIAS (no_isis_metric,
561 no_isis_metric_arg_cmd,
562 "no isis metric <0-16777215>",
563 NO_STR
564 "IS-IS commands\n"
565 "Set default metric for circuit\n"
566 "Default metric value\n")
567
568DEFUN (isis_metric_l1,
569 isis_metric_l1_cmd,
570 "isis metric <0-16777215> level-1",
571 "IS-IS commands\n"
572 "Set default metric for circuit\n"
573 "Default metric value\n"
574 "Specify metric for level-1 routing\n")
575{
576 int met;
577 struct isis_circuit *circuit = isis_circuit_lookup (vty);
578 if (!circuit)
579 return CMD_ERR_NO_MATCH;
580
581 met = atoi (argv[0]);
582
583 /* RFC3787 section 5.1 */
584 if (circuit->area && circuit->area->oldmetric == 1 &&
585 met > MAX_NARROW_LINK_METRIC)
586 {
587 vty_out (vty, "Invalid metric %d - should be <0-63> "
588 "when narrow metric type enabled%s",
589 met, VTY_NEWLINE);
590 return CMD_ERR_AMBIGUOUS;
591 }
592
593 /* RFC4444 */
594 if (circuit->area && circuit->area->newmetric == 1 &&
595 met > MAX_WIDE_LINK_METRIC)
596 {
597 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
598 "when wide metric type enabled%s",
599 met, VTY_NEWLINE);
600 return CMD_ERR_AMBIGUOUS;
601 }
602
603 isis_circuit_metric_set (circuit, IS_LEVEL_1, met);
604 return CMD_SUCCESS;
605}
606
607DEFUN (no_isis_metric_l1,
608 no_isis_metric_l1_cmd,
609 "no isis metric level-1",
610 NO_STR
611 "IS-IS commands\n"
612 "Set default metric for circuit\n"
613 "Specify metric for level-1 routing\n")
614{
615 struct isis_circuit *circuit = isis_circuit_lookup (vty);
616 if (!circuit)
617 return CMD_ERR_NO_MATCH;
618
619 isis_circuit_metric_set (circuit, IS_LEVEL_1, DEFAULT_CIRCUIT_METRIC);
620 return CMD_SUCCESS;
621}
622
623ALIAS (no_isis_metric_l1,
624 no_isis_metric_l1_arg_cmd,
625 "no isis metric <0-16777215> level-1",
626 NO_STR
627 "IS-IS commands\n"
628 "Set default metric for circuit\n"
629 "Default metric value\n"
630 "Specify metric for level-1 routing\n")
631
632DEFUN (isis_metric_l2,
633 isis_metric_l2_cmd,
634 "isis metric <0-16777215> level-2",
635 "IS-IS commands\n"
636 "Set default metric for circuit\n"
637 "Default metric value\n"
638 "Specify metric for level-2 routing\n")
639{
640 int met;
641 struct isis_circuit *circuit = isis_circuit_lookup (vty);
642 if (!circuit)
643 return CMD_ERR_NO_MATCH;
644
645 met = atoi (argv[0]);
646
647 /* RFC3787 section 5.1 */
648 if (circuit->area && circuit->area->oldmetric == 1 &&
649 met > MAX_NARROW_LINK_METRIC)
650 {
651 vty_out (vty, "Invalid metric %d - should be <0-63> "
652 "when narrow metric type enabled%s",
653 met, VTY_NEWLINE);
654 return CMD_ERR_AMBIGUOUS;
655 }
656
657 /* RFC4444 */
658 if (circuit->area && circuit->area->newmetric == 1 &&
659 met > MAX_WIDE_LINK_METRIC)
660 {
661 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
662 "when wide metric type enabled%s",
663 met, VTY_NEWLINE);
664 return CMD_ERR_AMBIGUOUS;
665 }
666
667 isis_circuit_metric_set (circuit, IS_LEVEL_2, met);
668 return CMD_SUCCESS;
669}
670
671DEFUN (no_isis_metric_l2,
672 no_isis_metric_l2_cmd,
673 "no isis metric level-2",
674 NO_STR
675 "IS-IS commands\n"
676 "Set default metric for circuit\n"
677 "Specify metric for level-2 routing\n")
678{
679 struct isis_circuit *circuit = isis_circuit_lookup (vty);
680 if (!circuit)
681 return CMD_ERR_NO_MATCH;
682
683 isis_circuit_metric_set (circuit, IS_LEVEL_2, DEFAULT_CIRCUIT_METRIC);
684 return CMD_SUCCESS;
685}
686
687ALIAS (no_isis_metric_l2,
688 no_isis_metric_l2_arg_cmd,
689 "no isis metric <0-16777215> level-2",
690 NO_STR
691 "IS-IS commands\n"
692 "Set default metric for circuit\n"
693 "Default metric value\n"
694 "Specify metric for level-2 routing\n")
695/* end of metrics */
696
David Lamparterb5d2f5f2016-07-28 17:23:28 +0200697DEFUN (isis_hello_interval,
698 isis_hello_interval_cmd,
699 "isis hello-interval <1-600>",
700 "IS-IS commands\n"
701 "Set Hello interval\n"
702 "Hello interval value\n"
703 "Holdtime 1 seconds, interval depends on multiplier\n")
704{
705 int interval;
706 struct isis_circuit *circuit = isis_circuit_lookup (vty);
707 if (!circuit)
708 return CMD_ERR_NO_MATCH;
709
710 interval = atoi (argv[0]);
711 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
712 {
713 vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s",
714 interval, VTY_NEWLINE);
715 return CMD_ERR_AMBIGUOUS;
716 }
717
718 circuit->hello_interval[0] = (u_int16_t) interval;
719 circuit->hello_interval[1] = (u_int16_t) interval;
720
721 return CMD_SUCCESS;
722}
723
724DEFUN (no_isis_hello_interval,
725 no_isis_hello_interval_cmd,
726 "no isis hello-interval",
727 NO_STR
728 "IS-IS commands\n"
729 "Set Hello interval\n")
730{
731 struct isis_circuit *circuit = isis_circuit_lookup (vty);
732 if (!circuit)
733 return CMD_ERR_NO_MATCH;
734
735 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
736 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
737
738 return CMD_SUCCESS;
739}
740
741ALIAS (no_isis_hello_interval,
742 no_isis_hello_interval_arg_cmd,
743 "no isis hello-interval <1-600>",
744 NO_STR
745 "IS-IS commands\n"
746 "Set Hello interval\n"
747 "Hello interval value\n"
748 "Holdtime 1 second, interval depends on multiplier\n")
749
750DEFUN (isis_hello_interval_l1,
751 isis_hello_interval_l1_cmd,
752 "isis hello-interval <1-600> level-1",
753 "IS-IS commands\n"
754 "Set Hello interval\n"
755 "Hello interval value\n"
756 "Holdtime 1 second, interval depends on multiplier\n"
757 "Specify hello-interval for level-1 IIHs\n")
758{
759 long interval;
760 struct isis_circuit *circuit = isis_circuit_lookup (vty);
761 if (!circuit)
762 return CMD_ERR_NO_MATCH;
763
764 interval = atoi (argv[0]);
765 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
766 {
767 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
768 interval, VTY_NEWLINE);
769 return CMD_ERR_AMBIGUOUS;
770 }
771
772 circuit->hello_interval[0] = (u_int16_t) interval;
773
774 return CMD_SUCCESS;
775}
776
777DEFUN (no_isis_hello_interval_l1,
778 no_isis_hello_interval_l1_cmd,
779 "no isis hello-interval level-1",
780 NO_STR
781 "IS-IS commands\n"
782 "Set Hello interval\n"
783 "Specify hello-interval for level-1 IIHs\n")
784{
785 struct isis_circuit *circuit = isis_circuit_lookup (vty);
786 if (!circuit)
787 return CMD_ERR_NO_MATCH;
788
789 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
790
791 return CMD_SUCCESS;
792}
793
794ALIAS (no_isis_hello_interval_l1,
795 no_isis_hello_interval_l1_arg_cmd,
796 "no isis hello-interval <1-600> level-1",
797 NO_STR
798 "IS-IS commands\n"
799 "Set Hello interval\n"
800 "Hello interval value\n"
801 "Holdtime 1 second, interval depends on multiplier\n"
802 "Specify hello-interval for level-1 IIHs\n")
803
804DEFUN (isis_hello_interval_l2,
805 isis_hello_interval_l2_cmd,
806 "isis hello-interval <1-600> level-2",
807 "IS-IS commands\n"
808 "Set Hello interval\n"
809 "Hello interval value\n"
810 "Holdtime 1 second, interval depends on multiplier\n"
811 "Specify hello-interval for level-2 IIHs\n")
812{
813 long interval;
814 struct isis_circuit *circuit = isis_circuit_lookup (vty);
815 if (!circuit)
816 return CMD_ERR_NO_MATCH;
817
818 interval = atoi (argv[0]);
819 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
820 {
821 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
822 interval, VTY_NEWLINE);
823 return CMD_ERR_AMBIGUOUS;
824 }
825
826 circuit->hello_interval[1] = (u_int16_t) interval;
827
828 return CMD_SUCCESS;
829}
830
831DEFUN (no_isis_hello_interval_l2,
832 no_isis_hello_interval_l2_cmd,
833 "no isis hello-interval level-2",
834 NO_STR
835 "IS-IS commands\n"
836 "Set Hello interval\n"
837 "Specify hello-interval for level-2 IIHs\n")
838{
839 struct isis_circuit *circuit = isis_circuit_lookup (vty);
840 if (!circuit)
841 return CMD_ERR_NO_MATCH;
842
843 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
844
845 return CMD_SUCCESS;
846}
847
848ALIAS (no_isis_hello_interval_l2,
849 no_isis_hello_interval_l2_arg_cmd,
850 "no isis hello-interval <1-600> level-2",
851 NO_STR
852 "IS-IS commands\n"
853 "Set Hello interval\n"
854 "Hello interval value\n"
855 "Holdtime 1 second, interval depends on multiplier\n"
856 "Specify hello-interval for level-2 IIHs\n")
857
858DEFUN (isis_hello_multiplier,
859 isis_hello_multiplier_cmd,
860 "isis hello-multiplier <2-100>",
861 "IS-IS commands\n"
862 "Set multiplier for Hello holding time\n"
863 "Hello multiplier value\n")
864{
865 int mult;
866 struct isis_circuit *circuit = isis_circuit_lookup (vty);
867 if (!circuit)
868 return CMD_ERR_NO_MATCH;
869
870 mult = atoi (argv[0]);
871 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
872 {
873 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
874 mult, VTY_NEWLINE);
875 return CMD_ERR_AMBIGUOUS;
876 }
877
878 circuit->hello_multiplier[0] = (u_int16_t) mult;
879 circuit->hello_multiplier[1] = (u_int16_t) mult;
880
881 return CMD_SUCCESS;
882}
883
884DEFUN (no_isis_hello_multiplier,
885 no_isis_hello_multiplier_cmd,
886 "no isis hello-multiplier",
887 NO_STR
888 "IS-IS commands\n"
889 "Set multiplier for Hello holding time\n")
890{
891 struct isis_circuit *circuit = isis_circuit_lookup (vty);
892 if (!circuit)
893 return CMD_ERR_NO_MATCH;
894
895 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
896 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
897
898 return CMD_SUCCESS;
899}
900
901ALIAS (no_isis_hello_multiplier,
902 no_isis_hello_multiplier_arg_cmd,
903 "no isis hello-multiplier <2-100>",
904 NO_STR
905 "IS-IS commands\n"
906 "Set multiplier for Hello holding time\n"
907 "Hello multiplier value\n")
908
909DEFUN (isis_hello_multiplier_l1,
910 isis_hello_multiplier_l1_cmd,
911 "isis hello-multiplier <2-100> level-1",
912 "IS-IS commands\n"
913 "Set multiplier for Hello holding time\n"
914 "Hello multiplier value\n"
915 "Specify hello multiplier for level-1 IIHs\n")
916{
917 int mult;
918 struct isis_circuit *circuit = isis_circuit_lookup (vty);
919 if (!circuit)
920 return CMD_ERR_NO_MATCH;
921
922 mult = atoi (argv[0]);
923 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
924 {
925 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
926 mult, VTY_NEWLINE);
927 return CMD_ERR_AMBIGUOUS;
928 }
929
930 circuit->hello_multiplier[0] = (u_int16_t) mult;
931
932 return CMD_SUCCESS;
933}
934
935DEFUN (no_isis_hello_multiplier_l1,
936 no_isis_hello_multiplier_l1_cmd,
937 "no isis hello-multiplier level-1",
938 NO_STR
939 "IS-IS commands\n"
940 "Set multiplier for Hello holding time\n"
941 "Specify hello multiplier for level-1 IIHs\n")
942{
943 struct isis_circuit *circuit = isis_circuit_lookup (vty);
944 if (!circuit)
945 return CMD_ERR_NO_MATCH;
946
947 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
948
949 return CMD_SUCCESS;
950}
951
952ALIAS (no_isis_hello_multiplier_l1,
953 no_isis_hello_multiplier_l1_arg_cmd,
954 "no isis hello-multiplier <2-100> level-1",
955 NO_STR
956 "IS-IS commands\n"
957 "Set multiplier for Hello holding time\n"
958 "Hello multiplier value\n"
959 "Specify hello multiplier for level-1 IIHs\n")
960
961DEFUN (isis_hello_multiplier_l2,
962 isis_hello_multiplier_l2_cmd,
963 "isis hello-multiplier <2-100> level-2",
964 "IS-IS commands\n"
965 "Set multiplier for Hello holding time\n"
966 "Hello multiplier value\n"
967 "Specify hello multiplier for level-2 IIHs\n")
968{
969 int mult;
970 struct isis_circuit *circuit = isis_circuit_lookup (vty);
971 if (!circuit)
972 return CMD_ERR_NO_MATCH;
973
974 mult = atoi (argv[0]);
975 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
976 {
977 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
978 mult, VTY_NEWLINE);
979 return CMD_ERR_AMBIGUOUS;
980 }
981
982 circuit->hello_multiplier[1] = (u_int16_t) mult;
983
984 return CMD_SUCCESS;
985}
986
987DEFUN (no_isis_hello_multiplier_l2,
988 no_isis_hello_multiplier_l2_cmd,
989 "no isis hello-multiplier level-2",
990 NO_STR
991 "IS-IS commands\n"
992 "Set multiplier for Hello holding time\n"
993 "Specify hello multiplier for level-2 IIHs\n")
994{
995 struct isis_circuit *circuit = isis_circuit_lookup (vty);
996 if (!circuit)
997 return CMD_ERR_NO_MATCH;
998
999 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
1000
1001 return CMD_SUCCESS;
1002}
1003
1004ALIAS (no_isis_hello_multiplier_l2,
1005 no_isis_hello_multiplier_l2_arg_cmd,
1006 "no isis hello-multiplier <2-100> level-2",
1007 NO_STR
1008 "IS-IS commands\n"
1009 "Set multiplier for Hello holding time\n"
1010 "Hello multiplier value\n"
1011 "Specify hello multiplier for level-2 IIHs\n")
1012
1013DEFUN (isis_hello_padding,
1014 isis_hello_padding_cmd,
1015 "isis hello padding",
1016 "IS-IS commands\n"
1017 "Add padding to IS-IS hello packets\n"
1018 "Pad hello packets\n"
1019 "<cr>\n")
1020{
1021 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1022 if (!circuit)
1023 return CMD_ERR_NO_MATCH;
1024
1025 circuit->pad_hellos = 1;
1026
1027 return CMD_SUCCESS;
1028}
1029
1030DEFUN (no_isis_hello_padding,
1031 no_isis_hello_padding_cmd,
1032 "no isis hello padding",
1033 NO_STR
1034 "IS-IS commands\n"
1035 "Add padding to IS-IS hello packets\n"
1036 "Pad hello packets\n"
1037 "<cr>\n")
1038{
1039 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1040 if (!circuit)
1041 return CMD_ERR_NO_MATCH;
1042
1043 circuit->pad_hellos = 0;
1044
1045 return CMD_SUCCESS;
1046}
1047
1048DEFUN (csnp_interval,
1049 csnp_interval_cmd,
1050 "isis csnp-interval <1-600>",
1051 "IS-IS commands\n"
1052 "Set CSNP interval in seconds\n"
1053 "CSNP interval value\n")
1054{
1055 unsigned long interval;
1056 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1057 if (!circuit)
1058 return CMD_ERR_NO_MATCH;
1059
1060 interval = atol (argv[0]);
1061 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
1062 {
1063 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
1064 interval, VTY_NEWLINE);
1065 return CMD_ERR_AMBIGUOUS;
1066 }
1067
1068 circuit->csnp_interval[0] = (u_int16_t) interval;
1069 circuit->csnp_interval[1] = (u_int16_t) interval;
1070
1071 return CMD_SUCCESS;
1072}
1073
1074DEFUN (no_csnp_interval,
1075 no_csnp_interval_cmd,
1076 "no isis csnp-interval",
1077 NO_STR
1078 "IS-IS commands\n"
1079 "Set CSNP interval in seconds\n")
1080{
1081 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1082 if (!circuit)
1083 return CMD_ERR_NO_MATCH;
1084
1085 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
1086 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
1087
1088 return CMD_SUCCESS;
1089}
1090
1091ALIAS (no_csnp_interval,
1092 no_csnp_interval_arg_cmd,
1093 "no isis csnp-interval <1-600>",
1094 NO_STR
1095 "IS-IS commands\n"
1096 "Set CSNP interval in seconds\n"
1097 "CSNP interval value\n")
1098
1099DEFUN (csnp_interval_l1,
1100 csnp_interval_l1_cmd,
1101 "isis csnp-interval <1-600> level-1",
1102 "IS-IS commands\n"
1103 "Set CSNP interval in seconds\n"
1104 "CSNP interval value\n"
1105 "Specify interval for level-1 CSNPs\n")
1106{
1107 unsigned long interval;
1108 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1109 if (!circuit)
1110 return CMD_ERR_NO_MATCH;
1111
1112 interval = atol (argv[0]);
1113 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
1114 {
1115 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
1116 interval, VTY_NEWLINE);
1117 return CMD_ERR_AMBIGUOUS;
1118 }
1119
1120 circuit->csnp_interval[0] = (u_int16_t) interval;
1121
1122 return CMD_SUCCESS;
1123}
1124
1125DEFUN (no_csnp_interval_l1,
1126 no_csnp_interval_l1_cmd,
1127 "no isis csnp-interval level-1",
1128 NO_STR
1129 "IS-IS commands\n"
1130 "Set CSNP interval in seconds\n"
1131 "Specify interval for level-1 CSNPs\n")
1132{
1133 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1134 if (!circuit)
1135 return CMD_ERR_NO_MATCH;
1136
1137 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
1138
1139 return CMD_SUCCESS;
1140}
1141
1142ALIAS (no_csnp_interval_l1,
1143 no_csnp_interval_l1_arg_cmd,
1144 "no isis csnp-interval <1-600> level-1",
1145 NO_STR
1146 "IS-IS commands\n"
1147 "Set CSNP interval in seconds\n"
1148 "CSNP interval value\n"
1149 "Specify interval for level-1 CSNPs\n")
1150
1151DEFUN (csnp_interval_l2,
1152 csnp_interval_l2_cmd,
1153 "isis csnp-interval <1-600> level-2",
1154 "IS-IS commands\n"
1155 "Set CSNP interval in seconds\n"
1156 "CSNP interval value\n"
1157 "Specify interval for level-2 CSNPs\n")
1158{
1159 unsigned long interval;
1160 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1161 if (!circuit)
1162 return CMD_ERR_NO_MATCH;
1163
1164 interval = atol (argv[0]);
1165 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
1166 {
1167 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
1168 interval, VTY_NEWLINE);
1169 return CMD_ERR_AMBIGUOUS;
1170 }
1171
1172 circuit->csnp_interval[1] = (u_int16_t) interval;
1173
1174 return CMD_SUCCESS;
1175}
1176
1177DEFUN (no_csnp_interval_l2,
1178 no_csnp_interval_l2_cmd,
1179 "no isis csnp-interval level-2",
1180 NO_STR
1181 "IS-IS commands\n"
1182 "Set CSNP interval in seconds\n"
1183 "Specify interval for level-2 CSNPs\n")
1184{
1185 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1186 if (!circuit)
1187 return CMD_ERR_NO_MATCH;
1188
1189 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
1190
1191 return CMD_SUCCESS;
1192}
1193
1194ALIAS (no_csnp_interval_l2,
1195 no_csnp_interval_l2_arg_cmd,
1196 "no isis csnp-interval <1-600> level-2",
1197 NO_STR
1198 "IS-IS commands\n"
1199 "Set CSNP interval in seconds\n"
1200 "CSNP interval value\n"
1201 "Specify interval for level-2 CSNPs\n")
1202
1203DEFUN (psnp_interval,
1204 psnp_interval_cmd,
1205 "isis psnp-interval <1-120>",
1206 "IS-IS commands\n"
1207 "Set PSNP interval in seconds\n"
1208 "PSNP interval value\n")
1209{
1210 unsigned long interval;
1211 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1212 if (!circuit)
1213 return CMD_ERR_NO_MATCH;
1214
1215 interval = atol (argv[0]);
1216 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
1217 {
1218 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
1219 interval, VTY_NEWLINE);
1220 return CMD_ERR_AMBIGUOUS;
1221 }
1222
1223 circuit->psnp_interval[0] = (u_int16_t) interval;
1224 circuit->psnp_interval[1] = (u_int16_t) interval;
1225
1226 return CMD_SUCCESS;
1227}
1228
1229DEFUN (no_psnp_interval,
1230 no_psnp_interval_cmd,
1231 "no isis psnp-interval",
1232 NO_STR
1233 "IS-IS commands\n"
1234 "Set PSNP interval in seconds\n")
1235{
1236 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1237 if (!circuit)
1238 return CMD_ERR_NO_MATCH;
1239
1240 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
1241 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
1242
1243 return CMD_SUCCESS;
1244}
1245
1246ALIAS (no_psnp_interval,
1247 no_psnp_interval_arg_cmd,
1248 "no isis psnp-interval <1-120>",
1249 NO_STR
1250 "IS-IS commands\n"
1251 "Set PSNP interval in seconds\n"
1252 "PSNP interval value\n")
1253
1254DEFUN (psnp_interval_l1,
1255 psnp_interval_l1_cmd,
1256 "isis psnp-interval <1-120> level-1",
1257 "IS-IS commands\n"
1258 "Set PSNP interval in seconds\n"
1259 "PSNP interval value\n"
1260 "Specify interval for level-1 PSNPs\n")
1261{
1262 unsigned long interval;
1263 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1264 if (!circuit)
1265 return CMD_ERR_NO_MATCH;
1266
1267 interval = atol (argv[0]);
1268 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
1269 {
1270 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
1271 interval, VTY_NEWLINE);
1272 return CMD_ERR_AMBIGUOUS;
1273 }
1274
1275 circuit->psnp_interval[0] = (u_int16_t) interval;
1276
1277 return CMD_SUCCESS;
1278}
1279
1280DEFUN (no_psnp_interval_l1,
1281 no_psnp_interval_l1_cmd,
1282 "no isis psnp-interval level-1",
1283 NO_STR
1284 "IS-IS commands\n"
1285 "Set PSNP interval in seconds\n"
1286 "Specify interval for level-1 PSNPs\n")
1287{
1288 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1289 if (!circuit)
1290 return CMD_ERR_NO_MATCH;
1291
1292 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
1293
1294 return CMD_SUCCESS;
1295}
1296
1297ALIAS (no_psnp_interval_l1,
1298 no_psnp_interval_l1_arg_cmd,
1299 "no isis psnp-interval <1-120> level-1",
1300 NO_STR
1301 "IS-IS commands\n"
1302 "Set PSNP interval in seconds\n"
1303 "PSNP interval value\n"
1304 "Specify interval for level-1 PSNPs\n")
1305
1306DEFUN (psnp_interval_l2,
1307 psnp_interval_l2_cmd,
1308 "isis psnp-interval <1-120> level-2",
1309 "IS-IS commands\n"
1310 "Set PSNP interval in seconds\n"
1311 "PSNP interval value\n"
1312 "Specify interval for level-2 PSNPs\n")
1313{
1314 unsigned long interval;
1315 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1316 if (!circuit)
1317 return CMD_ERR_NO_MATCH;
1318
1319 interval = atol (argv[0]);
1320 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
1321 {
1322 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
1323 interval, VTY_NEWLINE);
1324 return CMD_ERR_AMBIGUOUS;
1325 }
1326
1327 circuit->psnp_interval[1] = (u_int16_t) interval;
1328
1329 return CMD_SUCCESS;
1330}
1331
1332DEFUN (no_psnp_interval_l2,
1333 no_psnp_interval_l2_cmd,
1334 "no isis psnp-interval level-2",
1335 NO_STR
1336 "IS-IS commands\n"
1337 "Set PSNP interval in seconds\n"
1338 "Specify interval for level-2 PSNPs\n")
1339{
1340 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1341 if (!circuit)
1342 return CMD_ERR_NO_MATCH;
1343
1344 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
1345
1346 return CMD_SUCCESS;
1347}
1348
1349ALIAS (no_psnp_interval_l2,
1350 no_psnp_interval_l2_arg_cmd,
1351 "no isis psnp-interval <1-120> level-2",
1352 NO_STR
1353 "IS-IS commands\n"
1354 "Set PSNP interval in seconds\n"
1355 "PSNP interval value\n"
1356 "Specify interval for level-2 PSNPs\n")
1357
Christian Frankeccd485d2016-07-28 17:23:26 +02001358static int
1359validate_metric_style_narrow (struct vty *vty, struct isis_area *area)
1360{
1361 struct isis_circuit *circuit;
1362 struct listnode *node;
1363
1364 if (! vty)
1365 return CMD_ERR_AMBIGUOUS;
1366
1367 if (! area)
1368 {
1369 vty_out (vty, "ISIS area is invalid%s", VTY_NEWLINE);
1370 return CMD_ERR_AMBIGUOUS;
1371 }
1372
1373 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
1374 {
1375 if ((area->is_type & IS_LEVEL_1) &&
1376 (circuit->is_type & IS_LEVEL_1) &&
1377 (circuit->te_metric[0] > MAX_NARROW_LINK_METRIC))
1378 {
1379 vty_out (vty, "ISIS circuit %s metric is invalid%s",
1380 circuit->interface->name, VTY_NEWLINE);
1381 return CMD_ERR_AMBIGUOUS;
1382 }
1383 if ((area->is_type & IS_LEVEL_2) &&
1384 (circuit->is_type & IS_LEVEL_2) &&
1385 (circuit->te_metric[1] > MAX_NARROW_LINK_METRIC))
1386 {
1387 vty_out (vty, "ISIS circuit %s metric is invalid%s",
1388 circuit->interface->name, VTY_NEWLINE);
1389 return CMD_ERR_AMBIGUOUS;
1390 }
1391 }
1392
1393 return CMD_SUCCESS;
1394}
1395
1396DEFUN (metric_style,
1397 metric_style_cmd,
1398 "metric-style (narrow|transition|wide)",
1399 "Use old-style (ISO 10589) or new-style packet formats\n"
1400 "Use old style of TLVs with narrow metric\n"
1401 "Send and accept both styles of TLVs during transition\n"
1402 "Use new style of TLVs to carry wider metric\n")
1403{
1404 struct isis_area *area = vty->index;
1405 int ret;
1406
1407 assert(area);
1408
1409 if (strncmp (argv[0], "w", 1) == 0)
1410 {
1411 isis_area_metricstyle_set(area, false, true);
1412 return CMD_SUCCESS;
1413 }
1414
1415 ret = validate_metric_style_narrow (vty, area);
1416 if (ret != CMD_SUCCESS)
1417 return ret;
1418
1419 if (strncmp (argv[0], "t", 1) == 0)
1420 isis_area_metricstyle_set(area, true, true);
1421 else if (strncmp (argv[0], "n", 1) == 0)
1422 isis_area_metricstyle_set(area, true, false);
1423 return CMD_SUCCESS;
1424
1425 return CMD_SUCCESS;
1426}
1427
1428DEFUN (no_metric_style,
1429 no_metric_style_cmd,
1430 "no metric-style",
1431 NO_STR
1432 "Use old-style (ISO 10589) or new-style packet formats\n")
1433{
1434 struct isis_area *area = vty->index;
1435 int ret;
1436
1437 assert (area);
1438 ret = validate_metric_style_narrow (vty, area);
1439 if (ret != CMD_SUCCESS)
1440 return ret;
1441
1442 isis_area_metricstyle_set(area, true, false);
1443 return CMD_SUCCESS;
1444}
1445
1446DEFUN (set_overload_bit,
1447 set_overload_bit_cmd,
1448 "set-overload-bit",
1449 "Set overload bit to avoid any transit traffic\n"
1450 "Set overload bit\n")
1451{
1452 struct isis_area *area = vty->index;
1453 assert (area);
1454
1455 isis_area_overload_bit_set(area, true);
1456 return CMD_SUCCESS;
1457}
1458
1459DEFUN (no_set_overload_bit,
1460 no_set_overload_bit_cmd,
1461 "no set-overload-bit",
1462 "Reset overload bit to accept transit traffic\n"
1463 "Reset overload bit\n")
1464{
1465 struct isis_area *area = vty->index;
1466 assert (area);
1467
1468 isis_area_overload_bit_set(area, false);
1469 return CMD_SUCCESS;
1470}
1471
1472DEFUN (set_attached_bit,
1473 set_attached_bit_cmd,
1474 "set-attached-bit",
1475 "Set attached bit to identify as L1/L2 router for inter-area traffic\n"
1476 "Set attached bit\n")
1477{
1478 struct isis_area *area = vty->index;
1479 assert (area);
1480
1481 isis_area_attached_bit_set(area, true);
1482 return CMD_SUCCESS;
1483}
1484
1485DEFUN (no_set_attached_bit,
1486 no_set_attached_bit_cmd,
1487 "no set-attached-bit",
1488 "Reset attached bit\n")
1489{
1490 struct isis_area *area = vty->index;
1491 assert (area);
1492
1493 isis_area_attached_bit_set(area, false);
1494 return CMD_SUCCESS;
1495}
1496
1497DEFUN (dynamic_hostname,
1498 dynamic_hostname_cmd,
1499 "hostname dynamic",
1500 "Dynamic hostname for IS-IS\n"
1501 "Dynamic hostname\n")
1502{
1503 struct isis_area *area = vty->index;
1504 assert(area);
1505
1506 isis_area_dynhostname_set(area, true);
1507 return CMD_SUCCESS;
1508}
1509
1510DEFUN (no_dynamic_hostname,
1511 no_dynamic_hostname_cmd,
1512 "no hostname dynamic",
1513 NO_STR
1514 "Dynamic hostname for IS-IS\n"
1515 "Dynamic hostname\n")
1516{
1517 struct isis_area *area = vty->index;
1518 assert(area);
1519
1520 isis_area_dynhostname_set(area, false);
1521 return CMD_SUCCESS;
1522}
1523
Christian Franke304c7da2016-07-28 17:23:29 +02001524static int area_lsp_mtu_set(struct vty *vty, unsigned int lsp_mtu)
1525{
1526 struct isis_area *area = vty->index;
1527 struct listnode *node;
1528 struct isis_circuit *circuit;
1529
1530 if (!area)
1531 {
1532 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1533 return CMD_ERR_NO_MATCH;
1534 }
1535
1536 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit))
1537 {
1538 if(circuit->state != C_STATE_INIT && circuit->state != C_STATE_UP)
1539 continue;
1540 if(lsp_mtu > isis_circuit_pdu_size(circuit))
1541 {
1542 vty_out(vty, "ISIS area contains circuit %s, which has a maximum PDU size of %zu.%s",
1543 circuit->interface->name, isis_circuit_pdu_size(circuit),
1544 VTY_NEWLINE);
1545 return CMD_ERR_AMBIGUOUS;
1546 }
1547 }
1548
1549 isis_area_lsp_mtu_set(area, lsp_mtu);
1550 return CMD_SUCCESS;
1551}
1552
1553DEFUN (area_lsp_mtu,
1554 area_lsp_mtu_cmd,
1555 "lsp-mtu <128-4352>",
1556 "Configure the maximum size of generated LSPs\n"
1557 "Maximum size of generated LSPs\n")
1558{
1559 unsigned int lsp_mtu;
1560
1561 VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0], 128, 4352);
1562
1563 return area_lsp_mtu_set(vty, lsp_mtu);
1564}
1565
1566DEFUN(no_area_lsp_mtu,
1567 no_area_lsp_mtu_cmd,
1568 "no lsp-mtu",
1569 NO_STR
1570 "Configure the maximum size of generated LSPs\n")
1571{
1572 return area_lsp_mtu_set(vty, DEFAULT_LSP_MTU);
1573}
1574
1575ALIAS(no_area_lsp_mtu,
1576 no_area_lsp_mtu_arg_cmd,
1577 "no lsp-mtu <128-4352>",
1578 NO_STR
1579 "Configure the maximum size of generated LSPs\n"
1580 "Maximum size of generated LSPs\n");
1581
1582DEFUN (is_type,
1583 is_type_cmd,
1584 "is-type (level-1|level-1-2|level-2-only)",
1585 "IS Level for this routing process (OSI only)\n"
1586 "Act as a station router only\n"
1587 "Act as both a station router and an area router\n"
1588 "Act as an area router only\n")
1589{
1590 struct isis_area *area;
1591 int type;
1592
1593 area = vty->index;
1594
1595 if (!area)
1596 {
1597 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1598 return CMD_ERR_NO_MATCH;
1599 }
1600
1601 type = string2circuit_t (argv[0]);
1602 if (!type)
1603 {
1604 vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
1605 return CMD_SUCCESS;
1606 }
1607
1608 isis_area_is_type_set(area, type);
1609
1610 return CMD_SUCCESS;
1611}
1612
1613DEFUN (no_is_type,
1614 no_is_type_cmd,
1615 "no is-type (level-1|level-1-2|level-2-only)",
1616 NO_STR
1617 "IS Level for this routing process (OSI only)\n"
1618 "Act as a station router only\n"
1619 "Act as both a station router and an area router\n"
1620 "Act as an area router only\n")
1621{
1622 struct isis_area *area;
1623 int type;
1624
1625 area = vty->index;
1626 assert (area);
1627
1628 /*
1629 * Put the is-type back to defaults:
1630 * - level-1-2 on first area
1631 * - level-1 for the rest
1632 */
1633 if (listgetdata (listhead (isis->area_list)) == area)
1634 type = IS_LEVEL_1_AND_2;
1635 else
1636 type = IS_LEVEL_1;
1637
1638 isis_area_is_type_set(area, type);
1639
1640 return CMD_SUCCESS;
1641}
1642
Christian Franke4570ca42016-07-28 17:23:30 +02001643static int
1644set_lsp_gen_interval (struct vty *vty, struct isis_area *area,
1645 uint16_t interval, int level)
1646{
1647 int lvl;
1648
1649 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
1650 {
1651 if (!(lvl & level))
1652 continue;
1653
1654 if (interval >= area->lsp_refresh[lvl-1])
1655 {
1656 vty_out (vty, "LSP gen interval %us must be less than "
1657 "the LSP refresh interval %us%s",
1658 interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
1659 return CMD_ERR_AMBIGUOUS;
1660 }
1661 }
1662
1663 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
1664 {
1665 if (!(lvl & level))
1666 continue;
1667 area->lsp_gen_interval[lvl-1] = interval;
1668 }
1669
1670 return CMD_SUCCESS;
1671}
1672
1673DEFUN (lsp_gen_interval,
1674 lsp_gen_interval_cmd,
1675 "lsp-gen-interval <1-120>",
1676 "Minimum interval between regenerating same LSP\n"
1677 "Minimum interval in seconds\n")
1678{
1679 struct isis_area *area;
1680 uint16_t interval;
1681 int level;
1682
1683 area = vty->index;
1684 interval = atoi (argv[0]);
1685 level = IS_LEVEL_1 | IS_LEVEL_2;
1686 return set_lsp_gen_interval (vty, area, interval, level);
1687}
1688
1689DEFUN (no_lsp_gen_interval,
1690 no_lsp_gen_interval_cmd,
1691 "no lsp-gen-interval",
1692 NO_STR
1693 "Minimum interval between regenerating same LSP\n")
1694{
1695 struct isis_area *area;
1696 uint16_t interval;
1697 int level;
1698
1699 area = vty->index;
1700 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
1701 level = IS_LEVEL_1 | IS_LEVEL_2;
1702 return set_lsp_gen_interval (vty, area, interval, level);
1703}
1704
1705ALIAS (no_lsp_gen_interval,
1706 no_lsp_gen_interval_arg_cmd,
1707 "no lsp-gen-interval <1-120>",
1708 NO_STR
1709 "Minimum interval between regenerating same LSP\n"
1710 "Minimum interval in seconds\n")
1711
1712DEFUN (lsp_gen_interval_l1,
1713 lsp_gen_interval_l1_cmd,
1714 "lsp-gen-interval level-1 <1-120>",
1715 "Minimum interval between regenerating same LSP\n"
1716 "Set interval for level 1 only\n"
1717 "Minimum interval in seconds\n")
1718{
1719 struct isis_area *area;
1720 uint16_t interval;
1721 int level;
1722
1723 area = vty->index;
1724 interval = atoi (argv[0]);
1725 level = IS_LEVEL_1;
1726 return set_lsp_gen_interval (vty, area, interval, level);
1727}
1728
1729DEFUN (no_lsp_gen_interval_l1,
1730 no_lsp_gen_interval_l1_cmd,
1731 "no lsp-gen-interval level-1",
1732 NO_STR
1733 "Minimum interval between regenerating same LSP\n"
1734 "Set interval for level 1 only\n")
1735{
1736 struct isis_area *area;
1737 uint16_t interval;
1738 int level;
1739
1740 area = vty->index;
1741 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
1742 level = IS_LEVEL_1;
1743 return set_lsp_gen_interval (vty, area, interval, level);
1744}
1745
1746ALIAS (no_lsp_gen_interval_l1,
1747 no_lsp_gen_interval_l1_arg_cmd,
1748 "no lsp-gen-interval level-1 <1-120>",
1749 NO_STR
1750 "Minimum interval between regenerating same LSP\n"
1751 "Set interval for level 1 only\n"
1752 "Minimum interval in seconds\n")
1753
1754DEFUN (lsp_gen_interval_l2,
1755 lsp_gen_interval_l2_cmd,
1756 "lsp-gen-interval level-2 <1-120>",
1757 "Minimum interval between regenerating same LSP\n"
1758 "Set interval for level 2 only\n"
1759 "Minimum interval in seconds\n")
1760{
1761 struct isis_area *area;
1762 uint16_t interval;
1763 int level;
1764
1765 area = vty->index;
1766 interval = atoi (argv[0]);
1767 level = IS_LEVEL_2;
1768 return set_lsp_gen_interval (vty, area, interval, level);
1769}
1770
1771DEFUN (no_lsp_gen_interval_l2,
1772 no_lsp_gen_interval_l2_cmd,
1773 "no lsp-gen-interval level-2",
1774 NO_STR
1775 "Minimum interval between regenerating same LSP\n"
1776 "Set interval for level 2 only\n")
1777{
1778 struct isis_area *area;
1779 uint16_t interval;
1780 int level;
1781
1782 area = vty->index;
1783 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
1784 level = IS_LEVEL_2;
1785 return set_lsp_gen_interval (vty, area, interval, level);
1786}
1787
1788ALIAS (no_lsp_gen_interval_l2,
1789 no_lsp_gen_interval_l2_arg_cmd,
1790 "no lsp-gen-interval level-2 <1-120>",
1791 NO_STR
1792 "Minimum interval between regenerating same LSP\n"
1793 "Set interval for level 2 only\n"
1794 "Minimum interval in seconds\n")
1795
1796DEFUN (spf_interval,
1797 spf_interval_cmd,
1798 "spf-interval <1-120>",
1799 "Minimum interval between SPF calculations\n"
1800 "Minimum interval between consecutive SPFs in seconds\n")
1801{
1802 struct isis_area *area;
1803 u_int16_t interval;
1804
1805 area = vty->index;
1806 interval = atoi (argv[0]);
1807 area->min_spf_interval[0] = interval;
1808 area->min_spf_interval[1] = interval;
1809
1810 return CMD_SUCCESS;
1811}
1812
1813DEFUN (no_spf_interval,
1814 no_spf_interval_cmd,
1815 "no spf-interval",
1816 NO_STR
1817 "Minimum interval between SPF calculations\n")
1818{
1819 struct isis_area *area;
1820
1821 area = vty->index;
1822
1823 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
1824 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
1825
1826 return CMD_SUCCESS;
1827}
1828
1829ALIAS (no_spf_interval,
1830 no_spf_interval_arg_cmd,
1831 "no spf-interval <1-120>",
1832 NO_STR
1833 "Minimum interval between SPF calculations\n"
1834 "Minimum interval between consecutive SPFs in seconds\n")
1835
1836DEFUN (spf_interval_l1,
1837 spf_interval_l1_cmd,
1838 "spf-interval level-1 <1-120>",
1839 "Minimum interval between SPF calculations\n"
1840 "Set interval for level 1 only\n"
1841 "Minimum interval between consecutive SPFs in seconds\n")
1842{
1843 struct isis_area *area;
1844 u_int16_t interval;
1845
1846 area = vty->index;
1847 interval = atoi (argv[0]);
1848 area->min_spf_interval[0] = interval;
1849
1850 return CMD_SUCCESS;
1851}
1852
1853DEFUN (no_spf_interval_l1,
1854 no_spf_interval_l1_cmd,
1855 "no spf-interval level-1",
1856 NO_STR
1857 "Minimum interval between SPF calculations\n"
1858 "Set interval for level 1 only\n")
1859{
1860 struct isis_area *area;
1861
1862 area = vty->index;
1863
1864 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
1865
1866 return CMD_SUCCESS;
1867}
1868
1869ALIAS (no_spf_interval,
1870 no_spf_interval_l1_arg_cmd,
1871 "no spf-interval level-1 <1-120>",
1872 NO_STR
1873 "Minimum interval between SPF calculations\n"
1874 "Set interval for level 1 only\n"
1875 "Minimum interval between consecutive SPFs in seconds\n")
1876
1877DEFUN (spf_interval_l2,
1878 spf_interval_l2_cmd,
1879 "spf-interval level-2 <1-120>",
1880 "Minimum interval between SPF calculations\n"
1881 "Set interval for level 2 only\n"
1882 "Minimum interval between consecutive SPFs in seconds\n")
1883{
1884 struct isis_area *area;
1885 u_int16_t interval;
1886
1887 area = vty->index;
1888 interval = atoi (argv[0]);
1889 area->min_spf_interval[1] = interval;
1890
1891 return CMD_SUCCESS;
1892}
1893
1894DEFUN (no_spf_interval_l2,
1895 no_spf_interval_l2_cmd,
1896 "no spf-interval level-2",
1897 NO_STR
1898 "Minimum interval between SPF calculations\n"
1899 "Set interval for level 2 only\n")
1900{
1901 struct isis_area *area;
1902
1903 area = vty->index;
1904
1905 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
1906
1907 return CMD_SUCCESS;
1908}
1909
1910ALIAS (no_spf_interval,
1911 no_spf_interval_l2_arg_cmd,
1912 "no spf-interval level-2 <1-120>",
1913 NO_STR
1914 "Minimum interval between SPF calculations\n"
1915 "Set interval for level 2 only\n"
1916 "Minimum interval between consecutive SPFs in seconds\n")
1917
1918static int
1919area_max_lsp_lifetime_set(struct vty *vty, int level,
1920 uint16_t interval)
1921{
1922 struct isis_area *area = vty->index;
1923 int lvl;
1924 uint16_t refresh_interval = interval - 300;
1925 int set_refresh_interval[ISIS_LEVELS] = {0, 0};
1926
1927 if (!area)
1928 {
1929 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
1930 return CMD_ERR_NO_MATCH;
1931 }
1932
1933 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
1934 {
1935 if (!(lvl & level))
1936 continue;
1937
1938 if (refresh_interval < area->lsp_refresh[lvl-1])
1939 {
1940 vty_out (vty, "Level %d Max LSP lifetime %us must be 300s greater than "
1941 "the configured LSP refresh interval %us%s",
1942 lvl, interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
1943 vty_out (vty, "Automatically reducing level %d LSP refresh interval "
1944 "to %us%s", lvl, refresh_interval, VTY_NEWLINE);
1945 set_refresh_interval[lvl-1] = 1;
1946
1947 if (refresh_interval <= area->lsp_gen_interval[lvl-1])
1948 {
1949 vty_out (vty, "LSP refresh interval %us must be greater than "
1950 "the configured LSP gen interval %us%s",
1951 refresh_interval, area->lsp_gen_interval[lvl-1],
1952 VTY_NEWLINE);
1953 return CMD_ERR_AMBIGUOUS;
1954 }
1955 }
1956 }
1957
1958 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
1959 {
1960 if (!(lvl & level))
1961 continue;
1962 isis_area_max_lsp_lifetime_set(area, lvl, interval);
1963 if (set_refresh_interval[lvl-1])
1964 isis_area_lsp_refresh_set(area, lvl, refresh_interval);
1965 }
1966
1967 return CMD_SUCCESS;
1968}
1969
1970DEFUN (max_lsp_lifetime,
1971 max_lsp_lifetime_cmd,
1972 "max-lsp-lifetime <350-65535>",
1973 "Maximum LSP lifetime\n"
1974 "LSP lifetime in seconds\n")
1975{
1976 return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0]));
1977}
1978
1979DEFUN (no_max_lsp_lifetime,
1980 no_max_lsp_lifetime_cmd,
1981 "no max-lsp-lifetime",
1982 NO_STR
1983 "LSP lifetime in seconds\n")
1984{
1985 return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2,
1986 DEFAULT_LSP_LIFETIME);
1987}
1988
1989ALIAS (no_max_lsp_lifetime,
1990 no_max_lsp_lifetime_arg_cmd,
1991 "no max-lsp-lifetime <350-65535>",
1992 NO_STR
1993 "Maximum LSP lifetime\n"
1994 "LSP lifetime in seconds\n")
1995
1996DEFUN (max_lsp_lifetime_l1,
1997 max_lsp_lifetime_l1_cmd,
1998 "max-lsp-lifetime level-1 <350-65535>",
1999 "Maximum LSP lifetime for Level 1 only\n"
2000 "LSP lifetime for Level 1 only in seconds\n")
2001{
2002 return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[0]));
2003}
2004
2005DEFUN (no_max_lsp_lifetime_l1,
2006 no_max_lsp_lifetime_l1_cmd,
2007 "no max-lsp-lifetime level-1",
2008 NO_STR
2009 "LSP lifetime for Level 1 only in seconds\n")
2010{
2011 return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, DEFAULT_LSP_LIFETIME);
2012}
2013
2014ALIAS (no_max_lsp_lifetime_l1,
2015 no_max_lsp_lifetime_l1_arg_cmd,
2016 "no max-lsp-lifetime level-1 <350-65535>",
2017 NO_STR
2018 "Maximum LSP lifetime for Level 1 only\n"
2019 "LSP lifetime for Level 1 only in seconds\n")
2020
2021DEFUN (max_lsp_lifetime_l2,
2022 max_lsp_lifetime_l2_cmd,
2023 "max-lsp-lifetime level-2 <350-65535>",
2024 "Maximum LSP lifetime for Level 2 only\n"
2025 "LSP lifetime for Level 2 only in seconds\n")
2026{
2027 return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[0]));
2028}
2029
2030DEFUN (no_max_lsp_lifetime_l2,
2031 no_max_lsp_lifetime_l2_cmd,
2032 "no max-lsp-lifetime level-2",
2033 NO_STR
2034 "LSP lifetime for Level 2 only in seconds\n")
2035{
2036 return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, DEFAULT_LSP_LIFETIME);
2037}
2038
2039ALIAS (no_max_lsp_lifetime_l2,
2040 no_max_lsp_lifetime_l2_arg_cmd,
2041 "no max-lsp-lifetime level-2 <350-65535>",
2042 NO_STR
2043 "Maximum LSP lifetime for Level 2 only\n"
2044 "LSP lifetime for Level 2 only in seconds\n")
2045
2046static int
2047area_lsp_refresh_interval_set(struct vty *vty, int level, uint16_t interval)
2048{
2049 struct isis_area *area = vty->index;
2050 int lvl;
2051
2052 if (!area)
2053 {
2054 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
2055 return CMD_ERR_NO_MATCH;
2056 }
2057
2058 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2059 {
2060 if (!(lvl & level))
2061 continue;
2062 if (interval <= area->lsp_gen_interval[lvl-1])
2063 {
2064 vty_out (vty, "LSP refresh interval %us must be greater than "
2065 "the configured LSP gen interval %us%s",
2066 interval, area->lsp_gen_interval[lvl-1],
2067 VTY_NEWLINE);
2068 return CMD_ERR_AMBIGUOUS;
2069 }
2070 if (interval > (area->max_lsp_lifetime[lvl-1] - 300))
2071 {
2072 vty_out (vty, "LSP refresh interval %us must be less than "
2073 "the configured LSP lifetime %us less 300%s",
2074 interval, area->max_lsp_lifetime[lvl-1],
2075 VTY_NEWLINE);
2076 return CMD_ERR_AMBIGUOUS;
2077 }
2078 }
2079
2080 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2081 {
2082 if (!(lvl & level))
2083 continue;
2084 isis_area_lsp_refresh_set(area, lvl, interval);
2085 }
2086
2087 return CMD_SUCCESS;
2088}
2089
2090DEFUN (lsp_refresh_interval,
2091 lsp_refresh_interval_cmd,
2092 "lsp-refresh-interval <1-65235>",
2093 "LSP refresh interval\n"
2094 "LSP refresh interval in seconds\n")
2095{
2096 return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0]));
2097}
2098
2099DEFUN (no_lsp_refresh_interval,
2100 no_lsp_refresh_interval_cmd,
2101 "no lsp-refresh-interval",
2102 NO_STR
2103 "LSP refresh interval in seconds\n")
2104{
2105 return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2,
2106 DEFAULT_MAX_LSP_GEN_INTERVAL);
2107}
2108
2109ALIAS (no_lsp_refresh_interval,
2110 no_lsp_refresh_interval_arg_cmd,
2111 "no lsp-refresh-interval <1-65235>",
2112 NO_STR
2113 "LSP refresh interval\n"
2114 "LSP refresh interval in seconds\n")
2115
2116DEFUN (lsp_refresh_interval_l1,
2117 lsp_refresh_interval_l1_cmd,
2118 "lsp-refresh-interval level-1 <1-65235>",
2119 "LSP refresh interval for Level 1 only\n"
2120 "LSP refresh interval for Level 1 only in seconds\n")
2121{
2122 return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[0]));
2123}
2124
2125DEFUN (no_lsp_refresh_interval_l1,
2126 no_lsp_refresh_interval_l1_cmd,
2127 "no lsp-refresh-interval level-1",
2128 NO_STR
2129 "LSP refresh interval for Level 1 only in seconds\n")
2130{
2131 return area_lsp_refresh_interval_set(vty, IS_LEVEL_1,
2132 DEFAULT_MAX_LSP_GEN_INTERVAL);
2133}
2134
2135ALIAS (no_lsp_refresh_interval_l1,
2136 no_lsp_refresh_interval_l1_arg_cmd,
2137 "no lsp-refresh-interval level-1 <1-65235>",
2138 NO_STR
2139 "LSP refresh interval for Level 1 only\n"
2140 "LSP refresh interval for Level 1 only in seconds\n")
2141
2142DEFUN (lsp_refresh_interval_l2,
2143 lsp_refresh_interval_l2_cmd,
2144 "lsp-refresh-interval level-2 <1-65235>",
2145 "LSP refresh interval for Level 2 only\n"
2146 "LSP refresh interval for Level 2 only in seconds\n")
2147{
2148 return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[0]));
2149}
2150
2151DEFUN (no_lsp_refresh_interval_l2,
2152 no_lsp_refresh_interval_l2_cmd,
2153 "no lsp-refresh-interval level-2",
2154 NO_STR
2155 "LSP refresh interval for Level 2 only in seconds\n")
2156{
2157 return area_lsp_refresh_interval_set(vty, IS_LEVEL_2,
2158 DEFAULT_MAX_LSP_GEN_INTERVAL);
2159}
2160
2161ALIAS (no_lsp_refresh_interval_l2,
2162 no_lsp_refresh_interval_l2_arg_cmd,
2163 "no lsp-refresh-interval level-2 <1-65235>",
2164 NO_STR
2165 "LSP refresh interval for Level 2 only\n"
2166 "LSP refresh interval for Level 2 only in seconds\n")
2167
David Lamparter3732cba2016-07-29 16:19:40 +02002168void
2169isis_vty_init (void)
2170{
2171 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
2172 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
2173
2174 install_element (INTERFACE_NODE, &isis_passive_cmd);
2175 install_element (INTERFACE_NODE, &no_isis_passive_cmd);
2176
2177 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
2178 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
2179
2180 install_element (INTERFACE_NODE, &isis_network_cmd);
2181 install_element (INTERFACE_NODE, &no_isis_network_cmd);
2182
Christian Frankef5fbfb22016-07-28 17:23:27 +02002183 install_element (INTERFACE_NODE, &isis_passwd_cmd);
2184 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
2185 install_element (INTERFACE_NODE, &no_isis_passwd_arg_cmd);
2186
David Lamparter3732cba2016-07-29 16:19:40 +02002187 install_element (INTERFACE_NODE, &isis_priority_cmd);
2188 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
2189 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
2190 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
2191 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
2192 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
2193 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
2194 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
2195 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
2196
2197 install_element (INTERFACE_NODE, &isis_metric_cmd);
2198 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
2199 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
2200 install_element (INTERFACE_NODE, &isis_metric_l1_cmd);
2201 install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd);
2202 install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd);
2203 install_element (INTERFACE_NODE, &isis_metric_l2_cmd);
2204 install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd);
2205 install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd);
Christian Frankeccd485d2016-07-28 17:23:26 +02002206
David Lamparterb5d2f5f2016-07-28 17:23:28 +02002207 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
2208 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
2209 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
2210 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
2211 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
2212 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
2213 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
2214 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
2215 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
2216
2217 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
2218 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
2219 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
2220 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
2221 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
2222 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
2223 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
2224 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
2225 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
2226
2227 install_element (INTERFACE_NODE, &isis_hello_padding_cmd);
2228 install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd);
2229
2230 install_element (INTERFACE_NODE, &csnp_interval_cmd);
2231 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
2232 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
2233 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
2234 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
2235 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
2236 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
2237 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
2238 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
2239
2240 install_element (INTERFACE_NODE, &psnp_interval_cmd);
2241 install_element (INTERFACE_NODE, &no_psnp_interval_cmd);
2242 install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd);
2243 install_element (INTERFACE_NODE, &psnp_interval_l1_cmd);
2244 install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd);
2245 install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd);
2246 install_element (INTERFACE_NODE, &psnp_interval_l2_cmd);
2247 install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd);
2248 install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd);
2249
Christian Frankeccd485d2016-07-28 17:23:26 +02002250 install_element (ISIS_NODE, &metric_style_cmd);
2251 install_element (ISIS_NODE, &no_metric_style_cmd);
2252
2253 install_element (ISIS_NODE, &set_overload_bit_cmd);
2254 install_element (ISIS_NODE, &no_set_overload_bit_cmd);
2255
2256 install_element (ISIS_NODE, &set_attached_bit_cmd);
2257 install_element (ISIS_NODE, &no_set_attached_bit_cmd);
2258
2259 install_element (ISIS_NODE, &dynamic_hostname_cmd);
2260 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
Christian Franke304c7da2016-07-28 17:23:29 +02002261
2262 install_element (ISIS_NODE, &area_lsp_mtu_cmd);
2263 install_element (ISIS_NODE, &no_area_lsp_mtu_cmd);
2264 install_element (ISIS_NODE, &no_area_lsp_mtu_arg_cmd);
2265
2266 install_element (ISIS_NODE, &is_type_cmd);
2267 install_element (ISIS_NODE, &no_is_type_cmd);
Christian Franke4570ca42016-07-28 17:23:30 +02002268
2269 install_element (ISIS_NODE, &lsp_gen_interval_cmd);
2270 install_element (ISIS_NODE, &no_lsp_gen_interval_cmd);
2271 install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd);
2272 install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd);
2273 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd);
2274 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd);
2275 install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd);
2276 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd);
2277 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd);
2278
2279 install_element (ISIS_NODE, &spf_interval_cmd);
2280 install_element (ISIS_NODE, &no_spf_interval_cmd);
2281 install_element (ISIS_NODE, &no_spf_interval_arg_cmd);
2282 install_element (ISIS_NODE, &spf_interval_l1_cmd);
2283 install_element (ISIS_NODE, &no_spf_interval_l1_cmd);
2284 install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd);
2285 install_element (ISIS_NODE, &spf_interval_l2_cmd);
2286 install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
2287 install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
2288
2289 install_element (ISIS_NODE, &max_lsp_lifetime_cmd);
2290 install_element (ISIS_NODE, &no_max_lsp_lifetime_cmd);
2291 install_element (ISIS_NODE, &no_max_lsp_lifetime_arg_cmd);
2292 install_element (ISIS_NODE, &max_lsp_lifetime_l1_cmd);
2293 install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_cmd);
2294 install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_arg_cmd);
2295 install_element (ISIS_NODE, &max_lsp_lifetime_l2_cmd);
2296 install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_cmd);
2297 install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_arg_cmd);
2298
2299 install_element (ISIS_NODE, &lsp_refresh_interval_cmd);
2300 install_element (ISIS_NODE, &no_lsp_refresh_interval_cmd);
2301 install_element (ISIS_NODE, &no_lsp_refresh_interval_arg_cmd);
2302 install_element (ISIS_NODE, &lsp_refresh_interval_l1_cmd);
2303 install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_cmd);
2304 install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_arg_cmd);
2305 install_element (ISIS_NODE, &lsp_refresh_interval_l2_cmd);
2306 install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_cmd);
2307 install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_arg_cmd);
David Lamparter3732cba2016-07-29 16:19:40 +02002308}