diff options
Diffstat (limited to 'mgmtd/mgmt_vty.c')
| -rw-r--r-- | mgmtd/mgmt_vty.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/mgmtd/mgmt_vty.c b/mgmtd/mgmt_vty.c index 898eb43915..fa34d90c75 100644 --- a/mgmtd/mgmt_vty.c +++ b/mgmtd/mgmt_vty.c @@ -10,6 +10,8 @@ #include "command.h" #include "json.h" +#include "northbound_cli.h" + #include "mgmtd/mgmt.h" #include "mgmtd/mgmt_be_server.h" #include "mgmtd/mgmt_be_adapter.h" @@ -389,6 +391,7 @@ static struct cmd_node debug_node = { static int config_write_mgmt_debug_helper(struct vty *vty, bool config) { int n = mgmt_debug_be + mgmt_debug_fe + mgmt_debug_ds + mgmt_debug_txn; + if (!n) return 0; @@ -440,6 +443,7 @@ DEFPY(debug_mgmt, debug_mgmt_cmd, "Transaction debug\n") { bool set = !no; + if (all) be = fe = ds = txn = set ? all : NULL; @@ -455,6 +459,33 @@ DEFPY(debug_mgmt, debug_mgmt_cmd, return CMD_SUCCESS; } +/* + * Analog of `frr_config_read_in()`, instead of our config file though we loop + * over all daemons that have transitioned to mgmtd, loading their configs + */ +static int mgmt_config_pre_hook(struct event_loop *loop) +{ + FILE *confp; + char *p; + + for (uint i = 0; i < mgmt_daemons_count; i++) { + p = asprintfrr(MTYPE_TMP, "%s/%s.conf", frr_sysconfdir, + mgmt_daemons[i]); + confp = fopen(p, "r"); + if (confp == NULL) { + if (errno != ENOENT) + zlog_err("%s: couldn't read config file %s: %s", + __func__, p, safe_strerror(errno)); + } else { + zlog_info("mgmtd: reading daemon config from %s", p); + vty_read_file(vty_shared_candidate_config, confp); + fclose(confp); + } + XFREE(MTYPE_TMP, p); + } + return 0; +} + void mgmt_vty_init(void) { /* @@ -468,6 +499,8 @@ void mgmt_vty_init(void) static_vty_init(); #endif + hook_register(frr_config_pre, mgmt_config_pre_hook); + install_node(&debug_node); install_element(VIEW_NODE, &show_mgmt_be_adapter_cmd); |
