New plugin callback: ca_yang_patch - for modifying existing YANG modules
C-API: Added `spec` parameter to `xml2xpath()`
This commit is contained in:
parent
48a0fb9968
commit
a5220805b1
16 changed files with 318 additions and 193 deletions
|
|
@ -1069,6 +1069,65 @@ clixon_plugin_yang_mount_all(clicon_handle h,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*! Call plugin YANG schema patch
|
||||
*
|
||||
|
||||
* @param[in] cp Plugin handle
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] ymod YANG module
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
clixon_plugin_yang_patch_one(clixon_plugin_t *cp,
|
||||
clicon_handle h,
|
||||
yang_stmt *ymod)
|
||||
{
|
||||
int retval = -1;
|
||||
yang_patch_t *fn;
|
||||
void *wh = NULL;
|
||||
|
||||
if ((fn = cp->cp_api.ca_yang_patch) != NULL){
|
||||
wh = NULL;
|
||||
if (plugin_context_check(h, &wh, cp->cp_name, __FUNCTION__) < 0)
|
||||
goto done;
|
||||
if (fn(h, ymod) < 0) {
|
||||
if (clicon_errno < 0)
|
||||
clicon_log(LOG_WARNING, "%s: Internal error: Yang patch callback in plugin: %s returned -1 but did not make a clicon_err call",
|
||||
__FUNCTION__, cp->cp_name);
|
||||
goto done;
|
||||
}
|
||||
if (plugin_context_check(h, &wh, cp->cp_name, __FUNCTION__) < 0)
|
||||
goto done;
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*! Call plugin YANG schema patch in all plugins.
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] ymod YANG module
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
clixon_plugin_yang_patch_all(clicon_handle h,
|
||||
yang_stmt *ymod)
|
||||
{
|
||||
int retval = -1;
|
||||
clixon_plugin_t *cp = NULL;
|
||||
|
||||
while ((cp = clixon_plugin_each(h, cp)) != NULL) {
|
||||
if (clixon_plugin_yang_patch_one(cp, h, ymod) < 0)
|
||||
goto done;
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* RPC callbacks for both client/frontend and backend plugins.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue