static uint64_t mgmt_client_id_next;
static uint64_t mgmt_last_req_id = UINT64_MAX;
+static bool vty_debug;
+#define VTY_DBG(fmt, ...) \
+ do { \
+ if (vty_debug) \
+ zlog_debug(fmt, ##__VA_ARGS__); \
+ } while (0)
+
PREDECL_DLIST(vtyservs);
struct vty_serv {
static void vty_mgmt_server_connected(uintptr_t lib_hndl, uintptr_t usr_data,
bool connected)
{
- zlog_err("%sGot %sconnected %s MGMTD Frontend Server",
- !connected ? "ERROR: " : "", !connected ? "dis: " : "",
- !connected ? "from" : "to");
+ VTY_DBG("%sGot %sconnected %s MGMTD Frontend Server",
+ !connected ? "ERROR: " : "", !connected ? "dis: " : "",
+ !connected ? "from" : "to");
mgmt_fe_connected = connected;
vty = (struct vty *)session_ctx;
if (!success) {
- zlog_err("%s session for client %llu failed!",
- create ? "Creating" : "Destroying",
- (unsigned long long)client_id);
+ zlog_err("%s session for client %" PRIu64 " failed!",
+ create ? "Creating" : "Destroying", client_id);
return;
}
- zlog_err("%s session for client %llu successfully!",
- create ? "Created" : "Destroyed",
- (unsigned long long)client_id);
+ VTY_DBG("%s session for client %" PRIu64 " successfully",
+ create ? "Created" : "Destroyed", client_id);
if (create)
vty->mgmt_session_id = session_id;
}
vty = (struct vty *)session_ctx;
if (!success) {
- zlog_err("%socking for DS %u failed! Err: '%s'",
+ zlog_err("%socking for DS %u failed, Err: '%s'",
lock_ds ? "L" : "Unl", ds_id, errmsg_if_any);
- vty_out(vty, "ERROR: %socking for DS %u failed! Err: '%s'\n",
+ vty_out(vty, "ERROR: %socking for DS %u failed, Err: '%s'\n",
lock_ds ? "L" : "Unl", ds_id, errmsg_if_any);
} else {
- zlog_err("%socked DS %u successfully!", lock_ds ? "L" : "Unl",
- ds_id);
+ VTY_DBG("%socked DS %u successfully", lock_ds ? "L" : "Unl",
+ ds_id);
}
vty_mgmt_resume_response(vty, success);
vty = (struct vty *)session_ctx;
if (!success) {
- zlog_err(
- "SET_CONFIG request for client 0x%llx failed! Error: '%s'",
- (unsigned long long)client_id,
- errmsg_if_any ? errmsg_if_any : "Unknown");
- vty_out(vty, "ERROR: SET_CONFIG request failed! Error: %s\n",
+ zlog_err("SET_CONFIG request for client 0x%" PRIx64
+ " failed, Error: '%s'",
+ client_id, errmsg_if_any ? errmsg_if_any : "Unknown");
+ vty_out(vty, "ERROR: SET_CONFIG request failed, Error: %s\n",
errmsg_if_any ? errmsg_if_any : "Unknown");
} else {
- zlog_err(
- "SET_CONFIG request for client 0x%llx req-id %llu was successfull!",
- (unsigned long long)client_id,
- (unsigned long long)req_id);
+ VTY_DBG("SET_CONFIG request for client 0x%" PRIx64
+ " req-id %" PRIu64 " was successfull",
+ client_id, req_id);
}
vty_mgmt_resume_response(vty, success);
vty = (struct vty *)session_ctx;
if (!success) {
- zlog_err(
- "COMMIT_CONFIG request for client 0x%llx failed! Error: '%s'",
- (unsigned long long)client_id,
- errmsg_if_any ? errmsg_if_any : "Unknown");
- vty_out(vty, "ERROR: COMMIT_CONFIG request failed! Error: %s\n",
+ zlog_err("COMMIT_CONFIG request for client 0x%" PRIx64
+ " failed, Error: '%s'",
+ client_id, errmsg_if_any ? errmsg_if_any : "Unknown");
+ vty_out(vty, "ERROR: COMMIT_CONFIG request failed, Error: %s\n",
errmsg_if_any ? errmsg_if_any : "Unknown");
} else {
- zlog_err(
- "COMMIT_CONFIG request for client 0x%llx req-id %llu was successfull!",
- (unsigned long long)client_id,
- (unsigned long long)req_id);
+ VTY_DBG("COMMIT_CONFIG request for client 0x%" PRIx64
+ " req-id %" PRIu64 " was successfull",
+ client_id, req_id);
if (errmsg_if_any)
vty_out(vty, "MGMTD: %s\n", errmsg_if_any);
}
vty = (struct vty *)session_ctx;
if (!success) {
- zlog_err(
- "GET_DATA request for client 0x%llx failed! Error: '%s'",
- (unsigned long long)client_id,
- errmsg_if_any ? errmsg_if_any : "Unknown");
- vty_out(vty, "ERROR: GET_DATA request failed! Error: %s\n",
+ zlog_err("GET_DATA request for client 0x%" PRIx64
+ " failed, Error: '%s'",
+ client_id, errmsg_if_any ? errmsg_if_any : "Unknown");
+ vty_out(vty, "ERROR: GET_DATA request failed, Error: %s\n",
errmsg_if_any ? errmsg_if_any : "Unknown");
vty_mgmt_resume_response(vty, success);
return MGMTD_INTERNAL_ERROR;
}
- zlog_debug(
- "GET_DATA request for client 0x%llx req-id %llu was successfull!",
- (unsigned long long)client_id, (unsigned long long)req_id);
+ VTY_DBG("GET_DATA request for client 0x%" PRIx64 " req-id %" PRIu64
+ " was successfull!",
+ client_id, req_id);
if (req_id != mgmt_last_req_id) {
mgmt_last_req_id = req_id;
vty->mgmt_req_id, ds_id, lock);
if (ret != MGMTD_SUCCESS) {
zlog_err(
- "Failed to send %sLOCK-DS-REQ to MGMTD for req-id %llu.",
- lock ? "" : "UN",
- (unsigned long long)vty->mgmt_req_id);
- vty_out(vty, "Failed to send %sLOCK-DS-REQ to MGMTD!",
+ "Failed to send %sLOCK-DS-REQ to MGMTD for req-id %"
+ PRIu64 ".",
+ lock ? "" : "UN", vty->mgmt_req_id);
+ vty_out(vty, "Failed to send %sLOCK-DS-REQ to MGMTD!\n",
lock ? "" : "UN");
return -1;
}
MGMTD_DS_RUNNING) != MGMTD_SUCCESS) {
zlog_err("Failed to send %d Config Xpaths to MGMTD!!",
(int)indx);
+ vty_out(vty, "Failed to send SETCFG-REQ to MGMTD!\n");
return -1;
}
abort);
if (ret != MGMTD_SUCCESS) {
zlog_err(
- "Failed to send COMMIT-REQ to MGMTD for req-id %llu.",
- (unsigned long long)vty->mgmt_req_id);
- vty_out(vty, "Failed to send COMMIT-REQ to MGMTD!");
+ "Failed to send COMMIT-REQ to MGMTD for req-id %"
+ PRIu64 ".",
+ vty->mgmt_req_id);
+ vty_out(vty, "Failed to send COMMIT-REQ to MGMTD!\n");
return -1;
}
num_req);
if (ret != MGMTD_SUCCESS) {
- zlog_err("Failed to send GET-CONFIG to MGMTD for req-id %llu.",
- (unsigned long long)vty->mgmt_req_id);
- vty_out(vty, "Failed to send GET-CONFIG to MGMTD!");
+ zlog_err(
+ "Failed to send GET-CONFIG to MGMTD for req-id %" PRIu64
+ ".",
+ vty->mgmt_req_id);
+ vty_out(vty, "Failed to send GET-CONFIG to MGMTD!\n");
return -1;
}
vty->mgmt_req_id, datastore, getreq, num_req);
if (ret != MGMTD_SUCCESS) {
- zlog_err("Failed to send GET-DATA to MGMTD for req-id %llu.",
- (unsigned long long)vty->mgmt_req_id);
- vty_out(vty, "Failed to send GET-DATA to MGMTD!");
+ zlog_err("Failed to send GET-DATA to MGMTD for req-id %" PRIu64
+ ".",
+ vty->mgmt_req_id);
+ vty_out(vty, "Failed to send GET-DATA to MGMTD!\n");
return -1;
}