* CLI expansion of leafrefs default behavior changed
* In the autocli and handcrafted CLI:s using `expand_dbvar()` the CLI expansion followed the leafrefs to the sources, ie the origin of the leafrefs
* Instead leafref expansion now only looks at the leafrefs
This commit is contained in:
parent
614c927343
commit
a49cf41d1e
4 changed files with 36 additions and 5 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
|
@ -64,6 +64,16 @@ Expected: May 2022
|
||||||
|
|
||||||
Users may have to change how they access the system
|
Users may have to change how they access the system
|
||||||
|
|
||||||
|
* CLI expansion of leafrefs default behavior changed
|
||||||
|
* In the autocli and handcrafted CLI:s using `expand_dbvar()` the CLI expansion followed the leafrefs to the sources, ie the origin of the leafrefs
|
||||||
|
* Instead leafref expansion now only looks at the leafrefs
|
||||||
|
* Example:
|
||||||
|
* Assume ifref with leafref pointing to source if values:
|
||||||
|
* `<if>a</if><if>b</if><if>c</if>`
|
||||||
|
* `<ifref>b</ifref>`
|
||||||
|
* Existing behavior: propose: `a, b, c`
|
||||||
|
* New default behavior: propose: `b`
|
||||||
|
* To keep existing behavior, set `<CLICON_CLI_EXPAND_LEAFREF>true<CLICON_CLI_EXPAND_LEAFREF>`
|
||||||
* Restconf
|
* Restconf
|
||||||
* Added 404 return without body if neither restconf, data or streams prefix match
|
* Added 404 return without body if neither restconf, data or streams prefix match
|
||||||
* Netconf: Usage of chunked framing"
|
* Netconf: Usage of chunked framing"
|
||||||
|
|
@ -77,6 +87,7 @@ Users may have to change how they access the system
|
||||||
* `CLICON_NETCONF_BASE_CAPABILITY`
|
* `CLICON_NETCONF_BASE_CAPABILITY`
|
||||||
* `CLICON_HTTP_DATA_PATH`
|
* `CLICON_HTTP_DATA_PATH`
|
||||||
* `CLICON_HTTP_DATA_ROOT`
|
* `CLICON_HTTP_DATA_ROOT`
|
||||||
|
* `CLICON_CLI_EXPAND_LEAFREF`
|
||||||
* New `clixon-restconf@2022-03-21.yang` revision
|
* New `clixon-restconf@2022-03-21.yang` revision
|
||||||
* Added option:
|
* Added option:
|
||||||
* `enable-http-data`
|
* `enable-http-data`
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,8 @@ expand_dbvar(void *h,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
cprintf(cbxpath, "%s", xpath);
|
cprintf(cbxpath, "%s", xpath);
|
||||||
if ((ytype = yang_find(y, Y_TYPE, NULL)) != NULL &&
|
if (clicon_option_bool(h, "CLICON_CLI_EXPAND_LEAFREF") &&
|
||||||
|
(ytype = yang_find(y, Y_TYPE, NULL)) != NULL &&
|
||||||
strcmp(yang_argument_get(ytype), "leafref") == 0){
|
strcmp(yang_argument_get(ytype), "leafref") == 0){
|
||||||
/* Special case for leafref. Detect leafref via Yang-type,
|
/* Special case for leafref. Detect leafref via Yang-type,
|
||||||
* Get Yang path element, tentatively add the new syntax to the whole
|
* Get Yang path element, tentatively add the new syntax to the whole
|
||||||
|
|
|
||||||
|
|
@ -178,13 +178,16 @@ new "expand identityref 1st level"
|
||||||
expectpart "$(echo "set identityrefs identityref ?" | $clixon_cli -f $cfg 2> /dev/null)" 0 "ex:des" "ex:des2" "ex:des3"
|
expectpart "$(echo "set identityrefs identityref ?" | $clixon_cli -f $cfg 2> /dev/null)" 0 "ex:des" "ex:des2" "ex:des3"
|
||||||
|
|
||||||
new "expand leafref 1st level"
|
new "expand leafref 1st level"
|
||||||
expectpart "$(echo "set leafrefs leafref ?" | $clixon_cli -f $cfg 2> /dev/null)" 0 "91" "92" "93"
|
expectpart "$(echo "set leafrefs leafref ?" | $clixon_cli -f $cfg -o CLICON_CLI_EXPAND_LEAFREF=false 2> /dev/null)" 0 "<name>" --not-- "91" "92" "93"
|
||||||
|
|
||||||
|
new "expand leafref 1st level with leafref expand"
|
||||||
|
expectpart "$(echo "set leafrefs leafref ?" | $clixon_cli -f $cfg -o CLICON_CLI_EXPAND_LEAFREF=true 2> /dev/null)" 0 "91" "92" "93"
|
||||||
|
|
||||||
new "expand leafref top"
|
new "expand leafref top"
|
||||||
expectpart "$(echo "set leafrefsabs leafref ?" | $clixon_cli -f $cfg 2> /dev/null)" 0 "91" "92" "93"
|
expectpart "$(echo "set leafrefsabs leafref ?" | $clixon_cli -f $cfg -o CLICON_CLI_EXPAND_LEAFREF=true 2> /dev/null)" 0 "91" "92" "93"
|
||||||
|
|
||||||
new "expand leafref require-instance"
|
new "expand leafref require-instance"
|
||||||
expectpart "$(echo "set leafrefsreqinst leafref ?" | $clixon_cli -f $cfg 2> /dev/null)" 0 "91" "92" "93"
|
expectpart "$(echo "set leafrefsreqinst leafref ?" | $clixon_cli -f $cfg -o CLICON_CLI_EXPAND_LEAFREF=true 2> /dev/null)" 0 "91" "92" "93"
|
||||||
|
|
||||||
# First level id/leaf refs
|
# First level id/leaf refs
|
||||||
new "set identityref des"
|
new "set identityref des"
|
||||||
|
|
@ -237,7 +240,7 @@ expectpart "$(echo "set identityrefs2 identityref ?" | $clixon_cli -f $cfg 2> /d
|
||||||
|
|
||||||
# Note CI may have random number as host which may match "92"
|
# Note CI may have random number as host which may match "92"
|
||||||
new "expand leafref 2nd level"
|
new "expand leafref 2nd level"
|
||||||
expectpart "$(echo "set leafrefs2 leafref ?" | $clixon_cli -f $cfg 2> /dev/null)" 0 " 91" " 93" --not-- " 92"
|
expectpart "$(echo "set leafrefs2 leafref ?" | $clixon_cli -f $cfg -o CLICON_CLI_EXPAND_LEAFREF=true 2> /dev/null)" 0 " 91" " 93" --not-- " 92"
|
||||||
|
|
||||||
new "set identityref2 des"
|
new "set identityref2 des"
|
||||||
expectpart "$($clixon_cli -1 -f $cfg set identityrefs2 identityref ex:des)" 0 "^$"
|
expectpart "$($clixon_cli -1 -f $cfg set identityrefs2 identityref ex:des)" 0 "^$"
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ module clixon-config {
|
||||||
CLICON_NETCONF_BASE_CAPABILITY
|
CLICON_NETCONF_BASE_CAPABILITY
|
||||||
CLICON_HTTP_DATA_PATH
|
CLICON_HTTP_DATA_PATH
|
||||||
CLICON_HTTP_DATA_ROOT
|
CLICON_HTTP_DATA_ROOT
|
||||||
|
CLICON_CLI_EXPAND_LEAFREF
|
||||||
Released in Clixon 5.7";
|
Released in Clixon 5.7";
|
||||||
}
|
}
|
||||||
revision 2022-02-11 {
|
revision 2022-02-11 {
|
||||||
|
|
@ -762,6 +763,21 @@ module clixon-config {
|
||||||
This only applies if you have multi-line help strings, such as when generating
|
This only applies if you have multi-line help strings, such as when generating
|
||||||
from a spec, such as in the autocli.";
|
from a spec, such as in the autocli.";
|
||||||
}
|
}
|
||||||
|
leaf CLICON_CLI_EXPAND_LEAFREF {
|
||||||
|
type boolean;
|
||||||
|
default false;
|
||||||
|
description
|
||||||
|
"If true, then CLI expansion of leafrefs (in expand_dbvar) are done using the
|
||||||
|
source values, not the references.
|
||||||
|
This applies to the autocli but also in a handcrafted CLI if expand_dbvar is used.
|
||||||
|
Example, assume ifref with leafref pointing to source if values:
|
||||||
|
<if>a</if><if>b</if><if>c</if>
|
||||||
|
<ifref>b</ifref>
|
||||||
|
If true, expansion will suggest a, b, c (source if values)
|
||||||
|
If false, expansion will suggest b (destination ifref values)
|
||||||
|
While setting this value makes sense for adding new values, it makes less sense for
|
||||||
|
deleting.";
|
||||||
|
}
|
||||||
leaf CLICON_SOCK_FAMILY {
|
leaf CLICON_SOCK_FAMILY {
|
||||||
type socket_address_family;
|
type socket_address_family;
|
||||||
default UNIX;
|
default UNIX;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue