experimental netconf yang spec
This commit is contained in:
parent
822aac18a1
commit
056b5c97dd
16 changed files with 250 additions and 147 deletions
|
|
@ -382,8 +382,6 @@ clicon_options_main(clicon_handle h)
|
|||
/* Read configfile */
|
||||
if (clicon_option_readfile_xml(copt, configfile, yspec) < 0)
|
||||
goto done;
|
||||
if (yspec)
|
||||
yspec_free(yspec);
|
||||
}
|
||||
else {
|
||||
#ifdef CONFIG_COMPAT
|
||||
|
|
@ -402,6 +400,9 @@ clicon_options_main(clicon_handle h)
|
|||
}
|
||||
retval = 0;
|
||||
done:
|
||||
if (yspec) /* The clixon yang-spec is not used after this */
|
||||
yspec_free(yspec);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -704,7 +705,7 @@ clicon_quiet_mode_set(clicon_handle h, int val)
|
|||
return clicon_option_int_set(h, "CLICON_QUIET", val);
|
||||
}
|
||||
|
||||
/*! Get YANG specification
|
||||
/*! Get YANG specification for application
|
||||
* Must use hash functions directly since they are not strings.
|
||||
*/
|
||||
yang_spec *
|
||||
|
|
@ -719,7 +720,7 @@ clicon_dbspec_yang(clicon_handle h)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*! Set yang database specification
|
||||
/*! Set yang specification for application
|
||||
* ys must be a malloced pointer
|
||||
*/
|
||||
int
|
||||
|
|
@ -736,6 +737,39 @@ clicon_dbspec_yang_set(clicon_handle h,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*! Get YANG NETCONF specification
|
||||
* Must use hash functions directly since they are not strings.
|
||||
*/
|
||||
yang_spec *
|
||||
clicon_netconf_yang(clicon_handle h)
|
||||
{
|
||||
clicon_hash_t *cdat = clicon_data(h);
|
||||
size_t len;
|
||||
void *p;
|
||||
|
||||
if ((p = hash_value(cdat, "netconf_yang", &len)) != NULL)
|
||||
return *(yang_spec **)p;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*! Set yang netconf specification
|
||||
* ys must be a malloced pointer
|
||||
*/
|
||||
int
|
||||
clicon_netconf_yang_set(clicon_handle h,
|
||||
struct yang_spec *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 (hash_add(cdat, "netconf_yang", &ys, sizeof(ys)) == NULL)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*! Get dbspec name as read from spec. Can be used in CLI '@' syntax.
|
||||
* XXX: this we muśt change,...
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue