Test: updated perf tests that have been broken for some time

This commit is contained in:
Olof hagsand 2023-05-23 15:24:42 +02:00
parent 307a992f36
commit 246fd81f57
5 changed files with 284 additions and 160 deletions

View file

@ -1040,6 +1040,7 @@ EOF
# clixon tester read from file for large tests # clixon tester read from file for large tests
# Arguments: # Arguments:
# - Command # - Command
# - expected retval
# - Filename to pipe to stdin # - Filename to pipe to stdin
# - expected stdout outcome # - expected stdout outcome
function expecteof_file(){ function expecteof_file(){

View file

@ -2,7 +2,7 @@
# Performance of large lists. See doc/scaling/large-lists.md # Performance of large lists. See doc/scaling/large-lists.md
# The parameters are shown below (under Default values) # The parameters are shown below (under Default values)
# Examples # Examples
# 1. run all measurements up to 10000 entris collect all results in /tmp/plots # 1. run all measurements up to 10000 entries collect all results in /tmp/plots
# run=true plot=false to=10000 resdir=/tmp/plots ./plot_perf.sh # run=true plot=false to=10000 resdir=/tmp/plots ./plot_perf.sh
# 2. Use existing data plot and show on X11 # 2. Use existing data plot and show on X11
# run=false plot=true resdir=/tmp/plots term=x11 ./plot_perf.sh # run=false plot=true resdir=/tmp/plots term=x11 ./plot_perf.sh
@ -10,6 +10,8 @@
# archs="i686 armv7l" run=false plot=true resdir=/tmp/plots term=png ./plot_perf.sh # archs="i686 armv7l" run=false plot=true resdir=/tmp/plots term=png ./plot_perf.sh
# Need gnuplot installed # Need gnuplot installed
set -u
# Magic line must be first in script (see README.md) # Magic line must be first in script (see README.md)
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
@ -23,24 +25,24 @@ arch=$(arch)
: ${resdir=$dir} # Result dir (both data and gnuplot) : ${resdir=$dir} # Result dir (both data and gnuplot)
: ${plot=false} # Result dir (both data and gnuplot) : ${plot=false} # Result dir (both data and gnuplot)
: ${archs=$arch} # Plotting can be made for many architectures (not run) : ${archs=$arch} # Plotting can be made for many architectures (not run)
: ${protos="netconf restconf"}
: ${state=true} # Generate state data and netconf get state plot
# 0 prefix to protect against shell dynamic binding) # 0 prefix to protect against shell dynamic binding)
to0=$to to0=$to
step0=$step step0=$step
reqs0=$reqs reqs0=$reqs
ext=$term # gnuplot output file extenstion ext=$term # gnuplot output file extension
# Global variables # Global variables
APPNAME=example APPNAME=example
cfg=$dir/plot-conf.xml cfg=$dir/plot-conf.xml
fyang=$dir/plot.yang fyang=$dir/scaling.yang
fstate=$dir/state.xml
fxml=$dir/data.xml fxml=$dir/data.xml
fjson=$dir/data.json fjson=$dir/data.json
# Resultdir - if different from $dir that gets erased
#resdir=$dir
if [ ! -d $resdir ]; then if [ ! -d $resdir ]; then
mkdir $resdir mkdir $resdir
fi fi
@ -66,38 +68,57 @@ module scaling{
} }
leaf b { leaf b {
description "payload data"; description "payload data";
type string; type string;
}
leaf status {
description "state data";
type string;
config false;
} }
} }
} }
} }
EOF EOF
RESTCONFIG=$(restconf_config none false)
cat <<EOF > $cfg cat <<EOF > $cfg
<clixon-config xmlns="http://clicon.org/config"> <clixon-config xmlns="http://clicon.org/config">
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE> <CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
<CLICON_FEATURE>ietf-netconf:startup</CLICON_FEATURE>
<CLICON_FEATURE>clixon-restconf:allow-auth-none</CLICON_FEATURE> <!-- Use auth-type=none -->
<CLICON_YANG_DIR>$dir</CLICON_YANG_DIR> <CLICON_YANG_DIR>$dir</CLICON_YANG_DIR>
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR> <CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
<CLICON_YANG_MODULE_MAIN>scaling</CLICON_YANG_MODULE_MAIN> <CLICON_YANG_MAIN_FILE>$fyang</CLICON_YANG_MAIN_FILE>
<CLICON_SOCK>/usr/local/var/example/example.sock</CLICON_SOCK> <CLICON_SOCK>/usr/local/var/example/example.sock</CLICON_SOCK>
<CLICON_BACKEND_PIDFILE>/usr/local/var/example/example.pidfile</CLICON_BACKEND_PIDFILE> <CLICON_BACKEND_PIDFILE>/usr/local/var/example/example.pidfile</CLICON_BACKEND_PIDFILE>
<CLICON_XMLDB_DIR>$dir</CLICON_XMLDB_DIR> <CLICON_XMLDB_DIR>$dir</CLICON_XMLDB_DIR>
<CLICON_XMLDB_PRETTY>false</CLICON_XMLDB_PRETTY> <CLICON_XMLDB_PRETTY>false</CLICON_XMLDB_PRETTY>
<CLICON_VALIDATE_STATE_XML>false</CLICON_VALIDATE_STATE_XML>
$RESTCONFIG
</clixon-config> </clixon-config>
EOF EOF
# Generate file with n entries # Generate file $fxml or $fjson with "nr" entries for PUT operations
# argument: <n> <proto> # arguments:
function genfile(){ # 1: <nr>
if [ $2 = netconf ]; then # 2: <proto> netconf(in xml) or json (for restconf)
echo -n "<rpc><edit-config><target><candidate/></target><default-operation>replace</default-operation><config><x xmlns=\"urn:example:clixon\">" > $fxml function genfile()
for (( i=0; i<$1; i++ )); do {
echo -n "<y><a>$i</a><b>$i</b></y>" >> $fxml new "genfile"
nr=$1
myproto=$2
if [ $myproto = netconf ]; then
rpc="<rpc $DEFAULTNS><edit-config><target><candidate/></target><default-operation>replace</default-operation><config><x xmlns=\"urn:example:clixon\">"
for (( i=0; i<$nr; i++ )); do
rpc+="<y><a>$i</a><b>$i</b></y>"
done done
echo "</x></config></edit-config></rpc>]]>]]>" >> $fxml rpc+="</x></config></edit-config></rpc>"
else # restconf echo -n "$DEFAULTHELLO" > $fxml
echo "$(chunked_framing "$rpc")" >> $fxml
else # json
echo -n '{"scaling:x":{"y":[' > $fjson echo -n '{"scaling:x":{"y":[' > $fjson
for (( i=0; i<$1; i++ )); do for (( i=0; i<$nr; i++ )); do
if [ $i -ne 0 ]; then if [ $i -ne 0 ]; then
echo -n ',' >> $fjson echo -n ',' >> $fjson
fi fi
@ -107,49 +128,94 @@ function genfile(){
fi fi
} }
# Run netconffunction # Generate state file with "nr" entries
# args: <op> <proto> <load> <n> <reqs> # arguments:
# where proto is one of: # 1: <nr> Number of entries
# netconf, restconf # 2: <fstate> File name
# where op is one of: function genstate()
# get put delete commit {
function runnet(){ nr=$1
fstate=$2
echo "<x xmlns=\"urn:example:clixon\">" > $fstate
for (( i=0; i<$nr; i++ )); do
echo "<y><a>$i</a><state>$i</state></y>" >> $fstate
done
echo "</x>" >> $fstate
}
# Run netconf function
# args:
# 1: <op> put, get, commit, delete
# 2: <nr> Number of entries
# 3: <reqs> =0 means all in one go
# 4: <st> true: Also generate/get state data
function runnetconf()
{
op=$1 op=$1
nr=$2 # Number of entries in DB (keep diff from n due to shell dynamic binding) nr=$2 # Number of entries in DB (keep diff from n due to shell dynamic binding)
reqs=$3 reqs=$3
st=$4
file=$resdir/$op-netconf-$reqs-$arch file=$resdir/$op-netconf-$reqs-$st-$arch
new "runnetconf $file $nr"
echo -n "$nr " >> $file echo -n "$nr " >> $file
case $op in case $op in
put) put)
if [ $reqs = 0 ]; then # Write all in one go if [ $reqs = 0 ]; then # Write all in one go
genfile $nr netconf; genfile $nr netconf;
{ time -p cat $fxml | $clixon_netconf -qf $cfg -y $fyang ; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file { time -p cat $fxml | $clixon_netconf -qf $cfg; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file
else # reqs != 0 else # reqs != 0
{ time -p for (( i=0; i<$reqs; i++ )); do { time -p for (( i=0; i<$reqs; i++ )); do
rnd=$(( ( RANDOM % $nr ) )); rnd=$(( ( RANDOM % $nr ) ));
echo "<rpc><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><y><a>$rnd</a><b>$rnd</b></y></x></config></edit-config></rpc>]]>]]>"; rpc=$(chunked_framing "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><y><a>$rnd</a><b>$rnd</b></y></x></config></edit-config></rpc>")
done | $clixon_netconf -qf $cfg -y $fyang > /dev/null; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file if [ $i == 0 ]; then
echo -n "$DEFAULTHELLO";
fi
echo "$rpc"
done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file
fi fi
;; ;;
get) get)
if $st; then
GET1="<get>"
GET2="</get>"
else
GET1="<get-config><source><running/></source>"
GET2="</get-config>"
fi
if [ $reqs = 0 ]; then # Read all in one go if [ $reqs = 0 ]; then # Read all in one go
{ time -p echo "<rpc><get-config><source><running/></source></get-config></rpc>]]>]]>" | $clixon_netconf -qf $cfg -y $fyang > /dev/null ; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file rpc=$(chunked_framing "<rpc $DEFAULTNS>${GET1}${GET2}</rpc>")
{ time -p echo "$DEFAULTHELLO$rpc" | $clixon_netconf -qf $cfg > /dev/null ; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file
else # reqs != 0 else # reqs != 0
{ time -p for (( i=0; i<$reqs; i++ )); do { time -p for (( i=0; i<$reqs; i++ )); do
rnd=$(( ( RANDOM % $nr ) )) rnd=$(( ( RANDOM % $nr ) ))
echo "<rpc><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><y><a>$rnd</a><b>$rnd</b></y></x></config></edit-config></rpc>]]>]]>" rpc=$(chunked_framing "<rpc $DEFAULTNS>${GET1}<filter type=\"xpath\" select=\"/ex:x/ex:y[ex:a=$rnd]\" xmlns:ex=\"urn:example:clixon\"/>${GET2}</rpc>")
done | $clixon_netconf -qf $cfg -y $fyang > /dev/null; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file if [ $i == 0 ]; then
echo -n "$DEFAULTHELLO";
fi
echo "$rpc"
done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file
echo $file
fi fi
;; ;;
delete) delete)
if [ $reqs = 0 ]; then # Delete all in one go
rpc=$(chunked_framing "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><y><a>$rnd</a><b>$rnd</b></y></x></config></edit-config></rpc>")
{ time -p echo "$DEFAULTHELLO$rpc" | $clixon_netconf -qf $cfg > /dev/null ; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file
else
{ time -p for (( i=0; i<$reqs; i++ )); do { time -p for (( i=0; i<$reqs; i++ )); do
rnd=$(( ( RANDOM % $nr ) )) rnd=$(( ( RANDOM % $nr ) ))
echo "<rpc><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><y><a>$rnd</a><b>$rnd</b></y></x></config></edit-config></rpc>]]>]]>" rpc=$(chunked_framing "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><y><a>$rnd</a><b>$rnd</b></y></x></config></edit-config></rpc>")
done | $clixon_netconf -qf $cfg -y $fyang; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file if [ $i == 0 ]; then
echo -n "$DEFAULTHELLO";
fi
echo "$rpc"
done | $clixon_netconf -qf $cfg; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file
fi
;; ;;
commit) commit)
{ time -p echo "<rpc><commit/></rpc>]]>]]>" | $clixon_netconf -qf $cfg -y $fyang > /dev/null ; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file rpc=$(chunked_framing "<rpc $DEFAULTNS><commit/></rpc>")
{ time -p echo "$DEFAULTHELLO$rpc" | $clixon_netconf -qf $cfg > /dev/null ; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file
;; ;;
*) *)
err "Operation not supported" "$op" err "Operation not supported" "$op"
@ -159,46 +225,54 @@ done | $clixon_netconf -qf $cfg -y $fyang; } 2>&1 | awk '/real/ {print $2}' | tr
} }
# Run restconf function # Run restconf function
# args: <op> <proto> <load> <n> <reqs> # args:
# where proto is one of: # 1: <op> put, get, commit, delete
# netconf, restconf # 2: <nr> Number of entries
# where op is one of: # 3: <reqs> =0 means all in one go
# get put delete # 4: <st> true: Also generate/get state data
function runrest(){ function runrestconf()
{
op=$1 op=$1
nr=$2 # Number of entries in DB nr=$2 # Number of entries in DB
reqs=$3 reqs=$3
st=$4
file=$resdir/$op-restconf-$reqs-$arch file=$resdir/$op-restconf-$reqs-$st-$arch
new "runrestconf $file $nr"
echo -n "$nr " >> $file echo -n "$nr " >> $file
case $op in case $op in
put) put)
if [ $reqs = 0 ]; then # Write all in one go if [ $reqs = 0 ]; then # Write all in one go
genfile $nr restconf genfile $nr json
# restconf @- means from stdin # restconf @- means from stdin
{ time -p curl $CURLOPTS -X PUT -d @$fjson http://localhost/restconf/data/scaling:x ; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file { time -p curl $CURLOPTS -X PUT -H 'Content-Type: application/yang-data+json' -d @$fjson $RCPROTO://localhost/restconf/data/scaling:x ; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file
else # Small requests else # Small requests
{ time -p for (( i=0; i<$reqs; i++ )); do { time -p for (( i=0; i<$reqs; i++ )); do
rnd=$(( ( RANDOM % $nr ) )); rnd=$(( ( RANDOM % $nr ) ));
curl $CURLOPTS -X PUT http://localhost/restconf/data/scaling:x/y=$rnd -d "{\"scaling:y\":{\"a\":$rnd,\"b\":\"$rnd\"}}" curl $CURLOPTS -X PUT -H 'Content-Type: application/yang-data+json' $RCPROTO://localhost/restconf/data/scaling:x/y=$rnd -d "{\"scaling:y\":{\"a\":$rnd,\"b\":\"$rnd\"}}"
done ; } 2>&1 | awk '/real/ {print $2}' | tr , .>> $file done ; } 2>&1 | awk '/real/ {print $2}' | tr , .>> $file
# #
fi fi
;; ;;
get) get)
if $st; then
CONTENT=all
else
CONTENT=config
fi
if [ $reqs = 0 ]; then # Read all in one go if [ $reqs = 0 ]; then # Read all in one go
{ time -p curl $CURLOPTS -X GET http://localhost/restconf/data/scaling:x > /dev/null; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file { time -p curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/scaling:x?content=$CONTENT > /dev/null; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $file
else # Small requests else # Small requests
{ time -p for (( i=0; i<$reqs; i++ )); do { time -p for (( i=0; i<$reqs; i++ )); do
rnd=$(( ( RANDOM % $nr ) )); rnd=$(( ( RANDOM % $nr ) ));
curl $CURLOPTS -X GET http://localhost/restconf/data/scaling:x/y=$rnd curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/scaling:x/y=$rnd?content=$CONTENT
done ; } 2>&1 | awk '/real/ {print $2}' | tr , .>> $file done ; } 2>&1 | awk '/real/ {print $2}' | tr , .>> $file
fi fi
;; ;;
delete) delete)
{ time -p for (( i=0; i<$reqs; i++ )); do { time -p for (( i=0; i<$reqs; i++ )); do
rnd=$(( ( RANDOM % $nr ) )); rnd=$(( ( RANDOM % $nr ) ));
curl $CURLOPTS -X GET http://localhost/restconf/data/scaling:x/y=$rnd curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/scaling:x/y=$rnd
done ; } 2>&1 | awk '/real/ {print $2}' | tr , .>> $file done ; } 2>&1 | awk '/real/ {print $2}' | tr , .>> $file
;; ;;
*) *)
@ -208,63 +282,81 @@ function runrest(){
esac esac
} }
function commit()
function commit(){ {
# commit to running # commit to running
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><commit/></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$" new "commit"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><commit/></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
} }
function reset(){ # Delete all in candidate and commit, and state file
# delete all in candidate function reset()
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><edit-config><target><candidate/></target><default-operation>none</default-operation><config operation='delete'/></edit-config></rpc>]]>]]>" '^<rpc-reply><ok/></rpc-reply>]]>]]>$' {
new "reset"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><default-operation>none</default-operation><config operation='delete'/></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
# commit to running # commit to running
commit commit
echo "" > $fstate
} }
# Load n entries into candidate # Load nr entries into candidate
# Args: <n> # Args: <nr>
function load(){ function load()
{
new "load $1"
nr=$1
# Generate file ($fxml) # Generate file ($fxml)
genfile $1 netconf genfile $nr netconf
# Write it to backend in one chunk # Write it to backend in one chunk
expecteof_file "$clixon_netconf -qf $cfg -y $fyang" 0 "$fxml" "^<rpc-reply><ok/></rpc-reply>]]>]]>$" new "generated netconf"
expecteof_file "$clixon_netconf -qef $cfg" 0 "$fxml" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>$"
new "load done"
} }
# Run an operation, iterate from <from> to <to> in increment of <step> # Run an operation, iterate from <from> to <to> in increment of <step>
# Each operation do <reqs> times # Each operation do <reqs> times
# args: <op> <protocol> <from> <step> <to> <reqs> <cand> <run> # args:
# <reqs>=0 means all in one go # 1: <op> put, get, commit, delete
# <cand> <run> means a priori loaded into datastore # 2: <proto> netconf or restconf
function plot(){ # 3: <from> Iterate from
# 4: <step> in steps
# 5: <to> Increment to
# 6: <reqs> =0 means all in one go
# 7: <fill> Three values: "no", "candidate": prefill candidare, "running": also commit into running
# 8: <st> false: no state, true: Also get state data
function genplot()
{
op=$1 op=$1
proto=$2 proto=$2
from=$3 from=$3
step=$4 step=$4
to=$5 to=$5
reqs=$6 reqs=$6
can=$7 fill=$7
run=$8 st=$8
new "genplot $proto"
if [ $# -ne 8 ]; then if [ $# -ne 8 ]; then
exit "plot should be called with 8 arguments, got $#" exit "plot should be called with 8 arguments, got $#"
fi fi
# reset file # reset file
new "Create file $resdir/$op-$proto-$reqs-$arch" new "Create file $resdir/$op-$proto-$reqs-$st-$arch"
echo -n "" > $resdir/$op-$proto-$reqs-$arch echo -n "" > $resdir/$op-$proto-$reqs-$st-$arch
for (( n=$from; n<=$to; n=$n+$step )); do for (( nr=$from; nr<=$to; nr=$nr+$step )); do
reset reset
if [ $can = n ]; then if $st; then
load $n genstate $nr $fstate
if [ $run = n ]; then fi
commit if [ $fill = candidate ]; then
fi load $nr
elif [ $fill = running ]; then
load $nr
commit
fi fi
new "$op-$proto-$reqs-$arch $n"
if [ $proto = netconf ]; then if [ $proto = netconf ]; then
runnet $op $n $reqs runnetconf $op $nr $reqs $st
else else
runrest $op $n $reqs runrestconf $op $nr $reqs $st
fi fi
done done
echo # newline echo # newline
@ -274,16 +366,17 @@ function plot(){
# Each operation do <reqs> times # Each operation do <reqs> times
# args: <op> <protocol> <from> <step> <to> <reqs> <cand> <run> # args: <op> <protocol> <from> <step> <to> <reqs> <cand> <run>
# <reqs>=0 means all in one go # <reqs>=0 means all in one go
function startup(){ function startup()
{
from=$1 from=$1
step=$2 step=$2
to=$3 to=$3
mode=startup mode=startup
new "startup"
if [ $# -ne 3 ]; then if [ $# -ne 3 ]; then
exit "plot should be called with 3 arguments, got $#" exit "startup should be called with 3 arguments, got $#"
fi fi
# gnuplot file # gnuplot file
gfile=$resdir/startup-$arch gfile=$resdir/startup-$arch
new "Create file $gfile" new "Create file $gfile"
@ -302,10 +395,9 @@ function startup(){
done done
echo "</x></config>" >> $dbfile echo "</x></config>" >> $dbfile
new "Startup backend once -s $mode -f $cfg -y $fyang" new "Startup backend once -s $mode -f $cfg"
echo -n "$n " >> $gfile echo -n "$n " >> $gfile
{ time -p sudo $clixon_backend -F1 -D $DBG -s $mode -f $cfg -y $fyang 2> /dev/null; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $gfile { time -p sudo $clixon_backend -F1 -D $DBG -s $mode -f $cfg 2> /dev/null; } 2>&1 | awk '/real/ {print $2}' | tr , . >> $gfile
done done
echo # newline echo # newline
} }
@ -316,58 +408,67 @@ if $run; then
# backend a single time # backend a single time
startup $step $step $to startup $step $step $to
new "test params: -f $cfg -y $fyang" new "test params: -f $cfg"
if [ $BE -ne 0 ]; then if [ $BE -ne 0 ]; then
new "kill old backend" new "kill old backend"
sudo clixon_backend -zf $cfg -y $fyang sudo clixon_backend -zf $cfg
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
err err
fi fi
new "start backend -s init -f $cfg -y $fyang" new "start backend -s init -f $cfg -- -sS $fstate"
start_backend -s init -f $cfg -y $fyang start_backend -s init -f $cfg -- -sS $fstate
new "wait backend"
wait_backend
fi fi
if [ $RC -ne 0 ]; then
new "kill old restconf daemon"
stop_restconf_pre
new "kill old restconf daemon" new "start restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" start_restconf -f $cfg
new "start restconf daemon" new "wait restconf"
start_restconf -f $cfg -y $fyang wait_restconf
fi
new "waiting"
sleep $DEMWAIT
to=$to0 to=$to0
step=$step0 step=$step0
reqs=$reqs0 reqs=$reqs0
# Put all tests # Put all tests
for proto in netconf restconf; do for pr in ${protos}; do
new "$proto put all entries to candidate (restconf:running)" new "$pr put all entries to candidate (restconf:running)"
plot put $proto $step $step $to 0 0 0 # all candidate 0 running 0 genplot put $pr $step $step $to 0 no false # all candidate 0 running 0
done
# Get all tests
for proto in netconf restconf; do
new "$proto get all entries from running"
plot get $proto $step $step $to 0 n n # start w full datastore
done done
# Netconf commit all # Netconf commit all
new "Netconf commit all entries from candidate to running" new "Netconf commit all entries from candidate to running"
plot commit netconf $step $step $to 0 n 0 # candidate full running empty genplot commit netconf $step $step $to 0 candidate false # candidate full running empty
# Get all tests
for pr in ${protos}; do
new "$pr get all config entries from running"
genplot get $pr $step $step $to 0 running false # start w full datastore
done
if $state; then
for pr in ${protos}; do
new "$pr get all state entries from running"
genplot get $pr $step $step $to 0 running true # start w full datastore
done
fi
# Transactions get/put/delete # Transactions get/put/delete
reqs=$reqs0 reqs=$reqs0
for proto in netconf restconf; do for pr in ${protos} ; do
new "$proto get $reqs from full database" new "$pr get $reqs from full database"
plot get $proto $step $step $to $reqs n n genplot get $pr $step $step $to $reqs running false
new "$pr put $reqs to full database(replace / alter values)"
genplot put $pr $step $step $to $reqs running false
new "$proto put $reqs to full database(replace / alter values)" new "$pr delete $reqs from full database(replace / alter values)"
plot put $proto $step $step $to $reqs n n genplot delete $pr $step $step $to $reqs running false
new "$proto delete $reqs from full database(replace / alter values)"
plot delete $proto $step $step $to $reqs n n
done done
new "Kill restconf daemon" new "Kill restconf daemon"
@ -408,7 +509,7 @@ EOF
# 1. Get config # 1. Get config
gplot="" gplot=""
for a in $archs; do for a in $archs; do
gplot="$gplot \"$resdir/get-restconf-0-$a\" title \"rc-$a\", \"$resdir/get-netconf-0-$a\" title \"nc-$a\"," gplot="$gplot \"$resdir/get-restconf-0-false-$a\" title \"rc-$a\", \"$resdir/get-netconf-0-false-$a\" title \"nc-$a\","
done done
gnuplot -persist <<EOF gnuplot -persist <<EOF
@ -423,12 +524,30 @@ set output "$resdir/clixon-get-0.$term"
plot $gplot plot $gplot
EOF EOF
# 2. Get state
if $state; then
gplot=""
for a in $archs; do
gplot="$gplot \"$resdir/get-restconf-0-true-$a\" title \"rc-$a\", \"$resdir/get-netconf-0-true-$a\" title \"nc-$a\","
done
# 2. Put config gnuplot -persist <<EOF
set title "Clixon get state"
set style data linespoint
set xlabel "Entries"
set ylabel "Time[s]"
set grid
set terminal $term
set yrange [*:*]
set output "$resdir/clixon-getstate-0.$term"
plot $gplot
EOF
fi
# 3. Put config
gplot="" gplot=""
for a in $archs; do for a in $archs; do
gplot="$gplot \"$resdir/put-restconf-0-$a\" title \"rc-$a\", \"$resdir/put-netconf-0-$a\" title \"nc-$a\"," gplot="$gplot \"$resdir/put-restconf-0-false-$a\" title \"rc-$a\", \"$resdir/put-netconf-0-false-$a\" title \"nc-$a\","
done done
gnuplot -persist <<EOF gnuplot -persist <<EOF
@ -443,11 +562,11 @@ set output "$resdir/clixon-put-0.$term"
plot $gplot plot $gplot
EOF EOF
# 3. Commit config # 4. Commit config
gplot="" gplot=""
for a in $archs; do for a in $archs; do
gplot="$gplot \"$resdir/commit-netconf-0-$a\" title \"nc-$a\"," gplot="$gplot \"$resdir/commit-netconf-0-false-$a\" title \"nc-$a\","
done done
gnuplot -persist <<EOF gnuplot -persist <<EOF
@ -462,11 +581,11 @@ set output "$resdir/clixon-commit-0.$term"
plot $gplot plot $gplot
EOF EOF
# 4. Get single entry # 5. Get single entry
gplot="" gplot=""
for a in $archs; do for a in $archs; do
gplot="$gplot \"$resdir/get-restconf-100-$a\" using 1:(\$2/$reqs0) title \"rc-$a\", \"$resdir/get-netconf-100-$a\" using 1:(\$2/$reqs0) title \"nc-$a\"," gplot="$gplot \"$resdir/get-restconf-100-false-$a\" using 1:(\$2/$reqs0) title \"rc-$a\", \"$resdir/get-netconf-100-false-$a\" using 1:(\$2/$reqs0) title \"nc-$a\","
done done
gnuplot -persist <<EOF gnuplot -persist <<EOF
@ -481,11 +600,11 @@ set output "$resdir/clixon-get-100.$term"
plot $gplot plot $gplot
EOF EOF
# 5. Put single entry # 6. Put single entry
gplot="" gplot=""
for a in $archs; do for a in $archs; do
gplot="$gplot \"$resdir/put-restconf-100-$a\" using 1:(\$2/$reqs0) title \"rc-$a\", \"$resdir/put-netconf-100-$a\" using 1:(\$2/$reqs0) title \"nc-$a\"," gplot="$gplot \"$resdir/put-restconf-100-false-$a\" using 1:(\$2/$reqs0) title \"rc-$a\", \"$resdir/put-netconf-100-false-$a\" using 1:(\$2/$reqs0) title \"nc-$a\","
done done
gnuplot -persist <<EOF gnuplot -persist <<EOF
@ -500,11 +619,11 @@ set output "$resdir/clixon-put-100.$term"
plot $gplot plot $gplot
EOF EOF
# 6. Delete single entry # 7. Delete single entry
gplot="" gplot=""
for a in $archs; do for a in $archs; do
gplot="$gplot \"$resdir/delete-restconf-100-$a\" using 1:(\$2/$reqs0) title \"rc-$a\", \"$resdir/delete-netconf-100-$a\" using 1:(\$2/$reqs0) title \"nc-$a\"," gplot="$gplot \"$resdir/delete-restconf-100-false-$a\" using 1:(\$2/$reqs0) title \"rc-$a\", \"$resdir/delete-netconf-100-false-$a\" using 1:(\$2/$reqs0) title \"nc-$a\","
done done
@ -522,5 +641,15 @@ EOF
fi # if plot fi # if plot
unset to
unset step
unset reqs
unset run
unset term
unset resdir
unset plot
unset archs
unset proto
unset protos
#rm -rf $dir #rm -rf $dir

View file

@ -87,24 +87,29 @@ new "wait backend"
wait_backend wait_backend
new "generate config with $perfnr list entries" new "generate config with $perfnr list entries"
echo -n "<rpc><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\">" > $fconfig rpc="<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\">" > $fconfig
for (( i=0; i<$perfnr; i++ )); do for (( i=0; i<$perfnr; i++ )); do
echo -n "<y><a>$i</a><b>$i</b></y>" >> $fconfig rpc+="<y><a>$i</a><b>$i</b></y>"
done done
echo "</x></config></edit-config></rpc>]]>]]>" >> $fconfig rpc+="</x></config></edit-config></rpc>"
echo -n "$DEFAULTHELLO" > $fconfig
echo "$(chunked_framing "$rpc")" >> $fconfig
# Now take large config file and write it via netconf to candidate # Now take large config file and write it via netconf to candidate
new "test time exists" new "test time exists"
expectpart "$(time -p ls)" 0 expectpart "$(time -p ls)" 0 2>&1 | awk '/real/ {print $2}'
new "netconf write large config" new "netconf write large config"
expecteof_file "time -p $clixon_netconf -qef $cfg" 0 "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$" 2>&1 | awk '/real/ {print $2}' # One extra without time for potential error
expecteof_file "time -p $clixon_netconf -qef $cfg" 0 "$fconfig" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>$" 2>&1 | awk '/real/ {print $2}'
# Here, there are $perfnr entries in candidate # Here, there are $perfnr entries in candidate
# Now commit it from candidate to running # Now commit it from candidate to running
new "netconf commit large config" new "netconf commit large config"
expecteof "time -p $clixon_netconf -qef $cfg" 0 "<rpc><commit/></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$" 2>&1 | awk '/real/ {print $2}' rpc=$(chunked_framing "<rpc $DEFAULTNS><commit/></rpc>")
expecteof_netconf "time -p $clixon_netconf -qef $cfg" 0 "$DEFAULTHELLO" "$rpc" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>" 2>&1 | awk '/real/ {print $2}'
# CLI get. This takes a lot of time because expand_dbvar gets perfnr (eg 100000) entries # CLI get. This takes a lot of time because expand_dbvar gets perfnr (eg 100000) entries
# and loops over it. # and loops over it.
@ -134,18 +139,21 @@ done } 2>&1 | awk '/real/ {print $2}'
# Now do leaf-lists instead of leafs # Now do leaf-lists instead of leafs
#new "generate leaf-list config" new "generate leaf-list config"
echo -n "<rpc><edit-config><target><candidate/></target><default-operation>replace</default-operation><config><x xmlns=\"urn:example:clixon\">" > $fconfig2 rpc="<rpc $DEFAULTNS><edit-config><target><candidate/></target><default-operation>replace</default-operation><config><x xmlns=\"urn:example:clixon\">"
for (( i=0; i<$perfnr; i++ )); do for (( i=0; i<$perfnr; i++ )); do
echo -n "<c>$i</c>" >> $fconfig2 rpc+="<c>$i</c>"
done done
echo "</x></config></edit-config></rpc>]]>]]>" >> $fconfig2 rpc+="</x></config></edit-config></rpc>"
echo -n "$DEFAULTHELLO" > $fconfig2
echo "$(chunked_framing "$rpc")" >> $fconfig2
new "netconf replace large list-leaf config" new "netconf replace large list-leaf config"
expecteof_file "time -p $clixon_netconf -qef $cfg" 0 "$fconfig2" "^<rpc-reply><ok/></rpc-reply>]]>]]>$" 2>&1 | awk '/real/ {print $2}' expecteof_file "time -p $clixon_netconf -qef $cfg" 0 "$fconfig2" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>$" 2>&1 | awk '/real/ {print $2}'
new "netconf commit large leaf-list config" new "netconf commit large leaf-list config"
expecteof "time -p $clixon_netconf -qef $cfg" 0 "<rpc><commit/></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$" 2>&1 | awk '/real/ {print $2}' rpc=$(chunked_framing "<rpc $DEFAULTNS><commit/></rpc>")
expecteof "time -p $clixon_netconf -qef $cfg" 0 "$rpc" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>$" 2>&1 | awk '/real/ {print $2}'
# XXX No leafref cli tests # XXX No leafref cli tests

View file

@ -21,7 +21,8 @@ echo '"}' >> $fjson
echo "$fjson" echo "$fjson"
new "json parse long string" new "json parse long string"
expecteof_file "time -p $clixon_util_json" 0 "$fjson" 2>&1 | awk '/real/ {print $2}' #expecteof_file "$clixon_util_json" 0 "$fjson"
expecteof_file "time -p $clixon_util_json -j" 0 "$fjson" "$fjson" 2>&1 | awk '/real/ {print $2}'
rm -rf $dir rm -rf $dir

View file

@ -209,22 +209,7 @@ done
echo -n "</x>" >> $fdataxml2 # No CR echo -n "</x>" >> $fdataxml2 # No CR
new "restconf replace large list-leaf config" new "restconf replace large list-leaf config"
expectpart "$(time -p curl $CURLOPTS -X PUT -H "Content-Type: application/yang-data+xml" $RCPROTO://localhost/restconf/data/scaling:x -d @$fdataxml2)" 0 "HTTP/$HVER 20" expectpart "$(time -p curl $CURLOPTS -X PUT -H "Content-Type: application/yang-data+xml" $RCPROTO://localhost/restconf/data/scaling:x -d @$fdataxml2)" 0 "HTTP/$HVER 20" 2>&1 | awk '/real/ {print $2}'
new "netconf add $perfreq small leaf-list config"
{ time -p for (( i=0; i<$perfreq; i++ )); do
rnd=$(( ( RANDOM % $perfnr ) ))
echo "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><c>$rnd</c></x></config></edit-config></rpc>]]>]]>"
done | $clixon_netconf -qef $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}'
new "netconf add small leaf-list config"
expecteof "time -p $clixon_netconf -qef $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><c>x</c></x></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$" 2>&1 | awk '/real/ {print $2}'
new "netconf commit small leaf-list config"
expecteof "time -p $clixon_netconf -qef $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><commit/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$" 2>&1 | awk '/real/ {print $2}'
new "netconf get large leaf-list config"
expecteof "time -p $clixon_netconf -qef $cfg" 0 "$DEFAULTHELLO<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 [ $RC -ne 0 ]; then if [ $RC -ne 0 ]; then
new "Kill restconf daemon" new "Kill restconf daemon"