From 8883d012c714551c2787d3724b2e92abd5edf1a3 Mon Sep 17 00:00:00 2001 From: Jan-Olof Carlson Date: Mon, 12 Dec 2022 07:52:16 +0000 Subject: [PATCH] Set basic mode retrieval to explicit by default. RFC6243 --- apps/backend/backend_get.c | 2 +- test/test_yang_with_defaults.sh | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/apps/backend/backend_get.c b/apps/backend/backend_get.c index 8af3c507..5b4e489f 100644 --- a/apps/backend/backend_get.c +++ b/apps/backend/backend_get.c @@ -815,7 +815,7 @@ get_common(clicon_handle h, cxobj *xfind; uint32_t offset = 0; uint32_t limit = 0; - withdefaults_type wdef = WITHDEFAULTS_REPORT_ALL; + withdefaults_type wdef = WITHDEFAULTS_EXPLICIT; char *wdefstr; clicon_debug(1, "%s", __FUNCTION__); diff --git a/test/test_yang_with_defaults.sh b/test/test_yang_with_defaults.sh index 36662763..6ffb4da3 100755 --- a/test/test_yang_with_defaults.sh +++ b/test/test_yang_with_defaults.sh @@ -8,6 +8,9 @@ # Magic line must be first in script (see README.md) s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi +# Uncomment if defined at compile time +# NETCONF_DEFAULT_RETRIEVAL_REPORT_ALL="report-all" + APPNAME=example cfg=$dir/conf_yang.xml @@ -283,10 +286,10 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" \ "" "" \ "\ eth08192ok\ -eth11500ok\ +eth1ok\ eth29000not feeling so good\ eth31500waking up\ -edvdv\ +edv\ " "" new "rfc6243 2.3.3. 'explicit' and Behavior (part 1): create explicit node" @@ -316,10 +319,10 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" \ "" "" \ "\ eth08192ok\ -eth11500ok\ +eth1ok\ eth29000not feeling so good\ eth31500waking up\ -edvdv\ +edv\ " "" new "rfc6243 2.3.3. 'explicit' and Behavior (part 2): create default node" @@ -348,7 +351,7 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" \ eth13000ok\ eth29000not feeling so good\ eth31500waking up\ -edvdv\ +edv\ " "" new "rfc6243 2.3.3. 'explicit' and Behavior (part 3): delete explicit node" @@ -374,10 +377,10 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" \ "" "" \ "\ eth08192ok\ -eth11500ok\ +eth1ok\ eth29000not feeling so good\ eth31500waking up\ -edvdv\ +edv\ " "" new "rfc6243 2.3.3. 'explicit' and Behavior (part 4): delete default node" @@ -408,10 +411,10 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" \ "" "" \ "\ eth08192ok\ -eth11500ok\ +eth1ok\ eth29000not feeling so good\ eth31500waking up\ -edvdv\ +edv\ " "" new "Pagination" @@ -423,7 +426,7 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" \ " \ "" \ "\ -eth11500\ +eth1\ eth29000\ " @@ -493,7 +496,7 @@ expectpart "$(curl $CURLOPTS -X GET -H 'Accept: application/yang-data+json' $RCP "HTTP/$HVER 200" \ "Content-Type: application/yang-data+json" \ "Cache-Control: no-cache" \ -'{"example:interfaces":{"interface":\[{"name":"eth0","mtu":8192,"status":"ok"},{"name":"eth1","mtu":1500,"status":"ok"},{"name":"eth2","mtu":9000,"status":"not feeling so good"},{"name":"eth3","mtu":1500,"status":"waking up"}\],"cedv":{"edv":"edv"},"cdv":{"dv":"dv"}}}' +'{"example:interfaces":{"interface":\[{"name":"eth0","mtu":8192,"status":"ok"},{"name":"eth1","status":"ok"},{"name":"eth2","mtu":9000,"status":"not feeling so good"},{"name":"eth3","mtu":1500,"status":"waking up"}\],"cedv":{"edv":"edv"}}}' new "rfc8040 4.3. RESTCONF GET xml" expectpart "$(curl $CURLOPTS -X GET -H 'Accept: application/yang-data+xml' $RCPROTO://localhost/restconf/data/example:interfaces)" \ @@ -501,7 +504,7 @@ expectpart "$(curl $CURLOPTS -X GET -H 'Accept: application/yang-data+xml' $RCPR "HTTP/$HVER 200" \ "Content-Type: application/yang-data+xml" \ "Cache-Control: no-cache" \ -'eth08192oketh11500oketh29000not feeling so goodeth31500waking upedvdv' +'eth08192oketh1oketh29000not feeling so goodeth31500waking upedv' new "rfc8040 B.1.3. Retrieve the Server Capability Information json" expectpart "$(curl $CURLOPTS -X GET -H 'Accept: application/yang-data+json' $RCPROTO://localhost/restconf/data/ietf-restconf-monitoring:restconf-state/capabilities)" \