Fixed: YANG if-feature in config file did not work, was always on
Test: unset test variables
This commit is contained in:
parent
404d05950a
commit
e0100a6e3c
6 changed files with 32 additions and 12 deletions
|
|
@ -755,6 +755,7 @@ restconf_config_init(clicon_handle h,
|
|||
cvec *nsc = NULL;
|
||||
int auth_type;
|
||||
yang_stmt *yspec;
|
||||
yang_stmt *y;
|
||||
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clicon_err(OE_FATAL, 0, "No DB_SPEC");
|
||||
|
|
@ -786,14 +787,27 @@ restconf_config_init(clicon_handle h,
|
|||
else if (strcmp(bstr, "false") == 0)
|
||||
restconf_pretty_set(h, 0);
|
||||
}
|
||||
/* Check if enable-http-data is true and that feature is enabled
|
||||
* It is protected by if-feature http-data, which means if the feature is not enabled, its
|
||||
* YANG spec will exist but by ANYDATA
|
||||
*/
|
||||
if ((x = xpath_first(xrestconf, nsc, "enable-http-data")) != NULL &&
|
||||
(bstr = xml_body(x)) != NULL){
|
||||
if (strcmp(bstr, "true") == 0)
|
||||
(y = xml_spec(x)) != NULL &&
|
||||
yang_keyword_get(y) != Y_ANYDATA &&
|
||||
(bstr = xml_body(x)) != NULL &&
|
||||
strcmp(bstr, "true") == 0) {
|
||||
restconf_http_data_set(h, 1);
|
||||
else if (strcmp(bstr, "false") == 0)
|
||||
}
|
||||
else if (strcmp(bstr, "false") == 0){
|
||||
restconf_http_data_set(h, 0);
|
||||
}
|
||||
/* Check if fcgi-socket is true and that feature is enabled
|
||||
* It is protected by if-feature fcgi, which means if the feature is not enabled, then
|
||||
* YANG spec will exist but by ANYDATA
|
||||
*/
|
||||
if ((x = xpath_first(xrestconf, nsc, "fcgi-socket")) != NULL &&
|
||||
(y = xml_spec(x)) != NULL &&
|
||||
yang_keyword_get(y) != Y_ANYDATA &&
|
||||
(bstr = xml_body(x)) != NULL){
|
||||
if (restconf_fcgi_socket_set(h, bstr) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
14
test/lib.sh
14
test/lib.sh
|
|
@ -239,20 +239,20 @@ function restconf_config()
|
|||
|
||||
# Change this to fixed parameters
|
||||
if [ $# -gt 2 ]; then
|
||||
proto=$3
|
||||
myproto=$3
|
||||
else
|
||||
proto=$RCPROTO
|
||||
myproto=$RCPROTO
|
||||
fi
|
||||
if [ $# -gt 3 ]; then
|
||||
http_data=$4
|
||||
myhttpdata=$4
|
||||
else
|
||||
http_data=false
|
||||
myhttpdata=false
|
||||
fi
|
||||
|
||||
echo -n "<CLICON_FEATURE>clixon-restconf:fcgi</CLICON_FEATURE>"
|
||||
if [ $proto = http ]; then
|
||||
if [ $myproto = http ]; then
|
||||
echo -n "<restconf><enable>true</enable>"
|
||||
if ${http_data}; then
|
||||
if ${myhttpdata}; then
|
||||
echo -n "<enable-http-data>true</enable-http-data>"
|
||||
fi
|
||||
echo "<auth-type>$AUTH</auth-type><pretty>$PRETTY</pretty><debug>$DBG</debug><socket><namespace>default</namespace><address>0.0.0.0</address><port>80</port><ssl>false</ssl></socket></restconf>"
|
||||
|
|
@ -269,7 +269,7 @@ function restconf_config()
|
|||
servercerts $cakey $cacert $srvkey $srvcert
|
||||
fi
|
||||
echo -n "<restconf><enable>true</enable>"
|
||||
if ${http_data}; then
|
||||
if ${myhttpdata}; then
|
||||
echo -n "<enable-http-data>true</enable-http-data>"
|
||||
fi
|
||||
echo "<auth-type>$AUTH</auth-type><pretty>$PRETTY</pretty><server-cert-path>${certdir}/clixon-server-crt.pem</server-cert-path><server-key-path>${certdir}/clixon-server-key.pem</server-key-path><server-ca-cert-path>${certdir}/clixon-ca-crt.pem</server-ca-cert-path><debug>$DBG</debug><socket><namespace>default</namespace><address>0.0.0.0</address><port>443</port><ssl>true</ssl></socket></restconf>"
|
||||
|
|
|
|||
|
|
@ -244,6 +244,8 @@ rm -rf $dir
|
|||
unset RESTCONFIG
|
||||
unset HAVE_LIBNGHTTP2
|
||||
unset RCPROTO
|
||||
unset HVER
|
||||
unset CURLOPTS
|
||||
|
||||
# unset conditional parameters
|
||||
unset format
|
||||
|
|
|
|||
|
|
@ -557,6 +557,7 @@ for proto in $protos; do
|
|||
done
|
||||
|
||||
# unset conditional parameters
|
||||
unset HVER
|
||||
unset RCPROTO
|
||||
|
||||
# Set by restconf_config
|
||||
|
|
|
|||
|
|
@ -133,6 +133,8 @@ fi
|
|||
unset RESTCONFIG
|
||||
unset nr
|
||||
unset HAVE_LIBNGHTTP2
|
||||
unset CURLOPTS
|
||||
unset HVER
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
|
|
|
|||
|
|
@ -352,6 +352,7 @@ fi
|
|||
unset RESTCONFIG
|
||||
unset HVER
|
||||
unset RCPROTO
|
||||
unset CURLOPTS
|
||||
unset HAVE_LIBNGHTTP2
|
||||
|
||||
rm -rf $dir
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue