Refactoring of schema mount-points
Add new top-level `Y_MOUNTS` and add top-level yangs and mountpoints in yspecs
This commit is contained in:
parent
99503ac7fb
commit
dfe5c1bac1
18 changed files with 188 additions and 154 deletions
|
|
@ -91,7 +91,6 @@
|
|||
static int
|
||||
backend_terminate(clixon_handle h)
|
||||
{
|
||||
yang_stmt *yspec;
|
||||
char *pidfile = clicon_backend_pidfile(h);
|
||||
int sockfamily = clicon_sock_family(h);
|
||||
char *sockpath = clicon_sock_str(h);
|
||||
|
|
@ -113,14 +112,7 @@ backend_terminate(clixon_handle h)
|
|||
/* Free changelog */
|
||||
if ((x = clicon_xml_changelog_get(h)) != NULL)
|
||||
xml_free(x);
|
||||
if ((yspec = clicon_dbspec_yang(h)) != NULL){
|
||||
ys_free(yspec);
|
||||
}
|
||||
yang_exit(h);
|
||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
||||
ys_free(yspec);
|
||||
if ((yspec = clicon_nacm_ext_yang(h)) != NULL)
|
||||
ys_free(yspec);
|
||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||
cvec_free(nsctx);
|
||||
clicon_data_cvec_del(h, "netconf-statistics");
|
||||
|
|
@ -229,7 +221,7 @@ nacm_load_external(clixon_handle h)
|
|||
clixon_err(OE_UNIX, errno, "configure file: %s", filename);
|
||||
return -1;
|
||||
}
|
||||
if ((yspec = yspec_new()) == NULL)
|
||||
if ((yspec = yspec_new(h, YANG_NACM_TOP)) == NULL)
|
||||
goto done;
|
||||
if (yang_spec_parse_module(h, "ietf-netconf-acm", NULL, yspec) < 0)
|
||||
goto done;
|
||||
|
|
@ -240,8 +232,6 @@ nacm_load_external(clixon_handle h)
|
|||
clixon_err(OE_XML, 0, "No xml tree in %s", filename);
|
||||
goto done;
|
||||
}
|
||||
if (clicon_nacm_ext_yang_set(h, yspec) < 0)
|
||||
goto done;
|
||||
if (clicon_nacm_ext_set(h, xt) < 0)
|
||||
goto done;
|
||||
|
||||
|
|
@ -617,7 +607,6 @@ main(int argc,
|
|||
clixon_log_init(h, __PROGRAM__, dbg?LOG_DEBUG:LOG_INFO, logdst);
|
||||
clixon_debug_init(h, dbg);
|
||||
yang_init(h);
|
||||
|
||||
/* Find and read configfile */
|
||||
if (clicon_options_main(h) < 0){
|
||||
if (help)
|
||||
|
|
@ -836,14 +825,13 @@ main(int argc,
|
|||
* Note, loads yang -> extensions -> plugins
|
||||
*/
|
||||
nacm_mode = clicon_option_str(h, "CLICON_NACM_MODE");
|
||||
if (nacm_mode && strcmp(nacm_mode, "external") == 0)
|
||||
if (nacm_mode && strcmp(nacm_mode, "external") == 0){
|
||||
if (nacm_load_external(h) < 0)
|
||||
goto done;
|
||||
|
||||
/* Create top-level yang spec and store as option */
|
||||
if ((yspec = yspec_new()) == NULL)
|
||||
}
|
||||
/* Create top-level data yangs */
|
||||
if ((yspec = yspec_new(h, YANG_DATA_TOP)) == NULL)
|
||||
goto done;
|
||||
clicon_dbspec_yang_set(h, yspec);
|
||||
|
||||
/* Load backend plugins before yangs are loaded (eg extension callbacks) */
|
||||
if ((dir = clicon_backend_dir(h)) != NULL &&
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@ cli_history_save(clixon_handle h)
|
|||
static int
|
||||
cli_terminate(clixon_handle h)
|
||||
{
|
||||
yang_stmt *yspec;
|
||||
cvec *nsctx;
|
||||
cxobj *x;
|
||||
|
||||
|
|
@ -178,11 +177,7 @@ cli_terminate(clixon_handle h)
|
|||
clixon_exit_set(1);
|
||||
if (clicon_data_get(h, "session-transport", NULL) == 0)
|
||||
clicon_rpc_close_session(h);
|
||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||
ys_free(yspec);
|
||||
yang_exit(h);
|
||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
||||
ys_free(yspec);
|
||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||
cvec_free(nsctx);
|
||||
if ((x = clicon_conf_xml(h)) != NULL)
|
||||
|
|
@ -850,9 +845,8 @@ main(int argc,
|
|||
/* 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()) == NULL)
|
||||
if ((yspec = yspec_new(h, YANG_DATA_TOP)) == NULL)
|
||||
goto done;
|
||||
clicon_dbspec_yang_set(h, yspec);
|
||||
|
||||
/* Load Yang modules
|
||||
* 1. Load a yang module as a specific absolute filename */
|
||||
|
|
|
|||
|
|
@ -575,7 +575,6 @@ send_hello(clixon_handle h,
|
|||
static int
|
||||
netconf_terminate(clixon_handle h)
|
||||
{
|
||||
yang_stmt *yspec;
|
||||
cvec *nsctx;
|
||||
cxobj *x;
|
||||
|
||||
|
|
@ -584,10 +583,6 @@ netconf_terminate(clixon_handle h)
|
|||
/* Delete all plugins, and RPC callbacks */
|
||||
clixon_plugin_module_exit(h);
|
||||
clicon_rpc_close_session(h);
|
||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||
ys_free(yspec);
|
||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
||||
ys_free(yspec);
|
||||
yang_exit(h);
|
||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||
cvec_free(nsctx);
|
||||
|
|
@ -874,9 +869,8 @@ main(int argc,
|
|||
if (yang_metadata_init(h) < 0)
|
||||
goto done;
|
||||
/* Create top-level yang spec and store as option */
|
||||
if ((yspec = yspec_new()) == NULL)
|
||||
if ((yspec = yspec_new(h, YANG_DATA_TOP)) == NULL)
|
||||
goto done;
|
||||
clicon_dbspec_yang_set(h, yspec);
|
||||
|
||||
/* Load netconf plugins before yangs are loaded (eg extension callbacks) */
|
||||
if ((dir = clicon_netconf_dir(h)) != NULL &&
|
||||
|
|
|
|||
|
|
@ -355,7 +355,6 @@ get_user_cookie(char *cookiestr,
|
|||
int
|
||||
restconf_terminate(clixon_handle h)
|
||||
{
|
||||
yang_stmt *yspec;
|
||||
cvec *nsctx;
|
||||
cxobj *x;
|
||||
int fs; /* fgcx socket */
|
||||
|
|
@ -366,10 +365,6 @@ restconf_terminate(clixon_handle h)
|
|||
/* Delete all plugins, and RPC callbacks */
|
||||
clixon_plugin_module_exit(h);
|
||||
clicon_rpc_close_session(h);
|
||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||
ys_free(yspec);
|
||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
||||
ys_free(yspec);
|
||||
yang_exit(h);
|
||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||
cvec_free(nsctx);
|
||||
|
|
|
|||
|
|
@ -498,9 +498,8 @@ main(int argc,
|
|||
goto done;
|
||||
|
||||
/* Create top-level yang spec and store as option */
|
||||
if ((yspec = yspec_new()) == NULL)
|
||||
if ((yspec = yspec_new(h, YSPEC_DATA_TOP)) == NULL)
|
||||
goto done;
|
||||
clicon_dbspec_yang_set(h, yspec);
|
||||
|
||||
/* Initialize plugin module by creating a handle holding plugin and callback lists */
|
||||
if (clixon_plugin_module_init(h) < 0)
|
||||
|
|
|
|||
|
|
@ -967,9 +967,8 @@ restconf_clixon_init(clixon_handle h,
|
|||
if (yang_metadata_init(h) < 0)
|
||||
goto done;
|
||||
/* Create top-level yang spec and store as option */
|
||||
if ((yspec = yspec_new()) == NULL)
|
||||
if ((yspec = yspec_new(h, YANG_DATA_TOP)) == NULL)
|
||||
goto done;
|
||||
clicon_dbspec_yang_set(h, yspec);
|
||||
|
||||
/* Load restconf plugins before yangs are loaded (eg extension callbacks) */
|
||||
if ((dir = clicon_restconf_dir(h)) != NULL)
|
||||
|
|
|
|||
|
|
@ -122,10 +122,6 @@ snmp_terminate(clixon_handle h)
|
|||
x = NULL;
|
||||
}
|
||||
clicon_rpc_close_session(h);
|
||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||
ys_free(yspec);
|
||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
||||
ys_free(yspec);
|
||||
yang_exit(h);
|
||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||
cvec_free(nsctx);
|
||||
|
|
@ -524,9 +520,8 @@ main(int argc,
|
|||
goto done;
|
||||
|
||||
/* Create top-level yang spec and store as option */
|
||||
if ((yspec = yspec_new()) == NULL)
|
||||
if ((yspec = yspec_new(h, YANG_DATA_TOP)) == NULL)
|
||||
goto done;
|
||||
clicon_dbspec_yang_set(h, yspec);
|
||||
|
||||
/* Load Yang modules
|
||||
* 1. Load a yang module as a specific absolute filename */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue