diff --git a/xCAT-test/autotest/testcase/rinv/cases0 b/xCAT-test/autotest/testcase/rinv/cases0 index 5b61937df..466b95bf2 100644 --- a/xCAT-test/autotest/testcase/rinv/cases0 +++ b/xCAT-test/autotest/testcase/rinv/cases0 @@ -4,14 +4,30 @@ #check:rc!=0 #check:output=~Usage #end +start:rinv_h +description:show help information for rinv +cmd:rinv -h +check:rc==0 +check:output=~Usage +check:output=~rinv +end +start:rinv_v +description:show version for Version +cmd:rinv -v +check:rc==0 +check:output=~Version +end + start:rinv_bus -arch:ppc +description:rinv list all buses for each I/O slot +Attribute: $$CN-The operation object of rinv command cmd:rinv $$CN bus check:rc==0 check:output=~I/O Bus Information end start:rinv_config -arch:ppc +description:Retrieves number of processors, speed, total memory, and DIMM locations. +Attribute: $$CN-The operation object of rinv command cmd:rinv $$CN config check:rc==0 check:output=~Machine Configuration Info @@ -19,38 +35,86 @@ check:output=~Number of Processors:\s*\d+ check:output=~Total Memory \(\w+\):\s*\d+ end start:rinv_serial -arch:ppc -cmd:rinv $$CN serial +description:Retrieves serial number. +Attribute: $$CN-The operation object of rinv command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rinv $$CN serial check:rc==0 -check:output=~Serial Number:\s*\w{7} end start:rinv_model -arch:ppc -cmd:rinv $$CN model +description:Retrieves serial number. +Attribute: $$CN-The operation object of rinv command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rinv $$CN model check:rc==0 -check:output=~Machine Type/Model\s*:\s*\w{4}-\w{3} end start:rinv_firm -arch:ppc -cmd:rinv $$CN firm +description:Retrieves firmware versions. +Attribute: $$CN-The operation object of rinv command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rinv $$CN firm check:rc==0 -check:output=~Release Level\s*:\s*\w+ end start:rinv_all -arch:ppc -cmd:rinv $$CN all +description:get serial,model +Attribute: $$CN-The operation object of rinv command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rinv $$CN all check:rc==0 -check:output=~I/O Bus Information -check:output=~Machine Configuration Info -check:output=~Number of Processors:\s*\d+ -check:output=~Total Memory \(\w+\):\s*\d+ -check:output=~Serial Number:\s*\w{7} -check:output=~Machine Type/Model\s*:\s*\w{4}-\w{3} -check:output=~Release Level\s*:\s*\w+ end +start:rinv_cpu +description:get cpu information +Attribute: $$CN-The operation object of rinv command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rinv $$CN cpu +check:rc==0 +end +start:rinv_dimm +description:get dimm information +Attribute: $$CN-The operation object of rinv command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rinv $$CN dimm +check:rc==0 +end +start:rinv_uuid +description:get uuid information +Attribute: $$CN-The operation object of rinv command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rinv $$CN uuid +check:rc==0 +end +start:rinv_vpd +description:get vpd information +Attribute: $$CN-The operation object of rinv command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rinv $$CN vpd +check:rc==0 +end + start:rinv_noderange_err cmd:rinv testnode check:rc!=0 check:output=~Error end - +start:rinv_mixnode +description:get mixnode information,one is invalid node +Attribute: $$CN-The operation object of rinv command +cmd:test=$(lsdef testnode);if [[ $? -eq 0 ]]; then lsdef -l testnode -z >/tmp/testnode.stanza ;rmdef testnode;fi +check:rc==0 +cmd:chdef testnode groups=test mgt=__GETNODEATTR($$CN,mgt)__ +check:rc==0 +cmd:chdef -p -t node -o $$CN groups="test" +check:rc==0 +cmd:rinv test all +check:rc==1 +check:output=~$$CN: SYSTEM +cmd:chdef -m -t node -o $$CN groups="test" +check:rc==0 +cmd:rmdef testnode;if [[ -e /tmp/testnode.stanza ]]; then cat /tmp/testnode.stanza | chdef -z;rm -rf /tmp/testnode.stanza;fi +check:rc==0 +end +start:rinv_wrongbmcpasswd +description:get right return if bmc's passwd wrong +Attribute: $$CN-The operation object of rinv command +cmd:lsdef -l $$CN -z >/tmp/testnode.stanza +check:rc==0 +cmd:chdef $$CN bmcpassword=test +check:rc==0 +cmd:rinv $$CN all +check:rc==1 +check:output=~$$CN: Error: Invalid username or password +cmd:cat /tmp/testnode.stanza | chdef -z;rm -rf /tmp/testnode.stanza +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/rinv/cases1 b/xCAT-test/autotest/testcase/rinv/cases1 deleted file mode 100644 index 292e9b915..000000000 --- a/xCAT-test/autotest/testcase/rinv/cases1 +++ /dev/null @@ -1,70 +0,0 @@ -start:rinv_serial -arch:ppc64le -hcp:ipmi -cmd:rinv $$CN serial -check:rc==0 -check:output=~NODE 1 Chassis Serial Number:\s*\w{7} -end - -start:rinv_model -arch:ppc64le -hcp:ipmi -cmd:rinv $$CN model -check:rc==0 -check:output=~NODE 1 Chassis Part Number\s*:\s*\w{4}-\w{3} -end - -start:rinv_firm -arch:ppc64le -hcp:ipmi -cmd:rinv $$CN firm -check:rc==0 -check:output=~BMC Firmware\s*:\s*\w+.\w+ -end - -start:rinv_deviceid -hcp:ipmi -arch:ppc64le -cmd:rinv $$CN deviceid -check:rc==0 -check:output=~Device ID:\s*\w+ -check:output=~Product ID:\s*\w+ -check:output=~Manufacturer ID:\s*\w+ -end - - -start:rinv_vpd -hcp:ipmi -arch:ppc64le -cmd:rinv $$CN vpd -check:rc==0 -check:output=~Manufacturer ID:\s*\w+ -check:output=~Device ID:\s*\w+ -check:output=~BMC Firmware:\s*\w+.\w+ -check:output=~NODE 1 Chassis Serial Number:\s*\w{7} -check:output=~NODE 1 Chassis Part Number\s*:\s*\w{4}-\w{3} -end - - -start:rinv_all -hcp:ipmi -arch:ppc64le -cmd:rinv $$CN all -check:rc==0 -check:output=~BMC Firmware:\s*\w+.\w+ -check:output=~BMCCARD Board Part Number:\s*\w{7} -check:output=~UUID/GUID:\s*\w+-\w+-\w+-\w+-\w+ -check:output=~Product ID:\s*\d+ -check:output=~Manufacturer ID:\s*\d+ -check:output=~Device ID:\s*\d+ -check:output=~BMCCARD Board Serial Number:\s*\w+ -end - -start:rinv_noderange_err -hcp:ipmi -arch:ppc64le -cmd:rinv testnode -check:rc!=0 -check:output=~Error -end - diff --git a/xCAT-test/autotest/testcase/rvitals/cases0 b/xCAT-test/autotest/testcase/rvitals/cases0 index 9e759843d..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,27 +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 +end +start:rvitals_altitude +description:Retrieves altitude readings. +Attribute: $$CN-The operation object of rvitals command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN altitude check:rc==0 -check:output=~12V Sense|AC Avg Power -check:output=~Mem Cache Power|MEM Avg Power 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..c28e9fbfd --- /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 checked + 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