* NACM extension (RFC8341)
* NACM module support (RFC8341 A1+A2)
* Recovery user "_nacm_recovery" added.
* Example use is restconf PUT when NACM edit-config is permitted, then automatic commit and discard are permitted using recovery user.
* Example user changed adm1 to andy to comply with RFC8341 example
* Yang code upgrade (RFC7950)
* RPC method input parameters validated
* see https://github.com/clicon/clixon/issues/4
* Correct XML namespace handling
* XML multiple modules was based on "loose" semantics so that yang modules were found by iterating thorugh namespaces until a match was made. This did not adhere to proper [XML namespace handling](https://www.w3.org/TR/2009/REC-xml-names-20091208), and causes problems with overlapping names and false positives. Below see XML accepted (but wrong), and correct namespace declaration:
```
<rpc><my-own-method></rpc> # Wrong but accepted
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> # Correct
<my-own-method xmlns="http://example.net/me/my-own/1.0">
</rpc>
```
* To keep old loose semantics set config option CLICON_XML_NS_ITERATE (true by default)
* XML to JSON translator support for mapping xmlns attribute to module name prefix.
* Default namespace is still "urn:ietf:params:xml:ns:netconf:base:1.0"
* See https://github.com/clicon/clixon/issues/49
* Changed all make tags --> make TAGS
* Keyvalue datastore removed (it has been disabled since 3.3.3)
* debug rpc added in example application (should be in clixon-config).
This commit is contained in:
parent
e5c0b06cf9
commit
ae1af8da9e
63 changed files with 1852 additions and 3492 deletions
|
|
@ -56,7 +56,6 @@
|
|||
#include "clixon_err.h"
|
||||
#include "clixon_log.h"
|
||||
#include "clixon_string.h"
|
||||
|
||||
#include "clixon_queue.h"
|
||||
#include "clixon_hash.h"
|
||||
#include "clixon_handle.h"
|
||||
|
|
@ -73,7 +72,6 @@
|
|||
*/
|
||||
int xml_child_sort = 1;
|
||||
|
||||
|
||||
/*! Given a child name and an XML object, return yang stmt of child
|
||||
* If no xml parent, find root yang stmt matching name
|
||||
* @param[in] x Child
|
||||
|
|
@ -81,6 +79,8 @@ int xml_child_sort = 1;
|
|||
* @param[in] yspec Yang specification (top level)
|
||||
* @param[out] yresult Pointer to yang stmt of result, or NULL, if not found
|
||||
* @note special rule for rpc, ie <rpc><foo>,look for top "foo" node.
|
||||
* @note works for import prefix, but not work for generic XML parsing where
|
||||
* xmlns and xmlns:ns are used.
|
||||
*/
|
||||
int
|
||||
xml_child_spec(char *name,
|
||||
|
|
@ -88,17 +88,40 @@ xml_child_spec(char *name,
|
|||
yang_spec *yspec,
|
||||
yang_stmt **yresult)
|
||||
{
|
||||
yang_stmt *y; /* result yang node */
|
||||
int retval = -1;
|
||||
yang_stmt *y = NULL; /* result yang node */
|
||||
yang_stmt *yparent; /* parent yang */
|
||||
|
||||
if (xp && (yparent = xml_spec(xp)) != NULL)
|
||||
y = yang_find_datanode((yang_node*)yparent, name);
|
||||
else if (yspec)
|
||||
y = yang_find_topnode(yspec, name, YC_DATANODE); /* still NULL for config */
|
||||
yang_stmt *ymod = NULL;
|
||||
yang_stmt *yi;
|
||||
int i;
|
||||
|
||||
if (xp && (yparent = xml_spec(xp)) != NULL){
|
||||
if (yparent->ys_keyword == Y_RPC){
|
||||
if ((yi = yang_find((yang_node*)yparent, Y_INPUT, NULL)) != NULL)
|
||||
y = yang_find_datanode((yang_node*)yi, name);
|
||||
}
|
||||
else
|
||||
y = yang_find_datanode((yang_node*)yparent, name);
|
||||
}
|
||||
else if (yspec){
|
||||
if (ys_module_by_xml(yspec, xp, &ymod) < 0)
|
||||
goto done;
|
||||
if (ymod != NULL)
|
||||
y = yang_find_schemanode((yang_node*)ymod, name);
|
||||
if (y == NULL && _CLICON_XML_NS_ITERATE){
|
||||
for (i=0; i<yspec->yp_len; i++){
|
||||
ymod = yspec->yp_stmt[i];
|
||||
if ((y = yang_find_schemanode((yang_node*)ymod, name)) != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
y = NULL;
|
||||
*yresult = y;
|
||||
return 0;
|
||||
retval = 0;
|
||||
done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*! Help function to qsort for sorting entries in xml child vector
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue