* Restructured and extended <stats> rpc to schema mountpoints

* New revision of clixon-lib.yang
* CLI: Added `show statistics` example code for backend and CLI memory stats
This commit is contained in:
Olof hagsand 2023-05-05 17:43:03 +02:00
parent a0df12134a
commit b6116261a3
11 changed files with 285 additions and 60 deletions

View file

@ -91,7 +91,7 @@ function testrun(){
pid=$(cat $pidfile)
new "netconf get stats"
rpc=$(chunked_framing "<rpc $DEFAULTNS><stats $LIBNS/></rpc>")
rpc=$(chunked_framing "<rpc $DEFAULTNS><stats $LIBNS><modules>true</modules></stats></rpc>")
res=$(echo "$DEFAULTHELLO$rpc" | $clixon_netconf -qef $cfg)
# echo "res:$res"
err0=$(echo "$res" | $clixon_util_xpath -p "/rpc-reply/rpc-error")
@ -112,7 +112,7 @@ function testrun(){
fi
for db in running candidate startup; do
echo "$db"
resdb0=$(echo "$res" | $clixon_util_xpath -p "/rpc-reply/datastore[name=\"$db\"]")
resdb0=$(echo "$res" | $clixon_util_xpath -p "/rpc-reply/datastores/datastore[name=\"$db\"]")
resdb=${resdb0#"nodeset:0:"}
if [ "$resdb0" = "$resdb" ]; then
err1 "nodeset:0:" "$resdb0"
@ -122,15 +122,6 @@ function testrun(){
echo -n " mem: "
echo $resdb | $clixon_util_xpath -p "datastore/size" | awk -F ">" '{print $2}' | awk -F "<" '{print $1}' | awk '{print $1/1000000 "M"}'
done
for mod in clixon-config; do
echo "$mod"
resmod0=$(echo "$res" | $clixon_util_xpath -p "/rpc-reply/module[name=\"$mod\"]")
resmod=${resmod0#"nodeset:0:"}
echo -n " objects: "
echo $resmod | $clixon_util_xpath -p "module/nr" | awk -F ">" '{print $2}' | awk -F "<" '{print $1}'
echo -n " mem: "
echo $resmod | $clixon_util_xpath -p "module/size" | awk -F ">" '{print $2}' | awk -F "<" '{print $1}' | awk '{print $1/1000000 "M"}'
done
if [ $BE -ne 0 ]; then
new "Kill backend"
# Check if premature kill