Removed obsolete config yang handler
Added base netconf as default namespace in canonical nsctx
This commit is contained in:
parent
52629d7b35
commit
d0e97ee338
8 changed files with 7 additions and 50 deletions
|
|
@ -111,8 +111,6 @@ backend_terminate(clicon_handle h)
|
||||||
yspec_free(yspec);
|
yspec_free(yspec);
|
||||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||||
cvec_free(nsctx);
|
cvec_free(nsctx);
|
||||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
|
||||||
yspec_free(yspec);
|
|
||||||
if ((x = clicon_nacm_ext(h)) != NULL)
|
if ((x = clicon_nacm_ext(h)) != NULL)
|
||||||
xml_free(x);
|
xml_free(x);
|
||||||
if ((x = clicon_conf_xml(h)) != NULL)
|
if ((x = clicon_conf_xml(h)) != NULL)
|
||||||
|
|
@ -519,7 +517,6 @@ main(int argc,
|
||||||
usage(h, argv[0]);
|
usage(h, argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
clicon_config_yang_set(h, yspecfg);
|
|
||||||
/* External NACM file? */
|
/* External NACM file? */
|
||||||
nacm_mode = clicon_option_str(h, "CLICON_NACM_MODE");
|
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)
|
||||||
|
|
|
||||||
|
|
@ -169,8 +169,6 @@ cli_terminate(clicon_handle h)
|
||||||
clicon_rpc_close_session(h);
|
clicon_rpc_close_session(h);
|
||||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||||
yspec_free(yspec);
|
yspec_free(yspec);
|
||||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
|
||||||
yspec_free(yspec);
|
|
||||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||||
cvec_free(nsctx);
|
cvec_free(nsctx);
|
||||||
if ((x = clicon_conf_xml(h)) != NULL)
|
if ((x = clicon_conf_xml(h)) != NULL)
|
||||||
|
|
@ -361,7 +359,6 @@ main(int argc, char **argv)
|
||||||
usage(h, argv[0]);
|
usage(h, argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
clicon_config_yang_set(h, yspecfg);
|
|
||||||
/* Now rest of options */
|
/* Now rest of options */
|
||||||
opterr = 0;
|
opterr = 0;
|
||||||
optind = 1;
|
optind = 1;
|
||||||
|
|
|
||||||
|
|
@ -331,8 +331,6 @@ netconf_terminate(clicon_handle h)
|
||||||
clicon_rpc_close_session(h);
|
clicon_rpc_close_session(h);
|
||||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||||
yspec_free(yspec);
|
yspec_free(yspec);
|
||||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
|
||||||
yspec_free(yspec);
|
|
||||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||||
cvec_free(nsctx);
|
cvec_free(nsctx);
|
||||||
if ((x = clicon_conf_xml(h)) != NULL)
|
if ((x = clicon_conf_xml(h)) != NULL)
|
||||||
|
|
@ -449,7 +447,6 @@ main(int argc,
|
||||||
/* Find and read configfile */
|
/* Find and read configfile */
|
||||||
if (clicon_options_main(h, yspecfg) < 0)
|
if (clicon_options_main(h, yspecfg) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
clicon_config_yang_set(h, yspecfg);
|
|
||||||
/* Now rest of options */
|
/* Now rest of options */
|
||||||
optind = 1;
|
optind = 1;
|
||||||
opterr = 0;
|
opterr = 0;
|
||||||
|
|
|
||||||
|
|
@ -605,8 +605,6 @@ restconf_terminate(clicon_handle h)
|
||||||
clicon_rpc_close_session(h);
|
clicon_rpc_close_session(h);
|
||||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||||
yspec_free(yspec);
|
yspec_free(yspec);
|
||||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
|
||||||
yspec_free(yspec);
|
|
||||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||||
cvec_free(nsctx);
|
cvec_free(nsctx);
|
||||||
if ((x = clicon_conf_xml(h)) != NULL)
|
if ((x = clicon_conf_xml(h)) != NULL)
|
||||||
|
|
|
||||||
|
|
@ -648,7 +648,6 @@ main(int argc,
|
||||||
/* Find and read configfile */
|
/* Find and read configfile */
|
||||||
if (clicon_options_main(h, yspecfg) < 0)
|
if (clicon_options_main(h, yspecfg) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
clicon_config_yang_set(h, yspecfg);
|
|
||||||
stream_path = clicon_option_str(h, "CLICON_STREAM_PATH");
|
stream_path = clicon_option_str(h, "CLICON_STREAM_PATH");
|
||||||
/* Now rest of options, some overwrite option file */
|
/* Now rest of options, some overwrite option file */
|
||||||
optind = 1;
|
optind = 1;
|
||||||
|
|
|
||||||
|
|
@ -67,9 +67,6 @@ int clicon_nsctx_global_set(clicon_handle h, cvec *nsctx);
|
||||||
cxobj * clicon_nacm_ext(clicon_handle h);
|
cxobj * clicon_nacm_ext(clicon_handle h);
|
||||||
int clicon_nacm_ext_set(clicon_handle h, cxobj *xn);
|
int clicon_nacm_ext_set(clicon_handle h, cxobj *xn);
|
||||||
|
|
||||||
yang_stmt * clicon_config_yang(clicon_handle h);
|
|
||||||
int clicon_config_yang_set(clicon_handle h, yang_stmt *ys);
|
|
||||||
|
|
||||||
cxobj *clicon_conf_xml(clicon_handle h);
|
cxobj *clicon_conf_xml(clicon_handle h);
|
||||||
int clicon_conf_xml_set(clicon_handle h, cxobj *x);
|
int clicon_conf_xml_set(clicon_handle h, cxobj *x);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,10 @@ clicon_dbspec_yang_set(clicon_handle h,
|
||||||
* Canonical: use prefix and namespace specified in the yang modules.
|
* Canonical: use prefix and namespace specified in the yang modules.
|
||||||
* @param[in] h Clicon handle
|
* @param[in] h Clicon handle
|
||||||
* @retval nsctx Namespace context (malloced)
|
* @retval nsctx Namespace context (malloced)
|
||||||
|
* @code
|
||||||
|
* cvec *nsctx;
|
||||||
|
* nsctx = clicon_nsctx_global_get(h);
|
||||||
|
* @endcode
|
||||||
*/
|
*/
|
||||||
cvec *
|
cvec *
|
||||||
clicon_nsctx_global_get(clicon_handle h)
|
clicon_nsctx_global_get(clicon_handle h)
|
||||||
|
|
@ -186,41 +190,6 @@ clicon_nacm_ext_set(clicon_handle h,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 1 /* Temporary function until "Top-level Yang symbol cannot be called "config"" is fixed */
|
|
||||||
/*! Get YANG specification for clixon config
|
|
||||||
* Must use hash functions directly since they are not strings.
|
|
||||||
*/
|
|
||||||
yang_stmt *
|
|
||||||
clicon_config_yang(clicon_handle h)
|
|
||||||
{
|
|
||||||
clicon_hash_t *cdat = clicon_data(h);
|
|
||||||
size_t len;
|
|
||||||
void *p;
|
|
||||||
|
|
||||||
if ((p = clicon_hash_value(cdat, "control_yang", &len)) != NULL)
|
|
||||||
return *(yang_stmt **)p;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Set yang specification for control
|
|
||||||
* ys must be a malloced pointer
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
clicon_config_yang_set(clicon_handle h,
|
|
||||||
yang_stmt *ys)
|
|
||||||
{
|
|
||||||
clicon_hash_t *cdat = clicon_data(h);
|
|
||||||
|
|
||||||
/* It is the pointer to ys that should be copied by hash,
|
|
||||||
so we send a ptr to the ptr to indicate what to copy.
|
|
||||||
*/
|
|
||||||
if (clicon_hash_add(cdat, "control_yang", &ys, sizeof(ys)) == NULL)
|
|
||||||
return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*! Get YANG specification for Clixon system options and features
|
/*! Get YANG specification for Clixon system options and features
|
||||||
* Must use hash functions directly since they are not strings.
|
* Must use hash functions directly since they are not strings.
|
||||||
* Example: features are typically accessed directly in the config tree.
|
* Example: features are typically accessed directly in the config tree.
|
||||||
|
|
|
||||||
|
|
@ -387,6 +387,9 @@ xml_nsctx_yangspec(yang_stmt *yspec,
|
||||||
if (xml_nsctx_add(nc, yang_argument_get(yprefix), yang_argument_get(ynamespace)) < 0)
|
if (xml_nsctx_add(nc, yang_argument_get(yprefix), yang_argument_get(ynamespace)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
/* Add base netconf namespace as default and "nc" prefix */
|
||||||
|
if (xml_nsctx_add(nc, NULL, NETCONF_BASE_NAMESPACE) < 0)
|
||||||
|
goto done;
|
||||||
if (xml_nsctx_add(nc, NETCONF_BASE_PREFIX, NETCONF_BASE_NAMESPACE) < 0)
|
if (xml_nsctx_add(nc, NETCONF_BASE_PREFIX, NETCONF_BASE_NAMESPACE) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
*ncp = nc;
|
*ncp = nc;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue