From a22f5a5289a59ef01986616a34ee863fe24bd874 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Wed, 15 Nov 2023 02:14:22 +0100 Subject: [PATCH] mgmtd: add node for writing configuration Signed-off-by: Igor Ryzhov --- lib/command.h | 1 + mgmtd/mgmt_vty.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/command.h b/lib/command.h index 0da838feb1..91d22c5926 100644 --- a/lib/command.h +++ b/lib/command.h @@ -176,6 +176,7 @@ enum node_type { BMP_NODE, /* BMP config under router bgp */ ISIS_SRV6_NODE, /* ISIS SRv6 node */ ISIS_SRV6_NODE_MSD_NODE, /* ISIS SRv6 Node MSDs node */ + MGMTD_NODE, /* MGMTD node. */ NODE_TYPE_MAX, /* maximum */ }; /* clang-format on */ diff --git a/mgmtd/mgmt_vty.c b/mgmtd/mgmt_vty.c index a637898f8c..0f6df9f129 100644 --- a/mgmtd/mgmt_vty.c +++ b/mgmtd/mgmt_vty.c @@ -462,6 +462,24 @@ static void mgmt_config_read_in(struct event *event) } } +static int mgmtd_config_write(struct vty *vty) +{ + struct lyd_node *root; + + LY_LIST_FOR (running_config->dnode, root) { + nb_cli_show_dnode_cmds(vty, root, false); + } + + return 1; +} + +static struct cmd_node mgmtd_node = { + .name = "mgmtd", + .node = MGMTD_NODE, + .prompt = "", + .config_write = mgmtd_config_write, +}; + void mgmt_vty_init(void) { /* @@ -479,6 +497,7 @@ void mgmt_vty_init(void) &mgmt_daemon_info->read_in); install_node(&debug_node); + install_node(&mgmtd_node); install_element(VIEW_NODE, &show_mgmt_be_adapter_cmd); install_element(VIEW_NODE, &show_mgmt_be_xpath_reg_cmd); -- 2.39.5