blob: 3dd3682ced805eed46384e20d27b6a30519eff75 [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
David Lamparter3732cba2016-07-29 16:19:40 +02001524void
1525isis_vty_init (void)
1526{
1527 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
1528 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
1529
1530 install_element (INTERFACE_NODE, &isis_passive_cmd);
1531 install_element (INTERFACE_NODE, &no_isis_passive_cmd);
1532
1533 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
1534 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
1535
1536 install_element (INTERFACE_NODE, &isis_network_cmd);
1537 install_element (INTERFACE_NODE, &no_isis_network_cmd);
1538
Christian Frankef5fbfb22016-07-28 17:23:27 +02001539 install_element (INTERFACE_NODE, &isis_passwd_cmd);
1540 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
1541 install_element (INTERFACE_NODE, &no_isis_passwd_arg_cmd);
1542
David Lamparter3732cba2016-07-29 16:19:40 +02001543 install_element (INTERFACE_NODE, &isis_priority_cmd);
1544 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
1545 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
1546 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
1547 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
1548 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
1549 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
1550 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
1551 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
1552
1553 install_element (INTERFACE_NODE, &isis_metric_cmd);
1554 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
1555 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
1556 install_element (INTERFACE_NODE, &isis_metric_l1_cmd);
1557 install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd);
1558 install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd);
1559 install_element (INTERFACE_NODE, &isis_metric_l2_cmd);
1560 install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd);
1561 install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd);
Christian Frankeccd485d2016-07-28 17:23:26 +02001562
David Lamparterb5d2f5f2016-07-28 17:23:28 +02001563 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
1564 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
1565 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
1566 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
1567 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
1568 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
1569 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
1570 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
1571 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
1572
1573 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
1574 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
1575 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
1576 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
1577 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
1578 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
1579 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
1580 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
1581 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
1582
1583 install_element (INTERFACE_NODE, &isis_hello_padding_cmd);
1584 install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd);
1585
1586 install_element (INTERFACE_NODE, &csnp_interval_cmd);
1587 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
1588 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
1589 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
1590 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
1591 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
1592 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
1593 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
1594 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
1595
1596 install_element (INTERFACE_NODE, &psnp_interval_cmd);
1597 install_element (INTERFACE_NODE, &no_psnp_interval_cmd);
1598 install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd);
1599 install_element (INTERFACE_NODE, &psnp_interval_l1_cmd);
1600 install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd);
1601 install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd);
1602 install_element (INTERFACE_NODE, &psnp_interval_l2_cmd);
1603 install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd);
1604 install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd);
1605
Christian Frankeccd485d2016-07-28 17:23:26 +02001606 install_element (ISIS_NODE, &metric_style_cmd);
1607 install_element (ISIS_NODE, &no_metric_style_cmd);
1608
1609 install_element (ISIS_NODE, &set_overload_bit_cmd);
1610 install_element (ISIS_NODE, &no_set_overload_bit_cmd);
1611
1612 install_element (ISIS_NODE, &set_attached_bit_cmd);
1613 install_element (ISIS_NODE, &no_set_attached_bit_cmd);
1614
1615 install_element (ISIS_NODE, &dynamic_hostname_cmd);
1616 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
David Lamparter3732cba2016-07-29 16:19:40 +02001617}