From 8222b997c7e6c04ec35a3f00d1f9aeeb76003eb7 Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Fri, 12 Jul 2019 17:24:17 -0300 Subject: [PATCH] isisd: improvements based on feedback * Remove sanity checks that are already done by northbound; * Show error message on circuit absence; * Use a better idiom for the configuration display code; Signed-off-by: Rafael Zalamena --- isisd/isis_cli.c | 13 +++++++------ isisd/isis_northbound.c | 8 -------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index 7ca4c8795c..4b43260773 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -346,8 +346,10 @@ DEFPY(isis_bfd, dnode = yang_dnode_get(vty->candidate_config->dnode, "%s/frr-isisd:isis", VTY_CURR_XPATH); - if (dnode == NULL) + 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"); @@ -358,11 +360,10 @@ DEFPY(isis_bfd, void cli_show_ip_isis_bfd_monitoring(struct vty *vty, struct lyd_node *dnode, bool show_defaults) { - if (show_defaults == false) - vty_out(vty, " %s" PROTO_NAME " bfd\n", - yang_dnode_get_bool(dnode, NULL) ? "" : "no "); - else - vty_out(vty, " no " PROTO_NAME " bfd\n"); + if (!yang_dnode_get_bool(dnode, NULL)) + vty_out(vty, " no"); + + vty_out(vty, "isis bfd\n"); } /* diff --git a/isisd/isis_northbound.c b/isisd/isis_northbound.c index d596aecc1c..0982a468a6 100644 --- a/isisd/isis_northbound.c +++ b/isisd/isis_northbound.c @@ -1721,18 +1721,10 @@ static int lib_interface_isis_bfd_monitoring_modify(enum nb_event event, bfd_monitoring = yang_dnode_get_bool(dnode, NULL); if (bfd_monitoring) { - /* Sanity check: BFD session is already registered. */ - if (circuit->bfd_info != NULL) - return NB_OK; - isis_bfd_circuit_param_set(circuit, BFD_DEF_MIN_RX, BFD_DEF_MIN_TX, BFD_DEF_DETECT_MULT, true); } else { - /* Sanity check: no BFD session was registered. */ - if (circuit->bfd_info == NULL) - return NB_OK; - isis_bfd_circuit_cmd(circuit, ZEBRA_BFD_DEST_DEREGISTER); bfd_info_free(&circuit->bfd_info); } -- 2.39.5