Added CLICON_LOG_DESTINATION and CLICON_LOG_FILE for al applications
This commit is contained in:
parent
26062d7003
commit
0234ed94bc
22 changed files with 498 additions and 163 deletions
|
|
@ -120,10 +120,10 @@ expectpart "$($clixon_cli -1 -f $cfg show conf x)" 0 "x m1 a (null) b 22/22 c 44
|
|||
|
||||
# Negative tests
|
||||
new "err x"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l n err x)" 255 "Config error: api-path syntax error \"/example2:x\": application unknown-element No such yang module prefix <bad-element>example2</bad-element>: Invalid argument"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o err x)" 255 "Config error: api-path syntax error \"/example2:x\": application unknown-element No such yang module prefix <bad-element>example2</bad-element>: Invalid argument"
|
||||
|
||||
new "err x a"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l n err x a 99)" 255 "Config error: api-path syntax error \"/example:x/m1=%s\": rpc malformed-message List key m1 length mismatch : Invalid argument"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o err x a 99)" 255 "Config error: api-path syntax error \"/example:x/m1=%s\": rpc malformed-message List key m1 length mismatch : Invalid argument"
|
||||
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
|
|
|
|||
|
|
@ -89,11 +89,11 @@ new "wait backend"
|
|||
wait_backend
|
||||
|
||||
new "orig error"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l n example error orig)" 255 "Config error: api-path syntax error " ": application invalid-value Invalid api-path: (must start with '/')"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o example error orig)" 255 "Config error: api-path syntax error " ": application invalid-value Invalid api-path: (must start with '/')"
|
||||
|
||||
if [ ${LINKAGE} = dynamic ]; then
|
||||
new "customized error"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l n example error custom)" 255 "My new err-string"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o example error custom)" 255 "My new err-string"
|
||||
fi
|
||||
|
||||
if [ $BE -ne 0 ]; then
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
# Turn on debug on backend/cli/netconf
|
||||
# Note, restconf debug used to be tested but is no longer tested here,
|
||||
# maybe in test_restconf_internal?
|
||||
# Also some log destination tests
|
||||
# Note no restconf debug test
|
||||
|
||||
# Magic line must be first in script (see README.md)
|
||||
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
||||
|
|
@ -84,15 +84,57 @@ wait_restconf
|
|||
new "Set backend debug using netconf"
|
||||
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><debug $LIBNS><level>1</level></debug></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
|
||||
|
||||
new "Set cli debug using cli"
|
||||
# Debug
|
||||
new "cli debug cli"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o debug cli 1)" 0 "^$"
|
||||
|
||||
# Run cli debug
|
||||
new "get cli debug, expect 0"
|
||||
new "cli debug, expect 0"
|
||||
expectpart "$($clixon_cli -1 -f $cfg show debug cli)" 0 "CLI debug:0x0"
|
||||
|
||||
new "get cli debug expect 2"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -o CLICON_DEBUG=msg show debug cli)" 0 "CLI debug:0x2"
|
||||
new "cli debug -o single"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -o CLICON_DEBUG=msg show debug cli)" 0 "CLI debug:0x2" --not-- "CLI debug:0x20"
|
||||
|
||||
new "cli debug -o multi"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -o CLICON_DEBUG="msg app2" show debug cli)" 0 "CLI debug:0x200002"
|
||||
|
||||
new "cli debug -D multi"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -D msg -D app2 show debug cli)" 0
|
||||
|
||||
# Log destination
|
||||
new "cli log -lf<file>"
|
||||
rm -f $dir/clixon.log
|
||||
expectpart "$($clixon_cli -1 -lf$dir/clixon.log -f $cfg show version)" 0
|
||||
if [ ! -f "$dir/clixon.log" ]; then
|
||||
err "$dir/clixon.log" "No file"
|
||||
fi
|
||||
|
||||
new "cli log -lfile"
|
||||
rm -f $dir/clixon.log
|
||||
expectpart "$($clixon_cli -1 -lfile -f $cfg show version)" 0
|
||||
if [ -f "$dir/clixon.log" ]; then
|
||||
err "No file" "$dir/clixon.log"
|
||||
fi
|
||||
|
||||
new "cli log -lfile + CLICON_LOG_FILE"
|
||||
rm -f $dir/clixon.log
|
||||
expectpart "$($clixon_cli -1 -lfile -o CLICON_LOG_FILE=$dir/clixon.log -f $cfg show version)" 0
|
||||
if [ ! -f "$dir/clixon.log" ]; then
|
||||
err "$dir/clixon.log" "No file"
|
||||
fi
|
||||
|
||||
rm -f $dir/clixon.log
|
||||
new "cli log -o CLICON_LOG_DESTINATION + CLICON_LOG_FILE"
|
||||
expectpart "$($clixon_cli -1 -o CLICON_LOG_DESTINATION=file -o CLICON_LOG_FILE=$dir/clixon.log -f $cfg show version)" 0
|
||||
if [ ! -f "$dir/clixon.log" ]; then
|
||||
err "$dir/clixon.log" "No file"
|
||||
fi
|
||||
|
||||
rm -f $dir/clixon.log
|
||||
new "cli log -o CLICON_LOG_DESTINATION + CLICON_LOG_FILE multi"
|
||||
expectpart "$($clixon_cli -1 -o CLICON_LOG_DESTINATION="stdout file" -o CLICON_LOG_FILE=$dir/clixon.log -f $cfg show version)" 0
|
||||
if [ ! -f "$dir/clixon.log" ]; then
|
||||
err "$dir/clixon.log" "No file"
|
||||
fi
|
||||
|
||||
new "Set backend debug using cli"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o debug backend 1)" 0 "^$"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue