diff --git a/CHANGELOG.md b/CHANGELOG.md
index 481fc5c9..f7dc63a6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,16 +31,44 @@ Expected: February 2021
### New features
-* RESTCONF failed authentication changed error return code from 403 Forbiden to 401 Unauthorized following RFC 8040
- * Authentication OK but failed on access, remains as 403 Forbidden
* NETCONF Call Home Call Home RFC 8071
* See [Netconf/ssh callhome](https://clixon-docs.readthedocs.io/en/latest/netconf.html#callhome)
* Solution description using openssh and utility functions, no changes to core clixon
* Example: test/test_netconf_ssh_callhome.sh
- * RESTCONF Call home not done
+ * RESTCONF Call home not yet implemented
* New clixon_client API for external access
* See [client api docs](https://clixon-docs.readthedocs.io/en/latest/client.html)
+### API changes on existing protocol/config features
+
+Users may have to change how they access the system
+
+* RESTCONF configuration is unified and moved from clixon-config.yang to clixon-restconf.yang
+ * Except `CLICON_RESTCONF_DIR` which remains in clixon-config.yang due to bootstrapping
+ * -d
option removed
+ * This applies to both evhtp and fcgi RESTCONF
+ * Both can also read config from backend, and be started from backend
+ * You may need to move config as follows (from clixon-config.yang to clixon-restconf.yang)
+ * CLICON_RESTCONF_PRETTY -> restconf/pretty
+ * CLICON_RESTCONF_PATH -> restconf/fcgi-path
+ * For more info see [clixon-docs](https://clixon-docs.readthedocs.io/en/latest/restconf.html)
+* RESTCONF failed authentication changed error return code from 403 Forbiden to 401 Unauthorized following RFC 8040
+ * Authentication OK but failed on access, remains as 403 Forbidden
+* Handling empty netconf XML messages "]]>]]>" is changed from being accepted to return an error.
+* New clixon-restconf@2020-12-30.yang revision
+ * Added: debug field
+ * Added 'none' as default value for auth-type
+ * Changed http-auth-type enum from 'password' to 'user'
+* New clixon-lib@2020-12-30.yang revision
+ * Changed: RPC process-control output parameter status to pid
+* New clixon-config@2020-12-30.yang revision
+ * Removed obsolete RESTCONF and SSL options (CLICON_SSL_* and CLICON_RESTCONF_IP*/HTTP*)
+ * Removed obsolete: CLICON_TRANSACTION_MOD option
+ * Marked as obsolete: CLICON_RESTCONF_PATH CLICON_RESTCONF_PRETTY
+* Changed namespace of clixon-restconf@2020-10-30.yang from https://clicon.org/restconf ->http://clicon.org/restconf ->
+* CLIspec dbxml API: Ability to specify deletion of _any_ vs _specific_ entry.
+ * In a cli_del() call, the cvv arg list either exactly matches the api-format-path in which case _any_ deletion is specified, otherwise, if there is an extra element in the cvv list, that is used for a specific delete.
+
### C/CLI-API changes on existing features
Developers may need to change their code
@@ -56,23 +84,6 @@ Developers may need to change their code
* rpc msg C API rearranged to separate socket/connect from connect
* Added `cvv_i` output parameter to `api_path_fmt2api_path()` to see how many cvv entries were used.
-### API changes on existing protocol/config features
-
-Users may have to change how they access the system
-
-* Handling empty netconf XML messages "]]>]]>" is changed from being accepted to return an error.
-* New clixon-restconf@2020-12-30.yang revision
- * Added: debug field
- * Added 'none' as default value for auth-type
- * Changed http-auth-type enum from 'password' to 'user'
-* New clixon-lib@2020-12-30.yang revision
- * Changed: RPC process-control output parameter status to pid
-* New clixon-config@2020-12-30.yang revision
- * Removed obsolete RESTCONF and SSL options
-* Changed namespace of clixon-restconf@2020-10-30.yang from https://clicon.org/restconf ->http://clicon.org/restconf ->
-* CLIspec dbxml API: Ability to specify deletion of _any_ vs _specific_ entry.
- * In a cli_del() call, the cvv arg list either exactly matches the api-format-path in which case _any_ deletion is specified, otherwise, if there is an extra element in the cvv list, that is used for a specific delete.
-
### Minor changes
* Add ca_reset plugin also when backend starts as `-s none`
diff --git a/apps/restconf/restconf_lib.c b/apps/restconf/restconf_lib.c
index 6a5fcce0..32b0b83d 100644
--- a/apps/restconf/restconf_lib.c
+++ b/apps/restconf/restconf_lib.c
@@ -599,7 +599,6 @@ restconf_config_init(clicon_handle h,
goto disable;
}
}
-
/* get common fields */
if ((x = xpath_first(xrestconf, nsc, "auth-type")) != NULL &&
(bstr = xml_body(x)) != NULL){
@@ -609,6 +608,16 @@ restconf_config_init(clicon_handle h,
}
restconf_auth_type_set(h, auth_type);
}
+ if ((x = xpath_first(xrestconf, nsc, "pretty")) != NULL &&
+ (bstr = xml_body(x)) != NULL){
+ /* XXX redirection to (obsolete) option, fix by replacing its accesses */
+ clicon_option_str_set(h, "CLICON_RESTCONF_PRETTY", bstr);
+ }
+ if ((x = xpath_first(xrestconf, nsc, "fcgi-socket")) != NULL &&
+ (bstr = xml_body(x)) != NULL){
+ /* XXX redirection to (obsolete) option, fix by replacing its accesses */
+ clicon_option_str_set(h, "CLICON_RESTCONF_PATH", bstr);
+ }
retval = 1;
done:
return retval;
diff --git a/apps/restconf/restconf_main_evhtp.c b/apps/restconf/restconf_main_evhtp.c
index bb994fa0..f921f374 100644
--- a/apps/restconf/restconf_main_evhtp.c
+++ b/apps/restconf/restconf_main_evhtp.c
@@ -84,7 +84,7 @@
#include "restconf_root.h"
/* Command line options to be passed to getopt(3) */
-#define RESTCONF_OPTS "hD:f:E:l:p:d:y:a:u:ro:"
+#define RESTCONF_OPTS "hD:f:E:l:p:y:a:u:ro:"
/* See see listen(5) */
#define SOCKET_LISTEN_BACKLOG 16
@@ -700,15 +700,13 @@ usage(clicon_handle h,
"\t-E \t Extra configuration file directory\n"
"\t-l > \t Log on (s)yslog, (f)ile (syslog is default)\n"
"\t-p \t Yang directory path (see CLICON_YANG_DIR)\n"
- "\t-d \t Specify restconf plugin directory dir (default: %s)\n"
"\t-y \t Load yang spec file (override yang main module)\n"
"\t-a UNIX|IPv4|IPv6 Internal backend socket family\n"
"\t-u \t Internal socket domain path or IP addr (see -a)\n"
"\t-r \t\t Do not drop privileges if run as root\n"
"\t-o = Set configuration option overriding config file (see clixon-config.yang)\n"
,
- argv0,
- clicon_restconf_dir(h)
+ argv0
);
exit(0);
}
@@ -1043,12 +1041,11 @@ restconf_config(clicon_handle h,
cxobj *xerr = NULL;
uint32_t id = 0; /* Session id, to poll backend up */
struct passwd *pw;
- cxobj *xconfig1 = NULL;
- cxobj *xrestconf1 = NULL;
+ cxobj *xrestconf1 = NULL; /* Local config file */
cxobj *xconfig2 = NULL;
- cxobj *xrestconf2 = NULL;
+ cxobj *xrestconf2 = NULL; /* Config from backend */
int ret;
- int backend = 1; /* query backend for config */
+ int configure_done = 0; /* First try local then backend */
/* Set default namespace according to CLICON_NAMESPACE_NETCONF_DEFAULT */
xml_nsctx_namespace_netconf_default(h);
@@ -1126,6 +1123,7 @@ restconf_config(clicon_handle h,
/* Here all modules are loaded
* Compute and set canonical namespace context
+
*/
if (xml_nsctx_yangspec(yspec, &nsctx_global) < 0)
goto done;
@@ -1138,17 +1136,17 @@ restconf_config(clicon_handle h,
goto done;
}
- /* First get local config */
- xconfig1 = clicon_conf_xml(h);
- if ((xrestconf1 = xpath_first(xconfig1, NULL, "restconf")) != NULL){
+ /* First try to get restconf config from local config-file */
+ if ((xrestconf1 = clicon_conf_restconf(h)) != NULL){
/* Initialize evhtp with local config: ret 0 means disabled -> need to query remote */
if ((ret = cx_evhtp_init(h, xrestconf1, NULL, eh)) < 0)
goto done;
if (ret == 1)
- backend = 0;
+ configure_done = 1;
}
- if (backend){ /* Query backend of config. */
- /* Before evhtp, try again if not done */
+ /* If no local config, or it is disabled, try to query backend of config. */
+ if (!configure_done){
+ /* Loop to wait for backend starting, try again if not done */
while (1){
if (clicon_hello_req(h, &id) < 0){
if (errno == ENOENT){
@@ -1174,13 +1172,19 @@ restconf_config(clicon_handle h,
clixon_netconf_error(xerr, "Get backend restconf config", NULL);
goto done;
}
- /* Extract socket fields from xconfig */
+ /* Extract restconf configuration */
if ((xrestconf2 = xpath_first(xconfig2, nsc, "restconf")) != NULL){
/* Initialize evhtp with config from backend */
- if (cx_evhtp_init(h, xrestconf2, nsc, eh) < 0)
+ if ((ret = cx_evhtp_init(h, xrestconf2, nsc, eh)) < 0)
goto done;
+ if (ret == 1)
+ configure_done = 1;
}
}
+ if (!configure_done){ /* Query backend of config. */
+ clicon_err(OE_DAEMON, EFAULT, "Restconf daemon config not found or disabled");
+ goto done;
+ }
retval = 0;
done:
if (xconfig2)
@@ -1281,11 +1285,6 @@ main(int argc,
if (clicon_option_add(h, "CLICON_YANG_DIR", optarg) < 0)
goto done;
break;
- case 'd': /* Plugin directory */
- if (!strlen(optarg))
- usage(h, argv0);
- clicon_option_str_set(h, "CLICON_RESTCONF_DIR", optarg);
- break;
case 'y' : /* Load yang spec file (override yang main module) */
clicon_option_str_set(h, "CLICON_YANG_MAIN_FILE", optarg);
break;
diff --git a/apps/restconf/restconf_main_fcgi.c b/apps/restconf/restconf_main_fcgi.c
index 66cacde3..326c9a41 100644
--- a/apps/restconf/restconf_main_fcgi.c
+++ b/apps/restconf/restconf_main_fcgi.c
@@ -60,6 +60,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -175,15 +176,13 @@ usage(clicon_handle h,
"\t-E \t Extra configuration file directory\n"
"\t-l > \t Log on (s)yslog, (f)ile (syslog is default)\n"
"\t-p \t Yang directory path (see CLICON_YANG_DIR)\n"
- "\t-d \t Specify restconf plugin directory dir (default: %s)\n"
"\t-y \t Load yang spec file (override yang main module)\n"
"\t-a UNIX|IPv4|IPv6 Internal backend socket family\n"
"\t-u \t Internal socket domain path or IP addr (see -a)\n"
"\t-r \t\t Do not drop privileges if run as root\n"
"\t-o \"=\" Give configuration option overriding config file (see clixon-config.yang)\n",
- argv0,
- clicon_restconf_dir(h)
+ argv0
);
exit(0);
}
@@ -208,7 +207,6 @@ main(int argc,
yang_stmt *yspec = NULL;
char *stream_path;
int finish = 0;
- int start = 1;
char *str;
clixon_plugin *cp = NULL;
uint32_t id = 0;
@@ -217,9 +215,14 @@ main(int argc,
size_t cligen_bufthreshold;
int dbg = 0;
int drop_privileges = 1;
- cxobj *xconfig = NULL;
- cxobj *xrestconf = NULL;
int ret;
+ cxobj *xrestconf1 = NULL; /* Local config file */
+ cxobj *xconfig2 = NULL;
+ cxobj *xrestconf2 = NULL; /* Config from backend */
+ int configure_done = 0; /* First try local then backend */
+ cvec *nsc = NULL;
+ cxobj *xerr = NULL;
+ struct passwd *pw;
/* In the startup, logs to stderr & debug flag set later */
clicon_log_init(__PROGRAM__, LOG_INFO, logdst);
@@ -239,7 +242,7 @@ main(int argc,
if (sscanf(optarg, "%d", &dbg) != 1)
usage(h, argv[0]);
break;
- case 'f': /* override config file */
+ case 'f': /* override config file */
if (!strlen(optarg))
usage(h, argv[0]);
clicon_option_str_set(h, "CLICON_CONFIGFILE", optarg);
@@ -249,14 +252,14 @@ main(int argc,
usage(h, argv[0]);
clicon_option_str_set(h, "CLICON_CONFIGDIR", optarg);
break;
- case 'l': /* Log destination: s|e|o */
- if ((logdst = clicon_log_opt(optarg[0])) < 0)
+ case 'l': /* Log destination: s|e|o */
+ if ((logdst = clicon_log_opt(optarg[0])) < 0)
usage(h, argv[0]);
if (logdst == CLICON_LOG_FILE &&
strlen(optarg)>1 &&
clicon_log_file(optarg+1) < 0)
goto done;
- break;
+ break;
} /* switch getopt */
/*
* Logs, error and debug to stderr or syslog, set debug level
@@ -298,11 +301,6 @@ main(int argc,
if (clicon_option_add(h, "CLICON_YANG_DIR", optarg) < 0)
goto done;
break;
- case 'd': /* Plugin directory */
- if (!strlen(optarg))
- usage(h, argv[0]);
- clicon_option_str_set(h, "CLICON_RESTCONF_DIR", optarg);
- break;
case 'y' : /* Load yang spec file (override yang main module) */
clicon_option_str_set(h, "CLICON_YANG_MAIN_FILE", optarg);
break;
@@ -390,10 +388,11 @@ main(int argc,
if (yang_spec_load_dir(h, str, yspec) < 0)
goto done;
}
+
/* Load clixon lib yang module */
if (yang_spec_parse_module(h, "clixon-lib", NULL, yspec) < 0)
goto done;
- /* Load yang module library, RFC7895 */
+ /* Load yang module library, RFC7895 */
if (yang_modules_init(h) < 0)
goto done;
@@ -406,37 +405,77 @@ main(int argc,
goto done;
/* Add system modules */
- if (clicon_option_bool(h, "CLICON_STREAM_DISCOVERY_RFC8040") &&
- yang_spec_parse_module(h, "ietf-restconf-monitoring", NULL, yspec)< 0)
- goto done;
- if (clicon_option_bool(h, "CLICON_STREAM_DISCOVERY_RFC5277") &&
- yang_spec_parse_module(h, "clixon-rfc5277", NULL, yspec)< 0)
- goto done;
+ if (clicon_option_bool(h, "CLICON_STREAM_DISCOVERY_RFC8040") &&
+ yang_spec_parse_module(h, "ietf-restconf-monitoring", NULL, yspec)< 0)
+ goto done;
+ if (clicon_option_bool(h, "CLICON_STREAM_DISCOVERY_RFC5277") &&
+ yang_spec_parse_module(h, "clixon-rfc5277", NULL, yspec)< 0)
+ goto done;
- /* Here all modules are loaded
- * Compute and set canonical namespace context
- */
- if (xml_nsctx_yangspec(yspec, &nsctx_global) < 0)
- goto done;
- if (clicon_nsctx_global_set(h, nsctx_global) < 0)
- goto done;
+ /* Here all modules are loaded
+ * Compute and set canonical namespace context
+ */
+ if (xml_nsctx_yangspec(yspec, &nsctx_global) < 0)
+ goto done;
+ if (clicon_nsctx_global_set(h, nsctx_global) < 0)
+ goto done;
- /* Dump configuration options on debug */
+ /* Dump configuration options on debug */
if (dbg)
clicon_option_dump(h, dbg);
/* Call start function in all plugins before we go interactive */
- if (clixon_plugin_start_all(h) < 0)
- goto done;
- xconfig = clicon_conf_xml(h); /* Get local config */
- if ((xrestconf = xpath_first(xconfig, NULL, "restconf")) != NULL){
- if ((ret = restconf_config_init(h, xrestconf)) < 0)
- goto done;
- if (ret == 0){
- clicon_err(OE_DAEMON, EFAULT, "Restconf daemon disabled in config");
- goto done;
- }
- }
+ if (clixon_plugin_start_all(h) < 0)
+ goto done;
+
+ /* First try to get restconf config from local config-file */
+ if ((xrestconf1 = clicon_conf_restconf(h)) != NULL){
+ if ((ret = restconf_config_init(h, xrestconf1)) < 0)
+ goto done;
+ if (ret == 1)
+ configure_done = 1;
+ }
+ /* If no local config, or it is disabled, try to query backend of config. */
+ if (!configure_done){
+ /* Loop to wait for backend starting, try again if not done */
+ while (1){
+ if (clicon_hello_req(h, &id) < 0){
+ if (errno == ENOENT){
+ fprintf(stderr, "waiting");
+ sleep(1);
+ continue;
+ }
+ clicon_err(OE_UNIX, errno, "clicon_session_id_get");
+ goto done;
+ }
+ clicon_session_id_set(h, id);
+ break;
+ }
+ if ((nsc = xml_nsctx_init(NULL, CLIXON_RESTCONF_NS)) == NULL)
+ goto done;
+ if ((pw = getpwuid(getuid())) == NULL){
+ clicon_err(OE_UNIX, errno, "getpwuid");
+ goto done;
+ }
+ if (clicon_rpc_get_config(h, pw->pw_name, "running", "/restconf", nsc, &xconfig2) < 0)
+ goto done;
+ if ((xerr = xpath_first(xconfig2, NULL, "/rpc-error")) != NULL){
+ clixon_netconf_error(xerr, "Get backend restconf config", NULL);
+ goto done;
+ }
+ /* Extract restconf configuration */
+ if ((xrestconf2 = xpath_first(xconfig2, nsc, "restconf")) != NULL){
+ if ((ret = restconf_config_init(h, xrestconf1)) < 0)
+ goto done;
+ if (ret == 1)
+ configure_done = 1;
+ }
+ }
+ if (!configure_done){ /* Query backend of config. */
+ clicon_err(OE_DAEMON, EFAULT, "Restconf daemon config not found or disabled");
+ goto done;
+ }
+ /* XXX see restconf_config_init access directly */
if ((sockpath = clicon_option_str(h, "CLICON_RESTCONF_PATH")) == NULL){
clicon_err(OE_CFG, errno, "No CLICON_RESTCONF_PATH in clixon configure file");
goto done;
@@ -486,17 +525,6 @@ main(int argc,
}
clicon_debug(1, "------------");
- if (start == 0){
- /* Send hello request to backend to get session-id back
- * This is done once at the beginning of the session and then this is
- * used by the client, even though new TCP sessions are created for
- * each message sent to the backend.
- */
- if (clicon_hello_req(h, &id) < 0)
- goto done;
- clicon_session_id_set(h, id);
- start++;
- }
/* Translate from FCGI parameter form to Clixon runtime data
* XXX: potential name collision?
*/
@@ -555,6 +583,10 @@ main(int argc,
} /* while */
retval = 0;
done:
+ if (xconfig2)
+ xml_free(xconfig2);
+ if (nsc)
+ cvec_free(nsc);
stream_child_freeall(h);
restconf_terminate(h);
return retval;
diff --git a/apps/restconf/restconf_root.c b/apps/restconf/restconf_root.c
index c3426d4a..33e8a0c6 100644
--- a/apps/restconf/restconf_root.c
+++ b/apps/restconf/restconf_root.c
@@ -406,6 +406,7 @@ api_root_restconf(clicon_handle h,
}
request_method = restconf_param_get(h, "REQUEST_METHOD");
path = restconf_uripath(h);
+ /* XXX see restconf_config_init access directly */
pretty = clicon_option_bool(h, "CLICON_RESTCONF_PRETTY");
/* Get media for output (proactive negotiation) RFC7231 by using
* Accept:. This is for methods that have output, such as GET,
diff --git a/apps/restconf/restconf_stream_fcgi.c b/apps/restconf/restconf_stream_fcgi.c
index dbffb6dc..72fa1305 100644
--- a/apps/restconf/restconf_stream_fcgi.c
+++ b/apps/restconf/restconf_stream_fcgi.c
@@ -394,6 +394,7 @@ api_stream(clicon_handle h,
clicon_debug(1, "%s", __FUNCTION__);
path = restconf_uripath(h);
+ /* XXX see restconf_config_init access directly */
pretty = clicon_option_bool(h, "CLICON_RESTCONF_PRETTY");
if ((pvec = clicon_strsep(path, "/", &pn)) == NULL)
goto done;
diff --git a/lib/clixon/clixon_data.h b/lib/clixon/clixon_data.h
index c9e6f1e4..e5c577ef 100644
--- a/lib/clixon/clixon_data.h
+++ b/lib/clixon/clixon_data.h
@@ -90,6 +90,8 @@ int clicon_nacm_cache_set(clicon_handle h, cxobj *xn);
cxobj *clicon_conf_xml(clicon_handle h);
int clicon_conf_xml_set(clicon_handle h, cxobj *x);
+cxobj *clicon_conf_restconf(clicon_handle h);
+
db_elmnt *clicon_db_elmnt_get(clicon_handle h, const char *db);
int clicon_db_elmnt_set(clicon_handle h, const char *db, db_elmnt *xc);
diff --git a/lib/src/clixon_data.c b/lib/src/clixon_data.c
index 39918876..13e6b35a 100644
--- a/lib/src/clixon_data.c
+++ b/lib/src/clixon_data.c
@@ -461,6 +461,24 @@ clicon_conf_xml_set(clicon_handle h,
return 0;
}
+/*! Get local YANG specification for Clixon-restconf.yang tree
+ *
+ * That is, get the XML of clixon-config/restconf container of clixon-config.yang
+ * @param[in] h Clicon handle
+ * @retval x XML tree containing restconf xml node frm clixon-restconf.yang
+ * @note The clixon-restconf.yang instance can also be a part of the running datastore if
+ * CLICON_BACKEND_RESTCONF_PROCESS is true
+ */
+cxobj *
+clicon_conf_restconf(clicon_handle h)
+{
+ cxobj *xconfig = NULL;
+
+ if ((xconfig = clicon_conf_xml(h)) != NULL) /* Get local config */
+ return xpath_first(xconfig, NULL, "restconf");
+ return NULL;
+}
+
/*! Get authorized user name
* @param[in] h Clicon handle
* @retval username
diff --git a/lib/src/clixon_options.c b/lib/src/clixon_options.c
index dbd6f2d3..f966e7e7 100644
--- a/lib/src/clixon_options.c
+++ b/lib/src/clixon_options.c
@@ -519,6 +519,19 @@ clicon_options_main(clicon_handle h)
clicon_conf_xml_set(h, xconfig);
+#if defined(WITH_RESTCONF) && WITH_RESTCONF == fcgi
+ /* Enable fcgi feature
+ * Due to boot-strapping in first load of clixon config, a feature cannot be added
+ * programmatically after config file load
+ * It could be added to all clixon config files but since it is a compile time option
+ * this is a way to not be so intrusive
+ * If fcgi option gets secondary this should probably be changed
+ */
+ if (clixon_xml_parse_string("clixon-restconf:fcgi ",
+ YB_PARENT, NULL, &xconfig, NULL) < 0)
+ goto done;
+#endif
+
/* Parse clixon yang spec */
if (yang_spec_parse_module(h, "clixon-config", NULL, yspec) < 0)
goto done;
diff --git a/lib/src/clixon_yang.c b/lib/src/clixon_yang.c
index 7a8c0819..1ce5f149 100644
--- a/lib/src/clixon_yang.c
+++ b/lib/src/clixon_yang.c
@@ -1964,6 +1964,7 @@ if_feature(yang_stmt *yspec,
*
* @param[in] h Clicon handle
* @param[in] ys Feature yang statement to populate.
+ * Bootstrapping: A feature is enabled if found in clixon-config
*/
static int
ys_populate_feature(clicon_handle h,
@@ -1980,7 +1981,9 @@ ys_populate_feature(clicon_handle h,
char *m;
char *f;
- /* get clicon config file in xml form */
+ /* get clicon config file in xml form.
+ * Bootstrapping: A feature is enabled if found in clixon-config
+ */
if ((x = clicon_conf_xml(h)) == NULL)
goto ok;
if ((ymod = ys_module(ys)) == NULL){
diff --git a/test/lib.sh b/test/lib.sh
index 870bd665..db6bf96c 100755
--- a/test/lib.sh
+++ b/test/lib.sh
@@ -196,13 +196,18 @@ fi
# Default restconf configuration: http IPv4
# Can be placed in clixon-config
# Note that https clause assumes there exists certs and keys in /etc/ssl,...
+# Args:
+# 1: auth-type (one of none, client-cert, user)
+# 2: pretty (if true pretty-print restconf return values)
function restconf_config()
{
AUTH=$1
+ PRETTY=$2
+
if [ $RCPROTO = http ]; then
- RESTCONFIG="true $AUTH 1 default 0.0.0.0 80 false "
+ RESTCONFIG="true $AUTH $PRETTY $DBG default 0.0.0.0 80 false "
else
- RESTCONFIG="true $AUTH /etc/ssl/certs/clixon-server-crt.pem /etc/ssl/private/clixon-server-key.pem /etc/ssl/certs/clixon-ca-crt.pem 1 default 0.0.0.0 443 true "
+ RESTCONFIG="true $AUTH /etc/ssl/certs/clixon-server-crt.pem /etc/ssl/private/clixon-server-key.pem /etc/ssl/certs/clixon-ca-crt.pem $DBG default 0.0.0.0 443 true "
fi
}
diff --git a/test/long.sh b/test/long.sh
index 4092f97c..ba8d7fbc 100755
--- a/test/long.sh
+++ b/test/long.sh
@@ -21,6 +21,9 @@ cfg=$dir/scaling-conf.xml
fyang=$dir/scaling.yang
fconfig=$dir/large.xml
+# Define default restconfig config: RESTCONFIG
+restconf_config none false
+
cat < $fyang
module scaling{
yang-version 1.1;
@@ -52,10 +55,10 @@ cat < $cfg
$fyang
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/$APPNAME/$APPNAME.pidfile
- false
$format
/usr/local/var/$APPNAME
false
+ $RESTCONFIG
EOF
@@ -122,17 +125,18 @@ done
new "Kill restconf daemon"
stop_restconf
-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
rm -rf $dir
diff --git a/test/plot_perf.sh b/test/plot_perf.sh
index 5a578334..fcd7f901 100755
--- a/test/plot_perf.sh
+++ b/test/plot_perf.sh
@@ -81,7 +81,6 @@ cat < $cfg
scaling
/usr/local/var/example/example.sock
/usr/local/var/example/example.pidfile
- false
$dir
false
diff --git a/test/test_api.sh b/test/test_api.sh
index 2517166e..92d90612 100755
--- a/test/test_api.sh
+++ b/test/test_api.sh
@@ -25,7 +25,7 @@ if [ ! -d $pdir ]; then
fi
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
cat < $cfg
@@ -37,7 +37,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/cli
$APPNAME
/usr/local/var/$APPNAME/$APPNAME.sock
- false
$pdir
/usr/local/var/$APPNAME/$APPNAME.pidfile
$dir
diff --git a/test/test_augment.sh b/test/test_augment.sh
index bc6d0059..2b0d2909 100755
--- a/test/test_augment.sh
+++ b/test/test_augment.sh
@@ -24,7 +24,7 @@ fyang=$dir/main.yang
fyang2=$dir/ietf-interfaces@2019-03-04.yang
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
cat < $cfg
@@ -38,7 +38,6 @@ cat < $cfg
$APPNAME
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/$APPNAME/$APPNAME.pidfile
- false
/usr/local/var/$APPNAME
true
$RESTCONFIG
diff --git a/test/test_augment_state.sh b/test/test_augment_state.sh
index 210b3b9d..fc175d83 100755
--- a/test/test_augment_state.sh
+++ b/test/test_augment_state.sh
@@ -25,7 +25,6 @@ cat < $cfg
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/lib/$APPNAME/backend
- false
/usr/local/var/$APPNAME
false
diff --git a/test/test_augment_trans.sh b/test/test_augment_trans.sh
index c700b14b..9b77b647 100755
--- a/test/test_augment_trans.sh
+++ b/test/test_augment_trans.sh
@@ -28,7 +28,6 @@ cat < $cfg
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/lib/$APPNAME/backend
- false
/usr/local/var/$APPNAME
false
diff --git a/test/test_c++.sh b/test/test_c++.sh
index 27ffcc52..799cfc26 100755
--- a/test/test_c++.sh
+++ b/test/test_c++.sh
@@ -24,7 +24,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/clispec
/usr/local/lib/$APPNAME/cli
$APPNAME
- false
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
@@ -134,7 +133,6 @@ clixon_plugin_api* clixon_plugin_init(clicon_handle h)
return api.get_api();
}
-
EOF
new "C++ compile"
diff --git a/test/test_choice.sh b/test/test_choice.sh
index b65c7be4..673d4623 100755
--- a/test/test_choice.sh
+++ b/test/test_choice.sh
@@ -15,7 +15,7 @@ cfg=$dir/choice.xml
fyang=$dir/type.yang
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
cat < $cfg
@@ -28,7 +28,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/cli
$APPNAME
/usr/local/var/$APPNAME/$APPNAME.sock
- false
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
$RESTCONFIG
diff --git a/test/test_client.sh b/test/test_client.sh
index d3e37928..1c4b5b93 100755
--- a/test/test_client.sh
+++ b/test/test_client.sh
@@ -22,7 +22,7 @@ if [ ! -d $pdir ]; then
fi
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
cat < $cfg
@@ -34,7 +34,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/cli
$APPNAME
/usr/local/var/$APPNAME/$APPNAME.sock
- false
$pdir
/usr/local/var/$APPNAME/$APPNAME.pidfile
$dir
diff --git a/test/test_copy_config.sh b/test/test_copy_config.sh
index b00c218f..7e42bf37 100755
--- a/test/test_copy_config.sh
+++ b/test/test_copy_config.sh
@@ -30,7 +30,7 @@ cfg=$dir/conf_yang.xml
# Use yang in example
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none true
cat < $cfg
diff --git a/test/test_identity.sh b/test/test_identity.sh
index 825d4b9a..39719734 100755
--- a/test/test_identity.sh
+++ b/test/test_identity.sh
@@ -11,7 +11,7 @@ cfg=$dir/conf_yang.xml
fyang=$dir/example-my-crypto.yang
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
cat < $cfg
@@ -25,7 +25,6 @@ cat < $cfg
example_backend.so$
/usr/local/lib/$APPNAME/netconf
/usr/local/lib/$APPNAME/restconf
- false
/usr/local/lib/$APPNAME/cli
$APPNAME
/usr/local/var/$APPNAME/$APPNAME.sock
diff --git a/test/test_nacm.sh b/test/test_nacm.sh
index 67bb3637..9ecc6df8 100755
--- a/test/test_nacm.sh
+++ b/test/test_nacm.sh
@@ -18,7 +18,7 @@ cfg=$dir/conf_yang.xml
fyang=$dir/nacm-example.yang
# Define default restconfig config: RESTCONFIG
-restconf_config user
+restconf_config user false
cat < $cfg
@@ -34,7 +34,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/backend
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
- false
internal
true
$RESTCONFIG
diff --git a/test/test_nacm_datanode.sh b/test/test_nacm_datanode.sh
index 220fa358..75485401 100755
--- a/test/test_nacm_datanode.sh
+++ b/test/test_nacm_datanode.sh
@@ -46,7 +46,7 @@ fyang=$dir/nacm-example.yang
fyang2=$dir/itf.yang
# Define default restconfig config: RESTCONFIG
-restconf_config user
+restconf_config user false
cat < $cfg
@@ -63,7 +63,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/backend
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
- false
internal
true
$RESTCONFIG
diff --git a/test/test_nacm_datanode_paths.sh b/test/test_nacm_datanode_paths.sh
index 545830c2..1f5c4fe2 100755
--- a/test/test_nacm_datanode_paths.sh
+++ b/test/test_nacm_datanode_paths.sh
@@ -18,7 +18,7 @@ cfg=$dir/conf_yang.xml
fyang=$dir/nacm-example.yang
# Define default restconfig config: RESTCONFIG
-restconf_config user
+restconf_config user false
cat < $cfg
@@ -36,7 +36,6 @@ cat < $cfg
/usr/local/var/$APPNAME/$APPNAME.pidfile
$dir
/usr/local/lib/$APPNAME/restconf
- false
internal
none
$RESTCONFIG
diff --git a/test/test_nacm_datanode_read.sh b/test/test_nacm_datanode_read.sh
index f93d0b0b..d27e9205 100755
--- a/test/test_nacm_datanode_read.sh
+++ b/test/test_nacm_datanode_read.sh
@@ -26,7 +26,7 @@ fyang=$dir/nacm-example.yang
fyang2=$dir/nacm-example2.yang
# Define default restconfig config: RESTCONFIG
-restconf_config user
+restconf_config user false
cat < $cfg
@@ -43,7 +43,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/backend
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
- false
internal
true
$RESTCONFIG
diff --git a/test/test_nacm_datanode_write.sh b/test/test_nacm_datanode_write.sh
index 6d98f7c9..4205193a 100755
--- a/test/test_nacm_datanode_write.sh
+++ b/test/test_nacm_datanode_write.sh
@@ -18,7 +18,7 @@ cfg=$dir/conf_yang.xml
fyang=$dir/nacm-example.yang
# Define default restconfig config: RESTCONFIG
-restconf_config user
+restconf_config user false
cat < $cfg
@@ -35,7 +35,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/backend
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
- false
internal
true
$RESTCONFIG
diff --git a/test/test_nacm_default.sh b/test/test_nacm_default.sh
index fd342961..ce790862 100755
--- a/test/test_nacm_default.sh
+++ b/test/test_nacm_default.sh
@@ -14,7 +14,7 @@ fyang=$dir/nacm-example.yang
: ${format:=xml}
# Define default restconfig config: RESTCONFIG
-restconf_config user
+restconf_config user false
cat < $cfg
@@ -31,7 +31,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/backend
/usr/local/var/$APPNAME/$APPNAME.pidfile
$dir
- false
internal
true
$format
diff --git a/test/test_nacm_ext.sh b/test/test_nacm_ext.sh
index 72d46f33..9debcbab 100755
--- a/test/test_nacm_ext.sh
+++ b/test/test_nacm_ext.sh
@@ -16,7 +16,7 @@ fyang=$dir/nacm-example.yang
nacmfile=$dir/nacmfile
# Define default restconfig config: RESTCONFIG
-restconf_config user
+restconf_config user false
# Note filter out example_backend_nacm.so in CLICON_BACKEND_REGEXP below
cat < $cfg
@@ -35,7 +35,6 @@ cat < $cfg
false
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
- false
external
$nacmfile
none
diff --git a/test/test_nacm_module_read.sh b/test/test_nacm_module_read.sh
index 477cadb2..69e26931 100755
--- a/test/test_nacm_module_read.sh
+++ b/test/test_nacm_module_read.sh
@@ -19,7 +19,7 @@ cfg=$dir/conf_yang.xml
fyang=$dir/nacm-example.yang
# Define default restconfig config: RESTCONFIG
-restconf_config user
+restconf_config user false
cat < $cfg
@@ -35,7 +35,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/backend
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
- false
internal
none
true
diff --git a/test/test_nacm_module_write.sh b/test/test_nacm_module_write.sh
index e6997823..62fe2a3f 100755
--- a/test/test_nacm_module_write.sh
+++ b/test/test_nacm_module_write.sh
@@ -32,7 +32,7 @@ cfg=$dir/conf_yang.xml
fyang=$dir/nacm-example.yang
# Define default restconfig config: RESTCONFIG
-restconf_config user
+restconf_config user false
cat < $cfg
@@ -49,7 +49,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/backend
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
- false
internal
true
$RESTCONFIG
diff --git a/test/test_nacm_protocol.sh b/test/test_nacm_protocol.sh
index 21a4631d..f7d93cdc 100755
--- a/test/test_nacm_protocol.sh
+++ b/test/test_nacm_protocol.sh
@@ -35,7 +35,7 @@ cfg=$dir/conf_yang.xml
fyang=$dir/nacm-example.yang
# Define default restconfig config: RESTCONFIG
-restconf_config user
+restconf_config user false
cat < $cfg
@@ -52,7 +52,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/backend
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
- false
internal
none
true
diff --git a/test/test_nacm_recovery.sh b/test/test_nacm_recovery.sh
index 75ac201a..5783f2c6 100755
--- a/test/test_nacm_recovery.sh
+++ b/test/test_nacm_recovery.sh
@@ -21,7 +21,7 @@ fyang=$dir/nacm-example.yang
# cred:none, exact, except
# Define default restconfig config: RESTCONFIG
-restconf_config user
+restconf_config user false
cat < $fyang
module nacm-example{
@@ -84,7 +84,6 @@ cat < $cfg
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
false
- false
$recovery
internal
$cred
diff --git a/test/test_netconf_notifications.sh b/test/test_netconf_notifications.sh
index 76fe2ca7..93ce7b1a 100755
--- a/test/test_netconf_notifications.sh
+++ b/test/test_netconf_notifications.sh
@@ -32,7 +32,6 @@ cat < $cfg
/usr/local/share/clixon
$IETFRFC
$fyang
- false
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/lib/$APPNAME/backend
example_backend.so$
diff --git a/test/test_perf_cli.sh b/test/test_perf_cli.sh
index 779e48b9..e6518f97 100755
--- a/test/test_perf_cli.sh
+++ b/test/test_perf_cli.sh
@@ -60,7 +60,6 @@ cat < $cfg
$fyang
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/example/$APPNAME.pidfile
- false
$dir
false
$format
diff --git a/test/test_perf_mem.sh b/test/test_perf_mem.sh
index 9b805f2f..b285cdc4 100755
--- a/test/test_perf_mem.sh
+++ b/test/test_perf_mem.sh
@@ -50,7 +50,6 @@ cat < $cfg
$fyang
/usr/local/var/$APPNAME/$APPNAME.sock
$pidfile
- false
$dir
false
example
diff --git a/test/test_perf_netconf.sh b/test/test_perf_netconf.sh
index 41ac4e3e..4238f16e 100755
--- a/test/test_perf_netconf.sh
+++ b/test/test_perf_netconf.sh
@@ -61,7 +61,6 @@ cat < $cfg
$fyang
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/example/$APPNAME.pidfile
- false
$dir
false
$format
diff --git a/test/test_perf_restconf.sh b/test/test_perf_restconf.sh
index 4847456c..820fdade 100755
--- a/test/test_perf_restconf.sh
+++ b/test/test_perf_restconf.sh
@@ -53,7 +53,7 @@ module scaling{
EOF
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
cat < $cfg
@@ -63,7 +63,6 @@ cat < $cfg
$fyang
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/example/$APPNAME.pidfile
- false
$dir
false
$format
diff --git a/test/test_perf_startup.sh b/test/test_perf_startup.sh
index 33f55a94..8d7cd3e2 100755
--- a/test/test_perf_startup.sh
+++ b/test/test_perf_startup.sh
@@ -60,7 +60,6 @@ cat < $cfg
$fyang
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/example/$APPNAME.pidfile
- false
$dir
false
example
diff --git a/test/test_perf_state.sh b/test/test_perf_state.sh
index 1c8fe2ba..03d2b684 100755
--- a/test/test_perf_state.sh
+++ b/test/test_perf_state.sh
@@ -30,7 +30,7 @@ fconfig=$dir/large.xml
fstate=$dir/state.xml
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
cat < $cfg
@@ -41,7 +41,6 @@ cat < $cfg
/usr/local/var/example/$APPNAME.pidfile
/usr/local/lib/$APPNAME/backend
example_backend.so$
- false
$dir
false
$format
diff --git a/test/test_perf_state_only.sh b/test/test_perf_state_only.sh
index 4da26a55..747621a1 100755
--- a/test/test_perf_state_only.sh
+++ b/test/test_perf_state_only.sh
@@ -30,7 +30,7 @@ fconfig=$dir/large.xml
fstate=$dir/state.xml
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
cat < $cfg
@@ -41,7 +41,6 @@ cat < $cfg
/usr/local/var/example/$APPNAME.pidfile
/usr/local/lib/$APPNAME/backend
example_backend.so$
- false
$dir
false
$format
diff --git a/test/test_restconf.sh b/test/test_restconf.sh
index 31a230d3..adb46c36 100755
--- a/test/test_restconf.sh
+++ b/test/test_restconf.sh
@@ -49,7 +49,7 @@ if [ "${WITH_RESTCONF}" = "evhtp" ]; then
. ./certs.sh
else
# Define default restconfig config: RESTCONFIG
- restconf_config none
+ restconf_config none false
fi
# This is a fixed 'state' implemented in routing_backend. It is assumed to be always there
@@ -64,6 +64,7 @@ if $IPv6; then
$srvcert
$srvkey
$cakey
+ false
default 0.0.0.0 80 false
default 0.0.0.0 443 true
default :: 80 false
@@ -80,6 +81,7 @@ else
$srvcert
$srvkey
$cakey
+ false
default 0.0.0.0 80 false
default 0.0.0.0 443 true
@@ -98,7 +100,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/backend
example_backend.so$
/usr/local/lib/$APPNAME/restconf
- false
/usr/local/lib/$APPNAME/cli
$APPNAME
/usr/local/var/$APPNAME/$APPNAME.sock
@@ -109,7 +110,6 @@ cat < $cfg
EOF
-
# Restconf test routine with arguments:
# 1. proto:http/https
# 2: addr: 127.0.0.1/::1 # IPv4 or IPv6
diff --git a/test/test_restconf2.sh b/test/test_restconf2.sh
index 2ea81331..bc09eb2d 100755
--- a/test/test_restconf2.sh
+++ b/test/test_restconf2.sh
@@ -13,7 +13,7 @@ cfg=$dir/conf.xml
fyang=$dir/restconf.yang
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
# example
cat < $cfg
@@ -22,7 +22,6 @@ cat < $cfg
/usr/local/share/clixon
$IETFRFC
$fyang
- false
/usr/local/var/$APPNAME/$APPNAME.sock
$dir/restconf.pidfile
/usr/local/var/$APPNAME
diff --git a/test/test_restconf_err.sh b/test/test_restconf_err.sh
index 387e3174..4210d231 100755
--- a/test/test_restconf_err.sh
+++ b/test/test_restconf_err.sh
@@ -31,7 +31,7 @@ fxml=$dir/initial.xml
fstate=$dir/state.xml
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
# example
cat < $cfg
@@ -40,7 +40,6 @@ cat < $cfg
/usr/local/share/clixon
$dir
$fyang
- false
/usr/local/var/$APPNAME/$APPNAME.sock
$dir/restconf.pidfile
/usr/local/lib/$APPNAME/backend
diff --git a/test/test_restconf_jukebox.sh b/test/test_restconf_jukebox.sh
index e4192edf..21a4b768 100755
--- a/test/test_restconf_jukebox.sh
+++ b/test/test_restconf_jukebox.sh
@@ -24,7 +24,7 @@ cat < $dir/example-system.yang
EOF
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
# example
cat < $cfg
@@ -33,7 +33,6 @@ cat < $cfg
/usr/local/share/clixon
$IETFRFC
$dir
- false
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/lib/$APPNAME/backend
$dir/restconf.pidfile
diff --git a/test/test_restconf_listkey.sh b/test/test_restconf_listkey.sh
index 24353e2f..c1baa41b 100755
--- a/test/test_restconf_listkey.sh
+++ b/test/test_restconf_listkey.sh
@@ -11,7 +11,7 @@ cfg=$dir/conf.xml
fyang=$dir/list.yang
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
# example
cat < $cfg
@@ -20,7 +20,6 @@ cat < $cfg
/usr/local/share/clixon
$IETFRFC
$fyang
- false
/usr/local/var/$APPNAME/$APPNAME.sock
$dir/restconf.pidfile
/usr/local/var/$APPNAME
diff --git a/test/test_restconf_netns.sh b/test/test_restconf_netns.sh
index 24e94c72..8d8e58dd 100755
--- a/test/test_restconf_netns.sh
+++ b/test/test_restconf_netns.sh
@@ -25,7 +25,6 @@ if [ $? -ne 0 ]; then
if [ "$s" = $0 ]; then exit 0; else return 0; fi # skip
fi
-
APPNAME=example
cfg=$dir/conf.xml
@@ -53,6 +52,7 @@ RESTCONFIG=$(cat <$srvcert
$srvkey
$cakey
+ false
default
0.0.0.0
@@ -88,7 +88,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/backend
example_backend.so$
/usr/local/lib/$APPNAME/restconf
- false
/usr/local/lib/$APPNAME/cli
$APPNAME
/usr/local/var/$APPNAME/$APPNAME.sock
diff --git a/test/test_restconf_notifications.sh b/test/test_restconf_notifications.sh
index a51a946c..f821795c 100755
--- a/test/test_restconf_notifications.sh
+++ b/test/test_restconf_notifications.sh
@@ -42,7 +42,7 @@ fyang=$dir/stream.yang
xml=$dir/xml.xml
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
# example
cat < $cfg
@@ -51,7 +51,6 @@ cat < $cfg
/usr/local/share/clixon
$IETFRFC
$fyang
- false
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/lib/$APPNAME/backend
example_backend.so$
diff --git a/test/test_restconf_patch.sh b/test/test_restconf_patch.sh
index dd21af8b..36b6df13 100755
--- a/test/test_restconf_patch.sh
+++ b/test/test_restconf_patch.sh
@@ -13,7 +13,7 @@ startupdb=$dir/startup_db
fjukebox=$dir/example-jukebox.yang
# Define default restconfig config: RESTCONFIG
-restconf_config user
+restconf_config user false
cat < $cfg
@@ -23,7 +23,6 @@ cat < $cfg
$dir
/usr/local/var/$APPNAME/$APPNAME.sock
ietf-netconf:startup
- false
/usr/local/lib/$APPNAME/restconf
$dir/restconf.pidfile
$dir
diff --git a/test/test_restconf_rpc.sh b/test/test_restconf_rpc.sh
index cebd3f11..c047b3e2 100755
--- a/test/test_restconf_rpc.sh
+++ b/test/test_restconf_rpc.sh
@@ -17,7 +17,7 @@ cfg=$dir/conf.xml
startupdb=$dir/startup_db
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
cat < $cfg
@@ -30,7 +30,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/backend
example_backend.so$
/usr/local/lib/$APPNAME/restconf
- false
/usr/local/lib/$APPNAME/cli
$APPNAME
/usr/local/var/$APPNAME/$APPNAME.sock
diff --git a/test/test_restconf_ssl_certs.sh b/test/test_restconf_ssl_certs.sh
index a696df5d..0becf6e0 100755
--- a/test/test_restconf_ssl_certs.sh
+++ b/test/test_restconf_ssl_certs.sh
@@ -137,7 +137,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/backend
example_backend.so$
/usr/local/lib/$APPNAME/restconf
- false
/usr/local/lib/$APPNAME/cli
$APPNAME
/usr/local/var/$APPNAME/$APPNAME.sock
@@ -151,7 +150,8 @@ cat < $cfg
$srvcert
$srvkey
$cacert
-
+ $DBG
+ false
default
0.0.0.0
diff --git a/test/test_restconf_startup.sh b/test/test_restconf_startup.sh
index 98a64a3b..f866f16b 100755
--- a/test/test_restconf_startup.sh
+++ b/test/test_restconf_startup.sh
@@ -35,7 +35,7 @@ EOF
# Use yang in example
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none true
cat < $cfg
diff --git a/test/test_rpc.sh b/test/test_rpc.sh
index f5d8bfd7..9e35fa25 100755
--- a/test/test_rpc.sh
+++ b/test/test_rpc.sh
@@ -14,7 +14,7 @@ APPNAME=example
cfg=$dir/conf.xml
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
# Use yang in example
cat < $cfg
@@ -27,7 +27,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/clispec
/usr/local/lib/$APPNAME/cli
$APPNAME
- false
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
diff --git a/test/test_submodule.sh b/test/test_submodule.sh
index 32e14a75..46fd88b0 100755
--- a/test/test_submodule.sh
+++ b/test/test_submodule.sh
@@ -28,7 +28,7 @@ fextra1=$dir/extra1.yang # Referenced from sub1
fextra2=$dir/extra2.yang # Referenced from sub2
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
cat < $cfg
@@ -43,7 +43,6 @@ cat < $cfg
/usr/local/var/$APPNAME/$APPNAME.pidfile
example_backend.so$
/usr/local/lib/$APPNAME/restconf
- false
/usr/local/var/$APPNAME
false
$RESTCONFIG
diff --git a/test/test_yang_anydata.sh b/test/test_yang_anydata.sh
index 172f33f3..c2b88c6c 100755
--- a/test/test_yang_anydata.sh
+++ b/test/test_yang_anydata.sh
@@ -22,7 +22,7 @@ funknown=$dir/yang/unknown.yang
fstate=$dir/state.xml
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
cat < $fanydata
module any{
@@ -145,7 +145,6 @@ function testrun()
/usr/local/var/$APPNAME/$APPNAME.pidfile
$dir
false
- false
$unknown
$F
$RESTCONFIG
diff --git a/test/test_yang_namespace.sh b/test/test_yang_namespace.sh
index cb5f0217..1d14d1cf 100755
--- a/test/test_yang_namespace.sh
+++ b/test/test_yang_namespace.sh
@@ -14,7 +14,7 @@ fyang1=$dir/example1.yang
fyang2=$dir/example2.yang
# Define default restconfig config: RESTCONFIG
-restconf_config none
+restconf_config none false
cat < $cfg
@@ -25,7 +25,6 @@ cat < $cfg
/usr/local/lib/$APPNAME/clispec
/usr/local/lib/$APPNAME/cli
$APPNAME
- false
/usr/local/var/$APPNAME/$APPNAME.sock
/usr/local/var/$APPNAME/$APPNAME.pidfile
/usr/local/var/$APPNAME
diff --git a/yang/clixon/clixon-config@2020-12-30.yang b/yang/clixon/clixon-config@2020-12-30.yang
index ea3f46e8..e80dc036 100644
--- a/yang/clixon/clixon-config@2020-12-30.yang
+++ b/yang/clixon/clixon-config@2020-12-30.yang
@@ -52,7 +52,11 @@ module clixon-config {
CLICON_RESTCONF_HTTPS_PORT
CLICON_SSL_SERVER_CERT
CLICON_SSL_SERVER_KEY
- CLICON_SSL_CA_CERT";
+ CLICON_SSL_CA_CERT
+ CLICON_TRANSACTION_MOD
+ Marked as obsolete and moved to clixon-restconf.yang:
+ CLICON_RESTCONF_PATH
+ CLICON_RESTCONF_PRETTY";
}
revision 2020-11-03 {
description
@@ -428,7 +432,10 @@ module clixon-config {
type string;
description
"Location of restconf (frontend) .so plugins. Load all .so
- plugins in this dir as restconf code plugins";
+ plugins in this dir as restconf code plugins
+ Note: This cannot be moved to clixon-restconf.yang because it is needed
+ early in the bootstrapping phase, before clixon-restconf.yang config may
+ be loaded.";
}
leaf CLICON_RESTCONF_PATH {
type string;
@@ -436,8 +443,11 @@ module clixon-config {
description
"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";
+ Only if with-restconf=fcgi, NOT evhtp
+ Note: Obsolete, use fcgi-socket in clixon-restconf.yang instead";
+ status obsolete;
}
+
leaf CLICON_RESTCONF_PRETTY {
type boolean;
default true;
@@ -449,7 +459,9 @@ module clixon-config {
to get return value in XML or JSON.
RFC 8040 examples print XML and JSON in pretty-printed form.
Setting this value to false makes restconf return not pretty-printed
- which may be desirable for performance or tests";
+ which may be desirable for performance or tests
+ Note: Obsolete, use pretty in clixon-restconf.yang instead";
+ status obsolete;
}
leaf CLICON_CLI_DIR {
type string;
@@ -775,14 +787,6 @@ module clixon-config {
type startup_mode;
description "Which method to boot/start clicon backend";
}
- leaf CLICON_TRANSACTION_MOD {
- type boolean;
- default false;
- description "If set, modifications in validation and commit
- callbacks are written back into the datastore.
- This is a bad idea and therefore obsoleted.";
- status obsolete;
- }
leaf CLICON_NACM_MODE {
type nacm_mode;
default disabled;
diff --git a/yang/clixon/clixon-restconf@2020-12-30.yang b/yang/clixon/clixon-restconf@2020-12-30.yang
index fb8d12c2..5165f035 100644
--- a/yang/clixon/clixon-restconf@2020-12-30.yang
+++ b/yang/clixon/clixon-restconf@2020-12-30.yang
@@ -53,6 +53,15 @@ module clixon-restconf {
description
"Initial release";
}
+ feature fcgi {
+ description
+ "This feature indicates that the restconf server supports the fast-cgi reverse
+ proxy solution.
+ That is, a reverse proxy is the HTTP front-end and the restconf daemon listens
+ to a fcgi socket.
+ The alternative is the internal HTTP solution using evhtp.";
+ }
+
typedef http-auth-type {
type enumeration {
enum none {
@@ -125,6 +134,30 @@ module clixon-restconf {
type uint32;
default 0;
}
+ leaf pretty {
+ type boolean;
+ default true;
+ description
+ "Restconf return value pretty print.
+ Restconf clients may add HTTP header:
+ Accept: application/yang-data+json, or
+ Accept: application/yang-data+xml
+ to get return value in XML or JSON.
+ RFC 8040 examples print XML and JSON in pretty-printed form.
+ Setting this value to false makes restconf return not pretty-printed
+ which may be desirable for performance or tests
+ This replaces the CLICON_RESTCONF_PRETTY option in clixon-config.yang";
+ }
+ leaf fcgi-socket {
+ if-feature fcgi;
+ type string;
+ default "/www-data/fastcgi_restconf.sock";
+ description
+ "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";
+ }
list socket {
key "namespace address port";
leaf namespace {