#!/usr/bin/env bash # List pagination tests loosely based on draft-wwlh-netconf-list-pagination-00 # The example-social yang file is used # This tests contains a large config list: members/member/favorites/uint8-numbers # Magic line must be first in script (see README.md) s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi echo "...skipped: Must run interactvely" if [ "$s" = $0 ]; then exit 0; else return 0; fi APPNAME=example cfg=$dir/conf.xml fexample=$dir/example-social.yang # Common example-module spec (fexample must be set) . ./example_social.sh # Validate internal state xml : ${validatexml:=false} # Number of audit-log entries # Note mem.sh sets it : ${perfnr:=20000} cat < $cfg $cfg ietf-netconf:startup clixon-restconf:allow-auth-none /usr/local/share/clixon $IETFRFC $dir /usr/local/var/$APPNAME/$APPNAME.sock /usr/local/lib/$APPNAME/backend $dir/restconf.pidfile $dir xml true $APPNAME /usr/local/lib/$APPNAME/cli /usr/local/lib/$APPNAME/clispec $validatexml EOF # Based on draft-wwlh-netconf-list-pagination-00 A.2 but bob has a generated uint8-numbers list # start file cat <<'EOF' > $dir/startup_db alice alice@example.com $0$1543 BASE64VALUE= Every day is a new day false public bob eric lin 2020-07-08T13:12:45Z My first post Hiya all! 2020-07-09T01:32:23Z Sleepy... Catch y'all tomorrow. 17 13 11 7 5 3 -5 -3 -1 1 3 5 bob bob@example.com $0$1543 BASE64VALUE= Here and now, like never before. public 2020-08-14T03:32:25Z Just got in. 2020-08-14T03:33:55Z What's new? 2020-08-14T03:34:30Z I'm bored... EOF new "generate config with $perfnr leaf-list entries" for (( i=0; i<$perfnr; i++ )); do echo " $i" >> $dir/startup_db done # end file cat <<'EOF' >> $dir/startup_db -9 2 EOF new "test params: -f $cfg -s startup" if [ $BE -ne 0 ]; then new "kill old backend" sudo clixon_backend -zf $cfg if [ $? -ne 0 ]; then err fi sudo pkill -f clixon_backend # to be sure new "start backend -s startup -f $cfg" start_backend -s startup -f $cfg fi new "wait backend" wait_backend # XXX How to run without using a terminal? new "cli show" $clixon_cli -f $cfg -l o -1 show pagination xpath /es:members/es:member[es:member-id=\'bob\']/es:favorites/es:uint64-numbers cli if [ $BE -ne 0 ]; then 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 fi unset validatexml unset perfnr rm -rf $dir new "endtest" endtest