2 * IS-IS Rout(e)ing protocol - isis_vty_fabricd.c
4 * This file contains the CLI that is specific to OpenFabric
6 * Copyright (C) 2018 Christian Franke, for NetDEF, Inc.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public Licenseas published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
13 * This program is distributed in the hope that it will be useful,but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #include "isisd/isisd.h"
27 #include "isisd/isis_vty_common.h"
28 #include "isisd/fabricd.h"
29 #include "isisd/isis_tlvs.h"
30 #include "isisd/isis_misc.h"
31 #include "isisd/isis_lsp.h"
32 #include "isisd/isis_csm.h"
33 #include "isisd/isis_circuit.h"
34 #include "lib/spf_backoff.h"
35 #include "isisd/isis_mt.h"
40 "Statically configure the tier to advertise\n"
41 "Tier to advertise\n")
43 VTY_DECLVAR_CONTEXT(isis_area
, area
);
45 uint8_t tier
= atoi(argv
[1]->arg
);
47 fabricd_configure_tier(area
, tier
);
51 DEFUN (no_fabric_tier
,
53 "no fabric-tier [(0-14)]",
55 "Statically configure the tier to advertise\n"
56 "Tier to advertise\n")
58 VTY_DECLVAR_CONTEXT(isis_area
, area
);
60 fabricd_configure_tier(area
, ISIS_TIER_UNDEFINED
);
64 DEFUN (triggered_csnp
,
66 "triggered-csnp-delay (100-10000) [always]",
67 "Configure the delay for triggered CSNPs\n"
68 "Delay in milliseconds\n"
69 "Trigger CSNP for all LSPs, not only circuit-scoped\n")
71 VTY_DECLVAR_CONTEXT(isis_area
, area
);
73 int csnp_delay
= atoi(argv
[1]->arg
);
74 bool always_send_csnp
= (argc
== 3);
76 fabricd_configure_triggered_csnp(area
, csnp_delay
, always_send_csnp
);
80 DEFUN (no_triggered_csnp
,
81 no_triggered_csnp_cmd
,
82 "no triggered-csnp-delay [(100-10000) [always]]",
84 "Configure the delay for triggered CSNPs\n"
85 "Delay in milliseconds\n"
86 "Trigger CSNP for all LSPs, not only circuit-scoped\n")
88 VTY_DECLVAR_CONTEXT(isis_area
, area
);
90 fabricd_configure_triggered_csnp(area
, FABRICD_DEFAULT_CSNP_DELAY
,
95 static void lsp_print_flooding(struct vty
*vty
, struct isis_lsp
*lsp
)
99 lspid_print(lsp
->hdr
.lsp_id
, lspid
, true, true);
100 vty_out(vty
, "Flooding information for %s\n", lspid
);
102 if (!lsp
->flooding_neighbors
[TX_LSP_NORMAL
]) {
103 vty_out(vty
, " Never received.\n");
107 vty_out(vty
, " Last received on: %s (",
108 lsp
->flooding_interface
?
109 lsp
->flooding_interface
: "(null)");
111 time_t uptime
= time(NULL
) - lsp
->flooding_time
;
112 struct tm
*tm
= gmtime(&uptime
);
114 if (uptime
< ONE_DAY_SECOND
)
115 vty_out(vty
, "%02d:%02d:%02d", tm
->tm_hour
, tm
->tm_min
,
117 else if (uptime
< ONE_WEEK_SECOND
)
118 vty_out(vty
, "%dd%02dh%02dm", tm
->tm_yday
, tm
->tm_hour
,
121 vty_out(vty
, "%02dw%dd%02dh", tm
->tm_yday
/ 7,
122 tm
->tm_yday
- ((tm
->tm_yday
/ 7) * 7),
124 vty_out(vty
, " ago)\n");
126 if (lsp
->flooding_circuit_scoped
) {
127 vty_out(vty
, " Received as circuit-scoped LSP, so not "
132 for (enum isis_tx_type type
= TX_LSP_NORMAL
;
133 type
<= TX_LSP_CIRCUIT_SCOPED
; type
++) {
134 struct listnode
*node
;
135 uint8_t *neighbor_id
;
137 vty_out(vty
, " %s:\n",
138 (type
== TX_LSP_NORMAL
) ? "RF" : "DNR");
139 for (ALL_LIST_ELEMENTS_RO(lsp
->flooding_neighbors
[type
],
140 node
, neighbor_id
)) {
141 vty_out(vty
, " %s\n",
142 print_sys_hostname(neighbor_id
));
147 DEFUN (show_lsp_flooding
,
148 show_lsp_flooding_cmd
,
149 "show openfabric flooding [WORD]",
152 "Flooding information\n"
155 const char *lspid
= NULL
;
158 lspid
= argv
[3]->arg
;
160 struct listnode
*node
;
161 struct isis_area
*area
;
163 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
164 struct lspdb_head
*head
= &area
->lspdb
[ISIS_LEVEL2
- 1];
165 struct isis_lsp
*lsp
;
167 vty_out(vty
, "Area %s:\n", area
->area_tag
?
168 area
->area_tag
: "null");
171 lsp
= lsp_for_arg(head
, lspid
);
174 lsp_print_flooding(vty
, lsp
);
179 frr_each (lspdb
, head
, lsp
) {
180 lsp_print_flooding(vty
, lsp
);
188 DEFUN (ip_router_isis
,
190 "ip router " PROTO_NAME
" WORD",
191 "Interface Internet Protocol config commands\n"
192 "IP router interface commands\n"
194 "Routing process tag\n")
198 VTY_DECLVAR_CONTEXT(interface
, ifp
);
199 struct isis_circuit
*circuit
;
200 struct isis_area
*area
;
201 const char *af
= argv
[idx_afi
]->arg
;
202 const char *area_tag
= argv
[idx_word
]->arg
;
204 /* Prevent more than one area per circuit */
205 circuit
= circuit_scan_by_ifp(ifp
);
206 if (circuit
&& circuit
->area
) {
207 if (strcmp(circuit
->area
->area_tag
, area_tag
)) {
208 vty_out(vty
, "ISIS circuit is already defined on %s\n",
209 circuit
->area
->area_tag
);
210 return CMD_ERR_NOTHING_TODO
;
214 area
= isis_area_lookup(area_tag
);
216 area
= isis_area_create(area_tag
);
218 if (!circuit
|| !circuit
->area
) {
219 circuit
= isis_circuit_create(area
, ifp
);
221 if (circuit
->state
!= C_STATE_CONF
222 && circuit
->state
!= C_STATE_UP
) {
224 "Couldn't bring up interface, please check log.\n");
225 return CMD_WARNING_CONFIG_FAILED
;
229 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
235 isis_circuit_af_set(circuit
, ip
, ipv6
);
239 DEFUN (ip6_router_isis
,
241 "ipv6 router " PROTO_NAME
" WORD",
242 "Interface Internet Protocol config commands\n"
243 "IP router interface commands\n"
245 "Routing process tag\n")
247 return ip_router_isis(self
, vty
, argc
, argv
);
250 DEFUN (no_ip_router_isis
,
251 no_ip_router_isis_cmd
,
252 "no <ip|ipv6> router " PROTO_NAME
" WORD",
254 "Interface Internet Protocol config commands\n"
255 "IP router interface commands\n"
256 "IP router interface commands\n"
258 "Routing process tag\n")
262 VTY_DECLVAR_CONTEXT(interface
, ifp
);
263 struct isis_area
*area
;
264 struct isis_circuit
*circuit
;
265 const char *af
= argv
[idx_afi
]->arg
;
266 const char *area_tag
= argv
[idx_word
]->arg
;
268 area
= isis_area_lookup(area_tag
);
270 vty_out(vty
, "Can't find ISIS instance %s\n",
272 return CMD_ERR_NO_MATCH
;
275 circuit
= circuit_lookup_by_ifp(ifp
, area
->circuit_list
);
277 vty_out(vty
, "ISIS is not enabled on circuit %s\n", ifp
->name
);
278 return CMD_ERR_NO_MATCH
;
281 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
287 isis_circuit_af_set(circuit
, ip
, ipv6
);
291 DEFUN (set_overload_bit
,
292 set_overload_bit_cmd
,
294 "Set overload bit to avoid any transit traffic\n")
296 VTY_DECLVAR_CONTEXT(isis_area
, area
);
298 isis_area_overload_bit_set(area
, true);
302 DEFUN (no_set_overload_bit
,
303 no_set_overload_bit_cmd
,
304 "no set-overload-bit",
305 "Reset overload bit to accept transit traffic\n"
306 "Reset overload bit\n")
308 VTY_DECLVAR_CONTEXT(isis_area
, area
);
310 isis_area_overload_bit_set(area
, false);
314 static int isis_vty_password_set(struct vty
*vty
, int argc
,
315 struct cmd_token
*argv
[], int level
)
317 VTY_DECLVAR_CONTEXT(isis_area
, area
);
320 int idx_password
= 2;
321 int idx_snp_auth
= 5;
322 uint8_t snp_auth
= 0;
324 const char *passwd
= argv
[idx_password
]->arg
;
325 if (strlen(passwd
) > 254) {
326 vty_out(vty
, "Too long area password (>254)\n");
327 return CMD_WARNING_CONFIG_FAILED
;
330 if (argc
> idx_snp_auth
) {
331 snp_auth
= SNP_AUTH_SEND
;
332 if (strmatch(argv
[idx_snp_auth
]->text
, "validate"))
333 snp_auth
|= SNP_AUTH_RECV
;
336 if (strmatch(argv
[idx_algo
]->text
, "clear")) {
337 return isis_area_passwd_cleartext_set(area
, level
,
339 } else if (strmatch(argv
[idx_algo
]->text
, "md5")) {
340 return isis_area_passwd_hmac_md5_set(area
, level
,
344 return CMD_WARNING_CONFIG_FAILED
;
347 DEFUN (domain_passwd
,
349 "domain-password <clear|md5> WORD [authenticate snp <send-only|validate>]",
350 "Set the authentication password for a routing domain\n"
351 "Authentication type\n"
352 "Authentication type\n"
353 "Level-wide password\n"
356 "Send but do not check PDUs on receiving\n"
357 "Send and check PDUs on receiving\n")
359 return isis_vty_password_set(vty
, argc
, argv
, IS_LEVEL_2
);
362 DEFUN (no_domain_passwd
,
363 no_domain_passwd_cmd
,
364 "no domain-password",
366 "Set the authentication password for a routing domain\n")
368 VTY_DECLVAR_CONTEXT(isis_area
, area
);
370 return isis_area_passwd_unset(area
, IS_LEVEL_2
);
374 isis_vty_lsp_gen_interval_set(struct vty
*vty
, int level
, uint16_t interval
)
376 VTY_DECLVAR_CONTEXT(isis_area
, area
);
379 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
383 if (interval
>= area
->lsp_refresh
[lvl
- 1]) {
385 "LSP gen interval %us must be less than "
386 "the LSP refresh interval %us\n",
387 interval
, area
->lsp_refresh
[lvl
- 1]);
388 return CMD_WARNING_CONFIG_FAILED
;
392 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
395 area
->lsp_gen_interval
[lvl
- 1] = interval
;
401 DEFUN (lsp_gen_interval
,
402 lsp_gen_interval_cmd
,
403 "lsp-gen-interval (1-120)",
404 "Minimum interval between regenerating same LSP\n"
405 "Minimum interval in seconds\n")
407 uint16_t interval
= atoi(argv
[1]->arg
);
409 return isis_vty_lsp_gen_interval_set(vty
, IS_LEVEL_1_AND_2
, interval
);
412 DEFUN (no_lsp_gen_interval
,
413 no_lsp_gen_interval_cmd
,
414 "no lsp-gen-interval [(1-120)]",
416 "Minimum interval between regenerating same LSP\n"
417 "Minimum interval in seconds\n")
419 VTY_DECLVAR_CONTEXT(isis_area
, area
);
421 return isis_vty_lsp_gen_interval_set(vty
, IS_LEVEL_1_AND_2
,
422 DEFAULT_MIN_LSP_GEN_INTERVAL
);
426 isis_vty_lsp_refresh_set(struct vty
*vty
, int level
, uint16_t interval
)
428 VTY_DECLVAR_CONTEXT(isis_area
, area
);
431 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
434 if (interval
<= area
->lsp_gen_interval
[lvl
- 1]) {
436 "LSP refresh interval %us must be greater than "
437 "the configured LSP gen interval %us\n",
438 interval
, area
->lsp_gen_interval
[lvl
- 1]);
439 return CMD_WARNING_CONFIG_FAILED
;
441 if (interval
> (area
->max_lsp_lifetime
[lvl
- 1] - 300)) {
443 "LSP refresh interval %us must be less than "
444 "the configured LSP lifetime %us less 300\n",
445 interval
, area
->max_lsp_lifetime
[lvl
- 1]);
446 return CMD_WARNING_CONFIG_FAILED
;
450 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
453 isis_area_lsp_refresh_set(area
, lvl
, interval
);
459 DEFUN (lsp_refresh_interval
,
460 lsp_refresh_interval_cmd
,
461 "lsp-refresh-interval (1-65235)",
462 "LSP refresh interval\n"
463 "LSP refresh interval in seconds\n")
465 unsigned int interval
= atoi(argv
[1]->arg
);
466 return isis_vty_lsp_refresh_set(vty
, IS_LEVEL_1_AND_2
, interval
);
469 DEFUN (no_lsp_refresh_interval
,
470 no_lsp_refresh_interval_cmd
,
471 "no lsp-refresh-interval [(1-65235)]",
473 "LSP refresh interval\n"
474 "LSP refresh interval in seconds\n")
476 return isis_vty_lsp_refresh_set(vty
, IS_LEVEL_1_AND_2
,
477 DEFAULT_MAX_LSP_GEN_INTERVAL
);
481 isis_vty_max_lsp_lifetime_set(struct vty
*vty
, int level
, uint16_t interval
)
483 VTY_DECLVAR_CONTEXT(isis_area
, area
);
485 uint16_t refresh_interval
= interval
- 300;
486 int set_refresh_interval
[ISIS_LEVELS
] = {0, 0};
488 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++) {
492 if (refresh_interval
< area
->lsp_refresh
[lvl
- 1]) {
494 "Level %d Max LSP lifetime %us must be 300s greater than "
495 "the configured LSP refresh interval %us\n",
496 lvl
, interval
, area
->lsp_refresh
[lvl
- 1]);
498 "Automatically reducing level %d LSP refresh interval "
500 lvl
, refresh_interval
);
501 set_refresh_interval
[lvl
- 1] = 1;
504 <= area
->lsp_gen_interval
[lvl
- 1]) {
506 "LSP refresh interval %us must be greater than "
507 "the configured LSP gen interval %us\n",
509 area
->lsp_gen_interval
[lvl
- 1]);
510 return CMD_WARNING_CONFIG_FAILED
;
515 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++) {
518 isis_area_max_lsp_lifetime_set(area
, lvl
, interval
);
519 if (set_refresh_interval
[lvl
- 1])
520 isis_area_lsp_refresh_set(area
, lvl
, refresh_interval
);
526 DEFUN (max_lsp_lifetime
,
527 max_lsp_lifetime_cmd
,
528 "max-lsp-lifetime (350-65535)",
529 "Maximum LSP lifetime\n"
530 "LSP lifetime in seconds\n")
532 int lifetime
= atoi(argv
[1]->arg
);
534 return isis_vty_max_lsp_lifetime_set(vty
, IS_LEVEL_1_AND_2
, lifetime
);
538 DEFUN (no_max_lsp_lifetime
,
539 no_max_lsp_lifetime_cmd
,
540 "no max-lsp-lifetime [(350-65535)]",
542 "Maximum LSP lifetime\n"
543 "LSP lifetime in seconds\n")
545 return isis_vty_max_lsp_lifetime_set(vty
, IS_LEVEL_1_AND_2
,
546 DEFAULT_LSP_LIFETIME
);
551 "spf-interval (1-120)",
552 "Minimum interval between SPF calculations\n"
553 "Minimum interval between consecutive SPFs in seconds\n")
555 VTY_DECLVAR_CONTEXT(isis_area
, area
);
556 uint16_t interval
= atoi(argv
[1]->arg
);
558 area
->min_spf_interval
[0] = interval
;
559 area
->min_spf_interval
[1] = interval
;
564 DEFUN (no_spf_interval
,
566 "no spf-interval [(1-120)]",
568 "Minimum interval between SPF calculations\n"
569 "Minimum interval between consecutive SPFs in seconds\n")
571 VTY_DECLVAR_CONTEXT(isis_area
, area
);
573 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
574 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
579 static int isis_vty_lsp_mtu_set(struct vty
*vty
, unsigned int lsp_mtu
)
581 VTY_DECLVAR_CONTEXT(isis_area
, area
);
582 struct listnode
*node
;
583 struct isis_circuit
*circuit
;
585 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
)) {
586 if (circuit
->state
!= C_STATE_INIT
587 && circuit
->state
!= C_STATE_UP
)
589 if (lsp_mtu
> isis_circuit_pdu_size(circuit
)) {
591 "ISIS area contains circuit %s, which has a maximum PDU size of %zu.\n",
592 circuit
->interface
->name
,
593 isis_circuit_pdu_size(circuit
));
594 return CMD_WARNING_CONFIG_FAILED
;
598 isis_area_lsp_mtu_set(area
, lsp_mtu
);
604 "lsp-mtu (128-4352)",
605 "Configure the maximum size of generated LSPs\n"
606 "Maximum size of generated LSPs\n")
609 unsigned int lsp_mtu
;
611 lsp_mtu
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
613 return isis_vty_lsp_mtu_set(vty
, lsp_mtu
);
616 DEFUN (no_area_lsp_mtu
,
618 "no lsp-mtu [(128-4352)]",
620 "Configure the maximum size of generated LSPs\n"
621 "Maximum size of generated LSPs\n")
623 return isis_vty_lsp_mtu_set(vty
, DEFAULT_LSP_MTU
);
626 DEFUN (no_spf_delay_ietf
,
627 no_spf_delay_ietf_cmd
,
630 "IETF SPF delay algorithm\n")
632 VTY_DECLVAR_CONTEXT(isis_area
, area
);
634 spf_backoff_free(area
->spf_delay_ietf
[0]);
635 spf_backoff_free(area
->spf_delay_ietf
[1]);
636 area
->spf_delay_ietf
[0] = NULL
;
637 area
->spf_delay_ietf
[1] = NULL
;
642 DEFUN (spf_delay_ietf
,
644 "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)",
645 "IETF SPF delay algorithm\n"
646 "Delay used while in QUIET state\n"
647 "Delay used while in QUIET state in milliseconds\n"
648 "Delay used while in SHORT_WAIT state\n"
649 "Delay used while in SHORT_WAIT state in milliseconds\n"
650 "Delay used while in LONG_WAIT\n"
651 "Delay used while in LONG_WAIT state in milliseconds\n"
652 "Time with no received IGP events before considering IGP stable\n"
653 "Time with no received IGP events before considering IGP stable (in milliseconds)\n"
654 "Maximum duration needed to learn all the events related to a single failure\n"
655 "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n")
657 VTY_DECLVAR_CONTEXT(isis_area
, area
);
659 long init_delay
= atol(argv
[2]->arg
);
660 long short_delay
= atol(argv
[4]->arg
);
661 long long_delay
= atol(argv
[6]->arg
);
662 long holddown
= atol(argv
[8]->arg
);
663 long timetolearn
= atol(argv
[10]->arg
);
665 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
666 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
668 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
669 spf_backoff_free(area
->spf_delay_ietf
[0]);
670 area
->spf_delay_ietf
[0] =
671 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
672 long_delay
, holddown
, timetolearn
);
674 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
675 spf_backoff_free(area
->spf_delay_ietf
[1]);
676 area
->spf_delay_ietf
[1] =
677 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
678 long_delay
, holddown
, timetolearn
);
680 XFREE(MTYPE_TMP
, buf
);
684 DEFUN (area_purge_originator
,
685 area_purge_originator_cmd
,
686 "[no] purge-originator",
688 "Use the RFC 6232 purge-originator\n")
690 VTY_DECLVAR_CONTEXT(isis_area
, area
);
692 area
->purge_originator
= !!strcmp(argv
[0]->text
, "no");
698 PROTO_NAME
" passive",
700 "Configure the passive mode for interface\n")
702 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
704 return CMD_ERR_NO_MATCH
;
706 CMD_FERR_RETURN(isis_circuit_passive_set(circuit
, 1),
707 "Cannot set passive: $ERR");
711 DEFUN (no_isis_passive
,
713 "no " PROTO_NAME
" passive",
716 "Configure the passive mode for interface\n")
718 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
720 return CMD_ERR_NO_MATCH
;
722 CMD_FERR_RETURN(isis_circuit_passive_set(circuit
, 0),
723 "Cannot set no passive: $ERR");
729 PROTO_NAME
" password <md5|clear> WORD",
731 "Configure the authentication password for a circuit\n"
732 "HMAC-MD5 authentication\n"
733 "Cleartext password\n"
734 "Circuit password\n")
736 int idx_encryption
= 2;
738 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
742 return CMD_ERR_NO_MATCH
;
744 if (argv
[idx_encryption
]->arg
[0] == 'm')
745 rv
= isis_circuit_passwd_hmac_md5_set(circuit
,
746 argv
[idx_word
]->arg
);
748 rv
= isis_circuit_passwd_cleartext_set(circuit
,
749 argv
[idx_word
]->arg
);
751 CMD_FERR_RETURN(rv
, "Failed to set circuit password: $ERR");
755 DEFUN (no_isis_passwd
,
757 "no " PROTO_NAME
" password [<md5|clear> WORD]",
760 "Configure the authentication password for a circuit\n"
761 "HMAC-MD5 authentication\n"
762 "Cleartext password\n"
763 "Circuit password\n")
765 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
767 return CMD_ERR_NO_MATCH
;
769 CMD_FERR_RETURN(isis_circuit_passwd_unset(circuit
),
770 "Failed to unset circuit password: $ERR");
776 PROTO_NAME
" metric (0-16777215)",
778 "Set default metric for circuit\n"
779 "Default metric value\n")
783 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
785 return CMD_ERR_NO_MATCH
;
787 met
= atoi(argv
[idx_number
]->arg
);
789 /* RFC3787 section 5.1 */
790 if (circuit
->area
&& circuit
->area
->oldmetric
== 1
791 && met
> MAX_NARROW_LINK_METRIC
) {
793 "Invalid metric %d - should be <0-63> "
794 "when narrow metric type enabled\n",
796 return CMD_WARNING_CONFIG_FAILED
;
800 if (circuit
->area
&& circuit
->area
->newmetric
== 1
801 && met
> MAX_WIDE_LINK_METRIC
) {
803 "Invalid metric %d - should be <0-16777215> "
804 "when wide metric type enabled\n",
806 return CMD_WARNING_CONFIG_FAILED
;
809 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_1
, met
),
810 "Failed to set L1 metric: $ERR");
811 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_2
, met
),
812 "Failed to set L2 metric: $ERR");
816 DEFUN (no_isis_metric
,
818 "no " PROTO_NAME
" metric [(0-16777215)]",
821 "Set default metric for circuit\n"
822 "Default metric value\n")
824 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
826 return CMD_ERR_NO_MATCH
;
828 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_1
,
829 DEFAULT_CIRCUIT_METRIC
),
830 "Failed to set L1 metric: $ERR");
831 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_2
,
832 DEFAULT_CIRCUIT_METRIC
),
833 "Failed to set L2 metric: $ERR");
837 DEFUN (isis_hello_interval
,
838 isis_hello_interval_cmd
,
839 PROTO_NAME
" hello-interval (1-600)",
841 "Set Hello interval\n"
842 "Holdtime 1 seconds, interval depends on multiplier\n")
844 uint32_t interval
= atoi(argv
[2]->arg
);
845 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
847 return CMD_ERR_NO_MATCH
;
849 circuit
->hello_interval
[0] = interval
;
850 circuit
->hello_interval
[1] = interval
;
855 DEFUN (no_isis_hello_interval
,
856 no_isis_hello_interval_cmd
,
857 "no " PROTO_NAME
" hello-interval [(1-600)]",
860 "Set Hello interval\n"
861 "Holdtime 1 second, interval depends on multiplier\n")
863 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
865 return CMD_ERR_NO_MATCH
;
867 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
868 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
873 DEFUN (isis_hello_multiplier
,
874 isis_hello_multiplier_cmd
,
875 PROTO_NAME
" hello-multiplier (2-100)",
877 "Set multiplier for Hello holding time\n"
878 "Hello multiplier value\n")
880 uint16_t mult
= atoi(argv
[2]->arg
);
881 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
883 return CMD_ERR_NO_MATCH
;
885 circuit
->hello_multiplier
[0] = mult
;
886 circuit
->hello_multiplier
[1] = mult
;
891 DEFUN (no_isis_hello_multiplier
,
892 no_isis_hello_multiplier_cmd
,
893 "no " PROTO_NAME
" hello-multiplier [(2-100)]",
896 "Set multiplier for Hello holding time\n"
897 "Hello multiplier value\n")
899 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
901 return CMD_ERR_NO_MATCH
;
903 circuit
->hello_multiplier
[0] = DEFAULT_HELLO_MULTIPLIER
;
904 circuit
->hello_multiplier
[1] = DEFAULT_HELLO_MULTIPLIER
;
909 DEFUN (csnp_interval
,
911 PROTO_NAME
" csnp-interval (1-600)",
913 "Set CSNP interval in seconds\n"
914 "CSNP interval value\n")
916 uint16_t interval
= atoi(argv
[2]->arg
);
917 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
919 return CMD_ERR_NO_MATCH
;
921 circuit
->csnp_interval
[0] = interval
;
922 circuit
->csnp_interval
[1] = interval
;
927 DEFUN (no_csnp_interval
,
928 no_csnp_interval_cmd
,
929 "no " PROTO_NAME
" csnp-interval [(1-600)]",
932 "Set CSNP interval in seconds\n"
933 "CSNP interval value\n")
935 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
937 return CMD_ERR_NO_MATCH
;
939 circuit
->csnp_interval
[0] = DEFAULT_CSNP_INTERVAL
;
940 circuit
->csnp_interval
[1] = DEFAULT_CSNP_INTERVAL
;
945 DEFUN (psnp_interval
,
947 PROTO_NAME
" psnp-interval (1-120)",
949 "Set PSNP interval in seconds\n"
950 "PSNP interval value\n")
952 uint16_t interval
= atoi(argv
[2]->arg
);
953 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
955 return CMD_ERR_NO_MATCH
;
957 circuit
->psnp_interval
[0] = interval
;
958 circuit
->psnp_interval
[1] = interval
;
963 DEFUN (no_psnp_interval
,
964 no_psnp_interval_cmd
,
965 "no " PROTO_NAME
" psnp-interval [(1-120)]",
968 "Set PSNP interval in seconds\n"
969 "PSNP interval value\n")
971 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
973 return CMD_ERR_NO_MATCH
;
975 circuit
->psnp_interval
[0] = DEFAULT_PSNP_INTERVAL
;
976 circuit
->psnp_interval
[1] = DEFAULT_PSNP_INTERVAL
;
981 DEFUN (circuit_topology
,
982 circuit_topology_cmd
,
983 PROTO_NAME
" topology " ISIS_MT_NAMES
,
985 "Configure interface IS-IS topologies\n"
986 ISIS_MT_DESCRIPTIONS
)
988 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
990 return CMD_ERR_NO_MATCH
;
991 const char *arg
= argv
[2]->arg
;
992 uint16_t mtid
= isis_str2mtid(arg
);
994 if (circuit
->area
&& circuit
->area
->oldmetric
) {
996 "Multi topology IS-IS can only be used with wide metrics\n");
997 return CMD_WARNING_CONFIG_FAILED
;
1000 if (mtid
== (uint16_t)-1) {
1001 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1002 return CMD_WARNING_CONFIG_FAILED
;
1005 return isis_circuit_mt_enabled_set(circuit
, mtid
, true);
1008 DEFUN (no_circuit_topology
,
1009 no_circuit_topology_cmd
,
1010 "no " PROTO_NAME
" topology " ISIS_MT_NAMES
,
1013 "Configure interface IS-IS topologies\n"
1014 ISIS_MT_DESCRIPTIONS
)
1016 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
1018 return CMD_ERR_NO_MATCH
;
1019 const char *arg
= argv
[3]->arg
;
1020 uint16_t mtid
= isis_str2mtid(arg
);
1022 if (circuit
->area
&& circuit
->area
->oldmetric
) {
1024 "Multi topology IS-IS can only be used with wide metrics\n");
1025 return CMD_WARNING_CONFIG_FAILED
;
1028 if (mtid
== (uint16_t)-1) {
1029 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1030 return CMD_WARNING_CONFIG_FAILED
;
1033 return isis_circuit_mt_enabled_set(circuit
, mtid
, false);
1036 void isis_vty_daemon_init(void)
1038 install_element(ROUTER_NODE
, &fabric_tier_cmd
);
1039 install_element(ROUTER_NODE
, &no_fabric_tier_cmd
);
1040 install_element(ROUTER_NODE
, &triggered_csnp_cmd
);
1041 install_element(ROUTER_NODE
, &no_triggered_csnp_cmd
);
1043 install_element(ENABLE_NODE
, &show_lsp_flooding_cmd
);
1045 install_element(INTERFACE_NODE
, &ip_router_isis_cmd
);
1046 install_element(INTERFACE_NODE
, &ip6_router_isis_cmd
);
1047 install_element(INTERFACE_NODE
, &no_ip_router_isis_cmd
);
1049 install_element(ROUTER_NODE
, &set_overload_bit_cmd
);
1050 install_element(ROUTER_NODE
, &no_set_overload_bit_cmd
);
1052 install_element(ROUTER_NODE
, &domain_passwd_cmd
);
1053 install_element(ROUTER_NODE
, &no_domain_passwd_cmd
);
1055 install_element(ROUTER_NODE
, &lsp_gen_interval_cmd
);
1056 install_element(ROUTER_NODE
, &no_lsp_gen_interval_cmd
);
1058 install_element(ROUTER_NODE
, &lsp_refresh_interval_cmd
);
1059 install_element(ROUTER_NODE
, &no_lsp_refresh_interval_cmd
);
1061 install_element(ROUTER_NODE
, &max_lsp_lifetime_cmd
);
1062 install_element(ROUTER_NODE
, &no_max_lsp_lifetime_cmd
);
1064 install_element(ROUTER_NODE
, &area_lsp_mtu_cmd
);
1065 install_element(ROUTER_NODE
, &no_area_lsp_mtu_cmd
);
1067 install_element(ROUTER_NODE
, &spf_interval_cmd
);
1068 install_element(ROUTER_NODE
, &no_spf_interval_cmd
);
1070 install_element(ROUTER_NODE
, &spf_delay_ietf_cmd
);
1071 install_element(ROUTER_NODE
, &no_spf_delay_ietf_cmd
);
1073 install_element(ROUTER_NODE
, &area_purge_originator_cmd
);
1075 install_element(INTERFACE_NODE
, &isis_passive_cmd
);
1076 install_element(INTERFACE_NODE
, &no_isis_passive_cmd
);
1078 install_element(INTERFACE_NODE
, &isis_passwd_cmd
);
1079 install_element(INTERFACE_NODE
, &no_isis_passwd_cmd
);
1081 install_element(INTERFACE_NODE
, &isis_metric_cmd
);
1082 install_element(INTERFACE_NODE
, &no_isis_metric_cmd
);
1084 install_element(INTERFACE_NODE
, &isis_hello_interval_cmd
);
1085 install_element(INTERFACE_NODE
, &no_isis_hello_interval_cmd
);
1087 install_element(INTERFACE_NODE
, &isis_hello_multiplier_cmd
);
1088 install_element(INTERFACE_NODE
, &no_isis_hello_multiplier_cmd
);
1090 install_element(INTERFACE_NODE
, &csnp_interval_cmd
);
1091 install_element(INTERFACE_NODE
, &no_csnp_interval_cmd
);
1093 install_element(INTERFACE_NODE
, &psnp_interval_cmd
);
1094 install_element(INTERFACE_NODE
, &no_psnp_interval_cmd
);
1096 install_element(INTERFACE_NODE
, &circuit_topology_cmd
);
1097 install_element(INTERFACE_NODE
, &no_circuit_topology_cmd
);