diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/northbound.c | 26 | ||||
-rw-r--r-- | lib/northbound.h | 5 | ||||
-rw-r--r-- | lib/northbound_confd.c | 2 | ||||
-rw-r--r-- | lib/northbound_sysrepo.c | 2 |
4 files changed, 9 insertions, 26 deletions
diff --git a/lib/northbound.c b/lib/northbound.c index a831fc58b..949218332 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -695,35 +695,22 @@ static int dnode_create(struct nb_config *candidate, const char *xpath, int nb_candidate_edit(struct nb_config *candidate, const struct nb_node *nb_node, enum nb_operation operation, const char *xpath, - bool in_backend, const struct yang_data *previous, + const struct yang_data *previous, const struct yang_data *data) { struct lyd_node *dnode, *dep_dnode, *old_dnode; - char xpath_edit[XPATH_MAXLEN]; char dep_xpath[XPATH_MAXLEN]; struct lyd_node *parent = NULL; uint32_t options = 0; LY_ERR err; - /* - * Use special notation for leaf-lists (RFC 6020, section 9.13.5). - * if we are in a backend client this notation was already applied - * by mgmtd before sending to us. - */ - if (!in_backend && nb_node->snode->nodetype == LYS_LEAFLIST && - (operation == NB_OP_DESTROY || operation == NB_OP_DELETE)) - snprintf(xpath_edit, sizeof(xpath_edit), "%s[.='%s']", xpath, - data->value); - else - strlcpy(xpath_edit, xpath, sizeof(xpath_edit)); - switch (operation) { case NB_OP_CREATE: case NB_OP_MODIFY: options = LYD_NEW_PATH_UPDATE; fallthrough; case NB_OP_CREATE_EXCL: - err = dnode_create(candidate, xpath_edit, data->value, options, + err = dnode_create(candidate, xpath, data->value, options, &dnode); if (err) { return err; @@ -750,7 +737,7 @@ int nb_candidate_edit(struct nb_config *candidate, const struct nb_node *nb_node break; case NB_OP_DESTROY: case NB_OP_DELETE: - dnode = yang_dnode_get(candidate->dnode, xpath_edit); + dnode = yang_dnode_get(candidate->dnode, xpath); if (!dnode) { if (operation == NB_OP_DELETE) return NB_ERR; @@ -768,12 +755,12 @@ int nb_candidate_edit(struct nb_config *candidate, const struct nb_node *nb_node lyd_free_tree(dnode); break; case NB_OP_REPLACE: - old_dnode = yang_dnode_get(candidate->dnode, xpath_edit); + old_dnode = yang_dnode_get(candidate->dnode, xpath); if (old_dnode) { parent = lyd_parent(old_dnode); lyd_unlink_tree(old_dnode); } - err = dnode_create(candidate, xpath_edit, data->value, options, + err = dnode_create(candidate, xpath, data->value, options, &dnode); if (!err && dnode && !old_dnode) { /* create dependency if the node didn't exist */ @@ -908,8 +895,7 @@ void nb_candidate_edit_config_changes(struct nb_config *candidate_config, * configuration. */ ret = nb_candidate_edit(candidate_config, nb_node, - change->operation, xpath, in_backend, - NULL, data); + change->operation, xpath, NULL, data); yang_data_free(data); if (ret != NB_OK) { flog_warn( diff --git a/lib/northbound.h b/lib/northbound.h index 0a6bc8892..493e5ce70 100644 --- a/lib/northbound.h +++ b/lib/northbound.h @@ -950,9 +950,6 @@ extern bool nb_is_operation_allowed(struct nb_node *nb_node, * xpath * XPath of the configuration node being edited. * - * in_backend - * Specify whether the changes are being applied in the backend or not. - * * previous * Previous value of the configuration node. Should be used only when the * operation is NB_OP_MOVE, otherwise this parameter is ignored. @@ -967,7 +964,7 @@ extern bool nb_is_operation_allowed(struct nb_node *nb_node, extern int nb_candidate_edit(struct nb_config *candidate, const struct nb_node *nb_node, enum nb_operation operation, const char *xpath, - bool in_backend, const struct yang_data *previous, + const struct yang_data *previous, const struct yang_data *data); /* diff --git a/lib/northbound_confd.c b/lib/northbound_confd.c index c866b0afb..8503d1800 100644 --- a/lib/northbound_confd.c +++ b/lib/northbound_confd.c @@ -256,7 +256,7 @@ frr_confd_cdb_diff_iter(confd_hkeypath_t *kp, enum cdb_iter_op cdb_op, /* Edit the candidate configuration. */ data = yang_data_new(xpath, value_str); ret = nb_candidate_edit(iter_args->candidate, nb_node, nb_op, xpath, - false, NULL, data); + NULL, data); yang_data_free(data); if (ret != NB_OK) { flog_warn( diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c index 050477af9..198d96e38 100644 --- a/lib/northbound_sysrepo.c +++ b/lib/northbound_sysrepo.c @@ -219,7 +219,7 @@ static int frr_sr_process_change(struct nb_config *candidate, sr_val_to_buff(sr_data, value_str, sizeof(value_str)); data = yang_data_new(xpath, value_str); - ret = nb_candidate_edit(candidate, nb_node, nb_op, xpath, false, NULL, data); + ret = nb_candidate_edit(candidate, nb_node, nb_op, xpath, NULL, data); yang_data_free(data); if (ret != NB_OK) { flog_warn( |