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