readd namespace cache
This commit is contained in:
parent
0fd71ec372
commit
5535239363
3 changed files with 31 additions and 26 deletions
|
|
@ -458,12 +458,12 @@ xml2ns(cxobj *x,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if 0 /* Dont auto-populate all caches, eg startup doesnt need a cache */
|
|
||||||
/* Set default namespace cache (since code is at this point,
|
/* Set default namespace cache (since code is at this point,
|
||||||
* no cache was found */
|
* no cache was found
|
||||||
|
* If not, this is devastating when populating deep yang structures
|
||||||
|
*/
|
||||||
if (ns && nscache_set(x, prefix, ns) < 0)
|
if (ns && nscache_set(x, prefix, ns) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
#endif
|
|
||||||
ok:
|
ok:
|
||||||
if (namespace)
|
if (namespace)
|
||||||
*namespace = ns;
|
*namespace = ns;
|
||||||
|
|
|
||||||
|
|
@ -12,24 +12,35 @@ APPNAME=example
|
||||||
cfg=$dir/scaling-conf.xml
|
cfg=$dir/scaling-conf.xml
|
||||||
fyang=$dir/scaling.yang
|
fyang=$dir/scaling.yang
|
||||||
|
|
||||||
|
# NOTE, added a deep yang structure (x0,x1,x2) to expose performance due to turned off caching.
|
||||||
cat <<EOF > $fyang
|
cat <<EOF > $fyang
|
||||||
module scaling{
|
module scaling{
|
||||||
yang-version 1.1;
|
yang-version 1.1;
|
||||||
namespace "urn:example:clixon";
|
namespace "urn:example:clixon";
|
||||||
prefix ip;
|
prefix ip;
|
||||||
container x {
|
container "x0" {
|
||||||
list y {
|
container x1 {
|
||||||
key "a";
|
list x2 {
|
||||||
leaf a {
|
key "name";
|
||||||
type int32;
|
leaf name {
|
||||||
}
|
type string;
|
||||||
leaf b {
|
}
|
||||||
type int32;
|
container x {
|
||||||
}
|
list y {
|
||||||
}
|
key "a";
|
||||||
leaf-list c {
|
leaf a {
|
||||||
type string;
|
type int32;
|
||||||
}
|
}
|
||||||
|
leaf b {
|
||||||
|
type int32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
leaf-list c {
|
||||||
|
type string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
@ -65,11 +76,11 @@ fi
|
||||||
# Use it latter to generate startup-db in xml, tree formats
|
# Use it latter to generate startup-db in xml, tree formats
|
||||||
tmpx=$dir/tmp.xml
|
tmpx=$dir/tmp.xml
|
||||||
new "generate large startup config ($tmpx) with $perfnr entries"
|
new "generate large startup config ($tmpx) with $perfnr entries"
|
||||||
echo -n "<config><x xmlns=\"urn:example:clixon\">" > $tmpx
|
echo -n "<config><x0 xmlns=\"urn:example:clixon\"><x1><x2><name>ip</name><x>" > $tmpx
|
||||||
for (( i=0; i<$perfnr; i++ )); do
|
for (( i=0; i<$perfnr; i++ )); do
|
||||||
echo -n "<y><a>$i</a><b>$i</b></y>" >> $tmpx
|
echo -n "<y><a>$i</a><b>$i</b></y>" >> $tmpx
|
||||||
done
|
done
|
||||||
echo "</x></config>" >> $tmpx
|
echo "</x></x2></x1></x0></config>" >> $tmpx
|
||||||
|
|
||||||
if false; then # XXX JSON dont work as datastore yet
|
if false; then # XXX JSON dont work as datastore yet
|
||||||
# Then generate large JSON file (cant translate namespace - long story)
|
# Then generate large JSON file (cant translate namespace - long story)
|
||||||
|
|
@ -90,7 +101,7 @@ fi
|
||||||
# Loop over mode and format
|
# Loop over mode and format
|
||||||
for mode in startup running; do
|
for mode in startup running; do
|
||||||
file=$dir/${mode}_db
|
file=$dir/${mode}_db
|
||||||
for format in tree xml; do # json - something w namespaces
|
for format in xml; do # json - something w namespaces
|
||||||
sudo rm -f $file
|
sudo rm -f $file
|
||||||
sudo touch $file
|
sudo touch $file
|
||||||
sudo chmod 666 $file
|
sudo chmod 666 $file
|
||||||
|
|
@ -102,17 +113,11 @@ for mode in startup running; do
|
||||||
json)
|
json)
|
||||||
cp $tmpj $file
|
cp $tmpj $file
|
||||||
;;
|
;;
|
||||||
tree)
|
|
||||||
echo "clixon_util_datastore -d ${mode} -f tree -y $fyang -b $dir -x $tmpx put create"
|
|
||||||
|
|
||||||
clixon_util_datastore -d ${mode} -f tree -y $fyang -b $dir -x $tmpx put create
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
new "Startup format: $format mode:$mode"
|
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
|
# 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}'
|
{ 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
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,8 @@ cat <<EOF > $fyang
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# No args
|
||||||
testrun(){
|
testrun(){
|
||||||
|
|
||||||
# Initial data (default y not given)
|
# Initial data (default y not given)
|
||||||
XML='<a xmlns="urn:example:default"><b><c>0</c></b></a>'
|
XML='<a xmlns="urn:example:default"><b><c>0</c></b></a>'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue