Revert "* Added valgrind memory leak tests in testmem.sh for restconf"
String error
This reverts commit 6e63f0a77b.
This commit is contained in:
parent
5b6bdbfd3a
commit
a73d2bd242
29 changed files with 131 additions and 193 deletions
|
|
@ -111,7 +111,6 @@
|
||||||
* Many hand-crafted validation messages have been removed and replaced with generic validations, which may lead to changed rpc-error messages.
|
* Many hand-crafted validation messages have been removed and replaced with generic validations, which may lead to changed rpc-error messages.
|
||||||
* CLICON_XML_SORT option (in clixon-config.yang) has been removed and set to true permanently. Unsorted XML lists leads to slower performance and old obsolete code can be removed.
|
* CLICON_XML_SORT option (in clixon-config.yang) has been removed and set to true permanently. Unsorted XML lists leads to slower performance and old obsolete code can be removed.
|
||||||
* Strict namespace setting can be a problem when upgrading existing database files, such as startup-db or persistent running-db, or any other saved XML file.
|
* Strict namespace setting can be a problem when upgrading existing database files, such as startup-db or persistent running-db, or any other saved XML file.
|
||||||
* Removed obsolete `-x` command-line option to clixon_cli.
|
|
||||||
* Removed `delete-config` support for candidate db since it is not supported in RFC6241.
|
* Removed `delete-config` support for candidate db since it is not supported in RFC6241.
|
||||||
* Switched the order of `error-type` and `error-tag` in all netconf and restconf error messages to comply to RFC order.
|
* Switched the order of `error-type` and `error-tag` in all netconf and restconf error messages to comply to RFC order.
|
||||||
* XML namespace handling is corrected (see major changes)
|
* XML namespace handling is corrected (see major changes)
|
||||||
|
|
@ -130,15 +129,14 @@
|
||||||
* `<!DOCTYPE` (ie DTD) is not supported.
|
* `<!DOCTYPE` (ie DTD) is not supported.
|
||||||
* Added Clixon example full system docker container, see [docker/system](docker/system).
|
* Added Clixon example full system docker container, see [docker/system](docker/system).
|
||||||
* Moved datastore/text/ code to datastore/ since there is only one type of datastore.
|
* Moved datastore/text/ code to datastore/ since there is only one type of datastore.
|
||||||
* Added clicon_socket_set() and clicon_socket_get() functions for cleaning up backend server and restconf FCGI socket on termination.
|
|
||||||
* Changed clixon base system container to use Alpine [docker/base](docker/base).
|
* Changed clixon base system container to use Alpine [docker/base](docker/base).
|
||||||
* clixon-config YAML file has new revision: 2019-02-06.
|
* clixon-config YAML file has new revision: 2019-02-06.
|
||||||
* Added new log function: `clicon_log_xml()` for logging XML tree
|
* Added new log function: `clicon_log_xml()` for logging XML tree
|
||||||
* Replaced all calls to (obsolete) `cli_output` with `fprintf`
|
* Replaced all calls to (obsolete) `cli_output` with `fprintf`
|
||||||
* Added _experimental_ config option `CLICON_CLI_UTF8` default set to 0.
|
* Added _experimental_ config option `CLICON_CLI_UTF8` default set to 0.
|
||||||
* CLIgen UTF8 does not work with scrolling and control editing
|
* CLIgen UTF8 does not work with scrolling and control editing
|
||||||
* Added valgrind memory leak tests in testmem.sh for cli, netconf, restconf and backend
|
* Added valgrind memory leak tests in testmem.sh for cli, netconf and backend
|
||||||
* To run with backend for example: `mem.sh backend`
|
* remains: restconf
|
||||||
* Added `make test` from top-level Makefile
|
* Added `make test` from top-level Makefile
|
||||||
* Added `xml_rootchild_node()` lib function as variant of `xml_rootchild()`
|
* Added `xml_rootchild_node()` lib function as variant of `xml_rootchild()`
|
||||||
* Added -o "<option>=<value>" command-line option to all programs: backend, cli, netconf, restconf.
|
* Added -o "<option>=<value>" command-line option to all programs: backend, cli, netconf, restconf.
|
||||||
|
|
|
||||||
|
|
@ -77,10 +77,7 @@
|
||||||
|
|
||||||
#define BACKEND_LOGFILE "/usr/local/var/clixon_backend.log"
|
#define BACKEND_LOGFILE "/usr/local/var/clixon_backend.log"
|
||||||
|
|
||||||
/*! Clean and close all state of backend (but dont exit).
|
/*! Terminate. Cannot use h after this */
|
||||||
* Cannot use h after this
|
|
||||||
* @param[in] h Clixon handle
|
|
||||||
*/
|
|
||||||
static int
|
static int
|
||||||
backend_terminate(clicon_handle h)
|
backend_terminate(clicon_handle h)
|
||||||
{
|
{
|
||||||
|
|
@ -90,11 +87,8 @@ backend_terminate(clicon_handle h)
|
||||||
char *sockpath = clicon_sock(h);
|
char *sockpath = clicon_sock(h);
|
||||||
cxobj *x;
|
cxobj *x;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int ss;
|
|
||||||
|
|
||||||
clicon_debug(1, "%s", __FUNCTION__);
|
clicon_debug(1, "%s", __FUNCTION__);
|
||||||
if ((ss = clicon_socket_get(h)) != -1)
|
|
||||||
close(ss);
|
|
||||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||||
yspec_free(yspec);
|
yspec_free(yspec);
|
||||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
if ((yspec = clicon_config_yang(h)) != NULL)
|
||||||
|
|
@ -937,11 +931,10 @@ main(int argc,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize server socket and save it to handle */
|
/* Initialize server socket */
|
||||||
if ((ss = backend_server_socket(h)) < 0)
|
if ((ss = backend_server_socket(h)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (clicon_socket_set(h, ss) < 0)
|
|
||||||
goto done;
|
|
||||||
if (debug)
|
if (debug)
|
||||||
clicon_option_dump(h, debug);
|
clicon_option_dump(h, debug);
|
||||||
|
|
||||||
|
|
@ -952,6 +945,8 @@ main(int argc,
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
clicon_log(LOG_NOTICE, "%s: %u Terminated retval:%d", __PROGRAM__, getpid(), retval);
|
clicon_log(LOG_NOTICE, "%s: %u Terminated retval:%d", __PROGRAM__, getpid(), retval);
|
||||||
|
if (ss != -1)
|
||||||
|
close(ss);
|
||||||
backend_terminate(h); /* Cannot use h after this */
|
backend_terminate(h); /* Cannot use h after this */
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ struct cli_handle {
|
||||||
/* ------ end of common handle ------ */
|
/* ------ end of common handle ------ */
|
||||||
|
|
||||||
cligen_handle cl_cligen; /* cligen handle */
|
cligen_handle cl_cligen; /* cligen handle */
|
||||||
cli_syntax_t *cl_stx; /* CLI syntax structure */
|
cli_syntax_t *cl_stx; /* syntax structure */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! Return a clicon handle for other CLICON API calls
|
/*! Return a clicon handle for other CLICON API calls
|
||||||
|
|
|
||||||
|
|
@ -71,12 +71,11 @@
|
||||||
#include "cli_handle.h"
|
#include "cli_handle.h"
|
||||||
|
|
||||||
/* Command line options to be passed to getopt(3) */
|
/* Command line options to be passed to getopt(3) */
|
||||||
#define CLI_OPTS "hD:f:l:F:1a:u:d:m:qp:GLy:c:U:o:"
|
#define CLI_OPTS "hD:f:xl:F:1a:u:d:m:qp:GLy:c:U:o:"
|
||||||
|
|
||||||
/*! Clean and close all state of cli process (but dont exit).
|
#define CLI_LOGFILE "/tmp/clixon_cli.log"
|
||||||
* Cannot use h after this
|
|
||||||
* @param[in] h Clixon handle
|
/*! terminate cli application */
|
||||||
*/
|
|
||||||
static int
|
static int
|
||||||
cli_terminate(clicon_handle h)
|
cli_terminate(clicon_handle h)
|
||||||
{
|
{
|
||||||
|
|
@ -145,6 +144,63 @@ cli_interactive(clicon_handle h)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Read file as configuration file and print xml file for migrating to new fmt
|
||||||
|
* @see clicon_option_readfile_xml
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
dump_configfile_xml_fn(FILE *fout,
|
||||||
|
const char *filename)
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
char opt[1024];
|
||||||
|
char val[1024];
|
||||||
|
char line[1024];
|
||||||
|
char *cp;
|
||||||
|
FILE *f = NULL;
|
||||||
|
int retval = -1;
|
||||||
|
char *suffix;
|
||||||
|
|
||||||
|
if (filename == NULL || !strlen(filename)){
|
||||||
|
clicon_err(OE_UNIX, 0, "Not specified");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if ((suffix = rindex(filename, '.')) != NULL &&
|
||||||
|
strcmp((suffix+1), "xml") == 0){
|
||||||
|
clicon_err(OE_CFG, 0, "Configfile %s should not be XML", filename);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if (stat(filename, &st) < 0){
|
||||||
|
clicon_err(OE_UNIX, errno, "%s", filename);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if (!S_ISREG(st.st_mode)){
|
||||||
|
clicon_err(OE_UNIX, 0, "%s is not a regular file", filename);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if ((f = fopen(filename, "r")) == NULL) {
|
||||||
|
clicon_err(OE_UNIX, errno, "configure file: %s", filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
clicon_debug(2, "%s: Reading config file %s", __FUNCTION__, filename);
|
||||||
|
fprintf(fout, "<config>\n");
|
||||||
|
while (fgets(line, sizeof(line), f)) {
|
||||||
|
if ((cp = strchr(line, '\n')) != NULL) /* strip last \n */
|
||||||
|
*cp = '\0';
|
||||||
|
/* Trim out comments, strip whitespace, and remove CR */
|
||||||
|
if ((cp = strchr(line, '#')) != NULL)
|
||||||
|
memcpy(cp, "\n", 2);
|
||||||
|
if (sscanf(line, "%s %s", opt, val) < 2)
|
||||||
|
continue;
|
||||||
|
fprintf(fout, "\t<%s>%s</%s>\n", opt, val, opt);
|
||||||
|
}
|
||||||
|
fprintf(fout, "</config>\n");
|
||||||
|
retval = 0;
|
||||||
|
done:
|
||||||
|
if (f)
|
||||||
|
fclose(f);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage(clicon_handle h,
|
usage(clicon_handle h,
|
||||||
char *argv0)
|
char *argv0)
|
||||||
|
|
@ -157,6 +213,7 @@ usage(clicon_handle h,
|
||||||
"\t-h \t\tHelp\n"
|
"\t-h \t\tHelp\n"
|
||||||
"\t-D <level> \tDebug level\n"
|
"\t-D <level> \tDebug level\n"
|
||||||
"\t-f <file> \tConfig-file (mandatory)\n"
|
"\t-f <file> \tConfig-file (mandatory)\n"
|
||||||
|
"\t-x\t\tDump configuration file as XML on stdout (migration utility)\n"
|
||||||
"\t-F <file> \tRead commands from file (default stdin)\n"
|
"\t-F <file> \tRead commands from file (default stdin)\n"
|
||||||
"\t-1\t\tDo not enter interactive mode\n"
|
"\t-1\t\tDo not enter interactive mode\n"
|
||||||
"\t-a UNIX|IPv4|IPv6\tInternal backend socket family\n"
|
"\t-a UNIX|IPv4|IPv6\tInternal backend socket family\n"
|
||||||
|
|
@ -194,6 +251,7 @@ main(int argc, char **argv)
|
||||||
int help = 0;
|
int help = 0;
|
||||||
int logdst = CLICON_LOG_STDERR;
|
int logdst = CLICON_LOG_STDERR;
|
||||||
char *restarg = NULL; /* what remains after options */
|
char *restarg = NULL; /* what remains after options */
|
||||||
|
int dump_configfile_xml = 0;
|
||||||
yang_spec *yspec;
|
yang_spec *yspec;
|
||||||
yang_spec *yspecfg = NULL; /* For config XXX clixon bug */
|
yang_spec *yspecfg = NULL; /* For config XXX clixon bug */
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
@ -207,7 +265,6 @@ main(int argc, char **argv)
|
||||||
/* Initiate CLICON handle */
|
/* Initiate CLICON handle */
|
||||||
if ((h = cli_handle_init()) == NULL)
|
if ((h = cli_handle_init()) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* Set username to clicon handle. Use in all communication to backend
|
/* Set username to clicon handle. Use in all communication to backend
|
||||||
* Note, can be overridden by -U
|
* Note, can be overridden by -U
|
||||||
*/
|
*/
|
||||||
|
|
@ -244,6 +301,9 @@ main(int argc, char **argv)
|
||||||
usage(h, argv[0]);
|
usage(h, argv[0]);
|
||||||
clicon_option_str_set(h, "CLICON_CONFIGFILE", optarg);
|
clicon_option_str_set(h, "CLICON_CONFIGFILE", optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'x': /* dump config file as xml (migration from .conf file)*/
|
||||||
|
dump_configfile_xml++;
|
||||||
|
break;
|
||||||
case 'l': /* Log destination: s|e|o|f */
|
case 'l': /* Log destination: s|e|o|f */
|
||||||
if ((logdst = clicon_log_opt(optarg[0])) < 0)
|
if ((logdst = clicon_log_opt(optarg[0])) < 0)
|
||||||
usage(h, argv[0]);
|
usage(h, argv[0]);
|
||||||
|
|
@ -260,6 +320,14 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
clicon_debug_init(debug, NULL);
|
clicon_debug_init(debug, NULL);
|
||||||
|
|
||||||
|
/* Use cli as util tool to dump config file as xml for migration */
|
||||||
|
if (dump_configfile_xml) {
|
||||||
|
clicon_hash_t *copt = clicon_options(h);
|
||||||
|
char *configfile = hash_value(copt, "CLICON_CONFIGFILE", NULL);
|
||||||
|
if (dump_configfile_xml_fn(stdout, configfile) < 0)
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create top-level yang spec and store as option */
|
/* Create top-level yang spec and store as option */
|
||||||
if ((yspecfg = yspec_new()) == NULL)
|
if ((yspecfg = yspec_new()) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -277,6 +345,7 @@ main(int argc, char **argv)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'D' : /* debug */
|
case 'D' : /* debug */
|
||||||
case 'f': /* config file */
|
case 'f': /* config file */
|
||||||
|
case 'x': /* dump config file as xml */
|
||||||
case 'l': /* Log destination */
|
case 'l': /* Log destination */
|
||||||
break; /* see above */
|
break; /* see above */
|
||||||
case 'F': /* read commands from file */
|
case 'F': /* read commands from file */
|
||||||
|
|
|
||||||
|
|
@ -283,10 +283,6 @@ send_hello(clicon_handle h,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Clean and close all state of netconf process (but dont exit).
|
|
||||||
* Cannot use h after this
|
|
||||||
* @param[in] h Clixon handle
|
|
||||||
*/
|
|
||||||
static int
|
static int
|
||||||
netconf_terminate(clicon_handle h)
|
netconf_terminate(clicon_handle h)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -471,20 +471,12 @@ api_return_err(clicon_handle h,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Clean and close all state of restconf process (but dont exit).
|
|
||||||
* Cannot use h after this
|
|
||||||
* @param[in] h Clixon handle
|
|
||||||
*/
|
|
||||||
int
|
int
|
||||||
restconf_terminate(clicon_handle h)
|
restconf_terminate(clicon_handle h)
|
||||||
{
|
{
|
||||||
yang_spec *yspec;
|
yang_spec *yspec;
|
||||||
cxobj *x;
|
cxobj *x;
|
||||||
int fs; /* fgcx socket */
|
|
||||||
|
|
||||||
clicon_debug(1, "%s", __FUNCTION__);
|
|
||||||
if ((fs = clicon_socket_get(h)) != -1)
|
|
||||||
close(fs);
|
|
||||||
clixon_plugin_exit(h);
|
clixon_plugin_exit(h);
|
||||||
rpc_callback_delete_all();
|
rpc_callback_delete_all();
|
||||||
clicon_rpc_close_session(h);
|
clicon_rpc_close_session(h);
|
||||||
|
|
@ -498,4 +490,3 @@ restconf_terminate(clicon_handle h)
|
||||||
clicon_log_exit();
|
clicon_log_exit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -694,8 +694,6 @@ main(int argc,
|
||||||
clicon_err(OE_CFG, errno, "FCGX_OpenSocket");
|
clicon_err(OE_CFG, errno, "FCGX_OpenSocket");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (clicon_socket_set(h, sock) < 0)
|
|
||||||
goto done;
|
|
||||||
/* umask settings may interfer: we want group to write: this is 774 */
|
/* umask settings may interfer: we want group to write: this is 774 */
|
||||||
if (chmod(sockpath, S_IRWXU|S_IRWXG|S_IROTH) < 0){
|
if (chmod(sockpath, S_IRWXU|S_IRWXG|S_IROTH) < 0){
|
||||||
clicon_err(OE_UNIX, errno, "chmod");
|
clicon_err(OE_UNIX, errno, "chmod");
|
||||||
|
|
|
||||||
|
|
@ -44,38 +44,23 @@ SUBDIRS = base
|
||||||
SUBDIRS += system
|
SUBDIRS += system
|
||||||
#SUBDIRS += cluster
|
#SUBDIRS += cluster
|
||||||
|
|
||||||
.PHONY: all clean distclean depend install-include install uninstall test $(SUBDIRS)
|
.PHONY: all clean distclean depend install-include install uninstall test
|
||||||
|
|
||||||
all: $(SUBDIRS)
|
all: $(SUBDIRS)
|
||||||
|
|
||||||
$(SUBDIRS):
|
|
||||||
(cd $@; $(MAKE) $(MFLAGS) all)
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
for i in $(SUBDIRS); \
|
|
||||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f Makefile *~ .depend
|
rm -f Makefile *~ .depend
|
||||||
for i in $(SUBDIRS); \
|
|
||||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
for i in $(SUBDIRS); \
|
(cd system && $(MAKE) $(MFLAGS) test)
|
||||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
for i in $(SUBDIRS); \
|
|
||||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
|
||||||
|
|
||||||
install-include:
|
install-include:
|
||||||
for i in $(SUBDIRS); \
|
|
||||||
do (cd $$i && $(MAKE) $(MFLAGS) $@||exit 1); done;
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
for i in $(SUBDIRS); \
|
|
||||||
do (cd $$i && $(MAKE) $(MFLAGS) $@)||exit 1; done
|
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
for i in $(SUBDIRS); \
|
|
||||||
do (cd $$i; $(MAKE) $(MFLAGS) $@)||exit 1; done
|
|
||||||
|
|
|
||||||
|
|
@ -198,8 +198,4 @@ int clicon_xmldb_handle_set(clicon_handle h, void *xh);
|
||||||
char *clicon_username_get(clicon_handle h);
|
char *clicon_username_get(clicon_handle h);
|
||||||
int clicon_username_set(clicon_handle h, void *username);
|
int clicon_username_set(clicon_handle h, void *username);
|
||||||
|
|
||||||
/* Set and get socket fd (ie backend server socket / restconf fcgx socket */
|
|
||||||
int clicon_socket_get(clicon_handle h);
|
|
||||||
int clicon_socket_set(clicon_handle h, int s);
|
|
||||||
|
|
||||||
#endif /* _CLIXON_OPTIONS_H_ */
|
#endif /* _CLIXON_OPTIONS_H_ */
|
||||||
|
|
|
||||||
|
|
@ -66,17 +66,6 @@
|
||||||
* @note If you change here, you must also change the structs below:
|
* @note If you change here, you must also change the structs below:
|
||||||
* @see struct cli_handle
|
* @see struct cli_handle
|
||||||
* @see struct backend_handle
|
* @see struct backend_handle
|
||||||
* This is the internal definition of a "Clixon handle" which in its external
|
|
||||||
* form is "clicon_handle" and is used in most Clixon API calls.
|
|
||||||
* Some details:
|
|
||||||
* 1) the internal structure contains a header (defined here) whereas higher
|
|
||||||
* order libs (eg cli and backend) introduce more fields appended to this
|
|
||||||
* struct.
|
|
||||||
* 2) ch_options accessed via clicon_data() are clixon config options are
|
|
||||||
* string values appearing in the XML configfile accessed with -f.
|
|
||||||
* Alternatively, these could be accessed via clicon_conf_xml()
|
|
||||||
* 3) ch_data accessed via clicon_data() is more general purpose for any data.
|
|
||||||
* that is, not only strings. And has separate namespace from options.
|
|
||||||
*/
|
*/
|
||||||
struct clicon_handle {
|
struct clicon_handle {
|
||||||
int ch_magic; /* magic (HDR) */
|
int ch_magic; /* magic (HDR) */
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ hash_value(clicon_hash_t *hash,
|
||||||
*
|
*
|
||||||
* @param[in] hash Hash table
|
* @param[in] hash Hash table
|
||||||
* @param[in] key Variable name
|
* @param[in] key Variable name
|
||||||
* @param[in] val Variable value (pointer to)
|
* @param[in] val Variable value
|
||||||
* @param[in] vlen Length of variable value
|
* @param[in] vlen Length of variable value
|
||||||
* @retval variable New hash structure on success
|
* @retval variable New hash structure on success
|
||||||
* @retval NULL Failure
|
* @retval NULL Failure
|
||||||
|
|
|
||||||
|
|
@ -224,6 +224,7 @@ json_str_escape_cdata(cbuf *cb,
|
||||||
char *str)
|
char *str)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
char *snew = NULL;
|
||||||
int i;
|
int i;
|
||||||
int esc = 0; /* cdata escape */
|
int esc = 0; /* cdata escape */
|
||||||
|
|
||||||
|
|
@ -260,8 +261,12 @@ json_str_escape_cdata(cbuf *cb,
|
||||||
cprintf(cb, "%c", str[i]);
|
cprintf(cb, "%c", str[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if ((snew = strdup(cbuf_get(cb))) ==NULL){
|
||||||
|
clicon_err(OE_XML, errno, "strdup");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
retval = 0;
|
retval = 0;
|
||||||
// done:
|
done:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,7 @@
|
||||||
***** END LICENSE BLOCK *****
|
***** END LICENSE BLOCK *****
|
||||||
|
|
||||||
*
|
*
|
||||||
* This file contains access functions for two types of clixon vars:
|
* CLICON options
|
||||||
* - options, ie string based variables from Clixon configuration files.
|
|
||||||
* Accessed with clicon_options(h).
|
|
||||||
* - data. Free-typed values for runtime getting and setting.
|
|
||||||
* Accessed with clicon_data(h).
|
|
||||||
* Consider splitting?
|
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "clixon_config.h" /* generated by config & autoconf */
|
#include "clixon_config.h" /* generated by config & autoconf */
|
||||||
|
|
@ -364,8 +359,6 @@ clicon_option_str(clicon_handle h,
|
||||||
* @param[in] h clicon_handle
|
* @param[in] h clicon_handle
|
||||||
* @param[in] name option name
|
* @param[in] name option name
|
||||||
* @param[in] val option value, must be null-terminated string
|
* @param[in] val option value, must be null-terminated string
|
||||||
* @retval 0 OK
|
|
||||||
* @retval -1 Error
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
clicon_option_str_set(clicon_handle h,
|
clicon_option_str_set(clicon_handle h,
|
||||||
|
|
@ -890,35 +883,3 @@ clicon_username_set(clicon_handle h,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! Get socket fd (ie backend server socket / restconf fcgx socket)
|
|
||||||
* @param[in] h Clicon handle
|
|
||||||
* @retval -1 No open socket
|
|
||||||
* @retval s Socket
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
clicon_socket_get(clicon_handle h)
|
|
||||||
{
|
|
||||||
clicon_hash_t *cdat = clicon_data(h);
|
|
||||||
void *p;
|
|
||||||
|
|
||||||
if ((p = hash_value(cdat, "socket", NULL)) == NULL)
|
|
||||||
return -1;
|
|
||||||
return *(int*)p;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Set socket fd (ie backend server socket / restconf fcgx socket)
|
|
||||||
* @param[in] h Clicon handle
|
|
||||||
* @param[in] s Open socket (or -1 to close)
|
|
||||||
* @retval 0 OK
|
|
||||||
* @retval -1 Error
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
clicon_socket_set(clicon_handle h,
|
|
||||||
int s)
|
|
||||||
{
|
|
||||||
clicon_hash_t *cdat = clicon_data(h);
|
|
||||||
|
|
||||||
if (s == -1)
|
|
||||||
return hash_del(cdat, "socket");
|
|
||||||
return hash_add(cdat, "socket", &s, sizeof(int))==NULL?-1:0;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ These tests use valgrind to check for memory leaks:
|
||||||
mem.sh cli
|
mem.sh cli
|
||||||
mem.sh netconf
|
mem.sh netconf
|
||||||
mem.sh backend
|
mem.sh backend
|
||||||
mem.sh restconf
|
# mem.sh restconf # NYI
|
||||||
```
|
```
|
||||||
|
|
||||||
## Site.sh
|
## Site.sh
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
supp1
|
supp2
|
||||||
Memcheck:Leak
|
Memcheck:Leak
|
||||||
match-leak-kinds: reachable
|
match-leak-kinds: reachable
|
||||||
fun:*
|
fun:*
|
||||||
fun:_dl_new_object
|
fun:_dl_new_object
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
supp2
|
supp3
|
||||||
Memcheck:Leak
|
Memcheck:Leak
|
||||||
match-leak-kinds: reachable
|
match-leak-kinds: reachable
|
||||||
fun:*
|
fun:*
|
||||||
|
|
@ -14,31 +14,16 @@
|
||||||
fun:expand_dynamic_string_token
|
fun:expand_dynamic_string_token
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
supp3
|
supp44
|
||||||
Memcheck:Leak
|
Memcheck:Leak
|
||||||
match-leak-kinds: reachable
|
match-leak-kinds: reachable
|
||||||
fun:*
|
fun:*
|
||||||
fun:_dlerror_run
|
fun:_dlerror_run
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
supp4
|
supp5
|
||||||
Memcheck:Leak
|
Memcheck:Leak
|
||||||
match-leak-kinds: reachable
|
match-leak-kinds: reachable
|
||||||
fun:*
|
fun:*
|
||||||
fun:_dl_check_map_versions
|
fun:_dl_check_map_versions
|
||||||
}
|
}
|
||||||
{
|
|
||||||
supp5
|
|
||||||
Memcheck:Leak
|
|
||||||
match-leak-kinds: reachable
|
|
||||||
fun:*
|
|
||||||
fun:*
|
|
||||||
fun:_dl_map_object
|
|
||||||
}
|
|
||||||
{
|
|
||||||
supp6-fcgi
|
|
||||||
Memcheck:Leak
|
|
||||||
match-leak-kinds: reachable
|
|
||||||
fun:*
|
|
||||||
fun:OS_LibInit
|
|
||||||
}
|
|
||||||
25
test/lib.sh
25
test/lib.sh
|
|
@ -52,9 +52,8 @@ testname=
|
||||||
#
|
#
|
||||||
: ${valgrindtest=0}
|
: ${valgrindtest=0}
|
||||||
|
|
||||||
# Valgrind log file. This should be removed automatically. Note that mktemp
|
# Valgrind log file. This is usually removed automatically
|
||||||
# actually creates a file so do not call it by default
|
: ${valgrindfile=$(mktemp)}
|
||||||
#: ${valgrindfile=$(mktemp)}
|
|
||||||
|
|
||||||
# If set to 0, override starting of clixon_backend in test (you bring your own)
|
# If set to 0, override starting of clixon_backend in test (you bring your own)
|
||||||
: ${BE:=1}
|
: ${BE:=1}
|
||||||
|
|
@ -136,9 +135,9 @@ start_backend(){
|
||||||
if [ $valgrindtest -eq 2 ]; then
|
if [ $valgrindtest -eq 2 ]; then
|
||||||
# Start in background since daemon version creates two traces: parent,
|
# Start in background since daemon version creates two traces: parent,
|
||||||
# child. If background then only the single relevant.
|
# child. If background then only the single relevant.
|
||||||
sudo $clixon_backend -F -D $DBG $* &
|
sudo $clixon_backend -F $* -D $DBG &
|
||||||
else
|
else
|
||||||
sudo $clixon_backend -D $DBG $*
|
sudo $clixon_backend $* -D $DBG
|
||||||
fi
|
fi
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
|
|
@ -156,22 +155,6 @@ stop_backend(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
start_restconf(){
|
|
||||||
# Start in background
|
|
||||||
sudo su -c "$clixon_restconf $RCLOG -D $DBG $*" -s /bin/sh www-data &
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
err
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_restconf(){
|
|
||||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
|
||||||
if [ $valgrindtest -eq 3 ]; then
|
|
||||||
sleep 1
|
|
||||||
checkvalgrind
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Increment test number and print a nice string
|
# Increment test number and print a nice string
|
||||||
new(){
|
new(){
|
||||||
if [ $valgrindtest -eq 1 ]; then
|
if [ $valgrindtest -eq 1 ]; then
|
||||||
|
|
|
||||||
15
test/mem.sh
15
test/mem.sh
|
|
@ -15,12 +15,12 @@ case "$PROGRAM" in
|
||||||
'cli')
|
'cli')
|
||||||
valgrindtest=1
|
valgrindtest=1
|
||||||
RCWAIT=1
|
RCWAIT=1
|
||||||
clixon_cli="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_cli"
|
clixon_cli="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./clixon.supp --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_cli"
|
||||||
;;
|
;;
|
||||||
'netconf')
|
'netconf')
|
||||||
valgrindtest=1
|
valgrindtest=1
|
||||||
RCWAIT=1
|
RCWAIT=1
|
||||||
clixon_netconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_netconf"
|
clixon_netconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./clixon.supp --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_netconf"
|
||||||
;;
|
;;
|
||||||
'backend')
|
'backend')
|
||||||
valgrindtest=2 # This means backend valgrind test
|
valgrindtest=2 # This means backend valgrind test
|
||||||
|
|
@ -28,19 +28,10 @@ case "$PROGRAM" in
|
||||||
perfnr=100 # test_perf.sh restconf put more or less stops
|
perfnr=100 # test_perf.sh restconf put more or less stops
|
||||||
perfreq=10
|
perfreq=10
|
||||||
|
|
||||||
clixon_backend="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=yes --log-file=$valgrindfile clixon_backend"
|
clixon_backend="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./clixon.supp --track-fds=yes --trace-children=yes --log-file=$valgrindfile clixon_backend"
|
||||||
;;
|
|
||||||
'restconf')
|
|
||||||
valgrindtest=3 # This means backend valgrind test
|
|
||||||
sudo chmod 660 $valgrindfile
|
|
||||||
sudo chown www-data $valgrindfile
|
|
||||||
RCWAIT=5 # valgrind restconf needs some time to get up
|
|
||||||
clixon_restconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile /www-data/clixon_restconf"
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage: $0 cli|netconf|restconf|backend" # valgrind memleak checks
|
echo "usage: $0 cli|netconf|restconf|backend" # valgrind memleak checks
|
||||||
rm -f $valgrindfile
|
|
||||||
exit -1
|
exit -1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data clixon_restconf
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
start_restconf -f $cfg -y $fyang
|
sudo su -c "$clixon_restconf -f $RCLOG $cfg -y $fyang -D $DBG" -s /bin/sh www-data &
|
||||||
|
|
||||||
new "waiting"
|
new "waiting"
|
||||||
sleep $RCWAIT
|
sleep $RCWAIT
|
||||||
|
|
@ -194,7 +194,7 @@ new "netconf validate mandatory"
|
||||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
new "start restconf daemon (-a is enable basic authentication)"
|
new "start restconf daemon (-a is enable basic authentication)"
|
||||||
start_restconf -f $cfg -- -a
|
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
|
||||||
|
|
||||||
new "waiting"
|
new "waiting"
|
||||||
sleep $RCWAIT
|
sleep $RCWAIT
|
||||||
|
|
@ -178,7 +178,7 @@ new "guest edit nacm"
|
||||||
expecteq "$(curl -u guest:bar -sS -X PUT -d '{"nacm-example:x": 3}' http://localhost/restconf/data/nacm-example:x)" 0 '{"ietf-restconf:errors" : {"error": {"error-type": "application","error-tag": "access-denied","error-severity": "error","error-message": "access denied"}}}
'
|
expecteq "$(curl -u guest:bar -sS -X PUT -d '{"nacm-example:x": 3}' http://localhost/restconf/data/nacm-example:x)" 0 '{"ietf-restconf:errors" : {"error": {"error-type": "application","error-tag": "access-denied","error-severity": "error","error-message": "access denied"}}}
'
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "start restconf daemon (-a is enable http basic auth)"
|
new "start restconf daemon (-a is enable http basic auth)"
|
||||||
start_restconf -f $cfg -- -a
|
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
|
||||||
|
|
||||||
new "waiting"
|
new "waiting"
|
||||||
sleep $RCWAIT
|
sleep $RCWAIT
|
||||||
|
|
@ -207,7 +207,7 @@ new "cli rpc as guest"
|
||||||
expectfn "$clixon_cli -1 -U guest -l o -f $cfg rpc ipv4" 255 "protocol access-denied access denied"
|
expectfn "$clixon_cli -1 -U guest -l o -f $cfg rpc ipv4" 255 "protocol access-denied access denied"
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
new "start restconf daemon (-a is enable basic authentication)"
|
new "start restconf daemon (-a is enable basic authentication)"
|
||||||
start_restconf -f $cfg -- -a
|
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
|
||||||
|
|
||||||
new "waiting"
|
new "waiting"
|
||||||
sleep $RCWAIT
|
sleep $RCWAIT
|
||||||
|
|
@ -272,8 +272,7 @@ expecteq "$(curl -u guest:bar -sS -X GET http://localhost/restconf/data/clixon-e
|
||||||
|
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
new "start restconf daemon (-a is enable basic authentication)"
|
new "start restconf daemon (-a is enable basic authentication)"
|
||||||
start_restconf -f $cfg -- -a
|
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
|
||||||
|
|
||||||
new "waiting"
|
new "waiting"
|
||||||
sleep $RCWAIT
|
sleep $RCWAIT
|
||||||
|
|
@ -254,7 +254,7 @@ new "default delete list deny"
|
||||||
expecteq "$(curl -u wilma:bar -sS -X DELETE http://localhost/restconf/data/clixon-example:translate=key42)" 0 '{"ietf-restconf:errors" : {"error": {"error-type": "application","error-tag": "access-denied","error-severity": "error","error-message": "default deny"}}}
'
|
expecteq "$(curl -u wilma:bar -sS -X DELETE http://localhost/restconf/data/clixon-example:translate=key42)" 0 '{"ietf-restconf:errors" : {"error": {"error-type": "application","error-tag": "access-denied","error-severity": "error","error-message": "default deny"}}}
'
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
new "start restconf daemon (-a is enable basic authentication)"
|
new "start restconf daemon (-a is enable basic authentication)"
|
||||||
start_restconf -f $cfg -- -a
|
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
|
||||||
|
|
||||||
new "waiting"
|
new "waiting"
|
||||||
sleep $RCWAIT
|
sleep $RCWAIT
|
||||||
|
|
@ -216,7 +216,7 @@ new "permit-edit-config: guest fail restconf"
|
||||||
expecteq "$(curl -u guest:bar -sS -X PUT -d '{"nacm-example:x": 2}' http://localhost/restconf/data/nacm-example:x)" 0 '{"ietf-restconf:errors" : {"error": {"error-type": "application","error-tag": "access-denied","error-severity": "error","error-message": "default deny"}}}
'
|
expecteq "$(curl -u guest:bar -sS -X PUT -d '{"nacm-example:x": 2}' http://localhost/restconf/data/nacm-example:x)" 0 '{"ietf-restconf:errors" : {"error": {"error-type": "application","error-tag": "access-denied","error-severity": "error","error-message": "default deny"}}}
'
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
start_restconf -f $cfg -y $fyang
|
sudo su -c "$clixon_restconf -f $cfg -y $fyang $RCLOG -D $DBG" -s /bin/sh www-data &
|
||||||
|
|
||||||
new "waiting"
|
new "waiting"
|
||||||
sleep $RCWAIT
|
sleep $RCWAIT
|
||||||
|
|
@ -169,7 +169,7 @@ new "netconf get large leaf-list config"
|
||||||
expecteof "/usr/bin/time -f %e $clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>" '^<rpc-reply><data><x xmlns="urn:example:clixon"><c>0</c><c>1</c>'
|
expecteof "/usr/bin/time -f %e $clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>" '^<rpc-reply><data><x xmlns="urn:example:clixon"><c>0</c><c>1</c>'
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data clixon_restconf
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
start_restconf -f $cfg
|
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG" -s /bin/sh www-data &
|
||||||
|
|
||||||
new "waiting"
|
new "waiting"
|
||||||
sleep $RCWAIT
|
sleep $RCWAIT
|
||||||
|
|
@ -265,7 +265,7 @@ if [ -z "$match" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
start_restconf -f $cfg -y $fyang
|
sudo su -c "$clixon_restconf -f $cfg -y $fyang $RCLOG -D $DBG" -s /bin/sh www-data &
|
||||||
|
|
||||||
new "waiting"
|
new "waiting"
|
||||||
sleep $RCWAIT
|
sleep $RCWAIT
|
||||||
|
|
@ -182,7 +182,7 @@ new "restconf POST type x3"
|
||||||
expectfn 'curl -s -X GET http://localhost/restconf/data/example:types' 0 '{"example:types": {"tint": 42,"tdec64": 42.123,"tbool": false,"tstr": "str"}}'
|
expectfn 'curl -s -X GET http://localhost/restconf/data/example:types' 0 '{"example:types": {"tint": 42,"tdec64": 42.123,"tbool": false,"tstr": "str"}}'
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data clixon_restconf
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
start_restconf -f $cfg
|
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG" -s /bin/sh www-data &
|
||||||
|
|
||||||
new "waiting"
|
new "waiting"
|
||||||
sleep $RCWAIT
|
sleep $RCWAIT
|
||||||
|
|
@ -149,7 +149,7 @@ new "netconf edit-config missing config should fail"
|
||||||
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><target><candidate/></target></edit-config></rpc>]]>]]>' '^<rpc-reply><rpc-error><error-type>application</error-type><error-tag>data-missing</error-tag><error-app-tag>missing-choice</error-app-tag><error-info><missing-choice>edit-content</missing-choice></error-info><error-severity>error</error-severity></rpc-error></rpc-reply>]]>]]>$'
|
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><target><candidate/></target></edit-config></rpc>]]>]]>' '^<rpc-reply><rpc-error><error-type>application</error-type><error-tag>data-missing</error-tag><error-app-tag>missing-choice</error-app-tag><error-info><missing-choice>edit-content</missing-choice></error-info><error-severity>error</error-severity></rpc-error></rpc-reply>]]>]]>$'
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
start_restconf -f $cfg -y $fyang
|
sudo su -c "$clixon_restconf -f $cfg -y $fyang $RCLOG -D $DBG" -s /bin/sh www-data &
|
||||||
|
|
||||||
new "waiting"
|
new "waiting"
|
||||||
sleep $RCWAIT
|
sleep $RCWAIT
|
||||||
|
|
@ -274,7 +274,7 @@ echo "Eg: curl -H \"Accept: text/event-stream\" -s -X GET http://localhost/sub/E
|
||||||
#-----------------
|
#-----------------
|
||||||
sleep 5
|
sleep 5
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
|
|
@ -82,10 +82,7 @@ new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data clixon_restconf
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
start_restconf -f $cfg
|
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG" -s /bin/sh www-data &
|
||||||
|
|
||||||
new "waiting"
|
|
||||||
sleep $RCWAIT
|
|
||||||
|
|
||||||
new "netconf set x in example1"
|
new "netconf set x in example1"
|
||||||
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config><target><candidate/></target><config><x xmlns="urn:example:clixon1">42</x></config></edit-config></rpc>]]>]]>' '^<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply>]]>]]>$'
|
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config><target><candidate/></target><config><x xmlns="urn:example:clixon1">42</x></config></edit-config></rpc>]]>]]>' '^<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply>]]>]]>$'
|
||||||
|
|
@ -131,7 +128,7 @@ if [ -z "$match" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -eq 0 ]; then
|
||||||
exit # BE
|
exit # BE
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue