This commit is contained in:
Olof hagsand 2017-08-01 19:39:19 +02:00
parent fd91bb2933
commit 265ed859de
8 changed files with 137 additions and 39 deletions

View file

@ -40,7 +40,7 @@ expectfn(){
return
fi
# grep extended grep
match=`echo "$ret" | grep -EZo "$expect"`
match=`echo $ret | grep -EZo "$expect"`
# echo "ret:\"$ret\""
# echo "expect:\"$expect\""
# echo "match:\"$match\""

View file

@ -30,10 +30,11 @@ new "restconf options"
expectfn "curl -i -sS -X OPTIONS http://localhost/restconf/data" "Allow: OPTIONS,HEAD,GET,POST,PUT,DELETE"
new "restconf head"
expectfn "curl -sS -I http://localhost/restconf/data" "Content-Type: application/yang.data\+json"
expectfn "curl -sS -I http://localhost/restconf/data" "HTTP/1.1 200 OK"
#Content-Type: application/yang-data+json"
new "restconf get empty config"
expectfn "curl -sSG http://localhost/restconf/data" "^null $"
expectfn "curl -sSG http://localhost/restconf/data" "null"
new "restconf Add subtree to datastore using POST"
expectfn 'curl -sS -X POST -d {"interfaces":{"interface":{"name":"eth/0/0","type":"eth","enabled":"true"}}} http://localhost/restconf/data' ""
@ -46,7 +47,7 @@ new "restconf delete interfaces"
expectfn 'curl -sS -X DELETE http://localhost/restconf/data/interfaces' ""
new "restconf Check empty config"
expectfn "curl -sSG http://localhost/restconf/data" "^null $"
expectfn "curl -sSG http://localhost/restconf/data" "null"
new "restconf Add interfaces subtree eth/0/0 using POST"
expectfn 'curl -sS -X POST -d {"interface":{"name":"eth/0/0","type":"eth","enabled":"true"}} http://localhost/restconf/data/interfaces' ""
@ -69,7 +70,7 @@ new "restconf delete eth/0/0"
expectfn 'curl -sS -X DELETE http://localhost/restconf/data/interfaces/interface=eth%2f0%2f0' ""
new "Check deleted eth/0/0"
expectfn 'curl -sS -G http://localhost/restconf/data' "^null $"
expectfn 'curl -sS -G http://localhost/restconf/data' "null"
new "restconf Re-Delete eth/0/0 using none should generate error"
expectfn 'curl -sS -X DELETE http://localhost/restconf/data/interfaces/interface=eth%2f0%2f0' "Not Found"
@ -81,8 +82,15 @@ new "restconf get subtree"
expectfn "curl -sS -G http://localhost/restconf/data" '{"interfaces": {"interface": {"name": "eth/0/0","type": "eth","enabled": "true"}}}
$'
new "restconf rpc using POST (wrong output encoding)"
expectfn 'curl -sS -X POST -d {"input":{"routing-instance-name":"ipv4"}} http://localhost/restconf/operations/rt:fib-route' '{"rpc-reply": {"route": {"address-family": "ipv4","next-hop": {"next-hop-list": "2.3.4.5"}}}} $'
new "restconf rpc using POST json"
expectfn 'curl -sS -X POST -d {"input":{"routing-instance-name":"ipv4"}} http://localhost/restconf/operations/rt:fib-route' '{ "output": { "route": { "address-family": "ipv4", "next-hop": { "next-hop-list": "2.3.4.5" } } } } '
new "restconf rpc using POST xml"
ret=$(curl -sS -X POST -H "Accept: application/yang-data+xml" -d '{"input":{"routing-instance-name":"ipv4"}}' http://localhost/restconf/operations/rt:fib-route)
expect="<output> <route> <address-family>ipv4</address-family> <next-hop> <next-hop-list>2.3.4.5</next-hop-li t> </next-hop> </route> </output> "
match=`echo $ret | grep -EZo "$expect"`
echo -n "ret: "
echo $ret
new "Kill restconf daemon"
sudo pkill -u www-data clixon_restconf