diff --git a/xCAT-test/autotest/testcase/rvitals/cases0 b/xCAT-test/autotest/testcase/rvitals/cases0 index 996ee8dea..4a40f6b5c 100644 --- a/xCAT-test/autotest/testcase/rvitals/cases0 +++ b/xCAT-test/autotest/testcase/rvitals/cases0 @@ -18,9 +18,8 @@ end start:rvitals_temp description:Retrieves temperatures Attribute: $$CN-The operation object of rvitals command -cmd:rvitals $$CN temp +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN temp check:rc==0 -check:output=~System Temperature|Ambient Temp|temperature end start:rvitals_disktemp @@ -46,17 +45,15 @@ end start:rvitals_voltage description:Retrieves power supply and VRM voltage readings Attribute: $$CN-The operation object of rvitals command -cmd:rvitals $$CN voltage +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN voltage check:rc==0 -check:output=~Frame Voltages|CPU VDD Volt|SysBrd end start:rvitals_power description:Retrieves power status Attribute: $$CN-The operation object of rvitals command -cmd:rvitals $$CN power +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN power check:rc==0 -check:output=~Current Power Status:\s*(on|off)|Power Status:\s*(on|off) end start:rvitals_state @@ -79,12 +76,8 @@ end start:rvitals_all description:Retrieves all status Attribute: $$CN-The operation object of rvitals command -cmd:rvitals $$CN all +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN all check:rc==0 -check:output=~System Temperature|Ambient Temp -check:output=~Frame Voltages|CPU VDD Volt|SysBrd -check:output=~Current Power Status:\s*(on|off)|Power Status:\s*(on|off) -check:output=~ System State:|System Event:|NMI State end start:rvitals_leds @@ -98,34 +91,28 @@ end start:rvitals_fanspeed description:Retrieves fan speeds. Attribute: $$CN-The operation object of rvitals command -cmd:rvitals $$CN fanspeed +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN fanspeed check:rc==0 -check:output=~Fan|Fan\s*\d:\s*\w+\s*RPM end start:rvitals_wattage description:Retrieves wattage readings. Attribute: $$CN-The operation object of rvitals command -cmd:rvitals $$CN wattage +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN wattage check:rc==0 -check:output=~12V Sense|AC Avg Power -check:output=~Mem Cache Power|MEM Avg Power end start:rvitals_altitude description:Retrieves altitude readings. Attribute: $$CN-The operation object of rvitals command -cmd:rvitals $$CN altitude +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN altitude check:rc==0 -check:output=~No attributes returned from the BMC end start:rvitals_noderange_err description:using not defined node -cmd:rvitals testnode +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals testnode check:rc!=0 -check:output=~Error end start:rvitals_errorcommand description:using wrong command -cmd: rvitals $$CN errorcommand +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN errorcommand check:rc!=0 -check:output=~Unrecognized rvitals arguments end diff --git a/xCAT-test/autotest/testcase/rvitals/openbmctest.sh b/xCAT-test/autotest/testcase/rvitals/openbmctest.sh new file mode 100755 index 000000000..8584e79e4 --- /dev/null +++ b/xCAT-test/autotest/testcase/rvitals/openbmctest.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +function test_openbmccommand() +{ +node_number=0; +number=0; +if [[ $1 ]]&&[[ $2 ]]&&[[ $3 ]];then + `$1 $2 $3 >/tmp/openbmccommand.test`; + if [[ $? -eq 0 ]];then + echo right command; + number=`awk 'END{print NR}' /tmp/openbmccommand.test` + echo number is $number + `cat /tmp/openbmccommand.test |awk -F : '{print $1}' > /tmp/openbmccommand.test1` + for i in `cat /tmp/openbmccommand.test1` + do + echo $i + if [[ $i == $2 ]];then + node_number=1; + else + echo no than more node checkeid + node_number=2; + fi + done + if [[ $node_number -eq 1 ]];then + `cat /tmp/openbmccommand.test |awk -F : '{print $2}'> /tmp/openbmccommand.test2` + if [[ $number -eq 1 ]]&&[[ `awk -F "" '{for(i=1;i<=NF;++i) if($i==":") ++sum}END{print sum}' /tmp/openbmccommand.test` -eq 1 ]];then + if [[ `cat /tmp/openbmccommand.test` =~ "No attributes returned from the BMC" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No mprom information is available" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No deviceid information is available" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No uuid information is available" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No guid information is available" ]];then + echo "No attributes" + return 0; + else + return 1; + fi + else + if [[ `cat /tmp/openbmccommand.test2` =~ "No attributes returned from the BMC" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No mprom information is available" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No deviceid information is available" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No uuid information is available" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No guid information is available" ]];then + echo "wrong return" + return 1; + else + echo "right return" + return 0 + fi + fi + else + if [[ $node_number -eq 2 ]];then + return 0; + fi + fi + else + return 1; + fi +else + return 1; +fi +} +test_openbmccommand $1 $2 $3 +if [[ $? -eq 0 ]];then + exit 0; +else + exit 1; +fi