* YANG schema mount RFC 8528, Initial commit (work in progress)

* Keep track of YANG unknowns with ys_cvec of EXTENSION
* C-API: Init ys_cvec to NULL, added yang_cvec_add() and adjusted code to use it
This commit is contained in:
Olof Hagsand 2023-01-20 16:06:45 +01:00
parent 8451a20db7
commit b3dcee9639
21 changed files with 552 additions and 79 deletions

View file

@ -297,6 +297,19 @@ get_client_statedata(clicon_handle h,
if (ret == 0)
goto fail;
}
#ifdef YANG_SCHEMA_MOUNT
if ((ret = schema_mounts_state_get(h, yspec, xpath, nsc, xret, &xerr)) < 0)
goto done;
if (ret == 0){
if (clixon_netconf_internal_error(xerr, " . Internal error, schema_mounts_state_get returned invalid XML", NULL) < 0)
goto done;
if (*xret)
xml_free(*xret);
*xret = xerr;
xerr = NULL;
goto fail;
}
#endif
/* Use plugin state callbacks */
if ((ret = clixon_plugin_statedata_all(h, yspec, nsc, xpath, wdef, xret)) < 0)
goto done;

View file

@ -266,12 +266,6 @@ expand_dbvar(void *h,
/* Transform api-path to xpath for netconf */
if (api_path2xpath(api_path, yspec, &xpath, &nsc, NULL) < 0)
goto done;
if (nsc != NULL){
cvec_free(nsc);
nsc = NULL;
}
if (xml_nsctx_yang(y, &nsc) < 0)
goto done;
if ((cbxpath = cbuf_new()) == NULL){
clicon_err(OE_UNIX, errno, "cbuf_new");
goto done;

View file

@ -143,7 +143,8 @@ match_list_keys(yang_stmt *y,
clicon_debug(1, "%s", __FUNCTION__);
switch (yang_keyword_get(y)){
case Y_LIST:
cvk = yang_cvec_get(y); /* Use Y_LIST cache, see ys_populate_list() */
if ((cvk = yang_cvec_get(y)) == NULL) /* Use Y_LIST cache, see ys_populate_list() */
break;
cvi = NULL;
while ((cvi = cvec_each(cvk, cvi)) != NULL) {
keyname = cv_string_get(cvi);

View file

@ -900,7 +900,8 @@ snmp_yang2xpath_cb(yang_stmt *ys,
}
switch (yang_keyword_get(ys)){
case Y_LIST:
cvk = yang_cvec_get(ys); /* Use Y_LIST cache, see ys_populate_list() */
if ((cvk = yang_cvec_get(ys)) == NULL) /* Use Y_LIST cache, see ys_populate_list() */
break;
/* Iterate over individual keys */
assert(keyvec && cvec_len(cvk) == cvec_len(keyvec));
for (i=0; i<cvec_len(cvk); i++){