#!/bin/bash # Test of backward compatibility # 1) Load <3.9 startup/running/extra files without namespaces - ensure it returns namespaces # # Magic line must be first in script (see README.md) s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi APPNAME=example cfg=$dir/conf_startup.xml # Use yang in example cat < $cfg $cfg /usr/local/share/clixon $IETFRFC clixon-example $APPNAME /usr/local/lib/$APPNAME/backend /usr/local/lib/$APPNAME/netconf /usr/local/lib/$APPNAME/restconf /usr/local/lib/$APPNAME/cli /usr/local/lib/$APPNAME/clispec /usr/local/var/$APPNAME/$APPNAME.sock /usr/local/var/$APPNAME/$APPNAME.pidfile 1 /usr/local/var/$APPNAME /usr/local/lib/xmldb/text.so 0 init EOF testrun(){ mode=$1 expect=$2 dbdir=$dir/db cat < $dbdir run ex:eth EOF sudo mv $dbdir /usr/local/var/$APPNAME/running_db cat < $dbdir startup ex:eth EOF sudo mv $dbdir /usr/local/var/$APPNAME/startup_db cat < $dir/config extra ex:eth EOF new "test params: -f $cfg -s $mode -c $dir/config" if [ $BE -ne 0 ]; then new "kill old backend" sudo clixon_backend -zf $cfg if [ $? -ne 0 ]; then err fi new "start backend -f $cfg -s $mode -c $dir/config" start_backend -f $cfg -s $mode -c $dir/config new "waiting" sleep $RCWAIT fi new "Check $mode" expecteof "$clixon_netconf -qf $cfg" 0 ']]>]]>' "^$expect]]>]]>$" if [ $BE -eq 0 ]; then return # 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 } # testrun testrun running 'extraex:ethtrueloex:loopbacktruerunex:ethtrue' testrun startup 'extraex:ethtrueloex:loopbacktruestartupex:ethtrue' rm -rf $dir