diff options
| -rw-r--r-- | isisd/fabricd.h | 2 | ||||
| -rw-r--r-- | isisd/isis_cli.c | 35 | ||||
| -rw-r--r-- | isisd/isis_cli.h | 2 | ||||
| -rw-r--r-- | isisd/isis_main.c | 5 | ||||
| -rw-r--r-- | isisd/isis_northbound.c | 37 | ||||
| -rw-r--r-- | isisd/isis_vty_common.c | 109 | ||||
| -rw-r--r-- | isisd/isis_vty_common.h | 32 | ||||
| -rw-r--r-- | isisd/isis_vty_fabricd.c | 67 | ||||
| -rw-r--r-- | isisd/subdir.am | 3 | ||||
| -rw-r--r-- | yang/frr-isisd.yang | 6 |
10 files changed, 151 insertions, 147 deletions
diff --git a/isisd/fabricd.h b/isisd/fabricd.h index 315cfba3f0..6e93440f3a 100644 --- a/isisd/fabricd.h +++ b/isisd/fabricd.h @@ -53,4 +53,6 @@ void fabricd_update_lsp_no_flood(struct isis_lsp *lsp, void fabricd_configure_triggered_csnp(struct isis_area *area, int delay, bool always_send_csnp); void fabricd_init(void); +void isis_vty_daemon_init(void); + #endif diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index 0334b98a12..4b43260773 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -333,6 +333,40 @@ void cli_show_ip_isis_ipv6(struct vty *vty, struct lyd_node *dnode, } /* + * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring + */ +DEFPY(isis_bfd, + isis_bfd_cmd, + "[no] isis bfd", + NO_STR + PROTO_HELP + "Enable BFD support\n") +{ + const struct lyd_node *dnode; + + dnode = yang_dnode_get(vty->candidate_config->dnode, + "%s/frr-isisd:isis", VTY_CURR_XPATH); + if (dnode == NULL) { + vty_out(vty, "ISIS is not enabled on this circuit\n"); + return CMD_SUCCESS; + } + + nb_cli_enqueue_change(vty, "./frr-isisd:isis/bfd-monitoring", + NB_OP_MODIFY, no ? "false" : "true"); + + return nb_cli_apply_changes(vty, NULL); +} + +void cli_show_ip_isis_bfd_monitoring(struct vty *vty, struct lyd_node *dnode, + bool show_defaults) +{ + if (!yang_dnode_get_bool(dnode, NULL)) + vty_out(vty, " no"); + + vty_out(vty, "isis bfd\n"); +} + +/* * XPath: /frr-isisd:isis/instance/area-address */ DEFPY(net, net_cmd, "[no] net WORD", @@ -1949,6 +1983,7 @@ void isis_cli_init(void) install_element(INTERFACE_NODE, &ip_router_isis_cmd); install_element(INTERFACE_NODE, &ip6_router_isis_cmd); install_element(INTERFACE_NODE, &no_ip_router_isis_cmd); + install_element(INTERFACE_NODE, &isis_bfd_cmd); install_element(ISIS_NODE, &net_cmd); diff --git a/isisd/isis_cli.h b/isisd/isis_cli.h index 8dadf60981..6621dc0fc0 100644 --- a/isisd/isis_cli.h +++ b/isisd/isis_cli.h @@ -27,6 +27,8 @@ void cli_show_ip_isis_ipv4(struct vty *vty, struct lyd_node *dnode, bool show_defaults); void cli_show_ip_isis_ipv6(struct vty *vty, struct lyd_node *dnode, bool show_defaults); +void cli_show_ip_isis_bfd_monitoring(struct vty *vty, struct lyd_node *dnode, + bool show_defaults); void cli_show_isis_area_address(struct vty *vty, struct lyd_node *dnode, bool show_defaults); void cli_show_isis_is_type(struct vty *vty, struct lyd_node *dnode, diff --git a/isisd/isis_main.c b/isisd/isis_main.c index 48ae760173..7f49e9d89a 100644 --- a/isisd/isis_main.c +++ b/isisd/isis_main.c @@ -53,7 +53,6 @@ #include "isisd/isis_zebra.h" #include "isisd/isis_te.h" #include "isisd/isis_errors.h" -#include "isisd/isis_vty_common.h" #include "isisd/isis_bfd.h" #include "isisd/isis_lsp.h" #include "isisd/isis_mt.h" @@ -230,7 +229,9 @@ int main(int argc, char **argv, char **envp) prefix_list_init(); isis_init(); isis_circuit_init(); - isis_vty_init(); +#ifdef FABRICD + isis_vty_daemon_init(); +#endif /* FABRICD */ #ifndef FABRICD isis_cli_init(); #endif /* ifdef FABRICD */ diff --git a/isisd/isis_northbound.c b/isisd/isis_northbound.c index ffc6ee0464..0982a468a6 100644 --- a/isisd/isis_northbound.c +++ b/isisd/isis_northbound.c @@ -25,6 +25,8 @@ #include "libfrr.h" #include "linklist.h" #include "log.h" +#include "lib/bfd.h" +#include "isisd/isis_bfd.h" #include "isisd/isis_constants.h" #include "isisd/isis_common.h" #include "isisd/isis_flags.h" @@ -1703,6 +1705,34 @@ static int lib_interface_isis_ipv6_routing_modify(enum nb_event event, } /* + * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring + */ +static int lib_interface_isis_bfd_monitoring_modify(enum nb_event event, + const struct lyd_node *dnode, + union nb_resource *resource) +{ + struct isis_circuit *circuit; + bool bfd_monitoring; + + if (event != NB_EV_APPLY) + return NB_OK; + + circuit = nb_running_get_entry(dnode, NULL, true); + bfd_monitoring = yang_dnode_get_bool(dnode, NULL); + + if (bfd_monitoring) { + isis_bfd_circuit_param_set(circuit, BFD_DEF_MIN_RX, + BFD_DEF_MIN_TX, BFD_DEF_DETECT_MULT, + true); + } else { + isis_bfd_circuit_cmd(circuit, ZEBRA_BFD_DEST_DEREGISTER); + bfd_info_free(&circuit->bfd_info); + } + + return NB_OK; +} + +/* * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-1 */ static int @@ -3212,6 +3242,13 @@ const struct frr_yang_module_info frr_isisd_info = { }, }, { + .xpath = "/frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring", + .cbs = { + .modify = lib_interface_isis_bfd_monitoring_modify, + .cli_show = cli_show_ip_isis_bfd_monitoring, + } + }, + { .xpath = "/frr-interface:lib/interface/frr-isisd:isis/csnp-interval", .cbs = { .cli_show = cli_show_ip_isis_csnp_interval, diff --git a/isisd/isis_vty_common.c b/isisd/isis_vty_common.c deleted file mode 100644 index 06432db0b2..0000000000 --- a/isisd/isis_vty_common.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * IS-IS Rout(e)ing protocol - isis_vty_common.c - * - * This file contains the CLI that is shared between OpenFabric and IS-IS - * - * Copyright (C) 2001,2002 Sampo Saaristo - * Tampere University of Technology - * Institute of Communications Engineering - * Copyright (C) 2016 David Lamparter, for NetDEF, Inc. - * Copyright (C) 2018 Christian Franke, for NetDEF, Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public Licenseas published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; see the file COPYING; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <zebra.h> - -#include "command.h" -#include "bfd.h" - -#include "isis_circuit.h" -#include "isis_csm.h" -#include "isis_misc.h" -#include "isisd.h" -#include "isis_bfd.h" -#include "isis_vty_common.h" - -struct isis_circuit *isis_circuit_lookup(struct vty *vty) -{ - struct interface *ifp = VTY_GET_CONTEXT(interface); - struct isis_circuit *circuit; - - if (!ifp) { - vty_out(vty, "Invalid interface \n"); - return NULL; - } - - circuit = circuit_scan_by_ifp(ifp); - if (!circuit) { - vty_out(vty, "ISIS is not enabled on circuit %s\n", ifp->name); - return NULL; - } - - return circuit; -} - -DEFUN (isis_bfd, - isis_bfd_cmd, - PROTO_NAME " bfd", - PROTO_HELP - "Enable BFD support\n") -{ - struct isis_circuit *circuit = isis_circuit_lookup(vty); - - if (!circuit) - return CMD_ERR_NO_MATCH; - - if (circuit->bfd_info - && CHECK_FLAG(circuit->bfd_info->flags, BFD_FLAG_PARAM_CFG)) { - return CMD_SUCCESS; - } - - isis_bfd_circuit_param_set(circuit, BFD_DEF_MIN_RX, - BFD_DEF_MIN_TX, BFD_DEF_DETECT_MULT, true); - - return CMD_SUCCESS; -} - -DEFUN (no_isis_bfd, - no_isis_bfd_cmd, - "no " PROTO_NAME " bfd", - NO_STR - PROTO_HELP - "Disables BFD support\n" -) -{ - struct isis_circuit *circuit = isis_circuit_lookup(vty); - - if (!circuit) - return CMD_ERR_NO_MATCH; - - if (!circuit->bfd_info) - return CMD_SUCCESS; - - isis_bfd_circuit_cmd(circuit, ZEBRA_BFD_DEST_DEREGISTER); - bfd_info_free(&circuit->bfd_info); - return CMD_SUCCESS; -} - -void isis_vty_init(void) -{ - install_element(INTERFACE_NODE, &isis_bfd_cmd); - install_element(INTERFACE_NODE, &no_isis_bfd_cmd); - -#ifdef FABRICD - isis_vty_daemon_init(); -#endif /* ifdef FABRICD */ -} diff --git a/isisd/isis_vty_common.h b/isisd/isis_vty_common.h deleted file mode 100644 index 297da0e2c1..0000000000 --- a/isisd/isis_vty_common.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * IS-IS Rout(e)ing protocol - isis_vty_common.h - * - * Copyright (C) 2001,2002 Sampo Saaristo - * Tampere University of Technology - * Institute of Communications Engineering - * Copyright (C) 2016 David Lamparter, for NetDEF, Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public Licenseas published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; see the file COPYING; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef ISIS_VTY_COMMON_H -#define ISIS_VTY_COMMON_H - -struct isis_circuit *isis_circuit_lookup(struct vty *vty); - -void isis_vty_daemon_init(void); -void isis_vty_init(void); - -#endif diff --git a/isisd/isis_vty_fabricd.c b/isisd/isis_vty_fabricd.c index 431ad9712a..24e5c51947 100644 --- a/isisd/isis_vty_fabricd.c +++ b/isisd/isis_vty_fabricd.c @@ -23,8 +23,9 @@ #include "command.h" +#include "lib/bfd.h" +#include "isisd/isis_bfd.h" #include "isisd/isisd.h" -#include "isisd/isis_vty_common.h" #include "isisd/fabricd.h" #include "isisd/isis_tlvs.h" #include "isisd/isis_misc.h" @@ -34,6 +35,25 @@ #include "lib/spf_backoff.h" #include "isisd/isis_mt.h" +static struct isis_circuit *isis_circuit_lookup(struct vty *vty) +{ + struct interface *ifp = VTY_GET_CONTEXT(interface); + struct isis_circuit *circuit; + + if (!ifp) { + vty_out(vty, "Invalid interface \n"); + return NULL; + } + + circuit = circuit_scan_by_ifp(ifp); + if (!circuit) { + vty_out(vty, "ISIS is not enabled on circuit %s\n", ifp->name); + return NULL; + } + + return circuit; +} + DEFUN (fabric_tier, fabric_tier_cmd, "fabric-tier (0-14)", @@ -288,6 +308,49 @@ DEFUN (no_ip_router_isis, return CMD_SUCCESS; } +DEFUN (isis_bfd, + isis_bfd_cmd, + PROTO_NAME " bfd", + PROTO_HELP + "Enable BFD support\n") +{ + struct isis_circuit *circuit = isis_circuit_lookup(vty); + + if (!circuit) + return CMD_ERR_NO_MATCH; + + if (circuit->bfd_info + && CHECK_FLAG(circuit->bfd_info->flags, BFD_FLAG_PARAM_CFG)) { + return CMD_SUCCESS; + } + + isis_bfd_circuit_param_set(circuit, BFD_DEF_MIN_RX, + BFD_DEF_MIN_TX, BFD_DEF_DETECT_MULT, true); + + return CMD_SUCCESS; +} + +DEFUN (no_isis_bfd, + no_isis_bfd_cmd, + "no " PROTO_NAME " bfd", + NO_STR + PROTO_HELP + "Disables BFD support\n" +) +{ + struct isis_circuit *circuit = isis_circuit_lookup(vty); + + if (!circuit) + return CMD_ERR_NO_MATCH; + + if (!circuit->bfd_info) + return CMD_SUCCESS; + + isis_bfd_circuit_cmd(circuit, ZEBRA_BFD_DEST_DEREGISTER); + bfd_info_free(&circuit->bfd_info); + return CMD_SUCCESS; +} + DEFUN (set_overload_bit, set_overload_bit_cmd, "set-overload-bit", @@ -1045,6 +1108,8 @@ void isis_vty_daemon_init(void) install_element(INTERFACE_NODE, &ip_router_isis_cmd); install_element(INTERFACE_NODE, &ip6_router_isis_cmd); install_element(INTERFACE_NODE, &no_ip_router_isis_cmd); + install_element(INTERFACE_NODE, &isis_bfd_cmd); + install_element(INTERFACE_NODE, &no_isis_bfd_cmd); install_element(ROUTER_NODE, &set_overload_bit_cmd); install_element(ROUTER_NODE, &no_set_overload_bit_cmd); diff --git a/isisd/subdir.am b/isisd/subdir.am index bae56309cf..24f24022a5 100644 --- a/isisd/subdir.am +++ b/isisd/subdir.am @@ -11,7 +11,6 @@ vtysh_scan += \ $(top_srcdir)/isisd/isis_redist.c \ $(top_srcdir)/isisd/isis_spf.c \ $(top_srcdir)/isisd/isis_te.c \ - $(top_srcdir)/isisd/isis_vty_common.c \ $(top_srcdir)/isisd/isis_vty_fabricd.c \ $(top_srcdir)/isisd/isisd.c \ # end @@ -51,7 +50,6 @@ noinst_HEADERS += \ isisd/isis_te.h \ isisd/isis_tlvs.h \ isisd/isis_tx_queue.h \ - isisd/isis_vty_common.h \ isisd/isis_zebra.h \ isisd/isisd.h \ isisd/iso_checksum.h \ @@ -82,7 +80,6 @@ LIBISIS_SOURCES = \ isisd/isis_te.c \ isisd/isis_tlvs.c \ isisd/isis_tx_queue.c \ - isisd/isis_vty_common.c \ isisd/isis_zebra.c \ isisd/isisd.c \ isisd/iso_checksum.c \ diff --git a/yang/frr-isisd.yang b/yang/frr-isisd.yang index 7b132cb61e..05a896a1db 100644 --- a/yang/frr-isisd.yang +++ b/yang/frr-isisd.yang @@ -756,6 +756,12 @@ module frr-isisd { "IS-type of this circuit."; } + leaf bfd-monitoring { + type boolean; + default false; + description "Monitor IS-IS peers on this circuit."; + } + container csnp-interval { description "Complete Sequence Number PDU (CSNP) generation interval."; |
