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