]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/northbound_cli.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / lib / northbound_cli.c
index 4a4adb423f1e4098c6b884c80fa105f11f411eba..acde0ead025ac47d62750a6baff0480a06995cd0 100644 (file)
@@ -71,7 +71,7 @@ void nb_cli_enqueue_change(struct vty *vty, const char *xpath,
        }
 
        change = &vty->cfg_changes[vty->num_cfg_changes++];
-       change->xpath = xpath;
+       strlcpy(change->xpath, xpath, sizeof(change->xpath));
        change->operation = operation;
        change->value = value;
 }
@@ -833,6 +833,30 @@ DEFPY (show_config_candidate,
        return CMD_SUCCESS;
 }
 
+DEFPY (show_config_candidate_section,
+       show_config_candidate_section_cmd,
+       "show",
+       SHOW_STR)
+{
+       struct lyd_node *dnode;
+
+       /* Top-level configuration node, display everything. */
+       if (vty->xpath_index == 0)
+               return nb_cli_show_config(vty, vty->candidate_config,
+                                         NB_CFG_FMT_CMDS, NULL, false);
+
+       /* Display only the current section of the candidate configuration. */
+       dnode = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH);
+       if (!dnode)
+               /* Shouldn't happen. */
+               return CMD_WARNING;
+
+       nb_cli_show_dnode_cmds(vty, dnode, 0);
+       vty_out(vty, "!\n");
+
+       return CMD_SUCCESS;
+}
+
 DEFPY (show_config_compare,
        show_config_compare_cmd,
        "show configuration compare\
@@ -1547,6 +1571,8 @@ static struct cmd_node nb_debug_node = {NORTHBOUND_DEBUG_NODE, "", 1};
 
 void nb_cli_install_default(int node)
 {
+       install_element(node, &show_config_candidate_section_cmd);
+
        if (frr_get_cli_mode() != FRR_CLI_TRANSACTIONAL)
                return;