* [Need an option to disable restconf mandatory action of overwriting startup_db #230](https://github.com/clicon/clixon/issues/230)
* Disable RFC 8040 mandatory copy of running to startup after commit * Rename CLICON_RESTCONF_INSTALL_DIR -> CLICON_RESTCONF_INSTALLDIR
This commit is contained in:
parent
60c9172d21
commit
5b39418e92
8 changed files with 53 additions and 25 deletions
|
|
@ -50,14 +50,15 @@ Users may have to change how they access the system
|
||||||
* Changed config and install options for Restconf
|
* Changed config and install options for Restconf
|
||||||
* clixon_restconf daemon is installed in /usr/local/sbin (as clixon_backend), instead of /www-data
|
* clixon_restconf daemon is installed in /usr/local/sbin (as clixon_backend), instead of /www-data
|
||||||
* `configure --with-wwwdir=<dir>` remains but only applies to fcgi socket and log
|
* `configure --with-wwwdir=<dir>` remains but only applies to fcgi socket and log
|
||||||
* New option `CLICON_RESTCONF_INSTALL_DIR` is set to where clixon_restconf is installed, with default `/usr/local/sbin/`
|
* New option `CLICON_RESTCONF_INSTALLDIR` is set to where clixon_restconf is installed, with default `/usr/local/sbin/`
|
||||||
* Restconf drop privileges user is defined by `CLICON_RESTCONF_USER`
|
* Restconf drop privileges user is defined by `CLICON_RESTCONF_USER`
|
||||||
* `configure --with-wwwuser=<user>` is removed
|
* `configure --with-wwwuser=<user>` is removed
|
||||||
* clixon_restconf drop of privileges is defined by `CLICON_RESTCONF_PRIVILEGES` option
|
* clixon_restconf drop of privileges is defined by `CLICON_RESTCONF_PRIVILEGES` option
|
||||||
* New clixon-config@2020-05-20.yang revision
|
* New clixon-config@2020-05-20.yang revision
|
||||||
* Added: `CLICON_RESTCONF_USER`
|
* Added: `CLICON_RESTCONF_USER`
|
||||||
* Added: `CLICON_RESTCONF_PRIVILEGES`
|
* Added: `CLICON_RESTCONF_PRIVILEGES`
|
||||||
* Added: `CLICON_RESTCONF_INSTALL_DIR`
|
* Added: `CLICON_RESTCONF_INSTALLDIR`
|
||||||
|
* Added: `CLICON_RESTCONF_STARTUP_DONTUPDATE`
|
||||||
* New clixon-restconf@2020-05-20.yang revision
|
* New clixon-restconf@2020-05-20.yang revision
|
||||||
* Added: restconf `log-destination`
|
* Added: restconf `log-destination`
|
||||||
* RESTCONF error replies have changed
|
* RESTCONF error replies have changed
|
||||||
|
|
@ -71,6 +72,8 @@ Users may have to change how they access the system
|
||||||
|
|
||||||
### Minor features
|
### Minor features
|
||||||
|
|
||||||
|
* [Need an option to disable restconf mandatory action of overwriting startup_db #230](https://github.com/clicon/clixon/issues/230)
|
||||||
|
* Disable RFC 8040 mandatory copy of running to startup after commit
|
||||||
* Add default network namespace constant: `RESTCONF_NETNS_DEFAULT` with default value "default".
|
* Add default network namespace constant: `RESTCONF_NETNS_DEFAULT` with default value "default".
|
||||||
* CLI: Two new hide variables added (thanks: shmuelnatan)
|
* CLI: Two new hide variables added (thanks: shmuelnatan)
|
||||||
* hide-database : specifies that a command is not visible in database. This can be useful for setting passwords and not exposing them to users.
|
* hide-database : specifies that a command is not visible in database. This can be useful for setting passwords and not exposing them to users.
|
||||||
|
|
|
||||||
|
|
@ -202,12 +202,12 @@ restconf_pseudo_process_control(clicon_handle h)
|
||||||
clicon_err(OE_UNIX, errno, "cbuf_new");
|
clicon_err(OE_UNIX, errno, "cbuf_new");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* CLICON_RESTCONF_INSTALL_DIR is where we think clixon_restconf is installed
|
/* CLICON_RESTCONF_INSTALLDIR is where we think clixon_restconf is installed
|
||||||
* Problem is where to define it? Now in config file, but maybe it should be in configure?
|
* Problem is where to define it? Now in config file, but maybe it should be in configure?
|
||||||
* Tried Makefile but didnt work on Docker since it was moved around.
|
* Tried Makefile but didnt work on Docker since it was moved around.
|
||||||
* Use PATH?
|
* Use PATH?
|
||||||
*/
|
*/
|
||||||
cprintf(cb, "%s/clixon_restconf", clicon_option_str(h, "CLICON_RESTCONF_INSTALL_DIR"));
|
cprintf(cb, "%s/clixon_restconf", clicon_option_str(h, "CLICON_RESTCONF_INSTALLDIR"));
|
||||||
argv[i++] = cbuf_get(cb);
|
argv[i++] = cbuf_get(cb);
|
||||||
argv[i++] = "-f";
|
argv[i++] = "-f";
|
||||||
argv[i++] = clicon_option_str(h, "CLICON_CONFIGFILE");
|
argv[i++] = clicon_option_str(h, "CLICON_CONFIGFILE");
|
||||||
|
|
|
||||||
|
|
@ -522,8 +522,11 @@ api_data_write(clicon_handle h,
|
||||||
* configuration datastore, after the "running" datastore has been altered
|
* configuration datastore, after the "running" datastore has been altered
|
||||||
* as a consequence of a RESTCONF edit operation.
|
* as a consequence of a RESTCONF edit operation.
|
||||||
*/
|
*/
|
||||||
if ((IETF_DS_NONE == ds) && if_feature(yspec, "ietf-netconf", "startup"))
|
if ((IETF_DS_NONE == ds) &&
|
||||||
|
if_feature(yspec, "ietf-netconf", "startup") &&
|
||||||
|
!clicon_option_bool(h, "CLICON_RESTCONF_STARTUP_DONTUPDATE")){
|
||||||
cprintf(cbx, " copystartup=\"true\"");
|
cprintf(cbx, " copystartup=\"true\"");
|
||||||
|
}
|
||||||
cprintf(cbx, " autocommit=\"true\"");
|
cprintf(cbx, " autocommit=\"true\"");
|
||||||
cprintf(cbx, "><target><candidate /></target>");
|
cprintf(cbx, "><target><candidate /></target>");
|
||||||
cprintf(cbx, "<default-operation>none</default-operation>");
|
cprintf(cbx, "<default-operation>none</default-operation>");
|
||||||
|
|
@ -760,8 +763,11 @@ api_data_delete(clicon_handle h,
|
||||||
* configuration datastore, after the "running" datastore has been altered
|
* configuration datastore, after the "running" datastore has been altered
|
||||||
* as a consequence of a RESTCONF edit operation.
|
* as a consequence of a RESTCONF edit operation.
|
||||||
*/
|
*/
|
||||||
if ((IETF_DS_NONE == ds) && if_feature(yspec, "ietf-netconf", "startup"))
|
if ((IETF_DS_NONE == ds) &&
|
||||||
|
if_feature(yspec, "ietf-netconf", "startup") &&
|
||||||
|
!clicon_option_bool(h, "CLICON_RESTCONF_STARTUP_DONTUPDATE")){
|
||||||
cprintf(cbx, " copystartup=\"true\"");
|
cprintf(cbx, " copystartup=\"true\"");
|
||||||
|
}
|
||||||
cprintf(cbx, " autocommit=\"true\"");
|
cprintf(cbx, " autocommit=\"true\"");
|
||||||
cprintf(cbx, "><target><candidate /></target>");
|
cprintf(cbx, "><target><candidate /></target>");
|
||||||
cprintf(cbx, "<default-operation>none</default-operation>");
|
cprintf(cbx, "<default-operation>none</default-operation>");
|
||||||
|
|
|
||||||
|
|
@ -346,8 +346,11 @@ api_data_post(clicon_handle h,
|
||||||
* configuration datastore, after the "running" datastore has been altered
|
* configuration datastore, after the "running" datastore has been altered
|
||||||
* as a consequence of a RESTCONF edit operation.
|
* as a consequence of a RESTCONF edit operation.
|
||||||
*/
|
*/
|
||||||
if ((IETF_DS_NONE == ds) && if_feature(yspec, "ietf-netconf", "startup"))
|
if ((IETF_DS_NONE == ds) &&
|
||||||
|
if_feature(yspec, "ietf-netconf", "startup") &&
|
||||||
|
!clicon_option_bool(h, "CLICON_RESTCONF_STARTUP_DONTUPDATE")){
|
||||||
cprintf(cbx, " copystartup=\"true\"");
|
cprintf(cbx, " copystartup=\"true\"");
|
||||||
|
}
|
||||||
cprintf(cbx, " autocommit=\"true\"");
|
cprintf(cbx, " autocommit=\"true\"");
|
||||||
cprintf(cbx, "><target><candidate /></target>");
|
cprintf(cbx, "><target><candidate /></target>");
|
||||||
cprintf(cbx, "<default-operation>none</default-operation>");
|
cprintf(cbx, "<default-operation>none</default-operation>");
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ cat <<EOF > $cfg
|
||||||
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
||||||
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
|
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
|
||||||
<CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR>
|
<CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR>
|
||||||
<CLICON_RESTCONF_INSTALL_DIR>$RESTCONFDIR</CLICON_RESTCONF_INSTALL_DIR>
|
<CLICON_RESTCONF_INSTALLDIR>$RESTCONFDIR</CLICON_RESTCONF_INSTALLDIR>
|
||||||
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
|
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
|
||||||
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
||||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ cat <<EOF > $cfg
|
||||||
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
||||||
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
|
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
|
||||||
<CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR>
|
<CLICON_RESTCONF_DIR>/usr/local/lib/$APPNAME/restconf</CLICON_RESTCONF_DIR>
|
||||||
<CLICON_RESTCONF_INSTALL_DIR>$RESTCONFDIR</CLICON_RESTCONF_INSTALL_DIR>
|
<CLICON_RESTCONF_INSTALLDIR>$RESTCONFDIR</CLICON_RESTCONF_INSTALLDIR>
|
||||||
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
|
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
|
||||||
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
||||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||||
|
|
@ -194,15 +194,15 @@ ps aux|grep clixon_ # XXX
|
||||||
|
|
||||||
new "Check $pid1 exists"
|
new "Check $pid1 exists"
|
||||||
# Here backend dies / is killed
|
# Here backend dies / is killed
|
||||||
#while sudo kill -0 $pid1 2> /dev/null; do
|
# if sudo kill -0 $pid1; then # XXX
|
||||||
if sudo kill -0 $pid1; then # XXX
|
while sudo kill -0 $pid1 2> /dev/null; do
|
||||||
new "kill $pid1 externally"
|
new "kill $pid1 externally"
|
||||||
sudo kill $pid1
|
sudo kill $pid1
|
||||||
sleep 1 # There is a race condition here when restconf is killed while waiting for reply from backend
|
sleep 1 # There is a race condition here when restconf is killed while waiting for reply from backend
|
||||||
echo "pid1:$pid1" # XXX
|
echo "pid1:$pid1" # XXX
|
||||||
ps aux|grep clixon_ # XXX
|
ps aux|grep clixon_ # XXX
|
||||||
fi
|
done
|
||||||
#done
|
# fi
|
||||||
|
|
||||||
echo "pid1:$pid1" # XXX
|
echo "pid1:$pid1" # XXX
|
||||||
ps aux|grep clixon_ # XXX
|
ps aux|grep clixon_ # XXX
|
||||||
|
|
|
||||||
|
|
@ -66,16 +66,18 @@ function testrun(){
|
||||||
start_backend -s init -f $cfg -y $fyang $option
|
start_backend -s init -f $cfg -y $fyang $option
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "waiting"
|
new "wait backend"
|
||||||
wait_backend
|
wait_backend
|
||||||
|
|
||||||
new "kill old restconf daemon"
|
if [ $RC -ne 0 ]; then
|
||||||
stop_restconf_pre
|
new "kill old restconf daemon"
|
||||||
|
stop_restconf_pre
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
start_restconf -f $cfg -y $fyang $option
|
start_restconf -f $cfg -y $fyang $option
|
||||||
|
fi
|
||||||
|
|
||||||
new "waiting"
|
new "wait restconf"
|
||||||
wait_restconf
|
wait_restconf
|
||||||
|
|
||||||
new "restconf put 42"
|
new "restconf put 42"
|
||||||
|
|
@ -90,9 +92,11 @@ function testrun(){
|
||||||
new "restconf delete 42"
|
new "restconf delete 42"
|
||||||
expectpart "$(curl $CURLOPTS -X DELETE $RCPROTO://localhost/restconf/data/example:x/y=42)" 0 "HTTP/1.1 204 No Content"
|
expectpart "$(curl $CURLOPTS -X DELETE $RCPROTO://localhost/restconf/data/example:x/y=42)" 0 "HTTP/1.1 204 No Content"
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
if [ $RC -ne 0 ]; then
|
||||||
stop_restconf
|
new "Kill restconf daemon"
|
||||||
|
stop_restconf
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $BE -ne 0 ]; then
|
if [ $BE -ne 0 ]; then
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
# Check if premature kill
|
# Check if premature kill
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,8 @@ module clixon-config {
|
||||||
"Added option:
|
"Added option:
|
||||||
CLICON_RESTCONF_USER
|
CLICON_RESTCONF_USER
|
||||||
CLICON_RESTCONF_PRIVILEGES
|
CLICON_RESTCONF_PRIVILEGES
|
||||||
CLICON_RESTCONF_INSTALL_DIR
|
CLICON_RESTCONF_INSTALLDIR
|
||||||
|
CLICON_RESTCONF_STARTUP_DONTUPDATE
|
||||||
Released in Clixon 5.2";
|
Released in Clixon 5.2";
|
||||||
}
|
}
|
||||||
revision 2021-03-08 {
|
revision 2021-03-08 {
|
||||||
|
|
@ -479,7 +480,7 @@ module clixon-config {
|
||||||
Note: Obsolete, use fcgi-socket in clixon-restconf.yang instead";
|
Note: Obsolete, use fcgi-socket in clixon-restconf.yang instead";
|
||||||
status obsolete;
|
status obsolete;
|
||||||
}
|
}
|
||||||
leaf CLICON_RESTCONF_INSTALL_DIR {
|
leaf CLICON_RESTCONF_INSTALLDIR {
|
||||||
type string;
|
type string;
|
||||||
default "/usr/local/sbin";
|
default "/usr/local/sbin";
|
||||||
description
|
description
|
||||||
|
|
@ -489,7 +490,18 @@ module clixon-config {
|
||||||
installation moves the binaries, and this may be true elsewehere too.
|
installation moves the binaries, and this may be true elsewehere too.
|
||||||
Maybe one could locate it via PATHs search";
|
Maybe one could locate it via PATHs search";
|
||||||
}
|
}
|
||||||
|
leaf CLICON_RESTCONF_STARTUP_DONTUPDATE {
|
||||||
|
type boolean;
|
||||||
|
default false;
|
||||||
|
description
|
||||||
|
"According to RFC 8040 Sec 1.4:
|
||||||
|
If the NETCONF server supports :startup, the RESTCONF server MUST automatically
|
||||||
|
update the [...] startup configuration [...] as a consequence of a RESTCONF
|
||||||
|
edit operation.
|
||||||
|
Setting this option disables this behaviour, ie the startup configuration is NOT
|
||||||
|
automatically updated.
|
||||||
|
If this option is false, the startup is autoamtically updated following the RFC";
|
||||||
|
}
|
||||||
leaf CLICON_RESTCONF_PRETTY {
|
leaf CLICON_RESTCONF_PRETTY {
|
||||||
type boolean;
|
type boolean;
|
||||||
default true;
|
default true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue