1*** Settings *** 2Documentation Module for testing BMC via XCAT. 3 4Resource ../lib/xcat/resource.txt 5Resource ../lib/xcat/xcat_utils.robot 6 7Library OperatingSystem 8Library String 9 10Suite Setup Validate XCAT Setup 11Suite Teardown Close All Connections 12 13*** Variables *** 14 15${poweron_flag} ON 16${poweroff_flag} OFF 17${NUM_POWER_STATUS_CHECKS} 1000 18 19*** Test Cases *** 20 21Add BMC Nodes To XCAT 22 [Documentation] Connect and add BMC nodes. 23 [Tags] Add_BMC_Nodes_To_XCAT 24 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} 29 30Power 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 39Power 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} 47 48Add 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} 54 \ Add Nodes To Group ${bmc} ${GROUP} 55 \ Validate Node Added In Group ${bmc} ${GROUP} 56 57Power 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 78Power 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} 97 98Continuous 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 115Get 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 137Get 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 155Get Voltage Reading Via XCAT 156 [Documentation] Get voltage via XCAT. 157 [Tags] Get_Voltage_Via_XCAT 158 159 # Sample output of the keyword: 160 # node1: No attributes returned from the BMC. 161 # BMC node is not returning anything, this will fail at present. 162 163 # Get voltage reading from each BMC node. 164 165 : FOR ${bmc} IN @{BMC_LIST} 166 \ ${voltage}= Get Hardware Vitals Via XCAT ${bmc} voltage 167 \ Log \n Voltage reading on $[bmc}\n ${voltage} 168 169Get Wattage Via XCAT 170 [Documentation] Get wattage via XCAT. 171 [Tags] Get_Wattage_Via_XCAT 172 173 # Sample output of the keyword: 174 # node1: No attributes returned from the BMC. 175 # BMC node is not returning anything, this will fail at present. 176 177 # Get wattage reading from each BMC node. 178 179 : FOR ${bmc} IN @{BMC_LIST} 180 \ ${wattage}= Get Hardware Vitals Via XCAT ${bmc} wattage 181 \ Log \n Wattage reading on $[bmc}\n ${wattage} 182 183 184*** Keywords *** 185 186Validate XCAT Setup 187 [Documentation] Validate XCAT setup. 188 189 Open Connection And Login To XCAT 190 191 # Check if XCAT is installed. 192 ${cmd_output}= Execute Command ${XCAT_DIR_PATH}/lsxcatd -v 193 Should Not Be Empty ${cmd_output} msg=XCAT not installed. 194 195 Log \n XCAT Version is: \n${cmd_output} 196 197 # Get all the BMC nodes from the config file. 198 ${nodes}= Get List Of BMC Nodes 199 # Make a list of BMC nodes. 200 @{BMC_LIST}= Split To Lines ${nodes} 201 Log To Console BMC nodes to be added:\n ${BMC_LIST} 202 Set Suite Variable @{BMC_LIST} 203 204 # GROUP should not be empty. 205 Should Not Be EMPTY ${GROUP} msg=Group does not exist. 206 207Validate Power Status Via XCAT 208 [Documentation] Validate power status. 209 [Arguments] ${node} ${flag}=ON 210 211 ${status}= Get Power Status ${node} 212 Run Keyword If '${flag}' == 'ON' 213 ... Should Contain ${status} on msg=Host is off. 214 ... ELSE Should Contain ${status} off msg=Host is on. 215