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 char buf
[MONOTIME_STRLEN
];
121 lspid_print(lsp
->hdr
.lsp_id
, lspid
, sizeof(lspid
), true, true, isis
);
122 vty_out(vty
, "Flooding information for %s\n", lspid
);
124 if (!lsp
->flooding_neighbors
[TX_LSP_NORMAL
]) {
125 vty_out(vty
, " Never received.\n");
129 vty_out(vty
, " Last received on: %s (",
130 lsp
->flooding_interface
?
131 lsp
->flooding_interface
: "(null)");
133 time_t uptime
= time(NULL
) - lsp
->flooding_time
;
135 frrtime_to_interval(uptime
, buf
, sizeof(buf
));
137 vty_out(vty
, "%s ago)\n", buf
);
139 if (lsp
->flooding_circuit_scoped
) {
140 vty_out(vty
, " Received as circuit-scoped LSP, so not flooded.\n");
144 for (enum isis_tx_type type
= TX_LSP_NORMAL
;
145 type
<= TX_LSP_CIRCUIT_SCOPED
; type
++) {
146 struct listnode
*node
;
147 uint8_t *neighbor_id
;
149 vty_out(vty
, " %s:\n",
150 (type
== TX_LSP_NORMAL
) ? "RF" : "DNR");
151 for (ALL_LIST_ELEMENTS_RO(lsp
->flooding_neighbors
[type
],
152 node
, neighbor_id
)) {
153 vty_out(vty
, " %s\n",
154 print_sys_hostname(neighbor_id
));
159 DEFUN (show_lsp_flooding
,
160 show_lsp_flooding_cmd
,
161 "show openfabric flooding [WORD]",
164 "Flooding information\n"
167 const char *lspid
= NULL
;
170 lspid
= argv
[3]->arg
;
172 struct listnode
*node
;
173 struct isis_area
*area
;
174 struct isis
*isis
= NULL
;
176 isis
= isis_lookup_by_vrfid(VRF_DEFAULT
);
179 vty_out(vty
, "IS-IS Routing Process not enabled\n");
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",
188 area
->area_tag
? area
->area_tag
: "null");
190 lsp
= lsp_for_sysid(head
, lspid
, isis
);
192 lsp_print_flooding(vty
, lsp
, isis
);
195 frr_each (lspdb
, head
, lsp
) {
196 lsp_print_flooding(vty
, lsp
, isis
);
204 DEFUN (ip_router_isis
,
206 "ip router " PROTO_NAME
" WORD",
207 "Interface Internet Protocol config commands\n"
208 "IP router interface commands\n"
210 "Routing process tag\n")
214 VTY_DECLVAR_CONTEXT(interface
, ifp
);
215 struct isis_circuit
*circuit
;
216 struct isis_area
*area
;
217 const char *af
= argv
[idx_afi
]->arg
;
218 const char *area_tag
= argv
[idx_word
]->arg
;
220 /* Prevent more than one area per circuit */
221 circuit
= circuit_scan_by_ifp(ifp
);
222 if (circuit
&& circuit
->area
) {
223 if (strcmp(circuit
->area
->area_tag
, area_tag
)) {
224 vty_out(vty
, "ISIS circuit is already defined on %s\n",
225 circuit
->area
->area_tag
);
226 return CMD_ERR_NOTHING_TODO
;
230 area
= isis_area_lookup(area_tag
, VRF_DEFAULT
);
232 isis_area_create(area_tag
, VRF_DEFAULT_NAME
);
235 circuit
= isis_circuit_new(ifp
, area_tag
);
237 if (circuit
->state
!= C_STATE_CONF
238 && circuit
->state
!= C_STATE_UP
) {
240 "Couldn't bring up interface, please check log.\n");
241 return CMD_WARNING_CONFIG_FAILED
;
245 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
251 isis_circuit_af_set(circuit
, ip
, ipv6
);
255 DEFUN (ip6_router_isis
,
257 "ipv6 router " PROTO_NAME
" WORD",
258 "Interface Internet Protocol config commands\n"
259 "IP router interface commands\n"
261 "Routing process tag\n")
263 return ip_router_isis(self
, vty
, argc
, argv
);
266 DEFUN (no_ip_router_isis
,
267 no_ip_router_isis_cmd
,
268 "no <ip|ipv6> router " PROTO_NAME
" WORD",
270 "Interface Internet Protocol config commands\n"
271 "IP router interface commands\n"
272 "IP router interface commands\n"
274 "Routing process tag\n")
278 VTY_DECLVAR_CONTEXT(interface
, ifp
);
279 struct isis_area
*area
;
280 struct isis_circuit
*circuit
;
281 const char *af
= argv
[idx_afi
]->arg
;
282 const char *area_tag
= argv
[idx_word
]->arg
;
284 area
= isis_area_lookup(area_tag
, VRF_DEFAULT
);
286 vty_out(vty
, "Can't find ISIS instance %s\n",
288 return CMD_ERR_NO_MATCH
;
291 circuit
= circuit_scan_by_ifp(ifp
);
293 vty_out(vty
, "ISIS is not enabled on circuit %s\n", ifp
->name
);
294 return CMD_ERR_NO_MATCH
;
297 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
303 isis_circuit_af_set(circuit
, ip
, ipv6
);
306 isis_circuit_del(circuit
);
315 "Enable BFD support\n")
317 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
320 return CMD_ERR_NO_MATCH
;
322 if (circuit
->bfd_config
.enabled
)
325 circuit
->bfd_config
.enabled
= true;
326 isis_bfd_circuit_cmd(circuit
);
333 "no " PROTO_NAME
" bfd",
336 "Disables BFD support\n"
339 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
342 return CMD_ERR_NO_MATCH
;
344 if (!circuit
->bfd_config
.enabled
)
347 circuit
->bfd_config
.enabled
= false;
348 isis_bfd_circuit_cmd(circuit
);
353 DEFUN (set_overload_bit
,
354 set_overload_bit_cmd
,
356 "Set overload bit to avoid any transit traffic\n")
358 VTY_DECLVAR_CONTEXT(isis_area
, area
);
360 isis_area_overload_bit_set(area
, true);
364 DEFUN (no_set_overload_bit
,
365 no_set_overload_bit_cmd
,
366 "no set-overload-bit",
367 "Reset overload bit to accept transit traffic\n"
368 "Reset overload bit\n")
370 VTY_DECLVAR_CONTEXT(isis_area
, area
);
372 isis_area_overload_bit_set(area
, false);
376 static int isis_vty_password_set(struct vty
*vty
, int argc
,
377 struct cmd_token
*argv
[], int level
)
379 VTY_DECLVAR_CONTEXT(isis_area
, area
);
382 int idx_password
= 2;
383 int idx_snp_auth
= 5;
384 uint8_t snp_auth
= 0;
386 const char *passwd
= argv
[idx_password
]->arg
;
387 if (strlen(passwd
) > 254) {
388 vty_out(vty
, "Too long area password (>254)\n");
389 return CMD_WARNING_CONFIG_FAILED
;
392 if (argc
> idx_snp_auth
) {
393 snp_auth
= SNP_AUTH_SEND
;
394 if (strmatch(argv
[idx_snp_auth
]->text
, "validate"))
395 snp_auth
|= SNP_AUTH_RECV
;
398 if (strmatch(argv
[idx_algo
]->text
, "clear")) {
399 return isis_area_passwd_cleartext_set(area
, level
,
401 } else if (strmatch(argv
[idx_algo
]->text
, "md5")) {
402 return isis_area_passwd_hmac_md5_set(area
, level
,
406 return CMD_WARNING_CONFIG_FAILED
;
409 DEFUN (domain_passwd
,
411 "domain-password <clear|md5> WORD [authenticate snp <send-only|validate>]",
412 "Set the authentication password for a routing domain\n"
413 "Authentication type\n"
414 "Authentication type\n"
415 "Level-wide password\n"
418 "Send but do not check PDUs on receiving\n"
419 "Send and check PDUs on receiving\n")
421 return isis_vty_password_set(vty
, argc
, argv
, IS_LEVEL_2
);
424 DEFUN (no_domain_passwd
,
425 no_domain_passwd_cmd
,
426 "no domain-password",
428 "Set the authentication password for a routing domain\n")
430 VTY_DECLVAR_CONTEXT(isis_area
, area
);
432 return isis_area_passwd_unset(area
, IS_LEVEL_2
);
436 isis_vty_lsp_gen_interval_set(struct vty
*vty
, int level
, uint16_t interval
)
438 VTY_DECLVAR_CONTEXT(isis_area
, area
);
441 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
445 if (interval
>= area
->lsp_refresh
[lvl
- 1]) {
447 "LSP gen interval %us must be less than the LSP refresh interval %us\n",
448 interval
, area
->lsp_refresh
[lvl
- 1]);
449 return CMD_WARNING_CONFIG_FAILED
;
453 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
456 area
->lsp_gen_interval
[lvl
- 1] = interval
;
462 DEFUN (lsp_gen_interval
,
463 lsp_gen_interval_cmd
,
464 "lsp-gen-interval (1-120)",
465 "Minimum interval between regenerating same LSP\n"
466 "Minimum interval in seconds\n")
468 uint16_t interval
= atoi(argv
[1]->arg
);
470 return isis_vty_lsp_gen_interval_set(vty
, IS_LEVEL_1_AND_2
, interval
);
473 DEFUN (no_lsp_gen_interval
,
474 no_lsp_gen_interval_cmd
,
475 "no lsp-gen-interval [(1-120)]",
477 "Minimum interval between regenerating same LSP\n"
478 "Minimum interval in seconds\n")
480 VTY_DECLVAR_CONTEXT(isis_area
, area
);
482 return isis_vty_lsp_gen_interval_set(vty
, IS_LEVEL_1_AND_2
,
483 DEFAULT_MIN_LSP_GEN_INTERVAL
);
487 isis_vty_lsp_refresh_set(struct vty
*vty
, int level
, uint16_t interval
)
489 VTY_DECLVAR_CONTEXT(isis_area
, area
);
492 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
495 if (interval
<= area
->lsp_gen_interval
[lvl
- 1]) {
497 "LSP refresh interval %us must be greater than the configured LSP gen interval %us\n",
498 interval
, area
->lsp_gen_interval
[lvl
- 1]);
499 return CMD_WARNING_CONFIG_FAILED
;
501 if (interval
> (area
->max_lsp_lifetime
[lvl
- 1] - 300)) {
503 "LSP refresh interval %us must be less than the configured LSP lifetime %us less 300\n",
504 interval
, area
->max_lsp_lifetime
[lvl
- 1]);
505 return CMD_WARNING_CONFIG_FAILED
;
509 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
512 isis_area_lsp_refresh_set(area
, lvl
, interval
);
518 DEFUN (lsp_refresh_interval
,
519 lsp_refresh_interval_cmd
,
520 "lsp-refresh-interval (1-65235)",
521 "LSP refresh interval\n"
522 "LSP refresh interval in seconds\n")
524 unsigned int interval
= atoi(argv
[1]->arg
);
525 return isis_vty_lsp_refresh_set(vty
, IS_LEVEL_1_AND_2
, interval
);
528 DEFUN (no_lsp_refresh_interval
,
529 no_lsp_refresh_interval_cmd
,
530 "no lsp-refresh-interval [(1-65235)]",
532 "LSP refresh interval\n"
533 "LSP refresh interval in seconds\n")
535 return isis_vty_lsp_refresh_set(vty
, IS_LEVEL_1_AND_2
,
536 DEFAULT_MAX_LSP_GEN_INTERVAL
);
540 isis_vty_max_lsp_lifetime_set(struct vty
*vty
, int level
, uint16_t interval
)
542 VTY_DECLVAR_CONTEXT(isis_area
, area
);
544 uint16_t refresh_interval
= interval
- 300;
545 int set_refresh_interval
[ISIS_LEVELS
] = {0, 0};
547 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++) {
551 if (refresh_interval
< area
->lsp_refresh
[lvl
- 1]) {
553 "Level %d Max LSP lifetime %us must be 300s greater than the configured LSP refresh interval %us\n",
554 lvl
, interval
, area
->lsp_refresh
[lvl
- 1]);
556 "Automatically reducing level %d LSP refresh interval to %us\n",
557 lvl
, refresh_interval
);
558 set_refresh_interval
[lvl
- 1] = 1;
561 <= area
->lsp_gen_interval
[lvl
- 1]) {
563 "LSP refresh interval %us must be greater than the configured LSP gen interval %us\n",
565 area
->lsp_gen_interval
[lvl
- 1]);
566 return CMD_WARNING_CONFIG_FAILED
;
571 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++) {
574 isis_area_max_lsp_lifetime_set(area
, lvl
, interval
);
575 if (set_refresh_interval
[lvl
- 1])
576 isis_area_lsp_refresh_set(area
, lvl
, refresh_interval
);
582 DEFUN (max_lsp_lifetime
,
583 max_lsp_lifetime_cmd
,
584 "max-lsp-lifetime (350-65535)",
585 "Maximum LSP lifetime\n"
586 "LSP lifetime in seconds\n")
588 int lifetime
= atoi(argv
[1]->arg
);
590 return isis_vty_max_lsp_lifetime_set(vty
, IS_LEVEL_1_AND_2
, lifetime
);
594 DEFUN (no_max_lsp_lifetime
,
595 no_max_lsp_lifetime_cmd
,
596 "no max-lsp-lifetime [(350-65535)]",
598 "Maximum LSP lifetime\n"
599 "LSP lifetime in seconds\n")
601 return isis_vty_max_lsp_lifetime_set(vty
, IS_LEVEL_1_AND_2
,
602 DEFAULT_LSP_LIFETIME
);
607 "spf-interval (1-120)",
608 "Minimum interval between SPF calculations\n"
609 "Minimum interval between consecutive SPFs in seconds\n")
611 VTY_DECLVAR_CONTEXT(isis_area
, area
);
612 uint16_t interval
= atoi(argv
[1]->arg
);
614 area
->min_spf_interval
[0] = interval
;
615 area
->min_spf_interval
[1] = interval
;
620 DEFUN (no_spf_interval
,
622 "no spf-interval [(1-120)]",
624 "Minimum interval between SPF calculations\n"
625 "Minimum interval between consecutive SPFs in seconds\n")
627 VTY_DECLVAR_CONTEXT(isis_area
, area
);
629 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
630 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
635 static int isis_vty_lsp_mtu_set(struct vty
*vty
, unsigned int lsp_mtu
)
637 VTY_DECLVAR_CONTEXT(isis_area
, area
);
638 struct listnode
*node
;
639 struct isis_circuit
*circuit
;
641 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
)) {
642 if (circuit
->state
!= C_STATE_INIT
643 && circuit
->state
!= C_STATE_UP
)
645 if (lsp_mtu
> isis_circuit_pdu_size(circuit
)) {
647 "ISIS area contains circuit %s, which has a maximum PDU size of %zu.\n",
648 circuit
->interface
->name
,
649 isis_circuit_pdu_size(circuit
));
650 return CMD_WARNING_CONFIG_FAILED
;
654 isis_area_lsp_mtu_set(area
, lsp_mtu
);
660 "lsp-mtu (128-4352)",
661 "Configure the maximum size of generated LSPs\n"
662 "Maximum size of generated LSPs\n")
665 unsigned int lsp_mtu
;
667 lsp_mtu
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
669 return isis_vty_lsp_mtu_set(vty
, lsp_mtu
);
672 DEFUN (no_area_lsp_mtu
,
674 "no lsp-mtu [(128-4352)]",
676 "Configure the maximum size of generated LSPs\n"
677 "Maximum size of generated LSPs\n")
679 return isis_vty_lsp_mtu_set(vty
, DEFAULT_LSP_MTU
);
682 DEFUN (no_spf_delay_ietf
,
683 no_spf_delay_ietf_cmd
,
686 "IETF SPF delay algorithm\n")
688 VTY_DECLVAR_CONTEXT(isis_area
, area
);
690 spf_backoff_free(area
->spf_delay_ietf
[0]);
691 spf_backoff_free(area
->spf_delay_ietf
[1]);
692 area
->spf_delay_ietf
[0] = NULL
;
693 area
->spf_delay_ietf
[1] = NULL
;
698 DEFUN (spf_delay_ietf
,
700 "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)",
701 "IETF SPF delay algorithm\n"
702 "Delay used while in QUIET state\n"
703 "Delay used while in QUIET state in milliseconds\n"
704 "Delay used while in SHORT_WAIT state\n"
705 "Delay used while in SHORT_WAIT state in milliseconds\n"
706 "Delay used while in LONG_WAIT\n"
707 "Delay used while in LONG_WAIT state in milliseconds\n"
708 "Time with no received IGP events before considering IGP stable\n"
709 "Time with no received IGP events before considering IGP stable (in milliseconds)\n"
710 "Maximum duration needed to learn all the events related to a single failure\n"
711 "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n")
713 VTY_DECLVAR_CONTEXT(isis_area
, area
);
715 long init_delay
= atol(argv
[2]->arg
);
716 long short_delay
= atol(argv
[4]->arg
);
717 long long_delay
= atol(argv
[6]->arg
);
718 long holddown
= atol(argv
[8]->arg
);
719 long timetolearn
= atol(argv
[10]->arg
);
721 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
722 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
724 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
725 spf_backoff_free(area
->spf_delay_ietf
[0]);
726 area
->spf_delay_ietf
[0] =
727 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
728 long_delay
, holddown
, timetolearn
);
730 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
731 spf_backoff_free(area
->spf_delay_ietf
[1]);
732 area
->spf_delay_ietf
[1] =
733 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
734 long_delay
, holddown
, timetolearn
);
736 XFREE(MTYPE_TMP
, buf
);
740 DEFUN (area_purge_originator
,
741 area_purge_originator_cmd
,
742 "[no] purge-originator",
744 "Use the RFC 6232 purge-originator\n")
746 VTY_DECLVAR_CONTEXT(isis_area
, area
);
748 area
->purge_originator
= !!strcmp(argv
[0]->text
, "no");
754 PROTO_NAME
" passive",
756 "Configure the passive mode for interface\n")
758 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
760 return CMD_ERR_NO_MATCH
;
762 CMD_FERR_RETURN(isis_circuit_passive_set(circuit
, 1),
763 "Cannot set passive: $ERR");
767 DEFUN (no_isis_passive
,
769 "no " PROTO_NAME
" passive",
772 "Configure the passive mode for interface\n")
774 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
776 return CMD_ERR_NO_MATCH
;
778 CMD_FERR_RETURN(isis_circuit_passive_set(circuit
, 0),
779 "Cannot set no passive: $ERR");
785 PROTO_NAME
" password <md5|clear> WORD",
787 "Configure the authentication password for a circuit\n"
788 "HMAC-MD5 authentication\n"
789 "Cleartext password\n"
790 "Circuit password\n")
792 int idx_encryption
= 2;
794 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
798 return CMD_ERR_NO_MATCH
;
800 if (argv
[idx_encryption
]->arg
[0] == 'm')
801 rv
= isis_circuit_passwd_hmac_md5_set(circuit
,
802 argv
[idx_word
]->arg
);
804 rv
= isis_circuit_passwd_cleartext_set(circuit
,
805 argv
[idx_word
]->arg
);
807 CMD_FERR_RETURN(rv
, "Failed to set circuit password: $ERR");
811 DEFUN (no_isis_passwd
,
813 "no " PROTO_NAME
" password [<md5|clear> WORD]",
816 "Configure the authentication password for a circuit\n"
817 "HMAC-MD5 authentication\n"
818 "Cleartext password\n"
819 "Circuit password\n")
821 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
823 return CMD_ERR_NO_MATCH
;
825 CMD_FERR_RETURN(isis_circuit_passwd_unset(circuit
),
826 "Failed to unset circuit password: $ERR");
832 PROTO_NAME
" metric (0-16777215)",
834 "Set default metric for circuit\n"
835 "Default metric value\n")
839 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
841 return CMD_ERR_NO_MATCH
;
843 met
= atoi(argv
[idx_number
]->arg
);
845 /* RFC3787 section 5.1 */
846 if (circuit
->area
&& circuit
->area
->oldmetric
== 1
847 && met
> MAX_NARROW_LINK_METRIC
) {
849 "Invalid metric %d - should be <0-63> when narrow metric type enabled\n",
851 return CMD_WARNING_CONFIG_FAILED
;
855 if (circuit
->area
&& circuit
->area
->newmetric
== 1
856 && met
> MAX_WIDE_LINK_METRIC
) {
858 "Invalid metric %d - should be <0-16777215> when wide metric type enabled\n",
860 return CMD_WARNING_CONFIG_FAILED
;
863 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_1
, met
),
864 "Failed to set L1 metric: $ERR");
865 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_2
, met
),
866 "Failed to set L2 metric: $ERR");
870 DEFUN (no_isis_metric
,
872 "no " PROTO_NAME
" metric [(0-16777215)]",
875 "Set default metric for circuit\n"
876 "Default metric value\n")
878 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
880 return CMD_ERR_NO_MATCH
;
882 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_1
,
883 DEFAULT_CIRCUIT_METRIC
),
884 "Failed to set L1 metric: $ERR");
885 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_2
,
886 DEFAULT_CIRCUIT_METRIC
),
887 "Failed to set L2 metric: $ERR");
891 DEFUN (isis_hello_interval
,
892 isis_hello_interval_cmd
,
893 PROTO_NAME
" hello-interval (1-600)",
895 "Set Hello interval\n"
896 "Holdtime 1 seconds, interval depends on multiplier\n")
898 uint32_t interval
= atoi(argv
[2]->arg
);
899 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
901 return CMD_ERR_NO_MATCH
;
903 circuit
->hello_interval
[0] = interval
;
904 circuit
->hello_interval
[1] = interval
;
909 DEFUN (no_isis_hello_interval
,
910 no_isis_hello_interval_cmd
,
911 "no " PROTO_NAME
" hello-interval [(1-600)]",
914 "Set Hello interval\n"
915 "Holdtime 1 second, interval depends on multiplier\n")
917 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
919 return CMD_ERR_NO_MATCH
;
921 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
922 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
927 DEFUN (isis_hello_multiplier
,
928 isis_hello_multiplier_cmd
,
929 PROTO_NAME
" hello-multiplier (2-100)",
931 "Set multiplier for Hello holding time\n"
932 "Hello multiplier value\n")
934 uint16_t mult
= atoi(argv
[2]->arg
);
935 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
937 return CMD_ERR_NO_MATCH
;
939 circuit
->hello_multiplier
[0] = mult
;
940 circuit
->hello_multiplier
[1] = mult
;
945 DEFUN (no_isis_hello_multiplier
,
946 no_isis_hello_multiplier_cmd
,
947 "no " PROTO_NAME
" hello-multiplier [(2-100)]",
950 "Set multiplier for Hello holding time\n"
951 "Hello multiplier value\n")
953 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
955 return CMD_ERR_NO_MATCH
;
957 circuit
->hello_multiplier
[0] = DEFAULT_HELLO_MULTIPLIER
;
958 circuit
->hello_multiplier
[1] = DEFAULT_HELLO_MULTIPLIER
;
963 DEFUN (csnp_interval
,
965 PROTO_NAME
" csnp-interval (1-600)",
967 "Set CSNP interval in seconds\n"
968 "CSNP interval value\n")
970 uint16_t interval
= atoi(argv
[2]->arg
);
971 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
973 return CMD_ERR_NO_MATCH
;
975 circuit
->csnp_interval
[0] = interval
;
976 circuit
->csnp_interval
[1] = interval
;
981 DEFUN (no_csnp_interval
,
982 no_csnp_interval_cmd
,
983 "no " PROTO_NAME
" csnp-interval [(1-600)]",
986 "Set CSNP interval in seconds\n"
987 "CSNP interval value\n")
989 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
991 return CMD_ERR_NO_MATCH
;
993 circuit
->csnp_interval
[0] = DEFAULT_CSNP_INTERVAL
;
994 circuit
->csnp_interval
[1] = DEFAULT_CSNP_INTERVAL
;
999 DEFUN (psnp_interval
,
1001 PROTO_NAME
" psnp-interval (1-120)",
1003 "Set PSNP interval in seconds\n"
1004 "PSNP interval value\n")
1006 uint16_t interval
= atoi(argv
[2]->arg
);
1007 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
1009 return CMD_ERR_NO_MATCH
;
1011 circuit
->psnp_interval
[0] = interval
;
1012 circuit
->psnp_interval
[1] = interval
;
1017 DEFUN (no_psnp_interval
,
1018 no_psnp_interval_cmd
,
1019 "no " PROTO_NAME
" psnp-interval [(1-120)]",
1022 "Set PSNP interval in seconds\n"
1023 "PSNP interval value\n")
1025 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
1027 return CMD_ERR_NO_MATCH
;
1029 circuit
->psnp_interval
[0] = DEFAULT_PSNP_INTERVAL
;
1030 circuit
->psnp_interval
[1] = DEFAULT_PSNP_INTERVAL
;
1035 DEFUN (circuit_topology
,
1036 circuit_topology_cmd
,
1037 PROTO_NAME
" topology " ISIS_MT_NAMES
,
1039 "Configure interface IS-IS topologies\n"
1040 ISIS_MT_DESCRIPTIONS
)
1042 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
1044 return CMD_ERR_NO_MATCH
;
1045 const char *arg
= argv
[2]->arg
;
1046 uint16_t mtid
= isis_str2mtid(arg
);
1048 if (circuit
->area
&& circuit
->area
->oldmetric
) {
1050 "Multi topology IS-IS can only be used with wide metrics\n");
1051 return CMD_WARNING_CONFIG_FAILED
;
1054 if (mtid
== (uint16_t)-1) {
1055 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1056 return CMD_WARNING_CONFIG_FAILED
;
1059 return isis_circuit_mt_enabled_set(circuit
, mtid
, true);
1062 DEFUN (no_circuit_topology
,
1063 no_circuit_topology_cmd
,
1064 "no " PROTO_NAME
" topology " ISIS_MT_NAMES
,
1067 "Configure interface IS-IS topologies\n"
1068 ISIS_MT_DESCRIPTIONS
)
1070 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
1072 return CMD_ERR_NO_MATCH
;
1073 const char *arg
= argv
[3]->arg
;
1074 uint16_t mtid
= isis_str2mtid(arg
);
1076 if (circuit
->area
&& circuit
->area
->oldmetric
) {
1078 "Multi topology IS-IS can only be used with wide metrics\n");
1079 return CMD_WARNING_CONFIG_FAILED
;
1082 if (mtid
== (uint16_t)-1) {
1083 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1084 return CMD_WARNING_CONFIG_FAILED
;
1087 return isis_circuit_mt_enabled_set(circuit
, mtid
, false);
1090 void isis_vty_daemon_init(void)
1092 install_element(ROUTER_NODE
, &fabric_tier_cmd
);
1093 install_element(ROUTER_NODE
, &no_fabric_tier_cmd
);
1094 install_element(ROUTER_NODE
, &triggered_csnp_cmd
);
1095 install_element(ROUTER_NODE
, &no_triggered_csnp_cmd
);
1097 install_element(ENABLE_NODE
, &show_lsp_flooding_cmd
);
1099 install_element(INTERFACE_NODE
, &ip_router_isis_cmd
);
1100 install_element(INTERFACE_NODE
, &ip6_router_isis_cmd
);
1101 install_element(INTERFACE_NODE
, &no_ip_router_isis_cmd
);
1102 install_element(INTERFACE_NODE
, &isis_bfd_cmd
);
1103 install_element(INTERFACE_NODE
, &no_isis_bfd_cmd
);
1105 install_element(ROUTER_NODE
, &set_overload_bit_cmd
);
1106 install_element(ROUTER_NODE
, &no_set_overload_bit_cmd
);
1108 install_element(ROUTER_NODE
, &domain_passwd_cmd
);
1109 install_element(ROUTER_NODE
, &no_domain_passwd_cmd
);
1111 install_element(ROUTER_NODE
, &lsp_gen_interval_cmd
);
1112 install_element(ROUTER_NODE
, &no_lsp_gen_interval_cmd
);
1114 install_element(ROUTER_NODE
, &lsp_refresh_interval_cmd
);
1115 install_element(ROUTER_NODE
, &no_lsp_refresh_interval_cmd
);
1117 install_element(ROUTER_NODE
, &max_lsp_lifetime_cmd
);
1118 install_element(ROUTER_NODE
, &no_max_lsp_lifetime_cmd
);
1120 install_element(ROUTER_NODE
, &area_lsp_mtu_cmd
);
1121 install_element(ROUTER_NODE
, &no_area_lsp_mtu_cmd
);
1123 install_element(ROUTER_NODE
, &spf_interval_cmd
);
1124 install_element(ROUTER_NODE
, &no_spf_interval_cmd
);
1126 install_element(ROUTER_NODE
, &spf_delay_ietf_cmd
);
1127 install_element(ROUTER_NODE
, &no_spf_delay_ietf_cmd
);
1129 install_element(ROUTER_NODE
, &area_purge_originator_cmd
);
1131 install_element(INTERFACE_NODE
, &isis_passive_cmd
);
1132 install_element(INTERFACE_NODE
, &no_isis_passive_cmd
);
1134 install_element(INTERFACE_NODE
, &isis_passwd_cmd
);
1135 install_element(INTERFACE_NODE
, &no_isis_passwd_cmd
);
1137 install_element(INTERFACE_NODE
, &isis_metric_cmd
);
1138 install_element(INTERFACE_NODE
, &no_isis_metric_cmd
);
1140 install_element(INTERFACE_NODE
, &isis_hello_interval_cmd
);
1141 install_element(INTERFACE_NODE
, &no_isis_hello_interval_cmd
);
1143 install_element(INTERFACE_NODE
, &isis_hello_multiplier_cmd
);
1144 install_element(INTERFACE_NODE
, &no_isis_hello_multiplier_cmd
);
1146 install_element(INTERFACE_NODE
, &csnp_interval_cmd
);
1147 install_element(INTERFACE_NODE
, &no_csnp_interval_cmd
);
1149 install_element(INTERFACE_NODE
, &psnp_interval_cmd
);
1150 install_element(INTERFACE_NODE
, &no_psnp_interval_cmd
);
1152 install_element(INTERFACE_NODE
, &circuit_topology_cmd
);
1153 install_element(INTERFACE_NODE
, &no_circuit_topology_cmd
);