reorder clixon-restconf.yang and some test fixes
This commit is contained in:
parent
dcc19d3edf
commit
d1e5599572
4 changed files with 50 additions and 33 deletions
|
|
@ -566,6 +566,8 @@ restconf_authentication_cb(clicon_handle h,
|
|||
done:
|
||||
clicon_debug(1, "%s retval:%d authenticated:%d user:%s",
|
||||
__FUNCTION__, retval, authenticated, clicon_username_get(h));
|
||||
if (username)
|
||||
free(username);
|
||||
if (xret)
|
||||
xml_free(xret);
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -254,10 +254,13 @@ example_basic_auth(clicon_handle h,
|
|||
goto fail;
|
||||
/* authenticated */
|
||||
*userp = user;
|
||||
user=NULL; /* to avoid free below */
|
||||
*authp = 1;
|
||||
retval = 0;
|
||||
done: /* error */
|
||||
clicon_debug(1, "%s retval:%d authp:%d userp:%s", __FUNCTION__, retval, *authp, *userp);
|
||||
if (user)
|
||||
free(user);
|
||||
if (cb)
|
||||
cbuf_free(cb);
|
||||
if (xt)
|
||||
|
|
|
|||
|
|
@ -150,6 +150,12 @@ expectpart "$(curl -u wilma:bar $CURLOPTS -X PATCH -H 'Content-Type: application
|
|||
new 'user is authorized'
|
||||
expectpart "$(curl -u andy:bar $CURLOPTS -X PATCH -H 'Content-Type: application/yang-data+json' $RCPROTO://localhost/restconf/data/example-jukebox:jukebox/library/artist=Clash -d '{"example-jukebox:artist":{"name":"Clash","album":{"name":"London Calling"}}}')" 0 "HTTP/1.1 204 No Content"
|
||||
|
||||
# Kill old
|
||||
if [ $RC -ne 0 ]; then
|
||||
new "Kill restconf daemon"
|
||||
stop_restconf
|
||||
fi
|
||||
|
||||
# Restart
|
||||
cat<<EOF > $startupdb
|
||||
<config>
|
||||
|
|
@ -249,19 +255,17 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
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
|
||||
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
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
|
|
|
|||
|
|
@ -105,24 +105,6 @@ module clixon-restconf {
|
|||
Note client-certificate applies only if ssl-enable is true and socket has ssl";
|
||||
default none;
|
||||
}
|
||||
leaf server-cert-path {
|
||||
type string;
|
||||
description
|
||||
"Path to server certificate file.
|
||||
Note only applies if socket has ssl enabled";
|
||||
}
|
||||
leaf server-key-path {
|
||||
type string;
|
||||
description
|
||||
"Path to server key file
|
||||
Note only applies if socket has ssl enabled";
|
||||
}
|
||||
leaf server-ca-cert-path {
|
||||
type string;
|
||||
description
|
||||
"Path to server CA cert file
|
||||
Note only applies if socket has ssl enabled";
|
||||
}
|
||||
leaf debug {
|
||||
description
|
||||
"Set debug level of restconf daemon.
|
||||
|
|
@ -148,21 +130,47 @@ module clixon-restconf {
|
|||
which may be desirable for performance or tests
|
||||
This replaces the CLICON_RESTCONF_PRETTY option in clixon-config.yang";
|
||||
}
|
||||
/* From this point only specific options
|
||||
* First fcgi-specific options
|
||||
*/
|
||||
leaf fcgi-socket {
|
||||
if-feature fcgi;
|
||||
if-feature fcgi; /* Set by default by fcgi clixon_restconf daemon */
|
||||
type string;
|
||||
default "/www-data/fastcgi_restconf.sock";
|
||||
description
|
||||
"FastCGI unix socket. Should be specified in webserver
|
||||
"Path to FastCGI unix socket. Should be specified in webserver
|
||||
Eg in nginx: fastcgi_pass unix:/www-data/clicon_restconf.sock
|
||||
Only if with-restconf=fcgi, NOT evhtp
|
||||
This replaces CLICON_RESTCONF_PATH option in clixon-config.yang";
|
||||
}
|
||||
/* Second, evhtp-specific options */
|
||||
leaf server-cert-path {
|
||||
type string;
|
||||
description
|
||||
"Path to server certificate file.
|
||||
Note only applies if socket has ssl enabled";
|
||||
}
|
||||
leaf server-key-path {
|
||||
type string;
|
||||
description
|
||||
"Path to server key file
|
||||
Note only applies if socket has ssl enabled";
|
||||
}
|
||||
leaf server-ca-cert-path {
|
||||
type string;
|
||||
description
|
||||
"Path to server CA cert file
|
||||
Note only applies if socket has ssl enabled";
|
||||
}
|
||||
list socket {
|
||||
description
|
||||
"List of server sockets that the restconf daemon listens to";
|
||||
key "namespace address port";
|
||||
leaf namespace {
|
||||
type string;
|
||||
description "indicates a namespace for instance. On platforms where namespaces are not suppported, always 'default'";
|
||||
description
|
||||
"Network namespace.
|
||||
On platforms where namespaces are not suppported, always 'default'";
|
||||
}
|
||||
leaf address {
|
||||
type inet:ip-address;
|
||||
|
|
@ -170,7 +178,7 @@ module clixon-restconf {
|
|||
}
|
||||
leaf port {
|
||||
type inet:port-number;
|
||||
description "IP port to bind to";
|
||||
description "TCP port to bind to";
|
||||
}
|
||||
leaf ssl {
|
||||
type boolean;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue