* Made a separate Clixon datastore XML/JSON top-level symbol
* Replaces the hardcoded "config" keyword. * Implemented by a compile-time option called `DATASTORE_TOP_SYMBOL` option in clixon_custom.h * Tests: added endtest to all tests. Removed all premature exits if BE=0
This commit is contained in:
parent
2ab90d847b
commit
b7991d9b39
132 changed files with 939 additions and 628 deletions
|
|
@ -61,3 +61,8 @@ TOP_SRCDIR=@top_srcdir@
|
|||
|
||||
# Clixon version
|
||||
CLIXON_VERSION=@CLIXON_VERSION@
|
||||
|
||||
# Which XML symbol to add to top datastore config level
|
||||
# see also DATASTORE_TOP_SYMBOL
|
||||
DATASTORE_TOP="config"
|
||||
|
||||
|
|
|
|||
|
|
@ -361,6 +361,7 @@ function wait_restconf(){
|
|||
fi
|
||||
}
|
||||
|
||||
# End of test, final tests before normal exit of test
|
||||
function endtest()
|
||||
{
|
||||
if [ $valgrindtest -eq 1 ]; then
|
||||
|
|
@ -657,6 +658,10 @@ function expectmatch(){
|
|||
r=$2
|
||||
expret=$3
|
||||
expect=$4
|
||||
# echo "ret:$ret"
|
||||
# echo "ret:$r"
|
||||
# echo "expret:$expret"
|
||||
# echo "expect:$expect"
|
||||
if [ $r != $expret ]; then
|
||||
echo -e "\e[31m\nError ($r != $retval) in Test$testnr [$testname]:"
|
||||
echo -e "\e[0m:"
|
||||
|
|
|
|||
|
|
@ -277,3 +277,6 @@ unset format
|
|||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -260,3 +260,7 @@ unset nr
|
|||
unset clixon_util_path
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
||||
|
|
|
|||
|
|
@ -311,3 +311,6 @@ fi
|
|||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -246,17 +246,18 @@ testrun "$CONFIG" "$EXPSTATE"
|
|||
|
||||
#-----------------------------
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -135,3 +135,6 @@ fi
|
|||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -169,3 +169,5 @@ fi
|
|||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -287,20 +287,21 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -126,17 +126,18 @@ new "cli rpc"
|
|||
# We dont know which message-id the cli app uses
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o rpc ipv4)" 0 "<rpc-reply $DEFAULTONLY message-id=" "><x xmlns=\"urn:example:clixon\">ipv4</x><y xmlns=\"urn:example:clixon\">42</y></rpc-reply>"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@ show("Show a particular state of the system"){
|
|||
EOF
|
||||
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<table xmlns="urn:example:clixon">
|
||||
<parameter>
|
||||
<name>a</name>
|
||||
<value>42</value>
|
||||
</parameter>
|
||||
</table>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Add inline state
|
||||
|
|
|
|||
|
|
@ -291,3 +291,6 @@ fi
|
|||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -215,3 +215,6 @@ fi
|
|||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ show("Show a particular state of the system"){
|
|||
EOF
|
||||
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<table xmlns="urn:example:clixon">
|
||||
<parameter>
|
||||
<name>p1</name>
|
||||
|
|
@ -110,7 +110,7 @@ cat <<EOF > $dir/startup_db
|
|||
</index>
|
||||
</parameter>
|
||||
</table>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
new "test params: -f $cfg"
|
||||
|
|
@ -162,3 +162,6 @@ fi
|
|||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -136,3 +136,6 @@ fi
|
|||
|
||||
unset nr
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -125,17 +125,18 @@ expectpart "$($clixon_cli -1 -f $cfg set ex y a 2 b v2)" 0 ""
|
|||
new "show conf"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><ex xmlns=\"urn:example:clixon\"><x><a>1</a><b>v1</b></x><x><a>1</a><b>v2</b></x><x><a>1</a><b>v3</b></x><x><a>2</a><b>v1</b></x><x><a>2</a><b>v2</b></x><x><a>2</a><b>v3</b></x><y><a>1</a><b>v1</b></y><y><a>2</a><b>v1</b></y><y><a>1</a><b>v2</b></y><y><a>1</a><b>v3</b></y><y><a>2</a><b>v2</b></y></ex></data></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -109,17 +109,18 @@ for c in 2 4; do
|
|||
expectpart "$($clixon_cli -1 -m $m -f $cfg cmd$c)" 255 "^$"
|
||||
done
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -79,3 +79,6 @@ if [ $BE -ne 0 ]; then
|
|||
fi
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -157,19 +157,17 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=`pgrep -u root -f clixon_backend`
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=`pgrep -u root -f clixon_backend`
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# unset conditional parameters
|
||||
unset format
|
||||
|
||||
|
|
@ -177,3 +175,6 @@ unset format
|
|||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -126,3 +126,6 @@ new "Start with 2 extra configfiles + command-line"
|
|||
expectpart "$($clixon_cli -1 -f $cfg -o CLICON_MODULE_SET_ID=4 -o CLICON_FEATURE=test4 -l o show options)" 0 'CLICON_MODULE_SET_ID: "4"' 'CLICON_FEATURE: "test1"' 'CLICON_FEATURE: "test2"' 'CLICON_FEATURE: "test3"' 'CLICON_FEATURE: "test4"'
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ EOF
|
|||
|
||||
# Create empty startup
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config/>
|
||||
<${DATASTORE_TOP}/>
|
||||
EOF
|
||||
|
||||
# rm candidate and running
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ module ietf-ip{
|
|||
}
|
||||
EOF
|
||||
|
||||
xml='<config><x xmlns="urn:example:clixon"><y><a>1</a><b>2</b><c>first-entry</c></y><y><a>1</a><b>3</b><c>second-entry</c></y><y><a>2</a><b>3</b><c>third-entry</c></y><d/><f><e>a</e><e>b</e><e>c</e></f><g>astring</g></x></config>'
|
||||
xml="<x xmlns=\"urn:example:clixon\"><y><a>1</a><b>2</b><c>first-entry</c></y><y><a>1</a><b>3</b><c>second-entry</c></y><y><a>2</a><b>3</b><c>third-entry</c></y><d/><f><e>a</e><e>b</e><e>c</e></f><g>astring</g></x>"
|
||||
|
||||
xml2="<${DATASTORE_TOP}><x xmlns=\"urn:example:clixon\"><y><a>1</a><b>2</b><c>first-entry</c></y><y><a>1</a><b>3</b><c>second-entry</c></y><y><a>2</a><b>3</b><c>third-entry</c></y><d/><f><e>a</e><e>b</e><e>c</e></f><g>astring</g></x></${DATASTORE_TOP}>"
|
||||
|
||||
name=text
|
||||
|
||||
|
|
@ -68,13 +70,13 @@ ret=$($clixon_util_datastore $conf put replace "$xml")
|
|||
expectmatch "$ret" $? "0" ""
|
||||
|
||||
new "datastore get"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^$xml$"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^$xml2$"
|
||||
|
||||
new "datastore put all remove"
|
||||
expectpart "$($clixon_util_datastore $conf put remove "<config/>")" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put remove "")" 0 ""
|
||||
|
||||
new "datastore get"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^<config/>$"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^<${DATASTORE_TOP}/>$"
|
||||
|
||||
new "datastore put all merge"
|
||||
ret=$($clixon_util_datastore $conf put merge "$xml")
|
||||
|
|
@ -83,23 +85,23 @@ expectmatch "$ret" $? "0" ""
|
|||
# expectpart "$($clixon_util_datastore $conf put merge $xml)" 0 ""
|
||||
|
||||
new "datastore get"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^$xml$"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^$xml2$"
|
||||
|
||||
new "datastore put all delete"
|
||||
expectpart "$($clixon_util_datastore $conf put remove "<config/>")" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put remove "")" 0 ""
|
||||
|
||||
new "datastore get"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^<config/>$"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^<${DATASTORE_TOP}/>$"
|
||||
|
||||
new "datastore put all create"
|
||||
ret=$($clixon_util_datastore $conf put create "$xml")
|
||||
expectmatch "$ret" $? "0" ""
|
||||
|
||||
new "datastore get"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^$xml$"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^$xml2$"
|
||||
|
||||
new "datastore put top create"
|
||||
expectpart "$($clixon_util_datastore $conf put create "<config><x/></config>")" 0 "" # error
|
||||
expectpart "$($clixon_util_datastore $conf put create '<x xmlns="urn:example:clixon"/>')" 0 "" # error
|
||||
|
||||
# Single key operations
|
||||
# leaf
|
||||
|
|
@ -110,43 +112,43 @@ new "datastore init"
|
|||
expectpart "$($clixon_util_datastore $conf init)" 0 ""
|
||||
|
||||
new "datastore create leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put create "<config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>")" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put create '<x xmlns="urn:example:clixon"><y><a>1</a><b>3</b><c>newentry</c></y></x>')" 0 ""
|
||||
|
||||
new "datastore create leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put create '<config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>')" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put create '<x xmlns="urn:example:clixon"><y><a>1</a><b>3</b><c>newentry</c></y></x>')" 0 ""
|
||||
|
||||
new "datastore delete leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put delete '<config><x><y><a>1</a><b>3</b></y></x></config>')" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put delete '<x xmlns="urn:example:clixon"><y><a>1</a><b>3</b></y></x>')" 0 ""
|
||||
|
||||
new "datastore replace leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put create '<config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>')" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put create '<x xmlns="urn:example:clixon"><y><a>1</a><b>3</b><c>newentry</c></y></x>')" 0 ""
|
||||
|
||||
new "datastore remove leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put remove '<config><x><g/></x></config>')" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put remove '<x xmlns="urn:example:clixon"><g/></x>')" 0 ""
|
||||
|
||||
new "datastore remove leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put remove '<config><x><y><a>1</a><b>3</b><c/></y></x></config>')" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put remove '<x xmlns="urn:example:clixon"><y><a>1</a><b>3</b><c/></y></x>')" 0 ""
|
||||
|
||||
new "datastore delete leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put delete '<config><x><g/></x></config>')" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put delete '<x xmlns="urn:example:clixon"><g/></x>')" 0 ""
|
||||
|
||||
new "datastore merge leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put merge '<config><x><g>nalle</g></x></config>')" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put merge '<x xmlns="urn:example:clixon"><g>nalle</g></x>')" 0 ""
|
||||
|
||||
new "datastore replace leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put replace '<config><x><g>nalle</g></x></config>')" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put replace '<x xmlns="urn:example:clixon"><g>nalle</g></x>')" 0 ""
|
||||
|
||||
new "datastore merge leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put merge '<config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>')" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put merge '<x xmlns="urn:example:clixon"><y><a>1</a><b>3</b><c>newentry</c></y></x>')" 0 ""
|
||||
|
||||
new "datastore replace leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put replace '<config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>')" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put replace '<x xmlns="urn:example:clixon"><y><a>1</a><b>3</b><c>newentry</c></y></x>')" 0 ""
|
||||
|
||||
new "datastore create leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put create '<config><x><h><j>aaa</j></h></x></config>')" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put create '<x xmlns="urn:example:clixon"><h><j>aaa</j></h></x>')" 0 ""
|
||||
|
||||
new "datastore create leaf"
|
||||
expectpart "$($clixon_util_datastore $conf put create '<config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>')" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put create '<x xmlns="urn:example:clixon"><y><a>1</a><b>3</b><c>newentry</c></y></x>')" 0 ""
|
||||
|
||||
new "datastore other db init"
|
||||
expectpart "$($clixon_util_datastore -d kalle -b $mydir -y $dir/ietf-ip.yang init)" 0 ""
|
||||
|
|
@ -166,3 +168,6 @@ rm -rf $mydir
|
|||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ EOF
|
|||
)
|
||||
|
||||
function testrun(){
|
||||
new "test params: -f $cfg -- -U"
|
||||
new "test params: -f $cfg -- -U" # -U : upgrade
|
||||
# Bring your own backend
|
||||
if [ $BE -ne 0 ]; then
|
||||
# kill old backend (if any)
|
||||
|
|
@ -116,7 +116,7 @@ function testrun(){
|
|||
# Create startup db of "old" db with incorrect augment namespace tagging
|
||||
# without modstate
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<x xmlns="urn:example:a">
|
||||
<y>
|
||||
<z>
|
||||
|
|
@ -126,10 +126,13 @@ cat <<EOF > $dir/startup_db
|
|||
</x>
|
||||
<remove_me xmlns="urn:example:a"><k>This node is obsolete</k></remove_me>
|
||||
<remove_me xmlns="urn:example:a"><k>this too</k></remove_me>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
new "general-purpose upgrade without modstate"
|
||||
testrun
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
|
|
|
|||
|
|
@ -72,3 +72,6 @@ rm -rf $dir
|
|||
|
||||
# unset conditional parameters
|
||||
unset make
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -328,4 +328,5 @@ rm -rf $dir
|
|||
unset nr
|
||||
unset clixon_util_path # for other script reusing it
|
||||
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -99,4 +99,5 @@ expectpart "$($clixon_util_path -f $xml1 -y $ydir -p /ex:table/ex:parameter/ex:n
|
|||
rm -rf $dir
|
||||
unset clixon_util_path # for other script reusing it
|
||||
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -138,3 +138,6 @@ rm -rf $dir
|
|||
# unset conditional parameters
|
||||
unset clixon_util_json
|
||||
unset clixon_util_xml
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -197,3 +197,6 @@ rm -rf $dir
|
|||
# unset conditional parameters
|
||||
unset clixon_util_json
|
||||
unset clixon_util_xml
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -158,9 +158,9 @@ fi
|
|||
# From startup 1, only r1, all else should be filled in
|
||||
SXML='<r1 xmlns="urn:example:clixon">99</r1>'
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
$SXML
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
XML='<r1 xmlns="urn:example:clixon">99</r1><r2 xmlns="urn:example:clixon">22</r2><np3 xmlns="urn:example:clixon"><s3>33</s3><np31><s31>31</s31></np31></np3>'
|
||||
|
||||
|
|
@ -186,11 +186,11 @@ sudo chmod 666 $dir/running_db
|
|||
new "Check running no defaults: r1 only"
|
||||
# Running should have only non-defaults, ie only r1 that is set to 99
|
||||
|
||||
moreret=$(diff $dir/running_db <(echo "<config>
|
||||
moreret=$(diff $dir/running_db <(echo "<${DATASTORE_TOP}>
|
||||
$SXML
|
||||
</config>"))
|
||||
</${DATASTORE_TOP}>"))
|
||||
if [ $? -ne 0 ]; then
|
||||
err "<config>$SXML</config>" "$moreret"
|
||||
err "<${DATASTORE_TOP}>$SXML</${DATASTORE_TOP}>" "$moreret"
|
||||
fi
|
||||
|
||||
new "Change default value r2"
|
||||
|
|
@ -201,12 +201,12 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><commit/></rpc>]]>]]>" "
|
|||
|
||||
new "Check running no defaults: r1 and r2"
|
||||
# Again, running should have only non-defaults, ie only r1 and r2
|
||||
moreret=$(diff $dir/running_db <(echo "<config>
|
||||
moreret=$(diff $dir/running_db <(echo "<${DATASTORE_TOP}>
|
||||
$SXML
|
||||
<r2 xmlns=\"urn:example:clixon\">88</r2>
|
||||
</config>"))
|
||||
</${DATASTORE_TOP}>"))
|
||||
if [ $? -ne 0 ]; then
|
||||
err "<config>$SXML<r2 xmlns=\"urn:example:clixon\">88</r2></config>" "$moreret"
|
||||
err "<${DATASTORE_TOP}>$SXML<r2 xmlns=\"urn:example:clixon\">88</r2></${DATASTORE_TOP}>" "$moreret"
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
|
|
@ -218,9 +218,9 @@ fi
|
|||
|
||||
# From startup 2, only presence p4, s4/np5 should be filled in
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<p4 xmlns="urn:example:clixon"></p4>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
XML='<r1 xmlns="urn:example:clixon">11</r1><r2 xmlns="urn:example:clixon">22</r2><np3 xmlns="urn:example:clixon"><s3>33</s3><np31><s31>31</s31></np31></np3><p4 xmlns="urn:example:clixon"><s4>44</s4><np45><s5>45</s5></np45></p4>'
|
||||
if [ $BE -ne 0 ]; then
|
||||
|
|
@ -248,9 +248,9 @@ fi
|
|||
|
||||
# Only single x list element
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<xs-config xmlns="urn:example:clixon"><x><name>a</name></x></xs-config>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
XML='<r1 xmlns="urn:example:clixon">11</r1><r2 xmlns="urn:example:clixon">22</r2><np3 xmlns="urn:example:clixon"><s3>33</s3><np31><s31>31</s31></np31></np3>'
|
||||
if [ $BE -ne 0 ]; then
|
||||
|
|
@ -277,3 +277,6 @@ if [ -z "$pid" ]; then
|
|||
fi
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -187,17 +187,18 @@ expectpart "$($clixon_cli -1f $cfg -l o set sender a)" 0 "^$"
|
|||
new "cli sender template"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set sender b template a)" 0 "^$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -264,17 +264,19 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><validate><source><candi
|
|||
new "netconf discard-changes"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
fi
|
||||
if [ $BE -ne 0 ]; then
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -175,17 +175,18 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get content=\"nonconfig
|
|||
new "netconf get / config-only ok"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get content=\"config\"><filter type=\"xpath\" select=\"/\"/></get></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><sender-config xmlns=\"urn:example:example\"><name>y</name></sender-config></data></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -245,17 +245,18 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS $DEFAULTNS><edit-config>
|
|||
new "minmax: validate should fail empty list"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>protocol</error-type><error-tag>operation-failed</error-tag><error-app-tag>too-few-elements</error-app-tag><error-severity>error</error-severity><error-path>/c/a1</error-path></rpc-error></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -191,20 +191,21 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -231,3 +231,6 @@ rm -rf $dir
|
|||
|
||||
# unset conditional parameters
|
||||
unset clixon_util_socket
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -321,20 +321,21 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ EOF
|
|||
|
||||
# Set initial NACM rules in startup enabling admin and a single param config
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<table xmlns="urn:example:nacm">
|
||||
<parameters>
|
||||
<parameter>
|
||||
|
|
@ -86,7 +86,7 @@ cat <<EOF > $dir/startup_db
|
|||
$NGROUPS
|
||||
$NADMIN
|
||||
</nacm>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
new "test params: -f $cfg"
|
||||
|
|
@ -171,3 +171,6 @@ fi
|
|||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -303,3 +303,6 @@ fi
|
|||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -301,3 +301,6 @@ fi
|
|||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ EOF
|
|||
|
||||
# Use startup or set values with POST (below)
|
||||
if [ $db = startup ]; then
|
||||
sudo echo "<config>$NACM$XML</config>" > $dir/startup_db
|
||||
sudo echo "<${DATASTORE_TOP}>$NACM$XML</${DATASTORE_TOP}>" > $dir/startup_db
|
||||
fi
|
||||
|
||||
if [ $BE -ne 0 ]; then # Bring your own backend
|
||||
|
|
|
|||
|
|
@ -216,20 +216,21 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -259,20 +259,21 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -261,20 +261,21 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -227,20 +227,21 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -304,17 +304,18 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><client-rpc xmlns=\"urn:
|
|||
new "netconf extra leaf in leaf should fail"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"><interface><name>e0<name>e1</name></name></interface></interfaces></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>unknown-element</error-tag><error-info><bad-element>name</bad-element></error-info><error-severity>error</error-severity><error-message>Failed to find YANG spec of XML node: name with parent: name in namespace: urn:ietf:params:xml:ns:yang:ietf-interfaces</error-message></rpc-error></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -80,17 +80,18 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get><filter type='xpath
|
|||
new "get xpath one"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get><filter type='xpath' select=\"/fi:x/fi:y[fi:a='1']\" xmlns:fi='urn:example:filter' /></get></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><x xmlns=\"urn:example:filter\"><y><a>1</a><b>1</b></y></x></data></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -149,3 +149,5 @@ fi
|
|||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -59,8 +59,9 @@ EOF
|
|||
|
||||
new "test params: -f $cfg -s startup"
|
||||
|
||||
echo '<config><ex:x xmlns:ex="urn:example:whitespace">
|
||||
<ex:y> <ex:a>foo</ex:a>\n <ex:b> </ex:b></ex:y> </ex:x></config></edit-config></rpc>]]>]]>$start</config>' > $dir/startup_db
|
||||
# Keep the following as is (whitespace)
|
||||
echo "<${DATASTORE_TOP}><ex:x xmlns:ex=\"urn:example:whitespace\">
|
||||
<ex:y> <ex:a>foo</ex:a>\n <ex:b> </ex:b></ex:y> </ex:x></${DATASTORE_TOP}>" > $dir/startup_db
|
||||
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "kill old backend"
|
||||
|
|
@ -137,17 +138,18 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><validate><source><candi
|
|||
new "netconf discard-changes"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -161,3 +161,5 @@ fi
|
|||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ EOF
|
|||
rm -f $dbdir/candidate_db
|
||||
# alt
|
||||
cat <<EOF > $dbdir/running_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<y0 xmlns="urn:example:order">d</y0>
|
||||
<y1 xmlns="urn:example:order">d</y1>
|
||||
<y2 xmlns="urn:example:order"><k>d</k><a>bar</a></y2>
|
||||
|
|
@ -148,7 +148,7 @@ cat <<EOF > $dbdir/running_db
|
|||
<y3 xmlns="urn:example:order"><k>c</k><a>bar</a></y3>
|
||||
<y2 xmlns="urn:example:order"><k>b</k><a>bar</a></y2>
|
||||
<y3 xmlns="urn:example:order"><k>b</k><a>bar</a></y3>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
new "test params: -s running -f $cfg -- -s"
|
||||
|
|
@ -391,20 +391,21 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><ca
|
|||
new "check ordered-by-user: e,a,71,b,42,c,d"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><y2 xmlns=\"urn:example:order\"><k>e</k><a>bar</a></y2><y2 xmlns=\"urn:example:order\"><k>a</k><a>foo</a></y2><y2 xmlns=\"urn:example:order\"><k>71</k><a>fie</a></y2><y2 xmlns=\"urn:example:order\"><k>b</k><a>bar</a></y2><y2 xmlns=\"urn:example:order\"><k>42</k><a>fum</a></y2><y2 xmlns=\"urn:example:order\"><k>c</k><a>foo</a></y2><y2 xmlns=\"urn:example:order\"><k>d</k><a>fie</a></y2></data></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
# unset conditional parameters
|
||||
unset format
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -824,3 +824,6 @@ rm -rf $dir
|
|||
|
||||
# unset conditional parameters
|
||||
unset regex
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -149,22 +149,23 @@ expecteof "time -p $clixon_netconf -qf $cfg" 0 "<rpc><commit/></rpc>]]>]]>" "^<r
|
|||
|
||||
# XXX No leafref cli tests
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
# unset conditional parameters
|
||||
unset format
|
||||
unset perfnr
|
||||
unset perfreq
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -70,11 +70,11 @@ function testrun(){
|
|||
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "generate config with $nr list entries"
|
||||
echo -n "<config><x xmlns=\"urn:example:clixon\">" > $dir/startup_db
|
||||
echo -n "<${DATASTORE_TOP}><x xmlns=\"urn:example:clixon\">" > $dir/startup_db
|
||||
for (( i=0; i<$nr; i++ )); do
|
||||
echo -n "<y><a>$i</a><b>$i</b></y>" >> $dir/startup_db
|
||||
done
|
||||
echo "</x></config>" >> $dir/startup_db
|
||||
echo "</x></${DATASTORE_TOP}>" >> $dir/startup_db
|
||||
|
||||
new "kill old backend"
|
||||
sudo clixon_backend -zf $cfg
|
||||
|
|
@ -173,5 +173,7 @@ b:
|
|||
childvec: 8
|
||||
(ns-cache: 115) # only in startup?
|
||||
|
||||
|
||||
fi
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -191,22 +191,23 @@ expecteof "time -p $clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><commit/></rpc>]
|
|||
new "netconf get large leaf-list config"
|
||||
expecteof "time -p $clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><x xmlns=\"urn:example:clixon\"><c>0</c><c>1</c>" 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
# unset conditional parameters
|
||||
unset format
|
||||
unset perfnr
|
||||
unset perfreq
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -197,19 +197,17 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
# Set by restconf_config
|
||||
|
|
@ -219,3 +217,6 @@ unset RESTCONFIG
|
|||
unset format
|
||||
unset perfnr
|
||||
unset perfreq
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -163,3 +163,6 @@ rm -rf $dir
|
|||
|
||||
# unset conditional parameters
|
||||
unset perfnr
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -196,19 +196,17 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
# unset conditional parameters
|
||||
|
|
@ -219,3 +217,5 @@ unset perfreq
|
|||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -208,5 +208,5 @@ unset format
|
|||
unset perfnr
|
||||
unset perfreq
|
||||
|
||||
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -30,3 +30,5 @@ rm -rf $dir
|
|||
unset clixon_util_xml
|
||||
unset perfnr
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -134,3 +134,6 @@ new "Start as non-privileged, try to drop (but fail)"
|
|||
testrun $(whoami) $BUSER $BUSER drop_perm 1
|
||||
|
||||
sudo rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -414,3 +414,6 @@ unset RESTCONFIG
|
|||
unset RESTCONFIG1
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -208,20 +208,21 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ EOF
|
|||
|
||||
# NACM rules and top/ config
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm">
|
||||
<enable-nacm>true</enable-nacm>
|
||||
<read-default>deny</read-default>
|
||||
|
|
@ -163,7 +163,7 @@ cat <<EOF > $dir/startup_db
|
|||
<anonymous>42</anonymous>
|
||||
<wilma>71</wilma>
|
||||
</top>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Restconf auth test with arguments:
|
||||
|
|
@ -316,3 +316,6 @@ unset MSGERR1
|
|||
unset MSGERR2
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -245,20 +245,21 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -256,20 +256,21 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -171,20 +171,21 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ NACM0="<nacm xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-acm\">
|
|||
"
|
||||
|
||||
cat<<EOF > $startupdb
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
$NACM0
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# An extra testmodule that includes nacm
|
||||
|
|
@ -158,9 +158,9 @@ fi
|
|||
|
||||
# Restart
|
||||
cat<<EOF > $startupdb
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
$NACM0
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "kill old backend"
|
||||
|
|
@ -270,3 +270,6 @@ fi
|
|||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -42,6 +42,17 @@ cat <<EOF > $cfg
|
|||
</clixon-config>
|
||||
EOF
|
||||
|
||||
cat <<EOF > $dir/example.yang
|
||||
module example {
|
||||
namespace "urn:example:clixon";
|
||||
prefix ex;
|
||||
revision 2021-03-05;
|
||||
leaf val{
|
||||
type string;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Subroutine send a process control RPC and tricks to echo process-id returned
|
||||
# Args:
|
||||
# 1: operation
|
||||
|
|
@ -101,11 +112,11 @@ EOF
|
|||
new "ENABLE true"
|
||||
# First basic operation with restconf enable is true
|
||||
cat<<EOF > $startupdb
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<restconf xmlns="http://clicon.org/restconf">
|
||||
<enable>true</enable>
|
||||
</restconf>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
new "kill old restconf"
|
||||
|
|
@ -273,11 +284,11 @@ fi
|
|||
new "ENABLE false"
|
||||
# Second basic operation with restconf enable is false
|
||||
cat<<EOF > $startupdb
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<restconf xmlns="http://clicon.org/restconf">
|
||||
<enable>false</enable>
|
||||
</restconf>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
new "kill old restconf"
|
||||
|
|
@ -320,7 +331,7 @@ pid=$(testrpc status 1)
|
|||
if [ $? -ne 0 ]; then echo "$pid";exit -1; fi
|
||||
|
||||
# Edit a field, eg debug
|
||||
new "Edit a field via restconf"
|
||||
new "Edit a restconf field via restconf"
|
||||
expectpart "$(curl $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json" $RCPROTO://localhost/restconf/data/clixon-restconf:restconf/debug -d '{"clixon-restconf:debug":1}' )" 0 "HTTP/1.1 201 Created"
|
||||
|
||||
new "check status RPC new pid"
|
||||
|
|
@ -331,6 +342,18 @@ if [ $pid -eq $pid1 ]; then
|
|||
err "A different pid" "Same pid: $pid"
|
||||
fi
|
||||
|
||||
new "Edit a non-restconf field via restconf"
|
||||
echo "curl $CURLOPTS -X POST -H \"Content-Type: application/yang-data+json\" $RCPROTO://localhost/restconf/data -d '{\"example:val\":\"xyz\"}'"
|
||||
|
||||
expectpart "$(curl $CURLOPTS -X POST -H "Content-Type: application/yang-data+json" $RCPROTO://localhost/restconf/data -d '{"example:val":"xyz"}' )" 0 "HTTP/1.1 201 Created"
|
||||
|
||||
new "check status RPC same pid"
|
||||
pid2=$(testrpc status 1)
|
||||
if [ $? -ne 0 ]; then echo "$pid2";exit -1; fi
|
||||
if [ $pid1 -ne $pid2 ]; then
|
||||
err "Same pid $pid1" "$pid2"
|
||||
fi
|
||||
|
||||
new "Disable restconf"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><default-operation>merge</default-operation><target><candidate/></target><config><restconf xmlns=\"http://clicon.org/restconf\"><enable>false</enable></restconf></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
|
|
|
|||
|
|
@ -166,9 +166,9 @@ EOF
|
|||
function testrun()
|
||||
{
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
$RULES
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "kill old backend"
|
||||
|
|
|
|||
|
|
@ -135,3 +135,6 @@ fi
|
|||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -188,20 +188,21 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -96,4 +96,5 @@ rm -rf $dir
|
|||
unset nr
|
||||
unset clixon_util_path # for other script reusing it
|
||||
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -94,3 +94,6 @@ rm -rf $dir
|
|||
|
||||
# unset conditional parameters
|
||||
unset clixon_util_socket
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ function testrun(){
|
|||
exprun=$5 # expected running_db after startup
|
||||
|
||||
sudo rm -f $dir/*_db
|
||||
echo "<config>$rdb</config>" > $dir/running_db
|
||||
echo "<config>$sdb</config>" > $dir/startup_db
|
||||
echo "<config>$edb</config>" > $dir/extra_db
|
||||
echo "<${DATASTORE_TOP}>$rdb</${DATASTORE_TOP}>" > $dir/running_db
|
||||
echo "<${DATASTORE_TOP}>$sdb</${DATASTORE_TOP}>" > $dir/startup_db
|
||||
echo "<${DATASTORE_TOP}>$edb</${DATASTORE_TOP}>" > $dir/extra_db
|
||||
|
||||
if [ $BE -ne 0 ]; then # Bring your own backend
|
||||
# kill old backend (if any)
|
||||
|
|
@ -118,9 +118,9 @@ function testfail(){
|
|||
|
||||
sudo rm -f $dir/*_db
|
||||
|
||||
echo "<config>$rdb</config>" > $dir/running_db
|
||||
echo "<config>$sdb</config>" > $dir/startup_db
|
||||
echo "<config>$edb</config>" > $dir/extra_db
|
||||
echo "<${DATASTORE_TOP}>$rdb</${DATASTORE_TOP}>" > $dir/running_db
|
||||
echo "<${DATASTORE_TOP}>$sdb</${DATASTORE_TOP}>" > $dir/startup_db
|
||||
echo "<${DATASTORE_TOP}>$edb</${DATASTORE_TOP}>" > $dir/extra_db
|
||||
|
||||
# kill old backend (if any)
|
||||
new "kill old backend"
|
||||
|
|
@ -138,20 +138,20 @@ function testfail(){
|
|||
sudo chmod 666 $dir/running_db
|
||||
sudo chmod 666 $dir/startup_db
|
||||
new "Checking running unchanged"
|
||||
ret=$(diff $dir/running_db <(echo "<config>$rdb</config>"))
|
||||
ret=$(diff $dir/running_db <(echo "<${DATASTORE_TOP}>$rdb</${DATASTORE_TOP}>"))
|
||||
if [ $? -ne 0 ]; then
|
||||
err "<config>$rdb</config>" "$ret"
|
||||
err "<${DATASTORE_TOP}>$rdb</${DATASTORE_TOP}>" "$ret"
|
||||
fi
|
||||
new "Checking startup unchanged"
|
||||
ret=$(diff $dir/startup_db <(echo "<config>$sdb</config>"))
|
||||
ret=$(diff $dir/startup_db <(echo "<${DATASTORE_TOP}>$sdb</${DATASTORE_TOP}>"))
|
||||
if [ $? -ne 0 ]; then
|
||||
err "<config>$sdb</config>" "$ret"
|
||||
err "<${DATASTORE_TOP}>$sdb</${DATASTORE_TOP}>" "$ret"
|
||||
fi
|
||||
|
||||
new "Checking extra unchanged"
|
||||
ret=$(diff $dir/extra_db <(echo "<config>$edb</config>"))
|
||||
ret=$(diff $dir/extra_db <(echo "<${DATASTORE_TOP}>$edb</${DATASTORE_TOP}>"))
|
||||
if [ $? -ne 0 ]; then
|
||||
err "<config>$edb</config>" "$ret"
|
||||
err "<${DATASTORE_TOP}>$edb</${DATASTORE_TOP}>" "$ret"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -190,3 +190,6 @@ rm -rf $dir
|
|||
|
||||
# unset conditional parameters
|
||||
unset format
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -253,21 +253,22 @@ if [ $RC -ne 0 ]; then
|
|||
stop_restconf
|
||||
fi
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
sudo pkill -u root -f clixon_backend
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
sudo pkill -u root -f clixon_backend
|
||||
|
||||
# Set by restconf_config
|
||||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -305,19 +305,20 @@ for op in begin validate complete commit commit_done end; do
|
|||
let line++
|
||||
done
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
unset nr
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -131,19 +131,20 @@ done
|
|||
new "Send restart to nonexistatn plugin expect fail"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><restart-plugin xmlns=\"http://clicon.org/lib\"><plugin>xxx</plugin></restart-plugin></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>bad-element</error-tag><error-info><bad-element>plugin</bad-element></error-info><error-severity>error</error-severity><error-message>No such plugin</error-message></rpc-error></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
unset nr
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -679,3 +679,6 @@ testrun cache
|
|||
testrun cache-zerocopy
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -335,3 +335,6 @@ rm -rf $dir
|
|||
|
||||
# unset conditional parameters
|
||||
unset format
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -100,17 +100,18 @@ expectpart "$($clixon_cli -1f $cfg -l o set c ulle 33)" 0 "^$"
|
|||
new "cli set transitive union error"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c ulle kalle)" 255 "^CLI syntax error: \"set c ulle kalle\": 'kalle' is not a number$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -209,17 +209,18 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><validate><source><candi
|
|||
new "netconf discard-changes"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -126,17 +126,17 @@ EOF
|
|||
|
||||
# Create failsafe db
|
||||
cat <<EOF > $dir/failsafe_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<system xmlns="urn:example:a">
|
||||
<a>Failsafe</a>
|
||||
</system>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Create startup db revision example-a and example-b 2017-12-01
|
||||
# this should be automatically upgraded to 2017-12-20
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -162,7 +162,7 @@ cat <<EOF > $dir/startup_db
|
|||
<system-b xmlns="urn:example:b">
|
||||
<b>Obsolete</b>
|
||||
</system-b>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Wanted new XML
|
||||
|
|
@ -270,6 +270,9 @@ if [ $BE -ne 0 ]; then
|
|||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
fi
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -112,15 +112,15 @@ EOF
|
|||
|
||||
# Create failsafe db
|
||||
cat <<EOF > $dir/failsafe_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<a1 xmlns="urn:example:a">always work</a1>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Create compatible startup db
|
||||
# startup config XML with following
|
||||
cat <<EOF > $dir/compat-valid.xml
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -136,13 +136,13 @@ cat <<EOF > $dir/compat-valid.xml
|
|||
</modules-state>
|
||||
<a1 xmlns="urn:example:a">always work</a1>
|
||||
<b xmlns="urn:example:b">other text</b>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Create compatible startup db
|
||||
# startup config XML with following
|
||||
cat <<EOF > $dir/compat-invalid.xml
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -160,7 +160,7 @@ cat <<EOF > $dir/compat-invalid.xml
|
|||
<a1 xmlns="urn:example:a">always work</a1>
|
||||
<b xmlns="urn:example:b">other text</b>
|
||||
<c xmlns="urn:example:c">bla bla</c>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ EOF
|
|||
# startup config XML with following (A obsolete, B OK, C lacking)
|
||||
# But XML is OK
|
||||
cat <<EOF > $dir/non-compat-valid.xml
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -189,13 +189,13 @@ cat <<EOF > $dir/non-compat-valid.xml
|
|||
</modules-state>
|
||||
<a1 xmlns="urn:example:a">always work</a1>
|
||||
<b xmlns="urn:example:b">other text</b>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Create non-compat startup db
|
||||
# startup config XML with following (A obsolete, B OK, C lacking)
|
||||
cat <<EOF > $dir/non-compat-invalid.xml
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -218,12 +218,12 @@ cat <<EOF > $dir/non-compat-invalid.xml
|
|||
<a1 xmlns="urn:example:a">always work</a1>
|
||||
<b xmlns="urn:example:b">other text</b>
|
||||
<c xmlns="urn:example:c">bla bla</c>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Compatible startup with syntax errors
|
||||
cat <<EOF > $dir/compat-err.xml
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -239,7 +239,7 @@ cat <<EOF > $dir/compat-err.xml
|
|||
</modules-state>
|
||||
<<a3 xmlns="urn:example:a">always work</a2>
|
||||
<b xmlns="urn:example:b">other text
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
#! Start system in given mode and check database contents
|
||||
|
|
@ -365,6 +365,8 @@ new "8. Load non-compat startup. Syntax fail, enter failsafe, startup invalid"
|
|||
runtest true 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 # valgrindtest
|
||||
|
||||
if [ $BE -ne 0 ]; then
|
||||
rm -rf $dir
|
||||
fi
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ EOF
|
|||
# Create startup db revision from 2014-05-08 to be upgraded to 2018-02-20
|
||||
# This is 2014 syntax
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -226,7 +226,7 @@ cat <<EOF > $dir/startup_db
|
|||
<admin-status>testing</admin-status>
|
||||
</interface>
|
||||
</interfaces-state>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Create configuration
|
||||
|
|
@ -292,7 +292,7 @@ testrun "$XML"
|
|||
|
||||
# This is "2016" syntax
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -336,7 +336,7 @@ cat <<EOF > $dir/startup_db
|
|||
<admin-status>testing</admin-status>
|
||||
</interface>
|
||||
</interfaces-state>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# 2. Upgrade from intermediate 2016-01-01 to 2018-02-20
|
||||
|
|
@ -345,7 +345,7 @@ testrun "$XML"
|
|||
|
||||
# Again 2014 syntax
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -383,7 +383,7 @@ cat <<EOF > $dir/startup_db
|
|||
<admin-status>testing</admin-status>
|
||||
</interface>
|
||||
</interfaces-state>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
|
||||
EOF
|
||||
rm $if2018
|
||||
|
|
@ -397,7 +397,9 @@ testrun "$XML"
|
|||
#new "4. No model at all"
|
||||
#testrun "$XML"
|
||||
|
||||
if [ $BE -ne 0 ]; then
|
||||
rm -rf $dir
|
||||
fi
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -81,26 +81,26 @@ function createstartups()
|
|||
|
||||
# no : there is no modstate in the file (1)
|
||||
cat <<EOF > $dir/startup1.xml
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
$payload
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Create startup datastore:
|
||||
# - : there is modstate but module is not present (2)
|
||||
cat <<EOF > $dir/startup2.xml
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
</modules-state>
|
||||
$payload
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Create startup datastore:
|
||||
# <Y : there is modstate and revision is less than Y (3)
|
||||
cat <<EOF > $dir/startup3.xml
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -110,13 +110,13 @@ EOF
|
|||
</module>
|
||||
</modules-state>
|
||||
$payload
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Create startup datastore:
|
||||
# =Y : there is modstate and revision is exactly Y (4)
|
||||
cat <<EOF > $dir/startup4.xml
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -126,13 +126,13 @@ EOF
|
|||
</module>
|
||||
</modules-state>
|
||||
$payload
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Create startup datastore:
|
||||
# >Y : there is modstate and revision is exactly Y (5)
|
||||
cat <<EOF > $dir/startup5.xml
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -142,7 +142,7 @@ EOF
|
|||
</module>
|
||||
</modules-state>
|
||||
$payload
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
}
|
||||
|
||||
|
|
@ -313,3 +313,5 @@ testall '' ''
|
|||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ EOF
|
|||
# Create startup db revision from 2014-05-08 to be upgraded to 2018-02-20
|
||||
# This is 2014 syntax
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -233,7 +233,7 @@ cat <<EOF > $dir/startup_db
|
|||
<admin-status>testing</admin-status>
|
||||
</interface>
|
||||
</interfaces-state>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Create configuration
|
||||
|
|
@ -260,7 +260,7 @@ EOF
|
|||
|
||||
# This is 2014 syntax
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -298,7 +298,7 @@ cat <<EOF > $dir/startup_db
|
|||
<admin-status>testing</admin-status>
|
||||
</interface>
|
||||
</interfaces-state>
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
MODSTATE1='<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library"><module-set-id>0</module-set-id><module><name>clixon-lib</name><revision>2020-12-30</revision><namespace>http://clicon.org/lib</namespace></module>'
|
||||
|
|
@ -307,7 +307,7 @@ MODSTATE2='<module><name>interfaces</name><revision>2018-02-20</revision><namesp
|
|||
|
||||
XML='<interfaces xmlns="urn:example:interfaces"><interface><name>e0</name><docs><descr>First interface</descr></docs><type>eth</type><admin-status>up</admin-status><statistics><in-octets>54326.432</in-octets><in-unicast-pkts>8458765</in-unicast-pkts></statistics></interface><interface><name>e1</name><type>eth</type><admin-status>down</admin-status></interface></interfaces>'
|
||||
|
||||
ALL="<config>$MODSTATE$XML</config>"
|
||||
ALL="<${DATASTORE_TOP}>$MODSTATE$XML</${DATASTORE_TOP}>"
|
||||
|
||||
# -u means trigger example upgrade
|
||||
|
||||
|
|
@ -341,4 +341,5 @@ fi
|
|||
|
||||
rm -rf $dir
|
||||
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -73,15 +73,15 @@ EOF
|
|||
|
||||
# Create failsafe db
|
||||
cat <<EOF > $dir/failsafe_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
$SAMEXML
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
# Create non-compat startup db
|
||||
# startup config XML with following (A obsolete, B OK, C lacking)
|
||||
cat <<EOF > $dir/non-compat-invalid.xml
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
<modules-state xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
|
||||
<module-set-id>42</module-set-id>
|
||||
<module>
|
||||
|
|
@ -92,7 +92,7 @@ cat <<EOF > $dir/non-compat-invalid.xml
|
|||
</modules-state>
|
||||
$OLDXML
|
||||
$SAMEXML
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
|
||||
(cd $dir; rm -f tmp_db candidate_db running_db startup_db) # remove databases
|
||||
|
|
@ -147,7 +147,9 @@ if [ $BE -ne 0 ]; then
|
|||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
fi
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -128,3 +128,5 @@ stop_backend -f $cfg
|
|||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -140,17 +140,18 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><ca
|
|||
new "must: eth validate fail"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>operation-failed</error-tag><error-severity>error</error-severity><error-message>An Ethernet MTU must be 1500</error-message></rpc-error></rpc-reply>]]>]]>"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -101,17 +101,18 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><ca
|
|||
new "Check config (Clixon supports explicit)"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data>$EXPLICIT</data></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -179,9 +179,10 @@ EOF
|
|||
)
|
||||
expecteof "$clixon_util_xml -o" 0 "$XML" '^<bk:book xmlns:bk="urn:loc.gov:books" xmlns:isbn="urn:ISBN:0-395-36341-6"><bk:title>Cheaper by the Dozen</bk:title><isbn:number>1568491379</isbn:number></bk:book>$'
|
||||
|
||||
endtest
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
# unset conditional parameters
|
||||
unset clixon_util_xml
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -125,3 +125,6 @@ rm -rf $dir
|
|||
|
||||
# unset conditional parameters
|
||||
unset clixon_util_xml_mod
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -49,3 +49,6 @@ rm -rf $dir
|
|||
|
||||
# unset conditional parameters
|
||||
unset clixon_util_xml
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -230,3 +230,6 @@ rm -rf $dir
|
|||
|
||||
# unset conditional parameters
|
||||
unset clixon_util_xpath
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -66,3 +66,6 @@ rm -rf $dir
|
|||
|
||||
# unset conditional parameters
|
||||
unset clixon_util_xpath
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -186,3 +186,6 @@ if [ $BE -ne 0 ]; then
|
|||
fi
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -293,3 +293,6 @@ fi
|
|||
stop_backend -f "$cfg"
|
||||
|
||||
rm -rf "$dir"
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -155,9 +155,9 @@ EOF
|
|||
# Only positive startup test, ie dont add XMLU if unknown not treated as anyxml
|
||||
# and check for errors
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<${DATASTORE_TOP}>
|
||||
$XML
|
||||
</config>
|
||||
</${DATASTORE_TOP}>
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
|
@ -283,3 +283,6 @@ testrun true true
|
|||
unset RESTCONFIG
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
|
|
@ -156,3 +156,6 @@ new "JSON Add any on top"
|
|||
expectpart "$($clixon_util_xml -Jvy $fyang -f $fjson)" 0 '^$'
|
||||
|
||||
rm -rf $dir
|
||||
|
||||
new "endtest"
|
||||
endtest
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue