diff options
author | Christian Hopps <chopps@labn.net> | 2023-06-09 22:54:54 +0200 |
---|---|---|
committer | Christian Hopps <chopps@labn.net> | 2023-06-13 10:11:29 +0200 |
commit | 96f9e7853bad7e21676f2eb126a915561e6c8dce (patch) | |
tree | b902eda89b5fd78543bd24c494e18a3c0946ca11 /lib/mgmt_fe_client.c | |
parent | Merge pull request #13763 from LabNConsulting/mgmtd/simplify (diff) | |
download | frr-96f9e7853bad7e21676f2eb126a915561e6c8dce.tar.xz frr-96f9e7853bad7e21676f2eb126a915561e6c8dce.zip |
lib: mgmtd: improvements in logging and commentary
- log names of datastores not numbers
- improve logging for mgmt_msg_read
- Rather than use a bool, instead store the pending const string name of
the command being run that has postponed the CLI. This adds some nice
information to the logging when enabled.
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'lib/mgmt_fe_client.c')
-rw-r--r-- | lib/mgmt_fe_client.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/lib/mgmt_fe_client.c b/lib/mgmt_fe_client.c index 7af421405..be7263f21 100644 --- a/lib/mgmt_fe_client.c +++ b/lib/mgmt_fe_client.c @@ -50,6 +50,22 @@ struct mgmt_fe_client { struct debug mgmt_dbg_fe_client = {0, "Management frontend client operations"}; +static inline const char *dsid2name(Mgmtd__DatastoreId id) +{ + switch ((int)id) { + case MGMTD_DS_NONE: + return "none"; + case MGMTD_DS_RUNNING: + return "running"; + case MGMTD_DS_CANDIDATE: + return "candidate"; + case MGMTD_DS_OPERATIONAL: + return "operational"; + default: + return "unknown-datastore-id"; + } +} + static struct mgmt_fe_client_session * mgmt_fe_find_session_by_client_id(struct mgmt_fe_client *client, uint64_t client_id) @@ -165,8 +181,9 @@ int mgmt_fe_send_lockds_req(struct mgmt_fe_client *client, uint64_t session_id, fe_msg.lockds_req = &lockds_req; MGMTD_FE_CLIENT_DBG( - "Sending %sLOCK_REQ message for Ds:%d session-id %" PRIu64, - lock ? "" : "UN", ds_id, session_id); + "Sending LOCKDS_REQ (%sLOCK) message for DS:%s session-id %" PRIu64, + lock ? "" : "UN", dsid2name(ds_id), session_id); + return mgmt_fe_client_send_msg(client, &fe_msg, false); } @@ -194,9 +211,9 @@ int mgmt_fe_send_setcfg_req(struct mgmt_fe_client *client, uint64_t session_id, fe_msg.setcfg_req = &setcfg_req; MGMTD_FE_CLIENT_DBG( - "Sending SET_CONFIG_REQ message for Ds:%d session-id %" PRIu64 + "Sending SET_CONFIG_REQ message for DS:%s session-id %" PRIu64 " (#xpaths:%d)", - ds_id, session_id, num_data_reqs); + dsid2name(ds_id), session_id, num_data_reqs); return mgmt_fe_client_send_msg(client, &fe_msg, false); } @@ -224,8 +241,8 @@ int mgmt_fe_send_commitcfg_req(struct mgmt_fe_client *client, fe_msg.commcfg_req = &commitcfg_req; MGMTD_FE_CLIENT_DBG( - "Sending COMMIT_CONFIG_REQ message for Src-Ds:%d, Dst-Ds:%d session-id %" PRIu64, - src_ds_id, dest_ds_id, session_id); + "Sending COMMIT_CONFIG_REQ message for Src-DS:%s, Dst-DS:%s session-id %" PRIu64, + dsid2name(src_ds_id), dsid2name(dest_ds_id), session_id); return mgmt_fe_client_send_msg(client, &fe_msg, false); } @@ -251,9 +268,9 @@ int mgmt_fe_send_getcfg_req(struct mgmt_fe_client *client, uint64_t session_id, fe_msg.getcfg_req = &getcfg_req; MGMTD_FE_CLIENT_DBG( - "Sending GET_CONFIG_REQ message for Ds:%d session-id %" PRIu64 + "Sending GET_CONFIG_REQ message for DS:%s session-id %" PRIu64 " (#xpaths:%d)", - ds_id, session_id, num_data_reqs); + dsid2name(ds_id), session_id, num_data_reqs); return mgmt_fe_client_send_msg(client, &fe_msg, false); } @@ -279,9 +296,9 @@ int mgmt_fe_send_getdata_req(struct mgmt_fe_client *client, uint64_t session_id, fe_msg.getdata_req = &getdata_req; MGMTD_FE_CLIENT_DBG( - "Sending GET_CONFIG_REQ message for Ds:%d session-id %" PRIu64 + "Sending GET_CONFIG_REQ message for DS:%s session-id %" PRIu64 " (#xpaths:%d)", - ds_id, session_id, num_data_reqs); + dsid2name(ds_id), session_id, num_data_reqs); return mgmt_fe_client_send_msg(client, &fe_msg, false); } |