Rahul Maheshwari | 71525ad | 2019-08-01 05:54:06 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Module to test IPMI asset tag functionality. |
| 4 | Resource ../lib/ipmi_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
Tony Lee | 3fdd31e | 2020-02-15 11:21:40 +0800 | [diff] [blame] | 6 | Variables ../data/ipmi_raw_cmd_table.py |
Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 7 | Variables ../data/ipmi_variable.py |
| 8 | Library ../lib/bmc_network_utils.py |
| 9 | Library ../lib/ipmi_utils.py |
Rahul Maheshwari | 71525ad | 2019-08-01 05:54:06 -0500 | [diff] [blame] | 10 | |
| 11 | Test Teardown FFDC On Test Case Fail |
| 12 | |
| 13 | *** Test Cases *** |
| 14 | |
| 15 | Verify Get DCMI Capabilities |
| 16 | [Documentation] Verify get DCMI capabilities command output. |
| 17 | [Tags] Verify_Get_DCMI_Capabilities |
| 18 | ${cmd_output}= Run IPMI Standard Command dcmi discover |
| 19 | |
| 20 | @{supported_capabilities}= Create List |
| 21 | # Supported DCMI capabilities: |
| 22 | ... Mandatory platform capabilties |
| 23 | ... Optional platform capabilties |
| 24 | ... Power management available |
| 25 | ... Managebility access capabilties |
| 26 | ... In-band KCS channel available |
| 27 | # Mandatory platform attributes: |
| 28 | ... 200 SEL entries |
| 29 | ... SEL automatic rollover is enabled |
| 30 | # Optional Platform Attributes: |
| 31 | ... Slave address of device: 0h (8bits)(Satellite/External controller) |
| 32 | ... Channel number is 0h (Primary BMC) |
| 33 | ... Device revision is 0 |
| 34 | # Manageability Access Attributes: |
| 35 | ... Primary LAN channel number: 1 is available |
| 36 | ... Secondary LAN channel is not available for OOB |
| 37 | ... No serial channel is available |
| 38 | |
Rahul Maheshwari | 3a1d991 | 2020-02-25 03:13:14 -0600 | [diff] [blame] | 39 | FOR ${capability} IN @{supported_capabilities} |
| 40 | Should Contain ${cmd_output} ${capability} ignore_case=True |
| 41 | ... msg=Supported DCMI capabilities not present. |
| 42 | END |
Tony Lee | 3fdd31e | 2020-02-15 11:21:40 +0800 | [diff] [blame] | 43 | |
| 44 | |
| 45 | Test Get Self Test Results via IPMI Raw Command |
| 46 | [Documentation] Get self test results via IPMI raw command and verify the output. |
George Keishing | b98036a | 2022-01-31 12:39:47 -0600 | [diff] [blame] | 47 | [Tags] Test_Get_Self_Test_Results_via_IPMI_Raw_Command |
Tony Lee | 3fdd31e | 2020-02-15 11:21:40 +0800 | [diff] [blame] | 48 | |
| 49 | ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['Self_Test_Results']['Get'][0]} |
| 50 | |
| 51 | # 55h = No error. All Self Tests Passed. |
| 52 | # 56h = Self Test function not implemented in this controller. |
| 53 | Should Contain Any ${resp} 55 00 56 00 |
| 54 | |
| 55 | |
| 56 | Test Get Device GUID Via IPMI Raw Command |
| 57 | [Documentation] Get device GUID via IPMI raw command and verify it using Redfish. |
George Keishing | b98036a | 2022-01-31 12:39:47 -0600 | [diff] [blame] | 58 | [Tags] Test_Get_Device_GUID_Via_IPMI_Raw_Command |
Tony Lee | 3fdd31e | 2020-02-15 11:21:40 +0800 | [diff] [blame] | 59 | [Teardown] Run Keywords Redfish.Logout AND FFDC On Test Case Fail |
| 60 | # Get GUIDS via IPMI. |
| 61 | # This should match the /redfish/v1/Managers/bmc's UUID data. |
| 62 | ${guids}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['Device GUID']['Get'][0]} |
| 63 | # Reverse the order and remove space delims. |
| 64 | ${guids}= Split String ${guids} |
| 65 | Reverse List ${guids} |
| 66 | ${guids}= Evaluate "".join(${guids}) |
| 67 | |
| 68 | Redfish.Login |
| 69 | ${uuid}= Redfish.Get Attribute /redfish/v1/Managers/bmc UUID |
| 70 | ${uuid}= Remove String ${uuid} - |
| 71 | |
| 72 | Rprint Vars guids uuid |
| 73 | Valid Value uuid ['${guids}'] |
Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 74 | |
| 75 | |
| 76 | Verify Get Channel Info via IPMI |
| 77 | [Documentation] Verify get channel info via IPMI. |
| 78 | [Tags] Verify_Get_Channel_Info_via_IPMI |
| 79 | |
| 80 | # Get channel info via ipmi command "ipmitool channel info [channel number]". |
Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 81 | # Verify channel info with files "channel_access_volatile.json", "channel_access_nv.json" |
| 82 | # and "channel_config.json" in BMC. |
Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 83 | |
| 84 | # Example output from 'Get Channel Info': |
| 85 | # channel_info: |
| 86 | # [channel_0x2_info]: |
| 87 | # [channel_medium_type]: 802.3 LAN |
| 88 | # [channel_protocol_type]: IPMB-1.0 |
| 89 | # [session_support]: multi-session |
| 90 | # [active_session_count]: 0 |
| 91 | # [protocol_vendor_id]: 7154 |
Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 92 | # [volatile(active)_settings]: |
| 93 | # [alerting]: enabled |
| 94 | # [per-message_auth]: enabled |
| 95 | # [user_level_auth]: enabled |
| 96 | # [access_mode]: always available |
| 97 | # [Non-Volatile Settings]: |
| 98 | # [alerting]: enabled |
| 99 | # [per-message_auth]: enabled |
| 100 | # [user_level_auth]: enabled |
| 101 | # [access_mode]: always available |
Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 102 | |
| 103 | ${channel_info_ipmi}= Get Channel Info ${CHANNEL_NUMBER} |
| 104 | ${active_channel_config}= Get Active Channel Config |
Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 105 | ${channel_volatile_data_config}= Get Channel Access Config /run/ipmi/channel_access_volatile.json |
| 106 | ${channel_nv_data_config}= Get Channel Access Config /var/lib/ipmi/channel_access_nv.json |
| 107 | |
George Keishing | 33be359 | 2022-03-08 08:52:25 -0600 | [diff] [blame] | 108 | Rprint Vars channel_info_ipmi |
| 109 | Rprint Vars active_channel_config |
| 110 | Rprint Vars channel_volatile_data_config |
| 111 | Rprint Vars channel_nv_data_config |
Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 112 | |
| 113 | Valid Value medium_type_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['channel_medium_type']}'] |
| 114 | ... ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['medium_type']}'] |
| 115 | |
| 116 | Valid Value protocol_type_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['channel_protocol_type']}'] |
| 117 | ... ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['protocol_type']}'] |
| 118 | |
| 119 | Valid Value channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['session_support'] |
| 120 | ... ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['session_supported']}'] |
| 121 | |
| 122 | Valid Value channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['active_session_count'] |
| 123 | ... ['${active_channel_config['${CHANNEL_NUMBER}']['active_sessions']}'] |
| 124 | # IPMI Spec: The IPMI Enterprise Number is: 7154 (decimal) |
| 125 | Valid Value channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['protocol_vendor_id'] ['7154'] |
| 126 | |
Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 127 | # Verify volatile(active)_settings |
| 128 | Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['alerting']}'] |
| 129 | ... ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['alerting_disabled']}'] |
Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 130 | |
Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 131 | Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['per-message_auth']}'] |
| 132 | ... ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['per_msg_auth_disabled']}'] |
Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 133 | |
Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 134 | Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['user_level_auth']}'] |
| 135 | ... ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['user_auth_disabled']}'] |
Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 136 | |
Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 137 | Valid Value access_mode_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['access_mode']}'] |
| 138 | ... ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['access_mode']}'] |
| 139 | |
| 140 | # Verify Non-Volatile Settings |
| 141 | Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['alerting']}'] |
| 142 | ... ['${channel_nv_data_config['${CHANNEL_NUMBER}']['alerting_disabled']}'] |
| 143 | |
| 144 | Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['per-message_auth']}'] |
| 145 | ... ['${channel_nv_data_config['${CHANNEL_NUMBER}']['per_msg_auth_disabled']}'] |
| 146 | |
| 147 | Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['user_level_auth']}'] |
| 148 | ... ['${channel_nv_data_config['${CHANNEL_NUMBER}']['user_auth_disabled']}'] |
| 149 | |
| 150 | Valid Value access_mode_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['access_mode']}'] |
| 151 | ... ['${channel_nv_data_config['${CHANNEL_NUMBER}']['access_mode']}'] |
Tony Lee | 0754c5f | 2020-03-13 19:38:24 +0800 | [diff] [blame] | 152 | |
| 153 | |
| 154 | Test Get Channel Authentication Capabilities via IPMI |
| 155 | [Documentation] Test get channel authentication capabilities via IPMI. |
| 156 | [Tags] Test_Get_Channel_Authentication_Capabilities_via_IPMI |
| 157 | |
| 158 | ${channel_auth_cap}= Get Channel Auth Capabilities ${CHANNEL_NUMBER} |
| 159 | Rprint Vars channel_auth_cap |
| 160 | |
| 161 | Valid Value channel_auth_cap['channel_number'] ['${CHANNEL_NUMBER}'] |
| 162 | Valid Value channel_auth_cap['kg_status'] ['default (all zeroes)'] |
| 163 | Valid Value channel_auth_cap['per_message_authentication'] ['enabled'] |
| 164 | Valid Value channel_auth_cap['user_level_authentication'] ['enabled'] |
| 165 | Valid Value channel_auth_cap['non-null_user_names_exist'] ['yes'] |
| 166 | Valid Value channel_auth_cap['null_user_names_exist'] ['no'] |
| 167 | Valid Value channel_auth_cap['anonymous_login_enabled'] ['no'] |
| 168 | Valid Value channel_auth_cap['channel_supports_ipmi_v1.5'] ['no'] |
| 169 | Valid Value channel_auth_cap['channel_supports_ipmi_v2.0'] ['yes'] |
Tony Lee | 2d07182 | 2020-02-19 16:37:58 +0800 | [diff] [blame] | 170 | |
| 171 | |
| 172 | Verify Set Session Privilege Level via IPMI Raw Command |
| 173 | [Documentation] Set session privilege with given privilege level and verify the response with |
| 174 | ... expected level. |
| 175 | [Tags] Verify_Set_Session_Privilege_Level_via_IPMI_Raw_Command |
| 176 | [Template] Set Session Privilege Level And Verify |
| 177 | |
| 178 | # privilege_level expected_level |
| 179 | 0x00 04 |
| 180 | 0x02 02 |
| 181 | 0x03 03 |
| 182 | 0x04 04 |
| 183 | |
| 184 | |
George Keishing | b98036a | 2022-01-31 12:39:47 -0600 | [diff] [blame] | 185 | Verify Set Invalid Session Privilege Level Via IPMI Raw Command |
Tony Lee | 94f1a6c | 2020-03-25 10:37:46 +0800 | [diff] [blame] | 186 | [Documentation] Verify set invalid session privilege level via IPMI raw command. |
| 187 | [Tags] Verify_Set_Invalid_Session_Privilege_Level_Via_IPMI_Raw_Command |
| 188 | [Template] Set Invalid Session Privilege Level And Verify |
| 189 | |
| 190 | # invalid_privilege_level |
| 191 | 0x05 |
| 192 | 0x06 |
| 193 | 0x07 |
| 194 | 0x0F |
| 195 | |
| 196 | |
George Keishing | b98036a | 2022-01-31 12:39:47 -0600 | [diff] [blame] | 197 | Verify Close Session Via IPMI |
Tony Lee | d12b40d | 2020-03-19 10:45:21 +0800 | [diff] [blame] | 198 | [Documentation] Verify close session via IPMI. |
| 199 | [Tags] Verify_Close_Session_Via_IPMI |
| 200 | |
| 201 | # The "close session command" can be tested with any out-of-band IPMI command. |
| 202 | # When the session is about to close, it will execute the close session command at the end. |
| 203 | |
| 204 | ${cmd}= Catenate mc info -vvv 2>&1 | grep "Closed Session" |
| 205 | ${cmd_output}= Run External IPMI Standard Command ${cmd} |
| 206 | |
| 207 | Should Contain ${cmd_output} Closed Session |
| 208 | |
| 209 | |
Ashwini Chandrappa | 4ec7085 | 2021-09-07 09:10:36 -0500 | [diff] [blame] | 210 | Verify Chassis Identify via IPMI |
| 211 | [Documentation] Set chassis identify using IPMI and verify. |
| 212 | [Tags] Verify_Chassis_Identify_via_IPMI |
| 213 | [Setup] Redfish.Login |
| 214 | [Teardown] Redfish.logout |
| 215 | |
| 216 | # Set to default "chassis identify" and verify that LED blinks for 15s. |
| 217 | Run IPMI Standard Command chassis identify |
| 218 | Verify Identify LED State Via Redfish Lit |
| 219 | |
| 220 | Sleep 18s |
| 221 | Verify Identify LED State Via Redfish Off |
| 222 | |
| 223 | # Set "chassis identify" to 10s and verify that the LED blinks for 10s. |
| 224 | Run IPMI Standard Command chassis identify 10 |
| 225 | Verify Identify LED State Via Redfish Lit |
| 226 | |
| 227 | Sleep 12s |
| 228 | Verify Identify LED State Via Redfish Off |
| 229 | |
| 230 | |
| 231 | Verify Chassis Identify Off And Force Identify On via IPMI |
| 232 | [Documentation] Set chassis identify to "off" and "force" using IPMI and verify. |
| 233 | [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI |
| 234 | [Setup] Redfish.Login |
| 235 | [Teardown] Redfish.logout |
| 236 | |
| 237 | # Set the LED to "Force Identify On". |
| 238 | Run IPMI Standard Command chassis identify force |
| 239 | Verify Identify LED State Via Redfish Lit |
| 240 | |
| 241 | # Set "chassis identify" to 0 and verify that the LED turns off. |
| 242 | Run IPMI Standard Command chassis identify 0 |
| 243 | Verify Identify LED State Via Redfish Off |
| 244 | |
| 245 | |
Tony Lee | 2d07182 | 2020-02-19 16:37:58 +0800 | [diff] [blame] | 246 | *** Keywords *** |
| 247 | |
| 248 | Set Session Privilege Level And Verify |
| 249 | [Documentation] Set session privilege with given privilege level and verify the response with |
| 250 | ... expected level. |
| 251 | [Arguments] ${privilege_level} ${expected_level} |
| 252 | # Description of argument(s): |
| 253 | # privilege_level Requested Privilege Level. |
George Keishing | 33be359 | 2022-03-08 08:52:25 -0600 | [diff] [blame] | 254 | # expected_level New Privilege Level (or present level if ‘return present privilege level’ |
| 255 | # was selected). |
Tony Lee | 2d07182 | 2020-02-19 16:37:58 +0800 | [diff] [blame] | 256 | |
Tony Lee | b49853c | 2020-06-03 15:27:56 +0800 | [diff] [blame] | 257 | ${resp}= Run External IPMI Raw Command |
Tony Lee | 94f1a6c | 2020-03-25 10:37:46 +0800 | [diff] [blame] | 258 | ... 0x06 0x3b ${privilege_level} |
Tony Lee | 2d07182 | 2020-02-19 16:37:58 +0800 | [diff] [blame] | 259 | Should Contain ${resp} ${expected_level} |
Tony Lee | 94f1a6c | 2020-03-25 10:37:46 +0800 | [diff] [blame] | 260 | |
| 261 | |
| 262 | Set Invalid Session Privilege Level And Verify |
| 263 | [Documentation] Set invalid session privilege level and verify the response. |
| 264 | [Arguments] ${privilege_level} |
| 265 | # Description of argument(s): |
| 266 | # privilege_level Requested Privilege Level. |
| 267 | |
| 268 | # Verify requested level exceeds Channel and/or User Privilege Limit. |
Tony Lee | b49853c | 2020-06-03 15:27:56 +0800 | [diff] [blame] | 269 | ${msg}= Run Keyword And Expect Error * Run External IPMI Raw Command |
Tony Lee | 94f1a6c | 2020-03-25 10:37:46 +0800 | [diff] [blame] | 270 | ... 0x06 0x3b ${privilege_level} |
| 271 | Should Contain ${msg} Unknown rsp=0x81 |
Ashwini Chandrappa | 4ec7085 | 2021-09-07 09:10:36 -0500 | [diff] [blame] | 272 | |
| 273 | |
| 274 | Verify Identify LED State Via Redfish |
| 275 | [Documentation] Verify that Redfish identify LED system with given state. |
| 276 | [Arguments] ${expected_state} |
| 277 | # Description of argument(s): |
| 278 | # expected_led_status Expected value of Identify LED. |
| 279 | |
George Keishing | 52eb7c2 | 2022-03-11 10:58:53 -0600 | [diff] [blame] | 280 | # Python module: get_member_list(resource_path) |
| 281 | ${systems}= Redfish_Utils.Get Member List /redfish/v1/Systems |
| 282 | FOR ${system} IN @{systems} |
| 283 | ${led_value}= Redfish.Get Attribute ${system} IndicatorLED |
| 284 | Should Be True '${led_value}' == '${expected_state}' |
| 285 | END |