confirmed-commit fixes, tests

- fixed typo preventing evaluation of confirmed-commit logic in backend_startup
- fixed uninitialized variable warnings
- added details to CHANGELOG.MD
- added capabilities advertisement for confirmed-commit 1.0 and 1.1
- added xml hello message that uses only eom framing, for simplicity in asynch tests
- add stty restore after wait_restconf to fix console corruption in tests
- adjust test_confirmed_commit to drop perms and run as the invoking user.  This will require running user to have permissions on /usr/local/var/example
- added CLI tests
This commit is contained in:
Phil Heller 2022-10-03 21:42:01 -06:00
parent 284316b646
commit 8abcda6f85
9 changed files with 160 additions and 16 deletions

View file

@ -418,7 +418,8 @@ xmldb_delete(clicon_handle h,
if (xmldb_db2file(h, db, &filename) < 0)
goto done;
if (lstat(filename, &sb) == 0)
// TODO this had been changed from unlink to truncate some time ago. It was changed back for confirmed-commit
// TODO this had been changed from unlink to truncate some time ago, likely related to dropping privileges.
// It was changed back for confirmed-commit, and test_confirmed_commit.sh drops privileges.
// as the presence of the rollback_db at startup triggers loading of the rollback rather than the startup
// configuration. It might not be sufficient to check for a truncated file. Needs more review, switching back
// to unlink temporarily.
@ -619,7 +620,7 @@ xmldb_rename(clicon_handle h,
const char *suffix)
{
char *old;
char *fname;
char *fname = NULL;
int retval = -1;
if ((xmldb_db2file(h, db, &old)) < 0) {

View file

@ -1765,6 +1765,7 @@ netconf_hello_server(clicon_handle h,
char *module_set_id;
char *ietf_yang_library_revision;
char *encstr = NULL;
yang_stmt *yspec = clicon_dbspec_yang(h);
module_set_id = clicon_option_str(h, "CLICON_MODULE_SET_ID");
cprintf(cb, "<hello xmlns=\"%s\">", NETCONF_BASE_NAMESPACE);
@ -1799,6 +1800,13 @@ netconf_hello_server(clicon_handle h,
cprintf(cb, "<capability>");
xml_chardata_cbuf_append(cb, "urn:ietf:params:netconf:capability:with-defaults:1.0?basic-mode=explicit&also-supported=report-all,trim,report-all-tagged");
cprintf(cb, "</capability>");
/* rfc 4741 and 6241 confirmed-commit capabilities */
if (if_feature(yspec, "ietf-netconf", "confirmed-commit")) {
cprintf(cb, "<capability>urn:ietf:params:netconf:capability:confirmed-commit:1.0</capability>");
cprintf(cb, "<capability>urn:ietf:params:netconf:capability:confirmed-commit:1.1</capability>");
}
cprintf(cb, "</capabilities>");
if (session_id)
cprintf(cb, "<session-id>%lu</session-id>", (long unsigned int)session_id);