removed unnecessary strerror() in clixon_err() calls; added 'function' keyword in all function declarations in the test scripts
This commit is contained in:
parent
73414e2ece
commit
1f0147f996
42 changed files with 95 additions and 84 deletions
|
|
@ -818,8 +818,7 @@ load_config_file(clicon_handle h,
|
||||||
}
|
}
|
||||||
filename = cv_string_get(cv);
|
filename = cv_string_get(cv);
|
||||||
if (stat(filename, &st) < 0){
|
if (stat(filename, &st) < 0){
|
||||||
clicon_err(OE_UNIX, 0, "load_config: stat(%s): %s",
|
clicon_err(OE_UNIX, errno, "load_config: stat(%s)", filename);
|
||||||
filename, strerror(errno));
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* Open and parse local file into xml */
|
/* Open and parse local file into xml */
|
||||||
|
|
@ -1338,3 +1337,4 @@ cli_help(clicon_handle h, cvec *vars, cvec *argv)
|
||||||
pt = cligen_ph_active_get(ch);
|
pt = cligen_ph_active_get(ch);
|
||||||
return cligen_help(ch, stdout, pt);
|
return cligen_help(ch, stdout, pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,13 @@ typedef int (plgextension_t)(clicon_handle h, yang_stmt *yext, yang_stmt *ys);
|
||||||
*/
|
*/
|
||||||
typedef int (plgauth_t)(clicon_handle, void *);
|
typedef int (plgauth_t)(clicon_handle, void *);
|
||||||
|
|
||||||
typedef int (plgreset_t)(clicon_handle h, const char *db); /* Reset system status */
|
/*! Reset system status
|
||||||
|
* @param[in] h Clicon handle
|
||||||
|
* @param[in] db Database name (eg "running")
|
||||||
|
* @retval -1 Fatal error
|
||||||
|
* @retval 0 OK
|
||||||
|
*/
|
||||||
|
typedef int (plgreset_t)(clicon_handle h, const char *db);
|
||||||
|
|
||||||
/* Plugin statedata
|
/* Plugin statedata
|
||||||
* @param[in] Clicon handle
|
* @param[in] Clicon handle
|
||||||
|
|
|
||||||
|
|
@ -240,8 +240,8 @@ clixon_client_connect(clicon_handle h,
|
||||||
if ((netconf_bin = getenv("CLIXON_NETCONF_BIN")) == NULL)
|
if ((netconf_bin = getenv("CLIXON_NETCONF_BIN")) == NULL)
|
||||||
netconf_bin = CLIXON_NETCONF_BIN;
|
netconf_bin = CLIXON_NETCONF_BIN;
|
||||||
if (stat(netconf_bin, &st) < 0){
|
if (stat(netconf_bin, &st) < 0){
|
||||||
clicon_err(OE_NETCONF, 0, "netconf binary %s: %s. Set with CLIXON_NETCONF_BIN=",
|
clicon_err(OE_NETCONF, errno, "netconf binary %s. Set with CLIXON_NETCONF_BIN=",
|
||||||
netconf_bin, strerror(errno));
|
netconf_bin);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
argv[i++] = netconf_bin;
|
argv[i++] = netconf_bin;
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ clicon_file_dirent(const char *dir,
|
||||||
snprintf(filename, MAXPATHLEN-1, "%s/%s", dir, dent->d_name);
|
snprintf(filename, MAXPATHLEN-1, "%s/%s", dir, dent->d_name);
|
||||||
res = lstat(filename, &st);
|
res = lstat(filename, &st);
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
clicon_err(OE_UNIX, 0, "lstat: %s", strerror(errno));
|
clicon_err(OE_UNIX, errno, "lstat");
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
if ((type & st.st_mode) == 0)
|
if ((type & st.st_mode) == 0)
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ clicon_hash_init(void)
|
||||||
clicon_hash_t *hash;
|
clicon_hash_t *hash;
|
||||||
|
|
||||||
if ((hash = (clicon_hash_t *)malloc(sizeof(clicon_hash_t) * HASH_SIZE)) == NULL){
|
if ((hash = (clicon_hash_t *)malloc(sizeof(clicon_hash_t) * HASH_SIZE)) == NULL){
|
||||||
clicon_err(OE_UNIX, errno, "malloc: %s", strerror(errno));
|
clicon_err(OE_UNIX, errno, "malloc");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(hash, 0, sizeof(clicon_hash_t)*HASH_SIZE);
|
memset(hash, 0, sizeof(clicon_hash_t)*HASH_SIZE);
|
||||||
|
|
@ -240,14 +240,14 @@ clicon_hash_add(clicon_hash_t *hash,
|
||||||
h = clicon_hash_lookup(hash, key);
|
h = clicon_hash_lookup(hash, key);
|
||||||
if (h == NULL) {
|
if (h == NULL) {
|
||||||
if ((new = (clicon_hash_t)malloc(sizeof(*new))) == NULL){
|
if ((new = (clicon_hash_t)malloc(sizeof(*new))) == NULL){
|
||||||
clicon_err(OE_UNIX, errno, "malloc: %s", strerror(errno));
|
clicon_err(OE_UNIX, errno, "malloc");
|
||||||
goto catch;
|
goto catch;
|
||||||
}
|
}
|
||||||
memset(new, 0, sizeof(*new));
|
memset(new, 0, sizeof(*new));
|
||||||
|
|
||||||
new->h_key = strdup(key);
|
new->h_key = strdup(key);
|
||||||
if (new->h_key == NULL){
|
if (new->h_key == NULL){
|
||||||
clicon_err(OE_UNIX, errno, "strdup: %s", strerror(errno));
|
clicon_err(OE_UNIX, errno, "strdup");
|
||||||
goto catch;
|
goto catch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,7 +258,7 @@ clicon_hash_add(clicon_hash_t *hash,
|
||||||
/* Make copy of value. aligned */
|
/* Make copy of value. aligned */
|
||||||
newval = malloc(align4(vlen+3));
|
newval = malloc(align4(vlen+3));
|
||||||
if (newval == NULL){
|
if (newval == NULL){
|
||||||
clicon_err(OE_UNIX, errno, "malloc: %s", strerror(errno));
|
clicon_err(OE_UNIX, errno, "malloc");
|
||||||
goto catch;
|
goto catch;
|
||||||
}
|
}
|
||||||
memcpy(newval, val, vlen);
|
memcpy(newval, val, vlen);
|
||||||
|
|
@ -349,7 +349,7 @@ clicon_hash_keys(clicon_hash_t *hash,
|
||||||
break;
|
break;
|
||||||
tmp = realloc(keys, ((*nkeys)+1) * sizeof(char *));
|
tmp = realloc(keys, ((*nkeys)+1) * sizeof(char *));
|
||||||
if (tmp == NULL){
|
if (tmp == NULL){
|
||||||
clicon_err(OE_UNIX, errno, "realloc: %s", strerror(errno));
|
clicon_err(OE_UNIX, errno, "realloc");
|
||||||
goto catch;
|
goto catch;
|
||||||
}
|
}
|
||||||
keys = tmp;
|
keys = tmp;
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ fork_netns_socket(const char *netns,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (setns(fd, CLONE_NEWNET) < 0){
|
if (setns(fd, CLONE_NEWNET) < 0){
|
||||||
clicon_err(OE_UNIX, errno, "setns(%s)%d", netns, errno);
|
clicon_err(OE_UNIX, errno, "setns(%s)", netns);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
|
||||||
|
|
@ -702,7 +702,7 @@ rpc_callback_register(clicon_handle h,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if ((rc = malloc(sizeof(rpc_callback_t))) == NULL) {
|
if ((rc = malloc(sizeof(rpc_callback_t))) == NULL) {
|
||||||
clicon_err(OE_DB, errno, "malloc: %s", strerror(errno));
|
clicon_err(OE_DB, errno, "malloc");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
memset(rc, 0, sizeof(*rc));
|
memset(rc, 0, sizeof(*rc));
|
||||||
|
|
@ -829,7 +829,7 @@ upgrade_callback_reg_fn(clicon_handle h,
|
||||||
upgrade_callback_t *uc;
|
upgrade_callback_t *uc;
|
||||||
|
|
||||||
if ((uc = malloc(sizeof(upgrade_callback_t))) == NULL) {
|
if ((uc = malloc(sizeof(upgrade_callback_t))) == NULL) {
|
||||||
clicon_err(OE_DB, errno, "malloc: %s", strerror(errno));
|
clicon_err(OE_DB, errno, "malloc");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
memset(uc, 0, sizeof(*uc));
|
memset(uc, 0, sizeof(*uc));
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,6 @@ clixon_proc_socket_close(pid_t pid,
|
||||||
* @param[out] pid
|
* @param[out] pid
|
||||||
* @retval 0 OK
|
* @retval 0 OK
|
||||||
* @retval -1 Error.
|
* @retval -1 Error.
|
||||||
* @note SIGCHLD is set to IGN here. Maybe it should be done in main?
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
clixon_proc_background(char **argv,
|
clixon_proc_background(char **argv,
|
||||||
|
|
@ -280,9 +279,6 @@ clixon_proc_background(char **argv,
|
||||||
done:
|
done:
|
||||||
sigprocmask(SIG_SETMASK, &oset, NULL);
|
sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||||
set_signal(SIGINT, oldhandler, NULL);
|
set_signal(SIGINT, oldhandler, NULL);
|
||||||
/* Ensure reap proc child in same session */
|
|
||||||
if (set_signal(SIGCHLD, SIG_IGN, NULL) < 0)
|
|
||||||
goto quit;
|
|
||||||
*pid0 = child;
|
*pid0 = child;
|
||||||
retval = 0;
|
retval = 0;
|
||||||
quit:
|
quit:
|
||||||
|
|
|
||||||
36
test/lib.sh
36
test/lib.sh
|
|
@ -221,7 +221,7 @@ fi
|
||||||
# error and exit,
|
# error and exit,
|
||||||
# arg1: expected
|
# arg1: expected
|
||||||
# arg2: errmsg[optional]
|
# arg2: errmsg[optional]
|
||||||
err(){
|
function err(){
|
||||||
echo -e "\e[31m\nError in Test$testnr [$testname]:"
|
echo -e "\e[31m\nError in Test$testnr [$testname]:"
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
echo "Expected: $1"
|
echo "Expected: $1"
|
||||||
|
|
@ -240,7 +240,7 @@ err(){
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test is previous test had valgrind errors if so quit
|
# Test is previous test had valgrind errors if so quit
|
||||||
checkvalgrind(){
|
function checkvalgrind(){
|
||||||
if [ -f $valgrindfile ]; then
|
if [ -f $valgrindfile ]; then
|
||||||
res=$(cat $valgrindfile | grep -e "Invalid" |awk '{print $4}' | grep -v '^0$')
|
res=$(cat $valgrindfile | grep -e "Invalid" |awk '{print $4}' | grep -v '^0$')
|
||||||
if [ -n "$res" ]; then
|
if [ -n "$res" ]; then
|
||||||
|
|
@ -260,7 +260,7 @@ checkvalgrind(){
|
||||||
|
|
||||||
# Start backend with all varargs.
|
# Start backend with all varargs.
|
||||||
# If valgrindtest == 2, start valgrind
|
# If valgrindtest == 2, start valgrind
|
||||||
start_backend(){
|
function 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.
|
||||||
|
|
@ -273,7 +273,7 @@ start_backend(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_backend(){
|
function stop_backend(){
|
||||||
sudo clixon_backend -z $*
|
sudo clixon_backend -z $*
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
|
|
@ -286,7 +286,7 @@ stop_backend(){
|
||||||
}
|
}
|
||||||
|
|
||||||
# Wait for restconf to stop sending 502 Bad Gateway
|
# Wait for restconf to stop sending 502 Bad Gateway
|
||||||
wait_backend(){
|
function wait_backend(){
|
||||||
reply=$(echo '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101"><ping xmlns="http://clicon.org/lib"/></rpc>]]>]]>' | $clixon_netconf -qef $cfg 2> /dev/null)
|
reply=$(echo '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101"><ping xmlns="http://clicon.org/lib"/></rpc>]]>]]>' | $clixon_netconf -qef $cfg 2> /dev/null)
|
||||||
let i=0;
|
let i=0;
|
||||||
while [[ $reply != "<rpc-reply"* ]]; do
|
while [[ $reply != "<rpc-reply"* ]]; do
|
||||||
|
|
@ -304,7 +304,7 @@ wait_backend(){
|
||||||
|
|
||||||
# Start restconf daemon
|
# Start restconf daemon
|
||||||
# @see wait_restconf
|
# @see wait_restconf
|
||||||
start_restconf(){
|
function start_restconf(){
|
||||||
# Start in background
|
# Start in background
|
||||||
echo "sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG $*"
|
echo "sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG $*"
|
||||||
sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG $* &
|
sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG $* &
|
||||||
|
|
@ -314,7 +314,7 @@ start_restconf(){
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop restconf daemon before test
|
# Stop restconf daemon before test
|
||||||
stop_restconf_pre(){
|
function stop_restconf_pre(){
|
||||||
sudo pkill -f clixon_restconf
|
sudo pkill -f clixon_restconf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -322,7 +322,7 @@ stop_restconf_pre(){
|
||||||
# Two caveats in pkill:
|
# Two caveats in pkill:
|
||||||
# 1) Dont use $clixon_restconf (dont work in valgrind)
|
# 1) Dont use $clixon_restconf (dont work in valgrind)
|
||||||
# 2) Dont use -u $WWWUSER since clixon_restconf may drop privileges.
|
# 2) Dont use -u $WWWUSER since clixon_restconf may drop privileges.
|
||||||
stop_restconf(){
|
function stop_restconf(){
|
||||||
# sudo pkill -u $wwwuser -f clixon_restconf # Dont use $clixon_restoconf doesnt work in valgrind
|
# sudo pkill -u $wwwuser -f clixon_restconf # Dont use $clixon_restoconf doesnt work in valgrind
|
||||||
sudo pkill -f clixon_restconf
|
sudo pkill -f clixon_restconf
|
||||||
if [ $valgrindtest -eq 3 ]; then
|
if [ $valgrindtest -eq 3 ]; then
|
||||||
|
|
@ -335,7 +335,7 @@ stop_restconf(){
|
||||||
# @see start_restconf
|
# @see start_restconf
|
||||||
# Reasons for not working: if you run evhtp is nginx running?
|
# Reasons for not working: if you run evhtp is nginx running?
|
||||||
# @note assumes port=80 if RCPROTO=http and port=443 if RCPROTO=https
|
# @note assumes port=80 if RCPROTO=http and port=443 if RCPROTO=https
|
||||||
wait_restconf(){
|
function wait_restconf(){
|
||||||
# echo "curl $CURLOPTS $* $RCPROTO://localhost/restconf"
|
# echo "curl $CURLOPTS $* $RCPROTO://localhost/restconf"
|
||||||
hdr=$(curl $CURLOPTS $* $RCPROTO://localhost/restconf) 2> /dev/null
|
hdr=$(curl $CURLOPTS $* $RCPROTO://localhost/restconf) 2> /dev/null
|
||||||
# echo "hdr:\"$hdr\""
|
# echo "hdr:\"$hdr\""
|
||||||
|
|
@ -355,7 +355,7 @@ wait_restconf(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
endtest()
|
function endtest()
|
||||||
{
|
{
|
||||||
if [ $valgrindtest -eq 1 ]; then
|
if [ $valgrindtest -eq 1 ]; then
|
||||||
checkvalgrind
|
checkvalgrind
|
||||||
|
|
@ -363,7 +363,7 @@ endtest()
|
||||||
}
|
}
|
||||||
|
|
||||||
# Increment test number and print a nice string
|
# Increment test number and print a nice string
|
||||||
new(){
|
function new(){
|
||||||
endtest # finalize previous test
|
endtest # finalize previous test
|
||||||
testnr=`expr $testnr + 1`
|
testnr=`expr $testnr + 1`
|
||||||
testi=`expr $testi + 1`
|
testi=`expr $testi + 1`
|
||||||
|
|
@ -381,7 +381,7 @@ new(){
|
||||||
# Example:
|
# Example:
|
||||||
# expectpart "$(a-shell-cmd arg)" 0 'expected match 1' 'expected match 2' --not-- 'not expected 1'
|
# expectpart "$(a-shell-cmd arg)" 0 'expected match 1' 'expected match 2' --not-- 'not expected 1'
|
||||||
# @note need to escape \[\]
|
# @note need to escape \[\]
|
||||||
expectpart(){
|
function expectpart(){
|
||||||
r=$?
|
r=$?
|
||||||
ret=$1
|
ret=$1
|
||||||
retval=$2
|
retval=$2
|
||||||
|
|
@ -435,7 +435,7 @@ expectpart(){
|
||||||
# - stdin input
|
# - stdin input
|
||||||
# - expected stdout outcome
|
# - expected stdout outcome
|
||||||
# Use this if you want regex eg ^foo$
|
# Use this if you want regex eg ^foo$
|
||||||
expecteof(){
|
function expecteof(){
|
||||||
cmd=$1
|
cmd=$1
|
||||||
retval=$2
|
retval=$2
|
||||||
input=$3
|
input=$3
|
||||||
|
|
@ -482,7 +482,7 @@ EOF
|
||||||
# - expected command return value (0 if OK)
|
# - expected command return value (0 if OK)
|
||||||
# - stdin input
|
# - stdin input
|
||||||
# - expected stdout outcome
|
# - expected stdout outcome
|
||||||
expecteofx(){
|
function expecteofx(){
|
||||||
cmd=$1
|
cmd=$1
|
||||||
retval=$2
|
retval=$2
|
||||||
input=$3
|
input=$3
|
||||||
|
|
@ -528,7 +528,7 @@ EOF
|
||||||
# - expected command return value (0 if OK)
|
# - expected command return value (0 if OK)
|
||||||
# - stdin input
|
# - stdin input
|
||||||
# - expected stdout outcome
|
# - expected stdout outcome
|
||||||
expecteofeq(){
|
function expecteofeq(){
|
||||||
cmd=$1
|
cmd=$1
|
||||||
retval=$2
|
retval=$2
|
||||||
input=$3
|
input=$3
|
||||||
|
|
@ -567,7 +567,7 @@ EOF
|
||||||
# - Command
|
# - Command
|
||||||
# - Filename to pipe to stdin
|
# - Filename to pipe to stdin
|
||||||
# - expected stdout outcome
|
# - expected stdout outcome
|
||||||
expecteof_file(){
|
function expecteof_file(){
|
||||||
cmd=$1
|
cmd=$1
|
||||||
retval=$2
|
retval=$2
|
||||||
file=$3
|
file=$3
|
||||||
|
|
@ -601,7 +601,7 @@ expecteof_file(){
|
||||||
# - not expected stdout outcome*
|
# - not expected stdout outcome*
|
||||||
#
|
#
|
||||||
# XXX do expectwait like expectpart with multiple matches
|
# XXX do expectwait like expectpart with multiple matches
|
||||||
expectwait(){
|
function expectwait(){
|
||||||
cmd=$1
|
cmd=$1
|
||||||
input=$2
|
input=$2
|
||||||
expect=$3
|
expect=$3
|
||||||
|
|
@ -632,7 +632,7 @@ expectwait(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
expectmatch(){
|
function expectmatch(){
|
||||||
ret=$1
|
ret=$1
|
||||||
r=$2
|
r=$2
|
||||||
expret=$3
|
expret=$3
|
||||||
|
|
|
||||||
10
test/mem.sh
10
test/mem.sh
|
|
@ -8,12 +8,16 @@
|
||||||
|
|
||||||
# Run valgrindtest once, args:
|
# Run valgrindtest once, args:
|
||||||
# what: (cli|netconf|restconf|backend)* # no args means all
|
# what: (cli|netconf|restconf|backend)* # no args means all
|
||||||
memonce(){
|
function memonce(){
|
||||||
what=$1
|
what=$1
|
||||||
|
|
||||||
valgrindfile=$(mktemp)
|
valgrindfile=$(mktemp)
|
||||||
echo "valgrindfile:$valgrindfile"
|
echo "valgrindfile:$valgrindfile"
|
||||||
|
|
||||||
|
clixon_cli=
|
||||||
|
clixon_netconf=
|
||||||
|
clixon_backend=
|
||||||
|
clixon_restconf=
|
||||||
case "$what" in
|
case "$what" in
|
||||||
'cli')
|
'cli')
|
||||||
valgrindtest=1
|
valgrindtest=1
|
||||||
|
|
@ -32,7 +36,7 @@ memonce(){
|
||||||
clixon_backend="/usr/bin/valgrind --num-callers=50 --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --log-file=$valgrindfile clixon_backend"
|
clixon_backend="/usr/bin/valgrind --num-callers=50 --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --log-file=$valgrindfile clixon_backend"
|
||||||
;;
|
;;
|
||||||
'restconf')
|
'restconf')
|
||||||
valgrindtest=3 # This means backend valgrind test
|
valgrindtest=3 # This means restconf valgrind test
|
||||||
sudo chmod 660 $valgrindfile
|
sudo chmod 660 $valgrindfile
|
||||||
sudo chown www-data $valgrindfile
|
sudo chown www-data $valgrindfile
|
||||||
: ${DEMWAIT:=15} # valgrind backend needs some time to get up
|
: ${DEMWAIT:=15} # valgrind backend needs some time to get up
|
||||||
|
|
@ -66,7 +70,7 @@ memonce(){
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print a line with ==== under
|
# Print a line with ==== under
|
||||||
println(){
|
function println(){
|
||||||
str=$1
|
str=$1
|
||||||
echo "$str"
|
echo "$str"
|
||||||
length=$(echo "$str" | wc -c)
|
length=$(echo "$str" | wc -c)
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ EOF
|
||||||
|
|
||||||
# Generate file with n entries
|
# Generate file with n entries
|
||||||
# argument: <n> <proto>
|
# argument: <n> <proto>
|
||||||
genfile(){
|
function genfile(){
|
||||||
if [ $2 = netconf ]; then
|
if [ $2 = netconf ]; then
|
||||||
echo -n "<rpc><edit-config><target><candidate/></target><default-operation>replace</default-operation><config><x xmlns=\"urn:example:clixon\">" > $fxml
|
echo -n "<rpc><edit-config><target><candidate/></target><default-operation>replace</default-operation><config><x xmlns=\"urn:example:clixon\">" > $fxml
|
||||||
for (( i=0; i<$1; i++ )); do
|
for (( i=0; i<$1; i++ )); do
|
||||||
|
|
@ -114,7 +114,7 @@ genfile(){
|
||||||
# netconf, restconf
|
# netconf, restconf
|
||||||
# where op is one of:
|
# where op is one of:
|
||||||
# get put delete commit
|
# get put delete commit
|
||||||
runnet(){
|
function runnet(){
|
||||||
op=$1
|
op=$1
|
||||||
nr=$2 # Number of entries in DB (keep diff from n due to shell dynamic binding)
|
nr=$2 # Number of entries in DB (keep diff from n due to shell dynamic binding)
|
||||||
reqs=$3
|
reqs=$3
|
||||||
|
|
@ -165,7 +165,7 @@ done | $clixon_netconf -qf $cfg -y $fyang; } 2>&1 | awk '/real/ {print $2}' | tr
|
||||||
# netconf, restconf
|
# netconf, restconf
|
||||||
# where op is one of:
|
# where op is one of:
|
||||||
# get put delete
|
# get put delete
|
||||||
runrest(){
|
function runrest(){
|
||||||
op=$1
|
op=$1
|
||||||
nr=$2 # Number of entries in DB
|
nr=$2 # Number of entries in DB
|
||||||
reqs=$3
|
reqs=$3
|
||||||
|
|
@ -210,12 +210,12 @@ runrest(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
commit(){
|
function commit(){
|
||||||
# commit to running
|
# commit to running
|
||||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><commit/></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><commit/></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||||
}
|
}
|
||||||
|
|
||||||
reset(){
|
function reset(){
|
||||||
# delete all in candidate
|
# delete all in candidate
|
||||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><edit-config><target><candidate/></target><default-operation>none</default-operation><config operation='delete'/></edit-config></rpc>]]>]]>" '^<rpc-reply><ok/></rpc-reply>]]>]]>$'
|
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><edit-config><target><candidate/></target><default-operation>none</default-operation><config operation='delete'/></edit-config></rpc>]]>]]>" '^<rpc-reply><ok/></rpc-reply>]]>]]>$'
|
||||||
# commit to running
|
# commit to running
|
||||||
|
|
@ -224,7 +224,7 @@ reset(){
|
||||||
|
|
||||||
# Load n entries into candidate
|
# Load n entries into candidate
|
||||||
# Args: <n>
|
# Args: <n>
|
||||||
load(){
|
function load(){
|
||||||
# Generate file ($fxml)
|
# Generate file ($fxml)
|
||||||
genfile $1 netconf
|
genfile $1 netconf
|
||||||
# Write it to backend in one chunk
|
# Write it to backend in one chunk
|
||||||
|
|
@ -236,7 +236,7 @@ load(){
|
||||||
# args: <op> <protocol> <from> <step> <to> <reqs> <cand> <run>
|
# args: <op> <protocol> <from> <step> <to> <reqs> <cand> <run>
|
||||||
# <reqs>=0 means all in one go
|
# <reqs>=0 means all in one go
|
||||||
# <cand> <run> means a priori loaded into datastore
|
# <cand> <run> means a priori loaded into datastore
|
||||||
plot(){
|
function plot(){
|
||||||
op=$1
|
op=$1
|
||||||
proto=$2
|
proto=$2
|
||||||
from=$3
|
from=$3
|
||||||
|
|
@ -275,7 +275,7 @@ plot(){
|
||||||
# Each operation do <reqs> times
|
# Each operation do <reqs> times
|
||||||
# args: <op> <protocol> <from> <step> <to> <reqs> <cand> <run>
|
# args: <op> <protocol> <from> <step> <to> <reqs> <cand> <run>
|
||||||
# <reqs>=0 means all in one go
|
# <reqs>=0 means all in one go
|
||||||
startup(){
|
function startup(){
|
||||||
from=$1
|
from=$1
|
||||||
step=$2
|
step=$2
|
||||||
to=$3
|
to=$3
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ EOF
|
||||||
# Arguments
|
# Arguments
|
||||||
# - expected config
|
# - expected config
|
||||||
# - expected state
|
# - expected state
|
||||||
testrun()
|
function testrun()
|
||||||
{
|
{
|
||||||
config=$1
|
config=$1
|
||||||
state=$2
|
state=$2
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ if [ $BE -ne 0 ]; then
|
||||||
wait_backend
|
wait_backend
|
||||||
fi
|
fi
|
||||||
|
|
||||||
testparam()
|
function testparam()
|
||||||
{
|
{
|
||||||
|
|
||||||
# Try hidden parameter list
|
# Try hidden parameter list
|
||||||
|
|
@ -149,7 +149,7 @@ EOF
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
testvalue()
|
function testvalue()
|
||||||
{
|
{
|
||||||
# Try not hidden parameter list
|
# Try not hidden parameter list
|
||||||
new "query table parameter hidden"
|
new "query table parameter hidden"
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ fi
|
||||||
# then deleting it, and reloading it
|
# then deleting it, and reloading it
|
||||||
# 1. mode - either VARS Keywords on non-key variables: a <x> y <y> or
|
# 1. mode - either VARS Keywords on non-key variables: a <x> y <y> or
|
||||||
# ALL Keywords on all variables: a x <x> y <y>
|
# ALL Keywords on all variables: a x <x> y <y>
|
||||||
testrun()
|
function testrun()
|
||||||
{
|
{
|
||||||
mode=$1
|
mode=$1
|
||||||
if [ $mode = ALL ]; then
|
if [ $mode = ALL ]; then
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ AFTER=$(cat <<EOF
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
testrun(){
|
function testrun(){
|
||||||
new "test params: -f $cfg -- -U"
|
new "test params: -f $cfg -- -U"
|
||||||
# Bring your own backend
|
# Bring your own backend
|
||||||
if [ $BE -ne 0 ]; then
|
if [ $BE -ne 0 ]; then
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ EOF
|
||||||
# Run netconf feature test
|
# Run netconf feature test
|
||||||
# 1: syntax node
|
# 1: syntax node
|
||||||
# 2: disabled or enabled
|
# 2: disabled or enabled
|
||||||
testrun()
|
function testrun()
|
||||||
{
|
{
|
||||||
node=$1
|
node=$1
|
||||||
enabled=$2
|
enabled=$2
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ EOF
|
||||||
# Args:
|
# Args:
|
||||||
# 1: base tree
|
# 1: base tree
|
||||||
# 2: sub tree
|
# 2: sub tree
|
||||||
testrun(){
|
function testrun(){
|
||||||
x0=$1
|
x0=$1
|
||||||
xi="<c xmlns=\"urn:example:example\">$2</c>"
|
xi="<c xmlns=\"urn:example:example\">$2</c>"
|
||||||
xp=c
|
xp=c
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ EOF
|
||||||
# - socket family
|
# - socket family
|
||||||
# - socket file/addr
|
# - socket file/addr
|
||||||
# - precommand /(eg sudo to raise to root)
|
# - precommand /(eg sudo to raise to root)
|
||||||
testrun(){
|
function testrun(){
|
||||||
mode=$1
|
mode=$1
|
||||||
username=$2
|
username=$2
|
||||||
family=$3
|
family=$3
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ EOF
|
||||||
# - read other in same module
|
# - read other in same module
|
||||||
# - read table
|
# - read table
|
||||||
# - read parameter
|
# - read parameter
|
||||||
testrun(){
|
function testrun(){
|
||||||
readdefault=$1
|
readdefault=$1
|
||||||
module=$2
|
module=$2
|
||||||
table=$3
|
table=$3
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ EOF
|
||||||
# - read
|
# - read
|
||||||
# - update
|
# - update
|
||||||
# - delete
|
# - delete
|
||||||
testrun(){
|
function testrun(){
|
||||||
writedefault=$1
|
writedefault=$1
|
||||||
paramaccess=$2
|
paramaccess=$2
|
||||||
paramaction=$3
|
paramaction=$3
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ EOF
|
||||||
# 6: expected return value of test2
|
# 6: expected return value of test2
|
||||||
# 7: expected return value of test3
|
# 7: expected return value of test3
|
||||||
# 8: startup mode: startup or init
|
# 8: startup mode: startup or init
|
||||||
testrun(){
|
function testrun(){
|
||||||
enablenacm=$1
|
enablenacm=$1
|
||||||
readdefault=$2
|
readdefault=$2
|
||||||
writedefault=$3
|
writedefault=$3
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ if [ $RC -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set nacm from scratch
|
# Set nacm from scratch
|
||||||
nacm(){
|
function nacm(){
|
||||||
new "auth set authentication config"
|
new "auth set authentication config"
|
||||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config operation='replace'>$RULES</config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config operation='replace'>$RULES</config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ DEFAULT='<nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm"><enable-nacm
|
||||||
# recovery: recovery user
|
# recovery: recovery user
|
||||||
# getp: true: get works; false: get does not work
|
# getp: true: get works; false: get does not work
|
||||||
# putp: true: expected to work; false: not work
|
# putp: true: expected to work; false: not work
|
||||||
testrun()
|
function testrun()
|
||||||
{
|
{
|
||||||
cred=$1
|
cred=$1
|
||||||
realuser=$2
|
realuser=$2
|
||||||
|
|
|
||||||
|
|
@ -379,7 +379,7 @@ EOF
|
||||||
# 1: leaf tag in yang
|
# 1: leaf tag in yang
|
||||||
# 2: expected match(true) or fail(false)
|
# 2: expected match(true) or fail(false)
|
||||||
# 3: match string
|
# 3: match string
|
||||||
testrun(){
|
function testrun(){
|
||||||
leaf="$1" # leaf tag under <c> with pattern to test
|
leaf="$1" # leaf tag under <c> with pattern to test
|
||||||
mat="$2" # expected match (1) or fail (0)
|
mat="$2" # expected match (1) or fail (0)
|
||||||
str0="$3" # content string (to match against)
|
str0="$3" # content string (to match against)
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ EOF
|
||||||
# Test function
|
# Test function
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# 1: nr size of large list
|
# 1: nr size of large list
|
||||||
testrun(){
|
function testrun(){
|
||||||
nr=$1
|
nr=$1
|
||||||
|
|
||||||
new "test params: -f $cfg"
|
new "test params: -f $cfg"
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ EOF
|
||||||
# 3: expected user: Expected user after drop (or no drop then startuser)
|
# 3: expected user: Expected user after drop (or no drop then startuser)
|
||||||
# 4: privileged mode (none, drop_perm, drop_temp)
|
# 4: privileged mode (none, drop_perm, drop_temp)
|
||||||
# 5: expect error: 0 or 1
|
# 5: expect error: 0 or 1
|
||||||
testrun(){
|
function testrun(){
|
||||||
startuser=$1
|
startuser=$1
|
||||||
beuser=$2
|
beuser=$2
|
||||||
expectuser=$3
|
expectuser=$3
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ fi
|
||||||
# Restconf test routine with arguments:
|
# Restconf test routine with arguments:
|
||||||
# 1. proto:http/https
|
# 1. proto:http/https
|
||||||
# 2: addr: 127.0.0.1/::1 # IPv4 or IPv6
|
# 2: addr: 127.0.0.1/::1 # IPv4 or IPv6
|
||||||
testrun()
|
function testrun()
|
||||||
{
|
{
|
||||||
proto=$1 # http/https
|
proto=$1 # http/https
|
||||||
addr=$2 # 127.0.0.1/::1
|
addr=$2 # 127.0.0.1/::1
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,11 @@ if [ "${WITH_RESTCONF}" != "evhtp" ]; then
|
||||||
if [ "$s" = $0 ]; then exit 0; else return 0; fi # skip
|
if [ "$s" = $0 ]; then exit 0; else return 0; fi # skip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Skip if valgrind restconf (actually valgrind version < 3.16 27 May 2020)
|
||||||
|
if [ $valgrindtest -eq 3 ]; then
|
||||||
|
if [ "$s" = $0 ]; then exit 0; else return 0; fi # skip
|
||||||
|
fi
|
||||||
|
|
||||||
APPNAME=example
|
APPNAME=example
|
||||||
|
|
||||||
cfg=$dir/conf.xml
|
cfg=$dir/conf.xml
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ EOF
|
||||||
# Args:
|
# Args:
|
||||||
# 1: operation
|
# 1: operation
|
||||||
# 2: expectret 0: means expect pi 0 as return, else something else
|
# 2: expectret 0: means expect pi 0 as return, else something else
|
||||||
testrpc()
|
function testrpc()
|
||||||
{
|
{
|
||||||
operation=$1
|
operation=$1
|
||||||
expectret=$2
|
expectret=$2
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ cat <<EOF > $cfg
|
||||||
</clixon-config>
|
</clixon-config>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
testrun(){
|
function testrun(){
|
||||||
option=$1
|
option=$1
|
||||||
|
|
||||||
new "test params: -f $cfg -y $fyang $option"
|
new "test params: -f $cfg -y $fyang $option"
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ fyang=$dir/socket.yang
|
||||||
# 1: UNIX|IPv4|IPv6
|
# 1: UNIX|IPv4|IPv6
|
||||||
# 2: unix file or ipv4 address or ipv6 address
|
# 2: unix file or ipv4 address or ipv6 address
|
||||||
# 3: session-id
|
# 3: session-id
|
||||||
testrun(){
|
function testrun(){
|
||||||
family=$1
|
family=$1
|
||||||
sock=$2
|
sock=$2
|
||||||
id=$3
|
id=$3
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ cat <<EOF > $cfg
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Run The test, ssl config is in local config
|
# Run The test, ssl config is in local config
|
||||||
testrun()
|
function testrun()
|
||||||
{
|
{
|
||||||
cat <<EOF > $dir/startup_db
|
cat <<EOF > $dir/startup_db
|
||||||
<config>
|
<config>
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ brokenvar='<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><inte
|
||||||
# The configs are identified by an interface called run, startup, extra.
|
# The configs are identified by an interface called run, startup, extra.
|
||||||
# Depending on startup mode (init, none, running, or startup)
|
# Depending on startup mode (init, none, running, or startup)
|
||||||
# expect different output of an initial get-config of running
|
# expect different output of an initial get-config of running
|
||||||
testrun(){
|
function testrun(){
|
||||||
mode=$1
|
mode=$1
|
||||||
rdb=$2 # running db at start
|
rdb=$2 # running db at start
|
||||||
sdb=$3 # startup db at start
|
sdb=$3 # startup db at start
|
||||||
|
|
@ -110,7 +110,7 @@ testrun(){
|
||||||
|
|
||||||
|
|
||||||
# The backend should fail with 255 and all db:s should be unaffected
|
# The backend should fail with 255 and all db:s should be unaffected
|
||||||
testfail(){
|
function testfail(){
|
||||||
mode=$1
|
mode=$1
|
||||||
rdb=$2 # running db at start
|
rdb=$2 # running db at start
|
||||||
sdb=$3 # startup db at start
|
sdb=$3 # startup db at start
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ EOF
|
||||||
# Check statements in log
|
# Check statements in log
|
||||||
# arg1: a statement to look for
|
# arg1: a statement to look for
|
||||||
# arg2: expected line number
|
# arg2: expected line number
|
||||||
checklog(){
|
function checklog(){
|
||||||
s=$1 # statement
|
s=$1 # statement
|
||||||
l0=$2 # linenr
|
l0=$2 # linenr
|
||||||
new "Check $s in log"
|
new "Check $s in log"
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ EOF
|
||||||
# Check statements in log
|
# Check statements in log
|
||||||
# arg1: a statement to look for
|
# arg1: a statement to look for
|
||||||
# arg2: expected line number
|
# arg2: expected line number
|
||||||
checklog(){
|
function checklog(){
|
||||||
s=$1 # statement
|
s=$1 # statement
|
||||||
l0=$2 # linenr
|
l0=$2 # linenr
|
||||||
new "Check $s in log"
|
new "Check $s in log"
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ EOF
|
||||||
# Type tests.
|
# Type tests.
|
||||||
# Parameters:
|
# Parameters:
|
||||||
# 1: dbcache: cache, nocache, cache-zerocopy
|
# 1: dbcache: cache, nocache, cache-zerocopy
|
||||||
testrun(){
|
function testrun(){
|
||||||
dbcache=$1
|
dbcache=$1
|
||||||
new "test params: -f $cfg # dbcache: $dbcache"
|
new "test params: -f $cfg # dbcache: $dbcache"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ EOF
|
||||||
# 3: min value (for errmsg)
|
# 3: min value (for errmsg)
|
||||||
# 4: max value (for errmsg)
|
# 4: max value (for errmsg)
|
||||||
# 5: post (eg .000 - special for decimal64, others should have "") (NYI)
|
# 5: post (eg .000 - special for decimal64, others should have "") (NYI)
|
||||||
testbuiltin(){
|
function testbuiltin(){
|
||||||
t=$1
|
t=$1
|
||||||
val=$2
|
val=$2
|
||||||
rmin=$3
|
rmin=$3
|
||||||
|
|
@ -218,7 +218,7 @@ testbuiltin(){
|
||||||
# 2: val OK
|
# 2: val OK
|
||||||
# 3: eval Invalid value
|
# 3: eval Invalid value
|
||||||
# 4: post (eg .000 - special for decimal64, others should have "")
|
# 4: post (eg .000 - special for decimal64, others should have "")
|
||||||
testrange(){
|
function testrange(){
|
||||||
t=$1
|
t=$1
|
||||||
val=$2
|
val=$2
|
||||||
eval=$3
|
eval=$3
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ cat <<EOF > $cfg
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Start from startup and upgrade, check running
|
# Start from startup and upgrade, check running
|
||||||
testrun(){
|
function testrun(){
|
||||||
runxml=$1
|
runxml=$1
|
||||||
|
|
||||||
# -u means trigger example upgrade
|
# -u means trigger example upgrade
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ EOF
|
||||||
# Create 5 startup files 1-5 according to the 5 cases above (columns in the matrix)
|
# Create 5 startup files 1-5 according to the 5 cases above (columns in the matrix)
|
||||||
# Argument:
|
# Argument:
|
||||||
# 1: payload, eg whats in the config apart from modstate
|
# 1: payload, eg whats in the config apart from modstate
|
||||||
createstartups()
|
function createstartups()
|
||||||
{
|
{
|
||||||
payload=$1
|
payload=$1
|
||||||
|
|
||||||
|
|
@ -150,7 +150,7 @@ EOF
|
||||||
# Check statements in log
|
# Check statements in log
|
||||||
# arg1: a statement to look for
|
# arg1: a statement to look for
|
||||||
# arg2: expected line number
|
# arg2: expected line number
|
||||||
checklog(){
|
function checklog(){
|
||||||
s=$1 # statement
|
s=$1 # statement
|
||||||
l0=$2 # linenr
|
l0=$2 # linenr
|
||||||
new "Check $s in log on line $l0"
|
new "Check $s in log on line $l0"
|
||||||
|
|
@ -178,7 +178,7 @@ checklog(){
|
||||||
|
|
||||||
# Check statements are not in log
|
# Check statements are not in log
|
||||||
# arg1: a statement to look for
|
# arg1: a statement to look for
|
||||||
checknolog(){
|
function checknolog(){
|
||||||
s=$1 # statement
|
s=$1 # statement
|
||||||
new "Check $s not in log"
|
new "Check $s not in log"
|
||||||
# echo "grep -n "$s" $log"
|
# echo "grep -n "$s" $log"
|
||||||
|
|
@ -200,7 +200,7 @@ checknolog(){
|
||||||
# 2: v: verb: true or false. The next statement should be there or not
|
# 2: v: verb: true or false. The next statement should be there or not
|
||||||
# 3: what to look for in log (if v=true it should be there, if v=false it should not be there)
|
# 3: what to look for in log (if v=true it should be there, if v=false it should not be there)
|
||||||
# 4: Linenr in log
|
# 4: Linenr in log
|
||||||
testrun(){
|
function testrun(){
|
||||||
i=$1
|
i=$1
|
||||||
flag=$2
|
flag=$2
|
||||||
match=$3
|
match=$3
|
||||||
|
|
@ -248,7 +248,7 @@ testrun(){
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# 1 : payload with loaded YANG
|
# 1 : payload with loaded YANG
|
||||||
# 2 : payload without loaded YANG
|
# 2 : payload without loaded YANG
|
||||||
testall()
|
function testall()
|
||||||
{
|
{
|
||||||
payload1=$1
|
payload1=$1
|
||||||
payload2=$2
|
payload2=$2
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ EOF
|
||||||
# 4: xpath
|
# 4: xpath
|
||||||
# 5: retval
|
# 5: retval
|
||||||
# 6: result
|
# 6: result
|
||||||
testrun(){
|
function testrun(){
|
||||||
op=$1
|
op=$1
|
||||||
x0=$2
|
x0=$2
|
||||||
x1=$3
|
x1=$3
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ STATE1='<sa xmlns="urn:example:any"><sb><k>22</k><u5>55</u5></sb><u4><u5>a strin
|
||||||
# Args:
|
# Args:
|
||||||
# 1: bool: startup (or not)
|
# 1: bool: startup (or not)
|
||||||
# 2: bool: treat unknown as anydata (or not)
|
# 2: bool: treat unknown as anydata (or not)
|
||||||
testrun()
|
function testrun()
|
||||||
{
|
{
|
||||||
startup=$1
|
startup=$1
|
||||||
unknown=$2
|
unknown=$2
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ cat <<EOF > $fyang
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# No args
|
# No args
|
||||||
testrun(){
|
function testrun(){
|
||||||
# Initial data (default y not given)
|
# Initial data (default y not given)
|
||||||
XML='<a xmlns="urn:example:default"><b><c>0</c></b></a>'
|
XML='<a xmlns="urn:example:default"><b><c>0</c></b></a>'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue