Reworked cli show mem to yang domains
This commit is contained in:
parent
212be7ad57
commit
8901d00e47
6 changed files with 53 additions and 199 deletions
|
|
@ -64,7 +64,6 @@ int xml_yang_mount_set(clixon_handle h, cxobj *x, yang_stmt *yspec);
|
|||
int yang_mount_xtop2xmnt(cxobj *xtop, cvec **cvvp);
|
||||
int yang_mount_yspec2ymnt(yang_stmt *yspec, cvec **cvvp);
|
||||
int yang_schema_mount_statedata(clixon_handle h, yang_stmt *yspec, char *xpath, cvec *nsc, cxobj **xret, cxobj **xerr);
|
||||
int yang_schema_mount_statistics(clixon_handle h, cxobj *xt, int modules, cbuf *cb);
|
||||
int yang_schema_yanglib_parse_mount(clixon_handle h, cxobj *xt);
|
||||
int yang_schema_get_child(clixon_handle h, cxobj *x1, cxobj *x1c, yang_stmt **yc);
|
||||
int yang_schema_yspec_rm(clixon_handle h, cxobj *xmnt);
|
||||
|
|
|
|||
|
|
@ -695,100 +695,6 @@ yang_schema_mount_statedata(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
|
||||
/*! Statistics about mountpoints
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] xtop Top XML node
|
||||
* @param[in] modules
|
||||
* @param[in] cb
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @see yang_schema_mount_statedata
|
||||
*/
|
||||
int
|
||||
yang_schema_mount_statistics(clixon_handle h,
|
||||
cxobj *xtop,
|
||||
int modules,
|
||||
cbuf *cb)
|
||||
{
|
||||
int retval = -1;
|
||||
cvec *cvv = NULL;
|
||||
cg_var *cv;
|
||||
cxobj *xmnt;
|
||||
yang_stmt *yspec;
|
||||
yang_stmt *ym;
|
||||
int ret;
|
||||
char *xpath = NULL;
|
||||
uint64_t nr;
|
||||
size_t sz;
|
||||
cg_var *cv1;
|
||||
yang_stmt *yspec1;
|
||||
int inext;
|
||||
|
||||
if (yang_mount_xtop2xmnt(xtop, &cvv) < 0)
|
||||
goto done;
|
||||
cv = NULL;
|
||||
while ((cv = cvec_each(cvv, cv)) != NULL) {
|
||||
if ((xmnt = cv_void_get(cv)) == NULL)
|
||||
continue;
|
||||
if ((ret = xml_yang_mount_get(h, xmnt, NULL, &xpath, &yspec)) < 0)
|
||||
goto done;
|
||||
if (ret == 0)
|
||||
continue;
|
||||
cprintf(cb, "<module-set><name>mountpoint: ");
|
||||
xml_chardata_cbuf_append(cb, 0, xpath);
|
||||
cprintf(cb, "</name>");
|
||||
nr = 0; sz = 0;
|
||||
cv1 = NULL; /* For detecting shared YANGs */
|
||||
if (yspec) {
|
||||
cv1 = cv;
|
||||
while ((cv1 = cvec_each(cvv, cv1)) != NULL) {
|
||||
if (cv == cv1)
|
||||
continue;
|
||||
if ((ret = xml_yang_mount_get(h, cv_void_get(cv1), NULL, NULL, &yspec1)) < 0)
|
||||
goto done;
|
||||
if (yspec1 && yspec == yspec1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cv1 != NULL || yspec == NULL){
|
||||
cprintf(cb, "<nr>%" PRIu64 "</nr><size>%zu</size>", nr, sz);
|
||||
cprintf(cb, "</module-set>");
|
||||
if (xpath){
|
||||
free(xpath);
|
||||
xpath = NULL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (yang_stats(yspec, 0, &nr, &sz) < 0)
|
||||
goto done;
|
||||
cprintf(cb, "<nr>%" PRIu64 "</nr><size>%zu</size>", nr, sz);
|
||||
if (modules){
|
||||
inext = 0;
|
||||
while ((ym = yn_iter(yspec, &inext)) != NULL) {
|
||||
cprintf(cb, "<module><name>%s</name>", yang_argument_get(ym));
|
||||
nr = 0; sz = 0;
|
||||
if (yang_stats(ym, 0, &nr, &sz) < 0)
|
||||
goto done;
|
||||
cprintf(cb, "<nr>%" PRIu64 "</nr><size>%zu</size>", nr, sz);
|
||||
cprintf(cb, "</module>");
|
||||
}
|
||||
}
|
||||
cprintf(cb, "</module-set>");
|
||||
if (xpath){
|
||||
free(xpath);
|
||||
xpath = NULL;
|
||||
}
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
if (xpath)
|
||||
free(xpath);
|
||||
if (cvv)
|
||||
cvec_free(cvv);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*! Get yanglib from user plugin callback, parse it and mount it
|
||||
*
|
||||
* Optionally check for shared yspec
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue