1*** Settings *** 2 3Documentation Module to test IPMI asset tag functionality. 4Resource ../lib/ipmi_client.robot 5Resource ../lib/openbmc_ffdc.robot 6Resource ../lib/bmc_network_utils.robot 7Variables ../data/ipmi_raw_cmd_table.py 8Variables ../data/ipmi_variable.py 9Library ../lib/bmc_network_utils.py 10Library ../lib/ipmi_utils.py 11 12Suite Setup IPMI General Test Suite Setup 13Test Teardown FFDC On Test Case Fail 14 15*** Test Cases *** 16 17Test Get Self Test Results via IPMI Raw Command 18 [Documentation] Get self test results via IPMI raw command and verify the output. 19 [Tags] Test_Get_Self_Test_Results_via_IPMI_Raw_Command 20 21 ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['Self_Test_Results']['Get'][0]} 22 23 # 55h = No error. All Self Tests Passed. 24 # 56h = Self Test function not implemented in this controller. 25 Should Contain Any ${resp} 55 00 56 00 26 27 28Test Get Device GUID Via IPMI Raw Command 29 [Documentation] Get device GUID via IPMI raw command and verify it using Redfish. 30 [Tags] Test_Get_Device_GUID_Via_IPMI_Raw_Command 31 [Teardown] Run Keywords Redfish.Logout AND FFDC On Test Case Fail 32 # Get GUIDS via IPMI. 33 # This should match the /redfish/v1/Managers/${MANAGER_ID}'s UUID data. 34 ${guids}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['Device GUID']['Get'][0]} 35 # Reverse the order and remove space delims. 36 ${guids}= Split String ${guids} 37 Reverse List ${guids} 38 ${guids}= Evaluate "".join(${guids}) 39 40 Redfish.Login 41 ${uuid}= Redfish.Get Attribute /redfish/v1/Managers/${MANAGER_ID} UUID 42 ${uuid}= Remove String ${uuid} - 43 44 Rprint Vars guids uuid 45 Valid Value uuid ['${guids}'] 46 47 48Verify Get Channel Info via IPMI 49 [Documentation] Verify get channel info via IPMI. 50 [Tags] Verify_Get_Channel_Info_via_IPMI 51 52 # Get channel info via ipmi command "ipmitool channel info [channel number]". 53 # Verify channel info with files "channel_access_volatile.json", "channel_access_nv.json" 54 # and "channel_config.json" in BMC. 55 56 # Example output from 'Get Channel Info': 57 # channel_info: 58 # [channel_0x2_info]: 59 # [channel_medium_type]: 802.3 LAN 60 # [channel_protocol_type]: IPMB-1.0 61 # [session_support]: multi-session 62 # [active_session_count]: 0 63 # [protocol_vendor_id]: 7154 64 # [volatile(active)_settings]: 65 # [alerting]: enabled 66 # [per-message_auth]: enabled 67 # [user_level_auth]: enabled 68 # [access_mode]: always available 69 # [Non-Volatile Settings]: 70 # [alerting]: enabled 71 # [per-message_auth]: enabled 72 # [user_level_auth]: enabled 73 # [access_mode]: always available 74 75 ${channel_info_ipmi}= Get Channel Info ${CHANNEL_NUMBER} 76 ${active_channel_config}= Get Active Channel Config 77 ${channel_volatile_data_config}= Get Channel Access Config /run/ipmi/channel_access_volatile.json 78 ${channel_nv_data_config}= Get Channel Access Config /var/lib/ipmi/channel_access_nv.json 79 80 Rprint Vars channel_info_ipmi 81 Rprint Vars active_channel_config 82 Rprint Vars channel_volatile_data_config 83 Rprint Vars channel_nv_data_config 84 85 Valid Value medium_type_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['channel_medium_type']}'] 86 ... ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['medium_type']}'] 87 88 Valid Value protocol_type_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['channel_protocol_type']}'] 89 ... ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['protocol_type']}'] 90 91 Valid Value channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['session_support'] 92 ... ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['session_supported']}'] 93 94 Valid Value channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['active_session_count'] 95 ... ['${active_channel_config['${CHANNEL_NUMBER}']['active_sessions']}'] 96 # IPMI Spec: The IPMI Enterprise Number is: 7154 (decimal) 97 Valid Value channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['protocol_vendor_id'] ['7154'] 98 99 # Verify volatile(active)_settings 100 Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['alerting']}'] 101 ... ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['alerting_disabled']}'] 102 103 Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['per-message_auth']}'] 104 ... ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['per_msg_auth_disabled']}'] 105 106 Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['user_level_auth']}'] 107 ... ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['user_auth_disabled']}'] 108 109 Valid Value access_mode_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['access_mode']}'] 110 ... ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['access_mode']}'] 111 112 # Verify Non-Volatile Settings 113 Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['alerting']}'] 114 ... ['${channel_nv_data_config['${CHANNEL_NUMBER}']['alerting_disabled']}'] 115 116 Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['per-message_auth']}'] 117 ... ['${channel_nv_data_config['${CHANNEL_NUMBER}']['per_msg_auth_disabled']}'] 118 119 Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['user_level_auth']}'] 120 ... ['${channel_nv_data_config['${CHANNEL_NUMBER}']['user_auth_disabled']}'] 121 122 Valid Value access_mode_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['access_mode']}'] 123 ... ['${channel_nv_data_config['${CHANNEL_NUMBER}']['access_mode']}'] 124 125 126Test Get Channel Authentication Capabilities via IPMI 127 [Documentation] Verify channel authentication capabilities via IPMI. 128 [Tags] Test_Get_Channel_Authentication_Capabilities_via_IPMI 129 [Template] Verify Channel Auth Capabilities 130 131 FOR ${channel} IN @{active_channel_list} 132 FOR ${privilege} IN 4 3 2 133 # Input Channel Privilege Level 134 ${channel} ${privilege} 135 END 136 END 137 138 139Test Get Channel Authentication Capabilities IPMI Command For Invalid Channel 140 [Documentation] Verify get channel authentication capabilities for invalid channel. 141 [Tags] Test_Get_Channel_Authentication_Capabilities_IPMI_Command_For_Invalid_Channel 142 [Template] Verify Channel Auth Capabilities For Invalid Channel 143 144 FOR ${channel} IN @{inactive_channel_list} 145 # Input Channel 146 ${channel} 147 END 148 149 150Verify Get Channel Authentication Capabilities IPMI Raw Command With Invalid Data Length 151 [Documentation] Verify get channel authentication capabilities IPMI raw command with invalid data length. 152 [Tags] Verify_Get_Channel_Authentication_Capabilities_IPMI_Raw_Command_With_Invalid_Data_Length 153 [Template] Verify Channel Auth Command For Invalid Data Length 154 155 # Bytes 156 low 157 high 158 159 160Verify Set Session Privilege Level via IPMI Raw Command 161 [Documentation] Set session privilege with given privilege level and verify the response with 162 ... expected level. 163 [Tags] Verify_Set_Session_Privilege_Level_via_IPMI_Raw_Command 164 [Template] Set Session Privilege Level And Verify 165 166 # privilege_level expected_level 167 0x00 04 168 0x02 02 169 0x03 03 170 0x04 04 171 172 173Verify Set Invalid Session Privilege Level Via IPMI Raw Command 174 [Documentation] Verify set invalid session privilege level via IPMI raw command. 175 [Tags] Verify_Set_Invalid_Session_Privilege_Level_Via_IPMI_Raw_Command 176 [Template] Set Invalid Session Privilege Level And Verify 177 178 # invalid_privilege_level 179 0x01 180 0x05 181 0x06 182 0x07 183 0x0F 184 185 186Verify Close Session Via IPMI 187 [Documentation] Verify close session via IPMI. 188 [Tags] Verify_Close_Session_Via_IPMI 189 190 # The "close session command" can be tested with any out-of-band IPMI command. 191 # When the session is about to close, it will execute the close session command at the end. 192 193 ${cmd}= Catenate mc info -vvv 2>&1 | grep "Closed Session" 194 ${cmd_output}= Run External IPMI Standard Command ${cmd} 195 196 Should Contain ${cmd_output} Closed Session 197 198 199Verify Chassis Identify via IPMI 200 [Documentation] Set chassis identify using IPMI and verify. 201 [Tags] Verify_Chassis_Identify_via_IPMI 202 [Setup] Redfish.Login 203 [Teardown] Redfish.logout 204 205 # Set to default "chassis identify" and verify that LED blinks for 15s. 206 Run IPMI Standard Command chassis identify 207 Verify Identify LED State Via Redfish Lit 208 209 Sleep 18s 210 Verify Identify LED State Via Redfish Off 211 212 # Set "chassis identify" to 10s and verify that the LED blinks for 10s. 213 Run IPMI Standard Command chassis identify 10 214 Verify Identify LED State Via Redfish Lit 215 216 Sleep 12s 217 Verify Identify LED State Via Redfish Off 218 219 220Verify Chassis Identify Off And Force Identify On via IPMI 221 [Documentation] Set chassis identify to "off" and "force" using IPMI and verify. 222 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI 223 [Setup] Redfish.Login 224 [Teardown] Redfish.logout 225 226 # Set the LED to "Force Identify On". 227 Run IPMI Standard Command chassis identify force 228 Verify Identify LED State Via Redfish Lit 229 230 # Set "chassis identify" to 0 and verify that the LED turns off. 231 Run IPMI Standard Command chassis identify 0 232 Verify Identify LED State Via Redfish Off 233 234 235*** Keywords *** 236 237IPMI General Test Suite Setup 238 [Documentation] Get active and inactive/invalid channels from channel_config.json file 239 ... in list type and set it as suite variable. 240 241 # Get active channel list and set as suite variable. 242 @{active_channel_list}= Get Active Ethernet Channel List 243 Set Suite Variable @{active_channel_list} 244 245 # Get Inactive/Invalid channel list and set as suite variable. 246 @{inactive_channel_list}= Get Invalid Channel Number List 247 Set Suite Variable @{inactive_channel_list} 248 249 250Set Session Privilege Level And Verify 251 [Documentation] Set session privilege with given privilege level and verify the response with 252 ... expected level. 253 [Arguments] ${privilege_level} ${expected_level} 254 # Description of argument(s): 255 # privilege_level Requested Privilege Level. 256 # expected_level New Privilege Level (or present level if ‘return present privilege level’ 257 # was selected). 258 259 ${resp}= Run External IPMI Raw Command 260 ... 0x06 0x3b ${privilege_level} 261 Should Contain ${resp} ${expected_level} 262 263 264Set Invalid Session Privilege Level And Verify 265 [Documentation] Set invalid session privilege level and verify the response. 266 [Arguments] ${privilege_level} 267 # Description of argument(s): 268 # privilege_level Requested Privilege Level. 269 270 # Verify requested level exceeds Channel and/or User Privilege Limit. 271 ${msg}= Run Keyword And Expect Error * Run External IPMI Raw Command 272 ... 0x06 0x3b ${privilege_level} 273 274 # 0x05 is OEM proprietary level. 275 IF ${privilege_level} == 0x05 276 Should Contain ${msg} Unknown rsp=0x81 277 ELSE 278 # According to IPMI spec privelege level except 0x00-0x05, others are reserved. So if we 279 # try to set those privelege we will get rsp as 0xcc(Invalid data filed in request) 280 Should Contain ${msg} Invalid data field in request rsp=0xcc 281 END 282 283 284Verify Identify LED State Via Redfish 285 [Documentation] Verify that Redfish identify LED system with given state. 286 [Arguments] ${expected_state} 287 # Description of argument(s): 288 # expected_led_status Expected value of Identify LED. 289 290 # Get the following URI(s) and iterate to find the attribute IndicatorLED. 291 # Example: 292 # /redfish/v1/Systems/system 293 # /redfish/v1/Systems/hypervisor 294 295 # Python module: get_member_list(resource_path) 296 ${systems}= Redfish_Utils.Get Member List /redfish/v1/Systems 297 FOR ${system} IN @{systems} 298 ${led_value}= Redfish.Get Attribute ${system} IndicatorLED 299 # Get attribute return None if IndicatorLED does not exist in the URI. 300 Continue For Loop If '${led_value}' == 'None' 301 Should Be True '${led_value}' == '${expected_state}' 302 END 303 304 305Verify Channel Auth Capabilities 306 [Documentation] Verify authentication capabilities for given channel and privilege. 307 [Arguments] ${channel} ${privilege_level} 308 309 # Description of argument(s): 310 # channel Interface channel number. 311 # privilege_level User Privilege level (e.g. 4-Administator, 3-Operator, 2-Readonly). 312 313 # Python module: get_channel_auth_capabilities(channel_number, privilege_level) 314 ${channel_auth_cap}= Get Channel Auth Capabilities ${channel} ${privilege_level} 315 Rprint Vars channel_auth_cap 316 317 Valid Value channel_auth_cap['channel_number'] ['${channel}'] 318 Valid Value channel_auth_cap['kg_status'] ['default (all zeroes)'] 319 Valid Value channel_auth_cap['per_message_authentication'] ['enabled'] 320 Valid Value channel_auth_cap['user_level_authentication'] ['enabled'] 321 Valid Value channel_auth_cap['non-null_user_names_exist'] ['yes'] 322 Valid Value channel_auth_cap['null_user_names_exist'] ['no'] 323 Valid Value channel_auth_cap['anonymous_login_enabled'] ['no'] 324 Valid Value channel_auth_cap['channel_supports_ipmi_v1.5'] ['no'] 325 Valid Value channel_auth_cap['channel_supports_ipmi_v2.0'] ['yes'] 326 327 328Verify Channel Auth Capabilities For Invalid Channel 329 [Documentation] Verify authentication capabilities of invalid channels. 330 [Arguments] ${channel} 331 332 # Description of argument(s): 333 # channel Interface channel number. 334 335 ${channel_in_hex}= Convert To Hex ${channel} prefix=0x 336 ${cmd}= Catenate ${IPMI_RAW_CMD['Get Channel Auth Cap']['get'][0]} ${channel_in_hex} 0x04 337 338 Verify Invalid IPMI Command ${cmd} 0xcc 339 340 341Verify Channel Auth Command For Invalid Data Length 342 [Documentation] Verify channel authentication command for invalid data length. 343 [Arguments] ${byte_length} 344 345 # Description of argument(s): 346 # byte_length high or low. 347 # e.g. high - add extra byte to request data like "0x06 0x38 0x01 0x04 0x01". 348 # low - reduce bytes in actual request data like "0x06 0x38". 349 350 ${req_cmd}= Run Keyword If '${byte_length}' == 'low' 351 ... Catenate ${IPMI_RAW_CMD['Get Channel Auth Cap']['get'][0]} ${CHANNEL_NUMBER} 352 ... ELSE 353 ... Catenate ${IPMI_RAW_CMD['Get Channel Auth Cap']['get'][0]} ${CHANNEL_NUMBER} 0x04 0x01 354 355 Verify Invalid IPMI Command ${req_cmd} 0xc7 356