* 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:
Olof hagsand 2018-12-16 19:46:26 +01:00
parent e5c0b06cf9
commit ae1af8da9e
63 changed files with 1852 additions and 3492 deletions

View file

@ -46,7 +46,12 @@ module ietf-ip{
}
EOF
db='<config><x><y><a>1</a><b>2</b><c>first-entry</c></y><y><a>1</a><b>3</b><c>second-entry</c></y><y><a>2</a><b>3</b><c>third-entry</c></y><d/><f><e>a</e><e>b</e><e>c</e></f><g>astring</g></x></config>'
xml='<config><x xmlns="urn:example:clixon"><y><a>1</a><b>2</b><c>first-entry</c></y><y><a>1</a><b>3</b><c>second-entry</c></y><y><a>2</a><b>3</b><c>third-entry</c></y><d/><f><e>a</e><e>b</e><e>c</e></f><g>astring</g></x></config>'
# Without xmlns
xmlxxx='<config><x><y><a>1</a><b>2</b><c>first-entry</c></y><y><a>1</a><b>3</b><c>second-entry</c></y><y><a>2</a><b>3</b><c>third-entry</c></y><d/><f><e>a</e><e>b</e><e>c</e></f><g>astring</g></x></config>'
run(){
name=$1
@ -62,12 +67,12 @@ run(){
new "datastore $name init"
expectfn "$datastore $conf init" 0 ""
# Whole tree operations
new "datastore $name put all replace"
expectfn "$datastore $conf put replace $db" 0 ""
ret=$($datastore $conf put replace "$xml")
expectmatch "$ret" $? "0" ""
new "datastore $name get"
expectfn "$datastore $conf get /" 0 "^$db$"
expectfn "$datastore $conf get /" 0 "^$xmlxxx$"
new "datastore $name put all remove"
expectfn "$datastore $conf put remove <config/>" 0 ""
@ -76,10 +81,13 @@ run(){
expectfn "$datastore $conf get /" 0 "^<config/>$"
new "datastore $name put all merge"
expectfn "$datastore $conf put merge $db" 0 ""
ret=$($datastore $conf put merge "$xml")
expectmatch "$ret" $? "0" ""
# expectfn "$datastore $conf put merge $xml" 0 ""
new "datastore $name get"
expectfn "$datastore $conf get /" 0 "^$db$"
expectfn "$datastore $conf get /" 0 "^$xmlxxx$"
new "datastore $name put all delete"
expectfn "$datastore $conf put remove <config/>" 0 ""
@ -88,10 +96,11 @@ run(){
expectfn "$datastore $conf get /" 0 "^<config/>$"
new "datastore $name put all create"
expectfn "$datastore $conf put create $db" 0 ""
ret=$($datastore $conf put create "$xml")
expectmatch "$ret" $? "0" ""
new "datastore $name get"
expectfn "$datastore $conf get /" 0 "^$db$"
expectfn "$datastore $conf get /" 0 "^$xmlxxx$"
new "datastore $name put top create"
expectfn "$datastore $conf put create <config><x/></config>" 0 "" # error
@ -159,7 +168,6 @@ run(){
rm -rf $mydir
}
#run keyvalue # cant get the put to work
run text
rm -rf $dir