From e269d43bdc459c93ff6054184ec5e1cf212d02f7 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 8 Jun 2017 09:00:20 -0400 Subject: [PATCH 1/7] modify rvitals testcase for issue:3184 --- xCAT-test/autotest/testcase/rvitals/cases0 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xCAT-test/autotest/testcase/rvitals/cases0 b/xCAT-test/autotest/testcase/rvitals/cases0 index 9e759843d..11c30bf70 100644 --- a/xCAT-test/autotest/testcase/rvitals/cases0 +++ b/xCAT-test/autotest/testcase/rvitals/cases0 @@ -110,6 +110,12 @@ 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 +check:rc==0 +end start:rvitals_noderange_err description:using not defined node cmd:rvitals testnode From 0580e8d02aae3a4f7c261604af4e8e11ca5f79e2 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 9 Jun 2017 02:16:46 -0400 Subject: [PATCH 2/7] modify rvitals testcase for issue:3184 --- xCAT-test/autotest/testcase/rvitals/cases0 | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-test/autotest/testcase/rvitals/cases0 b/xCAT-test/autotest/testcase/rvitals/cases0 index 11c30bf70..996ee8dea 100644 --- a/xCAT-test/autotest/testcase/rvitals/cases0 +++ b/xCAT-test/autotest/testcase/rvitals/cases0 @@ -115,6 +115,7 @@ description:Retrieves altitude readings. Attribute: $$CN-The operation object of rvitals command cmd:rvitals $$CN altitude check:rc==0 +check:output=~No attributes returned from the BMC end start:rvitals_noderange_err description:using not defined node From 0f3411ae36b98bbf75321cd0a082a01c50673f5f Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 13 Jun 2017 11:21:13 -0400 Subject: [PATCH 3/7] modify rvitals testcase for issue:3184 --- xCAT-test/autotest/testcase/rvitals/cases0 | 31 +++------- .../autotest/testcase/rvitals/openbmctest.sh | 59 +++++++++++++++++++ 2 files changed, 68 insertions(+), 22 deletions(-) create mode 100755 xCAT-test/autotest/testcase/rvitals/openbmctest.sh 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 From ae2f2a5bdc32348692d8cb9191c6fa6d0ae50d8b Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 14 Jun 2017 03:22:52 -0400 Subject: [PATCH 4/7] modify rvitals testcase for issue:3184 --- xCAT-test/autotest/testcase/rinv/cases0 | 96 +++++++++++++++++++------ 1 file changed, 75 insertions(+), 21 deletions(-) diff --git a/xCAT-test/autotest/testcase/rinv/cases0 b/xCAT-test/autotest/testcase/rinv/cases0 index 5b61937df..d5aae55f0 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,76 @@ 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 +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 -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_noderange_err cmd:rinv testnode check:rc!=0 check:output=~Error end - +start:rinv_mixnode +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=~testnode: Error +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 +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 From d1a87e7b44dbfdcbbe4272c66bc1cd63580e1400 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 14 Jun 2017 05:32:53 -0400 Subject: [PATCH 5/7] modify rinv testcase for issue:3184 --- xCAT-test/autotest/testcase/rinv/cases0 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xCAT-test/autotest/testcase/rinv/cases0 b/xCAT-test/autotest/testcase/rinv/cases0 index d5aae55f0..5cd9d942c 100644 --- a/xCAT-test/autotest/testcase/rinv/cases0 +++ b/xCAT-test/autotest/testcase/rinv/cases0 @@ -76,12 +76,21 @@ 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)__ @@ -98,6 +107,8 @@ cmd:rmdef testnode;if [[ -e /tmp/testnode.stanza ]]; then cat /tmp/testnode.stan 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 From 4eeb0c1fef8b2cf3e8c8ae726997c1ca5dce9924 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 14 Jun 2017 05:33:34 -0400 Subject: [PATCH 6/7] modify rinv testcase for issue:3184 --- xCAT-test/autotest/testcase/rinv/cases1 | 70 ------------------------- 1 file changed, 70 deletions(-) delete mode 100644 xCAT-test/autotest/testcase/rinv/cases1 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 - From 201cbf15f7d3e7cbaeccd79b6584a095307d2b0c Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 16 Jun 2017 01:48:56 -0400 Subject: [PATCH 7/7] modify rinv and rvitals testcase for issue:3184 --- xCAT-test/autotest/testcase/rinv/cases0 | 1 - xCAT-test/autotest/testcase/rvitals/openbmctest.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/rinv/cases0 b/xCAT-test/autotest/testcase/rinv/cases0 index 5cd9d942c..466b95bf2 100644 --- a/xCAT-test/autotest/testcase/rinv/cases0 +++ b/xCAT-test/autotest/testcase/rinv/cases0 @@ -99,7 +99,6 @@ cmd:chdef -p -t node -o $$CN groups="test" check:rc==0 cmd:rinv test all check:rc==1 -check:output=~testnode: Error check:output=~$$CN: SYSTEM cmd:chdef -m -t node -o $$CN groups="test" check:rc==0 diff --git a/xCAT-test/autotest/testcase/rvitals/openbmctest.sh b/xCAT-test/autotest/testcase/rvitals/openbmctest.sh index 8584e79e4..c28e9fbfd 100755 --- a/xCAT-test/autotest/testcase/rvitals/openbmctest.sh +++ b/xCAT-test/autotest/testcase/rvitals/openbmctest.sh @@ -17,7 +17,7 @@ if [[ $1 ]]&&[[ $2 ]]&&[[ $3 ]];then if [[ $i == $2 ]];then node_number=1; else - echo no than more node checkeid + echo no than more node checked node_number=2; fi done