datastore text works with replace

This commit is contained in:
Olof hagsand 2017-04-17 19:47:32 +02:00
parent ee9b74d735
commit d02015f456
15 changed files with 627 additions and 160 deletions

View file

@ -17,9 +17,8 @@ new(){
# sleep 1
}
# clicon_cli tester. First arg is command and second is expected outcome
# clixon tester. First arg is command and second is expected outcome
expectfn(){
cmd=$1
expect=$2
ret=`$cmd`
@ -40,7 +39,8 @@ expectfn(){
fi
}
# clicon_cli tester. First arg is command and second is expected outcome
# clixon tester. First arg is command second is stdin and
# third is expected outcome
expecteof(){
cmd=$1
input=$2
@ -61,7 +61,8 @@ EOF
fi
}
# clicon_cli tester. First arg is command and second is expected outcome
# clixon tester. First arg is command second is stdin and
# third is expected outcome, fourth is how long to wait
expectwait(){
cmd=$1
input=$2

View file

@ -1,5 +1,5 @@
#!/bin/bash
# Test2: backend and netconf basic functionality
# Test4: Yang specifics: multi-keys and empty type
# include err() and new() functions
. ./lib.sh

63
test/test5.sh Executable file
View file

@ -0,0 +1,63 @@
#!/bin/bash
# Test5: datastore
# include err() and new() functions
. ./lib.sh
datastore=datastore_client
cat <<EOF > /tmp/ietf-ip.yang
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;
}
}
}
EOF
run(){
name=$1
dir=/tmp/$name
if [ ! -d $dir ]; then
mkdir $dir
fi
rm -rf $dir/*
conf="-d candidate -b $dir -p ../datastore/$name/$name.so -y /tmp -m ietf-ip"
new "datastore $name init"
expectfn "$datastore $conf init" ""
new "datastore $name get empty"
expectfn "$datastore $conf get /" "^<config/>$"
new "datastore $name put top"
expectfn "$datastore $conf put replace / <config><x><y><a>foo</a><b>bar</b><c>fie</c></y></x></config>" ""
new "datastore $name get config"
expectfn "$datastore $conf get /" "^<config><x><y><a>foo</a><b>bar</b><c>fie</c></y></x></config>$"
new "datastore $name put delete"
expectfn "$datastore $conf put delete / <config/>" ""
new "datastore $name get deleted"
expectfn "$datastore $conf get /" "^<config/>$"
rm -rf $dir
}
#run keyvalue # cant get the put to work
run text