Added event_poll function; optimization experiments

This commit is contained in:
Olof hagsand 2017-09-15 17:24:51 +02:00
parent 624b949b3f
commit 687641e944
6 changed files with 148 additions and 20 deletions

View file

@ -1,42 +1,73 @@
#!/bin/bash
# Test2: backend and netconf basic functionality
# Scaling test
number=10000
if [ $# = 0 ]; then
number=1000
elif [ $# = 1 ]; then
number=$1
else
echo "Usage: $0 [<number>]"
exit 1
fi
fyang=/tmp/scaling.yang
fconfig=/tmp/config
# include err() and new() functions
. ./lib.sh
# 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 ietf-ip{
container x {
list y {
key "a";
leaf a {
type string;
}
}
container z {
leaf-list c {
type string;
}
}
}
}
EOF
# kill old backend (if any)
new "kill old backend"
sudo clixon_backend -zf $clixon_cf
echo "clixon_backend -zf $clixon_cf -y $fyang"
sudo clixon_backend -zf $clixon_cf -y $fyang
if [ $? -ne 0 ]; then
err
fi
new "start backend"
# start new backend
sudo clixon_backend -If $clixon_cf
sudo clixon_backend -If $clixon_cf -y $fyang
if [ $? -ne 0 ]; then
err
fi
new "netconf perf tests"
str="<rpc><edit-config><target><candidate/></target><config><interfaces>"
for (( i=0; i<$number; i++ ))
do
str+="<interface><name>eth$i</name></interface>"
new "generate large config"
echo -n "<rpc><edit-config><target><candidate/></target><config><x>" > $fconfig
for (( i=0; i<$number; i++ )); do
echo -n "<y><a>$i</a></y>" >> $fconfig
done
str+="</interfaces></config></edit-config></rpc>]]>]]>"
echo "</x></config></edit-config></rpc>]]>]]>" >> $fconfig
new "netconf edit large config"
expecteof "$clixon_netconf -qf $clixon_cf" "$str" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
expecteof_file "time $clixon_netconf -qf $clixon_cf -y $fyang" "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$" < $fconfig
rm $fconfig
new "netconf get large config"
expecteof "$clixon_netconf -qf $clixon_cf" "<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply><data><interfaces><interface><name>eth0</name><enabled>true</enabled></interface>"
expecteof "time $clixon_netconf -qf $clixon_cf -y $fyang" "<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply><data><x><y><a>0</a></y><y><a>1</a>"
new "Kill backend"
# Check if still alive