diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-12-08 13:44:25 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-08 13:44:25 -0500 |
| commit | f7b0f4ef9e6efaafb77bf60ec897e931d340843b (patch) | |
| tree | 68638489ed5afd914d1e9e373bbd1544078ddc8d /lib/northbound_cli.c | |
| parent | 290e0a7b41048daef3d433fffd2ede1920981871 (diff) | |
| parent | 18bf258a0d83d92315ffac45ba23af71a3798456 (diff) | |
Merge pull request #3443 from opensourcerouting/show-command
lib: implement the "show" command
Diffstat (limited to 'lib/northbound_cli.c')
| -rw-r--r-- | lib/northbound_cli.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index 2cacc6b1dc..0d8345d39f 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -754,6 +754,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\ @@ -1468,6 +1492,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; |
