* C-API: Added vlev validate level parameter to candidate_commit
* `vlev` : validate level
This commit is contained in:
parent
a8e13047fc
commit
034ab632f1
13 changed files with 98 additions and 60 deletions
|
|
@ -75,6 +75,7 @@
|
|||
#include "clixon_xpath.h"
|
||||
#include "clixon_yang_module.h"
|
||||
#include "clixon_yang_type.h"
|
||||
#include "clixon_yang_schema_mount.h"
|
||||
#include "clixon_xml_default.h"
|
||||
#include "clixon_xml_map.h"
|
||||
#include "clixon_xml_bind.h"
|
||||
|
|
@ -1007,6 +1008,15 @@ xml_yang_validate_add(clicon_handle h,
|
|||
cg_var *cv0;
|
||||
enum cv_type cvtype;
|
||||
|
||||
#ifdef YANG_SCHEMA_MOUNT
|
||||
/* Do not validate beyond mountpoints */
|
||||
if ((ret = xml_yang_mount_get(xt, NULL)) < 0)
|
||||
goto done;
|
||||
if (ret == 1){
|
||||
retval = 1;
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
/* if not given by argument (overide) use default link
|
||||
and !Node has a config sub-statement and it is false */
|
||||
if ((yt = xml_spec(xt)) != NULL && yang_config(yt) != 0){
|
||||
|
|
@ -1215,6 +1225,13 @@ xml_yang_validate_all(clicon_handle h,
|
|||
cvec *nsc = NULL;
|
||||
int hit = 0;
|
||||
|
||||
#ifdef YANG_SCHEMA_MOUNT
|
||||
/* Do not validate beyond mountpoints */
|
||||
if ((ret = xml_yang_mount_get(xt, NULL)) < 0)
|
||||
goto done;
|
||||
if (ret == 1)
|
||||
goto ok;
|
||||
#endif
|
||||
/* if not given by argument (overide) use default link
|
||||
and !Node has a config sub-statement and it is false */
|
||||
if ((yt = xml_spec(xt)) == NULL){
|
||||
|
|
|
|||
|
|
@ -82,6 +82,11 @@
|
|||
#include "clixon_xml_map.h"
|
||||
#include "clixon_yang_parse_lib.h"
|
||||
|
||||
/*! Force add ietf-yang-library@2019-01-04 on all mount-points
|
||||
* This is a limitation of othe current implementation
|
||||
*/
|
||||
#define YANG_SCHEMA_MOUNT_YANG_LIB_FORCE
|
||||
|
||||
/*! Create modstate structure
|
||||
*
|
||||
* @retval md modstate struct
|
||||
|
|
@ -826,10 +831,10 @@ yang_metadata_init(clicon_handle h)
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*! Given a yang-lib module-set XML tree, parse all modules into an yspec
|
||||
/*! Given yang-lib module-set XML tree, parse all modules into an yspec
|
||||
*
|
||||
* This function is used where a yang-lib module-set is available to populate an
|
||||
* XML mount-point.
|
||||
* This function is used where a yang-lib module-set is available to populate
|
||||
* an XML mount-point.
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] xylib yang-lib XML tree on the form <yang-lib>...
|
||||
* @param[in] yspec Will be populated with YANGs, is consumed
|
||||
|
|
@ -860,14 +865,16 @@ yang_lib2yspec(clicon_handle h,
|
|||
continue;
|
||||
if ((revision = xml_find_body(xi, "revision")) == NULL)
|
||||
continue;
|
||||
if (yang_spec_parse_module(h, name, revision, yspec) < 0)
|
||||
if (yang_parse_module(h, name, revision, yspec, NULL) == NULL)
|
||||
goto fail;
|
||||
}
|
||||
#ifdef YANG_SCHEMA_MOUNT_YANG_LIB_FORCE
|
||||
/* XXX: Ensure yang-lib is always there otherwise get state dont work for mountpoint */
|
||||
if (yang_spec_parse_module(h, "ietf-yang-library", "2019-01-04", yspec) < 0)
|
||||
if (yang_parse_module(h, "ietf-yang-library", "2019-01-04", yspec, NULL) < 0)
|
||||
goto fail;
|
||||
#endif
|
||||
if (yang_parse_post(h, yspec, 0) < 0)
|
||||
goto done;
|
||||
retval = 1;
|
||||
done:
|
||||
if (vec)
|
||||
|
|
|
|||
|
|
@ -1059,7 +1059,7 @@ yang_parse_filename(const char *filename,
|
|||
*
|
||||
* See top of file for diagram of calling order
|
||||
*/
|
||||
static yang_stmt *
|
||||
yang_stmt *
|
||||
yang_parse_module(clicon_handle h,
|
||||
const char *module,
|
||||
const char *revision,
|
||||
|
|
|
|||
|
|
@ -459,11 +459,6 @@ yang_schema_yanglib_parse_mount(clicon_handle h,
|
|||
goto done;
|
||||
if (ret == 0)
|
||||
goto anydata;
|
||||
#ifdef YANG_SCHEMA_MOUNT_YANG_LIB_FORCE
|
||||
/* XXX: Ensure yang-lib is always there otherwise get state dont work for mountpoint */
|
||||
if (yang_spec_parse_module(h, "ietf-yang-library", "2019-01-04", yspec) < 0)
|
||||
goto done;
|
||||
#endif
|
||||
if (xml_yang_mount_set(xt, yspec) < 0)
|
||||
goto done;
|
||||
retval = 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue