From 221fe30c5a5fb64f60433efcc6f7529702281642 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 25 Aug 2017 07:50:39 -0400 Subject: [PATCH 01/11] modify rspconfig testcase for get more debug information --- xCAT-test/autotest/testcase/rspconfig/cases0 | 2 +- .../autotest/testcase/rspconfig/rspconfig.sh | 95 +++++++++++-------- 2 files changed, 57 insertions(+), 40 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/cases0 b/xCAT-test/autotest/testcase/rspconfig/cases0 index a62796ae1..838b21171 100644 --- a/xCAT-test/autotest/testcase/rspconfig/cases0 +++ b/xCAT-test/autotest/testcase/rspconfig/cases0 @@ -44,7 +44,7 @@ end start:rspconfig_ip description:rspconfig change openbmc ip Attribute: $$CN-The operation object of rspconfig command -cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -i $$CN +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -i $$CN $NODEIP check:rc==0 cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -c $$CN ip check:rc==0 diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 35cebceed..562739cca 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -16,57 +16,55 @@ function test_ip() } function net() { - a=$(echo "$1" | awk -F "." '{print $1" "$2" "$3" "$4}') - for num in $a; - do - while (($num!=0));do - echo -n $(($num%2)) >> /tmp/$$.num; - num=$(($num/2)); - done - done - rc=$(grep -o "1" /tmp/$$.num | wc -l) - rm /tmp/$$.num - ip="$2/$rc" - A=($(echo "$ip"|sed 's/[./;]/ /g')) - B=$(echo $((2**(32-${A[4]})-1))) - C=($(echo "obase=256;ibase=10; $B"|bc|awk '{if(NF==4)a=$0;if(NF==3)a="0"$0;if(NF==2)a="0 0"$0;if(NF==1)a="0 0 0"$0;print a}')) - D=$(echo ${A[*]} ${C[*]}) - rc2=echo echo $D|awk 'BEGIN{OFS="."}{print $1,$2,$3,$4"-"$1+$6,$2+$7,$3+$8,$4+$9}' |awk -F '-' '{print $2}' + LASTIP=`echo "$1 $2"|awk -F '[ .]+' 'BEGIN{OFS="."} END{print or($1,xor($5,255)),or($2,xor($6,255)),or($3,xor($7,255)),or($4,xor($8,255))}'` + FIRSTIP=`echo "$1 $2"|awk -F '[ .]+' 'BEGIN{OFS="."} END{print and($1,$5),and($2,$6),and($3,$7),and($4,$8)}'` + echo lastip is $LASTIP + echo first ip is $FIRSTIP + } function change_ip() { + echo "Prepare to change ip." + echo "Start to check ip valid ." + $NODEIP=$4; test_ip $1; - if [[ $? -ne 0 ]];then return 1;fi + if [[ $? -ne 0 ]];then echo "ip is invalid";return 1;fi + echo "ip is valid."; echo $1 > /tmp/BMCIP + net $1 $3 ip1=`echo $1|awk -F. '{print $1}'` ip2=`echo $1|awk -F. '{print $2}'` ip3=`echo $1|awk -F. '{print $3}'` - ip4=`echo $1|awk -F. '{print $4}'` - echo ip is $ip1.$ip2.$ip3.$ip4 - rc=$(net $3 $1) - rc4=`echo $rc |awk -F. '{print $4}'` - rc4=`expr "$rc4"` - if [[ $rc4 > 255 ]];then rc4=255;fi - ip=$ip4 + ip4=`echo $1|awk -F. '{print $4}'` + ipfirst=`echo $FIRSTIP|awk -F. '{print $4}'` + ip=`expr "$ipfirst" "+" "1"` + iplast=`echo $LASTIP|awk -F. '{print $4}'` + ip5=`expr "$iplast" "-" "1"` + echo ip is $ip ,ip5 is $ip5 while true; - do [[ $ip == "$rc4" ]] && return 1; + do [[ $ip == "$ip5" ]] && echo "exit for using last ip."&&return 1; ping $ip1.$ip2.$ip3.$ip -c 2 >/dev/null ; - if [[ $? != 0 ]]; then + if [[ $? != 0 && "$ip" != "$ip4" && "$ip1.$ip2.$ip3.$ip" != "$NODEIP" ]]; then coutip="$ip1.$ip2.$ip3.$ip" BMCNEWIP=$coutip; echo $1,$2,$3 + echo "Start to set ip for node." rspconfig $2 ip=$BMCNEWIP if [[ $? -eq 0 ]];then - echo right command; + echo "Could set ip for node."; else + echo "Could not set ip for node"; return 1; fi chdef $2 bmc=$BMCNEWIP + echo "Start to check ip setted successfully or not." check_result $2 ip $BMCNEWIP if [[ $? -ne 0 ]] ;then + echo "Ip could not be setted."; return 1; else - return 0; + echo "Ip could be setted."; + return 0; fi fi ip=`expr "$ip" "+" "1"` @@ -90,21 +88,25 @@ function check_result() } function clear_env() { +echo "Start to clear test environment."; if [[ -f /tmp/BMCIP ]];then originip=$(cat /tmp/BMCIP); echo originip is $originip; rspconfig $2 ip=$originip if [[ $? -eq 0 ]];then - echo right command; + echo "Could set the node's bmc ip to originip"; else + echo "Could not set the node's bmc ip to originip"; return 1; fi rm -rf /tmp/BMCIP chdef $2 bmc=$originip check_result $2 $3 $originip if [[ $? -ne 0 ]] ;then + echo "Could set the node's bmc ip to originip sucessfully."; return 1; else + echo "Could set the node's bmc ip to originip successfully."; return 0; fi fi @@ -112,41 +114,56 @@ function clear_env() } function change_gateway { - test_ip $1; - if [[ $? -ne 0 ]];then return 1;fi + echo "Prepare to change gateway."; + echo "Start to check gateway valid or not."; + test_ip $1; + if [[ $? -ne 0 ]];then echo "Gateway is invalid";return 1;fi + echo "Start to change gateway."; rspconfig $2 gateway=$1; if [[ $? -eq 0 ]];then - echo set gateway ok; + echo "Could set gateway."; else - return 1; + echo "Could not set gateway."; + return 1; fi + echo "Start to check gateway setted successfully or not."; check_result $2 $3 $1 if [[ $? -ne 0 ]] ;then + echo "Could not set gateway successfully."; return 1; else - return 0; + echo "Could set gateway successfully."; + return 0; fi } function change_netmask { - test_ip $1; - if [[ $? -ne 0 ]];then return 1;fi + echo "Prepare to change netmask"; + echo "Start to check netmask valid or not."; + test_ip $1; + if [[ $? -ne 0 ]];then echo "Net mask is invalid.";return 1;fi rspconfig $2 netmask=$1; if [[ $? -eq 0 ]];then - echo set netmask ok; + echo "Could set netmask."; else + echo "Could not set netmask."; return 1; fi check_result $2 $3 $1 if [[ $? -ne 0 ]] ;then + echo "Could not set netmask successfully."; return 1; else - return 0; + echo "Could set netmask successfully."; + return 0; fi } BMCIP="" BMCGTEWAT="" BMCNETMASK="" +FIRSTIP="" +LASTIP="" +NODEIP="" while [ "$#" -gt "0" ] do case $1 in @@ -158,7 +175,7 @@ do else exit 1; fi - change_ip $BMCIP $2 $BMCNETMASK + change_ip $BMCIP $2 $BMCNETMASK $3 if [[ $? -eq 1 ]];then exit 1 else From 0f971dda0cd385665ada717f4ebcd354e7267700 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 25 Aug 2017 09:01:32 -0400 Subject: [PATCH 02/11] modify rspconfig testcase for get more debug information --- xCAT-test/autotest/testcase/rspconfig/rspconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 562739cca..c359d173d 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -26,7 +26,7 @@ function change_ip() { echo "Prepare to change ip." echo "Start to check ip valid ." - $NODEIP=$4; + NODEIP=$4; test_ip $1; if [[ $? -ne 0 ]];then echo "ip is invalid";return 1;fi echo "ip is valid."; From af0d99d8a3547f2de42663fc5a2fbfa08a62e580 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 28 Aug 2017 08:46:32 -0400 Subject: [PATCH 03/11] modify rspconfig testcase for get more debug information --- .../autotest/testcase/rspconfig/rspconfig.sh | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index c359d173d..992b16d50 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -25,7 +25,7 @@ function net() function change_ip() { echo "Prepare to change ip." - echo "Start to check ip valid ." + echo "Start to check ip valid." NODEIP=$4; test_ip $1; if [[ $? -ne 0 ]];then echo "ip is invalid";return 1;fi @@ -51,19 +51,19 @@ function change_ip() echo "Start to set ip for node." rspconfig $2 ip=$BMCNEWIP if [[ $? -eq 0 ]];then - echo "Could set ip for node."; + echo "Could set bmc's ip for node using rspconfig."; else - echo "Could not set ip for node"; + echo "Could not set bmc's ip for node using rspconfig."; return 1; fi chdef $2 bmc=$BMCNEWIP - echo "Start to check ip setted successfully or not." + echo "Start to check bmc's ip setted successfully or not." check_result $2 ip $BMCNEWIP if [[ $? -ne 0 ]] ;then - echo "Ip could not be setted."; + echo "Set bmc's ip failed."; return 1; else - echo "Ip could be setted."; + echo "Set bmc's ip successfully."; return 0; fi fi @@ -88,25 +88,25 @@ function check_result() } function clear_env() { -echo "Start to clear test environment."; + echo "Start to clear test environment."; if [[ -f /tmp/BMCIP ]];then originip=$(cat /tmp/BMCIP); echo originip is $originip; rspconfig $2 ip=$originip if [[ $? -eq 0 ]];then - echo "Could set the node's bmc ip to originip"; + echo "Could set bmc's ip to originip using rspconfig."; else - echo "Could not set the node's bmc ip to originip"; + echo "Could not set bmc's ip to originip using rspconfig."; return 1; fi rm -rf /tmp/BMCIP chdef $2 bmc=$originip check_result $2 $3 $originip if [[ $? -ne 0 ]] ;then - echo "Could set the node's bmc ip to originip sucessfully."; + echo "Set bmc's ip to originip failed."; return 1; else - echo "Could set the node's bmc ip to originip successfully."; + echo "Set bmc's ip to originip successfully."; return 0; fi fi @@ -114,25 +114,25 @@ echo "Start to clear test environment."; } function change_gateway { - echo "Prepare to change gateway."; - echo "Start to check gateway valid or not."; + echo "Prepare to change gateway."; + echo "Start to check gateway valid or not."; test_ip $1; if [[ $? -ne 0 ]];then echo "Gateway is invalid";return 1;fi - echo "Start to change gateway."; + echo "Start to change bmc's gateway."; rspconfig $2 gateway=$1; if [[ $? -eq 0 ]];then - echo "Could set gateway."; + echo "Could set bmc's gateway."; else - echo "Could not set gateway."; + echo "Could not set bmc's gateway."; return 1; fi - echo "Start to check gateway setted successfully or not."; + echo "Start to check gateway setting successfully or not."; check_result $2 $3 $1 if [[ $? -ne 0 ]] ;then - echo "Could not set gateway successfully."; + echo "Set bmc's gateway failed."; return 1; else - echo "Could set gateway successfully."; + echo "Set bmc's gateway successfully."; return 0; fi } @@ -144,17 +144,17 @@ function change_netmask if [[ $? -ne 0 ]];then echo "Net mask is invalid.";return 1;fi rspconfig $2 netmask=$1; if [[ $? -eq 0 ]];then - echo "Could set netmask."; + echo "Could set bmc's netmask using rspconfig."; else - echo "Could not set netmask."; + echo "Could not set bmc's netmask using rspconfig."; return 1; fi check_result $2 $3 $1 if [[ $? -ne 0 ]] ;then - echo "Could not set netmask successfully."; + echo "Set bmc's netmask failed."; return 1; else - echo "Could set netmask successfully."; + echo "Set bmc's netmask successfully."; return 0; fi } From 69598e0b5182e81b80f450b45cc809eaef7f9c7f Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 1 Sep 2017 09:17:48 -0400 Subject: [PATCH 04/11] modify reventlog testcase for code change --- .../autotest/testcase/rspconfig/rspconfig.sh | 210 ++++++++++++++---- 1 file changed, 170 insertions(+), 40 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 992b16d50..38625bcd2 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -112,55 +112,67 @@ function clear_env() fi return 1; } -function change_gateway +function change_nonip { - echo "Prepare to change gateway."; - echo "Start to check gateway valid or not."; - test_ip $1; - if [[ $? -ne 0 ]];then echo "Gateway is invalid";return 1;fi - echo "Start to change bmc's gateway."; - rspconfig $2 gateway=$1; +echo "Prepare to change $4."; +echo "Start to check $4 valid or not."; + if [[ $4 =~ "gateway" ]]||[[ $4 =~ "netmask" ]];then + test_ip $1; + if [[ $? -ne 0 ]];then + echo "$4 is invalid"; + return 1; + fi + fi + echo "Start to change bmc's $4."; + rspconfig $2 $4=$1; if [[ $? -eq 0 ]];then - echo "Could set bmc's gateway."; - else - echo "Could not set bmc's gateway."; + echo "Could set bmc's $4."; + else + echo "Could not set bmc's $4."; return 1; - fi - echo "Start to check gateway setting successfully or not."; - check_result $2 $3 $1 - if [[ $? -ne 0 ]] ;then - echo "Set bmc's gateway failed."; - return 1; - else - echo "Set bmc's gateway successfully."; + fi + echo "Start to check $4 setting successfully or not."; + check_result $2 $3 $1 + if [[ $? -ne 0 ]] ;then + echo "Set bmc's $4 failed."; + return 1; + else + echo "Set bmc's $4 successfully."; return 0; - fi + fi + } -function change_netmask +function change_all { - echo "Prepare to change netmask"; - echo "Start to check netmask valid or not."; - test_ip $1; - if [[ $? -ne 0 ]];then echo "Net mask is invalid.";return 1;fi - rspconfig $2 netmask=$1; +echo "Prepare to change all for bmc." +echo "Start to change all for bmc." + rspconfig $2 gateway netmask vlan ip if [[ $? -eq 0 ]];then - echo "Could set bmc's netmask using rspconfig."; - else - echo "Could not set bmc's netmask using rspconfig."; - return 1; - fi - check_result $2 $3 $1 - if [[ $? -ne 0 ]] ;then - echo "Set bmc's netmask failed."; - return 1; - else - echo "Set bmc's netmask successfully."; - return 0; + BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'`; + BMCNETMASK=`rspconfig $2 netmask |awk -F":" '{print $3}'`; + BMCGGATEWAY=`rspconfig $2 gateway |awk -F":" '{print $3}'`; + output=`rspconfig $2 vlan` + if [[ $output =~ "BMC VLAN ID enabled" ]];then + BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` + else + echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" + return 1; + fi + rspconfig $2 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN + if [[ $? -eq 0 ]];then + echo "Could set bmc's all options."; + else + echo "Could not set bmc's all options."; + return 1; + fi fi + } BMCIP="" +BMCIP_LSDEF="" BMCGTEWAT="" BMCNETMASK="" +BMCVLAN="" FIRSTIP="" LASTIP="" NODEIP="" @@ -168,6 +180,7 @@ while [ "$#" -gt "0" ] do case $1 in "-i"|"--ip" ) + echo "--------------------To test bmc ip could be changed using rspconfig.--------------------" rspconfig $2 ip if [[ $? -eq 0 ]];then BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` @@ -177,44 +190,161 @@ do fi change_ip $BMCIP $2 $BMCNETMASK $3 if [[ $? -eq 1 ]];then + echo "--------------------To test bmc ip could be changed using rspconfig failed.--------------------" exit 1 - else + else + echo "--------------------To test bmc ip could be change using rspconfig successfully.-------------------" exit 0 fi ;; + "-lip"|"--list ip" ) + echo "--------------------To test bmc ip could be listed using rspconfig.--------------------" + BMCIP_LSDEF=`lsdef $2 |grep bmc |awk -F "=" '{print $2}'` + rspconfig $2 ip + if [[ $? -eq 0 ]];then + BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` + if [[ $BMCIP =~ "$BMCIP_LSDEF" ]];then + echo "-----------------To test bmc ip could be listed using rspconfig successfully.-----------------" + exit 0; + else + echo "-------------------To test bmc ip could be listed using rspconfig failed.----------------" + exit 1; + fi + else + echo "------------------To test bmc ip could be listed using rspconfig failed.-------------------" + exit 1; + fi + ;; + "-g"|"--gateway" ) + echo "--------------------To test bmc gateway could be changed using rspconfig.---------------------" rspconfig $2 gateway if [[ $? -eq 0 ]];then BMCGATEWAYE=`rspconfig $2 gateway |awk -F":" '{print $3}'` else exit 1; fi - change_gateway $BMCGATEWAYE $2 $3 + change_nonip $BMCGATEWAYE $2 $3 gateway if [[ $? -eq 1 ]];then + echo "--------------------To test bmc gateway could be changed using rspconfig failed.--------------------" exit 1 else + echo "--------------------To test bmc gateway could be changed using rspconfig successfully.--------------------" exit 0 fi ;; + "-lg"|"--list gateway" ) + output=rpconfig $2 gateway + if [[ $? -eq 0 ]];then + if [[ $output =~ "$2 BMC Gateway:" ]];then + echo "-------------------To test bmc gateway could be listed using rspconfig successfully.-----------------" + exit 0; + else + echo "-----------------To test bmc gateway could be listed using rsconfig failed.-------------------" + exit 1; + fi + else + echo "-------------------To test bmc gateway could be listed using rspconfig failed.---------------" + exit 1; + fi + ;; "-n"|"--netmask" ) rspconfig $2 netmask + echo "---------------------To test bmc netmask could be changed using rspconfig.--------------------" if [[ $? -eq 0 ]];then BMCNETMASK=`rspconfig $2 netmask |awk -F":" '{print $3}'` else exit 1; fi - change_netmask $BMCNETMASK $2 $3 + change_nonip $BMCNETMASK $2 $3 netmask if [[ $? -eq 1 ]];then + echo "--------------------To test bmc netmask could be changed using rspconfig failed.------------------" exit 1 else + echo "--------------------To test bmc netmask could be changed using rspconfig successfully.-------------------" exit 0 fi ;; + "-ln"|"--list netmask" ) + output=rpconfig $2 netmask + if [[ $? -eq 0 ]];then + if [[ $output =~ "$2 BMC Netmask:" ]];then + echo "-------------------To test bmc Netmask could be listed using rspconfig successfully.-----------------" + exit 0; + else + echo "-----------------To test bmc Netmask could be listed using rsconfig failed.-------------------" + exit 1; + fi + else + echo "-------------------To test bmc Netmask could be listed using rspconfig failed.---------------" + exit 1; + fi + ;; + "-v"|"--vlan" ) + output=rspconfig $2 vlan + echo "---------------------To test bmc vlan could be changed using rspconfig.--------------------" + if [[ $? -eq 0 ]]&&[[ $output =~ "BMC VLAN ID enabled" ]];then + BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` + else + echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" + exit 1; + fi + change_nonip $BMCVLAN $2 $3 vlan + if [[ $? -eq 1 ]];then + echo "--------------------To test bmc vlan could be changed using rspconfig failed.------------------" + exit 1 + else + echo "--------------------To test bmc vlan could be changed using rspconfig successfully.-------------------" + exit 0 + fi + ;; + "-lv"|"--list vlan" ) + output=rpconfig $2 vlan + if [[ $? -eq 0 ]];then + if [[ $output =~ "$2 BMC VLAN ID:" ]];then + echo "-------------------To test bmc Vlan could be listed using rspconfig successfully.-----------------" + exit 0; + else + echo "-----------------To test bmc Vlan could be listed using rsconfig failed.-------------------" + exit 1; + fi + else + echo "-------------------To test bmc Vlan could be listed using rspconfig failed.---------------" + exit 1; + fi + ;; + "-a"|"--all" ) + change_all $2 + if [[ $? -eq 1 ]];then + echo "--------------------To test bmc's all options could be changed using rspconfig failed.------------------" + exit 1 + else + echo "--------------------To test bmc's all options could be changed using rspconfig successfully.-------------------" + exit 0 + fi + ;; + "-la"|"--list all" ) + BMCIP_LSDEF=`lsdef $2 |grep bmc |awk -F "=" '{print $2}'` + BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` + output=rspconfig $2 ip gateway netmask vlan + if [[ $? -eq 0 ]];then + if [[ $output =~ "$2 BMC VLAN ID:" ]]&&[[ $output =~ "$2 BMC Netmask:" ]]&&[[ $output =~ "$2 BMC Gateway:" ]]&&[[ $BMCIP =~ "$BMCIP_LSDEF" ]];then + echo "------------------To test bmc's all option could be listed using rspconfig succssfully.-----------------" + exit 0 + else + echo "--------------------To test bmc's all options could be listed using rspconfig failed.--------------------" + exit 1 + fi + fi + ;; "-c"|"--clear" ) + echo "--------------------To clear the test envionment.--------------------" clear_env $1 $2 $3 if [[ $? -eq 1 ]];then + echo "--------------------To clear the test environment failed.-----------------" exit 1 else + echo "--------------------To clear the test environment sucessfully.-----------------" exit 0 fi ;; From e9a8d0121c6fcf9cf903b8a35aa02aa655ca04cc Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 4 Sep 2017 09:06:55 -0400 Subject: [PATCH 05/11] modify rspconfig testcase --- xCAT-test/autotest/testcase/rspconfig/cases0 | 49 +++++++++++++++++-- .../autotest/testcase/rspconfig/rspconfig.sh | 30 ++++++------ 2 files changed, 61 insertions(+), 18 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/cases0 b/xCAT-test/autotest/testcase/rspconfig/cases0 index 838b21171..32cf4618b 100644 --- a/xCAT-test/autotest/testcase/rspconfig/cases0 +++ b/xCAT-test/autotest/testcase/rspconfig/cases0 @@ -41,7 +41,7 @@ check:rc==0 check:output=~__GETNODEATTR($$CN,hcp)__: \w+ end -start:rspconfig_ip +start:rspconfig_set_ip description:rspconfig change openbmc ip Attribute: $$CN-The operation object of rspconfig command cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -i $$CN $NODEIP @@ -64,7 +64,7 @@ cmd:rspconfig $$CN ip= check:rc!=0 end -start:rspconfig_netmask +start:rspconfig_set_netmask description:rspconfig change openbmc netmask Attribute: $$CN-The operation object of rspconfig command cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -n $$CN netmask @@ -78,12 +78,19 @@ cmd:rspconfig $$CN netmask=ddd check:rc!=0 end -start:rspconfig_gateway +start:rspconfig_set_gateway description:rspconfig change openbmc gateway Attribute: $$CN-The operation object of rspconfig command cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -g $$CN gateway check:rc==0 end + +start:rspconfig_set_vlan +description:rspconfig change openbmc gateway +Attribute: $$CN-The operation object of rspconfig command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -v $$CN vlan +check:rc==0 +end start:rspconfig_gateway_invalid despcription:rspconfig could not change openbmc gatway using invalid gateway @@ -101,4 +108,38 @@ check:rc!=0 cmd:if [[ -e /tmp/testnode.stanza ]]; then cat /tmp/testnode.stanza | chdef -z;rm -rf /tmp/testnode.stanza;fi check:rc==0 end - + +start:rspconfig_list_ip +despcription:rspconfig list bmc ip +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -lip $$CN +check:rc==0 +end + +start:rspconfig_list_gateway +description:rspconfig list openbmc gateway +Attribute: $$CN-The operation object of rspconfig command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -lg $$CN +check:rc==0 +end + +start:rspconfig_list_netmask +description:rspconfig list openbmc netmask +Attribute: $$CN-The operation object of rspconfig command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -ln $$CN +check:rc==0 +end + +start:rspconfig_list_vlan +description:rspconfig list openbmc netmask +Attribute: $$CN-The operation object of rspconfig command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -lv $$CN +check:rc==0 +end + +start:rspconfig_list_all +description:rspconfig list openbmc netmask +Attribute: $$CN-The operation object of rspconfig command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -la $$CN +check:rc==0 +end + diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 38625bcd2..b540a5650 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -199,7 +199,7 @@ do ;; "-lip"|"--list ip" ) echo "--------------------To test bmc ip could be listed using rspconfig.--------------------" - BMCIP_LSDEF=`lsdef $2 |grep bmc |awk -F "=" '{print $2}'` + BMCIP_LSDEF=`lsdef $2 |grep "bmc=" |awk -F "=" '{print $2}'` rspconfig $2 ip if [[ $? -eq 0 ]];then BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` @@ -234,17 +234,18 @@ do fi ;; "-lg"|"--list gateway" ) - output=rpconfig $2 gateway + output=`rspconfig $2 gateway` +echo "output is $output" if [[ $? -eq 0 ]];then - if [[ $output =~ "$2 BMC Gateway:" ]];then - echo "-------------------To test bmc gateway could be listed using rspconfig successfully.-----------------" + if [[ $output =~ "$2: BMC Gateway:" ]];then + echo "--1-----------------To test bmc gateway could be listed using rspconfig successfully.-----------------" exit 0; else - echo "-----------------To test bmc gateway could be listed using rsconfig failed.-------------------" + echo "---2--------------To test bmc gateway could be listed using rsconfig failed.-------------------" exit 1; fi else - echo "-------------------To test bmc gateway could be listed using rspconfig failed.---------------" + echo "------------3-------To test bmc gateway could be listed using rspconfig failed.---------------" exit 1; fi ;; @@ -266,9 +267,9 @@ do fi ;; "-ln"|"--list netmask" ) - output=rpconfig $2 netmask + output=`rspconfig $2 netmask` if [[ $? -eq 0 ]];then - if [[ $output =~ "$2 BMC Netmask:" ]];then + if [[ $output =~ "$2: BMC Netmask:" ]];then echo "-------------------To test bmc Netmask could be listed using rspconfig successfully.-----------------" exit 0; else @@ -281,7 +282,7 @@ do fi ;; "-v"|"--vlan" ) - output=rspconfig $2 vlan + output=`rspconfig $2 vlan` echo "---------------------To test bmc vlan could be changed using rspconfig.--------------------" if [[ $? -eq 0 ]]&&[[ $output =~ "BMC VLAN ID enabled" ]];then BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` @@ -299,9 +300,9 @@ do fi ;; "-lv"|"--list vlan" ) - output=rpconfig $2 vlan + output=`rspconfig $2 vlan` if [[ $? -eq 0 ]];then - if [[ $output =~ "$2 BMC VLAN ID:" ]];then + if [[ $output =~ "$2: BMC VLAN ID" ]];then echo "-------------------To test bmc Vlan could be listed using rspconfig successfully.-----------------" exit 0; else @@ -324,11 +325,12 @@ do fi ;; "-la"|"--list all" ) - BMCIP_LSDEF=`lsdef $2 |grep bmc |awk -F "=" '{print $2}'` + BMCIP_LSDEF=`lsdef $2 |grep "bmc=" |awk -F "=" '{print $2}'` BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` - output=rspconfig $2 ip gateway netmask vlan + output=`rspconfig $2 ip gateway netmask vlan` if [[ $? -eq 0 ]];then - if [[ $output =~ "$2 BMC VLAN ID:" ]]&&[[ $output =~ "$2 BMC Netmask:" ]]&&[[ $output =~ "$2 BMC Gateway:" ]]&&[[ $BMCIP =~ "$BMCIP_LSDEF" ]];then + #if [[ $output =~ "BMC VLAN ID:" ]]&&[[ $output =~ "BMC Netmask:" ]]&&[[ $output =~ "BMC Gateway:" ]]&&[[ $BMCIP =~ "$BMCIP_LSDEF" ]];then + if [[ $output =~ "$2: BMC VLAN ID" ]]&&[[ $output =~ "BMC Netmask:" ]]&&[[ $output =~ "BMC Gateway:" ]]&&[[ $BMCIP =~ "$BMCIP_LSDEF" ]];then echo "------------------To test bmc's all option could be listed using rspconfig succssfully.-----------------" exit 0 else From 5255b79a138e0151a0989cb27e209cbec8004f1e Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 11 Sep 2017 09:48:17 -0400 Subject: [PATCH 06/11] modify rspconfig testcase for get more debug information --- .../autotest/testcase/rspconfig/rspconfig.sh | 265 ++++++++++-------- 1 file changed, 151 insertions(+), 114 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index b540a5650..6b7657d68 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -1,4 +1,39 @@ #!/bin/bash +function usage() +{ + local script="${0##*/}" + while read -r ; do echo "${REPLY}" ; done <<-EOF +Usage: ${script} [OPTION]... [ACTION] + Test rspconfig automatically + +Options: + Mandatory arguments to long options are mandatory for short options too. + -h, --help display this help and exit + -i|--ip To test rspconfig could change bmc's ip + -lip|--list ip To test rspconfig could get bmc's ip + -g|--gateway To test rspconfig could change bmc's gateway + -lg|--list gateway To test rspconfig could list bmc's gateway + -n|--netmask To test rspconfig could change bmc's netmask + -ln|--list netmask To test rspconfig could list bmc's netmask + -v|--vlan To test rspconfig could change bmc's vlan + -lv|--list vlan To test rspconfig could list bmc's vlan + -a|--all To test rspconfig could change bmc's ip,gateway,netmask,vlan + -la|--list all To test rspconfig could list bmc's ip,gateway,netmask,vlan + -c|--clear To clear test environment +Examples: + ${script} -i noderange nodeip=node's ip + ${script} -n noderange netmask + ${script} -g noderange gateway + ${script} -v noderange vlan + ${script} -lip noderange + ${script} -ln noderange + ${script} -lg noderange + ${script} -lv noderange + ${script} -a noderange + ${script} -la noderange + +EOF +} function test_ip() { IP=$1 @@ -20,27 +55,26 @@ function net() FIRSTIP=`echo "$1 $2"|awk -F '[ .]+' 'BEGIN{OFS="."} END{print and($1,$5),and($2,$6),and($3,$7),and($4,$8)}'` echo lastip is $LASTIP echo first ip is $FIRSTIP - } function change_ip() { - echo "Prepare to change ip." - echo "Start to check ip valid." - NODEIP=$4; + echo "Prepare to change ip." + echo "Start to check ip valid." + NODEIP=$4; test_ip $1; if [[ $? -ne 0 ]];then echo "ip is invalid";return 1;fi - echo "ip is valid."; + echo "ip is valid."; echo $1 > /tmp/BMCIP - net $1 $3 + net $1 $3 ip1=`echo $1|awk -F. '{print $1}'` ip2=`echo $1|awk -F. '{print $2}'` ip3=`echo $1|awk -F. '{print $3}'` - ip4=`echo $1|awk -F. '{print $4}'` + ip4=`echo $1|awk -F. '{print $4}'` ipfirst=`echo $FIRSTIP|awk -F. '{print $4}'` - ip=`expr "$ipfirst" "+" "1"` + ip=`expr "$ipfirst" "+" "1"` iplast=`echo $LASTIP|awk -F. '{print $4}'` - ip5=`expr "$iplast" "-" "1"` - echo ip is $ip ,ip5 is $ip5 + ip5=`expr "$iplast" "-" "1"` + echo ip is $ip ,ip5 is $ip5 while true; do [[ $ip == "$ip5" ]] && echo "exit for using last ip."&&return 1; ping $ip1.$ip2.$ip3.$ip -c 2 >/dev/null ; @@ -48,23 +82,23 @@ function change_ip() coutip="$ip1.$ip2.$ip3.$ip" BMCNEWIP=$coutip; echo $1,$2,$3 - echo "Start to set ip for node." + echo "Start to set ip for node." rspconfig $2 ip=$BMCNEWIP if [[ $? -eq 0 ]];then echo "Could set bmc's ip for node using rspconfig."; else - echo "Could not set bmc's ip for node using rspconfig."; + echo "Could not set bmc's ip for node using rspconfig."; return 1; fi chdef $2 bmc=$BMCNEWIP - echo "Start to check bmc's ip setted successfully or not." + echo "Start to check bmc's ip setting." check_result $2 ip $BMCNEWIP if [[ $? -ne 0 ]] ;then - echo "Set bmc's ip failed."; + echo "Set bmc's ip failed."; return 1; else echo "Set bmc's ip successfully."; - return 0; + return 0; fi fi ip=`expr "$ip" "+" "1"` @@ -114,8 +148,8 @@ function clear_env() } function change_nonip { -echo "Prepare to change $4."; -echo "Start to check $4 valid or not."; + echo "Prepare to change $4."; + echo "Start to check $4 valid or not."; if [[ $4 =~ "gateway" ]]||[[ $4 =~ "netmask" ]];then test_ip $1; if [[ $? -ne 0 ]];then @@ -126,45 +160,45 @@ echo "Start to check $4 valid or not."; echo "Start to change bmc's $4."; rspconfig $2 $4=$1; if [[ $? -eq 0 ]];then - echo "Could set bmc's $4."; - else - echo "Could not set bmc's $4."; - return 1; - fi - echo "Start to check $4 setting successfully or not."; - check_result $2 $3 $1 - if [[ $? -ne 0 ]] ;then - echo "Set bmc's $4 failed."; - return 1; - else - echo "Set bmc's $4 successfully."; - return 0; - fi + echo "Could set bmc's $4."; + else + echo "Could not set bmc's $4."; + return 1; + fi + echo "Start to check $4 setting."; + check_result $2 $3 $1 + if [[ $? -ne 0 ]] ;then + echo "Set bmc's $4 failed."; + return 1; + else + echo "Set bmc's $4 successfully."; + return 0; + fi } function change_all { -echo "Prepare to change all for bmc." -echo "Start to change all for bmc." + echo "Prepare to change all for bmc." + echo "Start to change all for bmc." rspconfig $2 gateway netmask vlan ip if [[ $? -eq 0 ]];then BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'`; BMCNETMASK=`rspconfig $2 netmask |awk -F":" '{print $3}'`; BMCGGATEWAY=`rspconfig $2 gateway |awk -F":" '{print $3}'`; - output=`rspconfig $2 vlan` - if [[ $output =~ "BMC VLAN ID enabled" ]];then - BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` - else - echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" - return 1; - fi + output=`rspconfig $2 vlan` + if [[ $output =~ "BMC VLAN ID enabled" ]];then + BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` + else + echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" + return 1; + fi rspconfig $2 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN if [[ $? -eq 0 ]];then - echo "Could set bmc's all options."; - else - echo "Could not set bmc's all options."; - return 1; - fi + echo "Could set BMC IP/netmask/gateway/vlan."; + else + echo "Could not set BMC IP/netmask/gateway/vlan."; + return 1; + fi fi } @@ -198,11 +232,11 @@ do fi ;; "-lip"|"--list ip" ) - echo "--------------------To test bmc ip could be listed using rspconfig.--------------------" - BMCIP_LSDEF=`lsdef $2 |grep "bmc=" |awk -F "=" '{print $2}'` - rspconfig $2 ip - if [[ $? -eq 0 ]];then - BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` + echo "--------------------To test bmc ip could be listed using rspconfig.--------------------" + BMCIP_LSDEF=`lsdef $2 |grep "bmc=" |awk -F "=" '{print $2}'` + rspconfig $2 ip + if [[ $? -eq 0 ]];then + BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` if [[ $BMCIP =~ "$BMCIP_LSDEF" ]];then echo "-----------------To test bmc ip could be listed using rspconfig successfully.-----------------" exit 0; @@ -210,11 +244,11 @@ do echo "-------------------To test bmc ip could be listed using rspconfig failed.----------------" exit 1; fi - else + else echo "------------------To test bmc ip could be listed using rspconfig failed.-------------------" - exit 1; - fi - ;; + exit 1; + fi + ;; "-g"|"--gateway" ) echo "--------------------To test bmc gateway could be changed using rspconfig.---------------------" @@ -222,11 +256,11 @@ do if [[ $? -eq 0 ]];then BMCGATEWAYE=`rspconfig $2 gateway |awk -F":" '{print $3}'` else - exit 1; + exit 1; fi change_nonip $BMCGATEWAYE $2 $3 gateway if [[ $? -eq 1 ]];then - echo "--------------------To test bmc gateway could be changed using rspconfig failed.--------------------" + echo "--------------------To test bmc gateway could be changed using rspconfig failed.--------------------" exit 1 else echo "--------------------To test bmc gateway could be changed using rspconfig successfully.--------------------" @@ -235,7 +269,6 @@ do ;; "-lg"|"--list gateway" ) output=`rspconfig $2 gateway` -echo "output is $output" if [[ $? -eq 0 ]];then if [[ $output =~ "$2: BMC Gateway:" ]];then echo "--1-----------------To test bmc gateway could be listed using rspconfig successfully.-----------------" @@ -266,70 +299,69 @@ echo "output is $output" exit 0 fi ;; - "-ln"|"--list netmask" ) - output=`rspconfig $2 netmask` - if [[ $? -eq 0 ]];then - if [[ $output =~ "$2: BMC Netmask:" ]];then - echo "-------------------To test bmc Netmask could be listed using rspconfig successfully.-----------------" - exit 0; - else - echo "-----------------To test bmc Netmask could be listed using rsconfig failed.-------------------" - exit 1; - fi - else - echo "-------------------To test bmc Netmask could be listed using rspconfig failed.---------------" - exit 1; - fi - ;; - "-v"|"--vlan" ) - output=`rspconfig $2 vlan` - echo "---------------------To test bmc vlan could be changed using rspconfig.--------------------" - if [[ $? -eq 0 ]]&&[[ $output =~ "BMC VLAN ID enabled" ]];then - BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` - else - echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" + "-ln"|"--list netmask" ) + output=`rspconfig $2 netmask` + if [[ $? -eq 0 ]];then + if [[ $output =~ "$2: BMC Netmask:" ]];then + echo "-------------------To test bmc Netmask could be listed using rspconfig successfully.-----------------" + exit 0; + else + echo "-----------------To test bmc Netmask could be listed using rsconfig failed.-------------------" + exit 1; + fi + else + echo "-------------------To test bmc Netmask could be listed using rspconfig failed.---------------" exit 1; - fi - change_nonip $BMCVLAN $2 $3 vlan - if [[ $? -eq 1 ]];then - echo "--------------------To test bmc vlan could be changed using rspconfig failed.------------------" - exit 1 - else - echo "--------------------To test bmc vlan could be changed using rspconfig successfully.-------------------" - exit 0 - fi - ;; - "-lv"|"--list vlan" ) - output=`rspconfig $2 vlan` - if [[ $? -eq 0 ]];then - if [[ $output =~ "$2: BMC VLAN ID" ]];then - echo "-------------------To test bmc Vlan could be listed using rspconfig successfully.-----------------" - exit 0; - else - echo "-----------------To test bmc Vlan could be listed using rsconfig failed.-------------------" - exit 1; - fi - else - echo "-------------------To test bmc Vlan could be listed using rspconfig failed.---------------" - exit 1; - fi - ;; - "-a"|"--all" ) - change_all $2 + fi + ;; + "-v"|"--vlan" ) + output=`rspconfig $2 vlan` + echo "---------------------To test bmc vlan could be changed using rspconfig.--------------------" + if [[ $? -eq 0 ]]&&[[ $output =~ "BMC VLAN ID enabled" ]];then + BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` + else + echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" + exit 1; + fi + change_nonip $BMCVLAN $2 $3 vlan if [[ $? -eq 1 ]];then - echo "--------------------To test bmc's all options could be changed using rspconfig failed.------------------" - exit 1 + echo "--------------------To test bmc vlan could be changed using rspconfig failed.------------------" + exit 1 + else + echo "--------------------To test bmc vlan could be changed using rspconfig successfully.-------------------" + exit 0 + fi + ;; + "-lv"|"--list vlan" ) + output=`rspconfig $2 vlan` + if [[ $? -eq 0 ]];then + if [[ $output =~ "$2: BMC VLAN ID" ]];then + echo "-------------------To test bmc Vlan could be listed using rspconfig successfully.-----------------" + exit 0; + else + echo "-----------------To test bmc Vlan could be listed using rsconfig failed.-------------------" + exit 1; + fi + else + echo "-------------------To test bmc Vlan could be listed using rspconfig failed.---------------" + exit 1; + fi + ;; + "-a"|"--all" ) + change_all $2 + if [[ $? -eq 1 ]];then + echo "--------------------To test BMC IP/netmask/gateway/vlan could be changed using rspconfig failed.------------------" + exit 1 else - echo "--------------------To test bmc's all options could be changed using rspconfig successfully.-------------------" - exit 0 - fi + echo "--------------------To test BMC IP/netmask/gateway/vlan could be changed using rspconfig successfully.-------------------" + exit 0 + fi ;; "-la"|"--list all" ) BMCIP_LSDEF=`lsdef $2 |grep "bmc=" |awk -F "=" '{print $2}'` BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` output=`rspconfig $2 ip gateway netmask vlan` if [[ $? -eq 0 ]];then - #if [[ $output =~ "BMC VLAN ID:" ]]&&[[ $output =~ "BMC Netmask:" ]]&&[[ $output =~ "BMC Gateway:" ]]&&[[ $BMCIP =~ "$BMCIP_LSDEF" ]];then if [[ $output =~ "$2: BMC VLAN ID" ]]&&[[ $output =~ "BMC Netmask:" ]]&&[[ $output =~ "BMC Gateway:" ]]&&[[ $BMCIP =~ "$BMCIP_LSDEF" ]];then echo "------------------To test bmc's all option could be listed using rspconfig succssfully.-----------------" exit 0 @@ -340,7 +372,7 @@ echo "output is $output" fi ;; "-c"|"--clear" ) - echo "--------------------To clear the test envionment.--------------------" + echo "--------------------To clear the test envionment.--------------------" clear_env $1 $2 $3 if [[ $? -eq 1 ]];then echo "--------------------To clear the test environment failed.-----------------" @@ -350,11 +382,16 @@ echo "output is $output" exit 0 fi ;; + "-h"|"--help" ) + usage + exit 0 + ;; *) echo - echo "Please Insert $0: -i|-g|-n|-c" + echo "Please Insert $0: -i|-lip|-g|-lg|-n|-ln|-v|-lv|-c|-a|-la" echo exit 1; ;; esac + shift done From 6fe93b9cb83488cbe083e141f3d11fadcd28d0d1 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 12 Sep 2017 04:46:24 -0400 Subject: [PATCH 07/11] modify rspconfig testcase for get more debug information --- xCAT-test/autotest/testcase/rspconfig/cases0 | 31 +++++++++++++++++++ .../autotest/testcase/rspconfig/rspconfig.sh | 15 ++++----- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/cases0 b/xCAT-test/autotest/testcase/rspconfig/cases0 index 32cf4618b..8266cc402 100644 --- a/xCAT-test/autotest/testcase/rspconfig/cases0 +++ b/xCAT-test/autotest/testcase/rspconfig/cases0 @@ -91,6 +91,13 @@ Attribute: $$CN-The operation object of rspconfig command cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -v $$CN vlan check:rc==0 end + +start:rspconfig_set_all +description:rspconfig change openbmc ip/netmask/gateway/vlan +Attribute: $$CN-The operation object of rspconfig command +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -a $$CN +check:rc==0 +end start:rspconfig_gateway_invalid despcription:rspconfig could not change openbmc gatway using invalid gateway @@ -99,6 +106,20 @@ cmd:rspconfig $$CN gateway=ddd check:rc!=0 end +start:rspconfig_set_vlan_invalid +despcription:rspconfig could not change openbmc gatway using invalid vlan +Attribute: $$CN-The operation object of rspconfig command +cmd:rspconfig $$CN vlan=dddsdsdfs +check:rc!=0 +end + +start:rspconfig_set_all_invalid +despcription:rspconfig could not change openbmc gatway using invalid vlan +Attribute: $$CN-The operation object of rspconfig command +cmd:rspconfig $$CN ip=dsd gateway=ooo netmask=asfsf vlan=dddsdsdfs +check:rc!=0 +end + start:rspconfig_node_invalid despcription:rspconfig could not do any action using invalid node cmd:test=$(lsdef testnode);if [[ $? -eq 0 ]]; then lsdef -l testnode -z >/tmp/testnode.stanza ;rmdef testnode;fi @@ -109,6 +130,16 @@ cmd:if [[ -e /tmp/testnode.stanza ]]; then cat /tmp/testnode.stanza | chdef -z;r check:rc==0 end +start:rspconfig_noderange_invalid +despcription:rspconfig could not do any action using invalid node +cmd:test=$(lsdef testnode);if [[ $? -eq 0 ]]; then lsdef -l testnode -z >/tmp/testnode.stanza ;rmdef testnode;fi +check:rc==0 +cmd:rspconfig testnode,$$CN ip +check:rc!=0 +cmd:if [[ -e /tmp/testnode.stanza ]]; then cat /tmp/testnode.stanza | chdef -z;rm -rf /tmp/testnode.stanza;fi +check:rc==0 +end + start:rspconfig_list_ip despcription:rspconfig list bmc ip cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rspconfig/rspconfig.sh -lip $$CN diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 6b7657d68..1a5ea8667 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -180,19 +180,20 @@ function change_all { echo "Prepare to change all for bmc." echo "Start to change all for bmc." - rspconfig $2 gateway netmask vlan ip + rspconfig $1 gateway netmask vlan ip if [[ $? -eq 0 ]];then - BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'`; - BMCNETMASK=`rspconfig $2 netmask |awk -F":" '{print $3}'`; - BMCGGATEWAY=`rspconfig $2 gateway |awk -F":" '{print $3}'`; - output=`rspconfig $2 vlan` + BMCIP=`rspconfig $1 ip |awk -F":" '{print $3}'|sed s/[[:space:]]//g`; + BMCNETMASK=`rspconfig $1 netmask |awk -F":" '{print $3}'|sed s/[[:space:]]//g`; + BMCGGATEWAY=`rspconfig $1 gateway |awk -F":" '{print $3}'|sed s/[[:space:]]//g`; + output=`rspconfig $1 vlan` if [[ $output =~ "BMC VLAN ID enabled" ]];then - BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` + BMCVLAN=`rspconfig $1 vlan |awk -F":" '{print $3}'|sed s/[[:space:]]//g` else echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" return 1; fi - rspconfig $2 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN + + rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN if [[ $? -eq 0 ]];then echo "Could set BMC IP/netmask/gateway/vlan."; else From 4833502bc2f75f87b7f1e6c2d9d882abcc8c0810 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 13 Sep 2017 07:08:06 -0400 Subject: [PATCH 08/11] modify rspconfig testcase for get more debug information --- .../autotest/testcase/rspconfig/rspconfig.sh | 165 +++++++++++------- 1 file changed, 99 insertions(+), 66 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 1a5ea8667..4dbcbc14b 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -58,12 +58,12 @@ function net() } function change_ip() { - echo "Prepare to change ip." - echo "Start to check ip valid." + echo "Prepare to change node's bmc ip." + echo "Start to check node's bmc original ip valid." NODEIP=$4; test_ip $1; - if [[ $? -ne 0 ]];then echo "ip is invalid";return 1;fi - echo "ip is valid."; + if [[ $? -ne 0 ]];then echo "node's bmc original ip is invalid";return 1;fi + echo "node's bmc original ip is valid."; echo $1 > /tmp/BMCIP net $1 $3 ip1=`echo $1|awk -F. '{print $1}'` @@ -74,30 +74,28 @@ function change_ip() ip=`expr "$ipfirst" "+" "1"` iplast=`echo $LASTIP|awk -F. '{print $4}'` ip5=`expr "$iplast" "-" "1"` - echo ip is $ip ,ip5 is $ip5 while true; do [[ $ip == "$ip5" ]] && echo "exit for using last ip."&&return 1; ping $ip1.$ip2.$ip3.$ip -c 2 >/dev/null ; if [[ $? != 0 && "$ip" != "$ip4" && "$ip1.$ip2.$ip3.$ip" != "$NODEIP" ]]; then coutip="$ip1.$ip2.$ip3.$ip" BMCNEWIP=$coutip; - echo $1,$2,$3 - echo "Start to set ip for node." + echo "Start to set node's bmc ip to $BMCNEWIP." rspconfig $2 ip=$BMCNEWIP if [[ $? -eq 0 ]];then - echo "Could set bmc's ip for node using rspconfig."; + echo "Set node's bmc ip for node using rspconfig successfully."; else - echo "Could not set bmc's ip for node using rspconfig."; + echo "Set node's bmc ip for node using rspconfig failed."; return 1; fi chdef $2 bmc=$BMCNEWIP - echo "Start to check bmc's ip setting." + echo "Start to check node's bmc's ip really setted using rspconfig." check_result $2 ip $BMCNEWIP if [[ $? -ne 0 ]] ;then - echo "Set bmc's ip failed."; + echo "Node's bmc ip really setted failed ."; return 1; else - echo "Set bmc's ip successfully."; + echo "Node's bmc ip really setted successfully."; return 0; fi fi @@ -109,9 +107,7 @@ function check_result() a=0; while true; do [ $a -eq 20 ] && return 1; output=`rspconfig $1 $2 |awk -F: '{print $3}'`; - echo output is $output; if [[ $(echo $output|tr '.' '+'|bc) -eq $(echo $3|tr '.' '+'|bc) ]];then - echo checkresult is $output; return 0 ; else a=$[$a+1]; @@ -125,22 +121,21 @@ function clear_env() echo "Start to clear test environment."; if [[ -f /tmp/BMCIP ]];then originip=$(cat /tmp/BMCIP); - echo originip is $originip; rspconfig $2 ip=$originip if [[ $? -eq 0 ]];then - echo "Could set bmc's ip to originip using rspconfig."; + echo "Set node's bmc ip to originip using rspconfig successfully."; else - echo "Could not set bmc's ip to originip using rspconfig."; + echo "Set node's bmc ip to originip using rspconfig failed."; return 1; fi rm -rf /tmp/BMCIP chdef $2 bmc=$originip check_result $2 $3 $originip if [[ $? -ne 0 ]] ;then - echo "Set bmc's ip to originip failed."; + echo "Node's bmc ip really setted to originip failed."; return 1; else - echo "Set bmc's ip to originip successfully."; + echo "Node's bmc ip really setted to originip successfully."; return 0; fi fi @@ -148,38 +143,38 @@ function clear_env() } function change_nonip { - echo "Prepare to change $4."; - echo "Start to check $4 valid or not."; + echo "Prepare to change node's bmc $4."; + echo "Start to check node's bmc $4 valid or not."; if [[ $4 =~ "gateway" ]]||[[ $4 =~ "netmask" ]];then test_ip $1; if [[ $? -ne 0 ]];then - echo "$4 is invalid"; + echo "Node's bmc $4 is invalid"; return 1; fi fi echo "Start to change bmc's $4."; rspconfig $2 $4=$1; if [[ $? -eq 0 ]];then - echo "Could set bmc's $4."; + echo "Set node's bmc $4 using rspconfig successfully."; else - echo "Could not set bmc's $4."; + echo "Set node's bmc $4 using rspconfig failed."; return 1; fi - echo "Start to check $4 setting."; + echo "Start to check node's bmc $4 really setted using rspconfig."; check_result $2 $3 $1 if [[ $? -ne 0 ]] ;then - echo "Set bmc's $4 failed."; + echo "Node's bmc $4 really setted failed."; return 1; else - echo "Set bmc's $4 successfully."; + echo "Node's bmc $4 really setted successfully."; return 0; fi } function change_all { - echo "Prepare to change all for bmc." - echo "Start to change all for bmc." + echo "Prepare to change ip/netmask/gateway/vlan for node's bmc." + echo "Start to change ip/netmask/gatway/vlan for node's bmc." rspconfig $1 gateway netmask vlan ip if [[ $? -eq 0 ]];then BMCIP=`rspconfig $1 ip |awk -F":" '{print $3}'|sed s/[[:space:]]//g`; @@ -188,17 +183,55 @@ function change_all output=`rspconfig $1 vlan` if [[ $output =~ "BMC VLAN ID enabled" ]];then BMCVLAN=`rspconfig $1 vlan |awk -F":" '{print $3}'|sed s/[[:space:]]//g` + rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN + if [[ $? -eq 0 ]];then + echo "Node's BMC IP/netmask/gateway/vlan setted successfully using rspconfig."; + else + echo "Node's BMC IP/netmask/gateway/vlan setted failed using rspconfig."; + return 1; + fi + echo "Start to check node's BMC IP/netmask/gateway/vlan really setted using rspconfig."; + check_result $1 ip $BMCIP + rc1=$?; + check_result $1 netmask $BMCNETMASK + rc2=$?; + check_result $1 gateway $BMCGGATEWAY + rc3=$?; + check_result $1 vlan $BMCVLAN + rc4=$?; + if [[ $rc1 -eq 0 ]] && [[ $rc2 -eq 0 ]] && [[ $rc3 -eq 0 ]] && [[ $rc4 -eq 0 ]];then + echo "Node's bmc IP/netmask/gateway/vlan really setted successfully." + return 0; + else + echo "Node's bmc IP/netmask/gateway really setted failed." + return 1; + fi + + else echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" - return 1; - fi + rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY + if [[ $? -eq 0 ]];then + echo "Node's BMC IP/netmask/gateway setted successfully using rspconfig."; + else + echo "Node's BMC IP/netmask/gateway setted failed using rspconfig."; + return 1; + fi + echo "Start to check node's BMC IP/netmask/gateway really setted using rspconfig."; + check_result $1 ip $BMCIP + rc1=$?; + check_result $1 netmask $BMCNETMASK + rc2=$?; + check_result $1 gateway $BMCGGATEWAY + rc3=$?; + if [[ $rc1 -eq 0 ]] && [[ $rc2 -eq 0 ]] && [[ $rc3 -eq 0 ]];then + echo "Node's bmc IP/netmask/gateway really setted successfully." + return 0; + else + echo "Node's bmc IP/netmask/gateway really setted failed." + return 1; + fi - rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN - if [[ $? -eq 0 ]];then - echo "Could set BMC IP/netmask/gateway/vlan."; - else - echo "Could not set BMC IP/netmask/gateway/vlan."; - return 1; fi fi @@ -215,7 +248,7 @@ while [ "$#" -gt "0" ] do case $1 in "-i"|"--ip" ) - echo "--------------------To test bmc ip could be changed using rspconfig.--------------------" + echo "--------------------Start to test rspconfig change node's bmc ip .--------------------" rspconfig $2 ip if [[ $? -eq 0 ]];then BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` @@ -225,34 +258,34 @@ do fi change_ip $BMCIP $2 $BMCNETMASK $3 if [[ $? -eq 1 ]];then - echo "--------------------To test bmc ip could be changed using rspconfig failed.--------------------" + echo "--------------------Result for test rspconfig change node's bmc ip failed.--------------------" exit 1 else - echo "--------------------To test bmc ip could be change using rspconfig successfully.-------------------" + echo "--------------------Restult for test rspconfig change node's bmc ip successfully.-------------------" exit 0 fi ;; "-lip"|"--list ip" ) - echo "--------------------To test bmc ip could be listed using rspconfig.--------------------" + echo "--------------------Start to test rspconfig list node's bmc ip .--------------------" BMCIP_LSDEF=`lsdef $2 |grep "bmc=" |awk -F "=" '{print $2}'` rspconfig $2 ip if [[ $? -eq 0 ]];then BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` if [[ $BMCIP =~ "$BMCIP_LSDEF" ]];then - echo "-----------------To test bmc ip could be listed using rspconfig successfully.-----------------" + echo "-----------------Result for test rspconfig list node's bmc ip successfully.-----------------" exit 0; else - echo "-------------------To test bmc ip could be listed using rspconfig failed.----------------" + echo "-------------------Result for test rspconfig list node's bmc ip failed.----------------" exit 1; fi else - echo "------------------To test bmc ip could be listed using rspconfig failed.-------------------" + echo "------------------Result for test rspconfig list node's bmc ip failed.-------------------" exit 1; fi ;; "-g"|"--gateway" ) - echo "--------------------To test bmc gateway could be changed using rspconfig.---------------------" + echo "--------------------Start to test rspconfig change node's bmc gateway .---------------------" rspconfig $2 gateway if [[ $? -eq 0 ]];then BMCGATEWAYE=`rspconfig $2 gateway |awk -F":" '{print $3}'` @@ -261,10 +294,10 @@ do fi change_nonip $BMCGATEWAYE $2 $3 gateway if [[ $? -eq 1 ]];then - echo "--------------------To test bmc gateway could be changed using rspconfig failed.--------------------" + echo "--------------------Result for test rspconfig change node's bmc gateway failed.--------------------" exit 1 else - echo "--------------------To test bmc gateway could be changed using rspconfig successfully.--------------------" + echo "--------------------Result for test rspconfig change node's bmc gateway successfully.--------------------" exit 0 fi ;; @@ -272,20 +305,20 @@ do output=`rspconfig $2 gateway` if [[ $? -eq 0 ]];then if [[ $output =~ "$2: BMC Gateway:" ]];then - echo "--1-----------------To test bmc gateway could be listed using rspconfig successfully.-----------------" + echo "--------------------Result for test rspconfig list node's bmc gateway successfully.-----------------" exit 0; else - echo "---2--------------To test bmc gateway could be listed using rsconfig failed.-------------------" + echo "------------------Result for test rspconfig list node's bmc gateway failed.-------------------" exit 1; fi else - echo "------------3-------To test bmc gateway could be listed using rspconfig failed.---------------" + echo "-------------------Result for test rspconfig list node's bmc gateway failed.---------------" exit 1; fi ;; "-n"|"--netmask" ) rspconfig $2 netmask - echo "---------------------To test bmc netmask could be changed using rspconfig.--------------------" + echo "---------------------Start to test rspconfig change node's bmc netmask .--------------------" if [[ $? -eq 0 ]];then BMCNETMASK=`rspconfig $2 netmask |awk -F":" '{print $3}'` else @@ -293,10 +326,10 @@ do fi change_nonip $BMCNETMASK $2 $3 netmask if [[ $? -eq 1 ]];then - echo "--------------------To test bmc netmask could be changed using rspconfig failed.------------------" + echo "--------------------Result for rspconfig change node's bmc netmask failed.------------------" exit 1 else - echo "--------------------To test bmc netmask could be changed using rspconfig successfully.-------------------" + echo "--------------------Result for rspconfig change node's bmc netmask successfully.-------------------" exit 0 fi ;; @@ -304,20 +337,20 @@ do output=`rspconfig $2 netmask` if [[ $? -eq 0 ]];then if [[ $output =~ "$2: BMC Netmask:" ]];then - echo "-------------------To test bmc Netmask could be listed using rspconfig successfully.-----------------" + echo "-------------------Result for test rspconfig list node's bmc Netmask successfully.-----------------" exit 0; else - echo "-----------------To test bmc Netmask could be listed using rsconfig failed.-------------------" + echo "-----------------Result for test rspconfig list node's bmc Netmask failed.-------------------" exit 1; fi else - echo "-------------------To test bmc Netmask could be listed using rspconfig failed.---------------" + echo "-------------------Result for test rspconfig list node's bmc Netmask failed.---------------" exit 1; fi ;; "-v"|"--vlan" ) output=`rspconfig $2 vlan` - echo "---------------------To test bmc vlan could be changed using rspconfig.--------------------" + echo "---------------------Start to test rspconfig change node's bmc vlan .--------------------" if [[ $? -eq 0 ]]&&[[ $output =~ "BMC VLAN ID enabled" ]];then BMCVLAN=`rspconfig $2 vlan |awk -F":" '{print $3}'` else @@ -326,10 +359,10 @@ do fi change_nonip $BMCVLAN $2 $3 vlan if [[ $? -eq 1 ]];then - echo "--------------------To test bmc vlan could be changed using rspconfig failed.------------------" + echo "--------------------Result for rpsconfig change node's bmc vlan failed.------------------" exit 1 else - echo "--------------------To test bmc vlan could be changed using rspconfig successfully.-------------------" + echo "--------------------Result for rspconfig change node's bmc vlan successfully.-------------------" exit 0 fi ;; @@ -337,24 +370,24 @@ do output=`rspconfig $2 vlan` if [[ $? -eq 0 ]];then if [[ $output =~ "$2: BMC VLAN ID" ]];then - echo "-------------------To test bmc Vlan could be listed using rspconfig successfully.-----------------" + echo "-------------------Result for rspconfig list node's bmc Vlan successfully.-----------------" exit 0; else - echo "-----------------To test bmc Vlan could be listed using rsconfig failed.-------------------" + echo "-----------------Result for rspconfig list node's bmc Vlan failed.-------------------" exit 1; fi else - echo "-------------------To test bmc Vlan could be listed using rspconfig failed.---------------" + echo "-------------------Result for rspconfig list node's bmc Vlan failed.---------------" exit 1; fi ;; "-a"|"--all" ) change_all $2 if [[ $? -eq 1 ]];then - echo "--------------------To test BMC IP/netmask/gateway/vlan could be changed using rspconfig failed.------------------" + echo "--------------------Result for rspconfig change node's BMC IP/netmask/gateway/vlan failed.------------------" exit 1 else - echo "--------------------To test BMC IP/netmask/gateway/vlan could be changed using rspconfig successfully.-------------------" + echo "--------------------Result for rspconfig change node's BMC IP/netmask/gateway/vlan successfully.-------------------" exit 0 fi ;; @@ -364,10 +397,10 @@ do output=`rspconfig $2 ip gateway netmask vlan` if [[ $? -eq 0 ]];then if [[ $output =~ "$2: BMC VLAN ID" ]]&&[[ $output =~ "BMC Netmask:" ]]&&[[ $output =~ "BMC Gateway:" ]]&&[[ $BMCIP =~ "$BMCIP_LSDEF" ]];then - echo "------------------To test bmc's all option could be listed using rspconfig succssfully.-----------------" + echo "------------------Result for rspconfig list node's BMC IP/netmask/gateway/vlan succssfully.-----------------" exit 0 else - echo "--------------------To test bmc's all options could be listed using rspconfig failed.--------------------" + echo "--------------------Result for rspconfig list node's BMC IP/netmask/gateway/vlan failed.--------------------" exit 1 fi fi From e9e2604ea83238ac0eeb2441e30d604f8da5622f Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 13 Sep 2017 07:23:51 -0400 Subject: [PATCH 09/11] rspconfig.sh modify rspconfig testcase for get more debug info --- xCAT-test/autotest/testcase/rspconfig/rspconfig.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 4dbcbc14b..f7c5ef182 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -40,7 +40,7 @@ function test_ip() VALID_CHECK=$(echo $IP|awk -F. '$1<=255&&$2<=255&&$3<=255&&$4<=255{print "yes"}') if echo $IP|grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$">/dev/null; then if [ ${VALID_CHECK:-no} == "yes" ]; then - echo $1; + echo $1 is valid; else return 1; fi @@ -53,8 +53,6 @@ function net() { LASTIP=`echo "$1 $2"|awk -F '[ .]+' 'BEGIN{OFS="."} END{print or($1,xor($5,255)),or($2,xor($6,255)),or($3,xor($7,255)),or($4,xor($8,255))}'` FIRSTIP=`echo "$1 $2"|awk -F '[ .]+' 'BEGIN{OFS="."} END{print and($1,$5),and($2,$6),and($3,$7),and($4,$8)}'` - echo lastip is $LASTIP - echo first ip is $FIRSTIP } function change_ip() { From fddc0f64fa489357b6ae89ac78feb18d3675e9fa Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 13 Sep 2017 07:45:10 -0400 Subject: [PATCH 10/11] modify rspconfig testcase for get more debug info --- .../autotest/testcase/rspconfig/rspconfig.sh | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index f7c5ef182..8b8cda8ad 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -81,9 +81,9 @@ function change_ip() echo "Start to set node's bmc ip to $BMCNEWIP." rspconfig $2 ip=$BMCNEWIP if [[ $? -eq 0 ]];then - echo "Set node's bmc ip for node using rspconfig successfully."; + echo "Run rspconfig $2 ip=$BMCNEWIP and return value is 0."; else - echo "Set node's bmc ip for node using rspconfig failed."; + echo "Run rspconfig $2 ip=$BMCNEWIP and return value is 1."; return 1; fi chdef $2 bmc=$BMCNEWIP @@ -121,9 +121,9 @@ function clear_env() originip=$(cat /tmp/BMCIP); rspconfig $2 ip=$originip if [[ $? -eq 0 ]];then - echo "Set node's bmc ip to originip using rspconfig successfully."; + echo "Run rspconfig $2 ip=$originip and return value is 0."; else - echo "Set node's bmc ip to originip using rspconfig failed."; + echo "Run rspconfig $2 ip=$originip and return value is 1."; return 1; fi rm -rf /tmp/BMCIP @@ -153,9 +153,9 @@ function change_nonip echo "Start to change bmc's $4."; rspconfig $2 $4=$1; if [[ $? -eq 0 ]];then - echo "Set node's bmc $4 using rspconfig successfully."; + echo "Run rspconfig $2 $4=$1 and return value is 0."; else - echo "Set node's bmc $4 using rspconfig failed."; + echo "Run rspconfig $2 $4=$1 and return value is 1."; return 1; fi echo "Start to check node's bmc $4 really setted using rspconfig."; @@ -183,9 +183,9 @@ function change_all BMCVLAN=`rspconfig $1 vlan |awk -F":" '{print $3}'|sed s/[[:space:]]//g` rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN if [[ $? -eq 0 ]];then - echo "Node's BMC IP/netmask/gateway/vlan setted successfully using rspconfig."; + echo "Run rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN and return value is 0."; else - echo "Node's BMC IP/netmask/gateway/vlan setted failed using rspconfig."; + echo "Run rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY vlan=$BMCVLAN and return value is 1."; return 1; fi echo "Start to check node's BMC IP/netmask/gateway/vlan really setted using rspconfig."; @@ -210,9 +210,9 @@ function change_all echo "------------------Bmc vlan disabled so could not change vlan id using rspconfig.--------------------" rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY if [[ $? -eq 0 ]];then - echo "Node's BMC IP/netmask/gateway setted successfully using rspconfig."; + echo "Run rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY and return value is 0."; else - echo "Node's BMC IP/netmask/gateway setted failed using rspconfig."; + echo "Run rspconfig $1 ip=$BMCIP netmask=$BMCNETMASK gateway=$BMCGGATEWAY and return value is 1."; return 1; fi echo "Start to check node's BMC IP/netmask/gateway really setted using rspconfig."; From 91ed1e1ab8a93fddd19128ff1138c4300c116bd9 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 13 Sep 2017 07:55:41 -0400 Subject: [PATCH 11/11] modify rspconfig testcase for get more debug info --- xCAT-test/autotest/testcase/rspconfig/rspconfig.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh index 8b8cda8ad..b24c11cec 100755 --- a/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh +++ b/xCAT-test/autotest/testcase/rspconfig/rspconfig.sh @@ -252,6 +252,7 @@ do BMCIP=`rspconfig $2 ip |awk -F":" '{print $3}'` BMCNETMASK=`rspconfig $2 netmask |awk -F":" '{print $3}'` else + echo "Run rspconfig $2 ip and return value is 1. " exit 1; fi change_ip $BMCIP $2 $BMCNETMASK $3 @@ -288,6 +289,7 @@ do if [[ $? -eq 0 ]];then BMCGATEWAYE=`rspconfig $2 gateway |awk -F":" '{print $3}'` else + echo "Run rspconfig $2 gateway and return value is 1." exit 1; fi change_nonip $BMCGATEWAYE $2 $3 gateway @@ -320,6 +322,7 @@ do if [[ $? -eq 0 ]];then BMCNETMASK=`rspconfig $2 netmask |awk -F":" '{print $3}'` else + echo "Run rspconfig $2 netmask and return value is 1." exit 1; fi change_nonip $BMCNETMASK $2 $3 netmask