Merge branch 'master' into develop
This commit is contained in:
commit
bf6c87c9d1
8 changed files with 34 additions and 18 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
### Known issues
|
### Known issues
|
||||||
* Please use text datastore, key-value datastore no up-to-date
|
* Please use text datastore, key-value datastore no up-to-date
|
||||||
* Restconf RPC does not encode output correct
|
* leafref occuring within lists: cli expansion does not work
|
||||||
|
|
||||||
### Major changes:
|
### Major changes:
|
||||||
* Added support for YANG anyxml.
|
* Added support for YANG anyxml.
|
||||||
|
|
|
||||||
|
|
@ -1195,6 +1195,7 @@ cli_copy_config(clicon_handle h,
|
||||||
goto done;
|
goto done;
|
||||||
if (xml_copy(x1, x2) < 0)
|
if (xml_copy(x1, x2) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
xml_name_set(x2, "config");
|
||||||
cprintf(cb, "/%s", keyname);
|
cprintf(cb, "/%s", keyname);
|
||||||
if ((x = xpath_first(x2, cbuf_get(cb))) == NULL){
|
if ((x = xpath_first(x2, cbuf_get(cb))) == NULL){
|
||||||
clicon_err(OE_PLUGIN, 0, "Field %s not found in copy tree", keyname);
|
clicon_err(OE_PLUGIN, 0, "Field %s not found in copy tree", keyname);
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,9 @@ expand_dbvar(void *h,
|
||||||
if ((xtop = xml_new("config", NULL)) == NULL)
|
if ((xtop = xml_new("config", NULL)) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
xbot = xtop;
|
xbot = xtop;
|
||||||
|
/* This is primarily to get "y", XXX xbot can be broken (contains =%s)
|
||||||
|
* xpath2xml would have worked!!
|
||||||
|
*/
|
||||||
if (api_path && api_path2xml(api_path, yspec, xtop, 0, &xbot, &y) < 0)
|
if (api_path && api_path2xml(api_path, yspec, xtop, 0, &xbot, &y) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
/* Special case for leafref. Detect leafref via Yang-type,
|
/* Special case for leafref. Detect leafref via Yang-type,
|
||||||
|
|
@ -182,7 +185,7 @@ expand_dbvar(void *h,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
xpathcur = ypath->ys_argument;
|
xpathcur = ypath->ys_argument;
|
||||||
if (xml_merge(xt, xtop, yspec) < 0)
|
if (xml_merge(xt, xtop, yspec) < 0) /* Merge xtop into xt */
|
||||||
goto done;
|
goto done;
|
||||||
if ((xcur = xpath_first(xt, xpath)) == NULL){
|
if ((xcur = xpath_first(xt, xpath)) == NULL){
|
||||||
clicon_err(OE_DB, 0, "xpath %s should return merged content", xpath);
|
clicon_err(OE_DB, 0, "xpath %s should return merged content", xpath);
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ netconf_plugin_callbacks(clicon_handle h,
|
||||||
yang_stmt *yinput;
|
yang_stmt *yinput;
|
||||||
yang_stmt *youtput;
|
yang_stmt *youtput;
|
||||||
cxobj *xoutput;
|
cxobj *xoutput;
|
||||||
cbuf *cb;
|
cbuf *cb = NULL;
|
||||||
|
|
||||||
if (deps != NULL){
|
if (deps != NULL){
|
||||||
nreg = deps;
|
nreg = deps;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ debug("Debugging parts of the system"), cli_debug_cli((int32)1);{
|
||||||
}
|
}
|
||||||
copy("Copy and create a new object") {
|
copy("Copy and create a new object") {
|
||||||
interface("Copy interface"){
|
interface("Copy interface"){
|
||||||
<name:string expand_dbvar("candidate","/interfaces/interface/name")>("name of interface to copy from") to("Copy to interface") <toname:string>("Name of interface to copy to"), cli_copy_config("candidate","//interface[%s=%s]","name","name","toname");
|
<name:string expand_dbvar("candidate","/interfaces/interface=%s/name")>("name of interface to copy from") to("Copy to interface") <toname:string>("Name of interface to copy to"), cli_copy_config("candidate","//interface[%s=%s]","name","name","toname");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
discard("Discard edits (rollback 0)"), discard_changes();
|
discard("Discard edits (rollback 0)"), discard_changes();
|
||||||
|
|
|
||||||
|
|
@ -1725,19 +1725,23 @@ api_path2xml_vec(char **vec,
|
||||||
/* The value is a list of keys: <key>[ <key>]* */
|
/* The value is a list of keys: <key>[ <key>]* */
|
||||||
if ((cvk = yang_arg2cvec(ykey, " ")) == NULL)
|
if ((cvk = yang_arg2cvec(ykey, " ")) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
if (restval==NULL){
|
if (valvec){
|
||||||
clicon_err(OE_XML, 0, "malformed key, expected '=<restval>'");
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
if (valvec)
|
|
||||||
free(valvec);
|
free(valvec);
|
||||||
|
valvec = NULL;
|
||||||
|
}
|
||||||
|
if (restval==NULL){
|
||||||
|
// XXX patch to allow for lists without restval tobe backward compat
|
||||||
|
// clicon_err(OE_XML, 0, "malformed key, expected '=<restval>'");
|
||||||
|
// goto done;
|
||||||
|
}
|
||||||
|
else{
|
||||||
if ((valvec = clicon_strsep(restval, ",", &nvalvec)) == NULL)
|
if ((valvec = clicon_strsep(restval, ",", &nvalvec)) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (cvec_len(cvk) != nvalvec){
|
if (cvec_len(cvk) != nvalvec){
|
||||||
clicon_err(OE_XML, errno, "List %s key length mismatch", name);
|
clicon_err(OE_XML, errno, "List %s key length mismatch", name);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
cvi = NULL;
|
cvi = NULL;
|
||||||
/* create list object */
|
/* create list object */
|
||||||
if ((x = xml_new_spec(name, x0, y)) == NULL)
|
if ((x = xml_new_spec(name, x0, y)) == NULL)
|
||||||
|
|
@ -1747,13 +1751,14 @@ api_path2xml_vec(char **vec,
|
||||||
/* Create keys */
|
/* Create keys */
|
||||||
while ((cvi = cvec_each(cvk, cvi)) != NULL) {
|
while ((cvi = cvec_each(cvk, cvi)) != NULL) {
|
||||||
keyname = cv_string_get(cvi);
|
keyname = cv_string_get(cvi);
|
||||||
val2 = valvec[j++];
|
|
||||||
if ((xn = xml_new(keyname, x)) == NULL)
|
if ((xn = xml_new(keyname, x)) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
xml_type_set(xn, CX_ELMNT);
|
xml_type_set(xn, CX_ELMNT);
|
||||||
if ((xb = xml_new("body", xn)) == NULL)
|
if ((xb = xml_new("body", xn)) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
xml_type_set(xb, CX_BODY);
|
xml_type_set(xb, CX_BODY);
|
||||||
|
val2 = valvec?valvec[j++]:NULL;
|
||||||
if (xml_value_set(xb, val2) <0)
|
if (xml_value_set(xb, val2) <0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1741,7 +1741,7 @@ schema_nodeid_vec(yang_node *yn,
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
char *arg;
|
char *arg;
|
||||||
yang_node *ynext;
|
yang_node *ynext;
|
||||||
char *nodeid;
|
char *nodeid = NULL;
|
||||||
int i;
|
int i;
|
||||||
yang_stmt *ys;
|
yang_stmt *ys;
|
||||||
int match;
|
int match;
|
||||||
|
|
@ -1788,7 +1788,7 @@ schema_nodeid_vec(yang_node *yn,
|
||||||
if (yang_schemanode((yang_stmt*)ynext))
|
if (yang_schemanode((yang_stmt*)ynext))
|
||||||
*yres = (yang_stmt*)ynext;
|
*yres = (yang_stmt*)ynext;
|
||||||
else
|
else
|
||||||
clicon_debug(1, "%s not schema node", nodeid);
|
clicon_debug(1, "%s not schema node", arg);
|
||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
/* recursive call using ynext */
|
/* recursive call using ynext */
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@ expectfn "$clixon_cli -1f $clixon_cf set interfaces interface eth/0/0" "^$"
|
||||||
new "cli show configuration"
|
new "cli show configuration"
|
||||||
expectfn "$clixon_cli -1f $clixon_cf show conf cli" "^interfaces interface name eth/0/0" "interfaces interface enabled true$"
|
expectfn "$clixon_cli -1f $clixon_cf show conf cli" "^interfaces interface name eth/0/0" "interfaces interface enabled true$"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
new "cli failed validate"
|
new "cli failed validate"
|
||||||
expectfn "$clixon_cli -1f $clixon_cf -l o validate" "Missing mandatory variable"
|
expectfn "$clixon_cli -1f $clixon_cf -l o validate" "Missing mandatory variable"
|
||||||
|
|
||||||
|
|
@ -63,6 +65,9 @@ expectfn "$clixon_cli -1f $clixon_cf -l o delete interfaces interface eth/0/0 de
|
||||||
new "cli show xpath no description"
|
new "cli show xpath no description"
|
||||||
expectfn "$clixon_cli -1f $clixon_cf -l o show xpath /interfaces/interface/description" "^$"
|
expectfn "$clixon_cli -1f $clixon_cf -l o show xpath /interfaces/interface/description" "^$"
|
||||||
|
|
||||||
|
new "cli copy interface"
|
||||||
|
expectfn "$clixon_cli -1f $clixon_cf copy interface eth/0/0 to eth99" "^$"
|
||||||
|
|
||||||
new "cli success validate"
|
new "cli success validate"
|
||||||
expectfn "$clixon_cli -1f $clixon_cf -l o validate" "^$"
|
expectfn "$clixon_cli -1f $clixon_cf -l o validate" "^$"
|
||||||
|
|
||||||
|
|
@ -72,6 +77,8 @@ expectfn "$clixon_cli -1f $clixon_cf -l o commit" "^$"
|
||||||
new "cli save"
|
new "cli save"
|
||||||
expectfn "$clixon_cli -1f $clixon_cf -l o save /tmp/foo" "^$"
|
expectfn "$clixon_cli -1f $clixon_cf -l o save /tmp/foo" "^$"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
new "cli delete all"
|
new "cli delete all"
|
||||||
expectfn "$clixon_cli -1f $clixon_cf -l o delete all" "^$"
|
expectfn "$clixon_cli -1f $clixon_cf -l o delete all" "^$"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue