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