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) {
|
||||
/* The properties to replace MUST exist in the target node.*/
|
||||
kw = yang_keyword_get(yc);
|
||||
if ((ytc = yang_find(ytarget, kw, NULL)) == NULL){
|
||||
ytc = yang_find(ytarget, kw, NULL);
|
||||
switch (kw){
|
||||
case Y_CONFIG: /* special case: implicit default is config true */
|
||||
break;
|
||||
default:
|
||||
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;
|
||||
}
|
||||
/* Make a copy of deviate child and insert. */
|
||||
if ((yc1 = ys_dup(yc)) == NULL)
|
||||
goto done;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue