Merge branch 'master' of https://github.com/clicon/clixon
This commit is contained in:
commit
3dd67474e0
23 changed files with 119 additions and 50 deletions
|
|
@ -27,8 +27,11 @@
|
||||||
|
|
||||||
### Minor changes
|
### Minor changes
|
||||||
* Added specific clixon_suberrno code: XMLPARSE_ERRNO to identify XML parse errors.
|
* Added specific clixon_suberrno code: XMLPARSE_ERRNO to identify XML parse errors.
|
||||||
|
* Removed all dependency on strverscmp
|
||||||
|
* Added libgen.h for baseline()
|
||||||
|
|
||||||
### Corrected Bugs
|
### Corrected Bugs
|
||||||
|
* There was a problem with ordered-by-user for XML children that appeared in some circumstances and difficult to trigger. Entries entered by the user did not appear in the order they were entered. This should now be fixed.
|
||||||
|
|
||||||
## 3.9.0 (21 Feb 2019)
|
## 3.9.0 (21 Feb 2019)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define __USE_GNU /* strverscmp */
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ucred.h>
|
#include <sys/ucred.h>
|
||||||
#endif
|
#endif
|
||||||
#define __USE_GNU
|
#define __USE_GNU /* for ucred */
|
||||||
#define _GNU_SOURCE /* for ucred */
|
#define _GNU_SOURCE /* for ucred */
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define __USE_GNU /* strverscmp */
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
|
||||||
2
configure
vendored
2
configure
vendored
|
|
@ -4417,7 +4417,7 @@ _ACEOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
for ac_func in inet_aton sigaction sigvec strlcpy strsep strndup alphasort versionsort strverscmp
|
for ac_func in inet_aton sigaction sigvec strlcpy strsep strndup alphasort versionsort
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ AC_CHECK_LIB(socket, socket)
|
||||||
AC_CHECK_LIB(nsl, xdr_char)
|
AC_CHECK_LIB(nsl, xdr_char)
|
||||||
AC_CHECK_LIB(dl, dlopen)
|
AC_CHECK_LIB(dl, dlopen)
|
||||||
|
|
||||||
AC_CHECK_FUNCS(inet_aton sigaction sigvec strlcpy strsep strndup alphasort versionsort strverscmp)
|
AC_CHECK_FUNCS(inet_aton sigaction sigvec strlcpy strsep strndup alphasort versionsort)
|
||||||
|
|
||||||
# CLIXON_DATADIR is where clixon installs the "system" yang files in yang/Makfile
|
# CLIXON_DATADIR is where clixon installs the "system" yang files in yang/Makfile
|
||||||
# This directory should most probably be included in each application,
|
# This directory should most probably be included in each application,
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,14 @@ server {
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# This is a clixon site test file. Disable all model testing.
|
# This is a clixon site test file.
|
||||||
|
# Add to skiplist:
|
||||||
|
# - all 3rd party model testing (you need to download the repos)
|
||||||
|
# - test_install.sh since you dont have the make environment
|
||||||
|
# - test_order.sh XXX this is a bug need debugging
|
||||||
cat <<EOF > /usr/local/bin/test/site.sh
|
cat <<EOF > /usr/local/bin/test/site.sh
|
||||||
# Add your local site specific env variables (or tests) here.
|
# Add your local site specific env variables (or tests) here.
|
||||||
SKIPLIST="test_yangmodels.sh test_openconfig.sh test_install.sh test_order.sh"
|
SKIPLIST="test_yangmodels.sh test_openconfig.sh test_install.sh"
|
||||||
#IETFRFC=
|
#IETFRFC=
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,9 +90,6 @@
|
||||||
/* Define to 1 if you have the `strsep' function. */
|
/* Define to 1 if you have the `strsep' function. */
|
||||||
#undef HAVE_STRSEP
|
#undef HAVE_STRSEP
|
||||||
|
|
||||||
/* Define to 1 if you have the `strverscmp' function. */
|
|
||||||
#undef HAVE_STRVERSCMP
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
#undef HAVE_SYS_STAT_H
|
#undef HAVE_SYS_STAT_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,6 @@
|
||||||
#define strndup(s, n) clicon_strndup(s, n)
|
#define strndup(s, n) clicon_strndup(s, n)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
|
|
||||||
#define BSD
|
|
||||||
/* at least for openbsd 4.5 i cannot get a hdr file */
|
|
||||||
int strverscmp (__const char *__s1, __const char *__s2);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set if you want to assert that all rpc messages have set username
|
/* Set if you want to assert that all rpc messages have set username
|
||||||
*/
|
*/
|
||||||
#undef RPC_USERNAME_ASSERT
|
#undef RPC_USERNAME_ASSERT
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,9 @@ int xml_rm(cxobj *xc);
|
||||||
int xml_rootchild(cxobj *xp, int i, cxobj **xcp);
|
int xml_rootchild(cxobj *xp, int i, cxobj **xcp);
|
||||||
int xml_rootchild_node(cxobj *xp, cxobj *xc);
|
int xml_rootchild_node(cxobj *xp, cxobj *xc);
|
||||||
|
|
||||||
|
int xml_enumerate_children(cxobj *xp);
|
||||||
|
int xml_enumerate_get(cxobj *x);
|
||||||
|
|
||||||
char *xml_body(cxobj *xn);
|
char *xml_body(cxobj *xn);
|
||||||
cxobj *xml_body_get(cxobj *xn);
|
cxobj *xml_body_get(cxobj *xn);
|
||||||
char *xml_find_type_value(cxobj *xn_parent, char *prefix,
|
char *xml_find_type_value(cxobj *xn_parent, char *prefix,
|
||||||
|
|
@ -173,6 +176,7 @@ int cxvec_append(cxobj *x, cxobj ***vec, size_t *len);
|
||||||
int xml_apply(cxobj *xn, enum cxobj_type type, xml_applyfn_t fn, void *arg);
|
int xml_apply(cxobj *xn, enum cxobj_type type, xml_applyfn_t fn, void *arg);
|
||||||
int xml_apply0(cxobj *xn, enum cxobj_type type, xml_applyfn_t fn, void *arg);
|
int xml_apply0(cxobj *xn, enum cxobj_type type, xml_applyfn_t fn, void *arg);
|
||||||
int xml_apply_ancestor(cxobj *xn, xml_applyfn_t fn, void *arg);
|
int xml_apply_ancestor(cxobj *xn, xml_applyfn_t fn, void *arg);
|
||||||
|
int xml_isancestor(cxobj *x, cxobj *xp);
|
||||||
|
|
||||||
int xml_body_parse(cxobj *xb, enum cv_type type, cg_var **cvp);
|
int xml_body_parse(cxobj *xb, enum cv_type type, cg_var **cvp);
|
||||||
int xml_body_int32(cxobj *xb, int32_t *val);
|
int xml_body_int32(cxobj *xb, int32_t *val);
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@ int yang_mandatory(yang_stmt *ys);
|
||||||
int yang_config(yang_stmt *ys);
|
int yang_config(yang_stmt *ys);
|
||||||
int yang_spec_parse_module(clicon_handle h, const char *module,
|
int yang_spec_parse_module(clicon_handle h, const char *module,
|
||||||
const char *revision, yang_spec *yspec);
|
const char *revision, yang_spec *yspec);
|
||||||
int yang_spec_parse_file(clicon_handle h, const char *filename, yang_spec *yspec);
|
int yang_spec_parse_file(clicon_handle h, char *filename, yang_spec *yspec);
|
||||||
int yang_spec_load_dir(clicon_handle h, char *dir, yang_spec *yspec);
|
int yang_spec_load_dir(clicon_handle h, char *dir, yang_spec *yspec);
|
||||||
cvec *yang_arg2cvec(yang_stmt *ys, char *delimi);
|
cvec *yang_arg2cvec(yang_stmt *ys, char *delimi);
|
||||||
int yang_key_match(yang_node *yn, char *name);
|
int yang_key_match(yang_node *yn, char *name);
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ clicon_err_fn(const char *fn,
|
||||||
line,
|
line,
|
||||||
clicon_strerror(category),
|
clicon_strerror(category),
|
||||||
msg,
|
msg,
|
||||||
strerror(suberr));
|
suberr==XMLPARSE_ERRNO?"XML parse error":strerror(suberr));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
clicon_log(LOG_ERR, "%s: %d: %s: %s",
|
clicon_log(LOG_ERR, "%s: %d: %s: %s",
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#define __USE_GNU /* strverscmp */
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
@ -71,11 +70,7 @@ clicon_file_dirent_sort(const void* arg1,
|
||||||
struct dirent *d1 = (struct dirent *)arg1;
|
struct dirent *d1 = (struct dirent *)arg1;
|
||||||
struct dirent *d2 = (struct dirent *)arg2;
|
struct dirent *d2 = (struct dirent *)arg2;
|
||||||
|
|
||||||
#ifdef HAVE_STRVERSCMP
|
|
||||||
return strverscmp(d1->d_name, d2->d_name); /* strverscmp specific GNU function */
|
|
||||||
#else /* HAVE_STRVERSCMP */
|
|
||||||
return strcoll(d1->d_name, d2->d_name);
|
return strcoll(d1->d_name, d2->d_name);
|
||||||
#endif /* HAVE_STRVERSCMP */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Return alphabetically sorted files from a directory matching regexp
|
/*! Return alphabetically sorted files from a directory matching regexp
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ clicon_log_str(int level,
|
||||||
* @code
|
* @code
|
||||||
clicon_log(LOG_NOTICE, "%s: dump to dtd not supported", __PROGRAM__);
|
clicon_log(LOG_NOTICE, "%s: dump to dtd not supported", __PROGRAM__);
|
||||||
* @endcode
|
* @endcode
|
||||||
* @see cicon_log_init and clicon_log_str
|
* @see clicon_log_init and clicon_log_str
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
clicon_log(int level,
|
clicon_log(int level,
|
||||||
|
|
|
||||||
|
|
@ -122,12 +122,14 @@ struct xml{
|
||||||
int x_childvec_len;/* length of vector */
|
int x_childvec_len;/* length of vector */
|
||||||
enum cxobj_type x_type; /* type of node: element, attribute, body */
|
enum cxobj_type x_type; /* type of node: element, attribute, body */
|
||||||
char *x_value; /* attribute and body nodes have values */
|
char *x_value; /* attribute and body nodes have values */
|
||||||
int _x_vector_i; /* internal use: xml_child_each */
|
|
||||||
int x_flags; /* Flags according to XML_FLAG_* */
|
int x_flags; /* Flags according to XML_FLAG_* */
|
||||||
yang_stmt *x_spec; /* Pointer to specification, eg yang, by
|
yang_stmt *x_spec; /* Pointer to specification, eg yang, by
|
||||||
reference, dont free */
|
reference, dont free */
|
||||||
cg_var *x_cv; /* Cached value as cligen variable
|
cg_var *x_cv; /* Cached value as cligen variable
|
||||||
(eg xml_cmp) */
|
(eg xml_cmp) */
|
||||||
|
int _x_vector_i; /* internal use: xml_child_each */
|
||||||
|
int _x_i; /* internal use for sorting:
|
||||||
|
see xml_enumerate and xml_cmp */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1057,6 +1059,43 @@ xml_rootchild_node(cxobj *xp,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*! help function to sorting: enumerate all children according to present order
|
||||||
|
* This is so that the child itself know its present order in a list.
|
||||||
|
* When sorting by "ordered by user", the order should remain in its present
|
||||||
|
* state.
|
||||||
|
* A child can always compute its order functionally but it computes
|
||||||
|
* more cycles,..
|
||||||
|
* @param[in] xp Enumerate its children
|
||||||
|
* @retval 0 OK
|
||||||
|
* @see xml_sort
|
||||||
|
* @see xml_enumerate_get Call to the child to get the number
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
xml_enumerate_children(cxobj *xp)
|
||||||
|
{
|
||||||
|
cxobj *x = NULL;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while ((x = xml_child_each(xp, x, -1)) != NULL)
|
||||||
|
x->_x_i = i++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! Get the enumeration of a single child set by enumeration of parent
|
||||||
|
* @see xml_children_enumerate
|
||||||
|
* @note that it has to be called right after xml_children_enumerate. If not,
|
||||||
|
* there are many cases where this info is stale.
|
||||||
|
* @param[in] x A child whose parent has enumerated its children
|
||||||
|
* @retval n Enumeration
|
||||||
|
* @see xml_enumerate_children Call to the parent to compute the nr
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
xml_enumerate_get(cxobj *x)
|
||||||
|
{
|
||||||
|
return x->_x_i;
|
||||||
|
}
|
||||||
|
|
||||||
/*! Get the first sub-node which is an XML body.
|
/*! Get the first sub-node which is an XML body.
|
||||||
* @param[in] xn xml tree node
|
* @param[in] xn xml tree node
|
||||||
* @retval The returned body as a pointer to the name string
|
* @retval The returned body as a pointer to the name string
|
||||||
|
|
@ -1560,6 +1599,7 @@ _xml_parse(const char *str,
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
struct xml_parse_yacc_arg ya = {0,};
|
struct xml_parse_yacc_arg ya = {0,};
|
||||||
cxobj *x;
|
cxobj *x;
|
||||||
|
|
||||||
if (strlen(str) == 0)
|
if (strlen(str) == 0)
|
||||||
return 0; /* OK */
|
return 0; /* OK */
|
||||||
if (xt == NULL){
|
if (xt == NULL){
|
||||||
|
|
@ -1595,7 +1635,7 @@ _xml_parse(const char *str,
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
clixon_xml_parsel_exit(&ya);
|
clixon_xml_parsel_exit(&ya);
|
||||||
if(ya.ya_parse_string != NULL)
|
if (ya.ya_parse_string != NULL)
|
||||||
free(ya.ya_parse_string);
|
free(ya.ya_parse_string);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
@ -2046,6 +2086,28 @@ xml_apply_ancestor(cxobj *xn,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Is xpp ancestor of x?
|
||||||
|
* @param[in] x XML node
|
||||||
|
* @param[in] xpp Potential ancestor of x in XML tree
|
||||||
|
* @retval 0 No, xpp is not ancestor of x
|
||||||
|
* @retval 1 Yes, xpp is ancestor of x
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
xml_isancestor(cxobj *x,
|
||||||
|
cxobj *xpp)
|
||||||
|
{
|
||||||
|
cxobj *xp = NULL;
|
||||||
|
cxobj *xn = NULL;
|
||||||
|
|
||||||
|
xn = x;
|
||||||
|
while ((xp = xml_parent(xn)) != NULL) {
|
||||||
|
if (xp == xpp)
|
||||||
|
return 1;
|
||||||
|
xn = xp;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*! Generic parse function for xml values
|
/*! Generic parse function for xml values
|
||||||
* @param[in] xb xml tree body node, ie containing a value to be parsed
|
* @param[in] xb xml tree body node, ie containing a value to be parsed
|
||||||
* @param[in] type Type of value to be parsed in value
|
* @param[in] type Type of value to be parsed in value
|
||||||
|
|
@ -2255,7 +2317,6 @@ clicon_log_xml(int level,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Turn this on to get a xml parse and pretty print test program
|
* Turn this on to get a xml parse and pretty print test program
|
||||||
* Usage: xpath
|
* Usage: xpath
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,7 @@ xml_child_spec(cxobj *x,
|
||||||
* @note args are pointer ot pointers, to fit into qsort cmp function
|
* @note args are pointer ot pointers, to fit into qsort cmp function
|
||||||
* @see xml_cmp1 Similar, but for one object
|
* @see xml_cmp1 Similar, but for one object
|
||||||
* @note empty value/NULL is smallest value
|
* @note empty value/NULL is smallest value
|
||||||
|
* @note xml_enumerate_children must have been called prior to this call
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xml_cmp(const void* arg1,
|
xml_cmp(const void* arg1,
|
||||||
|
|
@ -213,12 +214,19 @@ xml_cmp(const void* arg1,
|
||||||
char *keyname;
|
char *keyname;
|
||||||
cg_var *cv1;
|
cg_var *cv1;
|
||||||
cg_var *cv2;
|
cg_var *cv2;
|
||||||
|
int nr1;
|
||||||
|
int nr2;
|
||||||
|
|
||||||
assert(x1&&x2);
|
if (x1==NULL || x2==NULL)
|
||||||
|
return 0; /* shouldnt happen */
|
||||||
y1 = xml_spec(x1);
|
y1 = xml_spec(x1);
|
||||||
y2 = xml_spec(x2);
|
y2 = xml_spec(x2);
|
||||||
if (y1==NULL || y2==NULL)
|
nr1 = xml_enumerate_get(x1);
|
||||||
return 0; /* just ignore */
|
nr2 = xml_enumerate_get(x2);
|
||||||
|
if (y1==NULL || y2==NULL){
|
||||||
|
equal = nr1-nr2;
|
||||||
|
return equal;
|
||||||
|
}
|
||||||
if (y1 != y2){
|
if (y1 != y2){
|
||||||
yi1 = yang_order(y1);
|
yi1 = yang_order(y1);
|
||||||
yi2 = yang_order(y2);
|
yi2 = yang_order(y2);
|
||||||
|
|
@ -230,8 +238,10 @@ xml_cmp(const void* arg1,
|
||||||
* otherwise sort according to key
|
* otherwise sort according to key
|
||||||
*/
|
*/
|
||||||
if (yang_config(y1)==0 ||
|
if (yang_config(y1)==0 ||
|
||||||
yang_find((yang_node*)y1, Y_ORDERED_BY, "user") != NULL)
|
yang_find((yang_node*)y1, Y_ORDERED_BY, "user") != NULL){
|
||||||
return 0; /* Ordered by user or state data : maintain existing order */
|
equal = nr1-nr2;
|
||||||
|
return equal; /* Ordered by user or state data : maintain existing order */
|
||||||
|
}
|
||||||
switch (y1->ys_keyword){
|
switch (y1->ys_keyword){
|
||||||
case Y_LEAF_LIST: /* Match with name and value */
|
case Y_LEAF_LIST: /* Match with name and value */
|
||||||
if ((b1 = xml_body(x1)) == NULL)
|
if ((b1 = xml_body(x1)) == NULL)
|
||||||
|
|
@ -358,6 +368,7 @@ xml_sort(cxobj *x,
|
||||||
/* Abort sort if non-config (=state) data */
|
/* Abort sort if non-config (=state) data */
|
||||||
if ((ys = xml_spec(x)) != 0 && yang_config(ys)==0)
|
if ((ys = xml_spec(x)) != 0 && yang_config(ys)==0)
|
||||||
return 1;
|
return 1;
|
||||||
|
xml_enumerate_children(x);
|
||||||
qsort(xml_childvec_get(x), xml_child_nr(x), sizeof(cxobj *), xml_cmp);
|
qsort(xml_childvec_get(x), xml_child_nr(x), sizeof(cxobj *), xml_cmp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -642,6 +653,7 @@ xml_sort_verify(cxobj *x0,
|
||||||
retval = 1;
|
retval = 1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
xml_enumerate_children(x0);
|
||||||
while ((x = xml_child_each(x0, x, -1)) != NULL) {
|
while ((x = xml_child_each(x0, x, -1)) != NULL) {
|
||||||
if (xprev != NULL){ /* Check xprev <= x */
|
if (xprev != NULL){ /* Check xprev <= x */
|
||||||
if (xml_cmp(&xprev, &x) > 0)
|
if (xml_cmp(&xprev, &x) > 0)
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,6 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#define __USE_GNU /* strverscmp */
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
|
|
@ -66,6 +64,7 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <libgen.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
|
@ -2449,7 +2448,7 @@ yang_spec_parse_module(clicon_handle h,
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
yang_spec_parse_file(clicon_handle h,
|
yang_spec_parse_file(clicon_handle h,
|
||||||
const char *filename,
|
char *filename,
|
||||||
yang_spec *yspec)
|
yang_spec *yspec)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#define __USE_GNU /* strverscmp */
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#define __USE_GNU /* strverscmp */
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
>&2 echo "Running $testfile"
|
>&2 echo "Running $testfile"
|
||||||
|
|
||||||
# Site file, an example of this file in README.md
|
# Site file, an example of this file in README.md
|
||||||
if [ -x ./site.sh ]; then
|
if [ -f ./site.sh ]; then
|
||||||
|
|
||||||
. ./site.sh
|
. ./site.sh
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ new "Make DESTDIR install"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "Check installed files /usr"
|
new "Check installed files /usr"
|
||||||
if [ ! -d $dir/usr ]; then
|
if [ ! -d $dir/usr ]; then
|
||||||
err $dir/usr
|
err $dir/usr
|
||||||
|
|
@ -59,3 +58,5 @@ l=$(find $dir -type l)
|
||||||
if [ -n "$l" ]; then
|
if [ -n "$l" ]; then
|
||||||
err "$l"
|
err "$l"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -rf $dir
|
||||||
|
|
|
||||||
|
|
@ -262,11 +262,10 @@ runtest(){
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
new "start backend -s $mode -f $cfg"
|
new "start backend -s $mode -f $cfg"
|
||||||
# start new backend
|
start_backend -s $mode -f $cfg
|
||||||
sudo $clixon_backend -s $mode -f $cfg -D $DBG
|
|
||||||
if [ $? -ne 0 ]; then
|
new "waiting"
|
||||||
err
|
sleep $RCWAIT
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
new "Restart backend as eg follows: -Ff $cfg -s $mode ($BETIMEOUT s)"
|
new "Restart backend as eg follows: -Ff $cfg -s $mode ($BETIMEOUT s)"
|
||||||
sleep $BETIMEOUT
|
sleep $BETIMEOUT
|
||||||
|
|
@ -311,23 +310,28 @@ runtest startup '<data><a1 xmlns="urn:example:a">always work</a1><b xmlns="urn:e
|
||||||
new "4. Load non-compat invalid startup. Enter failsafe, startup invalid."
|
new "4. Load non-compat invalid startup. Enter failsafe, startup invalid."
|
||||||
(cd $dir; rm -f tmp_db candidate_db running_db startup_db) # remove databases
|
(cd $dir; rm -f tmp_db candidate_db running_db startup_db) # remove databases
|
||||||
(cd $dir; cp non-compat-invalid.xml startup_db)
|
(cd $dir; cp non-compat-invalid.xml startup_db)
|
||||||
runtest startup '<data><a1 xmlns="urn:example:a">always work</a1></data>' '<data><a1 xmlns="urn:example:a">always work</a1><b xmlns="urn:example:b">other text</b><a0 xmlns="urn:example:a">old version</a0><c xmlns="urn:example:c">bla bla</c></data>'
|
runtest startup '<data><a1 xmlns="urn:example:a">always work</a1></data>' '<data><a0 xmlns="urn:example:a">old version</a0><a1 xmlns="urn:example:a">always work</a1><b xmlns="urn:example:b">other text</b><c xmlns="urn:example:c">bla bla</c></data>'
|
||||||
|
|
||||||
new "5. Load non-compat invalid running. Enter failsafe, startup invalid."
|
new "5. Load non-compat invalid running. Enter failsafe, startup invalid."
|
||||||
(cd $dir; rm -f tmp_db candidate_db running_db startup_db) # remove databases
|
(cd $dir; rm -f tmp_db candidate_db running_db startup_db) # remove databases
|
||||||
(cd $dir; cp non-compat-invalid.xml running_db)
|
(cd $dir; cp non-compat-invalid.xml running_db)
|
||||||
runtest running '<data><a1 xmlns="urn:example:a">always work</a1></data>' '<data><a1 xmlns="urn:example:a">always work</a1><b xmlns="urn:example:b">other text</b><a0 xmlns="urn:example:a">old version</a0><c xmlns="urn:example:c">bla bla</c></data>'
|
runtest running '<data><a1 xmlns="urn:example:a">always work</a1></data>' '<data><a0 xmlns="urn:example:a">old version</a0><a1 xmlns="urn:example:a">always work</a1><b xmlns="urn:example:b">other text</b><c xmlns="urn:example:c">bla bla</c></data>'
|
||||||
|
|
||||||
new "6. Load compatible invalid startup."
|
new "6. Load compatible invalid startup."
|
||||||
(cd $dir; rm -f tmp_db candidate_db running_db startup_db) # remove databases
|
(cd $dir; rm -f tmp_db candidate_db running_db startup_db) # remove databases
|
||||||
(cd $dir; cp compat-invalid.xml startup_db)
|
(cd $dir; cp compat-invalid.xml startup_db)
|
||||||
runtest startup '<data><a1 xmlns="urn:example:a">always work</a1></data>' '<data><a1 xmlns="urn:example:a">always work</a1><b xmlns="urn:example:b">other text</b><a0 xmlns="urn:example:a">old version</a0><c xmlns="urn:example:c">bla bla</c></data>'
|
runtest startup '<data><a1 xmlns="urn:example:a">always work</a1></data>' '<data><a0 xmlns="urn:example:a">old version</a0><a1 xmlns="urn:example:a">always work</a1><b xmlns="urn:example:b">other text</b><c xmlns="urn:example:c">bla bla</c></data>'
|
||||||
|
|
||||||
|
# This testcase contains an error/exception of the clixon xml parser, and
|
||||||
|
# I cant track down the memory leakage.
|
||||||
|
if [ $valgrindtest -ne 2 ]; then
|
||||||
new "7. Load non-compat startup. Syntax fail, enter failsafe, startup invalid"
|
new "7. Load non-compat startup. Syntax fail, enter failsafe, startup invalid"
|
||||||
(cd $dir; rm -f tmp_db candidate_db running_db startup_db) # remove databases
|
(cd $dir; rm -f tmp_db candidate_db running_db startup_db) # remove databases
|
||||||
(cd $dir; cp compat-err.xml startup_db)
|
(cd $dir; cp compat-err.xml startup_db)
|
||||||
runtest startup '<data><a1 xmlns="urn:example:a">always work</a1></data>' '<rpc-error><error-type>application</error-type><error-tag>operation-failed</error-tag><error-severity>error</error-severity><error-message>read registry</error-message></rpc-error>'
|
runtest startup '<data><a1 xmlns="urn:example:a">always work</a1></data>' '<rpc-error><error-type>application</error-type><error-tag>operation-failed</error-tag><error-severity>error</error-severity><error-message>read registry</error-message></rpc-error>'
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $BE -ne 0 ]; then
|
if [ $BE -ne 0 ]; then
|
||||||
rm -rf $dir
|
rm -rf $dir
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#define __USE_GNU /* strverscmp */
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue