4
# Tests report generation for instance data. Returns 0 for success, 1 for failure.
11
CLC_IP=`cat ../input/2b_tested.lst |grep '\[.*CLC.*\]'|awk '{ print $1 }'`
13
# Login, and get session id
14
wget -O /tmp/sessionId --no-check-certificate "https://$CLC_IP:8443/loginservlet?adminPw=admin"
15
if [ "$?" -ne "0" ]; then echo "Login failed"; exit 1; fi
16
export SESSIONID=`cat /tmp/sessionId`
17
echo "session id:" $SESSIONID
19
# Clear and generate false data for instances
20
wget --no-check-certificate -O /tmp/nothing "https://$CLC_IP:8443/commandservlet?sessionId=$SESSIONID&className=com.eucalyptus.reporting.instance.FalseDataGenerator&methodName=removeFalseData"
21
if [ "$?" -ne "0" ]; then echo "Data removal failed"; exit 1; fi
22
wget --no-check-certificate -O /tmp/nothing "https://$CLC_IP:8443/commandservlet?sessionId=$SESSIONID&className=com.eucalyptus.reporting.instance.FalseDataGenerator&methodName=generateFalseData"
23
if [ "$?" -ne "0" ]; then echo "Data generation failed"; exit 1; fi
25
# Generate instance report, based upon data generated above
26
wget -O /tmp/instanceReport.csv --no-check-certificate "https://$CLC_IP:8443/reports?session=$SESSIONID&name=user_vms&type=csv&page=0&flush=false&start=1104566480000&end=1104571200000&criterionId=2&groupById=0"
27
if [ "$?" -ne "0" ]; then echo "Report generation failed"; exit 1; fi
29
# Verify that the resulting report has the correct number of entries in it
30
REPORT_USERS_CNT=`cat /tmp/instanceReport.csv | grep 'user-[0-9]\+' | wc -l`
31
if [ "$REPORT_USERS_CNT" -ne "8" ]; then
32
echo "Report users count is incorrect."
36
# Verify that the report is correct, using the CsvChecker tool.
37
java -jar CsvChecker.jar 0.2 instanceReference.csv /tmp/instanceReport.csv
38
if [ "$?" -ne "0" ]; then echo "Report failed values check"; exit 1; fi