Clixon 4.4 three compile-time options: MOVE_TRANS_END for changing transaction-end callbacks; STATE_ORDERED_BY_SYSTEM to make state data system ordered; XML_MERGE_TWO_ROUNDS to improve xml_merge performance.
This commit is contained in:
parent
5535239363
commit
662d6b0a3f
19 changed files with 483 additions and 61 deletions
|
|
@ -157,7 +157,7 @@ if [ $RC -ne 0 ]; then
|
|||
fi
|
||||
|
||||
new "auth get"
|
||||
expecteq "$(curl -u andy:bar -sS -X GET http://localhost/restconf/data)" 0 '{"data":{"clixon-example:state":{"op":["42","41","43"]}}}
|
||||
expecteq "$(curl -u andy:bar -sS -X GET http://localhost/restconf/data)" 0 '{"data":{"clixon-example:state":{"op":["41","42","43"]}}}
|
||||
'
|
||||
|
||||
new "Set x to 0"
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ expecteq "$(curl -u andy:bar -sS -X GET http://localhost/restconf/data/nacm-exam
|
|||
'
|
||||
|
||||
new "admin read state OK"
|
||||
expecteq "$(curl -u andy:bar -sS -X GET http://localhost/restconf/data/clixon-example:state)" 0 '{"clixon-example:state":{"op":["42","41","43"]}}
|
||||
expecteq "$(curl -u andy:bar -sS -X GET http://localhost/restconf/data/clixon-example:state)" 0 '{"clixon-example:state":{"op":["41","42","43"]}}
|
||||
'
|
||||
|
||||
new "admin read top ok (all)"
|
||||
|
|
@ -208,11 +208,11 @@ new "limit read other module fail"
|
|||
expecteq "$(curl -u wilma:bar -sS -X GET http://localhost/restconf/data/nacm-example:x)" 0 '{"ietf-restconf:errors":{"error":{"error-type":"application","error-tag":"invalid-value","error-severity":"error","error-message":"Instance does not exist"}}}
'
|
||||
|
||||
new "limit read state OK"
|
||||
expecteq "$(curl -u wilma:bar -sS -X GET http://localhost/restconf/data/clixon-example:state)" 0 '{"clixon-example:state":{"op":["42","41","43"]}}
|
||||
expecteq "$(curl -u wilma:bar -sS -X GET http://localhost/restconf/data/clixon-example:state)" 0 '{"clixon-example:state":{"op":["41","42","43"]}}
|
||||
'
|
||||
|
||||
new "limit read top ok (part)"
|
||||
expecteq "$(curl -u wilma:bar -sS -X GET http://localhost/restconf/data)" 0 '{"data":{"clixon-example:translate":{"translate":[{"k":"key42","value":"val42"},{"k":"key43","value":"val43"}]},"clixon-example:state":{"op":["42","41","43"]}}}
|
||||
expecteq "$(curl -u wilma:bar -sS -X GET http://localhost/restconf/data)" 0 '{"data":{"clixon-example:translate":{"translate":[{"k":"key42","value":"val42"},{"k":"key43","value":"val43"}]},"clixon-example:state":{"op":["41","42","43"]}}}
|
||||
'
|
||||
|
||||
#user:guest
|
||||
|
|
|
|||
|
|
@ -167,11 +167,13 @@ if [ $BE -ne 0 ]; then
|
|||
fi
|
||||
|
||||
# STATE (should not be ordered)
|
||||
new "state data (should be unordered: 42,41,43)"
|
||||
#new "state data (should be unordered: 42,41,43)"
|
||||
# Eeh I changed that to sortered unless STATE_ORDERED_BY_SYSTEM
|
||||
new "state data (should be ordered: 41,42,43)"
|
||||
cat <<EOF > $tmp
|
||||
<rpc><get><filter type="xpath" select="ex:state" xmlns:ex="urn:example:clixon" /></get></rpc>]]>]]>
|
||||
EOF
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$(cat $tmp)" '<rpc-reply><data><state xmlns="urn:example:clixon"><op>42</op><op>41</op><op>43</op></state></data></rpc-reply>]]>]]>'
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$(cat $tmp)" '<rpc-reply><data><state xmlns="urn:example:clixon"><op>41</op><op>42</op><op>43</op></state></data></rpc-reply>]]>]]>'
|
||||
|
||||
# Check as file
|
||||
new "verify running from start, should be: c,l,y0,y1,y2,y3; y1 and y3 sorted."
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ for mode in startup running; do
|
|||
;;
|
||||
esac
|
||||
new "Startup format: $format mode:$mode"
|
||||
# echo "time sudo $clixon_backend -F1 -D $DBG -s $mode -f $cfg -y $fyang -o CLICON_XMLDB_FORMAT=$format"
|
||||
echo "time sudo $clixon_backend -F1 -D $DBG -s $mode -f $cfg -y $fyang -o CLICON_XMLDB_FORMAT=$format"
|
||||
# Cannot use start_backend here due to expected error case
|
||||
{ time -p sudo $clixon_backend -F1 -D $DBG -s $mode -f $cfg -y $fyang -o CLICON_XMLDB_FORMAT=$format 2> /dev/null; } 2>&1 | awk '/real/ {print $2}'
|
||||
done
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
# Scaling/ performance tests
|
||||
# Config + state data, only get
|
||||
# Restconf/Netconf/CLI
|
||||
# Use mixed ietf-interfaces config+state
|
||||
# Use mixed interfaces config+state
|
||||
# ALso added two layers a/b to get extra depth (som caching can break)
|
||||
|
||||
# Magic line must be first in script (see README.md)
|
||||
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
||||
|
|
@ -22,14 +23,15 @@ s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
|||
APPNAME=example
|
||||
|
||||
cfg=$dir/config.xml
|
||||
fyang=$dir/$APPNAME.yang
|
||||
fconfig=$dir/large.xml
|
||||
fstate=$dir/state.xml
|
||||
|
||||
cat <<EOF > $cfg
|
||||
<clixon-config xmlns="http://clicon.org/config">
|
||||
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
|
||||
<CLICON_YANG_DIR>$dir</CLICON_YANG_DIR>
|
||||
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
|
||||
<CLICON_YANG_MODULE_MAIN>clixon-example</CLICON_YANG_MODULE_MAIN>
|
||||
<CLICON_YANG_MAIN_FILE>$fyang</CLICON_YANG_MAIN_FILE>
|
||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||
<CLICON_BACKEND_PIDFILE>/usr/local/var/example/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
||||
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
||||
|
|
@ -46,6 +48,48 @@ cat <<EOF > $cfg
|
|||
</clixon-config>
|
||||
EOF
|
||||
|
||||
cat <<EOF > $fyang
|
||||
module $APPNAME{
|
||||
yang-version 1.1;
|
||||
prefix ex;
|
||||
namespace "urn:example:clixon";
|
||||
container interfaces {
|
||||
list a{
|
||||
key "name";
|
||||
leaf name {
|
||||
type string;
|
||||
}
|
||||
container b{
|
||||
list interface {
|
||||
key "name";
|
||||
leaf name {
|
||||
type string;
|
||||
}
|
||||
leaf type {
|
||||
type string;
|
||||
}
|
||||
leaf enabled {
|
||||
type boolean;
|
||||
default true;
|
||||
}
|
||||
leaf status {
|
||||
type string;
|
||||
config false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
new "generate state file with $perfnr list entries"
|
||||
echo -n "<interfaces xmlns=\"urn:example:clixon\"><a><name>foo</name><b>" > $fstate
|
||||
for (( i=0; i<$perfnr; i++ )); do
|
||||
echo -n "<interface><name>e$i</name><status>up</status></interface>" >> $fstate
|
||||
done
|
||||
echo "</b></a></interfaces>" >> $fstate
|
||||
|
||||
new "test params: -f $cfg"
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "kill old backend"
|
||||
|
|
@ -54,8 +98,8 @@ if [ $BE -ne 0 ]; then
|
|||
err
|
||||
fi
|
||||
|
||||
new "start backend -s init -f $cfg -- -s"
|
||||
start_backend -s init -f $cfg -- -s
|
||||
new "start backend -s init -f $cfg -- -sS $fstate"
|
||||
start_backend -s init -f $cfg -- -sS $fstate
|
||||
fi
|
||||
|
||||
new "waiting"
|
||||
|
|
@ -71,11 +115,11 @@ new "waiting"
|
|||
wait_restconf
|
||||
|
||||
new "generate 'large' config with $perfnr list entries"
|
||||
echo -n "<rpc><edit-config><target><candidate/></target><config><interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">" > $fconfig
|
||||
echo -n "<rpc><edit-config><target><candidate/></target><config><interfaces xmlns=\"urn:example:clixon\"><a><name>foo</name><b>" > $fconfig
|
||||
for (( i=0; i<$perfnr; i++ )); do
|
||||
echo -n "<interface><name>e$i</name><type>ex:eth</type></interface>" >> $fconfig
|
||||
done
|
||||
echo "</interfaces></config></edit-config></rpc>]]>]]>" >> $fconfig
|
||||
echo "</b></a></interfaces></config></edit-config></rpc>]]>]]>" >> $fconfig
|
||||
|
||||
# Now take large config file and write it via netconf to candidate
|
||||
new "netconf write large config"
|
||||
|
|
@ -89,20 +133,20 @@ expecteof "time -p $clixon_netconf -qf $cfg" 0 "<rpc><commit/></rpc>]]>]]>" "^<r
|
|||
# Having a large db, get single entries many times
|
||||
# NETCONF get
|
||||
new "netconf get test single req"
|
||||
sel="/if:interfaces/if:interface[if:name='e1']"
|
||||
msg="<rpc><get><filter type=\"xpath\" select=\"$sel\" xmlns:if=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"/></get></rpc>]]>]]>"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$msg" '^<rpc-reply><data><interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>e1</name><type>ex:eth</type><enabled>true</enabled><oper-status>up</oper-status><ex:my-status xmlns:ex="urn:example:clixon"><ex:int>42</ex:int><ex:str>foo</ex:str></ex:my-status></interface></interfaces></data></rpc-reply>]]>]]>$'
|
||||
sel="/ex:interfaces/ex:a[ex:name='foo']/ex:b/ex:interface[ex:name='e1']"
|
||||
msg="<rpc><get><filter type=\"xpath\" select=\"$sel\" xmlns:ex=\"urn:example:clixon\"/></get></rpc>]]>]]>"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$msg" '^<rpc-reply><data><interfaces xmlns="urn:example:clixon"><a><name>foo</name><b><interface><name>e1</name><type>ex:eth</type><enabled>true</enabled><status>up</status></interface></b></a></interfaces></data></rpc-reply>]]>]]>$'
|
||||
|
||||
new "netconf get $perfreq single reqs"
|
||||
{ time -p for (( i=0; i<$perfreq; i++ )); do
|
||||
rnd=$(( ( RANDOM % $perfnr ) ))
|
||||
sel="/if:interfaces/if:interface[if:name='e$rnd']"
|
||||
echo "<rpc><get><filter type=\"xpath\" select=\"$sel\" xmlns:if=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"/></get></rpc>]]>]]>"
|
||||
sel="/ex:interfaces/ex:a[ex:name='foo']/ex:b/ex:interface[ex:name='e$rnd']"
|
||||
echo "<rpc><get><filter type=\"xpath\" select=\"$sel\" xmlns:ex=\"urn:example:clixon\"/></get></rpc>]]>]]>"
|
||||
done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
# RESTCONF get
|
||||
new "restconf get test single req"
|
||||
expecteq "$(curl -s -X GET http://localhost/restconf/data/ietf-interfaces:interfaces/interface=e1)" 0 '{"ietf-interfaces:interface":[{"name":"e1","type":"clixon-example:eth","enabled":true,"oper-status":"up","clixon-example:my-status":{"int":42,"str":"foo"}}]}
|
||||
expecteq "$(curl -s -X GET http://localhost/restconf/data/example:interfaces/a=foo/b/interface=e1)" 0 '{"example:interface":[{"name":"e1","type":"ex:eth","enabled":true,"status":"up"}]}
|
||||
'
|
||||
|
||||
new "restconf get $perfreq single reqs"
|
||||
|
|
@ -111,33 +155,33 @@ new "restconf get $perfreq single reqs"
|
|||
|
||||
{ time -p for (( i=0; i<$perfreq; i++ )); do
|
||||
rnd=$(( ( RANDOM % $perfnr ) ))
|
||||
curl -sG http://localhost/restconf/data/ietf-interfaces:interfaces/interface=e$rnd > /dev/null
|
||||
curl -sG http://localhost/restconf/data/example:interfaces/a/b/interface=e$rnd > /dev/null
|
||||
done } 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
# CLI get
|
||||
new "cli get test single req"
|
||||
expectfn "$clixon_cli -1 -1f $cfg -l o show state xml interfaces interface e1" 0 '^<interface>
|
||||
expectfn "$clixon_cli -1 -1f $cfg -l o show state xml interfaces a foo b interface e1" 0 '^<interface>
|
||||
<name>e1</name>
|
||||
<type>ex:eth</type>
|
||||
<type>eth</type>
|
||||
<enabled>true</enabled>
|
||||
<oper-status>up</oper-status>
|
||||
<status>up</status>
|
||||
</interface>$'
|
||||
|
||||
new "cli get $perfreq single reqs"
|
||||
{ time -p for (( i=0; i<$perfreq; i++ )); do
|
||||
rnd=$(( ( RANDOM % $perfnr ) ))
|
||||
$clixon_cli -1 -f $cfg show state xml interfaces interface e$rnd > /dev/null
|
||||
$clixon_cli -1 -f $cfg show state xml interfaces a b interface e$rnd > /dev/null
|
||||
done } 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
# Get config in one large get
|
||||
new "netconf get large config"
|
||||
{ time -p echo "<rpc><get> <filter type=\"xpath\" select=\"/if:interfaces\" xmlns:if=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"/></get></rpc>]]>]]>" | $clixon_netconf -qf $cfg > /tmp/netconf; } 2>&1 | awk '/real/ {print $2}'
|
||||
{ time -p echo "<rpc><get> <filter type=\"xpath\" select=\"/ex:interfaces/ex:a[name='foo']/ex:b\" xmlns:ex=\"urn:example:clixon\"/></get></rpc>]]>]]>" | $clixon_netconf -qf $cfg > /tmp/netconf; } 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
new "restconf get large config"
|
||||
$TIMEFN curl -sG http://localhost/restconf/data/ietf-interfaces:interfaces 2>&1 | awk '/real/ {print $2}'
|
||||
$TIMEFN curl -sG http://localhost/restconf/data/example:interfaces/a=foo/b 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
new "cli get large config"
|
||||
$TIMEFN $clixon_cli -1f $cfg show state xml interfaces 2>&1 | awk '/real/ {print $2}'
|
||||
$TIMEFN $clixon_cli -1f $cfg show state xml interfaces a foo b 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
new "Kill restconf daemon"
|
||||
stop_restconf
|
||||
|
|
|
|||
212
test/test_perf_state_only.sh
Executable file
212
test/test_perf_state_only.sh
Executable file
|
|
@ -0,0 +1,212 @@
|
|||
#!/usr/bin/env bash
|
||||
# Scaling/ performance tests
|
||||
# State data only, in particular non-config lists (ie not state leafs on a config list)
|
||||
# Restconf/Netconf/CLI
|
||||
# ALso added two layers a/b to get extra depth (som caching can break)
|
||||
|
||||
# Magic line must be first in script (see README.md)
|
||||
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
||||
|
||||
# Which format to use as datastore format internally
|
||||
: ${format:=xml}
|
||||
|
||||
# Number of list/leaf-list entries in file (cant be less than 2)
|
||||
: ${perfnr:=1000}
|
||||
|
||||
# Number of requests made get/put
|
||||
: ${perfreq:=10}
|
||||
|
||||
# time function (this is a mess to get right on freebsd/linux)
|
||||
: ${TIMEFN:=time -p} # portability: 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
APPNAME=example
|
||||
|
||||
cfg=$dir/config.xml
|
||||
fyang=$dir/$APPNAME.yang
|
||||
fconfig=$dir/large.xml
|
||||
fstate=$dir/state.xml
|
||||
|
||||
cat <<EOF > $cfg
|
||||
<clixon-config xmlns="http://clicon.org/config">
|
||||
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
|
||||
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
|
||||
<CLICON_YANG_MAIN_FILE>$fyang</CLICON_YANG_MAIN_FILE>
|
||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||
<CLICON_BACKEND_PIDFILE>/usr/local/var/example/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
||||
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
|
||||
<CLICON_BACKEND_REGEXP>example_backend.so$</CLICON_BACKEND_REGEXP>
|
||||
<CLICON_RESTCONF_PRETTY>false</CLICON_RESTCONF_PRETTY>
|
||||
<CLICON_XMLDB_DIR>$dir</CLICON_XMLDB_DIR>
|
||||
<CLICON_XMLDB_PRETTY>false</CLICON_XMLDB_PRETTY>
|
||||
<CLICON_XMLDB_FORMAT>$format</CLICON_XMLDB_FORMAT>
|
||||
<CLICON_CLI_MODE>example</CLICON_CLI_MODE>
|
||||
<CLICON_CLI_DIR>/usr/local/lib/example/cli</CLICON_CLI_DIR>
|
||||
<CLICON_CLISPEC_DIR>/usr/local/lib/example/clispec</CLICON_CLISPEC_DIR>
|
||||
<CLICON_CLI_LINESCROLLING>0</CLICON_CLI_LINESCROLLING>
|
||||
<CLICON_FEATURE>ietf-netconf:startup</CLICON_FEATURE>
|
||||
</clixon-config>
|
||||
EOF
|
||||
|
||||
cat <<EOF > $fyang
|
||||
module $APPNAME{
|
||||
yang-version 1.1;
|
||||
prefix ex;
|
||||
namespace "urn:example:clixon";
|
||||
container interfaces {
|
||||
config false;
|
||||
list a{
|
||||
key "name";
|
||||
leaf name {
|
||||
type string;
|
||||
}
|
||||
container b{
|
||||
list interface {
|
||||
key "name";
|
||||
leaf name {
|
||||
type string;
|
||||
}
|
||||
leaf type {
|
||||
type string;
|
||||
}
|
||||
leaf enabled {
|
||||
type boolean;
|
||||
default true;
|
||||
}
|
||||
leaf status {
|
||||
type string;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
new "generate state file with $perfnr list entries"
|
||||
echo -n "<interfaces xmlns=\"urn:example:clixon\"><a><name>foo</name><b>" > $fstate
|
||||
for (( i=0; i<$perfnr; i++ )); do
|
||||
echo -n "<interface><name>e$i</name><type>ex:eth</type><status>up</status></interface>" >> $fstate
|
||||
done
|
||||
echo "</b></a></interfaces>" >> $fstate
|
||||
|
||||
new "test params: -f $cfg"
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "kill old backend"
|
||||
sudo clixon_backend -zf $cfg
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
fi
|
||||
|
||||
new "start backend -s init -f $cfg -- -sS $fstate"
|
||||
start_backend -s init -f $cfg -- -sS $fstate
|
||||
fi
|
||||
|
||||
new "waiting"
|
||||
wait_backend
|
||||
|
||||
new "kill old restconf daemon"
|
||||
sudo pkill -u $wwwuser -f clixon_restconf
|
||||
|
||||
new "start restconf daemon"
|
||||
start_restconf -f $cfg
|
||||
|
||||
new "waiting"
|
||||
wait_restconf
|
||||
exit
|
||||
if false; then
|
||||
new "generate 'large' config with $perfnr list entries"
|
||||
echo -n "<rpc><edit-config><target><candidate/></target><config><interfaces xmlns=\"urn:example:clixon\"><a><name>foo</name><b>" > $fconfig
|
||||
for (( i=0; i<$perfnr; i++ )); do
|
||||
echo -n "<interface><name>e$i</name><type>ex:eth</type></interface>" >> $fconfig
|
||||
done
|
||||
echo "</b></a></interfaces></config></edit-config></rpc>]]>]]>" >> $fconfig
|
||||
|
||||
# Now take large config file and write it via netconf to candidate
|
||||
new "netconf write large config"
|
||||
expecteof_file "time -p $clixon_netconf -qf $cfg" 0 "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$" 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
# Now commit it from candidate to running
|
||||
new "netconf commit large config"
|
||||
expecteof "time -p $clixon_netconf -qf $cfg" 0 "<rpc><commit/></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$" 2>&1 | awk '/real/ {print $2}'
|
||||
fi
|
||||
|
||||
# START actual tests
|
||||
# Having a large db, get single entries many times
|
||||
# NETCONF get
|
||||
new "netconf get test single req"
|
||||
sel="/ex:interfaces/ex:a[ex:name='foo']/ex:b/ex:interface[ex:name='e1']"
|
||||
msg="<rpc><get><filter type=\"xpath\" select=\"$sel\" xmlns:ex=\"urn:example:clixon\"/></get></rpc>]]>]]>"
|
||||
time -p expecteof "$clixon_netconf -qf $cfg" 0 "$msg" '^<rpc-reply><data><interfaces xmlns="urn:example:clixon"><a><name>foo</name><b><interface><name>e1</name><type>ex:eth</type><enabled>true</enabled><status>up</status></interface></b></a></interfaces></data></rpc-reply>]]>]]>$'
|
||||
|
||||
new "netconf get $perfreq single reqs"
|
||||
{ time -p for (( i=0; i<$perfreq; i++ )); do
|
||||
rnd=$(( ( RANDOM % $perfnr ) ))
|
||||
sel="/ex:interfaces/ex:a[ex:name='foo']/ex:b/ex:interface[ex:name='e$rnd']"
|
||||
echo "<rpc><get><filter type=\"xpath\" select=\"$sel\" xmlns:ex=\"urn:example:clixon\"/></get></rpc>]]>]]>"
|
||||
done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
# RESTCONF get
|
||||
#echo "curl -s -X GET http://localhost/restconf/data/example:interfaces/a=foo/b/interface=e1"
|
||||
new "restconf get test single req"
|
||||
time -p expecteq "$(curl -s -X GET http://localhost/restconf/data/example:interfaces/a=foo/b/interface=e1)" 0 '{"example:interface":[{"name":"e1","type":"ex:eth","enabled":true,"status":"up"}]}
|
||||
' | awk '/real/ {print $2}'
|
||||
|
||||
new "restconf get $perfreq single reqs"
|
||||
#echo "curl -sG http://localhost/restconf/data/ietf-interfaces:interfaces/interface=e0"
|
||||
#curl -sG http://localhost/restconf/data/ietf-interfaces:interfaces/interface=e67
|
||||
|
||||
{ time -p for (( i=0; i<$perfreq; i++ )); do
|
||||
rnd=$(( ( RANDOM % $perfnr ) ))
|
||||
curl -sG http://localhost/restconf/data/example:interfaces/a/b/interface=e$rnd > /dev/null
|
||||
done } 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
if false; then
|
||||
# CLI get
|
||||
new "cli get test single req"
|
||||
expectfn "$clixon_cli -1 -1f $cfg -l o show state xml interfaces a foo b interface e1" 0 '^<interface>
|
||||
<name>e1</name>
|
||||
<type>eth</type>
|
||||
<enabled>true</enabled>
|
||||
<status>up</status>
|
||||
</interface>$'
|
||||
|
||||
new "cli get $perfreq single reqs"
|
||||
{ time -p for (( i=0; i<$perfreq; i++ )); do
|
||||
rnd=$(( ( RANDOM % $perfnr ) ))
|
||||
$clixon_cli -1 -f $cfg show state xml interfaces a b interface e$rnd > /dev/null
|
||||
done } 2>&1 | awk '/real/ {print $2}'
|
||||
fi
|
||||
# Get config in one large get
|
||||
new "netconf get large config"
|
||||
{ time -p echo "<rpc><get> <filter type=\"xpath\" select=\"/ex:interfaces/ex:a[name='foo']/ex:b\" xmlns:ex=\"urn:example:clixon\"/></get></rpc>]]>]]>" | $clixon_netconf -qf $cfg > /tmp/netconf; } 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
new "restconf get large config"
|
||||
$TIMEFN curl -sG http://localhost/restconf/data/example:interfaces/a=foo/b 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
new "cli get large config"
|
||||
$TIMEFN $clixon_cli -1f $cfg show state xml interfaces a foo b 2>&1 | awk '/real/ {print $2}'
|
||||
|
||||
new "Kill restconf daemon"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
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
|
||||
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ cat <<EOF > $cfg
|
|||
EOF
|
||||
|
||||
# This is a fixed 'state' implemented in routing_backend. It is assumed to be always there
|
||||
state='{"clixon-example:state":{"op":\["42","41","43"\]}'
|
||||
state='{"clixon-example:state":{"op":\["41","42","43"\]}'
|
||||
|
||||
new "test params: -f $cfg -- -s"
|
||||
if [ $BE -ne 0 ]; then
|
||||
|
|
@ -129,7 +129,7 @@ new "restconf debug rpc"
|
|||
#expectpart "$(curl -si -X POST -H "Content-Type: application/yang-data+json" -d {\"clixon-lib:input\":{\"level\":0}} http://localhost/restconf/operations/clixon-lib:debug)" 0 "HTTP/1.1 204 No Content"
|
||||
|
||||
new "restconf get empty config + state json"
|
||||
expecteq "$(curl -sS -X GET http://localhost/restconf/data/clixon-example:state)" 0 '{"clixon-example:state":{"op":["42","41","43"]}}
|
||||
expecteq "$(curl -sS -X GET http://localhost/restconf/data/clixon-example:state)" 0 '{"clixon-example:state":{"op":["41","42","43"]}}
|
||||
'
|
||||
|
||||
new "restconf get empty config + state json with wrong module name"
|
||||
|
|
@ -140,7 +140,7 @@ expectpart "$(curl -siSG http://localhost/restconf/data/badmodule:state)" 0 'HTT
|
|||
|
||||
new "restconf get empty config + state xml"
|
||||
ret=$(curl -s -H "Accept: application/yang-data+xml" -G http://localhost/restconf/data/clixon-example:state)
|
||||
expect='<state xmlns="urn:example:clixon"><op>42</op><op>41</op><op>43</op></state>'
|
||||
expect='<state xmlns="urn:example:clixon"><op>41</op><op>42</op><op>43</op></state>'
|
||||
match=`echo $ret | grep --null -Eo "$expect"`
|
||||
if [ -z "$match" ]; then
|
||||
err "$expect" "$ret"
|
||||
|
|
@ -173,7 +173,7 @@ if [ -z "$match" ]; then
|
|||
fi
|
||||
|
||||
new "restconf GET datastore"
|
||||
expecteq "$(curl -s -X GET http://localhost/restconf/data/clixon-example:state)" 0 '{"clixon-example:state":{"op":["42","41","43"]}}
|
||||
expecteq "$(curl -s -X GET http://localhost/restconf/data/clixon-example:state)" 0 '{"clixon-example:state":{"op":["41","42","43"]}}
|
||||
'
|
||||
|
||||
# Exact match
|
||||
|
|
@ -207,7 +207,7 @@ new "restconf Check eth/0/0 GET augmented state level 2"
|
|||
expectpart "$(curl -s -X GET -H 'Accept: application/yang-data+json' http://localhost/restconf/data/ietf-interfaces:interfaces/interface=eth%2f0%2f0/clixon-example:my-status)" 0 '{"clixon-example:my-status":{"int":42,"str":"foo"}}'
|
||||
|
||||
new "restconf Check eth/0/0 added state"
|
||||
expectpart "$(curl -s -X GET -H 'Accept: application/yang-data+json' http://localhost/restconf/data/clixon-example:state)" 0 '{"clixon-example:state":{"op":\["42","41","43"\]}}'
|
||||
expectpart "$(curl -s -X GET -H 'Accept: application/yang-data+json' http://localhost/restconf/data/clixon-example:state)" 0 '{"clixon-example:state":{"op":\["41","42","43"\]}}'
|
||||
|
||||
new "restconf Re-post eth/0/0 which should generate error"
|
||||
expectpart "$(curl -s -X POST -H "Content-Type: application/yang-data+json" -d '{"ietf-interfaces:interface":{"name":"eth/0/0","type":"clixon-example:eth","enabled":true}}' http://localhost/restconf/data/ietf-interfaces:interfaces)" 0 '{"ietf-restconf:errors":{"error":{"error-type":"application","error-tag":"data-exists","error-severity":"error","error-message":"Data already exists; cannot create new resource"}}}
'
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ expectpart "$(curl -si -X GET -H 'Accept: application/yang-data+xml' http://loca
|
|||
# This just catches the header and the jukebox module, the RFC has foo and bar which
|
||||
# seems wrong to recreate
|
||||
new "B.1.2. Retrieve the Server Module Information"
|
||||
expectpart "$(curl -si -X GET -H 'Accept: application/yang-data+json' http://localhost/restconf/data/ietf-yang-library:modules-state)" 0 "HTTP/1.1 200 OK" 'Cache-Control: no-cache' "Content-Type: application/yang-data+json" '{"ietf-yang-library:modules-state":{"module-set-id":"0","module":\[{"name":"example-events","revision":"","namespace":"urn:example:events","conformance-type":"implement"},{"name":"example-jukebox","revision":"2016-08-15","namespace":"http://example.com/ns/example-jukebox","conformance-type":"implement"},{"name":"example-system","revision":"","namespace":"http://example.com/ns/example-system","conformance-type":"implement"},{"name":"clixon-lib","revision":"2019-08-13","namespace":"http://clicon.org/lib","conformance-type":"implement"},{"name":"ietf-yang-library","revision":"2016-06-21","namespace":"urn:ietf:params:xml:ns:yang:ietf-yang-library"'
|
||||
expectpart "$(curl -si -X GET -H 'Accept: application/yang-data+json' http://localhost/restconf/data/ietf-yang-library:modules-state)" 0 "HTTP/1.1 200 OK" 'Cache-Control: no-cache' "Content-Type: application/yang-data+json" '{"ietf-yang-library:modules-state":{"module-set-id":"0","module":\[{"name":"clixon-lib","revision":"2019-08-13","namespace":"http://clicon.org/lib","conformance-type":"implement"},{"name":"clixon-rfc5277","revision":"2008-07-01","namespace":"urn:ietf:params:xml:ns:netmod:notification","conformance-type":"implement"},{"name":"example-events","revision":"","namespace":"urn:example:events","conformance-type":"implement"},{"name":"example-jukebox","revision":"2016-08-15","namespace":"http://example.com/ns/example-jukebox","conformance-type":"implement"},{"name":"example-system","revision":"","namespace":"http://example.com/ns/example-system","conformance-type":"implement"},{"name":"ietf-inet-types","revision":"2013-07-15","namespace":"urn:ietf:params:xml:ns:yang:ietf-inet-types","conformance-type":"implement"},'
|
||||
|
||||
new "B.1.3. Retrieve the Server Capability Information"
|
||||
expectpart "$(curl -si -X GET -H 'Accept: application/yang-data+xml' http://localhost/restconf/data/ietf-restconf-monitoring:restconf-state/capabilities)" 0 "HTTP/1.1 200 OK" "Content-Type: application/yang-data+xml" 'Cache-Control: no-cache' '<capabilities xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring"><capability>urn:ietf:params:restconf:capability:defaults:1.0?basic-mode=explicit</capability><capability>urn:ietf:params:restconf:capability:depth</capability>
|
||||
|
|
|
|||
|
|
@ -273,10 +273,11 @@ for op in begin validate complete commit; do
|
|||
let line++
|
||||
done
|
||||
|
||||
# End is special because change does not haveold element
|
||||
# End is special because change does not have old element
|
||||
checklog "$nr main_end add: <d>0</d>" $line
|
||||
let line++
|
||||
checklog "$nr main_end change: <b>42</b>" $line
|
||||
# This check does not work if MOVE_TRANS_END is set
|
||||
#checklog "$nr main_end change: <b>42</b>" $line
|
||||
let line+=3 # skip nacm
|
||||
|
||||
let nr++
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue