fixed datastore cache
This commit is contained in:
parent
e169485985
commit
14faf93eec
7 changed files with 173 additions and 173 deletions
|
|
@ -1,88 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Scaling test
|
||||
|
||||
if [ $# = 0 ]; then
|
||||
number=1000
|
||||
req=10
|
||||
elif [ $# = 1 ]; then
|
||||
number=$1
|
||||
req=10
|
||||
elif [ $# = 2 ]; then
|
||||
number=$1
|
||||
req=$2
|
||||
else
|
||||
echo "Usage: $0 [<number> [<requests>]]"
|
||||
exit 1
|
||||
fi
|
||||
rnd=$(( ( RANDOM % $number ) ))
|
||||
|
||||
fyang=/tmp/scaling.yang
|
||||
db=/tmp/text/candidate_db
|
||||
name=text
|
||||
dir=/tmp/text
|
||||
conf="-d candidate -b $dir -p ../datastore/$name/$name.so -y /tmp -m ietf-ip"
|
||||
|
||||
# include err() and new() functions
|
||||
. ./lib.sh
|
||||
clixon_cf=/tmp/scaling-conf.xml
|
||||
|
||||
|
||||
# For memcheck
|
||||
# clixon_netconf="valgrind --leak-check=full --show-leak-kinds=all clixon_netconf"
|
||||
# clixon_netconf="valgrind --tool=callgrind clixon_netconf
|
||||
clixon_netconf=clixon_netconf
|
||||
|
||||
|
||||
cat <<EOF > $fyang
|
||||
module example{
|
||||
container x {
|
||||
list y {
|
||||
key "a";
|
||||
leaf a {
|
||||
type string;
|
||||
}
|
||||
leaf b {
|
||||
type string;
|
||||
}
|
||||
}
|
||||
leaf-list c {
|
||||
type string;
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
cat <<EOF > $clixon_cf
|
||||
<config>
|
||||
<CLICON_CONFIGFILE>/tmp/test_yang.xml</CLICON_CONFIGFILE>
|
||||
<CLICON_YANG_DIR>/usr/local/share/routing/yang</CLICON_YANG_DIR>
|
||||
<CLICON_YANG_MODULE_MAIN>example</CLICON_YANG_MODULE_MAIN>
|
||||
<CLICON_SOCK>/usr/local/var/routing/routing.sock</CLICON_SOCK>
|
||||
<CLICON_BACKEND_PIDFILE>/usr/local/var/routing/routing.pidfile</CLICON_BACKEND_PIDFILE>
|
||||
<CLICON_XMLDB_DIR>/usr/local/var/routing</CLICON_XMLDB_DIR>
|
||||
<CLICON_XMLDB_PLUGIN>/usr/local/lib/xmldb/text.so</CLICON_XMLDB_PLUGIN>
|
||||
</config>
|
||||
EOF
|
||||
|
||||
if [ ! -d $dir ]; then
|
||||
mkdir $dir
|
||||
fi
|
||||
|
||||
echo "datastore_client $conf mget $req /x/y[a=$rnd][b=$rnd]"
|
||||
|
||||
new "generate large list config"
|
||||
echo -n "<config><x>" > $db
|
||||
for (( i=0; i<$number; i++ )); do
|
||||
echo -n "<y><a>$i</a><b>$i</b></y>" >> $db
|
||||
done
|
||||
echo "</x></config>" >> $db
|
||||
|
||||
new "datastore_client $name init"
|
||||
expectfn "datastore_client $conf init" ""
|
||||
|
||||
new "datastore $name mget"
|
||||
expectfn "datastore_client $conf mget 1 /x/y[a=$rnd][b=$rnd]" "^<config><x><y><a>$rnd</a><b>$rnd</b></y></x></config>$"
|
||||
|
||||
new "make $req gets"
|
||||
time datastore_client $conf mget $req "/x/y[a=$rnd][b=$rnd]" > /dev/null
|
||||
|
||||
|
|
@ -1,12 +1,17 @@
|
|||
#!/bin/bash
|
||||
# Scaling test
|
||||
|
||||
number=1000
|
||||
req=100
|
||||
if [ $# = 0 ]; then
|
||||
number=1000
|
||||
elif [ $# = 1 ]; then
|
||||
number=$1
|
||||
elif [ $# = 2 ]; then
|
||||
number=$1
|
||||
req=$2
|
||||
else
|
||||
echo "Usage: $0 [<number>]"
|
||||
echo "Usage: $0 [<number> [<requests>]]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -15,6 +20,7 @@ fconfig=/tmp/config
|
|||
|
||||
# include err() and new() functions
|
||||
. ./lib.sh
|
||||
clixon_cf=/tmp/scaling-conf.xml
|
||||
|
||||
# For memcheck
|
||||
# clixon_netconf="valgrind --leak-check=full --show-leak-kinds=all clixon_netconf"
|
||||
|
|
@ -40,6 +46,19 @@ module ietf-ip{
|
|||
}
|
||||
EOF
|
||||
|
||||
cat <<EOF > $clixon_cf
|
||||
<config>
|
||||
<CLICON_CONFIGFILE>$clixon_cf</CLICON_CONFIGFILE>
|
||||
<CLICON_YANG_DIR>$fyang</CLICON_YANG_DIR>
|
||||
<CLICON_YANG_MODULE_MAIN>ietf-ip</CLICON_YANG_MODULE_MAIN>
|
||||
<CLICON_SOCK>/usr/local/var/routing/routing.sock</CLICON_SOCK>
|
||||
<CLICON_BACKEND_PIDFILE>/usr/local/var/routing/routing.pidfile</CLICON_BACKEND_PIDFILE>
|
||||
<CLICON_XMLDB_DIR>/usr/local/var/routing</CLICON_XMLDB_DIR>
|
||||
<CLICON_XMLDB_PLUGIN>/usr/local/lib/xmldb/text.so</CLICON_XMLDB_PLUGIN>
|
||||
</config>
|
||||
EOF
|
||||
|
||||
|
||||
# kill old backend (if any)
|
||||
new "kill old backend"
|
||||
sudo clixon_backend -zf $clixon_cf -y $fyang
|
||||
|
|
@ -61,26 +80,44 @@ for (( i=0; i<$number; i++ )); do
|
|||
done
|
||||
echo "</x></config></edit-config></rpc>]]>]]>" >> $fconfig
|
||||
|
||||
# Just for manual dbg
|
||||
echo "$clixon_netconf -qf $clixon_cf -y $fyang"
|
||||
|
||||
new "netconf edit large config"
|
||||
expecteof_file "time -p $clixon_netconf -qf $clixon_cf -y $fyang" "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
expecteof_file "time -p $clixon_netconf -qf $clixon_cf -y $fyang" "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
echo '<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>' | $clixon_netconf -qf $clixon_cf -y $fyang
|
||||
|
||||
new "netconf edit large config again"
|
||||
expecteof_file "time -p $clixon_netconf -qf $clixon_cf -y $fyang" "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
expecteof_file "time -p $clixon_netconf -qf $clixon_cf -y $fyang" "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
echo '<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>' | $clixon_netconf -qf $clixon_cf -y $fyang
|
||||
|
||||
rm $fconfig
|
||||
|
||||
new "netconf commit large config"
|
||||
expecteof "time -p $clixon_netconf -qf $clixon_cf -y $fyang" "<rpc><commit><source><candidate/></source></commit></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "netconf add small config"
|
||||
new "netconf add one small config"
|
||||
expecteof "time -p $clixon_netconf -qf $clixon_cf -y $fyang" "<rpc><edit-config><target><candidate/></target><config><x><y><a>x</a><b>y</b></y></x></config></edit-config></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "netconf add $req small config"
|
||||
time -p for (( i=0; i<$req; i++ )); do
|
||||
rnd=$(( ( RANDOM % $number ) ))
|
||||
echo "<rpc><edit-config><target><candidate/></target><config><x><y><a>$rnd</a><b>$rnd</b></y></x></config></edit-config></rpc>]]>]]>"
|
||||
done | $clixon_netconf -qf $clixon_cf -y $fyang > /dev/null
|
||||
|
||||
new "netconf commit small config"
|
||||
expecteof "time -p $clixon_netconf -qf $clixon_cf -y $fyang" "<rpc><commit><source><candidate/></source></commit></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "netconf get large config"
|
||||
expecteof "time -p $clixon_netconf -qf $clixon_cf -y $fyang" "<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply><data><x><y><a>0</a><b>0</b></y><y><a>1</a><b>1</b>"
|
||||
|
||||
new "netconf get $req small config"
|
||||
time -p for (( i=0; i<$req; i++ )); do
|
||||
rnd=$(( ( RANDOM % $number ) ))
|
||||
echo "<rpc><get-config><source><candidate/></source><filter type=\"xpath\" select=\"/x/y[a=$rnd][b=$rnd]\" /></get-config></rpc>]]>]]>"
|
||||
done | $clixon_netconf -qf $clixon_cf -y $fyang > /dev/null
|
||||
|
||||
new "generate large leaf-list config"
|
||||
echo -n "<rpc><edit-config><target><candidate/></target><default-operation>replace</default-operation><config><x>" > $fconfig
|
||||
|
|
|
|||
|
|
@ -128,13 +128,12 @@ expecteof "$clixon_netconf -qf $clixon_cf -y /tmp/test.yang" "<rpc><edit-config>
|
|||
new "netconf set presence and not present"
|
||||
expecteof "$clixon_netconf -qf $clixon_cf -y /tmp/test.yang" "<rpc><edit-config><target><candidate/></target><config><x><nopresence/><presence/></x></config></edit-config></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "netconf get"
|
||||
expecteof "$clixon_netconf -qf $clixon_cf -y /tmp/test.yang" "<rpc><get-config><source><candidate/></source><filter type=\"xpath\" select=\"/x/*presence\"/></get-config></rpc>]]>]]>" "^<rpc-reply><data><x><presence/></x></data></rpc-reply>]]>]]>$"
|
||||
new "netconf get presence only"
|
||||
expecteof "$clixon_netconf -qf $clixon_cf -y /tmp/test.yang" '<rpc><get-config><source><candidate/></source><filter type="xpath" select="/x/*presence"/></get-config></rpc>]]>]]>' "^<rpc-reply><data><x><presence/></x></data></rpc-reply>]]>]]>$"
|
||||
|
||||
new "netconf discard-changes"
|
||||
expecteof "$clixon_netconf -qf $clixon_cf" "<rpc><discard-changes/></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
|
||||
new "netconf anyxml"
|
||||
expecteof "$clixon_netconf -qf $clixon_cf -y /tmp/test.yang" "<rpc><edit-config><target><candidate/></target><config><x><any><foo><bar a=\"nisse\"/></foo></any></x></config></edit-config></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue