#!/bin/bash # Test5: datastore tests. # Just run a binary direct to datastore. No clixon. # include err() and new() functions and creates $dir . ./lib.sh fyang=$dir/ietf-ip.yang datastore=datastore_client cat < $fyang module ietf-ip{ container x { list y { key "a b"; leaf a { type string; } leaf b { type string; } leaf c { type string; } } leaf d { type empty; } container f { leaf-list e { type string; } } leaf g { type string; } container h { leaf j { type string; } } } } EOF db='12first-entry13second-entry23third-entryabcastring' run(){ name=$1 mydir=$dir/$name if [ ! -d $mydir ]; then mkdir $mydir fi rm -rf $mydir/* conf="-d candidate -b $mydir -p ../datastore/$name/$name.so -y $dir -m ietf-ip" new "datastore $name init" expectfn "$datastore $conf init" 0 "" # Whole tree operations new "datastore $name put all replace" expectfn "$datastore $conf put replace $db" 0 "" new "datastore $name get" expectfn "$datastore $conf get /" 0 "^$db$" new "datastore $name put all remove" expectfn "$datastore $conf put remove " 0 "" new "datastore $name get" expectfn "$datastore $conf get /" 0 "^$" new "datastore $name put all merge" expectfn "$datastore $conf put merge $db" 0 "" new "datastore $name get" expectfn "$datastore $conf get /" 0 "^$db$" new "datastore $name put all delete" expectfn "$datastore $conf put remove " 0 "" new "datastore $name get" expectfn "$datastore $conf get /" 0 "^$" new "datastore $name put all create" expectfn "$datastore $conf put create $db" 0 "" new "datastore $name get" expectfn "$datastore $conf get /" 0 "^$db$" new "datastore $name put top create" expectfn "$datastore $conf put create " 0 "" # error # Single key operations # leaf new "datastore $name put all delete" expectfn "$datastore $conf delete" 0 "" new "datastore $name init" expectfn "$datastore $conf init" 0 "" new "datastore $name create leaf" expectfn "$datastore $conf put create 13newentry" 0 "" new "datastore $name create leaf" expectfn "$datastore $conf put create 13newentry" 0 "" new "datastore $name delete leaf" expectfn "$datastore $conf put delete 13" 0 "" new "datastore $name replace leaf" expectfn "$datastore $conf put create 13newentry" 0 "" new "datastore $name remove leaf" expectfn "$datastore $conf put remove " 0 "" new "datastore $name remove leaf" expectfn "$datastore $conf put remove 13" 0 "" new "datastore $name delete leaf" expectfn "$datastore $conf put delete " 0 "" new "datastore $name merge leaf" expectfn "$datastore $conf put merge nalle" 0 "" new "datastore $name replace leaf" expectfn "$datastore $conf put replace nalle" 0 "" new "datastore $name merge leaf" expectfn "$datastore $conf put merge 13newentry" 0 "" new "datastore $name replace leaf" expectfn "$datastore $conf put replace 13newentry" 0 "" new "datastore $name create leaf" expectfn "$datastore $conf put create aaa" 0 "" new "datastore $name create leaf" expectfn "$datastore $conf put create 13newentry" 0 "" new "datastore other db init" expectfn "$datastore -d kalle -b $mydir -p ../datastore/$name/$name.so -y $dir -m ietf-ip init" 0 "" new "datastore other db copy" expectfn "$datastore $conf copy kalle" 0 "" diff $mydir/kalle_db $mydir/candidate_db new "datastore lock" expectfn "$datastore $conf lock 756" 0 "" #leaf-list rm -rf $mydir } #run keyvalue # cant get the put to work run text rm -rf $dir