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"
39 "Statically configure the tier to advertise\n"
40 "Tier to advertise\n")
42 VTY_DECLVAR_CONTEXT(isis_area
, area
);
44 uint8_t tier
= atoi(argv
[1]->arg
);
46 fabricd_configure_tier(area
, tier
);
50 DEFUN (no_fabric_tier
,
52 "no fabric-tier [(0-14)]",
54 "Statically configure the tier to advertise\n"
55 "Tier to advertise\n")
57 VTY_DECLVAR_CONTEXT(isis_area
, area
);
59 fabricd_configure_tier(area
, ISIS_TIER_UNDEFINED
);
63 DEFUN (triggered_csnp
,
65 "triggered-csnp-delay (100-10000) [always]",
66 "Configure the delay for triggered CSNPs\n"
67 "Delay in milliseconds\n"
68 "Trigger CSNP for all LSPs, not only circuit-scoped\n")
70 VTY_DECLVAR_CONTEXT(isis_area
, area
);
72 int csnp_delay
= atoi(argv
[1]->arg
);
73 bool always_send_csnp
= (argc
== 3);
75 fabricd_configure_triggered_csnp(area
, csnp_delay
, always_send_csnp
);
79 DEFUN (no_triggered_csnp
,
80 no_triggered_csnp_cmd
,
81 "no triggered-csnp-delay [(100-10000) [always]]",
83 "Configure the delay for triggered CSNPs\n"
84 "Delay in milliseconds\n"
85 "Trigger CSNP for all LSPs, not only circuit-scoped\n")
87 VTY_DECLVAR_CONTEXT(isis_area
, area
);
89 fabricd_configure_triggered_csnp(area
, FABRICD_DEFAULT_CSNP_DELAY
,
94 static void lsp_print_flooding(struct vty
*vty
, struct isis_lsp
*lsp
)
98 lspid_print(lsp
->hdr
.lsp_id
, lspid
, true, true);
99 vty_out(vty
, "Flooding information for %s\n", lspid
);
101 if (!lsp
->flooding_neighbors
[TX_LSP_NORMAL
]) {
102 vty_out(vty
, " Never received.\n");
106 vty_out(vty
, " Last received on: %s (",
107 lsp
->flooding_interface
?
108 lsp
->flooding_interface
: "(null)");
110 time_t uptime
= time(NULL
) - lsp
->flooding_time
;
111 struct tm
*tm
= gmtime(&uptime
);
113 if (uptime
< ONE_DAY_SECOND
)
114 vty_out(vty
, "%02d:%02d:%02d", tm
->tm_hour
, tm
->tm_min
,
116 else if (uptime
< ONE_WEEK_SECOND
)
117 vty_out(vty
, "%dd%02dh%02dm", tm
->tm_yday
, tm
->tm_hour
,
120 vty_out(vty
, "%02dw%dd%02dh", tm
->tm_yday
/ 7,
121 tm
->tm_yday
- ((tm
->tm_yday
/ 7) * 7),
123 vty_out(vty
, " ago)\n");
125 if (lsp
->flooding_circuit_scoped
) {
126 vty_out(vty
, " Received as circuit-scoped LSP, so not "
131 for (enum isis_tx_type type
= TX_LSP_NORMAL
;
132 type
<= TX_LSP_CIRCUIT_SCOPED
; type
++) {
133 struct listnode
*node
;
134 uint8_t *neighbor_id
;
136 vty_out(vty
, " %s:\n",
137 (type
== TX_LSP_NORMAL
) ? "RF" : "DNR");
138 for (ALL_LIST_ELEMENTS_RO(lsp
->flooding_neighbors
[type
],
139 node
, neighbor_id
)) {
140 vty_out(vty
, " %s\n",
141 print_sys_hostname(neighbor_id
));
146 DEFUN (show_lsp_flooding
,
147 show_lsp_flooding_cmd
,
148 "show openfabric flooding [WORD]",
151 "Flooding information\n"
154 const char *lspid
= NULL
;
157 lspid
= argv
[3]->arg
;
159 struct listnode
*node
;
160 struct isis_area
*area
;
162 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
163 dict_t
*lspdb
= area
->lspdb
[ISIS_LEVEL2
- 1];
165 vty_out(vty
, "Area %s:\n", area
->area_tag
?
166 area
->area_tag
: "null");
169 struct isis_lsp
*lsp
= lsp_for_arg(lspid
, lspdb
);
172 lsp_print_flooding(vty
, lsp
);
177 for (dnode_t
*dnode
= dict_first(lspdb
); dnode
;
178 dnode
= dict_next(lspdb
, dnode
)) {
179 lsp_print_flooding(vty
, dnode_get(dnode
));
187 DEFUN (ip_router_isis
,
189 "ip router " PROTO_NAME
" WORD",
190 "Interface Internet Protocol config commands\n"
191 "IP router interface commands\n"
193 "Routing process tag\n")
197 VTY_DECLVAR_CONTEXT(interface
, ifp
);
198 struct isis_circuit
*circuit
;
199 struct isis_area
*area
;
200 const char *af
= argv
[idx_afi
]->arg
;
201 const char *area_tag
= argv
[idx_word
]->arg
;
203 /* Prevent more than one area per circuit */
204 circuit
= circuit_scan_by_ifp(ifp
);
205 if (circuit
&& circuit
->area
) {
206 if (strcmp(circuit
->area
->area_tag
, area_tag
)) {
207 vty_out(vty
, "ISIS circuit is already defined on %s\n",
208 circuit
->area
->area_tag
);
209 return CMD_ERR_NOTHING_TODO
;
213 area
= isis_area_lookup(area_tag
);
215 area
= isis_area_create(area_tag
);
217 if (!circuit
|| !circuit
->area
) {
218 circuit
= isis_circuit_create(area
, ifp
);
220 if (circuit
->state
!= C_STATE_CONF
221 && circuit
->state
!= C_STATE_UP
) {
223 "Couldn't bring up interface, please check log.\n");
224 return CMD_WARNING_CONFIG_FAILED
;
228 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
234 isis_circuit_af_set(circuit
, ip
, ipv6
);
238 DEFUN (ip6_router_isis
,
240 "ipv6 router " PROTO_NAME
" WORD",
241 "Interface Internet Protocol config commands\n"
242 "IP router interface commands\n"
244 "Routing process tag\n")
246 return ip_router_isis(self
, vty
, argc
, argv
);
249 DEFUN (no_ip_router_isis
,
250 no_ip_router_isis_cmd
,
251 "no <ip|ipv6> router " PROTO_NAME
" WORD",
253 "Interface Internet Protocol config commands\n"
254 "IP router interface commands\n"
255 "IP router interface commands\n"
257 "Routing process tag\n")
261 VTY_DECLVAR_CONTEXT(interface
, ifp
);
262 struct isis_area
*area
;
263 struct isis_circuit
*circuit
;
264 const char *af
= argv
[idx_afi
]->arg
;
265 const char *area_tag
= argv
[idx_word
]->arg
;
267 area
= isis_area_lookup(area_tag
);
269 vty_out(vty
, "Can't find ISIS instance %s\n",
271 return CMD_ERR_NO_MATCH
;
274 circuit
= circuit_lookup_by_ifp(ifp
, area
->circuit_list
);
276 vty_out(vty
, "ISIS is not enabled on circuit %s\n", ifp
->name
);
277 return CMD_ERR_NO_MATCH
;
280 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
286 isis_circuit_af_set(circuit
, ip
, ipv6
);
290 DEFUN (set_overload_bit
,
291 set_overload_bit_cmd
,
293 "Set overload bit to avoid any transit traffic\n")
295 VTY_DECLVAR_CONTEXT(isis_area
, area
);
297 isis_area_overload_bit_set(area
, true);
301 DEFUN (no_set_overload_bit
,
302 no_set_overload_bit_cmd
,
303 "no set-overload-bit",
304 "Reset overload bit to accept transit traffic\n"
305 "Reset overload bit\n")
307 VTY_DECLVAR_CONTEXT(isis_area
, area
);
309 isis_area_overload_bit_set(area
, false);
313 static int isis_vty_password_set(struct vty
*vty
, int argc
,
314 struct cmd_token
*argv
[], int level
)
316 VTY_DECLVAR_CONTEXT(isis_area
, area
);
319 int idx_password
= 2;
320 int idx_snp_auth
= 5;
321 uint8_t snp_auth
= 0;
323 const char *passwd
= argv
[idx_password
]->arg
;
324 if (strlen(passwd
) > 254) {
325 vty_out(vty
, "Too long area password (>254)\n");
326 return CMD_WARNING_CONFIG_FAILED
;
329 if (argc
> idx_snp_auth
) {
330 snp_auth
= SNP_AUTH_SEND
;
331 if (strmatch(argv
[idx_snp_auth
]->text
, "validate"))
332 snp_auth
|= SNP_AUTH_RECV
;
335 if (strmatch(argv
[idx_algo
]->text
, "clear")) {
336 return isis_area_passwd_cleartext_set(area
, level
,
338 } else if (strmatch(argv
[idx_algo
]->text
, "md5")) {
339 return isis_area_passwd_hmac_md5_set(area
, level
,
343 return CMD_WARNING_CONFIG_FAILED
;
346 DEFUN (domain_passwd
,
348 "domain-password <clear|md5> WORD [authenticate snp <send-only|validate>]",
349 "Set the authentication password for a routing domain\n"
350 "Authentication type\n"
351 "Authentication type\n"
352 "Level-wide password\n"
355 "Send but do not check PDUs on receiving\n"
356 "Send and check PDUs on receiving\n")
358 return isis_vty_password_set(vty
, argc
, argv
, IS_LEVEL_2
);
361 DEFUN (no_domain_passwd
,
362 no_domain_passwd_cmd
,
363 "no domain-password",
365 "Set the authentication password for a routing domain\n")
367 VTY_DECLVAR_CONTEXT(isis_area
, area
);
369 return isis_area_passwd_unset(area
, IS_LEVEL_2
);
373 isis_vty_lsp_gen_interval_set(struct vty
*vty
, int level
, uint16_t interval
)
375 VTY_DECLVAR_CONTEXT(isis_area
, area
);
378 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
382 if (interval
>= area
->lsp_refresh
[lvl
- 1]) {
384 "LSP gen interval %us must be less than "
385 "the LSP refresh interval %us\n",
386 interval
, area
->lsp_refresh
[lvl
- 1]);
387 return CMD_WARNING_CONFIG_FAILED
;
391 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
394 area
->lsp_gen_interval
[lvl
- 1] = interval
;
400 DEFUN (lsp_gen_interval
,
401 lsp_gen_interval_cmd
,
402 "lsp-gen-interval (1-120)",
403 "Minimum interval between regenerating same LSP\n"
404 "Minimum interval in seconds\n")
406 uint16_t interval
= atoi(argv
[1]->arg
);
408 return isis_vty_lsp_gen_interval_set(vty
, IS_LEVEL_1_AND_2
, interval
);
411 DEFUN (no_lsp_gen_interval
,
412 no_lsp_gen_interval_cmd
,
413 "no lsp-gen-interval [(1-120)]",
415 "Minimum interval between regenerating same LSP\n"
416 "Minimum interval in seconds\n")
418 VTY_DECLVAR_CONTEXT(isis_area
, area
);
420 return isis_vty_lsp_gen_interval_set(vty
, IS_LEVEL_1_AND_2
,
421 DEFAULT_MIN_LSP_GEN_INTERVAL
);
425 isis_vty_lsp_refresh_set(struct vty
*vty
, int level
, uint16_t interval
)
427 VTY_DECLVAR_CONTEXT(isis_area
, area
);
430 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
433 if (interval
<= area
->lsp_gen_interval
[lvl
- 1]) {
435 "LSP refresh interval %us must be greater than "
436 "the configured LSP gen interval %us\n",
437 interval
, area
->lsp_gen_interval
[lvl
- 1]);
438 return CMD_WARNING_CONFIG_FAILED
;
440 if (interval
> (area
->max_lsp_lifetime
[lvl
- 1] - 300)) {
442 "LSP refresh interval %us must be less than "
443 "the configured LSP lifetime %us less 300\n",
444 interval
, area
->max_lsp_lifetime
[lvl
- 1]);
445 return CMD_WARNING_CONFIG_FAILED
;
449 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
452 isis_area_lsp_refresh_set(area
, lvl
, interval
);
458 DEFUN (lsp_refresh_interval
,
459 lsp_refresh_interval_cmd
,
460 "lsp-refresh-interval (1-65235)",
461 "LSP refresh interval\n"
462 "LSP refresh interval in seconds\n")
464 unsigned int interval
= atoi(argv
[1]->arg
);
465 return isis_vty_lsp_refresh_set(vty
, IS_LEVEL_1_AND_2
, interval
);
468 DEFUN (no_lsp_refresh_interval
,
469 no_lsp_refresh_interval_cmd
,
470 "no lsp-refresh-interval [(1-65235)]",
472 "LSP refresh interval\n"
473 "LSP refresh interval in seconds\n")
475 return isis_vty_lsp_refresh_set(vty
, IS_LEVEL_1_AND_2
,
476 DEFAULT_MAX_LSP_GEN_INTERVAL
);
480 isis_vty_max_lsp_lifetime_set(struct vty
*vty
, int level
, uint16_t interval
)
482 VTY_DECLVAR_CONTEXT(isis_area
, area
);
484 uint16_t refresh_interval
= interval
- 300;
485 int set_refresh_interval
[ISIS_LEVELS
] = {0, 0};
487 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++) {
491 if (refresh_interval
< area
->lsp_refresh
[lvl
- 1]) {
493 "Level %d Max LSP lifetime %us must be 300s greater than "
494 "the configured LSP refresh interval %us\n",
495 lvl
, interval
, area
->lsp_refresh
[lvl
- 1]);
497 "Automatically reducing level %d LSP refresh interval "
499 lvl
, refresh_interval
);
500 set_refresh_interval
[lvl
- 1] = 1;
503 <= area
->lsp_gen_interval
[lvl
- 1]) {
505 "LSP refresh interval %us must be greater than "
506 "the configured LSP gen interval %us\n",
508 area
->lsp_gen_interval
[lvl
- 1]);
509 return CMD_WARNING_CONFIG_FAILED
;
514 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++) {
517 isis_area_max_lsp_lifetime_set(area
, lvl
, interval
);
518 if (set_refresh_interval
[lvl
- 1])
519 isis_area_lsp_refresh_set(area
, lvl
, refresh_interval
);
525 DEFUN (max_lsp_lifetime
,
526 max_lsp_lifetime_cmd
,
527 "max-lsp-lifetime (350-65535)",
528 "Maximum LSP lifetime\n"
529 "LSP lifetime in seconds\n")
531 int lifetime
= atoi(argv
[1]->arg
);
533 return isis_vty_max_lsp_lifetime_set(vty
, IS_LEVEL_1_AND_2
, lifetime
);
537 DEFUN (no_max_lsp_lifetime
,
538 no_max_lsp_lifetime_cmd
,
539 "no max-lsp-lifetime [(350-65535)]",
541 "Maximum LSP lifetime\n"
542 "LSP lifetime in seconds\n")
544 return isis_vty_max_lsp_lifetime_set(vty
, IS_LEVEL_1_AND_2
,
545 DEFAULT_LSP_LIFETIME
);
550 "spf-interval (1-120)",
551 "Minimum interval between SPF calculations\n"
552 "Minimum interval between consecutive SPFs in seconds\n")
554 VTY_DECLVAR_CONTEXT(isis_area
, area
);
555 uint16_t interval
= atoi(argv
[1]->arg
);
557 area
->min_spf_interval
[0] = interval
;
558 area
->min_spf_interval
[1] = interval
;
563 DEFUN (no_spf_interval
,
565 "no spf-interval [(1-120)]",
567 "Minimum interval between SPF calculations\n"
568 "Minimum interval between consecutive SPFs in seconds\n")
570 VTY_DECLVAR_CONTEXT(isis_area
, area
);
572 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
573 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
578 static int isis_vty_lsp_mtu_set(struct vty
*vty
, unsigned int lsp_mtu
)
580 VTY_DECLVAR_CONTEXT(isis_area
, area
);
581 struct listnode
*node
;
582 struct isis_circuit
*circuit
;
584 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
)) {
585 if (circuit
->state
!= C_STATE_INIT
586 && circuit
->state
!= C_STATE_UP
)
588 if (lsp_mtu
> isis_circuit_pdu_size(circuit
)) {
590 "ISIS area contains circuit %s, which has a maximum PDU size of %zu.\n",
591 circuit
->interface
->name
,
592 isis_circuit_pdu_size(circuit
));
593 return CMD_WARNING_CONFIG_FAILED
;
597 isis_area_lsp_mtu_set(area
, lsp_mtu
);
603 "lsp-mtu (128-4352)",
604 "Configure the maximum size of generated LSPs\n"
605 "Maximum size of generated LSPs\n")
608 unsigned int lsp_mtu
;
610 lsp_mtu
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
612 return isis_vty_lsp_mtu_set(vty
, lsp_mtu
);
615 DEFUN (no_area_lsp_mtu
,
617 "no lsp-mtu [(128-4352)]",
619 "Configure the maximum size of generated LSPs\n"
620 "Maximum size of generated LSPs\n")
622 return isis_vty_lsp_mtu_set(vty
, DEFAULT_LSP_MTU
);
625 DEFUN (no_spf_delay_ietf
,
626 no_spf_delay_ietf_cmd
,
629 "IETF SPF delay algorithm\n")
631 VTY_DECLVAR_CONTEXT(isis_area
, area
);
633 spf_backoff_free(area
->spf_delay_ietf
[0]);
634 spf_backoff_free(area
->spf_delay_ietf
[1]);
635 area
->spf_delay_ietf
[0] = NULL
;
636 area
->spf_delay_ietf
[1] = NULL
;
641 DEFUN (spf_delay_ietf
,
643 "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)",
644 "IETF SPF delay algorithm\n"
645 "Delay used while in QUIET state\n"
646 "Delay used while in QUIET state in milliseconds\n"
647 "Delay used while in SHORT_WAIT state\n"
648 "Delay used while in SHORT_WAIT state in milliseconds\n"
649 "Delay used while in LONG_WAIT\n"
650 "Delay used while in LONG_WAIT state in milliseconds\n"
651 "Time with no received IGP events before considering IGP stable\n"
652 "Time with no received IGP events before considering IGP stable (in milliseconds)\n"
653 "Maximum duration needed to learn all the events related to a single failure\n"
654 "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n")
656 VTY_DECLVAR_CONTEXT(isis_area
, area
);
658 long init_delay
= atol(argv
[2]->arg
);
659 long short_delay
= atol(argv
[4]->arg
);
660 long long_delay
= atol(argv
[6]->arg
);
661 long holddown
= atol(argv
[8]->arg
);
662 long timetolearn
= atol(argv
[10]->arg
);
664 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
665 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
667 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
668 spf_backoff_free(area
->spf_delay_ietf
[0]);
669 area
->spf_delay_ietf
[0] =
670 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
671 long_delay
, holddown
, timetolearn
);
673 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
674 spf_backoff_free(area
->spf_delay_ietf
[1]);
675 area
->spf_delay_ietf
[1] =
676 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
677 long_delay
, holddown
, timetolearn
);
679 XFREE(MTYPE_TMP
, buf
);
683 DEFUN (area_purge_originator
,
684 area_purge_originator_cmd
,
685 "[no] purge-originator",
687 "Use the RFC 6232 purge-originator\n")
689 VTY_DECLVAR_CONTEXT(isis_area
, area
);
691 area
->purge_originator
= !!strcmp(argv
[0]->text
, "no");
697 PROTO_NAME
" passive",
699 "Configure the passive mode for interface\n")
701 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
703 return CMD_ERR_NO_MATCH
;
705 CMD_FERR_RETURN(isis_circuit_passive_set(circuit
, 1),
706 "Cannot set passive: $ERR");
710 DEFUN (no_isis_passive
,
712 "no " PROTO_NAME
" passive",
715 "Configure the passive mode for interface\n")
717 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
719 return CMD_ERR_NO_MATCH
;
721 CMD_FERR_RETURN(isis_circuit_passive_set(circuit
, 0),
722 "Cannot set no passive: $ERR");
728 PROTO_NAME
" password <md5|clear> WORD",
730 "Configure the authentication password for a circuit\n"
731 "HMAC-MD5 authentication\n"
732 "Cleartext password\n"
733 "Circuit password\n")
735 int idx_encryption
= 2;
737 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
741 return CMD_ERR_NO_MATCH
;
743 if (argv
[idx_encryption
]->arg
[0] == 'm')
744 rv
= isis_circuit_passwd_hmac_md5_set(circuit
,
745 argv
[idx_word
]->arg
);
747 rv
= isis_circuit_passwd_cleartext_set(circuit
,
748 argv
[idx_word
]->arg
);
750 CMD_FERR_RETURN(rv
, "Failed to set circuit password: $ERR");
754 DEFUN (no_isis_passwd
,
756 "no " PROTO_NAME
" password [<md5|clear> WORD]",
759 "Configure the authentication password for a circuit\n"
760 "HMAC-MD5 authentication\n"
761 "Cleartext password\n"
762 "Circuit password\n")
764 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
766 return CMD_ERR_NO_MATCH
;
768 CMD_FERR_RETURN(isis_circuit_passwd_unset(circuit
),
769 "Failed to unset circuit password: $ERR");
775 PROTO_NAME
" metric (0-16777215)",
777 "Set default metric for circuit\n"
778 "Default metric value\n")
782 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
784 return CMD_ERR_NO_MATCH
;
786 met
= atoi(argv
[idx_number
]->arg
);
788 /* RFC3787 section 5.1 */
789 if (circuit
->area
&& circuit
->area
->oldmetric
== 1
790 && met
> MAX_NARROW_LINK_METRIC
) {
792 "Invalid metric %d - should be <0-63> "
793 "when narrow metric type enabled\n",
795 return CMD_WARNING_CONFIG_FAILED
;
799 if (circuit
->area
&& circuit
->area
->newmetric
== 1
800 && met
> MAX_WIDE_LINK_METRIC
) {
802 "Invalid metric %d - should be <0-16777215> "
803 "when wide metric type enabled\n",
805 return CMD_WARNING_CONFIG_FAILED
;
808 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_1
, met
),
809 "Failed to set L1 metric: $ERR");
810 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_2
, met
),
811 "Failed to set L2 metric: $ERR");
815 DEFUN (no_isis_metric
,
817 "no " PROTO_NAME
" metric [(0-16777215)]",
820 "Set default metric for circuit\n"
821 "Default metric value\n")
823 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
825 return CMD_ERR_NO_MATCH
;
827 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_1
,
828 DEFAULT_CIRCUIT_METRIC
),
829 "Failed to set L1 metric: $ERR");
830 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_2
,
831 DEFAULT_CIRCUIT_METRIC
),
832 "Failed to set L2 metric: $ERR");
836 DEFUN (isis_hello_interval
,
837 isis_hello_interval_cmd
,
838 PROTO_NAME
" hello-interval (1-600)",
840 "Set Hello interval\n"
841 "Holdtime 1 seconds, interval depends on multiplier\n")
843 uint32_t interval
= atoi(argv
[2]->arg
);
844 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
846 return CMD_ERR_NO_MATCH
;
848 circuit
->hello_interval
[0] = interval
;
849 circuit
->hello_interval
[1] = interval
;
854 DEFUN (no_isis_hello_interval
,
855 no_isis_hello_interval_cmd
,
856 "no " PROTO_NAME
" hello-interval [(1-600)]",
859 "Set Hello interval\n"
860 "Holdtime 1 second, interval depends on multiplier\n")
862 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
864 return CMD_ERR_NO_MATCH
;
866 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
867 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
872 void isis_vty_daemon_init(void)
874 install_element(ROUTER_NODE
, &fabric_tier_cmd
);
875 install_element(ROUTER_NODE
, &no_fabric_tier_cmd
);
876 install_element(ROUTER_NODE
, &triggered_csnp_cmd
);
877 install_element(ROUTER_NODE
, &no_triggered_csnp_cmd
);
879 install_element(ENABLE_NODE
, &show_lsp_flooding_cmd
);
881 install_element(INTERFACE_NODE
, &ip_router_isis_cmd
);
882 install_element(INTERFACE_NODE
, &ip6_router_isis_cmd
);
883 install_element(INTERFACE_NODE
, &no_ip_router_isis_cmd
);
885 install_element(ROUTER_NODE
, &set_overload_bit_cmd
);
886 install_element(ROUTER_NODE
, &no_set_overload_bit_cmd
);
888 install_element(ROUTER_NODE
, &domain_passwd_cmd
);
889 install_element(ROUTER_NODE
, &no_domain_passwd_cmd
);
891 install_element(ROUTER_NODE
, &lsp_gen_interval_cmd
);
892 install_element(ROUTER_NODE
, &no_lsp_gen_interval_cmd
);
894 install_element(ROUTER_NODE
, &lsp_refresh_interval_cmd
);
895 install_element(ROUTER_NODE
, &no_lsp_refresh_interval_cmd
);
897 install_element(ROUTER_NODE
, &max_lsp_lifetime_cmd
);
898 install_element(ROUTER_NODE
, &no_max_lsp_lifetime_cmd
);
900 install_element(ROUTER_NODE
, &area_lsp_mtu_cmd
);
901 install_element(ROUTER_NODE
, &no_area_lsp_mtu_cmd
);
903 install_element(ROUTER_NODE
, &spf_interval_cmd
);
904 install_element(ROUTER_NODE
, &no_spf_interval_cmd
);
906 install_element(ROUTER_NODE
, &spf_delay_ietf_cmd
);
907 install_element(ROUTER_NODE
, &no_spf_delay_ietf_cmd
);
909 install_element(ROUTER_NODE
, &area_purge_originator_cmd
);
911 install_element(INTERFACE_NODE
, &isis_passive_cmd
);
912 install_element(INTERFACE_NODE
, &no_isis_passive_cmd
);
914 install_element(INTERFACE_NODE
, &isis_passwd_cmd
);
915 install_element(INTERFACE_NODE
, &no_isis_passwd_cmd
);
917 install_element(INTERFACE_NODE
, &isis_metric_cmd
);
918 install_element(INTERFACE_NODE
, &no_isis_metric_cmd
);
920 install_element(INTERFACE_NODE
, &isis_hello_interval_cmd
);
921 install_element(INTERFACE_NODE
, &no_isis_hello_interval_cmd
);