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