Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Module for testing BMC via XCAT. |
| 3 | |
Sandhya Somashekar | 839a0c2 | 2019-01-31 05:05:43 -0600 | [diff] [blame] | 4 | Resource ../lib/xcat/resource.robot |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 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 |
Prashanth Katti | 56cbd17 | 2017-07-07 05:38:12 -0500 | [diff] [blame] | 11 | Suite Teardown Close All Connections |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 12 | |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 13 | *** Variables *** |
| 14 | |
| 15 | ${poweron_flag} ON |
| 16 | ${poweroff_flag} OFF |
Prashanth Katti | 56cbd17 | 2017-07-07 05:38:12 -0500 | [diff] [blame] | 17 | ${NUM_POWER_STATUS_CHECKS} 1000 |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 18 | |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 19 | *** Test Cases *** |
| 20 | |
| 21 | Add BMC Nodes To XCAT |
| 22 | [Documentation] Connect and add BMC nodes. |
| 23 | [Tags] Add_BMC_Nodes_To_XCAT |
| 24 | |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 25 | # Add BMC nodes one by one and check whether it is successfully added. |
Sushil Singh | ab209cd | 2020-07-01 09:01:14 -0500 | [diff] [blame] | 26 | FOR ${bmc} IN @{BMC_LIST} |
| 27 | Add Nodes To XCAT ${bmc} |
| 28 | Validate Added Node ${bmc} |
| 29 | END |
| 30 | |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 31 | |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 32 | Power On Via XCAT And Validate |
| 33 | [Documentation] Power on via XCAT and validate. |
| 34 | [Tags] Power_On_Via_XCAT_And_Validate |
| 35 | |
| 36 | # Power on each BMC node and validate the power status. |
Sushil Singh | ab209cd | 2020-07-01 09:01:14 -0500 | [diff] [blame] | 37 | FOR ${bmc} IN @{BMC_LIST} |
| 38 | Power On Via XCAT ${bmc} |
| 39 | Validate Power Status Via XCAT ${bmc} ${poweron_flag} |
| 40 | END |
| 41 | |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 42 | |
| 43 | Power Off Via XCAT And Validate |
| 44 | [Documentation] Power off via XCAT and validate. |
| 45 | [Tags] Power_Off_Via_XCAT_And_Validate |
| 46 | |
| 47 | # Power off each BMC node and validate the power status. |
Sushil Singh | ab209cd | 2020-07-01 09:01:14 -0500 | [diff] [blame] | 48 | FOR ${bmc} IN @{BMC_LIST} |
| 49 | Power Off Via XCAT ${bmc} |
| 50 | Validate Power Status Via XCAT ${bmc} ${poweroff_flag} |
| 51 | END |
| 52 | |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 53 | |
Prashanth Katti | b974a74 | 2017-05-25 06:52:29 -0500 | [diff] [blame] | 54 | Add Nodes To Group List |
| 55 | [Documentation] Add BMC nodes into group. |
| 56 | [Tags] Move_Added_Nodes_To_Group |
| 57 | |
| 58 | # Add BMC nodes to group and validate. |
Sushil Singh | ab209cd | 2020-07-01 09:01:14 -0500 | [diff] [blame] | 59 | FOR ${bmc} IN @{BMC_LIST} |
| 60 | Add Nodes To Group ${bmc} ${GROUP} |
| 61 | Validate Node Added In Group ${bmc} ${GROUP} |
| 62 | END |
| 63 | |
Prashanth Katti | 06c687d | 2017-06-01 04:15:59 -0500 | [diff] [blame] | 64 | |
| 65 | Power On Group And Validate |
| 66 | [Documentation] Power on all BMCs in group and validate. |
| 67 | [Tags] Power_On_Group_And_Validate |
| 68 | |
| 69 | # Sample output of this keyword: |
| 70 | # XXX.XXX.XXX.XXX |
| 71 | # YYY.YYY.YYY.YYY |
| 72 | # ZZZ.ZZZ.ZZZ.ZZZ |
| 73 | |
| 74 | ${nodes}= Get List Of Nodes In Group ${GROUP} |
| 75 | Should Not Be Empty ${nodes} msg=Group is empty. |
| 76 | Power On Via XCAT ${GROUP} |
| 77 | |
| 78 | # List the BMC nodes. |
| 79 | |
| 80 | @{bmc_nodes}= Split String ${nodes} |
| 81 | |
| 82 | # Validate power status on each BMC node one by one. |
Sushil Singh | ab209cd | 2020-07-01 09:01:14 -0500 | [diff] [blame] | 83 | FOR ${bmc_node} IN @{bmc_nodes} |
| 84 | Validate Power Status Via XCAT ${bmc_node} ${poweron_flag} |
| 85 | END |
| 86 | |
Prashanth Katti | 06c687d | 2017-06-01 04:15:59 -0500 | [diff] [blame] | 87 | |
| 88 | Power Off Group And Validate |
| 89 | [Documentation] Power off all BMCs in group and validate. |
| 90 | [Tags] Power_Off_Group_And_Validate |
| 91 | |
| 92 | # Sample output of this keyword: |
| 93 | # XXX.XXX.XXX.XXX |
| 94 | # YYY.YYY.YYY.YYY |
| 95 | # ZZZ.ZZZ.ZZZ.ZZZ |
| 96 | |
| 97 | ${nodes}= Get List Of Nodes In Group ${GROUP} |
| 98 | Should Not Be Empty ${nodes} msg=Group is empty. |
| 99 | Power Off Via XCAT ${GROUP} |
| 100 | |
| 101 | # List the BMC nodes. |
| 102 | @{bmc_nodes}= Split String ${nodes} |
| 103 | |
| 104 | # Validate power status on each BMC node one by one. |
Sushil Singh | ab209cd | 2020-07-01 09:01:14 -0500 | [diff] [blame] | 105 | FOR ${bmc_node} IN @{bmc_nodes} |
| 106 | Validate Power Status Via XCAT ${bmc_node} ${poweroff_flag} |
| 107 | END |
| 108 | |
Prashanth Katti | b974a74 | 2017-05-25 06:52:29 -0500 | [diff] [blame] | 109 | |
Prashanth Katti | 56cbd17 | 2017-07-07 05:38:12 -0500 | [diff] [blame] | 110 | Continuous Node Power Status |
| 111 | [Documentation] Continuously get the power status. |
| 112 | # This keyword verifies the REST connectivity between XCAT and the BMC node. |
| 113 | [Tags] Continuos_Node_Power_Status |
| 114 | |
| 115 | # Performing this operation only on one BMC node. |
| 116 | |
| 117 | Power On Via XCAT ${BMC_LIST[1]} |
| 118 | |
| 119 | # Get the power status of the node repeatedly. |
| 120 | # By default it gets power status 1000 times. |
George Keishing | 4d4ef99 | 2021-01-28 09:56:53 -0600 | [diff] [blame] | 121 | # It basically stress the BMC node and test REST implementation |
Prashanth Katti | 56cbd17 | 2017-07-07 05:38:12 -0500 | [diff] [blame] | 122 | # of the BMC node |
| 123 | |
Sushil Singh | ab209cd | 2020-07-01 09:01:14 -0500 | [diff] [blame] | 124 | FOR ${index} IN RANGE 1 ${NUM_POWER_STATUS_CHECKS} |
| 125 | Validate Power Status Via XCAT ${BMC_LIST[1]} ${poweron_flag} |
| 126 | END |
| 127 | |
Prashanth Katti | 56cbd17 | 2017-07-07 05:38:12 -0500 | [diff] [blame] | 128 | |
| 129 | Get Temperature Reading Via XCAT |
| 130 | [Documentation] Get temperature reading via XCAT. |
| 131 | [Tags] Get_Temperature_Reading_Via_XCAT |
| 132 | |
| 133 | # Sample output of the keyword: |
| 134 | # node1: Ambient: 28.62 C |
| 135 | # node1: P0 Vcs Temp: 35 C |
| 136 | # node1: P0 Vdd Temp: 35 C |
| 137 | # node1: P0 Vddr Temp: 35 C |
| 138 | # node1: P0 Vdn Temp: 35 C |
| 139 | # node1: P1 Vcs Temp: 33 C |
| 140 | # node1: P1 Vdd Temp: 33 C |
| 141 | # node1: P1 Vddr Temp: 34 C |
| 142 | # node1: P1 Vdn Temp: 34 C |
| 143 | |
| 144 | # Get temperature reading from each BMC node. |
| 145 | |
Sushil Singh | ab209cd | 2020-07-01 09:01:14 -0500 | [diff] [blame] | 146 | FOR ${bmc} IN @{BMC_LIST} |
| 147 | ${temp_reading}= Get Hardware Vitals Via XCAT ${bmc} temp |
| 148 | Should Match ${temp_reading} ${bmc}* C |
| 149 | Log \n Temperature reading on $[bmc}\n ${temp_reading} |
| 150 | END |
| 151 | |
Prashanth Katti | 56cbd17 | 2017-07-07 05:38:12 -0500 | [diff] [blame] | 152 | |
| 153 | Get Fanspeed Via XCAT |
| 154 | [Documentation] Get fanspeed via XCAT. |
| 155 | [Tags] Get_Fanspeed_Reading_Via_XCAT |
| 156 | |
| 157 | # Sample output of the keyword: |
| 158 | # node1: Fan0 0: 10714 RPMS |
| 159 | # node1: Fan1 0: 10216 RPMS |
| 160 | # node1: Fan2 0: 14124 RPMS |
| 161 | # node1: Fan3 0: 11114 RPMS |
| 162 | |
| 163 | # Get fanspeed from each BMC node. |
| 164 | |
Sushil Singh | ab209cd | 2020-07-01 09:01:14 -0500 | [diff] [blame] | 165 | FOR ${bmc} IN @{BMC_LIST} |
| 166 | ${fanspeed}= Get Hardware Vitals Via XCAT ${bmc} fanspeed |
| 167 | Should Match ${fanspeed} ${bmc}* RPMS |
| 168 | Log \n fanspeed on $[bmc}\n ${fanspeed} |
| 169 | END |
Prashanth Katti | 56cbd17 | 2017-07-07 05:38:12 -0500 | [diff] [blame] | 170 | |
Prashanth Katti | 56cbd17 | 2017-07-07 05:38:12 -0500 | [diff] [blame] | 171 | |
| 172 | Get Voltage Reading Via XCAT |
| 173 | [Documentation] Get voltage via XCAT. |
| 174 | [Tags] Get_Voltage_Via_XCAT |
| 175 | |
| 176 | # Sample output of the keyword: |
| 177 | # node1: No attributes returned from the BMC. |
| 178 | # BMC node is not returning anything, this will fail at present. |
| 179 | |
| 180 | # Get voltage reading from each BMC node. |
| 181 | |
Sushil Singh | ab209cd | 2020-07-01 09:01:14 -0500 | [diff] [blame] | 182 | FOR ${bmc} IN @{BMC_LIST} |
| 183 | ${voltage}= Get Hardware Vitals Via XCAT ${bmc} voltage |
| 184 | Log \n Voltage reading on $[bmc}\n ${voltage} |
| 185 | END |
| 186 | |
Prashanth Katti | 56cbd17 | 2017-07-07 05:38:12 -0500 | [diff] [blame] | 187 | |
| 188 | Get Wattage Via XCAT |
| 189 | [Documentation] Get wattage via XCAT. |
| 190 | [Tags] Get_Wattage_Via_XCAT |
| 191 | |
| 192 | # Sample output of the keyword: |
| 193 | # node1: No attributes returned from the BMC. |
| 194 | # BMC node is not returning anything, this will fail at present. |
| 195 | |
| 196 | # Get wattage reading from each BMC node. |
| 197 | |
Sushil Singh | ab209cd | 2020-07-01 09:01:14 -0500 | [diff] [blame] | 198 | FOR ${bmc} IN @{BMC_LIST} |
| 199 | ${wattage}= Get Hardware Vitals Via XCAT ${bmc} wattage |
| 200 | Log \n Wattage reading on $[bmc}\n ${wattage} |
| 201 | END |
Prashanth Katti | 56cbd17 | 2017-07-07 05:38:12 -0500 | [diff] [blame] | 202 | |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 203 | *** Keywords *** |
| 204 | |
| 205 | Validate XCAT Setup |
| 206 | [Documentation] Validate XCAT setup. |
| 207 | |
| 208 | Open Connection And Login To XCAT |
| 209 | |
| 210 | # Check if XCAT is installed. |
| 211 | ${cmd_output}= Execute Command ${XCAT_DIR_PATH}/lsxcatd -v |
| 212 | Should Not Be Empty ${cmd_output} msg=XCAT not installed. |
| 213 | |
| 214 | Log \n XCAT Version is: \n${cmd_output} |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 215 | |
| 216 | # Get all the BMC nodes from the config file. |
| 217 | ${nodes}= Get List Of BMC Nodes |
| 218 | # Make a list of BMC nodes. |
| 219 | @{BMC_LIST}= Split To Lines ${nodes} |
| 220 | Log To Console BMC nodes to be added:\n ${BMC_LIST} |
| 221 | Set Suite Variable @{BMC_LIST} |
| 222 | |
Prashanth Katti | 06c687d | 2017-06-01 04:15:59 -0500 | [diff] [blame] | 223 | # GROUP should not be empty. |
| 224 | Should Not Be EMPTY ${GROUP} msg=Group does not exist. |
| 225 | |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 226 | Validate Power Status Via XCAT |
| 227 | [Documentation] Validate power status. |
| 228 | [Arguments] ${node} ${flag}=ON |
| 229 | |
| 230 | ${status}= Get Power Status ${node} |
| 231 | Run Keyword If '${flag}' == 'ON' |
| 232 | ... Should Contain ${status} on msg=Host is off. |
| 233 | ... ELSE Should Contain ${status} off msg=Host is on. |