]> git.proxmox.com Git - mirror_frr.git/commitdiff
bfdd: convert `bfd` command to northbound
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Tue, 25 Jun 2019 12:34:14 +0000 (09:34 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Tue, 25 Jun 2019 12:34:14 +0000 (09:34 -0300)
This helps northbound to create the `bfd` node on the configuration
output sooner than adding a peer.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
bfdd/bfdd_cli.c
bfdd/bfdd_vty.c

index 15df0f769f6f91b36e51cd10066a63d16d2262bb..c2c3040ebcd0ae16b8cc29cdf218f2db13744161 100644 (file)
 /*
  * Functions.
  */
+DEFPY_NOSH(
+       bfd_enter, bfd_enter_cmd,
+       "bfd",
+       "Configure BFD peers\n")
+{
+       int ret;
+
+       nb_cli_enqueue_change(vty, "/frr-bfdd:bfdd/bfd", NB_OP_CREATE, NULL);
+       ret = nb_cli_apply_changes(vty, NULL);
+       if (ret == CMD_SUCCESS)
+               VTY_PUSH_XPATH(BFD_NODE, "/frr-bfdd:bfdd/bfd");
+
+       return ret;
+}
+
 DEFUN(
        bfd_config_reset, bfd_config_reset_cmd,
        "no bfd",
@@ -120,7 +135,7 @@ DEFPY_NOSH(
 
        nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
 
-       /* Apply settings immediatly. */
+       /* Apply settings immediately. */
        ret = nb_cli_apply_changes(vty, NULL);
        if (ret == CMD_SUCCESS)
                VTY_PUSH_XPATH(BFD_PEER_NODE, xpath);
@@ -376,6 +391,7 @@ void bfd_cli_show_echo_interval(struct vty *vty, struct lyd_node *dnode,
 void
 bfdd_cli_init(void)
 {
+       install_element(CONFIG_NODE, &bfd_enter_cmd);
        install_element(CONFIG_NODE, &bfd_config_reset_cmd);
 
        install_element(BFD_NODE, &bfd_peer_enter_cmd);
index c3ca7a43f1ff56f8331193bfb628e22e24ba785b..a211f34219af8ef8a99ef05b5b634b30b20b1675 100644 (file)
@@ -72,15 +72,6 @@ _find_peer_or_error(struct vty *vty, int argc, struct cmd_token **argv,
                    const char *local_str, const char *ifname,
                    const char *vrfname);
 
-/*
- * Commands definition.
- */
-DEFUN_NOSH(bfd_enter, bfd_enter_cmd, "bfd", "Configure BFD peers\n")
-{
-       vty->node = BFD_NODE;
-       return CMD_SUCCESS;
-}
-
 
 /*
  * Show commands helper functions
@@ -743,7 +734,6 @@ void bfdd_vty_init(void)
        install_element(ENABLE_NODE, &bfd_show_peer_counters_cmd);
        install_element(ENABLE_NODE, &bfd_show_peers_cmd);
        install_element(ENABLE_NODE, &bfd_show_peer_cmd);
-       install_element(CONFIG_NODE, &bfd_enter_cmd);
        install_element(ENABLE_NODE, &show_debugging_bfd_cmd);
 
        /* Install BFD node and commands. */