summaryrefslogtreecommitdiff
path: root/lib/northbound.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/northbound.c')
-rw-r--r--lib/northbound.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/northbound.c b/lib/northbound.c
index 9a5d67cd1b..0bc79d0277 100644
--- a/lib/northbound.c
+++ b/lib/northbound.c
@@ -932,14 +932,22 @@ static int nb_candidate_edit_tree_add(struct nb_config *candidate,
/* if replace failed, restore the original node */
if (existing) {
if (root) {
+ /* Restoring the whole config. */
candidate->dnode = existing;
+ } else if (ex_parent) {
+ /*
+ * Restoring a nested node. Insert it as a
+ * child.
+ */
+ lyd_insert_child(ex_parent, existing);
} else {
- if (ex_parent)
- lyd_insert_child(ex_parent, existing);
- else
- lyd_insert_sibling(candidate->dnode,
- existing,
- &candidate->dnode);
+ /*
+ * Restoring a top-level node. Insert it as a
+ * sibling to candidate->dnode to make sure
+ * the linkage is correct.
+ */
+ lyd_insert_sibling(candidate->dnode, existing,
+ &candidate->dnode);
}
}
yang_print_errors(ly_native_ctx, errmsg, errmsg_len);
@@ -1820,14 +1828,11 @@ const void *nb_callback_lookup_next(const struct nb_node *nb_node,
}
int nb_callback_rpc(const struct nb_node *nb_node, const char *xpath,
- const struct list *input, struct list *output, char *errmsg,
- size_t errmsg_len)
+ const struct lyd_node *input, struct lyd_node *output,
+ char *errmsg, size_t errmsg_len)
{
struct nb_cb_rpc_args args = {};
- if (CHECK_FLAG(nb_node->flags, F_NB_NODE_IGNORE_CFG_CBS))
- return 0;
-
DEBUGD(&nb_dbg_cbs_rpc, "northbound RPC: %s", xpath);
args.xpath = xpath;