YANG device: allow replace of config bool as special case
This commit is contained in:
parent
ddfcb9716c
commit
7558d40faa
1 changed files with 20 additions and 11 deletions
|
|
@ -2069,18 +2069,27 @@ yang_deviation(yang_stmt *ys,
|
||||||
while ((yc = yn_each(yd, yc)) != NULL) {
|
while ((yc = yn_each(yd, yc)) != NULL) {
|
||||||
/* The properties to replace MUST exist in the target node.*/
|
/* The properties to replace MUST exist in the target node.*/
|
||||||
kw = yang_keyword_get(yc);
|
kw = yang_keyword_get(yc);
|
||||||
if ((ytc = yang_find(ytarget, kw, NULL)) == NULL){
|
ytc = yang_find(ytarget, kw, NULL);
|
||||||
clicon_err(OE_YANG, 0, "deviation %s: \"%s %s\" replaced but node does not exist in target %s",
|
switch (kw){
|
||||||
nodeid,
|
case Y_CONFIG: /* special case: implicit default is config true */
|
||||||
yang_key2str(kw), yang_argument_get(yc),
|
break;
|
||||||
yang_argument_get(ytarget));
|
default:
|
||||||
goto done;
|
if (ytc == NULL){
|
||||||
|
clicon_err(OE_YANG, 0, "deviation %s: \"%s %s\" replaced but node does not exist in target %s",
|
||||||
|
nodeid,
|
||||||
|
yang_key2str(kw), yang_argument_get(yc),
|
||||||
|
yang_argument_get(ytarget));
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ytc){
|
||||||
|
/* Remove old */
|
||||||
|
if (ys_prune_self(ytc) < 0)
|
||||||
|
goto done;
|
||||||
|
if (ys_free(ytc) < 0)
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
/* Remove old */
|
|
||||||
if (ys_prune_self(ytc) < 0)
|
|
||||||
goto done;
|
|
||||||
if (ys_free(ytc) < 0)
|
|
||||||
goto done;
|
|
||||||
/* Make a copy of deviate child and insert. */
|
/* Make a copy of deviate child and insert. */
|
||||||
if ((yc1 = ys_dup(yc)) == NULL)
|
if ((yc1 = ys_dup(yc)) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue