CLICON_XML_SORT option (in clixon-config.yang) has been removed and set to true permanently since setting it to false is obsolete.
This commit is contained in:
parent
0103d58994
commit
32ea957a52
14 changed files with 28 additions and 145 deletions
|
|
@ -79,6 +79,7 @@
|
||||||
* CLICON_YANG_MAIN_DIR Provides a directory where all yang modules should be loaded.
|
* CLICON_YANG_MAIN_DIR Provides a directory where all yang modules should be loaded.
|
||||||
|
|
||||||
### API changes on existing features (you may need to change your code)
|
### API changes on existing features (you may need to change your code)
|
||||||
|
* CLICON_XML_SORT option (in clixon-config.yang) has been removed and set to true permanently since setting it to false is obsolete.
|
||||||
* Strict namespace setting can be a problem when upgrading existing database files, such as startup-db or persistent running-db, or any other saved XML file.
|
* Strict namespace setting can be a problem when upgrading existing database files, such as startup-db or persistent running-db, or any other saved XML file.
|
||||||
* For backward compatibility, load of startup and running set CLICON_XML_NS_STRICT to false temporarily.
|
* For backward compatibility, load of startup and running set CLICON_XML_NS_STRICT to false temporarily.
|
||||||
* Removed `delete-config` support for candidate db since it is not supported in RFC6241.
|
* Removed `delete-config` support for candidate db since it is not supported in RFC6241.
|
||||||
|
|
|
||||||
|
|
@ -482,7 +482,7 @@ from_client_edit_config(clicon_handle h,
|
||||||
/* Cant do this earlier since we dont have a yang spec to
|
/* Cant do this earlier since we dont have a yang spec to
|
||||||
* the upper part of the tree, until we get the "config" tree.
|
* the upper part of the tree, until we get the "config" tree.
|
||||||
*/
|
*/
|
||||||
if (clicon_xml_sort(h) && xml_apply0(xc, CX_ELMNT, xml_sort, NULL) < 0)
|
if (xml_apply0(xc, CX_ELMNT, xml_sort, NULL) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if ((ret = xmldb_put(h, target, operation, xc, cbret)) < 0){
|
if ((ret = xmldb_put(h, target, operation, xc, cbret)) < 0){
|
||||||
clicon_debug(1, "%s ERROR PUT", __FUNCTION__);
|
clicon_debug(1, "%s ERROR PUT", __FUNCTION__);
|
||||||
|
|
|
||||||
|
|
@ -832,8 +832,6 @@ main(int argc,
|
||||||
goto done;
|
goto done;
|
||||||
if (xmldb_setopt(h, "pretty", (void*)(intptr_t)clicon_option_bool(h, "CLICON_XMLDB_PRETTY")) < 0)
|
if (xmldb_setopt(h, "pretty", (void*)(intptr_t)clicon_option_bool(h, "CLICON_XMLDB_PRETTY")) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (xmldb_setopt(h, "sort", (void*)(intptr_t)clicon_option_bool(h, "CLICON_XML_SORT")) < 0)
|
|
||||||
goto done;
|
|
||||||
/* Startup mode needs to be defined, */
|
/* Startup mode needs to be defined, */
|
||||||
startup_mode = clicon_startup_mode(h);
|
startup_mode = clicon_startup_mode(h);
|
||||||
if (startup_mode == -1){
|
if (startup_mode == -1){
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,6 @@ struct text_handle {
|
||||||
Assumes single backend*/
|
Assumes single backend*/
|
||||||
char *th_format; /* Datastroe format: xml / json */
|
char *th_format; /* Datastroe format: xml / json */
|
||||||
int th_pretty; /* Store xml/json pretty-printed. */
|
int th_pretty; /* Store xml/json pretty-printed. */
|
||||||
int th_sort; /* Sort XML lists and leaf-lists alphabetically
|
|
||||||
(unless ordered-by user) */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Struct per database in hash */
|
/* Struct per database in hash */
|
||||||
|
|
@ -241,8 +239,6 @@ text_getopt(xmldb_handle xh,
|
||||||
*value = th->th_format;
|
*value = th->th_format;
|
||||||
else if (strcmp(optname, "pretty") == 0)
|
else if (strcmp(optname, "pretty") == 0)
|
||||||
*value = &th->th_pretty;
|
*value = &th->th_pretty;
|
||||||
else if (strcmp(optname, "sort") == 0)
|
|
||||||
*value = &th->th_sort;
|
|
||||||
else{
|
else{
|
||||||
clicon_err(OE_PLUGIN, 0, "Option %s not implemented by plugin", optname);
|
clicon_err(OE_PLUGIN, 0, "Option %s not implemented by plugin", optname);
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -292,9 +288,6 @@ text_setopt(xmldb_handle xh,
|
||||||
else if (strcmp(optname, "pretty") == 0){
|
else if (strcmp(optname, "pretty") == 0){
|
||||||
th->th_pretty = (intptr_t)value;
|
th->th_pretty = (intptr_t)value;
|
||||||
}
|
}
|
||||||
else if (strcmp(optname, "sort") == 0){
|
|
||||||
th->th_sort = (intptr_t)value;
|
|
||||||
}
|
|
||||||
else{
|
else{
|
||||||
clicon_err(OE_PLUGIN, 0, "Option %s not implemented by plugin", optname);
|
clicon_err(OE_PLUGIN, 0, "Option %s not implemented by plugin", optname);
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -551,14 +544,8 @@ text_get(xmldb_handle xh,
|
||||||
/* Add default values (if not set) */
|
/* Add default values (if not set) */
|
||||||
if (xml_apply(xt, CX_ELMNT, xml_default, NULL) < 0)
|
if (xml_apply(xt, CX_ELMNT, xml_default, NULL) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
/* Order XML children according to YANG.
|
|
||||||
* XXX: should this be !th->th_sort?
|
|
||||||
*/
|
|
||||||
if (!th->th_sort)
|
|
||||||
if (xml_apply(xt, CX_ELMNT, xml_order, NULL) < 0)
|
|
||||||
goto done;
|
|
||||||
#if 1 /* debug */
|
#if 1 /* debug */
|
||||||
if (th->th_sort && xml_apply0(xt, -1, xml_sort_verify, NULL) < 0)
|
if (xml_apply0(xt, -1, xml_sort_verify, NULL) < 0)
|
||||||
clicon_log(LOG_NOTICE, "%s: sort verify failed #2", __FUNCTION__);
|
clicon_log(LOG_NOTICE, "%s: sort verify failed #2", __FUNCTION__);
|
||||||
#endif
|
#endif
|
||||||
if (debug>1)
|
if (debug>1)
|
||||||
|
|
@ -741,7 +728,7 @@ text_modify(struct text_handle *th,
|
||||||
}
|
}
|
||||||
/* See if there is a corresponding node in the base tree */
|
/* See if there is a corresponding node in the base tree */
|
||||||
x0c = NULL;
|
x0c = NULL;
|
||||||
if (match_base_child(x0, x1c, &x0c, th->th_sort, yc) < 0)
|
if (match_base_child(x0, x1c, &x0c, yc) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
x0vec[i++] = x0c;
|
x0vec[i++] = x0c;
|
||||||
}
|
}
|
||||||
|
|
@ -865,7 +852,7 @@ text_modify_top(struct text_handle *th,
|
||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
/* See if there is a corresponding node in the base tree */
|
/* See if there is a corresponding node in the base tree */
|
||||||
if (match_base_child(x0, x1c, &x0c, th->th_sort, yc) < 0)
|
if (match_base_child(x0, x1c, &x0c, yc) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (text_modify(th, x0c, (yang_node*)yc, x0, x1c, op, cbret) < 0)
|
if (text_modify(th, x0c, (yang_node*)yc, x0, x1c, op, cbret) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -996,14 +983,8 @@ text_put(xmldb_handle xh,
|
||||||
xml_name(x0));
|
xml_name(x0));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
/* Add yang specification backpointer to all XML nodes
|
|
||||||
* This is already done in from_client_edit_config() */
|
|
||||||
if (xml_apply(x1, CX_ELMNT, xml_spec_populate, yspec) < 0)
|
|
||||||
goto done;
|
|
||||||
#endif
|
|
||||||
#if 0 /* debug */
|
#if 0 /* debug */
|
||||||
if (th->th_sort && xml_apply0(x1, -1, xml_sort_verify, NULL) < 0)
|
if (xml_apply0(x1, -1, xml_sort_verify, NULL) < 0)
|
||||||
clicon_log(LOG_NOTICE, "%s: verify failed #1", __FUNCTION__);
|
clicon_log(LOG_NOTICE, "%s: verify failed #1", __FUNCTION__);
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
|
|
@ -1029,7 +1010,7 @@ text_put(xmldb_handle xh,
|
||||||
if (xml_tree_prune_flagged(x0, XML_FLAG_MARK, 1) < 0)
|
if (xml_tree_prune_flagged(x0, XML_FLAG_MARK, 1) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
#if 0 /* debug */
|
#if 0 /* debug */
|
||||||
if (th->th_sort && xml_apply0(x0, -1, xml_sort_verify, NULL) < 0)
|
if (xml_apply0(x0, -1, xml_sort_verify, NULL) < 0)
|
||||||
clicon_log(LOG_NOTICE, "%s: verify failed #3", __FUNCTION__);
|
clicon_log(LOG_NOTICE, "%s: verify failed #3", __FUNCTION__);
|
||||||
#endif
|
#endif
|
||||||
/* Write back to datastore cache if first time */
|
/* Write back to datastore cache if first time */
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ fib_route_rpc(clicon_handle h,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* Print result */
|
/* Print result */
|
||||||
xml2txt(stdout, xml_child_i(xret, 0), 1);
|
xml2txt(stdout, xml_child_i(xret, 0), 0);
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
if (xret)
|
if (xret)
|
||||||
|
|
|
||||||
|
|
@ -153,9 +153,6 @@ static inline char *clicon_xmldb_dir(clicon_handle h){
|
||||||
static inline char *clicon_xmldb_plugin(clicon_handle h){
|
static inline char *clicon_xmldb_plugin(clicon_handle h){
|
||||||
return clicon_option_str(h, "CLICON_XMLDB_PLUGIN");
|
return clicon_option_str(h, "CLICON_XMLDB_PLUGIN");
|
||||||
}
|
}
|
||||||
static inline int clicon_xml_sort(clicon_handle h){
|
|
||||||
return clicon_option_bool(h, "CLICON_XML_SORT");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-- Specific option access functions for YANG options w type conversion--*/
|
/*-- Specific option access functions for YANG options w type conversion--*/
|
||||||
int clicon_cli_genmodel(clicon_handle h);
|
int clicon_cli_genmodel(clicon_handle h);
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,6 @@ int api_path_fmt2xpath(char *api_path_fmt, cvec *cvv, char **xpath);
|
||||||
int xml_tree_prune_flagged_sub(cxobj *xt, int flag, int test, int *upmark);
|
int xml_tree_prune_flagged_sub(cxobj *xt, int flag, int test, int *upmark);
|
||||||
int xml_tree_prune_flagged(cxobj *xt, int flag, int test);
|
int xml_tree_prune_flagged(cxobj *xt, int flag, int test);
|
||||||
int xml_default(cxobj *x, void *arg);
|
int xml_default(cxobj *x, void *arg);
|
||||||
int xml_order(cxobj *x, void *arg);
|
|
||||||
int xml_sanity(cxobj *x, void *arg);
|
int xml_sanity(cxobj *x, void *arg);
|
||||||
int xml_non_config_data(cxobj *xt, void *arg);
|
int xml_non_config_data(cxobj *xt, void *arg);
|
||||||
int xml_spec_populate_rpc(clicon_handle h, cxobj *x, yang_spec *yspec);
|
int xml_spec_populate_rpc(clicon_handle h, cxobj *x, yang_spec *yspec);
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,6 @@
|
||||||
#ifndef _CLIXON_XML_SORT_H
|
#ifndef _CLIXON_XML_SORT_H
|
||||||
#define _CLIXON_XML_SORT_H
|
#define _CLIXON_XML_SORT_H
|
||||||
|
|
||||||
/* Sort and binary search of XML children
|
|
||||||
* XXX This variable is a kludge since low-level functions xml_merge/xml_diff calls
|
|
||||||
* match_base_child without handle
|
|
||||||
* @see clicon_xml_sort
|
|
||||||
*/
|
|
||||||
extern int xml_child_sort;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prototypes
|
* Prototypes
|
||||||
*/
|
*/
|
||||||
|
|
@ -55,6 +48,6 @@ int xml_insert_pos(cxobj *x0, char *name, int yangi, enum rfc_6020 keyword,
|
||||||
int upper);
|
int upper);
|
||||||
cxobj *xml_match(cxobj *x0, char *name, enum rfc_6020 keyword, int keynr, char **keyvec, char **keyval);
|
cxobj *xml_match(cxobj *x0, char *name, enum rfc_6020 keyword, int keynr, char **keyvec, char **keyval);
|
||||||
int xml_sort_verify(cxobj *x, void *arg);
|
int xml_sort_verify(cxobj *x, void *arg);
|
||||||
int match_base_child(cxobj *x0, cxobj *x1c, cxobj **x0cp, int xml_sort, yang_stmt *yc);
|
int match_base_child(cxobj *x0, cxobj *x1c, cxobj **x0cp, yang_stmt *yc);
|
||||||
|
|
||||||
#endif /* _CLIXON_XML_SORT_H */
|
#endif /* _CLIXON_XML_SORT_H */
|
||||||
|
|
|
||||||
|
|
@ -207,6 +207,8 @@ parse_configfile(clicon_handle h,
|
||||||
*xconfig = xt;
|
*xconfig = xt;
|
||||||
xt = NULL;
|
xt = NULL;
|
||||||
done:
|
done:
|
||||||
|
if (cbret)
|
||||||
|
cbuf_free(cbret);
|
||||||
if (xt)
|
if (xt)
|
||||||
xml_free(xt);
|
xml_free(xt);
|
||||||
if (f)
|
if (f)
|
||||||
|
|
@ -275,11 +277,6 @@ clicon_options_main(clicon_handle h,
|
||||||
goto done;
|
goto done;
|
||||||
/* Set clixon_conf pointer to handle */
|
/* Set clixon_conf pointer to handle */
|
||||||
clicon_conf_xml_set(h, xconfig);
|
clicon_conf_xml_set(h, xconfig);
|
||||||
/* Specific option handling */
|
|
||||||
if (clicon_option_bool(h, "CLICON_XML_SORT") == 1)
|
|
||||||
xml_child_sort = 1;
|
|
||||||
else
|
|
||||||
xml_child_sort = 0;
|
|
||||||
/* XXX Kludge to low-level functions to search for xml in all yang modules */
|
/* XXX Kludge to low-level functions to search for xml in all yang modules */
|
||||||
_CLICON_XML_NS_STRICT = clicon_option_bool(h, "CLICON_XML_NS_STRICT");
|
_CLICON_XML_NS_STRICT = clicon_option_bool(h, "CLICON_XML_NS_STRICT");
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
|
||||||
|
|
@ -988,8 +988,7 @@ xml_diff1(yang_stmt *ys,
|
||||||
clicon_err(OE_UNIX, errno, "Unknown element: %s", xml_name(x1c));
|
clicon_err(OE_UNIX, errno, "Unknown element: %s", xml_name(x1c));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* XXX xml_child_sort is global */
|
if (match_base_child(x2, x1c, &x2c, yc) < 0)
|
||||||
if (match_base_child(x2, x1c, &x2c, xml_child_sort, yc) < 0)
|
|
||||||
goto done;
|
goto done;
|
||||||
if (x2c == NULL){
|
if (x2c == NULL){
|
||||||
if (cxvec_append(x1c, x1vec, x1veclen) < 0)
|
if (cxvec_append(x1c, x1vec, x1veclen) < 0)
|
||||||
|
|
@ -1025,8 +1024,7 @@ xml_diff1(yang_stmt *ys,
|
||||||
clicon_err(OE_UNIX, errno, "Unknown element: %s", xml_name(x2c));
|
clicon_err(OE_UNIX, errno, "Unknown element: %s", xml_name(x2c));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* XXX xml_child_sort is global */
|
if (match_base_child(x1, x2c, &x1c, yc) < 0)
|
||||||
if (match_base_child(x1, x2c, &x1c, xml_child_sort, yc) < 0)
|
|
||||||
goto done;
|
goto done;
|
||||||
if (x1c == NULL)
|
if (x1c == NULL)
|
||||||
if (cxvec_append(x2c, x2vec, x2veclen) < 0)
|
if (cxvec_append(x2c, x2vec, x2veclen) < 0)
|
||||||
|
|
@ -1550,70 +1548,6 @@ xml_default(cxobj *xt,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Order XML children according to YANG
|
|
||||||
* @param[in] xt XML top of tree
|
|
||||||
* @param[in] arg Dummy (so it can be called from xml_apply)
|
|
||||||
* @see xml_sort XXX: how do they relate?
|
|
||||||
* Called from text_get *only*
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
xml_order(cxobj *xt,
|
|
||||||
void *arg)
|
|
||||||
{
|
|
||||||
int retval = -1;
|
|
||||||
yang_stmt *y;
|
|
||||||
yang_stmt *yc;
|
|
||||||
int i;
|
|
||||||
int j0;
|
|
||||||
int j;
|
|
||||||
cxobj *xc;
|
|
||||||
cxobj *xj;
|
|
||||||
char *yname; /* yang child name */
|
|
||||||
char *xname; /* xml child name */
|
|
||||||
|
|
||||||
if ((y = (yang_stmt*)xml_spec(xt)) == NULL){
|
|
||||||
retval = 0;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
j0 = 0;
|
|
||||||
/* Go through yang node's children and ensure that the
|
|
||||||
* xml children follow this order.
|
|
||||||
* Do not order the list or leaf-list children (have same name).
|
|
||||||
*/
|
|
||||||
for (i=0; i<y->ys_len; i++){
|
|
||||||
yc = y->ys_stmt[i];
|
|
||||||
if (!yang_datanode(yc))
|
|
||||||
continue;
|
|
||||||
yname = yc->ys_argument;
|
|
||||||
/* First go thru xml children with same name in rest of list */
|
|
||||||
for (; j0<xml_child_nr(xt); j0++){
|
|
||||||
xc = xml_child_i(xt, j0);
|
|
||||||
if (xml_type(xc) != CX_ELMNT)
|
|
||||||
continue;
|
|
||||||
xname = xml_name(xc);
|
|
||||||
if (strcmp(xname, yname))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* Now we have children not with same name */
|
|
||||||
for (j=j0; j<xml_child_nr(xt); j++){
|
|
||||||
xc = xml_child_i(xt, j);
|
|
||||||
if (xml_type(xc) != CX_ELMNT)
|
|
||||||
continue;
|
|
||||||
xname = xml_name(xc);
|
|
||||||
if (strcmp(xname, yname))
|
|
||||||
continue;
|
|
||||||
/* reorder */
|
|
||||||
xj = xml_child_i(xt, j0);
|
|
||||||
xml_child_i_set(xt, j0, xc);
|
|
||||||
xml_child_i_set(xt, j, xj);
|
|
||||||
j0++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
retval = 0;
|
|
||||||
done:
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Sanitize an xml tree: xml node has matching yang_stmt pointer
|
/*! Sanitize an xml tree: xml node has matching yang_stmt pointer
|
||||||
* @param[in] xt XML top of tree
|
* @param[in] xt XML top of tree
|
||||||
*/
|
*/
|
||||||
|
|
@ -2272,7 +2206,7 @@ xml_merge1(cxobj *x0,
|
||||||
}
|
}
|
||||||
/* See if there is a corresponding node in the base tree */
|
/* See if there is a corresponding node in the base tree */
|
||||||
x0c = NULL;
|
x0c = NULL;
|
||||||
if (yc && match_base_child(x0, x1c, &x0c, xml_child_sort, yc) < 0)
|
if (yc && match_base_child(x0, x1c, &x0c, yc) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (xml_merge1(x0c, (yang_node*)yc, x0, x1c, reason) < 0)
|
if (xml_merge1(x0c, (yang_node*)yc, x0, x1c, reason) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -2354,7 +2288,7 @@ xml_merge(cxobj *x0,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* See if there is a corresponding node in the base tree */
|
/* See if there is a corresponding node in the base tree */
|
||||||
if (match_base_child(x0, x1c, &x0c, xml_child_sort, yc) < 0)
|
if (match_base_child(x0, x1c, &x0c, yc) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (xml_merge1(x0c, (yang_node*)yc, x0, x1c, reason) < 0)
|
if (xml_merge1(x0c, (yang_node*)yc, x0, x1c, reason) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -69,13 +69,6 @@
|
||||||
* Variables
|
* Variables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Sort and binary search of XML children
|
|
||||||
* XXX kludge since low-level functions xml_merge/xml_diff calls
|
|
||||||
* match_base_child without handle
|
|
||||||
* @see clicon_xml_sort
|
|
||||||
*/
|
|
||||||
int xml_child_sort = 1;
|
|
||||||
|
|
||||||
/*! Given a child name and an XML object, return yang stmt of child
|
/*! Given a child name and an XML object, return yang stmt of child
|
||||||
* If no xml parent, find root yang stmt matching name
|
* If no xml parent, find root yang stmt matching name
|
||||||
* @param[in] x Child
|
* @param[in] x Child
|
||||||
|
|
@ -267,7 +260,6 @@ xml_cmp1(cxobj *x,
|
||||||
* Assume populated by yang spec.
|
* Assume populated by yang spec.
|
||||||
* @param[in] x0 XML node
|
* @param[in] x0 XML node
|
||||||
* @param[in] arg Dummy so it can be called by xml_apply()
|
* @param[in] arg Dummy so it can be called by xml_apply()
|
||||||
* @see xml_order XXX: how do they relate?
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xml_sort(cxobj *x,
|
xml_sort(cxobj *x,
|
||||||
|
|
@ -566,7 +558,6 @@ xml_sort_verify(cxobj *x0,
|
||||||
* param[in] x0 Base tree node
|
* param[in] x0 Base tree node
|
||||||
* param[in] x1c Modification tree child
|
* param[in] x1c Modification tree child
|
||||||
* param[in] yc Yang spec of tree child
|
* param[in] yc Yang spec of tree child
|
||||||
* param[in] xml_sort Value of CLICON_XML_SORT option
|
|
||||||
* param[out] x0cp Matching base tree child (if any)
|
* param[out] x0cp Matching base tree child (if any)
|
||||||
* @note XXX: room for optimization? on 1K calls we have 1M body calls and
|
* @note XXX: room for optimization? on 1K calls we have 1M body calls and
|
||||||
500K xml_child_each/cvec_each calls.
|
500K xml_child_each/cvec_each calls.
|
||||||
|
|
@ -579,7 +570,6 @@ int
|
||||||
match_base_child(cxobj *x0,
|
match_base_child(cxobj *x0,
|
||||||
cxobj *x1c,
|
cxobj *x1c,
|
||||||
cxobj **x0cp,
|
cxobj **x0cp,
|
||||||
int xml_sort,
|
|
||||||
yang_stmt *yc)
|
yang_stmt *yc)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
@ -637,9 +627,6 @@ match_base_child(cxobj *x0,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Get match. Sorting mode(optimized) or not?*/
|
/* Get match. Sorting mode(optimized) or not?*/
|
||||||
if (xml_sort==0)
|
|
||||||
*x0cp = xml_match(x0, xml_name(x1c), yc->ys_keyword, keynr, keyvec, keyval);
|
|
||||||
else{
|
|
||||||
if (xml_child_nr(x0)==0 || xml_spec(xml_child_i(x0,0))!=NULL){
|
if (xml_child_nr(x0)==0 || xml_spec(xml_child_i(x0,0))!=NULL){
|
||||||
yorder = yang_order(yc);
|
yorder = yang_order(yc);
|
||||||
*x0cp = xml_search(x0, xml_name(x1c), yorder, yc->ys_keyword, keynr, keyvec, keyval);
|
*x0cp = xml_search(x0, xml_name(x1c), yorder, yc->ys_keyword, keynr, keyvec, keyval);
|
||||||
|
|
@ -647,7 +634,6 @@ match_base_child(cxobj *x0,
|
||||||
else{
|
else{
|
||||||
*x0cp = xml_match(x0, xml_name(x1c), yc->ys_keyword, keynr, keyvec, keyval);
|
*x0cp = xml_match(x0, xml_name(x1c), yc->ys_keyword, keynr, keyvec, keyval);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ok:
|
ok:
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,13 @@ expectfn "$clixon_cli -1 -f $cfg -l o debug level 1" 0 "^$"
|
||||||
expectfn "$clixon_cli -1 -f $cfg -l o debug level 0" 0 "^$"
|
expectfn "$clixon_cli -1 -f $cfg -l o debug level 0" 0 "^$"
|
||||||
|
|
||||||
new "cli rpc"
|
new "cli rpc"
|
||||||
expectfn "$clixon_cli -1 -f $cfg -l o rpc ipv4" 0 "<address-family>ipv4</address-family>" "<next-hop-list>2.3.4.5</next-hop-list>"
|
expectfn "$clixon_cli -1 -f $cfg -l o rpc ipv4" 0 'rpc-reply {
|
||||||
|
route {
|
||||||
|
address-family ipv4;
|
||||||
|
next-hop {
|
||||||
|
next-hop-list 2.3.4.5;
|
||||||
|
}
|
||||||
|
source-protocol static;'
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ new "cli show conf as guest"
|
||||||
expectfn "$clixon_cli -1 -U guest -l o -f $cfg -y $fyang show conf" 255 "protocol access-denied"
|
expectfn "$clixon_cli -1 -U guest -l o -f $cfg -y $fyang show conf" 255 "protocol access-denied"
|
||||||
|
|
||||||
new "cli rpc as admin"
|
new "cli rpc as admin"
|
||||||
expectfn "$clixon_cli -1 -U andy -l o -f $cfg -y $fyang rpc ipv4" 0 "<next-hop-list>2.3.4.5</next-hop-list>"
|
expectfn "$clixon_cli -1 -U andy -l o -f $cfg -y $fyang rpc ipv4" 0 "next-hop-list 2.3.4.5;"
|
||||||
|
|
||||||
new "cli rpc as limited"
|
new "cli rpc as limited"
|
||||||
expectfn "$clixon_cli -1 -U wilma -l o -f $cfg -y $fyang rpc ipv4" 255 "protocol access-denied default deny"
|
expectfn "$clixon_cli -1 -U wilma -l o -f $cfg -y $fyang rpc ipv4" 255 "protocol access-denied default deny"
|
||||||
|
|
|
||||||
|
|
@ -344,15 +344,6 @@ module clixon-config {
|
||||||
If set, insert spaces and line-feeds making the XML/JSON human
|
If set, insert spaces and line-feeds making the XML/JSON human
|
||||||
readable. If not set, make the XML/JSON more compact.";
|
readable. If not set, make the XML/JSON more compact.";
|
||||||
}
|
}
|
||||||
leaf CLICON_XML_SORT {
|
|
||||||
type boolean;
|
|
||||||
default true;
|
|
||||||
description
|
|
||||||
"If set, sort XML lists and leaf-lists alphabetically and uses binary
|
|
||||||
search. Unless ordered-by user is used.
|
|
||||||
Only works for Yang specified XML.
|
|
||||||
If not set, all lists accessed via linear search.";
|
|
||||||
}
|
|
||||||
leaf CLICON_XML_NS_STRICT {
|
leaf CLICON_XML_NS_STRICT {
|
||||||
type boolean;
|
type boolean;
|
||||||
default true;
|
default true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue