start:rpower_off
description:This case is to test off option could remote power off nodes
Attribute: $$CN-The operation object of rpower command
label:cn_bmc_ready,hctrl_general
cmd:rpower $$CN on
cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
check:ouptut=~Running|on
cmd:rpower $$CN off
check:rc==0
cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN stat
check:output=~Not Activated|off
end

start:rpower_stat
description:This case is to test stat option could show the power status of nodes
Attribute: $$CN-The operation object of rpower command
label:cn_bmc_ready,hctrl_general
cmd:rpower $$CN on
cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 5 ];then break;fi done
cmd:rpower $$CN stat
check:rc==0
check:output=~Running|on
cmd:rpower $$CN state
check:rc==0
check:output=~Running|on
cmd:rpower $$CN off
cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 5 ];then break;fi done
cmd:rpower $$CN stat
check:rc==0
check:output=~Not Activated|off
cmd:rpower $$CN state
check:rc==0
check:output=~Not Activated|off
end

start:rpower_boot
description:This case is to test boot option could power on the nodes if nodes in off state.  Or could  hard reset the nodes if they are on.
Attribute: $$CN-The operation object of rpower command
label:cn_bmc_ready,hctrl_general
cmd:rpower $$CN off
cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN stat
check:output=~Not Activated|off
cmd:rpower $$CN boot
check:rc==0
cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN stat
check:output=~Running|on
end

start:rpower_status
description:This case is to test status option could show the power status of nodes
Attribute: $$CN-The operation object of rpower command
label:cn_bmc_ready,hctrl_general
cmd:rpower $$CN off
cmd:a=0;while ! `rpower $$CN status|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN status
check:output=~Not Activated|off
cmd:rpower $$CN boot
check:rc==0
cmd:a=0;while ! `rpower $$CN status|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN status
check:output=~Running|on
end

start:rpower_state
description:This case is to test state option could show the power status of nodes
Attribute: $$CN-The operation object of rpower command
label:cn_bmc_ready,hctrl_general
cmd:rpower $$CN off
cmd:a=0;while ! `rpower $$CN state|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN state
check:output=~Not Activated|off
cmd:rpower $$CN boot
check:rc==0
cmd:a=0;while ! `rpower $$CN state|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN state
check:output=~Running|on
end

start:rpower_on
description:This case is to test on option could remote power on nodes
Attribute: $$CN-The operation object of rpower command
label:cn_bmc_ready,hctrl_general
cmd:rpower $$CN off
cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN stat
check:output=~Not Activated|off
cmd:rpower $$CN on
check:rc==0
cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN stat
check:output=~Running|on
end

start:rpower_reset
description:This case is to test reset option could hard reset nodes when nodes are in on state.
Attribute: $$CN-The operation object of rpower command
label:cn_bmc_ready,hctrl_general
cmd:stat=`rpower $$CN stat`;if ([[ $stat =~ on ]] || [[ $stat =~ Running ]]) ;then rpower $$CN reset;sleep 300;stat1=`rpower $$CN stat`;if ([[ $stat1 =~ on ]] || [[ $stat1 =~ Running ]]);then exit 0;else exit 1;fi;else rpower $$CN reset;sleep 300;stat1=`rpower $$CN stat`;if ([[ $stat1 =~ off ]] || [[ $stat1 =~ "Not Activated" ]]);then exit 0;else exit 1;fi;fi
check:rc==0
end

start:rpower_noderange
description:This case is to test rpower could process error usage and return help information.
Attribute: $$CN-The operation object of rpower command
label:cn_bmc_ready,hctrl_general
cmd:rpower $$CN
check:rc!=0
check:output=~Unsupported|Usage|Please enter an action
end

start:rpower_noderange_nodeps
description:This case is to test rpower could process error usage and return help information.
Attribute: $$CN-The operation object of rpower command
label:cn_bmc_ready,hctrl_general
cmd:rpower $$CN --nodeps
check:rc!=0
check:output=~Unsupported|Usage
end

start:rpower_err_noderange
description:This case is to test rpower could process error usage and return help information.
Attribute:N/A
label:mn_only,hctrl_general
cmd:rpower testnode stat
check:rc!=0
check:output=~Error
end

start:rpower_softoff
description:This case is to test softoff option could remote shutdown nodes
Attribute: $$CN-The operation object of rpower command
label:cn_bmc_ready,hctrl_fsp,hctrl_openbmc
cmd:rpower $$CN on
cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
check:ouptut=~Running|on
cmd:rpower $$CN softoff
check:rc==0
cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN stat
check:output=~Not Activated|off
end

start:rpower_onstandby
description:This case is to test onstandby option could bring server to standby state
Attribute: $$CN-The operation object of rpower command
label:cn_bmc_ready,hctrl_fsp
arch:ppc64
cmd:rpower $$CN off
check:rc==0
cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN stat
check:output=~Not Activated|off
cmd:rpower $$CN onstandby
cmd:a=0;while ! `rpower $$CN stat|grep "standby\|Standby" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
check:ouptut=~standby|Standby
end

start:rpower_wrongpasswd
description:rpower ipmi and openbmc using wrong passwd
Attribute: $$CN-The operation object of rpower command
label:cn_bmc_ready,hctrl_openpower_ipmi
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh  -pt $$CN  $$bmcpasswd $$bmcusername
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh  -c $$CN
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh  -apt $$CN  $$bmcpasswd $$bmcusername
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rpower/rpower_wrongpasswd_test.sh  -c $$CN
check:rc==0
end

start:rpower_suspend_OpenpowerBmc
hcp:openbmc,ipmi
label:cn_bmc_ready,hctrl_openpower_ipmi,hctrl_openbmc
cmd:rpower $$CN suspend
check:output=~Error: (\[.*?\]: )?[Uu]nsupported command[:]* rpower suspend
check:rc==1
end


start:rpower_wake_OpenpowerBmc
hcp:openbmc,ipmi
label:cn_bmc_ready,hctrl_openpower_ipmi,hctrl_openbmc
cmd:rpower $$CN wake
check:output=~Error: (\[.*?\]: )?[Uu]nsupported command[:]* rpower wake
check:rc==1
end

start:rpower_errorcommand_OpenpowerBmc
hcp:openbmc,ipmi
label:cn_bmc_ready,hctrl_openpower_ipmi,hctrl_openbmc
cmd:rpower $$CN ddd
check:output=~Error: (\[.*?\]: )?[Uu]nsupported command[:]* rpower ddd
check:rc==1
end

start:rpower_off_on
description:This case is to test off and on option could work for a diskful node. This case is do task 82, for bug 4132, the node status cannot be updated on normal system reboot #4138. 
Attribute: $$CN-The operation object of rpower command
label:others,hctrl_general
cmd:rpower $$CN stat 
check:output=~Running|on
cmd:lsdef -l $$CN -i status
check:output=~booted
cmd:rpower $$CN off
check:rc==0
cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN on
check:rc==0
cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN stat
check:output=~Running|on
cmd:a=0;while ! `lsdef -l $$CN -i status|grep "booted" >/dev/null`; do sleep 5;((a++));if [ $a -gt 50 ];then break;fi done
cmd:lsdef -l $$CN -i status|grep "booted"
check:rc==0
end
