Break out init of orig-ptr to yang_start() to be made after options
This commit is contained in:
parent
ba40f5a929
commit
43bfc82942
8 changed files with 24 additions and 3 deletions
|
|
@ -829,6 +829,7 @@ main(int argc,
|
|||
if (nacm_load_external(h) < 0)
|
||||
goto done;
|
||||
}
|
||||
yang_start(h);
|
||||
/* Create top-level data yangs */
|
||||
if ((yspec = yspec_new(h, YANG_DATA_TOP)) == NULL)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -842,8 +842,10 @@ main(int argc,
|
|||
/* In case ietf-yang-metadata is loaded by application, handle annotation extension */
|
||||
if (yang_metadata_init(h) < 0)
|
||||
goto done;
|
||||
yang_start(h);
|
||||
/* Set default namespace according to CLICON_NAMESPACE_NETCONF_DEFAULT */
|
||||
xml_nsctx_namespace_netconf_default(h);
|
||||
|
||||
/* Create top-level and store as option */
|
||||
if ((yspec = yspec_new(h, YANG_DATA_TOP)) == NULL)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -866,6 +866,7 @@ main(int argc,
|
|||
/* Initialize plugin module by creating a handle holding plugin and callback lists */
|
||||
if (clixon_plugin_module_init(h) < 0)
|
||||
goto done;
|
||||
yang_start(h);
|
||||
/* In case ietf-yang-metadata is loaded by application, handle annotation extension */
|
||||
if (yang_metadata_init(h) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -1353,6 +1353,7 @@ main(int argc,
|
|||
/* Initialize plugin module by creating a handle holding plugin and callback lists */
|
||||
if (clixon_plugin_module_init(h) < 0)
|
||||
goto done;
|
||||
yang_start(h);
|
||||
/* Call start function in all plugins before we go interactive */
|
||||
if (clixon_plugin_start_all(h) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ main(int argc,
|
|||
|
||||
/* Set default namespace according to CLICON_NAMESPACE_NETCONF_DEFAULT */
|
||||
xml_nsctx_namespace_netconf_default(h);
|
||||
|
||||
yang_start(h);
|
||||
/* Add (hardcoded) netconf features in case ietf-netconf loaded here
|
||||
* Otherwise it is loaded in netconf_module_load below
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -347,6 +347,7 @@ void *yang_action_cb_get(yang_stmt *ys);
|
|||
int yang_action_cb_add(yang_stmt *ys, void *rc);
|
||||
int ys_populate_feature(clixon_handle h, yang_stmt *ys);
|
||||
int yang_init(clixon_handle h);
|
||||
int yang_start(clixon_handle h);
|
||||
int yang_exit(clixon_handle h);
|
||||
|
||||
#endif /* _CLIXON_YANG_H_ */
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ clixon_client_init(const char *config_file)
|
|||
/* Find, read and parse configfile */
|
||||
if (clicon_options_main(h) < 0)
|
||||
return NULL;
|
||||
yang_start(h);
|
||||
return h;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4456,7 +4456,7 @@ yang_action_cb_add(yang_stmt *ys,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*! Init yang code
|
||||
/*! Init yang code. Called before any yang code, before options
|
||||
*
|
||||
* Add two external tables for YANGs
|
||||
* @param[in] h Clixon handle
|
||||
|
|
@ -4470,7 +4470,6 @@ yang_init(clixon_handle h)
|
|||
map_ptr2ptr *mp;
|
||||
yang_stmt *ymounts;
|
||||
|
||||
_yang_use_orig = clicon_option_bool(h, "CLICON_YANG_USE_ORIGINAL");
|
||||
if ((mp = calloc(1, sizeof(*mp))) == NULL){
|
||||
clixon_err(OE_UNIX, errno, "calloc");
|
||||
goto done;
|
||||
|
|
@ -4492,6 +4491,21 @@ yang_init(clixon_handle h)
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*! Start yang code. Called after yang options loaded
|
||||
*
|
||||
* Called after YANG config and -o options and plugins init
|
||||
* But before YANG data loaded
|
||||
* Set local CLICON_YANG_USE_ORIGINAL variable
|
||||
* @param[in] h Clixon handle
|
||||
* @retval 0 OK
|
||||
*/
|
||||
int
|
||||
yang_start(clixon_handle h)
|
||||
{
|
||||
_yang_use_orig = clicon_option_bool(h, "CLICON_YANG_USE_ORIGINAL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! Exit yang code
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue