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
27 #include "isisd/isis_bfd.h"
28 #include "isisd/isisd.h"
29 #include "isisd/fabricd.h"
30 #include "isisd/isis_tlvs.h"
31 #include "isisd/isis_misc.h"
32 #include "isisd/isis_lsp.h"
33 #include "isisd/isis_csm.h"
34 #include "isisd/isis_circuit.h"
35 #include "lib/spf_backoff.h"
36 #include "isisd/isis_mt.h"
38 static struct isis_circuit
*isis_circuit_lookup(struct vty
*vty
)
40 struct interface
*ifp
= VTY_GET_CONTEXT(interface
);
41 struct isis_circuit
*circuit
;
44 vty_out(vty
, "Invalid interface \n");
48 circuit
= circuit_scan_by_ifp(ifp
);
50 vty_out(vty
, "ISIS is not enabled on circuit %s\n", ifp
->name
);
60 "Statically configure the tier to advertise\n"
61 "Tier to advertise\n")
63 VTY_DECLVAR_CONTEXT(isis_area
, area
);
65 uint8_t tier
= atoi(argv
[1]->arg
);
67 fabricd_configure_tier(area
, tier
);
71 DEFUN (no_fabric_tier
,
73 "no fabric-tier [(0-14)]",
75 "Statically configure the tier to advertise\n"
76 "Tier to advertise\n")
78 VTY_DECLVAR_CONTEXT(isis_area
, area
);
80 fabricd_configure_tier(area
, ISIS_TIER_UNDEFINED
);
84 DEFUN (triggered_csnp
,
86 "triggered-csnp-delay (100-10000) [always]",
87 "Configure the delay for triggered CSNPs\n"
88 "Delay in milliseconds\n"
89 "Trigger CSNP for all LSPs, not only circuit-scoped\n")
91 VTY_DECLVAR_CONTEXT(isis_area
, area
);
93 int csnp_delay
= atoi(argv
[1]->arg
);
94 bool always_send_csnp
= (argc
== 3);
96 fabricd_configure_triggered_csnp(area
, csnp_delay
, always_send_csnp
);
100 DEFUN (no_triggered_csnp
,
101 no_triggered_csnp_cmd
,
102 "no triggered-csnp-delay [(100-10000) [always]]",
104 "Configure the delay for triggered CSNPs\n"
105 "Delay in milliseconds\n"
106 "Trigger CSNP for all LSPs, not only circuit-scoped\n")
108 VTY_DECLVAR_CONTEXT(isis_area
, area
);
110 fabricd_configure_triggered_csnp(area
, FABRICD_DEFAULT_CSNP_DELAY
,
115 static void lsp_print_flooding(struct vty
*vty
, struct isis_lsp
*lsp
)
119 lspid_print(lsp
->hdr
.lsp_id
, lspid
, true, true);
120 vty_out(vty
, "Flooding information for %s\n", lspid
);
122 if (!lsp
->flooding_neighbors
[TX_LSP_NORMAL
]) {
123 vty_out(vty
, " Never received.\n");
127 vty_out(vty
, " Last received on: %s (",
128 lsp
->flooding_interface
?
129 lsp
->flooding_interface
: "(null)");
131 time_t uptime
= time(NULL
) - lsp
->flooding_time
;
132 struct tm
*tm
= gmtime(&uptime
);
134 if (uptime
< ONE_DAY_SECOND
)
135 vty_out(vty
, "%02d:%02d:%02d", tm
->tm_hour
, tm
->tm_min
,
137 else if (uptime
< ONE_WEEK_SECOND
)
138 vty_out(vty
, "%dd%02dh%02dm", tm
->tm_yday
, tm
->tm_hour
,
141 vty_out(vty
, "%02dw%dd%02dh", tm
->tm_yday
/ 7,
142 tm
->tm_yday
- ((tm
->tm_yday
/ 7) * 7),
144 vty_out(vty
, " ago)\n");
146 if (lsp
->flooding_circuit_scoped
) {
147 vty_out(vty
, " Received as circuit-scoped LSP, so not "
152 for (enum isis_tx_type type
= TX_LSP_NORMAL
;
153 type
<= TX_LSP_CIRCUIT_SCOPED
; type
++) {
154 struct listnode
*node
;
155 uint8_t *neighbor_id
;
157 vty_out(vty
, " %s:\n",
158 (type
== TX_LSP_NORMAL
) ? "RF" : "DNR");
159 for (ALL_LIST_ELEMENTS_RO(lsp
->flooding_neighbors
[type
],
160 node
, neighbor_id
)) {
161 vty_out(vty
, " %s\n",
162 print_sys_hostname(neighbor_id
));
167 DEFUN (show_lsp_flooding
,
168 show_lsp_flooding_cmd
,
169 "show openfabric flooding [WORD]",
172 "Flooding information\n"
175 const char *lspid
= NULL
;
178 lspid
= argv
[3]->arg
;
180 struct listnode
*node
;
181 struct isis_area
*area
;
183 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
184 struct lspdb_head
*head
= &area
->lspdb
[ISIS_LEVEL2
- 1];
185 struct isis_lsp
*lsp
;
187 vty_out(vty
, "Area %s:\n", area
->area_tag
?
188 area
->area_tag
: "null");
191 lsp
= lsp_for_arg(head
, lspid
);
194 lsp_print_flooding(vty
, lsp
);
199 frr_each (lspdb
, head
, lsp
) {
200 lsp_print_flooding(vty
, lsp
);
208 DEFUN (ip_router_isis
,
210 "ip router " PROTO_NAME
" WORD",
211 "Interface Internet Protocol config commands\n"
212 "IP router interface commands\n"
214 "Routing process tag\n")
218 VTY_DECLVAR_CONTEXT(interface
, ifp
);
219 struct isis_circuit
*circuit
;
220 struct isis_area
*area
;
221 const char *af
= argv
[idx_afi
]->arg
;
222 const char *area_tag
= argv
[idx_word
]->arg
;
224 /* Prevent more than one area per circuit */
225 circuit
= circuit_scan_by_ifp(ifp
);
226 if (circuit
&& circuit
->area
) {
227 if (strcmp(circuit
->area
->area_tag
, area_tag
)) {
228 vty_out(vty
, "ISIS circuit is already defined on %s\n",
229 circuit
->area
->area_tag
);
230 return CMD_ERR_NOTHING_TODO
;
234 area
= isis_area_lookup(area_tag
);
236 area
= isis_area_create(area_tag
);
238 if (!circuit
|| !circuit
->area
) {
239 circuit
= isis_circuit_create(area
, ifp
);
241 if (circuit
->state
!= C_STATE_CONF
242 && circuit
->state
!= C_STATE_UP
) {
244 "Couldn't bring up interface, please check log.\n");
245 return CMD_WARNING_CONFIG_FAILED
;
249 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
255 isis_circuit_af_set(circuit
, ip
, ipv6
);
259 DEFUN (ip6_router_isis
,
261 "ipv6 router " PROTO_NAME
" WORD",
262 "Interface Internet Protocol config commands\n"
263 "IP router interface commands\n"
265 "Routing process tag\n")
267 return ip_router_isis(self
, vty
, argc
, argv
);
270 DEFUN (no_ip_router_isis
,
271 no_ip_router_isis_cmd
,
272 "no <ip|ipv6> router " PROTO_NAME
" WORD",
274 "Interface Internet Protocol config commands\n"
275 "IP router interface commands\n"
276 "IP router interface commands\n"
278 "Routing process tag\n")
282 VTY_DECLVAR_CONTEXT(interface
, ifp
);
283 struct isis_area
*area
;
284 struct isis_circuit
*circuit
;
285 const char *af
= argv
[idx_afi
]->arg
;
286 const char *area_tag
= argv
[idx_word
]->arg
;
288 area
= isis_area_lookup(area_tag
);
290 vty_out(vty
, "Can't find ISIS instance %s\n",
292 return CMD_ERR_NO_MATCH
;
295 circuit
= circuit_lookup_by_ifp(ifp
, area
->circuit_list
);
297 vty_out(vty
, "ISIS is not enabled on circuit %s\n", ifp
->name
);
298 return CMD_ERR_NO_MATCH
;
301 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
307 isis_circuit_af_set(circuit
, ip
, ipv6
);
315 "Enable BFD support\n")
317 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
320 return CMD_ERR_NO_MATCH
;
322 if (circuit
->bfd_info
323 && CHECK_FLAG(circuit
->bfd_info
->flags
, BFD_FLAG_PARAM_CFG
)) {
327 isis_bfd_circuit_param_set(circuit
, BFD_DEF_MIN_RX
,
328 BFD_DEF_MIN_TX
, BFD_DEF_DETECT_MULT
, true);
335 "no " PROTO_NAME
" bfd",
338 "Disables BFD support\n"
341 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
344 return CMD_ERR_NO_MATCH
;
346 if (!circuit
->bfd_info
)
349 isis_bfd_circuit_cmd(circuit
, ZEBRA_BFD_DEST_DEREGISTER
);
350 bfd_info_free(&circuit
->bfd_info
);
354 DEFUN (set_overload_bit
,
355 set_overload_bit_cmd
,
357 "Set overload bit to avoid any transit traffic\n")
359 VTY_DECLVAR_CONTEXT(isis_area
, area
);
361 isis_area_overload_bit_set(area
, true);
365 DEFUN (no_set_overload_bit
,
366 no_set_overload_bit_cmd
,
367 "no set-overload-bit",
368 "Reset overload bit to accept transit traffic\n"
369 "Reset overload bit\n")
371 VTY_DECLVAR_CONTEXT(isis_area
, area
);
373 isis_area_overload_bit_set(area
, false);
377 static int isis_vty_password_set(struct vty
*vty
, int argc
,
378 struct cmd_token
*argv
[], int level
)
380 VTY_DECLVAR_CONTEXT(isis_area
, area
);
383 int idx_password
= 2;
384 int idx_snp_auth
= 5;
385 uint8_t snp_auth
= 0;
387 const char *passwd
= argv
[idx_password
]->arg
;
388 if (strlen(passwd
) > 254) {
389 vty_out(vty
, "Too long area password (>254)\n");
390 return CMD_WARNING_CONFIG_FAILED
;
393 if (argc
> idx_snp_auth
) {
394 snp_auth
= SNP_AUTH_SEND
;
395 if (strmatch(argv
[idx_snp_auth
]->text
, "validate"))
396 snp_auth
|= SNP_AUTH_RECV
;
399 if (strmatch(argv
[idx_algo
]->text
, "clear")) {
400 return isis_area_passwd_cleartext_set(area
, level
,
402 } else if (strmatch(argv
[idx_algo
]->text
, "md5")) {
403 return isis_area_passwd_hmac_md5_set(area
, level
,
407 return CMD_WARNING_CONFIG_FAILED
;
410 DEFUN (domain_passwd
,
412 "domain-password <clear|md5> WORD [authenticate snp <send-only|validate>]",
413 "Set the authentication password for a routing domain\n"
414 "Authentication type\n"
415 "Authentication type\n"
416 "Level-wide password\n"
419 "Send but do not check PDUs on receiving\n"
420 "Send and check PDUs on receiving\n")
422 return isis_vty_password_set(vty
, argc
, argv
, IS_LEVEL_2
);
425 DEFUN (no_domain_passwd
,
426 no_domain_passwd_cmd
,
427 "no domain-password",
429 "Set the authentication password for a routing domain\n")
431 VTY_DECLVAR_CONTEXT(isis_area
, area
);
433 return isis_area_passwd_unset(area
, IS_LEVEL_2
);
437 isis_vty_lsp_gen_interval_set(struct vty
*vty
, int level
, uint16_t interval
)
439 VTY_DECLVAR_CONTEXT(isis_area
, area
);
442 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
446 if (interval
>= area
->lsp_refresh
[lvl
- 1]) {
448 "LSP gen interval %us must be less than "
449 "the LSP refresh interval %us\n",
450 interval
, area
->lsp_refresh
[lvl
- 1]);
451 return CMD_WARNING_CONFIG_FAILED
;
455 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
458 area
->lsp_gen_interval
[lvl
- 1] = interval
;
464 DEFUN (lsp_gen_interval
,
465 lsp_gen_interval_cmd
,
466 "lsp-gen-interval (1-120)",
467 "Minimum interval between regenerating same LSP\n"
468 "Minimum interval in seconds\n")
470 uint16_t interval
= atoi(argv
[1]->arg
);
472 return isis_vty_lsp_gen_interval_set(vty
, IS_LEVEL_1_AND_2
, interval
);
475 DEFUN (no_lsp_gen_interval
,
476 no_lsp_gen_interval_cmd
,
477 "no lsp-gen-interval [(1-120)]",
479 "Minimum interval between regenerating same LSP\n"
480 "Minimum interval in seconds\n")
482 VTY_DECLVAR_CONTEXT(isis_area
, area
);
484 return isis_vty_lsp_gen_interval_set(vty
, IS_LEVEL_1_AND_2
,
485 DEFAULT_MIN_LSP_GEN_INTERVAL
);
489 isis_vty_lsp_refresh_set(struct vty
*vty
, int level
, uint16_t interval
)
491 VTY_DECLVAR_CONTEXT(isis_area
, area
);
494 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
497 if (interval
<= area
->lsp_gen_interval
[lvl
- 1]) {
499 "LSP refresh interval %us must be greater than "
500 "the configured LSP gen interval %us\n",
501 interval
, area
->lsp_gen_interval
[lvl
- 1]);
502 return CMD_WARNING_CONFIG_FAILED
;
504 if (interval
> (area
->max_lsp_lifetime
[lvl
- 1] - 300)) {
506 "LSP refresh interval %us must be less than "
507 "the configured LSP lifetime %us less 300\n",
508 interval
, area
->max_lsp_lifetime
[lvl
- 1]);
509 return CMD_WARNING_CONFIG_FAILED
;
513 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
516 isis_area_lsp_refresh_set(area
, lvl
, interval
);
522 DEFUN (lsp_refresh_interval
,
523 lsp_refresh_interval_cmd
,
524 "lsp-refresh-interval (1-65235)",
525 "LSP refresh interval\n"
526 "LSP refresh interval in seconds\n")
528 unsigned int interval
= atoi(argv
[1]->arg
);
529 return isis_vty_lsp_refresh_set(vty
, IS_LEVEL_1_AND_2
, interval
);
532 DEFUN (no_lsp_refresh_interval
,
533 no_lsp_refresh_interval_cmd
,
534 "no lsp-refresh-interval [(1-65235)]",
536 "LSP refresh interval\n"
537 "LSP refresh interval in seconds\n")
539 return isis_vty_lsp_refresh_set(vty
, IS_LEVEL_1_AND_2
,
540 DEFAULT_MAX_LSP_GEN_INTERVAL
);
544 isis_vty_max_lsp_lifetime_set(struct vty
*vty
, int level
, uint16_t interval
)
546 VTY_DECLVAR_CONTEXT(isis_area
, area
);
548 uint16_t refresh_interval
= interval
- 300;
549 int set_refresh_interval
[ISIS_LEVELS
] = {0, 0};
551 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++) {
555 if (refresh_interval
< area
->lsp_refresh
[lvl
- 1]) {
557 "Level %d Max LSP lifetime %us must be 300s greater than "
558 "the configured LSP refresh interval %us\n",
559 lvl
, interval
, area
->lsp_refresh
[lvl
- 1]);
561 "Automatically reducing level %d LSP refresh interval "
563 lvl
, refresh_interval
);
564 set_refresh_interval
[lvl
- 1] = 1;
567 <= area
->lsp_gen_interval
[lvl
- 1]) {
569 "LSP refresh interval %us must be greater than "
570 "the configured LSP gen interval %us\n",
572 area
->lsp_gen_interval
[lvl
- 1]);
573 return CMD_WARNING_CONFIG_FAILED
;
578 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++) {
581 isis_area_max_lsp_lifetime_set(area
, lvl
, interval
);
582 if (set_refresh_interval
[lvl
- 1])
583 isis_area_lsp_refresh_set(area
, lvl
, refresh_interval
);
589 DEFUN (max_lsp_lifetime
,
590 max_lsp_lifetime_cmd
,
591 "max-lsp-lifetime (350-65535)",
592 "Maximum LSP lifetime\n"
593 "LSP lifetime in seconds\n")
595 int lifetime
= atoi(argv
[1]->arg
);
597 return isis_vty_max_lsp_lifetime_set(vty
, IS_LEVEL_1_AND_2
, lifetime
);
601 DEFUN (no_max_lsp_lifetime
,
602 no_max_lsp_lifetime_cmd
,
603 "no max-lsp-lifetime [(350-65535)]",
605 "Maximum LSP lifetime\n"
606 "LSP lifetime in seconds\n")
608 return isis_vty_max_lsp_lifetime_set(vty
, IS_LEVEL_1_AND_2
,
609 DEFAULT_LSP_LIFETIME
);
614 "spf-interval (1-120)",
615 "Minimum interval between SPF calculations\n"
616 "Minimum interval between consecutive SPFs in seconds\n")
618 VTY_DECLVAR_CONTEXT(isis_area
, area
);
619 uint16_t interval
= atoi(argv
[1]->arg
);
621 area
->min_spf_interval
[0] = interval
;
622 area
->min_spf_interval
[1] = interval
;
627 DEFUN (no_spf_interval
,
629 "no spf-interval [(1-120)]",
631 "Minimum interval between SPF calculations\n"
632 "Minimum interval between consecutive SPFs in seconds\n")
634 VTY_DECLVAR_CONTEXT(isis_area
, area
);
636 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
637 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
642 static int isis_vty_lsp_mtu_set(struct vty
*vty
, unsigned int lsp_mtu
)
644 VTY_DECLVAR_CONTEXT(isis_area
, area
);
645 struct listnode
*node
;
646 struct isis_circuit
*circuit
;
648 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
)) {
649 if (circuit
->state
!= C_STATE_INIT
650 && circuit
->state
!= C_STATE_UP
)
652 if (lsp_mtu
> isis_circuit_pdu_size(circuit
)) {
654 "ISIS area contains circuit %s, which has a maximum PDU size of %zu.\n",
655 circuit
->interface
->name
,
656 isis_circuit_pdu_size(circuit
));
657 return CMD_WARNING_CONFIG_FAILED
;
661 isis_area_lsp_mtu_set(area
, lsp_mtu
);
667 "lsp-mtu (128-4352)",
668 "Configure the maximum size of generated LSPs\n"
669 "Maximum size of generated LSPs\n")
672 unsigned int lsp_mtu
;
674 lsp_mtu
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
676 return isis_vty_lsp_mtu_set(vty
, lsp_mtu
);
679 DEFUN (no_area_lsp_mtu
,
681 "no lsp-mtu [(128-4352)]",
683 "Configure the maximum size of generated LSPs\n"
684 "Maximum size of generated LSPs\n")
686 return isis_vty_lsp_mtu_set(vty
, DEFAULT_LSP_MTU
);
689 DEFUN (no_spf_delay_ietf
,
690 no_spf_delay_ietf_cmd
,
693 "IETF SPF delay algorithm\n")
695 VTY_DECLVAR_CONTEXT(isis_area
, area
);
697 spf_backoff_free(area
->spf_delay_ietf
[0]);
698 spf_backoff_free(area
->spf_delay_ietf
[1]);
699 area
->spf_delay_ietf
[0] = NULL
;
700 area
->spf_delay_ietf
[1] = NULL
;
705 DEFUN (spf_delay_ietf
,
707 "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)",
708 "IETF SPF delay algorithm\n"
709 "Delay used while in QUIET state\n"
710 "Delay used while in QUIET state in milliseconds\n"
711 "Delay used while in SHORT_WAIT state\n"
712 "Delay used while in SHORT_WAIT state in milliseconds\n"
713 "Delay used while in LONG_WAIT\n"
714 "Delay used while in LONG_WAIT state in milliseconds\n"
715 "Time with no received IGP events before considering IGP stable\n"
716 "Time with no received IGP events before considering IGP stable (in milliseconds)\n"
717 "Maximum duration needed to learn all the events related to a single failure\n"
718 "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n")
720 VTY_DECLVAR_CONTEXT(isis_area
, area
);
722 long init_delay
= atol(argv
[2]->arg
);
723 long short_delay
= atol(argv
[4]->arg
);
724 long long_delay
= atol(argv
[6]->arg
);
725 long holddown
= atol(argv
[8]->arg
);
726 long timetolearn
= atol(argv
[10]->arg
);
728 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
729 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
731 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
732 spf_backoff_free(area
->spf_delay_ietf
[0]);
733 area
->spf_delay_ietf
[0] =
734 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
735 long_delay
, holddown
, timetolearn
);
737 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
738 spf_backoff_free(area
->spf_delay_ietf
[1]);
739 area
->spf_delay_ietf
[1] =
740 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
741 long_delay
, holddown
, timetolearn
);
743 XFREE(MTYPE_TMP
, buf
);
747 DEFUN (area_purge_originator
,
748 area_purge_originator_cmd
,
749 "[no] purge-originator",
751 "Use the RFC 6232 purge-originator\n")
753 VTY_DECLVAR_CONTEXT(isis_area
, area
);
755 area
->purge_originator
= !!strcmp(argv
[0]->text
, "no");
761 PROTO_NAME
" passive",
763 "Configure the passive mode for interface\n")
765 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
767 return CMD_ERR_NO_MATCH
;
769 CMD_FERR_RETURN(isis_circuit_passive_set(circuit
, 1),
770 "Cannot set passive: $ERR");
774 DEFUN (no_isis_passive
,
776 "no " PROTO_NAME
" passive",
779 "Configure the passive mode for interface\n")
781 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
783 return CMD_ERR_NO_MATCH
;
785 CMD_FERR_RETURN(isis_circuit_passive_set(circuit
, 0),
786 "Cannot set no passive: $ERR");
792 PROTO_NAME
" password <md5|clear> WORD",
794 "Configure the authentication password for a circuit\n"
795 "HMAC-MD5 authentication\n"
796 "Cleartext password\n"
797 "Circuit password\n")
799 int idx_encryption
= 2;
801 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
805 return CMD_ERR_NO_MATCH
;
807 if (argv
[idx_encryption
]->arg
[0] == 'm')
808 rv
= isis_circuit_passwd_hmac_md5_set(circuit
,
809 argv
[idx_word
]->arg
);
811 rv
= isis_circuit_passwd_cleartext_set(circuit
,
812 argv
[idx_word
]->arg
);
814 CMD_FERR_RETURN(rv
, "Failed to set circuit password: $ERR");
818 DEFUN (no_isis_passwd
,
820 "no " PROTO_NAME
" password [<md5|clear> WORD]",
823 "Configure the authentication password for a circuit\n"
824 "HMAC-MD5 authentication\n"
825 "Cleartext password\n"
826 "Circuit password\n")
828 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
830 return CMD_ERR_NO_MATCH
;
832 CMD_FERR_RETURN(isis_circuit_passwd_unset(circuit
),
833 "Failed to unset circuit password: $ERR");
839 PROTO_NAME
" metric (0-16777215)",
841 "Set default metric for circuit\n"
842 "Default metric value\n")
846 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
848 return CMD_ERR_NO_MATCH
;
850 met
= atoi(argv
[idx_number
]->arg
);
852 /* RFC3787 section 5.1 */
853 if (circuit
->area
&& circuit
->area
->oldmetric
== 1
854 && met
> MAX_NARROW_LINK_METRIC
) {
856 "Invalid metric %d - should be <0-63> "
857 "when narrow metric type enabled\n",
859 return CMD_WARNING_CONFIG_FAILED
;
863 if (circuit
->area
&& circuit
->area
->newmetric
== 1
864 && met
> MAX_WIDE_LINK_METRIC
) {
866 "Invalid metric %d - should be <0-16777215> "
867 "when wide metric type enabled\n",
869 return CMD_WARNING_CONFIG_FAILED
;
872 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_1
, met
),
873 "Failed to set L1 metric: $ERR");
874 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_2
, met
),
875 "Failed to set L2 metric: $ERR");
879 DEFUN (no_isis_metric
,
881 "no " PROTO_NAME
" metric [(0-16777215)]",
884 "Set default metric for circuit\n"
885 "Default metric value\n")
887 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
889 return CMD_ERR_NO_MATCH
;
891 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_1
,
892 DEFAULT_CIRCUIT_METRIC
),
893 "Failed to set L1 metric: $ERR");
894 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_2
,
895 DEFAULT_CIRCUIT_METRIC
),
896 "Failed to set L2 metric: $ERR");
900 DEFUN (isis_hello_interval
,
901 isis_hello_interval_cmd
,
902 PROTO_NAME
" hello-interval (1-600)",
904 "Set Hello interval\n"
905 "Holdtime 1 seconds, interval depends on multiplier\n")
907 uint32_t interval
= atoi(argv
[2]->arg
);
908 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
910 return CMD_ERR_NO_MATCH
;
912 circuit
->hello_interval
[0] = interval
;
913 circuit
->hello_interval
[1] = interval
;
918 DEFUN (no_isis_hello_interval
,
919 no_isis_hello_interval_cmd
,
920 "no " PROTO_NAME
" hello-interval [(1-600)]",
923 "Set Hello interval\n"
924 "Holdtime 1 second, interval depends on multiplier\n")
926 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
928 return CMD_ERR_NO_MATCH
;
930 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
931 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
936 DEFUN (isis_hello_multiplier
,
937 isis_hello_multiplier_cmd
,
938 PROTO_NAME
" hello-multiplier (2-100)",
940 "Set multiplier for Hello holding time\n"
941 "Hello multiplier value\n")
943 uint16_t mult
= atoi(argv
[2]->arg
);
944 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
946 return CMD_ERR_NO_MATCH
;
948 circuit
->hello_multiplier
[0] = mult
;
949 circuit
->hello_multiplier
[1] = mult
;
954 DEFUN (no_isis_hello_multiplier
,
955 no_isis_hello_multiplier_cmd
,
956 "no " PROTO_NAME
" hello-multiplier [(2-100)]",
959 "Set multiplier for Hello holding time\n"
960 "Hello multiplier value\n")
962 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
964 return CMD_ERR_NO_MATCH
;
966 circuit
->hello_multiplier
[0] = DEFAULT_HELLO_MULTIPLIER
;
967 circuit
->hello_multiplier
[1] = DEFAULT_HELLO_MULTIPLIER
;
972 DEFUN (csnp_interval
,
974 PROTO_NAME
" csnp-interval (1-600)",
976 "Set CSNP interval in seconds\n"
977 "CSNP interval value\n")
979 uint16_t interval
= atoi(argv
[2]->arg
);
980 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
982 return CMD_ERR_NO_MATCH
;
984 circuit
->csnp_interval
[0] = interval
;
985 circuit
->csnp_interval
[1] = interval
;
990 DEFUN (no_csnp_interval
,
991 no_csnp_interval_cmd
,
992 "no " PROTO_NAME
" csnp-interval [(1-600)]",
995 "Set CSNP interval in seconds\n"
996 "CSNP interval value\n")
998 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
1000 return CMD_ERR_NO_MATCH
;
1002 circuit
->csnp_interval
[0] = DEFAULT_CSNP_INTERVAL
;
1003 circuit
->csnp_interval
[1] = DEFAULT_CSNP_INTERVAL
;
1008 DEFUN (psnp_interval
,
1010 PROTO_NAME
" psnp-interval (1-120)",
1012 "Set PSNP interval in seconds\n"
1013 "PSNP interval value\n")
1015 uint16_t interval
= atoi(argv
[2]->arg
);
1016 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
1018 return CMD_ERR_NO_MATCH
;
1020 circuit
->psnp_interval
[0] = interval
;
1021 circuit
->psnp_interval
[1] = interval
;
1026 DEFUN (no_psnp_interval
,
1027 no_psnp_interval_cmd
,
1028 "no " PROTO_NAME
" psnp-interval [(1-120)]",
1031 "Set PSNP interval in seconds\n"
1032 "PSNP interval value\n")
1034 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
1036 return CMD_ERR_NO_MATCH
;
1038 circuit
->psnp_interval
[0] = DEFAULT_PSNP_INTERVAL
;
1039 circuit
->psnp_interval
[1] = DEFAULT_PSNP_INTERVAL
;
1044 DEFUN (circuit_topology
,
1045 circuit_topology_cmd
,
1046 PROTO_NAME
" topology " ISIS_MT_NAMES
,
1048 "Configure interface IS-IS topologies\n"
1049 ISIS_MT_DESCRIPTIONS
)
1051 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
1053 return CMD_ERR_NO_MATCH
;
1054 const char *arg
= argv
[2]->arg
;
1055 uint16_t mtid
= isis_str2mtid(arg
);
1057 if (circuit
->area
&& circuit
->area
->oldmetric
) {
1059 "Multi topology IS-IS can only be used with wide metrics\n");
1060 return CMD_WARNING_CONFIG_FAILED
;
1063 if (mtid
== (uint16_t)-1) {
1064 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1065 return CMD_WARNING_CONFIG_FAILED
;
1068 return isis_circuit_mt_enabled_set(circuit
, mtid
, true);
1071 DEFUN (no_circuit_topology
,
1072 no_circuit_topology_cmd
,
1073 "no " PROTO_NAME
" topology " ISIS_MT_NAMES
,
1076 "Configure interface IS-IS topologies\n"
1077 ISIS_MT_DESCRIPTIONS
)
1079 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
1081 return CMD_ERR_NO_MATCH
;
1082 const char *arg
= argv
[3]->arg
;
1083 uint16_t mtid
= isis_str2mtid(arg
);
1085 if (circuit
->area
&& circuit
->area
->oldmetric
) {
1087 "Multi topology IS-IS can only be used with wide metrics\n");
1088 return CMD_WARNING_CONFIG_FAILED
;
1091 if (mtid
== (uint16_t)-1) {
1092 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1093 return CMD_WARNING_CONFIG_FAILED
;
1096 return isis_circuit_mt_enabled_set(circuit
, mtid
, false);
1099 void isis_vty_daemon_init(void)
1101 install_element(ROUTER_NODE
, &fabric_tier_cmd
);
1102 install_element(ROUTER_NODE
, &no_fabric_tier_cmd
);
1103 install_element(ROUTER_NODE
, &triggered_csnp_cmd
);
1104 install_element(ROUTER_NODE
, &no_triggered_csnp_cmd
);
1106 install_element(ENABLE_NODE
, &show_lsp_flooding_cmd
);
1108 install_element(INTERFACE_NODE
, &ip_router_isis_cmd
);
1109 install_element(INTERFACE_NODE
, &ip6_router_isis_cmd
);
1110 install_element(INTERFACE_NODE
, &no_ip_router_isis_cmd
);
1111 install_element(INTERFACE_NODE
, &isis_bfd_cmd
);
1112 install_element(INTERFACE_NODE
, &no_isis_bfd_cmd
);
1114 install_element(ROUTER_NODE
, &set_overload_bit_cmd
);
1115 install_element(ROUTER_NODE
, &no_set_overload_bit_cmd
);
1117 install_element(ROUTER_NODE
, &domain_passwd_cmd
);
1118 install_element(ROUTER_NODE
, &no_domain_passwd_cmd
);
1120 install_element(ROUTER_NODE
, &lsp_gen_interval_cmd
);
1121 install_element(ROUTER_NODE
, &no_lsp_gen_interval_cmd
);
1123 install_element(ROUTER_NODE
, &lsp_refresh_interval_cmd
);
1124 install_element(ROUTER_NODE
, &no_lsp_refresh_interval_cmd
);
1126 install_element(ROUTER_NODE
, &max_lsp_lifetime_cmd
);
1127 install_element(ROUTER_NODE
, &no_max_lsp_lifetime_cmd
);
1129 install_element(ROUTER_NODE
, &area_lsp_mtu_cmd
);
1130 install_element(ROUTER_NODE
, &no_area_lsp_mtu_cmd
);
1132 install_element(ROUTER_NODE
, &spf_interval_cmd
);
1133 install_element(ROUTER_NODE
, &no_spf_interval_cmd
);
1135 install_element(ROUTER_NODE
, &spf_delay_ietf_cmd
);
1136 install_element(ROUTER_NODE
, &no_spf_delay_ietf_cmd
);
1138 install_element(ROUTER_NODE
, &area_purge_originator_cmd
);
1140 install_element(INTERFACE_NODE
, &isis_passive_cmd
);
1141 install_element(INTERFACE_NODE
, &no_isis_passive_cmd
);
1143 install_element(INTERFACE_NODE
, &isis_passwd_cmd
);
1144 install_element(INTERFACE_NODE
, &no_isis_passwd_cmd
);
1146 install_element(INTERFACE_NODE
, &isis_metric_cmd
);
1147 install_element(INTERFACE_NODE
, &no_isis_metric_cmd
);
1149 install_element(INTERFACE_NODE
, &isis_hello_interval_cmd
);
1150 install_element(INTERFACE_NODE
, &no_isis_hello_interval_cmd
);
1152 install_element(INTERFACE_NODE
, &isis_hello_multiplier_cmd
);
1153 install_element(INTERFACE_NODE
, &no_isis_hello_multiplier_cmd
);
1155 install_element(INTERFACE_NODE
, &csnp_interval_cmd
);
1156 install_element(INTERFACE_NODE
, &no_csnp_interval_cmd
);
1158 install_element(INTERFACE_NODE
, &psnp_interval_cmd
);
1159 install_element(INTERFACE_NODE
, &no_psnp_interval_cmd
);
1161 install_element(INTERFACE_NODE
, &circuit_topology_cmd
);
1162 install_element(INTERFACE_NODE
, &no_circuit_topology_cmd
);