Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Module for testing BMC via XCAT. |
| 3 | |
| 4 | Resource ../lib/xcat/resource.txt |
| 5 | Resource ../lib/xcat/xcat_utils.robot |
| 6 | |
| 7 | Library OperatingSystem |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 8 | Library String |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 9 | |
| 10 | Suite Setup Validate XCAT Setup |
| 11 | |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 12 | *** Variables *** |
| 13 | |
| 14 | ${poweron_flag} ON |
| 15 | ${poweroff_flag} OFF |
| 16 | |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 17 | *** Test Cases *** |
| 18 | |
| 19 | Add BMC Nodes To XCAT |
| 20 | [Documentation] Connect and add BMC nodes. |
| 21 | [Tags] Add_BMC_Nodes_To_XCAT |
| 22 | |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 23 | # Add BMC nodes one by one and check whether it is successfully added. |
| 24 | : FOR ${bmc} IN @{BMC_LIST} |
| 25 | \ Add Nodes To XCAT ${bmc} |
| 26 | \ Validate Added Node ${bmc} |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 27 | |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 28 | Power On Via XCAT And Validate |
| 29 | [Documentation] Power on via XCAT and validate. |
| 30 | [Tags] Power_On_Via_XCAT_And_Validate |
| 31 | |
| 32 | # Power on each BMC node and validate the power status. |
| 33 | : FOR ${bmc} IN @{BMC_LIST} |
| 34 | \ Power On Via XCAT ${bmc} |
| 35 | \ Validate Power Status Via XCAT ${bmc} ${poweron_flag} |
| 36 | |
| 37 | Power Off Via XCAT And Validate |
| 38 | [Documentation] Power off via XCAT and validate. |
| 39 | [Tags] Power_Off_Via_XCAT_And_Validate |
| 40 | |
| 41 | # Power off each BMC node and validate the power status. |
| 42 | : FOR ${bmc} IN @{BMC_LIST} |
| 43 | \ Power Off Via XCAT ${bmc} |
| 44 | \ Validate Power Status Via XCAT ${bmc} ${poweroff_flag} |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 45 | |
Prashanth Katti | b974a74 | 2017-05-25 06:52:29 -0500 | [diff] [blame] | 46 | Add Nodes To Group List |
| 47 | [Documentation] Add BMC nodes into group. |
| 48 | [Tags] Move_Added_Nodes_To_Group |
| 49 | |
| 50 | # Add BMC nodes to group and validate. |
| 51 | : FOR ${bmc} IN @{BMC_LIST} |
Prashanth Katti | 06c687d | 2017-06-01 04:15:59 -0500 | [diff] [blame] | 52 | \ Add Nodes To Group ${bmc} ${GROUP} |
| 53 | \ Validate Node Added In Group ${bmc} ${GROUP} |
| 54 | |
| 55 | Power On Group And Validate |
| 56 | [Documentation] Power on all BMCs in group and validate. |
| 57 | [Tags] Power_On_Group_And_Validate |
| 58 | |
| 59 | # Sample output of this keyword: |
| 60 | # XXX.XXX.XXX.XXX |
| 61 | # YYY.YYY.YYY.YYY |
| 62 | # ZZZ.ZZZ.ZZZ.ZZZ |
| 63 | |
| 64 | ${nodes}= Get List Of Nodes In Group ${GROUP} |
| 65 | Should Not Be Empty ${nodes} msg=Group is empty. |
| 66 | Power On Via XCAT ${GROUP} |
| 67 | |
| 68 | # List the BMC nodes. |
| 69 | |
| 70 | @{bmc_nodes}= Split String ${nodes} |
| 71 | |
| 72 | # Validate power status on each BMC node one by one. |
| 73 | : FOR ${bmc_node} IN @{bmc_nodes} |
| 74 | \ Validate Power Status Via XCAT ${bmc_node} ${poweron_flag} |
| 75 | |
| 76 | Power Off Group And Validate |
| 77 | [Documentation] Power off all BMCs in group and validate. |
| 78 | [Tags] Power_Off_Group_And_Validate |
| 79 | |
| 80 | # Sample output of this keyword: |
| 81 | # XXX.XXX.XXX.XXX |
| 82 | # YYY.YYY.YYY.YYY |
| 83 | # ZZZ.ZZZ.ZZZ.ZZZ |
| 84 | |
| 85 | ${nodes}= Get List Of Nodes In Group ${GROUP} |
| 86 | Should Not Be Empty ${nodes} msg=Group is empty. |
| 87 | Power Off Via XCAT ${GROUP} |
| 88 | |
| 89 | # List the BMC nodes. |
| 90 | @{bmc_nodes}= Split String ${nodes} |
| 91 | |
| 92 | # Validate power status on each BMC node one by one. |
| 93 | : FOR ${bmc_node} IN @{bmc_nodes} |
| 94 | \ Validate Power Status Via XCAT ${bmc_node} ${poweroff_flag} |
Prashanth Katti | b974a74 | 2017-05-25 06:52:29 -0500 | [diff] [blame] | 95 | |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 96 | *** Keywords *** |
| 97 | |
| 98 | Validate XCAT Setup |
| 99 | [Documentation] Validate XCAT setup. |
| 100 | |
| 101 | Open Connection And Login To XCAT |
| 102 | |
| 103 | # Check if XCAT is installed. |
| 104 | ${cmd_output}= Execute Command ${XCAT_DIR_PATH}/lsxcatd -v |
| 105 | Should Not Be Empty ${cmd_output} msg=XCAT not installed. |
| 106 | |
| 107 | Log \n XCAT Version is: \n${cmd_output} |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 108 | |
| 109 | # Get all the BMC nodes from the config file. |
| 110 | ${nodes}= Get List Of BMC Nodes |
| 111 | # Make a list of BMC nodes. |
| 112 | @{BMC_LIST}= Split To Lines ${nodes} |
| 113 | Log To Console BMC nodes to be added:\n ${BMC_LIST} |
| 114 | Set Suite Variable @{BMC_LIST} |
| 115 | |
Prashanth Katti | 06c687d | 2017-06-01 04:15:59 -0500 | [diff] [blame] | 116 | # GROUP should not be empty. |
| 117 | Should Not Be EMPTY ${GROUP} msg=Group does not exist. |
| 118 | |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 119 | Validate Power Status Via XCAT |
| 120 | [Documentation] Validate power status. |
| 121 | [Arguments] ${node} ${flag}=ON |
| 122 | |
| 123 | ${status}= Get Power Status ${node} |
| 124 | Run Keyword If '${flag}' == 'ON' |
| 125 | ... Should Contain ${status} on msg=Host is off. |
| 126 | ... ELSE Should Contain ${status} off msg=Host is on. |