Workaround for [YANG if-feature does not support nested boolean expression](https://github.com/clicon/clixon/issues/341)
This commit is contained in:
parent
05918e3ca2
commit
5bb3767358
1 changed files with 8 additions and 0 deletions
|
|
@ -2791,6 +2791,7 @@ ys_populate2(yang_stmt *ys,
|
||||||
* @note if-feature syntax is restricted to single, and, or, syntax, such as "a or b"
|
* @note if-feature syntax is restricted to single, and, or, syntax, such as "a or b"
|
||||||
* but RFC7950 allows for nested expr/term/factor syntax.
|
* but RFC7950 allows for nested expr/term/factor syntax.
|
||||||
* XXX This should really be parsed in yang/lex.
|
* XXX This should really be parsed in yang/lex.
|
||||||
|
* XXX: work-around for https://github.com/clicon/clixon/issues/341
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
yang_if_feature(clicon_handle h,
|
yang_if_feature(clicon_handle h,
|
||||||
|
|
@ -2827,6 +2828,7 @@ yang_if_feature(clicon_handle h,
|
||||||
switch (opand){
|
switch (opand){
|
||||||
case -1:
|
case -1:
|
||||||
if (i != 1){
|
if (i != 1){
|
||||||
|
goto ok;
|
||||||
clicon_err(OE_YANG, EINVAL, "Syntax error IF_FEATURE \"%s\" (only single if-feature-expr and/or lists allowed)", ys->ys_argument);
|
clicon_err(OE_YANG, EINVAL, "Syntax error IF_FEATURE \"%s\" (only single if-feature-expr and/or lists allowed)", ys->ys_argument);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
@ -2835,6 +2837,7 @@ yang_if_feature(clicon_handle h,
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
goto ok;
|
||||||
clicon_err(OE_YANG, EINVAL, "Syntax error IF_FEATURE \"%s\" (only single if-feature-expr and/or lists allowed)", ys->ys_argument);
|
clicon_err(OE_YANG, EINVAL, "Syntax error IF_FEATURE \"%s\" (only single if-feature-expr and/or lists allowed)", ys->ys_argument);
|
||||||
goto done;
|
goto done;
|
||||||
break;
|
break;
|
||||||
|
|
@ -2844,12 +2847,14 @@ yang_if_feature(clicon_handle h,
|
||||||
switch (opand){
|
switch (opand){
|
||||||
case -1:
|
case -1:
|
||||||
if (i != 1){
|
if (i != 1){
|
||||||
|
goto ok;
|
||||||
clicon_err(OE_YANG, EINVAL, "Syntax error IF_FEATURE \"%s\" (only single if-feature-expr and/or lists allowed)", ys->ys_argument);
|
clicon_err(OE_YANG, EINVAL, "Syntax error IF_FEATURE \"%s\" (only single if-feature-expr and/or lists allowed)", ys->ys_argument);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
opand = 1;
|
opand = 1;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
|
goto ok;
|
||||||
clicon_err(OE_YANG, EINVAL, "Syntax error IF_FEATURE \"%s\" (only single if-feature-expr and/or lists allowed)", ys->ys_argument);
|
clicon_err(OE_YANG, EINVAL, "Syntax error IF_FEATURE \"%s\" (only single if-feature-expr and/or lists allowed)", ys->ys_argument);
|
||||||
goto done;
|
goto done;
|
||||||
break;
|
break;
|
||||||
|
|
@ -2858,11 +2863,13 @@ yang_if_feature(clicon_handle h,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
goto ok;
|
||||||
clicon_err(OE_YANG, EINVAL, "Syntax error IF_FEATURE \"%s\" (only single if-feature-expr and/or lists allowed)", ys->ys_argument);
|
clicon_err(OE_YANG, EINVAL, "Syntax error IF_FEATURE \"%s\" (only single if-feature-expr and/or lists allowed)", ys->ys_argument);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
} /* for step 1 */
|
} /* for step 1 */
|
||||||
if (j%2 == 0){ /* Must be odd: eg a / "a or b" etc */
|
if (j%2 == 0){ /* Must be odd: eg a / "a or b" etc */
|
||||||
|
goto ok;
|
||||||
clicon_err(OE_YANG, EINVAL, "Syntax error IF_FEATURE \"%s\" (only single if-feature-expr and/or lists allowed)", ys->ys_argument);
|
clicon_err(OE_YANG, EINVAL, "Syntax error IF_FEATURE \"%s\" (only single if-feature-expr and/or lists allowed)", ys->ys_argument);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
@ -2920,6 +2927,7 @@ yang_if_feature(clicon_handle h,
|
||||||
}
|
}
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
goto disabled;
|
goto disabled;
|
||||||
|
ok:
|
||||||
retval = 1;
|
retval = 1;
|
||||||
done:
|
done:
|
||||||
if (vec)
|
if (vec)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue