* New backend startup and upgrade support, see [doc/startup.md] for details
* Datastore files contain RFC7895 module-state information
This commit is contained in:
parent
28bd698968
commit
560110b4e8
44 changed files with 1595 additions and 631 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# Startup test: Start clicon daemon in the (four) different startup modes
|
||||
# and the dbs and files are setup as follows:
|
||||
# (init, none, running, or startup)
|
||||
# The dbs and files are setup as follows:
|
||||
# - The example reset_state callback adds "lo" interface
|
||||
# - An extra xml configuration file starts with an "extra" interface
|
||||
# - running db starts with a "run" interface
|
||||
|
|
@ -27,8 +28,7 @@ cat <<EOF > $cfg
|
|||
<CLICON_CLISPEC_DIR>/usr/local/lib/$APPNAME/clispec</CLICON_CLISPEC_DIR>
|
||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||
<CLICON_BACKEND_PIDFILE>/usr/local/var/$APPNAME/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
||||
<CLICON_CLI_GENMODEL_COMPLETION>1</CLICON_CLI_GENMODEL_COMPLETION>
|
||||
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
|
||||
<CLICON_XMLDB_DIR>$dir</CLICON_XMLDB_DIR>
|
||||
<CLICON_XMLDB_PLUGIN>/usr/local/lib/xmldb/text.so</CLICON_XMLDB_PLUGIN>
|
||||
<CLICON_CLI_LINESCROLLING>0</CLICON_CLI_LINESCROLLING>
|
||||
<CLICON_STARTUP_MODE>init</CLICON_STARTUP_MODE>
|
||||
|
|
@ -36,12 +36,17 @@ cat <<EOF > $cfg
|
|||
|
||||
EOF
|
||||
|
||||
# Create a pre-set running, startup and (extra) config.
|
||||
# The configs are identified by an interface called run, startup, extra.
|
||||
# Depending on startup mode (init, none, running, or startup)
|
||||
# expect different output of an initial get-config
|
||||
testrun(){
|
||||
mode=$1
|
||||
expect=$2
|
||||
|
||||
dbdir=$dir/db
|
||||
cat <<EOF > $dbdir
|
||||
# Create running-db containin the interface "run"
|
||||
sudo rm -f $dir/running_db
|
||||
cat <<EOF > $dir/running_db
|
||||
<config>
|
||||
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
|
||||
<interface>
|
||||
|
|
@ -51,9 +56,10 @@ testrun(){
|
|||
</interfaces>
|
||||
</config>
|
||||
EOF
|
||||
sudo mv $dbdir /usr/local/var/$APPNAME/running_db
|
||||
|
||||
cat <<EOF > $dbdir
|
||||
# Create startup-db containin the interface "startup"
|
||||
sudo rm -f $dir/startup_db
|
||||
cat <<EOF > $dir/startup_db
|
||||
<config>
|
||||
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
|
||||
<interface>
|
||||
|
|
@ -63,8 +69,9 @@ EOF
|
|||
</interfaces>
|
||||
</config>
|
||||
EOF
|
||||
sudo mv $dbdir /usr/local/var/$APPNAME/startup_db
|
||||
|
||||
# Create extra xml containin the interface "extra"
|
||||
sudo rm -f $dir/config
|
||||
cat <<EOF > $dir/config
|
||||
<config>
|
||||
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
|
||||
|
|
@ -76,20 +83,23 @@ EOF
|
|||
</config>
|
||||
EOF
|
||||
|
||||
# kill old backend (if any)
|
||||
new "kill old backend"
|
||||
sudo clixon_backend -zf $cfg
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
if [ $BE -ne 0 ]; then # Bring your own backend
|
||||
# kill old backend (if any)
|
||||
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 -- -r"
|
||||
start_backend -s $mode -f $cfg -c $dir/config -- -r
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
else
|
||||
new "Restart backend as eg follows: -Ff $cfg -s $mode -c $dir/config -- -r ($BETIMEOUT s)"
|
||||
sleep $BETIMEOUT
|
||||
fi
|
||||
|
||||
new "start backend -f $cfg -s $mode -c $dir/config"
|
||||
start_backend -s $mode -f $cfg -c $dir/config
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
||||
new "Check $mode"
|
||||
new "Startup test for init mode: $mode"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><get-config><source><running/></source></get-config></rpc>]]>]]>' "^<rpc-reply>$expect</rpc-reply>]]>]]>$"
|
||||
|
||||
new "Kill backend"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue