[Presence container configs not displayed in 'show config set' #164 ](https://github.com/clicon/clixon/issues/164)
This commit is contained in:
parent
4de0a475d3
commit
906d8bc63c
3 changed files with 30 additions and 9 deletions
|
|
@ -31,8 +31,11 @@ Expected: February 2021
|
|||
|
||||
### Corrected Bugs
|
||||
|
||||
* [Presence container configs not displayed in 'show config set' #164 ](https://github.com/clicon/clixon/issues/164)
|
||||
* Treat presence container as a leaf: always print a placeholder regardless if it has children or not. An extra check for children could have been made to not print if it has, but this adds an extra minor complexity.
|
||||
|
||||
## 4.9.0
|
||||
18 Dec 2020
|
||||
18 December 2020
|
||||
|
||||
### New features
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,9 @@ xml2cli_recurse(FILE *f,
|
|||
goto ok;
|
||||
if ((ys = xml_spec(x)) == NULL)
|
||||
goto ok;
|
||||
if (yang_keyword_get(ys) == Y_LEAF || yang_keyword_get(ys) == Y_LEAF_LIST){
|
||||
/* If leaf/leaf-list or presence container, then print line */
|
||||
if (yang_keyword_get(ys) == Y_LEAF ||
|
||||
yang_keyword_get(ys) == Y_LEAF_LIST){
|
||||
if (prepend)
|
||||
(*fn)(f, "%s", prepend);
|
||||
if (gt == GT_ALL || gt == GT_VARS || gt == GT_HIDE)
|
||||
|
|
@ -266,8 +268,8 @@ xml2cli_recurse(FILE *f,
|
|||
if (yang_container_cli_hide(ys, gt) == 0)
|
||||
cprintf(cbpre, "%s ", xml_name(x));
|
||||
|
||||
/* If list then first loop through keys */
|
||||
if (yang_keyword_get(ys) == Y_LIST){
|
||||
/* If list then first loop through keys */
|
||||
xe = NULL;
|
||||
while ((xe = xml_child_each(x, xe, -1)) != NULL){
|
||||
if ((match = yang_key_match(ys, xml_name(xe))) < 0)
|
||||
|
|
@ -279,6 +281,22 @@ xml2cli_recurse(FILE *f,
|
|||
cprintf(cbpre, "%s ", xml_body(xe));
|
||||
}
|
||||
}
|
||||
else if ((yang_keyword_get(ys) == Y_CONTAINER) &&
|
||||
yang_find(ys, Y_PRESENCE, NULL) != NULL){
|
||||
/* If presence container, then print as leaf (but continue to children) */
|
||||
if (prepend)
|
||||
(*fn)(f, "%s", prepend);
|
||||
if (gt == GT_ALL || gt == GT_VARS || gt == GT_HIDE)
|
||||
(*fn)(f, "%s ", xml_name(x));
|
||||
if ((body = xml_body(x)) != NULL){
|
||||
if (index(body, ' '))
|
||||
(*fn)(f, "\"%s\"", body);
|
||||
else
|
||||
(*fn)(f, "%s", body);
|
||||
}
|
||||
(*fn)(f, "\n");
|
||||
}
|
||||
|
||||
/* Then loop through all other (non-keys) */
|
||||
xe = NULL;
|
||||
while ((xe = xml_child_each(x, xe, -1)) != NULL){
|
||||
|
|
|
|||
|
|
@ -185,22 +185,22 @@ new "restconf set protocol tcp+udp fail again"
|
|||
expectpart "$(curl $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json" $RCPROTO://localhost/restconf/data/system:system/protocol -d '{"system:protocol":{"tcp": [null], "udp": [null]}}')" 0 "HTTP/1.1 400 Bad Request" '{"ietf-restconf:errors":{"error":{"error-type":"application","error-tag":"bad-element","error-info":{"bad-element":"tcp"},"error-severity":"error","error-message":"Element in choice statement already exists"}}}'
|
||||
|
||||
new "cli set protocol udp"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o set system protocol udp" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o set system protocol udp)" 0 "^$"
|
||||
|
||||
new "cli get protocol udp"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o show configuration cli " 0 "^set system protocol udp$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o show configuration cli)" 0 "set system protocol" "set system protocol udp"
|
||||
|
||||
new "cli change protocol to tcp"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o set system protocol tcp" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o set system protocol tcp)" 0 "^$"
|
||||
|
||||
new "cli get protocol tcp"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o show configuration cli " 0 "^set system protocol tcp$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o show configuration cli)" 0 "set system protocol" "set system protocol tcp"
|
||||
|
||||
new "cli delete all"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o delete all" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o delete all)" 0 "^$"
|
||||
|
||||
new "commit"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o commit" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o commit)" 0 "^$"
|
||||
|
||||
# Second shorthand (no case)
|
||||
new "netconf set protocol both udp and tcp"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue