fixed CHANGELOG, restconf memleak, with-defaults test

This commit is contained in:
Olof hagsand 2019-08-09 17:35:45 +02:00
parent e244f5c8f8
commit 48022e57b9
4 changed files with 144 additions and 4 deletions

View file

@ -4,8 +4,8 @@
### Major New features
* Restconf RFC 8040 increased feature compliance
* RESTCONF PATCH (plain patch) is being implemented according to RFC 8040 4.6.1
* Work-in-progress, expected done by 4.1.0
* RESTCONF PATCH (plain patch) is being implemented according to RFC 8040 Section 4.6.1
* Note RESTCONF plain patch is different from RFC 8072 "YANG Patch Media Type" which is not implemented
* RESTCONF "insert" and "point" query parameters supported
* Applies to ordered-by-user leaf and leaf-lists
* RESTCONF PUT/POST erroneously returned 200 OK. Instead restconf now returns:
@ -28,6 +28,8 @@
* Netconf edit-config "operation" attribute namespace check is enforced
* This is enforced: `<a xmlns="uri:example" nc:operation="merge" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
* This was previously allowed: `<a xmlns="uri:example" operation="merge">
* RESTCONF NACM access-denied error code changed from "401 Unauthorized" to "403 Forbidden"
* See RFC 8040 (eg 4.4.1, 4.4.2, 4.5, 4.6, 4.7)
* RESTCONF PUT/POST erroneously returned 200 OK. Instead restconf now returns:
* `201 Created` for created resources
* `204 No Content` for replaced resources.
@ -68,6 +70,21 @@
* See [RESTCONF: HTTP return codes are not according to RFC 8040](https://github.com/clicon/clixon/issues/56)
* Yang Unique statements with multiple schema identifiers did not work on some platforms due to memory error.
## 4.0.1 (5 Aug 2019)
This is a hotfix for a multi-key CLI bug that appeared in 4.0.0
(worked in 3.10).
### Corrected Bugs
* Corrected CLI bug with lists of multiple keys (netconf/restconf works).
* Example: `yang list x { key "a b";...}`
CLI error example:
```
set x a 1 b 1; #OK
set x a 1 b 2; #OK
set x a 1 b <anything> # Error
```
## 4.0.0 (13 July 2019)
### Summary

View file

@ -204,9 +204,10 @@ You can create namespace in three ways:
## Netconf
Clixon implements the following NETCONF proposals or standards:
Clixon relates to the following NETCONF proposals or standards:
- [RFC 6241: NETCONF Configuration Protocol](http://www.rfc-base.org/txt/rfc-6241.txt)
- [RFC 6242: Using the NETCONF Configuration Protocol over Secure Shell (SSH)](http://www.rfc-base.org/txt/rfc-6242.txt)
- [RFC 6243: With-defaults Capability for NETCONF](http://www.rfc-base.org/txt/rfc-6243.txt). Clixon implements "explicit" default handling, but does not implement the RFC.
- [RFC 5277: NETCONF Event Notifications](http://www.rfc-base.org/txt/rfc-5277.txt)
- [RFC 8341: Network Configuration Access Control Model](http://www.rfc-base.org/txt/rfc-8341.txt)

View file

@ -689,7 +689,7 @@ api_data_write(clicon_handle h,
done:
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
if (cbpath)
cbuf_reset(cbpath);
cbuf_free(cbpath);
if (xret)
xml_free(xret);
if (xerr)

122
test/test_with_default.sh Executable file
View file

@ -0,0 +1,122 @@
#!/bin/bash
# Netconf with default capability See RFC 6243
# Test what clixon has
# These are the modes defined in RFC 6243:
# o report-all
# (o report-all-tagged)
# o trim
# o explicit
# Clixon supports explicit, bit the testcases define the other cases as well
# in case others will be supported
# Magic line must be first in script (see README.md)
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
APPNAME=example
cfg=$dir/conf_yang.xml
fyang=$dir/example-default.yang
cat <<EOF > $cfg
<clixon-config xmlns="http://clicon.org/config">
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
<CLICON_FEATURE>ietf-netconf:startup</CLICON_FEATURE>
<CLICON_MODULE_SET_ID>42</CLICON_MODULE_SET_ID>
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
<CLICON_YANG_DIR>$IETFRFC</CLICON_YANG_DIR>
<CLICON_YANG_MAIN_FILE>$fyang</CLICON_YANG_MAIN_FILE>
<CLICON_CLISPEC_DIR>/usr/local/lib/$APPNAME/clispec</CLICON_CLISPEC_DIR>
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
<CLICON_NETCONF_DIR>/usr/local/lib/$APPNAME/netconf</CLICON_NETCONF_DIR>
<CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR>
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
<CLICON_SOCK>$dir/$APPNAME.sock</CLICON_SOCK>
<CLICON_BACKEND_PIDFILE>/usr/local/var/$APPNAME/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
<CLICON_CLI_GENMODEL_COMPLETION>1</CLICON_CLI_GENMODEL_COMPLETION>
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
</clixon-config>
EOF
cat <<EOF > $fyang
module example-default {
namespace "urn:example:default";
prefix "ex";
typedef dt {
description "Just a base type with a default value of 42";
type int32;
default 42;
}
container c{
list x {
key k;
leaf k{
type string;
}
leaf y {
/* Three possible values: notset, default(42), other(eg 99) */
type dt;
}
}
}
}
EOF
new "test params: -f $cfg"
# Bring your own backend
if [ $BE -ne 0 ]; then
# kill old backend (if any)
new "kill old backend"
sudo clixon_backend -zf $cfg
if [ $? -ne 0 ]; then
err
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
# This is the base XML with thre values in the server: noset, default, other
XML='<c xmlns="urn:example:default"><x><k>default</k><y>42</y></x><x><k>notset</k></x><x><k>other</k><y>99</y></x></c>'
# report-all: doe not consider any data node to be default data,
# even schema default data. (noset is set to 42)
REPORT_ALL='<c xmlns="urn:example:default"><x><k>default</k><y>42</y></x><x><k>notset</k></x><x><k>other</k><y>99</y></x></c>'
# report-all: doe not consider any data node to be default data,
# even schema default data. (noset is set to 42)
REPORT_ALL='<c xmlns="urn:example:default"><x><k>default</k><y>42</y></x><x><k>notset</k><y>42</y></x><x><k>other</k><y>99</y></x></c>'
# trim: MUST consider any data node set to its schema default value to be
# default data (default is not set)
TRIM='<c xmlns="urn:example:default"><x><k>default</k></x><x><k>notset</k></x><x><k>other</k><y>99</y></x></c>'
# explicit: MUST consider any data node that is not explicitly set data to
# be default data.
# (SAME AS Input XML)
EXPLICIT='<c xmlns="urn:example:default"><x><k>default</k><y>42</y></x><x><k>notset</k></x><x><k>other</k><y>99</y></x></c>'
new "Set defaults"
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc><edit-config><target><candidate/></target><config>$XML</config></edit-config></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
new "Check config (Clixon supports explicit)"
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>' "^<rpc-reply><data>$EXPLICIT</data></rpc-reply>]]>]]>$"
if [ $BE -eq 0 ]; then
exit # BE
fi
new "Kill backend"
# Check if premature kill
pid=`pgrep -u root -f clixon_backend`
if [ -z "$pid" ]; then
err "backend already dead"
fi
# kill backend
stop_backend -f $cfg
rm -rf $dir