confd: add support for "replace" operation

When toggling settings like 'interfaces/interface/ipv6/enabled', which
guards both link-local and all static addresses, the operation is not
"create" or "delete", but "replace".  Callback must take any "replace"
on an 'enabled' node into account since none of the other nodes will
be available in the diff.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2023-06-20 11:11:52 +02:00
committed by Tobias Waldekranz
parent 5be4a629f3
commit d71a3b3db6
2 changed files with 8 additions and 3 deletions
+7 -3
View File
@@ -17,15 +17,19 @@ enum lydx_op lydx_get_op(struct lyd_node *node)
if (opstr && !strcmp(opstr, "delete"))
return LYDX_OP_DELETE;
if (opstr && !strcmp(opstr, "replace"))
return LYDX_OP_REPLACE;
return LYDX_OP_NONE;
}
void lydx_diff_print(struct lydx_diff *nd, FILE *fp)
{
static const char opchar[] = {
[LYDX_OP_CREATE] = '+',
[LYDX_OP_DELETE] = '-',
[LYDX_OP_NONE] = '%',
[LYDX_OP_CREATE] = '+',
[LYDX_OP_DELETE] = '-',
[LYDX_OP_REPLACE] = '|',
[LYDX_OP_NONE] = '%',
};
fprintf(fp, "%c%s %s%s ->%s%s\n",
+1
View File
@@ -15,6 +15,7 @@ enum lydx_op {
LYDX_OP_NONE,
LYDX_OP_CREATE,
LYDX_OP_DELETE,
LYDX_OP_REPLACE,
};
struct lydx_diff {