diff --git a/CHANGELOG.md b/CHANGELOG.md index 5555f932..efc0cf5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: ` * This was previously allowed: ` +* 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 # Error + ``` + ## 4.0.0 (13 July 2019) ### Summary diff --git a/README.md b/README.md index c778b710..aa4d3106 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/apps/restconf/restconf_methods.c b/apps/restconf/restconf_methods.c index b5437101..85da9f5b 100644 --- a/apps/restconf/restconf_methods.c +++ b/apps/restconf/restconf_methods.c @@ -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) diff --git a/test/test_with_default.sh b/test/test_with_default.sh new file mode 100755 index 00000000..6fa2c282 --- /dev/null +++ b/test/test_with_default.sh @@ -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 < $cfg + + $cfg + ietf-netconf:startup + 42 + /usr/local/share/clixon + $IETFRFC + $fyang + /usr/local/lib/$APPNAME/clispec + /usr/local/lib/$APPNAME/backend + example_backend.so$ + /usr/local/lib/$APPNAME/netconf + /usr/local/lib/$APPNAME/restconf + /usr/local/lib/$APPNAME/cli + $APPNAME + $dir/$APPNAME.sock + /usr/local/var/$APPNAME/$APPNAME.pidfile + 1 + /usr/local/var/$APPNAME + +EOF + +cat < $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='default42notsetother99' + +# report-all: doe not consider any data node to be default data, +# even schema default data. (noset is set to 42) +REPORT_ALL='default42notsetother99' + +# report-all: doe not consider any data node to be default data, +# even schema default data. (noset is set to 42) +REPORT_ALL='default42notset42other99' + +# trim: MUST consider any data node set to its schema default value to be +# default data (default is not set) +TRIM='defaultnotsetother99' + +# explicit: MUST consider any data node that is not explicitly set data to +# be default data. +# (SAME AS Input XML) +EXPLICIT='default42notsetother99' + +new "Set defaults" +expecteof "$clixon_netconf -qf $cfg" 0 "$XML]]>]]>" "^]]>]]>$" + +new "Check config (Clixon supports explicit)" +expecteof "$clixon_netconf -qf $cfg" 0 ']]>]]>' "^$EXPLICIT]]>]]>$" + + +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