struct mgmt_ds_ctx *dst)
{
struct lyd_node *dst_dnode, *src_dnode;
- struct ly_out *out;
if (!src || !dst)
return -1;
nb_config_diff_del_changes(&src->root.cfg_root->cfg_chgs);
}
- if (dst->ds_id == MGMTD_DS_RUNNING) {
- if (ly_out_new_filepath(MGMTD_STARTUP_DS_FILE_PATH, &out)
- == LY_SUCCESS)
- mgmt_ds_dump_in_memory(dst, "", LYD_JSON, out);
- ly_out_free(out, NULL, 0);
- }
-
/* TODO: Update the versions if nb_config present */
return 0;
{
int ret;
struct lyd_node **dst_dnode, *src_dnode;
- struct ly_out *out;
if (!src || !dst)
return -1;
nb_config_diff_del_changes(&src->root.cfg_root->cfg_chgs);
}
- if (dst->ds_id == MGMTD_DS_RUNNING) {
- if (ly_out_new_filepath(MGMTD_STARTUP_DS_FILE_PATH, &out)
- == LY_SUCCESS)
- mgmt_ds_dump_in_memory(dst, "", LYD_JSON, out);
- ly_out_free(out, NULL, 0);
- }
-
return 0;
}
int mgmt_ds_init(struct mgmt_master *mm)
{
- struct lyd_node *root;
-
if (mgmt_ds_mm || mm->running_ds || mm->candidate_ds || mm->oper_ds)
assert(!"MGMTD: Call ds_init only once!");
if (!running_config)
assert(!"MGMTD: Call ds_init after frr_init only!");
- if (mgmt_ds_load_cfg_from_file(MGMTD_STARTUP_DS_FILE_PATH, &root)
- == 0) {
- nb_config_free(running_config);
- running_config = nb_config_new(root);
- }
-
running.root.cfg_root = running_config;
running.config_ds = true;
running.ds_id = MGMTD_DS_RUNNING;
#define MGMTD_DS_NAME_CANDIDATE "candidate"
#define MGMTD_DS_NAME_OPERATIONAL "operational"
-#define MGMTD_STARTUP_DS_FILE_PATH DAEMON_DB_DIR "/frr_startup.json"
-
#define FOREACH_MGMTD_DS_ID(id) \
for ((id) = MGMTD_DS_NONE; (id) < MGMTD_DS_MAX_ID; (id)++)