#!/bin/bash
# Test2: backend and netconf basic functionality
# include err() and new() functions
. ./lib.sh
# kill old backend (if any)
new "kill old backend"
sudo clixon_backend -zf $clixon_cf
if [ $? -ne 0 ]; then
err
fi
new "start backend"
# start new backend
sudo clixon_backend -If $clixon_cf
if [ $? -ne 0 ]; then
err
fi
new "netconf get empty config"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^]]>]]>$"
new "netconf edit config"
expecteof "clixon_netconf -qf $clixon_cf" "eth0eth1true9.2.3.424]]>]]>" "^]]>]]>$"
new "netconf get config xpath"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^true]]>]]>$"
new "netconf validate missing type"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^"
new "netconf discard-changes"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^]]>]]>$"
new "netconf get empty config2"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^]]>]]>$"
new "netconf edit config patch"
expecteof "clixon_netconf -qf $clixon_cf" "eth1eth]]>]]>" "^]]>]]>$"
new "netconf validate"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^]]>]]>$"
new "netconf commit"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^]]>]]>$"
new "netconf lock/unlock"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>]]>]]>" "^]]>]]>]]>]]>$"
new "netconf lock/lock"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^]]>]]>$"
new "netconf lock"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^]]>]]>$"
new "close-session"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^]]>]]>$"
new "kill-session"
expecteof "clixon_netconf -qf $clixon_cf" "44]]>]]>" "^]]>]]>$"
new "copy startup"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^]]>]]>$"
new "netconf get startup"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^eth1ethtrue]]>]]>$"
new "netconf delete startup"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^]]>]]>$"
new "netconf check empty startup"
expecteof "clixon_netconf -qf $clixon_cf" "]]>]]>" "^]]>]]>$"
new "netconf subscription"
expectwait "clixon_netconf -qf $clixon_cf" "ROUTING]]>]]>" "^]]>]]>Routing notification]]>]]>$" 30
new "Kill backend"
# Check if still alive
pid=`pgrep clixon_backend`
if [ -z "$pid" ]; then
err "backend already dead"
fi
# kill backend
sudo clixon_backend -zf $clixon_cf
if [ $? -ne 0 ]; then
err "kill backend"
fi