From a892d52457a1cd8517655379d41453edd05c7d70 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 2 Nov 2016 22:45:28 -0400 Subject: [PATCH 1/3] updated all existed cases, passed on rhels and ubuntu both --- xCAT-test/autotest/testcase/xcatconfig/case0 | 44 ++++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcatconfig/case0 b/xCAT-test/autotest/testcase/xcatconfig/case0 index ef0776219..44013c2d4 100644 --- a/xCAT-test/autotest/testcase/xcatconfig/case0 +++ b/xCAT-test/autotest/testcase/xcatconfig/case0 @@ -1,11 +1,14 @@ start:xcatconfig_null description:xcatconfig with no argument +os:Linux cmd:xcatconfig -check:output=~Usage +check:output=~No parameters were supplied on the xcatconfig command. Run xcatconfig -h +check:rc!=0 end start:xcatconfig_f description:To force regeneration of keys and credentials and reinitialize the site table +os:Linux cmd:xcatconfig -f check:rc==0 end @@ -13,6 +16,7 @@ end start:xcatconfig_k description:To regenerate root's ssh keys +os:Linux cmd:cp -rf /root/.ssh /root/.sshbak cmd:xcatconfig -k check:rc==0 @@ -25,22 +29,42 @@ cmd:cp -rf /root/.sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys cmd:mv -f /root/.sshbak /root/.ssh end +start:xcatconfig_k_c +description:To regenerate root's ssh keys +os:Linux +cmd:cp -rf /root/.ssh /root/.sshbak +cmd:xcatconfig -k -c +check:rc==0 +check:output=~(Generated /root/.ssh/id_rsa.pub) +check:output=~Created xCAT certificate +check:output=~Signature ok +check:output!=Fail +cmd:diff /root/.ssh/id_rsa.pub /root/.sshbak/id_rsa.pub +check:rc!=0 +cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +cmd:cp -rf /root/.sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys +cmd:mv -f /root/.sshbak /root/.ssh +end -start:xcatconfig_d +start:xcatconfig_d_V description:This option will reinitialize the basic xCAT database table setup -cmd:dumpxCATdb -p /tmp +os:Linux +cmd:dumpxCATdb -p /tmp/xcatconfig check:rc==0 -cmd:xcatconfig -d +cmd:xcatconfig -d -V check:rc==0 -check:output=~(Updated cluster site definition) -cmd:restorexCATdb -p /tmp +check:output=~Updated cluster site definition +check:output=~Created postscripts definition +cmd:restorexCATdb -p /tmp/xcatconfig check:rc==0 -cmd:rm -rf /tmp/*.csv +cmd:rm -rf /tmp/xcatconfig/*.csv end start:xcatconfig_s description:To regenerate node host ssh keys +os:Linux cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak check:rc==0 cmd:xcatconfig -s @@ -53,6 +77,7 @@ end start:xcatconfig_s_c description:To regenerate node host ssh keys and credentials +os:Linux cmd:cp -rf /root/.xcat /root/.xcatbak check:rc==0 cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak @@ -61,7 +86,6 @@ cmd:xcatconfig -s -c check:rc==0 check:output=~Created xCAT certificate check:output=~Signature ok -check:output=~OK check:output!~Fail cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub check:rc!=0 @@ -71,6 +95,7 @@ end start:xcatconfig_h description:xcatconfig -h and --help +os:Linux cmd:xcatconfig -h check:output=~Usage cmd:xcatconfig --help @@ -80,6 +105,7 @@ end start:xcatconfig_v description:xcatconfig -v and --version +os:Linux cmd:xcatconfig -v check:output=~version|Version cmd:xcatconfig --version @@ -87,6 +113,7 @@ check:output=~version|Version end start:xcatconfig_u_check_xcatsslversion_rhels_sles +os:rhels,sles description:after xcatconfig -u the site.xcatsslversion will not be changed cmd:lsdef -t site -i xcatsslversion -c | grep '=TLSv1$' check:rc==0 @@ -105,6 +132,7 @@ end start:xcatconfig_u_check_xcatsslversion_ubuntu description:after xcatconfig -u the site.xcatsslversion will not be changed +os:ubuntu cmd:lsdef -t site -i xcatsslversion -c | grep '=TLSv1$' check:rc==0 cmd:chtab key=xcatsslversion site.value=TLSv1_2 From 8663283e3ed21cbadbaefe03eea2bd539f2dfe56 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Fri, 4 Nov 2016 04:55:07 -0400 Subject: [PATCH 2/3] complete all cases --- xCAT-test/autotest/testcase/xcatconfig/case0 | 334 ++++++++++++++----- 1 file changed, 245 insertions(+), 89 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcatconfig/case0 b/xCAT-test/autotest/testcase/xcatconfig/case0 index 44013c2d4..1b86b2c05 100644 --- a/xCAT-test/autotest/testcase/xcatconfig/case0 +++ b/xCAT-test/autotest/testcase/xcatconfig/case0 @@ -6,93 +6,6 @@ check:output=~No parameters were supplied on the xcatconfig command. Run xcatcon check:rc!=0 end -start:xcatconfig_f -description:To force regeneration of keys and credentials and reinitialize the site table -os:Linux -cmd:xcatconfig -f -check:rc==0 -end - - -start:xcatconfig_k -description:To regenerate root's ssh keys -os:Linux -cmd:cp -rf /root/.ssh /root/.sshbak -cmd:xcatconfig -k -check:rc==0 -check:output=~(Generated /root/.ssh/id_rsa.pub) -cmd:diff /root/.ssh/id_rsa.pub /root/.sshbak/id_rsa.pub -check:rc!=0 -cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys -check:rc==0 -cmd:cp -rf /root/.sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys -cmd:mv -f /root/.sshbak /root/.ssh -end - -start:xcatconfig_k_c -description:To regenerate root's ssh keys -os:Linux -cmd:cp -rf /root/.ssh /root/.sshbak -cmd:xcatconfig -k -c -check:rc==0 -check:output=~(Generated /root/.ssh/id_rsa.pub) -check:output=~Created xCAT certificate -check:output=~Signature ok -check:output!=Fail -cmd:diff /root/.ssh/id_rsa.pub /root/.sshbak/id_rsa.pub -check:rc!=0 -cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys -check:rc==0 -cmd:cp -rf /root/.sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys -cmd:mv -f /root/.sshbak /root/.ssh -end - -start:xcatconfig_d_V -description:This option will reinitialize the basic xCAT database table setup -os:Linux -cmd:dumpxCATdb -p /tmp/xcatconfig -check:rc==0 -cmd:xcatconfig -d -V -check:rc==0 -check:output=~Updated cluster site definition -check:output=~Created postscripts definition -cmd:restorexCATdb -p /tmp/xcatconfig -check:rc==0 -cmd:rm -rf /tmp/xcatconfig/*.csv -end - - -start:xcatconfig_s -description:To regenerate node host ssh keys -os:Linux -cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak -check:rc==0 -cmd:xcatconfig -s -check:rc==0 -check:output=~(Generating new node hostkeys) -cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub -check:rc!=0 -cmd:rm -rf /etc/xcat/hostkeysbak -end - -start:xcatconfig_s_c -description:To regenerate node host ssh keys and credentials -os:Linux -cmd:cp -rf /root/.xcat /root/.xcatbak -check:rc==0 -cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak -check:rc==0 -cmd:xcatconfig -s -c -check:rc==0 -check:output=~Created xCAT certificate -check:output=~Signature ok -check:output!~Fail -cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub -check:rc!=0 -cmd:rm -rf /etc/xcat/hostkeysbak -cmd:rm -rf /root/.xcatbak -end - start:xcatconfig_h description:xcatconfig -h and --help os:Linux @@ -102,16 +15,259 @@ cmd:xcatconfig --help check:output=~Usage end - start:xcatconfig_v description:xcatconfig -v and --version os:Linux -cmd:xcatconfig -v +cmd:xcatconfig -v check:output=~version|Version cmd:xcatconfig --version check:output=~version|Version end +start:xcatconfig_k +description:To regenerate root's ssh keys +os:Linux +#step1:backup /root/.ssh +cmd:cp -rf /root/.ssh /root/sshbak +check:rc==0 +#step2: run command +cmd:xcatconfig -k +check:rc==0 +check:output=~Generated /root/.ssh/id_rsa.pub +#step3: To make sure /root/.ssh/id_rsa.pub is regenerated +cmd:diff /root/.ssh/id_rsa.pub /root/sshbak/id_rsa.pub +check:rc!=0 +#make sure the /install/postscripts/_ssh/authorized_keys is rewrite +cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +#step4. restore test environment +cmd:cp -rf /root/sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +cmd:mv -f /root/sshbak/* /root/.ssh;rm -rf /root/sshbak +check:rc==0 +end + + +start:xcatconfig_k_c +description:To regenerate root's ssh keys and cretials +os:Linux +#step1:backup /root/.ssh +cmd:cp -rf /root/.ssh /root/sshbak +check:rc==0 +#step2:run command and check the output +cmd:xcatconfig -k -c +check:rc==0 +check:output=~Generated /root/.ssh/id_rsa.pub +check:output=~Created xCAT certificate +check:output=~Signature ok +check:output!=(Fail|fail|Error|error) +#step3:To make sure /root/.ssh/id_rsa.pub is regenerated +cmd:diff /root/.ssh/id_rsa.pub /root/sshbak/id_rsa.pub +check:rc!=0 +#make sure the /install/postscripts/_ssh/authorized_keys is rewrite +cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +#step4:restore test environment +cmd:cp -rf /root/sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +cmd:mv -f /root/sshbak/* /root/.ssh;rm -rf /root/sshbak +check:rc==0 +end + + + +start:xcatconfig_s +description:To regenerate node host ssh keys +os:Linux +#step1:backup: /etc/xcat/hostkeys /install/postscripts/hostkeys +cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak +check:rc==0 +cmd:cp -rf /install/postscripts/hostkeys /install/postscripts/hostkeysbak +check:rc==0 +#step2:run command and check messages +cmd:xcatconfig -s +check:rc==0 +check:output=~Generating new node hostkeys +check:output=~Generating SSH2 RSA Key +#step3:Make sure /etc/xcat/hostkeys/ssh_host_rsa_key.pub is regenerated +cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub +check:rc!=0 +#step4:Make sure /install/postscripts/hostkeys/ssh_host_rsa_key.pub is regenerated +cmd:diff /install/postscripts/hostkeys/ssh_host_rsa_key.pub /install/postscripts/hostkeysbak/ssh_host_rsa_key.pub +check:rc!=0 +#step5:restore test environment +cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys;rm -rf /etc/xcat/hostkeysbak +check:rc==0 +cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys;rm -rf /install/postscripts/hostkeysbak +check:rc==0 +end + +start:xcatconfig_s_c +description:To regenerate node host ssh keys and credentials +os:Linux +#step1:backup: /etc/xcat/hostkeys /install/postscripts/hostkeys +cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak +check:rc==0 +cmd:cp -rf /install/postscripts/hostkeys /install/postscripts/hostkeysbak +check:rc==0 +#step2:run command and check messages +cmd:xcatconfig -s -c +check:rc==0 +check:output=~Created xCAT certificate +check:output=~Generating new node hostkeys +check:output=~Generating SSH2 RSA Key +check:output=~Signature ok +check:output!=(Fail|fail|Error|error) +#step3:Make sure /etc/xcat/hostkeys/ssh_host_rsa_key.pub is regenerated +cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub +check:rc!=0 +#step4:Make sure /install/postscripts/hostkeys/ssh_host_rsa_key.pub is regenerated +cmd:diff /install/postscripts/hostkeys/ssh_host_rsa_key.pub /install/postscripts/hostkeysbak/ssh_host_rsa_key.pub +check:rc!=0 +#step5:restore test environment +cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys;rm -rf /etc/xcat/hostkeysbak +check:rc==0 +cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys;rm -rf /install/postscripts/hostkeysbak +check:rc==0 +end + + +step1:dumpxCATdb -p /tmp/xcatconfigtest +step2:change existed site.maxssh value:chtab key=maxssh site.value=888 +step3:add a new key with value: chtab key=testxcatconfigoptiond site.value=test +step4:xcatconfig -d -V +check:rc==0 +check:output=~Updated cluster site definition +step5:check the existed key value is inited to be default value: lsdef -t site -i maxssh | grep "=8$" +step6:check the added key and value is still the same:lsdef -t site -i testxcatconfigoptiond | grep "=test$" +step7:restorexCATdb -p /tmp/xcatconfigtest +step8:rm -rf /tmp/xcatconfigtest + +start:xcatconfig_d_V +description:This -d option will reinitialize the basic xCAT database table setup +os:Linux +#step1:backup database and prepare test data +cmd:dumpxCATdb -p /tmp/xcatconfigtest +check:rc==0 +#change existed key's value +cmd:chtab key=maxssh site.value=888 +check:rc==0 +#add new key and value +cmd:chtab key=testxcatconfigoptiond site.value=test +check:rc==0 +#step2:run command and check messages +cmd:xcatconfig -d -V +check:rc==0 +check:output=~Updated cluster site definition +#step3:Make sure existed key's value is reinited +cmd:lsdef -t site -i maxssh | grep "=8$" +check:rc==0 +#make sure the added key and value are existed and not changed +cmd:lsdef -t site -i testxcatconfigoptiond | grep "=test$" +check:rc==0 +#step4:restore test environment +cmd:restorexCATdb -p /tmp/xcatconfigtest +check:rc==0 +cmd:rm -rf /tmp/xcatconfigtest +end + + + +start:xcatconfig_i +os:Linux +description:Initial the xCAT installation in Management Node, only node host key regenerated, xcatd restart; xCAT credentials, database and the ssh key are not changed +#step1:backup test environment and prepare test data +#backup test environment, including database, /root/.ssh/, /etc/xcat/hostkey/, install/postscripts/hostkeys +cmd:dumpxCATdb -p /tmp/xcatconfigtest +check:rc==0 +cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak +check:rc==0 +cmd:cp -rf /install/postscripts/hostkeys /install/postscripts/hostkeysbak +check:rc==0 +cmd:cp -rf /root/.ssh /root/sshbak +check:rc==0 +#prepare data:change existed site.maxssh, and add new key with value +cmd:chtab key=maxssh site.value=888 +check:rc==0 +cmd:chtab key=testxcatconfigoptiond site.value=test +check:rc==0 +#step2: run command and check output +cmd:xcatconfig -i +check:rc==0 +check:output!=Created xCAT certificate +check:output!=(Fail|fail|Error|error) +#step3: check the test result +#xCATd is running +cmd:service xcatd status +check:rc==0 +check:output=~(active \(running\)|service is running) +#node ssh key are regenerated +cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub +check:rc!=0 +#/root/.ssh are still the same, not changed +cmd:diff /root/.ssh/id_rsa.pub /root/sshbak/id_rsa.pub +check:rc==0 +cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +#keys in site table are not changed +cmd:lsdef -t site -i testxcatconfigoptiond | grep "=test$" +check:rc==0 +cmd:lsdef -t site -i maxssh | grep "=888$" +check:rc==0 +#step4.restore test environment +cmd:rm -rf /etc/xcat/hostkeysbak +check:rc==0 +cmd:restorexCATdb -p /tmp/xcatconfigtest;rm -rf /tmp/xcatconfigtest +check:rc==0 +end + + +start:xcatconfig_u +os:Linux +description:Update xCAT in Management Node, xcatd restart; database, xCAT credentials, node ssh key and root ssh key are not changed +#step1:backup test environment and prepare test data +#backup test environment, including database, /root/.ssh/, /etc/xcat/hostkey/, install/postscripts/hostkeys +cmd:dumpxCATdb -p /tmp/xcatconfigtest +check:rc==0 +cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak +check:rc==0 +cmd:cp -rf /install/postscripts/hostkeys /install/postscripts/hostkeysbak +check:rc==0 +cmd:cp -rf /root/.ssh /root/sshbak +check:rc==0 +#prepare data:change existed site.maxssh, and add new key with value +cmd:chtab key=maxssh site.value=888 +check:rc==0 +cmd:chtab key=testxcatconfigoptiond site.value=test +check:rc==0 +#step2: run command and check output +cmd:xcatconfig -u +check:rc==0 +check:output!=Created xCAT certificate +check:output!=(Fail|fail|Error|error) +#step3: check the test result +#xCATd is running +cmd:service xcatd status +check:rc==0 +check:output=~(active \(running\)|service is running) +#node ssh key not changed +cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub +check:rc==0 +#/root/.ssh are still the same, not changed +cmd:diff /root/.ssh/id_rsa.pub /root/sshbak/id_rsa.pub +check:rc==0 +cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +#keys in site table are not changed +cmd:lsdef -t site -i testxcatconfigoptiond | grep "=test$" +check:rc==0 +cmd:lsdef -t site -i maxssh | grep "=888$" +check:rc==0 +#step4.restore test environment +cmd:restorexCATdb -p /tmp/xcatconfigtest;rm -rf /tmp/xcatconfigtest +check:rc==0 +end + start:xcatconfig_u_check_xcatsslversion_rhels_sles os:rhels,sles description:after xcatconfig -u the site.xcatsslversion will not be changed From 6570ff566f0e929c9953dc5ad4881ed15b61e9c2 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Fri, 11 Nov 2016 03:56:15 -0500 Subject: [PATCH 3/3] updated all --- xCAT-test/autotest/testcase/xcatconfig/case0 | 59 +++++--- .../xcatconfig/change_site_table_values | 131 ++++++++++++++++++ .../verify_site_table_values_is_changed | 130 +++++++++++++++++ 3 files changed, 298 insertions(+), 22 deletions(-) create mode 100755 xCAT-test/autotest/testcase/xcatconfig/change_site_table_values create mode 100755 xCAT-test/autotest/testcase/xcatconfig/verify_site_table_values_is_changed diff --git a/xCAT-test/autotest/testcase/xcatconfig/case0 b/xCAT-test/autotest/testcase/xcatconfig/case0 index 1b86b2c05..59bfcf65f 100644 --- a/xCAT-test/autotest/testcase/xcatconfig/case0 +++ b/xCAT-test/autotest/testcase/xcatconfig/case0 @@ -1,3 +1,8 @@ +start:testtest +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcatconfig/change_site_table_values +check:rc==0 +end + start:xcatconfig_null description:xcatconfig with no argument os:Linux @@ -10,8 +15,10 @@ start:xcatconfig_h description:xcatconfig -h and --help os:Linux cmd:xcatconfig -h +check:rc==0 check:output=~Usage cmd:xcatconfig --help +check:rc==0 check:output=~Usage end @@ -19,8 +26,10 @@ start:xcatconfig_v description:xcatconfig -v and --version os:Linux cmd:xcatconfig -v +check:rc==0 check:output=~version|Version cmd:xcatconfig --version +check:rc==0 check:output=~version|Version end @@ -43,7 +52,9 @@ check:rc==0 #step4. restore test environment cmd:cp -rf /root/sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys check:rc==0 -cmd:mv -f /root/sshbak/* /root/.ssh;rm -rf /root/sshbak +cmd:mv -f /root/sshbak/* /root/.ssh +check:rc==0 +cmd:rm -rf /root/sshbak check:rc==0 end @@ -70,7 +81,9 @@ check:rc==0 #step4:restore test environment cmd:cp -rf /root/sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys check:rc==0 -cmd:mv -f /root/sshbak/* /root/.ssh;rm -rf /root/sshbak +cmd:mv -f /root/sshbak/* /root/.ssh +check:rc==0 +cmd:rm -rf /root/sshbak check:rc==0 end @@ -96,9 +109,13 @@ check:rc!=0 cmd:diff /install/postscripts/hostkeys/ssh_host_rsa_key.pub /install/postscripts/hostkeysbak/ssh_host_rsa_key.pub check:rc!=0 #step5:restore test environment -cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys;rm -rf /etc/xcat/hostkeysbak +cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys check:rc==0 -cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys;rm -rf /install/postscripts/hostkeysbak +cmd:rm -rf /etc/xcat/hostkeysbak +check:rc==0 +cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys +check:rc==0 +cmd:rm -rf /install/postscripts/hostkeysbak check:rc==0 end @@ -125,24 +142,16 @@ check:rc!=0 cmd:diff /install/postscripts/hostkeys/ssh_host_rsa_key.pub /install/postscripts/hostkeysbak/ssh_host_rsa_key.pub check:rc!=0 #step5:restore test environment -cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys;rm -rf /etc/xcat/hostkeysbak +cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys check:rc==0 -cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys;rm -rf /install/postscripts/hostkeysbak +cmd:rm -rf /etc/xcat/hostkeysbak +check:rc==0 +cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys +check:rc==0 +cmd:rm -rf /install/postscripts/hostkeysbak check:rc==0 end - -step1:dumpxCATdb -p /tmp/xcatconfigtest -step2:change existed site.maxssh value:chtab key=maxssh site.value=888 -step3:add a new key with value: chtab key=testxcatconfigoptiond site.value=test -step4:xcatconfig -d -V -check:rc==0 -check:output=~Updated cluster site definition -step5:check the existed key value is inited to be default value: lsdef -t site -i maxssh | grep "=8$" -step6:check the added key and value is still the same:lsdef -t site -i testxcatconfigoptiond | grep "=test$" -step7:restorexCATdb -p /tmp/xcatconfigtest -step8:rm -rf /tmp/xcatconfigtest - start:xcatconfig_d_V description:This -d option will reinitialize the basic xCAT database table setup os:Linux @@ -187,7 +196,8 @@ check:rc==0 cmd:cp -rf /root/.ssh /root/sshbak check:rc==0 #prepare data:change existed site.maxssh, and add new key with value -cmd:chtab key=maxssh site.value=888 +#cmd:chtab key=maxssh site.value=888 +cmd:./install/xcat-core/xCAT-test/autotest/testcase/xcatconfig/change_site_table_values check:rc==0 cmd:chtab key=testxcatconfigoptiond site.value=test check:rc==0 @@ -210,14 +220,17 @@ check:rc==0 cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys check:rc==0 #keys in site table are not changed -cmd:lsdef -t site -i testxcatconfigoptiond | grep "=test$" +#cmd:lsdef -t site -i testxcatconfigoptiond | grep "=test$" +cmd:cmd:./install/xcat-core/xCAT-test/autotest/testcase/xcatconfig/verify_site_table_values_is_changed check:rc==0 cmd:lsdef -t site -i maxssh | grep "=888$" check:rc==0 #step4.restore test environment cmd:rm -rf /etc/xcat/hostkeysbak check:rc==0 -cmd:restorexCATdb -p /tmp/xcatconfigtest;rm -rf /tmp/xcatconfigtest +cmd:restorexCATdb -p /tmp/xcatconfigtest +check:rc==0 +cmd:rm -rf /tmp/xcatconfigtest check:rc==0 end @@ -264,7 +277,9 @@ check:rc==0 cmd:lsdef -t site -i maxssh | grep "=888$" check:rc==0 #step4.restore test environment -cmd:restorexCATdb -p /tmp/xcatconfigtest;rm -rf /tmp/xcatconfigtest +cmd:restorexCATdb -p /tmp/xcatconfigtest +check:rc==0 +cmd:rm -rf /tmp/xcatconfigtest check:rc==0 end diff --git a/xCAT-test/autotest/testcase/xcatconfig/change_site_table_values b/xCAT-test/autotest/testcase/xcatconfig/change_site_table_values new file mode 100755 index 000000000..7f91cf8a8 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcatconfig/change_site_table_values @@ -0,0 +1,131 @@ +#!/usr/bin/env perl + +$ENV{TERM} = "xterm-256color"; + +my $os = $ARGV[0]; +my $arch = $ARGV[1]; +my $log = "/tmp/change_site_table_values.log"; + +sub runcmd { + my $cmd = shift; + `$cmd >> $log 2>&1`; + if ($?) { + + exit 1; + } +} + +my $blademaxp_value=6400; +my $domain_value="testdomain"; +my $fsptimeout_value=100; +my $installdir_value="installdirtest"; +my $ipmimaxp_value=6400; +my $ipmiretries_value=300; +my $ipmitimeout_value=200; +my $consoleondemand_value="notest"; +my $master_value="mastertest"; +my $forwarders_value="forwarderstest"; +my $nameservers_value="mastertest"; +my $maxssh_value=800; +my $ppcmaxp_value=6400; +my $ppcretry_value=300; +my $ppctimeout_value=100; +my $powerinterval_value=100; +my $syspowerinterval_value=100; +my $sharedtftp_value=100; +my $SNsyncfiledir_value="syncdirtest"; +my $nodesyncfiledir_value="nodesyncdirtest"; +my $tftpdir_value="tftpdirtest"; +my $xcatdport_value="xcatporttest"; +my $xcatiport_value="xcatiporttest"; +my $xcatconfdir_value="confdirtest"; +my $timezone_value="test"; +my $useNmapfromMN_value="notest"; +my $enableASMI_value="notest"; +my $db2installloc_value="\/mntdb2test"; +my $databaseloc_value="\/var\/libtest"; +my $sshbetweennodes_value="ALLGROUPStest"; +my $dnshandler_value="ddnstest"; +my $vsftp_value="ntest"; +my $cleanupxcatpost_value="notest"; +my $dhcplease_value=43200; +my $auditnosyslog_value=100; +my $xcatsslversion_value="tLSv1test"; +my $auditskipcmds_value="ALLtest"; + + +$cmd = "chtab key=domain site.value=$domain_value"; +runcmd("$cmd"); +$cmd = "chtab key=fsptimeout site.value=$fsptimeout_value"; +runcmd("$cmd"); +$cmd = "chtab key=installdir site.value=$installdir_value"; +runcmd("$cmd"); +$cmd = "chtab key=ipmimaxp site.value=$ipmimaxp_value"; +runcmd("$cmd"); +$cmd = "chtab key=ipmiretries site.value=$ipmiretries_value"; +runcmd("$cmd"); +$cmd = "chtab key=ipmitimeout site.value=$ipmitimeout_value"; +runcmd("$cmd"); +$cmd = "chtab key=consoleondemand site.value=$consoleondemand_value"; +runcmd("$cmd"); +$cmd = "chtab key=master site.value=$master_value"; +runcmd("$cmd"); +$cmd = "chtab key=forwarders site.value=$forwarders_value"; +runcmd("$cmd"); +$cmd = "chtab key=nameservers site.value=$nameservers_value"; +runcmd("$cmd"); +$cmd = "chtab key=maxssh site.value=$maxssh_value"; +runcmd("$cmd"); +$cmd = "chtab key=ppcmaxp site.value=$ppcmaxp_value"; +runcmd("$cmd"); +$cmd = "chtab key=ppcretry site.value=$ppcretry_value"; +runcmd("$cmd"); +$cmd = "chtab key=ppctimeout site.value=$ppctimeout_value"; +runcmd("$cmd"); +$cmd = "chtab key=powerinterval site.value=$powerinterval_value"; +runcmd("$cmd"); +$cmd = "chtab key=syspowerinterval site.value=$syspowerinterval_value"; +runcmd("$cmd"); +$cmd = "chtab key=sharedtftp site.value=$sharedtftp_value"; +runcmd("$cmd"); +$cmd = "chtab key=SNsyncfiledir site.value=$SNsyncfiledir_value"; +runcmd("$cmd"); +$cmd = "chtab key=nodesyncfiledir site.value=$nodesyncfiledir_value"; +runcmd("$cmd"); +$cmd = "chtab key=tftpdir site.value=$tftpdir_value"; +runcmd("$cmd"); +$cmd = "chtab key=xcatdport site.value=$xcatdport_value"; +runcmd("$cmd"); +$cmd = "chtab key=xcatiport site.value=$xcatiport_value"; +runcmd("$cmd"); +$cmd = "chtab key=xcatconfdir site.value=$xcatconfdir_value"; +runcmd("$cmd"); +$cmd = "chtab key=timezone site.value=$timezone_value"; +runcmd("$cmd"); +$cmd = "chtab key=useNmapfromMN site.value=$useNmapfromMN_value"; +runcmd("$cmd"); +$cmd = "chtab key=enableASMI site.value=$enableASMI_value"; +runcmd("$cmd"); +$cmd = "chtab key=db2installloc site.value=$db2installloc_value"; +runcmd("$cmd"); +$cmd = "chtab key=databaseloc site.value=$databaseloc_value"; +runcmd("$cmd"); +$cmd = "chtab key=sshbetweennodes site.value=$sshbetweennodes_value"; +runcmd("$cmd"); +$cmd = "chtab key=dnshandler site.value=$dnshandler_value"; +runcmd("$cmd"); +$cmd = "chtab key=vsftp site.value=$vsftp_value"; +runcmd("$cmd"); +$cmd = "chtab key=cleanupxcatpost site.value=$cleanupxcatpost_value"; +runcmd("$cmd"); +$cmd = "chtab key=dhcplease site.value=$dhcplease_value"; +runcmd("$cmd"); +$cmd = "chtab key=auditnosyslog site.value=$auditnosyslog_value"; +runcmd("$cmd"); +$cmd = "chtab key=xcatsslversion site.value=$xcatsslversion_value"; +runcmd("$cmd"); +$cmd = "chtab key=auditskipcmds site.value=$auditskipcmds_value"; +runcmd("$cmd"); + +exit 0; + diff --git a/xCAT-test/autotest/testcase/xcatconfig/verify_site_table_values_is_changed b/xCAT-test/autotest/testcase/xcatconfig/verify_site_table_values_is_changed new file mode 100755 index 000000000..bc8ff0810 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcatconfig/verify_site_table_values_is_changed @@ -0,0 +1,130 @@ +#!/usr/bin/env perl + +$ENV{TERM} = "xterm-256color"; + +my $os = $ARGV[0]; +my $arch = $ARGV[1]; +my $log = "/tmp/verify_site_table_values_is_changed"; + +sub runcmd { + my $cmd = shift; + `$cmd >> $log 2>&1`; + if ($?) { + print "run $cmd ....[error]\n"; + exit 1; + } +} + +my $blademaxp_value=6400; +my $domain_value="testdomain"; +my $fsptimeout_value=100; +my $installdir_value="installdirtest"; +my $ipmimaxp_value=6400; +my $ipmiretries_value=300; +my $ipmitimeout_value=200; +my $consoleondemand_value="notest"; +my $master_value="mastertest"; +my $forwarders_value="forwarderstest"; +my $nameservers_value="mastertest"; +my $maxssh_value=800; +my $ppcmaxp_value=6400; +my $ppcretry_value=300; +my $ppctimeout_value=100; +my $powerinterval_value=100; +my $syspowerinterval_value=100; +my $sharedtftp_value=100; +my $SNsyncfiledir_value="syncdirtest"; +my $nodesyncfiledir_value="nodesyncdirtest"; +my $tftpdir_value="tftpdirtest"; +my $xcatdport_value="xcatporttest"; +my $xcatiport_value="xcatiporttest"; +my $xcatconfdir_value="confdirtest"; +my $timezone_value="test"; +my $useNmapfromMN_value="notest"; +my $enableASMI_value="notest"; +my $db2installloc_value="\/mntdb2test"; +my $databaseloc_value="\/var\/libtest"; +my $sshbetweennodes_value="ALLGROUPStest"; +my $dnshandler_value="ddnstest"; +my $vsftp_value="ntest"; +my $cleanupxcatpost_value="notest"; +my $dhcplease_value=43200; +my $auditnosyslog_value=100; +my $xcatsslversion_value="tLSv1test"; +my $auditskipcmds_value="ALLtest"; + +$cmd = "lsdef -t site -i blademaxp | grep \"\=$blademaxp_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i domain | grep \"\=$domain_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i fsptimeout | grep \"\=$fsptimeout_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i installdir | grep \"\=$installdir_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i ipmimaxp | grep \"\=$ipmimaxp_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i ipmiretries | grep \"\=$ipmiretries_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i ipmitimeout | grep \"\=$ipmitimeout_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i consoleondemand | grep \"\=$consoleondemand_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i master | grep \"\=$master_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i forwarders | grep \"\=$forwarders_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i nameservers | grep \"\=$nameservers_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i maxssh | grep \"\=$maxssh_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i ppcmaxp | grep \"\=$ppcmaxp_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i ppcretry | grep \"\=$ppcretry_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i ppctimeout | grep \"\=$ppctimeout_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i powerinterval | grep \"\=$powerinterval_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i syspowerinterval | grep \"\=$syspowerinterval_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i sharedtftp | grep \"\=$sharedtftp_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i SNsyncfiledir | grep \"\=$SNsyncfiledir_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i nodesyncfiledir | grep \"\=$nodesyncfiledir_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i tftpdir | grep \"\=$tftpdir_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i xcatdport | grep \"\=$xcatdport_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i xcatiport | grep \"\=$xcatiport_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i xcatconfdir | grep \"\=$xcatconfdir_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i timezone | grep \"\=$timezone_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i useNmapfromMN | grep \"\=$useNmapfromMN_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i enableASMI | grep \"\=$enableASMI_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i db2installloc | grep \"\=$db2installloc_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i databaseloc | grep \"\=$databaseloc_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i sshbetweennodes | grep \"\=$sshbetweennodes_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i dnshandler | grep \"\=$dnshandler_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i vsftp | grep \"\=$vsftp_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i cleanupxcatpost | grep \"\=$cleanupxcatpost_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i dhcplease | grep \"\=$dhcplease_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i auditnosyslog | grep \"\=$auditnosyslog_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i auditskipcmds | grep \"\=$auditskipcmds_value\$\""; +runcmd("$cmd"); + + +exit 0;