Add ping to cli example, misc debug

This commit is contained in:
Olof hagsand 2024-12-05 15:37:09 +01:00
parent 379644a570
commit 30f9e174fa
7 changed files with 74 additions and 8 deletions

View file

@ -217,7 +217,7 @@ typedef int (plgreset_t)(clixon_handle h, const char *db);
* @param[in] h Clixon handle
* @param[in] xpath Part of state requested
* @param[in] nsc XPath namespace context.
* @param[out] xtop XML tree where data is added
* @param[out] xconfig XML tree where data is added
* @retval 0 OK
* @retval -1 Fatal error
*
@ -225,7 +225,7 @@ typedef int (plgreset_t)(clixon_handle h, const char *db);
* @note The system does not validate the xml, unless CLICON_VALIDATE_STATE_XML is set
* @see clixon_pagination_cb_register for special paginated state data callback
*/
typedef int (plgstatedata_t)(clixon_handle h, cvec *nsc, char *xpath, cxobj *xtop);
typedef int (plgstatedata_t)(clixon_handle h, cvec *nsc, char *xpath, cxobj *xconfig);
/*! Pagination-data type
*

View file

@ -327,6 +327,7 @@ int yang_order(yang_stmt *y);
int yang_print_cb(FILE *f, yang_stmt *yn, clicon_output_cb *fn);
int yang_print(FILE *f, yang_stmt *yn);
int yang_print_cbuf(cbuf *cb, yang_stmt *yn, int marginal, int pretty);
int yang_dump1(FILE *f, yang_stmt *yn);
int yang_deviation(yang_stmt *ys, void *arg);
int yang_spec_print(FILE *f, yang_stmt *yspec);
int yang_spec_dump(yang_stmt *yspec, int debuglevel);

View file

@ -1959,7 +1959,6 @@ netconf_hello_server(clixon_handle h,
return retval;
}
/*! Add internal error info to existing netconf error message by rewriting
*
* If a eg sanity check detects errors in internal messages passing, such as from a plugin or

View file

@ -1496,6 +1496,7 @@ yn_insert1(yang_stmt *ys_parent,
* ...ynext...
* }
* @endcode
* @note NULL children are skipped, which means inext may increment by more than 1
*/
yang_stmt *
yn_iter(yang_stmt *yparent,
@ -2496,6 +2497,22 @@ yang_spec_dump(yang_stmt *yspec,
return retval;
}
/*! Dump pointers to children, debug function
*/
int
yang_dump1(FILE *f,
yang_stmt *yn)
{
yang_stmt *ys;
int inext;
inext = 0;
while ((ys = yn_iter(yn, &inext)) != NULL) {
fprintf(stderr, "%2d %p %s %s\n", inext-1, ys, yang_key2str(yang_keyword_get(ys)), yang_argument_get(ys));
}
return 0;
}
/*! Print yang specification to cligen buf
*
* @param[in] cb Cligen buffer. This is where the pretty print is.

View file

@ -908,6 +908,7 @@ yang_schema_yspec_rm(clixon_handle h,
int retval = -1;
yang_stmt *yspec = NULL;
char *xpath = NULL;
int ret;
if ((ret = xml_yang_mount_get(h, xmnt, NULL, &xpath, &yspec)) < 0)
@ -915,6 +916,18 @@ yang_schema_yspec_rm(clixon_handle h,
if (ret == 1 && xpath != NULL && yspec != NULL){
if (yang_cvec_rm(yspec, xpath) < 0)
goto done;
#if 0
cvec *cvv;
/* see https://github.com/clicon/clixon-controller/issues/169
* cannot remove yspec since it may still be in use by caches
*/
cvv = yang_cvec_get(yspec);
if (cvv && cvec_len(cvv) == 0){
ys_prune_self(yspec);
ys_free(yspec);
yspec = NULL;
}
#endif
}
retval = 0;
done: