commit xpath

This commit is contained in:
Olof hagsand 2016-02-24 21:16:15 +01:00
parent 554c1cb9de
commit 9bd941ab76
14 changed files with 306 additions and 130 deletions

View file

@ -126,8 +126,8 @@ candidate_commit(clicon_handle h,
char *running)
{
int retval = -1;
// int i, j;
// int failed = 0;
int i;
cxobj *xn;
struct stat sb;
void *firsterr = NULL;
yang_spec *yspec;
@ -171,6 +171,25 @@ candidate_commit(clicon_handle h,
goto done;
if (debug)
transaction_print(stderr, td);
/* Mark as changed in tree */
for (i=0; i<td->td_dlen; i++){ /* Also down */
xn = td->td_dvec[i];
xml_flag_set(xn, XML_FLAG_DEL);
xml_apply(xn, CX_ELMNT, (xml_applyfn_t*)xml_flag_set, (void*)XML_FLAG_DEL);
}
for (i=0; i<td->td_alen; i++){ /* Also down */
xn = td->td_avec[i];
xml_flag_set(xn, XML_FLAG_ADD);
xml_apply(xn, CX_ELMNT, (xml_applyfn_t*)xml_flag_set, (void*)XML_FLAG_ADD);
}
for (i=0; i<td->td_clen; i++){ /* Also up */
xn = td->td_scvec[i];
xml_flag(xn, XML_FLAG_CHANGE);
xml_apply_ancestor(xn, (xml_applyfn_t*)xml_flag_set, (void*)XML_FLAG_CHANGE);
xn = td->td_tcvec[i];
xml_flag_set(xn, XML_FLAG_CHANGE);
xml_apply_ancestor(xn, (xml_applyfn_t*)xml_flag_set, (void*)XML_FLAG_CHANGE);
}
/* 4. Call plugin transaction start callbacks */
if (plugin_transaction_begin(h, td) < 0)
@ -236,6 +255,8 @@ candidate_validate(clicon_handle h,
struct stat sb;
yang_spec *yspec;
transaction_data_t *td = NULL;
int i;
cxobj *xn;
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clicon_err(OE_FATAL, 0, "No DB_SPEC");
@ -276,6 +297,22 @@ candidate_validate(clicon_handle h,
if (debug)
transaction_print(stderr, td);
/* Mark as changed in tree */
for (i=0; i<td->td_dlen; i++){ /* Also down */
xn = td->td_dvec[i];
xml_flag_set(xn, XML_FLAG_DEL);
}
for (i=0; i<td->td_alen; i++){ /* Also down */
xn = td->td_avec[i];
xml_flag_set(xn, XML_FLAG_ADD);
}
for (i=0; i<td->td_clen; i++){ /* Also up */
xn = td->td_scvec[i];
xml_flag_set(xn, XML_FLAG_CHANGE);
xn = td->td_tcvec[i];
xml_flag(xn, XML_FLAG_CHANGE);
}
/* 4. Call plugin start transaction callbacks */
if (plugin_transaction_begin(h, td) < 0)

View file

@ -1492,7 +1492,7 @@ show_conf_xpath(clicon_handle h, cvec *cvv, cg_var *arg)
cg_var *cv;
cxobj *xt = NULL;
cxobj **xv = NULL;
int xlen;
size_t xlen;
int i;
if (arg == NULL || (str = cv_string_get(arg)) == NULL){
@ -1516,7 +1516,7 @@ show_conf_xpath(clicon_handle h, cvec *cvv, cg_var *arg)
cv = cvec_find_var(cvv, "xpath");
xpath = cv_string_get(cv);
yspec = clicon_dbspec_yang(h);
if (xmldb_get_xpath(dbname, xpath, yspec, &xt, &xv, &xlen) < 0)
if (xmldb_get_vec(dbname, xpath, yspec, &xt, &xv, &xlen) < 0)
goto done;
for (i=0; i<xlen; i++)
clicon_xml2file(stdout, xv[i], 0, 1);

View file

@ -219,11 +219,11 @@ netconf_xpath(cxobj *xsearch,
cxobj *xorig)
{
cxobj *x;
int retval = -1;
char *selector;
int retval = -1;
char *selector;
cxobj **xv;
int xlen;
int i;
size_t xlen;
int i;
if ((selector = xml_find_value(xfilter, "select")) == NULL){
netconf_create_rpc_error(cb_err, xorig,