* YANG schema mount RFC 8528, state data
This commit is contained in:
parent
51ebbdf12f
commit
a8e13047fc
21 changed files with 572 additions and 144 deletions
|
|
@ -269,6 +269,26 @@ typedef char *(cli_prompthook_t)(clicon_handle, char *mode);
|
|||
*/
|
||||
typedef int (datastore_upgrade_t)(clicon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
|
||||
|
||||
/*! YANG schema mount
|
||||
*
|
||||
* Given an XML mount-point xt, return XML yang-lib modules-set
|
||||
* Return yanglib as XML tree on the RFC8525 form:
|
||||
* <yang-library>
|
||||
* <module-set>
|
||||
* <module>...</module>
|
||||
* ...
|
||||
* </module-set>
|
||||
* </yang-library>
|
||||
* No need to YANG bind.
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] xt XML mount-point in XML tree
|
||||
* @param[out] yanglib XML yang-lib module-set tree. Freed by caller.
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @see RFC 8528 (schema-mount) and RFC 8525 (yang-lib)
|
||||
*/
|
||||
typedef int (yang_mount_t)(clicon_handle h, cxobj *xt, cxobj **yanglib);
|
||||
|
||||
/*! Startup status for use in startup-callback
|
||||
* Note that for STARTUP_ERR and STARTUP_INVALID, running runs in failsafe mode
|
||||
* and startup contains the erroneous or invalid database.
|
||||
|
|
@ -322,6 +342,7 @@ struct clixon_plugin_api{
|
|||
trans_cb_t *cb_trans_end; /* Transaction completed */
|
||||
trans_cb_t *cb_trans_abort; /* Transaction aborted */
|
||||
datastore_upgrade_t *cb_datastore_upgrade; /* General-purpose datastore upgrade */
|
||||
yang_mount_t *cb_yang_mount; /* RFC 8528 schema mount */
|
||||
} cau_backend;
|
||||
} u;
|
||||
};
|
||||
|
|
@ -344,6 +365,7 @@ struct clixon_plugin_api{
|
|||
#define ca_trans_end u.cau_backend.cb_trans_end
|
||||
#define ca_trans_abort u.cau_backend.cb_trans_abort
|
||||
#define ca_datastore_upgrade u.cau_backend.cb_datastore_upgrade
|
||||
#define ca_yang_mount u.cau_backend.cb_yang_mount
|
||||
|
||||
/*
|
||||
* Macros
|
||||
|
|
@ -419,6 +441,9 @@ int clixon_plugin_extension_all(clicon_handle h, yang_stmt *yext, yang_stmt *ys)
|
|||
int clixon_plugin_datastore_upgrade_one(clixon_plugin_t *cp, clicon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
|
||||
int clixon_plugin_datastore_upgrade_all(clicon_handle h, const char *db, cxobj *xt, modstate_diff_t *msd);
|
||||
|
||||
int clixon_plugin_yang_mount_one(clixon_plugin_t *cp, clicon_handle h, cxobj *xt, cxobj **yanglib);
|
||||
int clixon_plugin_yang_mount_all(clicon_handle h, cxobj *xt, cxobj **yanglib);
|
||||
|
||||
/* rpc callback API */
|
||||
int rpc_callback_register(clicon_handle h, clicon_rpc_cb cb, void *arg, const char *ns, const char *name);
|
||||
int rpc_callback_call(clicon_handle h, cxobj *xe, void *arg, int *nrp, cbuf *cbret);
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ cg_var *yang_cv_get(yang_stmt *ys);
|
|||
int yang_cv_set(yang_stmt *ys, cg_var *cv);
|
||||
cvec *yang_cvec_get(yang_stmt *ys);
|
||||
int yang_cvec_set(yang_stmt *ys, cvec *cvv);
|
||||
cg_var *yang_cvec_add(yang_stmt *ys, enum cv_type type, char *name);
|
||||
uint16_t yang_flag_get(yang_stmt *ys, uint16_t flag);
|
||||
int yang_flag_set(yang_stmt *ys, uint16_t flag);
|
||||
int yang_flag_reset(yang_stmt *ys, uint16_t flag);
|
||||
|
|
|
|||
|
|
@ -78,5 +78,6 @@ yang_stmt *yang_find_module_by_name_revision(yang_stmt *yspec, const char *name,
|
|||
yang_stmt *yang_find_module_by_name(yang_stmt *yspec, char *name);
|
||||
int yang_metadata_annotation_check(cxobj *x, yang_stmt *ymod, int *ismeta);
|
||||
int yang_metadata_init(clicon_handle h);
|
||||
int yang_lib2yspec(clicon_handle h, cxobj *yanglib,yang_stmt *yspec);
|
||||
|
||||
#endif /* _CLIXON_YANG_MODULE_H_ */
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
* Prototypes
|
||||
*/
|
||||
yang_stmt *yang_parse_file(FILE *fp, const char *name, yang_stmt *ysp);
|
||||
int yang_file_find_match(clicon_handle h, const char *module, const char *revision, cbuf *fbuf);
|
||||
yang_stmt *yang_parse_filename(const char *filename, yang_stmt *ysp);
|
||||
int yang_parse_post(clicon_handle h, yang_stmt *yspec, int modmin);
|
||||
int yang_spec_parse_module(clicon_handle h, const char *module,
|
||||
|
|
|
|||
|
|
@ -44,12 +44,26 @@
|
|||
*/
|
||||
#define YANG_SCHEMA_MOUNT_NAMESPACE "urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount"
|
||||
|
||||
/* Limitations/deviations from RFC 8528 */
|
||||
/*! Only support YANG presende containers as mount-points
|
||||
* This is a limitation of othe current implementation
|
||||
*/
|
||||
#define YANG_SCHEMA_MOUNT_ONLY_PRESENCE_CONTAINERS
|
||||
|
||||
/*! 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
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int yang_schema_mount_point(yang_stmt *y);
|
||||
|
||||
int schema_mounts_state_get(clicon_handle h, yang_stmt *yspec, char *xpath, cvec *nsc, cxobj **xret, cxobj **xerr);
|
||||
int yang_schema_unknown(clicon_handle h, yang_stmt *yext, yang_stmt *ys);
|
||||
int xml_yang_mount_get(cxobj *x, yang_stmt **yspec);
|
||||
int xml_yang_mount_set(cxobj *x, yang_stmt *yspec);
|
||||
int xml_yang_mount_freeall(cvec *cvv);
|
||||
int yang_schema_mount_statedata(clicon_handle h, yang_stmt *yspec, char *xpath, cvec *nsc, cxobj **xret, cxobj **xerr);
|
||||
int yang_schema_yanglib_parse_mount(clicon_handle h, cxobj *xt);
|
||||
int yang_schema_get_child(clicon_handle h, cxobj *x1, cxobj *x1c, yang_stmt **yc);
|
||||
|
||||
#endif /* _CLIXON_YANG_SCHEMA_MOUNT_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue