xcat-core/xCAT-server/xCAT-wsapi/xcatws-test.sh

36 lines
2.2 KiB
Bash
Raw Normal View History

2014-02-03 20:58:15 +00:00
#!/bin/bash
# IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html
2014-01-31 13:26:55 +00:00
# Test driver for xcatws.cgi, pass two arguments to it, user and password.
# Usage example: ./xcatws-test.sh wsuer cluster
2014-01-31 13:26:55 +00:00
user=$1
pw=$2
format='format=json&pretty=1'
2014-02-03 20:58:15 +00:00
#todo: add a test case for every api call that is documented
#curl [options] [URL...]:
# -X/--request <command> : commands include PUT,POST,GET and DELETE.
# -k/--insecure : This option explicitly allows curl to perform "insecure" SSL connections and transfers.
2014-02-03 20:58:15 +00:00
2014-02-25 09:11:22 +00:00
curl -X GET -k "https://127.0.0.1/xcatws/nodes?userName=$user&password=$pw&$format"
curl -X GET -k "https://127.0.0.1/xcatws/nodes?userName=$user&password=$pw&$format&field=mac"
curl -X GET -k "https://127.0.0.1/xcatws/nodes/test001-test006?userName=$user&password=$pw&$format"
curl -X GET -k "https://127.0.0.1/xcatws/nodes/test001-test006?userName=$user&password=$pw&$format&field=mac"
curl -X DELETE -k "http://127.0.0.1/xcatws/nodes/test001?userName=$user&password=$pw"
2014-02-25 09:11:22 +00:00
curl -X PUT -k "https://127.0.0.1/xcatws/nodes/test001?userName=$user&password=$pw&$format" -H Content-Type:application/json --data '{"room":"hi","unit":"7"}'
curl -X POST -k "https://127.0.0.1/xcatws/nodes/ws1?userName=$user&password=$pw&$format" -H Content-Type:application/json --data '{"groups":"wstest"}'
curl -X POST -k "https://127.0.0.1/xcatws/nodes/bruce/dsh?userName=$user&password=$pw&$format" -H Content-Type:application/json --data '["command=date"]'
2014-02-03 20:58:15 +00:00
2014-02-25 09:11:22 +00:00
curl -X GET -k "https://127.0.0.1/xcatws/groups?userName=$user&password=$pw&$format"
2014-01-31 13:26:55 +00:00
2014-02-25 09:11:22 +00:00
curl -X GET -k "https://127.0.0.1/xcatws/images?userName=$user&password=$pw&$format"
curl -X GET -k "https://127.0.0.1/xcatws/images?userName=$user&password=$pw&$format&field=osvers"
curl -X GET -k "https://127.0.0.1/xcatws/images/bp-netboot?userName=$user&password=$pw&$format"
curl -X GET -k "https://127.0.0.1/xcatws/images/bp-netboot?userName=$user&password=$pw&$format&field=osvers"
#todo: remove when these test cases are in xcatws-test.pl
./xcatws-test.pl -u "https://127.0.0.1/xcatws/nodes/test001?userName=$user&password=$pw" -m GET
./xcatws-test.pl -u "https://127.0.0.1/xcatws/nodes/test001?userName=$user&password=$pw" -m PUT "nodepos.room=foo"