diff --git a/CHANGELOG.md b/CHANGELOG.md
index 702195ae..e5e9fe75 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -64,8 +64,10 @@ Users may have to change how they access the system
### Minor features
+* [prevent clixon-restconf@2021-05-20.yang module from loading](https://github.com/clicon/clixon/issues/318)
+ * Instead of always loading it, load it to datastore YANGs only if `CLICON_BACKEND_RESTCONF_PROCESS` is `true`
* YANG unique: added single descendant node ids as special case
-c * This means that two variants are supported:
+ * This means that two variants are supported:
* unique "a b c", ie multiple direct children
* unique "a/b/c", ie single descendants
* RFC 7950 Sec 7.8.3 is somewhat unclear
diff --git a/lib/clixon/clixon_options.h b/lib/clixon/clixon_options.h
index b451c61c..991da5aa 100644
--- a/lib/clixon/clixon_options.h
+++ b/lib/clixon/clixon_options.h
@@ -52,7 +52,7 @@
*/
#define CLIXON_CONF_NS "http://clicon.org/config"
#define CLIXON_LIB_NS "http://clicon.org/lib"
-#define CLIXON_AUTOCLI_NS "http://clicon.org/autocli"
+#define CLIXON_AUTOCLI_NS "http://clicon.org/autocli"
#define CLIXON_RESTCONF_NS "http://clicon.org/restconf"
/*
diff --git a/lib/src/clixon_netconf_lib.c b/lib/src/clixon_netconf_lib.c
index decd8e93..7957ad33 100644
--- a/lib/src/clixon_netconf_lib.c
+++ b/lib/src/clixon_netconf_lib.c
@@ -1483,7 +1483,6 @@ netconf_module_features(clicon_handle h)
return retval;
}
-
/*! Load generic yang specs, ie ietf netconf yang module and set enabled features
* @param[in] h Clixon handle
* @retval 0 OK
@@ -1512,9 +1511,10 @@ netconf_module_load(clicon_handle h)
if (clicon_option_bool(h, "CLICON_XML_CHANGELOG"))
if (yang_spec_parse_module(h, "clixon-xml-changelog", NULL, yspec)< 0)
goto done;
- /* Load restconf yang. Note this is also a part of clixon-config */
- if (yang_spec_parse_module(h, "clixon-restconf", NULL, yspec)< 0)
- goto done;
+ /* Load restconf yang to data. Note clixon-restconf.yang is always part of clixon-config */
+ if (clicon_option_bool(h, "CLICON_BACKEND_RESTCONF_PROCESS"))
+ if (yang_spec_parse_module(h, "clixon-restconf", NULL, yspec)< 0)
+ goto done;
/* XXX: Both the following settings are because clicon-handle is not part of all API
* functions
* Treat unknown XML as anydata */
diff --git a/test/test_debug.sh b/test/test_debug.sh
index 0ace72bf..07ac0987 100755
--- a/test/test_debug.sh
+++ b/test/test_debug.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
-# Turn on debug on backend/cli/restconf/netconf
+# Turn on debug on backend/cli/netconf
+# Note, restconf debug used to be tested but is no longer tested here,
+# maybe in test_restconf_internal?
# Magic line must be first in script (see README.md)
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
@@ -79,30 +81,15 @@ wait_restconf
new "Set backend debug using netconf"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "1" "" ""
-new "Set backend debug using restconf"
-expectpart "$(curl $CURLOPTS -X POST -H 'Content-Type: application/yang-data+json' $RCPROTO://localhost/restconf/operations/clixon-lib:debug -d '{"clixon-lib:input":{"level":1}}')" 0 "HTTP/$HVER 204"
-
-new "Set restconf debug using netconf"
-expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "1" "" ""
-
-new "netconf commit"
-expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" ""
-
-new "Set restconf debug using restconf"
-expectpart "$(curl $CURLOPTS -X PUT -H 'Content-Type: application/yang-data+json' $RCPROTO://localhost/restconf/data/clixon-restconf:restconf/debug -d '{"clixon-restconf:debug":1}')" 0 "HTTP/$HVER 204"
-
new "Set cli debug using cli"
expectpart "$($clixon_cli -1 -f $cfg -l o debug cli 1)" 0 "^$"
new "Set backend debug using cli"
expectpart "$($clixon_cli -1 -f $cfg -l o debug backend 1)" 0 "^$"
-new "Set restconf debug using cli"
-expectpart "$($clixon_cli -1 -f $cfg -l o debug restconf 1)" 0 "^$"
-
# Exercise debug code
new "get and put config using restconf"
-expectpart "$(curl $CURLOPTS -H "Accept: application/yang-data+xml" -X GET $RCPROTO://localhost/restconf/data?content=config --next $CURLOPTS -H "Content-Type: application/yang-data+json" -X POST $RCPROTO://localhost/restconf/data -d '{"example:table":{"parameter":{"name":"local0","value":"foo"}}}')" 0 "HTTP/$HVER 200" '' "HTTP/$HVER 201"
+expectpart "$(curl $CURLOPTS -H "Accept: application/yang-data+xml" -X GET $RCPROTO://localhost/restconf/data?content=config --next $CURLOPTS -H "Content-Type: application/yang-data+json" -X POST $RCPROTO://localhost/restconf/data -d '{"example:table":{"parameter":{"name":"local0","value":"foo"}}}')" 0 "HTTP/$HVER 200" '' "HTTP/$HVER 201"
# In freebsd, backend dies in stop_restconf below unless sleep
sleep $DEMSLEEP
diff --git a/test/test_restconf.sh b/test/test_restconf.sh
index d2d04137..d550b07d 100755
--- a/test/test_restconf.sh
+++ b/test/test_restconf.sh
@@ -110,7 +110,6 @@ cat < $cfg
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
- false
$RESTCONFIG
EOF
diff --git a/test/test_restconf_http_upgrade.sh b/test/test_restconf_http_upgrade.sh
index bb6d7904..20e16d86 100755
--- a/test/test_restconf_http_upgrade.sh
+++ b/test/test_restconf_http_upgrade.sh
@@ -44,7 +44,6 @@ cat < $cfg
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
- false
true
$RESTCONFIG
diff --git a/test/test_restconf_internal.sh b/test/test_restconf_internal.sh
index 5b2147ad..fb283f80 100755
--- a/test/test_restconf_internal.sh
+++ b/test/test_restconf_internal.sh
@@ -217,6 +217,12 @@ wait_restconf
new "try restconf rpc status"
expectpart "$(curl $CURLOPTS -X POST -H "Content-Type: application/yang-data+json" $RCPROTO://localhost/restconf/operations/clixon-lib:process-control -d '{"clixon-lib:input":{"name":"restconf","operation":"status"}}')" 0 "HTTP/$HVER 200" '{"clixon-lib:output":' '"active":' '"pid":'
+new "Set backend debug using restconf"
+expectpart "$(curl $CURLOPTS -X POST -H 'Content-Type: application/yang-data+json' $RCPROTO://localhost/restconf/operations/clixon-lib:debug -d '{"clixon-lib:input":{"level":1}}')" 0 "HTTP/$HVER 204"
+
+new "Set restconf debug using netconf"
+expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "1" "" ""
+
new "2. Get status"
rpcstatus true running
pid1=$pid
diff --git a/test/test_restconf_nmap.sh b/test/test_restconf_nmap.sh
index 7f94c237..dc11ddca 100755
--- a/test/test_restconf_nmap.sh
+++ b/test/test_restconf_nmap.sh
@@ -96,7 +96,6 @@ cat < $cfg
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
- false
$RESTCONFIG
EOF