#!/bin/bash
usage="usage: test_soap a|r|w [host] [alarm-params|watchdog-params]"
if [ $# -eq 0 ]
then
echo $usage
exit 1
fi
if [ $# -eq 1 ]
then
echo No host given. Using localhost
host=localhost
else
host=$2
fi
if [ $1 = "a" ]
then
# alarm handling
curl "http://$host/sysal/soap/service.php?class=SysalSoap" -X POST -d '11.2.3.41.2.3.4SRV_IDP' >result.xml
elif [ $1 = "r" ]
then
# alarm reset
curl "http://$host/sysal/soap/service.php?class=SysalSoap" -X POST -d '11.2.3.41.2.3.4SRV_REST' >result.xml
elif [ $1 = "w" ]
then
# watchdog handling
curl "http://$host/sysal/soap/service.php?class=SysalSoap" -X POST -d 'Dog13' >result.xml
else
echo $usage
exit 1
fi
if ! grep ">0/dev/null
then
cat result.xml
exit 1
fi