| 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 | 
| nagarjunb22 | 9845074 | 2022-04-19 12:00:02 +0530 | [diff] [blame] | 6 | Resource         ../lib/bmc_network_utils.robot | 
| Nandish-Matti | 18179e7 | 2023-10-26 10:29:55 -0500 | [diff] [blame] | 7 | Resource         ../lib/energy_scale_utils.robot | 
| Tony Lee | 3fdd31e | 2020-02-15 11:21:40 +0800 | [diff] [blame] | 8 | Variables        ../data/ipmi_raw_cmd_table.py | 
| Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 9 | Variables        ../data/ipmi_variable.py | 
 | 10 | Library          ../lib/bmc_network_utils.py | 
 | 11 | Library          ../lib/ipmi_utils.py | 
| Rahul Maheshwari | 71525ad | 2019-08-01 05:54:06 -0500 | [diff] [blame] | 12 |  | 
| nagarjunb22 | 9845074 | 2022-04-19 12:00:02 +0530 | [diff] [blame] | 13 | Suite Setup      IPMI General Test Suite Setup | 
| Rahul Maheshwari | 71525ad | 2019-08-01 05:54:06 -0500 | [diff] [blame] | 14 | Test Teardown    FFDC On Test Case Fail | 
 | 15 |  | 
| Matt Fischer | 6fb70d9 | 2023-10-24 19:06:33 -0600 | [diff] [blame] | 16 | Test Tags       IPMI_General | 
| George Keishing | 87dc442 | 2023-10-20 12:56:30 +0530 | [diff] [blame] | 17 |  | 
| Rahul Maheshwari | 71525ad | 2019-08-01 05:54:06 -0500 | [diff] [blame] | 18 | *** Test Cases *** | 
 | 19 |  | 
| Tony Lee | 3fdd31e | 2020-02-15 11:21:40 +0800 | [diff] [blame] | 20 | Test Get Self Test Results via IPMI Raw Command | 
 | 21 |     [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] | 22 |     [Tags]  Test_Get_Self_Test_Results_via_IPMI_Raw_Command | 
| Tony Lee | 3fdd31e | 2020-02-15 11:21:40 +0800 | [diff] [blame] | 23 |  | 
| ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 24 |     ${resp}=  Run IPMI Command  ${IPMI_RAW_CMD['Self_Test_Results']['Get'][0]} | 
| Tony Lee | 3fdd31e | 2020-02-15 11:21:40 +0800 | [diff] [blame] | 25 |  | 
 | 26 |     # 55h = No error. All Self Tests Passed. | 
 | 27 |     # 56h = Self Test function not implemented in this controller. | 
 | 28 |     Should Contain Any  ${resp}  55 00  56 00 | 
 | 29 |  | 
 | 30 |  | 
 | 31 | Test Get Device GUID Via IPMI Raw Command | 
 | 32 |     [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] | 33 |     [Tags]  Test_Get_Device_GUID_Via_IPMI_Raw_Command | 
| Tony Lee | 3fdd31e | 2020-02-15 11:21:40 +0800 | [diff] [blame] | 34 |     [Teardown]  Run Keywords  Redfish.Logout  AND  FFDC On Test Case Fail | 
 | 35 |     # Get GUIDS via IPMI. | 
| ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 36 |     # This should match the /redfish/v1/Managers/${MANAGER_ID}'s UUID data. | 
| ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 37 |     ${guids}=  Run IPMI Command  ${IPMI_RAW_CMD['Device GUID']['Get'][0]} | 
| Tony Lee | 3fdd31e | 2020-02-15 11:21:40 +0800 | [diff] [blame] | 38 |     # Reverse the order and remove space delims. | 
 | 39 |     ${guids}=  Split String  ${guids} | 
 | 40 |     Reverse List  ${guids} | 
 | 41 |     ${guids}=  Evaluate  "".join(${guids}) | 
 | 42 |  | 
 | 43 |     Redfish.Login | 
| ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 44 |     ${uuid}=  Redfish.Get Attribute  /redfish/v1/Managers/${MANAGER_ID}  UUID | 
| Tony Lee | 3fdd31e | 2020-02-15 11:21:40 +0800 | [diff] [blame] | 45 |     ${uuid}=  Remove String  ${uuid}  - | 
 | 46 |  | 
 | 47 |     Rprint Vars  guids  uuid | 
 | 48 |     Valid Value  uuid  ['${guids}'] | 
| Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 49 |  | 
 | 50 |  | 
 | 51 | Verify Get Channel Info via IPMI | 
 | 52 |     [Documentation]  Verify get channel info via IPMI. | 
 | 53 |     [Tags]  Verify_Get_Channel_Info_via_IPMI | 
 | 54 |  | 
 | 55 |     # Get channel info via ipmi command "ipmitool channel info [channel number]". | 
| Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 56 |     # Verify channel info with files "channel_access_volatile.json", "channel_access_nv.json" | 
 | 57 |     # and "channel_config.json" in BMC. | 
| Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 58 |  | 
 | 59 |     # Example output from 'Get Channel Info': | 
 | 60 |     # channel_info: | 
 | 61 |     #   [channel_0x2_info]: | 
 | 62 |     #     [channel_medium_type]:                        802.3 LAN | 
 | 63 |     #     [channel_protocol_type]:                      IPMB-1.0 | 
 | 64 |     #     [session_support]:                            multi-session | 
 | 65 |     #     [active_session_count]:                       0 | 
 | 66 |     #     [protocol_vendor_id]:                         7154 | 
| Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 67 |     #   [volatile(active)_settings]: | 
 | 68 |     #       [alerting]:                                 enabled | 
 | 69 |     #       [per-message_auth]:                         enabled | 
 | 70 |     #       [user_level_auth]:                          enabled | 
 | 71 |     #       [access_mode]:                              always available | 
 | 72 |     #   [Non-Volatile Settings]: | 
 | 73 |     #       [alerting]:                                 enabled | 
 | 74 |     #       [per-message_auth]:                         enabled | 
 | 75 |     #       [user_level_auth]:                          enabled | 
 | 76 |     #       [access_mode]:                              always available | 
| Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 77 |  | 
 | 78 |     ${channel_info_ipmi}=  Get Channel Info  ${CHANNEL_NUMBER} | 
 | 79 |     ${active_channel_config}=  Get Active Channel Config | 
| Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 80 |     ${channel_volatile_data_config}=  Get Channel Access Config  /run/ipmi/channel_access_volatile.json | 
 | 81 |     ${channel_nv_data_config}=  Get Channel Access Config  /var/lib/ipmi/channel_access_nv.json | 
 | 82 |  | 
| George Keishing | 33be359 | 2022-03-08 08:52:25 -0600 | [diff] [blame] | 83 |     Rprint Vars  channel_info_ipmi | 
 | 84 |     Rprint Vars  active_channel_config | 
 | 85 |     Rprint Vars  channel_volatile_data_config | 
 | 86 |     Rprint Vars  channel_nv_data_config | 
| Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 87 |  | 
 | 88 |     Valid Value  medium_type_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['channel_medium_type']}'] | 
 | 89 |     ...  ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['medium_type']}'] | 
 | 90 |  | 
 | 91 |     Valid Value  protocol_type_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['channel_protocol_type']}'] | 
 | 92 |     ...  ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['protocol_type']}'] | 
 | 93 |  | 
 | 94 |     Valid Value  channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['session_support'] | 
 | 95 |     ...  ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['session_supported']}'] | 
 | 96 |  | 
 | 97 |     Valid Value  channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['active_session_count'] | 
 | 98 |     ...  ['${active_channel_config['${CHANNEL_NUMBER}']['active_sessions']}'] | 
 | 99 |     # IPMI Spec: The IPMI Enterprise Number is: 7154 (decimal) | 
 | 100 |     Valid Value  channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['protocol_vendor_id']  ['7154'] | 
 | 101 |  | 
| Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 102 |     # Verify volatile(active)_settings | 
 | 103 |     Valid Value  disabled_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['alerting']}'] | 
 | 104 |     ...  ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['alerting_disabled']}'] | 
| Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 105 |  | 
| Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 106 |     Valid Value  disabled_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['per-message_auth']}'] | 
 | 107 |     ...  ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['per_msg_auth_disabled']}'] | 
| Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 108 |  | 
| Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 109 |     Valid Value  disabled_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['user_level_auth']}'] | 
 | 110 |     ...  ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['user_auth_disabled']}'] | 
| Tony Lee | 18c6f9a | 2020-02-18 17:00:20 +0800 | [diff] [blame] | 111 |  | 
| Tony Lee | 87c9cb9 | 2020-03-04 14:47:09 +0800 | [diff] [blame] | 112 |     Valid Value  access_mode_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['access_mode']}'] | 
 | 113 |     ...  ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['access_mode']}'] | 
 | 114 |  | 
 | 115 |     # Verify Non-Volatile Settings | 
 | 116 |     Valid Value  disabled_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['alerting']}'] | 
 | 117 |     ...  ['${channel_nv_data_config['${CHANNEL_NUMBER}']['alerting_disabled']}'] | 
 | 118 |  | 
 | 119 |     Valid Value  disabled_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['per-message_auth']}'] | 
 | 120 |     ...  ['${channel_nv_data_config['${CHANNEL_NUMBER}']['per_msg_auth_disabled']}'] | 
 | 121 |  | 
 | 122 |     Valid Value  disabled_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['user_level_auth']}'] | 
 | 123 |     ...  ['${channel_nv_data_config['${CHANNEL_NUMBER}']['user_auth_disabled']}'] | 
 | 124 |  | 
 | 125 |     Valid Value  access_mode_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['access_mode']}'] | 
 | 126 |     ...  ['${channel_nv_data_config['${CHANNEL_NUMBER}']['access_mode']}'] | 
| Tony Lee | 0754c5f | 2020-03-13 19:38:24 +0800 | [diff] [blame] | 127 |  | 
 | 128 |  | 
 | 129 | Test Get Channel Authentication Capabilities via IPMI | 
| nagarjunb22 | 9845074 | 2022-04-19 12:00:02 +0530 | [diff] [blame] | 130 |     [Documentation]  Verify channel authentication capabilities via IPMI. | 
| Tony Lee | 0754c5f | 2020-03-13 19:38:24 +0800 | [diff] [blame] | 131 |     [Tags]  Test_Get_Channel_Authentication_Capabilities_via_IPMI | 
| nagarjunb22 | 9845074 | 2022-04-19 12:00:02 +0530 | [diff] [blame] | 132 |     [Template]  Verify Channel Auth Capabilities | 
| Tony Lee | 0754c5f | 2020-03-13 19:38:24 +0800 | [diff] [blame] | 133 |  | 
| nagarjunb22 | 9845074 | 2022-04-19 12:00:02 +0530 | [diff] [blame] | 134 |     FOR  ${channel}  IN   @{active_channel_list} | 
 | 135 |         FOR  ${privilege}  IN   4  3  2 | 
 | 136 |             # Input Channel     Privilege Level | 
 | 137 |             ${channel}          ${privilege} | 
 | 138 |         END | 
 | 139 |     END | 
| Tony Lee | 0754c5f | 2020-03-13 19:38:24 +0800 | [diff] [blame] | 140 |  | 
| nagarjunb22 | 9845074 | 2022-04-19 12:00:02 +0530 | [diff] [blame] | 141 |  | 
 | 142 | Test Get Channel Authentication Capabilities IPMI Command For Invalid Channel | 
 | 143 |     [Documentation]  Verify get channel authentication capabilities for invalid channel. | 
 | 144 |     [Tags]  Test_Get_Channel_Authentication_Capabilities_IPMI_Command_For_Invalid_Channel | 
| George Keishing | 13b7afd | 2022-05-23 07:36:16 -0500 | [diff] [blame] | 145 |     [Template]  Verify Channel Auth Capabilities For Invalid Channel | 
| nagarjunb22 | 9845074 | 2022-04-19 12:00:02 +0530 | [diff] [blame] | 146 |  | 
 | 147 |     FOR  ${channel}  IN  @{inactive_channel_list} | 
 | 148 |         # Input Channel | 
 | 149 |         ${channel} | 
 | 150 |     END | 
 | 151 |  | 
 | 152 |  | 
| George Keishing | 13b7afd | 2022-05-23 07:36:16 -0500 | [diff] [blame] | 153 | Verify Get Channel Authentication Capabilities IPMI Raw Command With Invalid Data Length | 
 | 154 |     [Documentation]  Verify get channel authentication capabilities IPMI raw command with invalid data length. | 
 | 155 |     [Tags]  Verify_Get_Channel_Authentication_Capabilities_IPMI_Raw_Command_With_Invalid_Data_Length | 
| nagarjunb22 | 9845074 | 2022-04-19 12:00:02 +0530 | [diff] [blame] | 156 |     [Template]  Verify Channel Auth Command For Invalid Data Length | 
 | 157 |  | 
 | 158 |     # Bytes | 
 | 159 |     low | 
 | 160 |     high | 
| Tony Lee | 2d07182 | 2020-02-19 16:37:58 +0800 | [diff] [blame] | 161 |  | 
 | 162 |  | 
 | 163 | Verify Set Session Privilege Level via IPMI Raw Command | 
 | 164 |     [Documentation]  Set session privilege with given privilege level and verify the response with | 
 | 165 |     ...              expected level. | 
 | 166 |     [Tags]  Verify_Set_Session_Privilege_Level_via_IPMI_Raw_Command | 
 | 167 |     [Template]  Set Session Privilege Level And Verify | 
 | 168 |  | 
 | 169 |     # privilege_level   expected_level | 
 | 170 |     0x00                04 | 
 | 171 |     0x02                02 | 
 | 172 |     0x03                03 | 
 | 173 |     0x04                04 | 
 | 174 |  | 
 | 175 |  | 
| George Keishing | b98036a | 2022-01-31 12:39:47 -0600 | [diff] [blame] | 176 | Verify Set Invalid Session Privilege Level Via IPMI Raw Command | 
| Tony Lee | 94f1a6c | 2020-03-25 10:37:46 +0800 | [diff] [blame] | 177 |     [Documentation]  Verify set invalid session privilege level via IPMI raw command. | 
 | 178 |     [Tags]  Verify_Set_Invalid_Session_Privilege_Level_Via_IPMI_Raw_Command | 
 | 179 |     [Template]  Set Invalid Session Privilege Level And Verify | 
 | 180 |  | 
 | 181 |     # invalid_privilege_level | 
| Nagarjun B | bb3365c | 2023-05-25 14:40:57 +0530 | [diff] [blame] | 182 |     0x01 | 
| Tony Lee | 94f1a6c | 2020-03-25 10:37:46 +0800 | [diff] [blame] | 183 |     0x05 | 
 | 184 |     0x06 | 
 | 185 |     0x07 | 
 | 186 |     0x0F | 
 | 187 |  | 
 | 188 |  | 
| George Keishing | b98036a | 2022-01-31 12:39:47 -0600 | [diff] [blame] | 189 | Verify Close Session Via IPMI | 
| Tony Lee | d12b40d | 2020-03-19 10:45:21 +0800 | [diff] [blame] | 190 |     [Documentation]  Verify close session via IPMI. | 
 | 191 |     [Tags]  Verify_Close_Session_Via_IPMI | 
 | 192 |  | 
 | 193 |     # The "close session command" can be tested with any out-of-band IPMI command. | 
 | 194 |     # When the session is about to close, it will execute the close session command at the end. | 
 | 195 |  | 
 | 196 |     ${cmd}=  Catenate  mc info -vvv 2>&1 | grep "Closed Session" | 
 | 197 |     ${cmd_output}=  Run External IPMI Standard Command  ${cmd} | 
 | 198 |  | 
 | 199 |     Should Contain  ${cmd_output}  Closed Session | 
 | 200 |  | 
 | 201 |  | 
| Ashwini Chandrappa | 4ec7085 | 2021-09-07 09:10:36 -0500 | [diff] [blame] | 202 | Verify Chassis Identify via IPMI | 
 | 203 |     [Documentation]  Set chassis identify using IPMI and verify. | 
 | 204 |     [Tags]  Verify_Chassis_Identify_via_IPMI | 
 | 205 |     [Setup]  Redfish.Login | 
 | 206 |     [Teardown]  Redfish.logout | 
 | 207 |  | 
 | 208 |     # Set to default "chassis identify" and verify that LED blinks for 15s. | 
 | 209 |     Run IPMI Standard Command  chassis identify | 
| manimozhik | 1263acd | 2023-11-08 06:44:41 +0000 | [diff] [blame] | 210 |     Verify Identify LED State Via Redfish  True | 
| Ashwini Chandrappa | 4ec7085 | 2021-09-07 09:10:36 -0500 | [diff] [blame] | 211 |  | 
 | 212 |     Sleep  18s | 
| manimozhik | 1263acd | 2023-11-08 06:44:41 +0000 | [diff] [blame] | 213 |     Verify Identify LED State Via Redfish  False | 
| Ashwini Chandrappa | 4ec7085 | 2021-09-07 09:10:36 -0500 | [diff] [blame] | 214 |  | 
 | 215 |     # Set "chassis identify" to 10s and verify that the LED blinks for 10s. | 
 | 216 |     Run IPMI Standard Command  chassis identify 10 | 
| manimozhik | 1263acd | 2023-11-08 06:44:41 +0000 | [diff] [blame] | 217 |     Verify Identify LED State Via Redfish  True | 
| Ashwini Chandrappa | 4ec7085 | 2021-09-07 09:10:36 -0500 | [diff] [blame] | 218 |  | 
 | 219 |     Sleep  12s | 
| manimozhik | 1263acd | 2023-11-08 06:44:41 +0000 | [diff] [blame] | 220 |     Verify Identify LED State Via Redfish  False | 
| Ashwini Chandrappa | 4ec7085 | 2021-09-07 09:10:36 -0500 | [diff] [blame] | 221 |  | 
 | 222 |  | 
 | 223 | Verify Chassis Identify Off And Force Identify On via IPMI | 
 | 224 |     [Documentation]  Set chassis identify to "off" and "force" using IPMI and verify. | 
 | 225 |     [Tags]  Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI | 
 | 226 |     [Setup]  Redfish.Login | 
 | 227 |     [Teardown]  Redfish.logout | 
 | 228 |  | 
 | 229 |     # Set the LED to "Force Identify On". | 
 | 230 |     Run IPMI Standard Command  chassis identify force | 
| manimozhik | 1263acd | 2023-11-08 06:44:41 +0000 | [diff] [blame] | 231 |     Verify Identify LED State Via Redfish  True | 
| Ashwini Chandrappa | 4ec7085 | 2021-09-07 09:10:36 -0500 | [diff] [blame] | 232 |  | 
 | 233 |     # Set "chassis identify" to 0 and verify that the LED turns off. | 
 | 234 |     Run IPMI Standard Command  chassis identify 0 | 
| manimozhik | 1263acd | 2023-11-08 06:44:41 +0000 | [diff] [blame] | 235 |     Verify Identify LED State Via Redfish  False | 
| Ashwini Chandrappa | 4ec7085 | 2021-09-07 09:10:36 -0500 | [diff] [blame] | 236 |  | 
 | 237 |  | 
| Nandish-Matti | 18179e7 | 2023-10-26 10:29:55 -0500 | [diff] [blame] | 238 | Set Power Cap Value Via IPMI And Verify Using Redfish | 
 | 239 |     [Documentation]  Set power cap value via IPMI and verify using Redfish. | 
 | 240 |     [Setup]  Redfish.Login | 
 | 241 |     [Teardown]  Run Keywords  Set Power Cap Value Via Redfish  ${initial_power_value}  AND  Redfish.Logout | 
 | 242 |     [Tags]  Set_Power_Cap_Value_Via_IPMI_And_Verify_Using_Redfish | 
 | 243 |  | 
 | 244 |     # Get initial power cap value via Redfish. | 
 | 245 |     ${power_limit_watts}=  Get System Power Cap Limit | 
 | 246 |     ${initial_power_value}=  Set Variable  ${power_limit_watts['SetPoint']} | 
 | 247 |  | 
 | 248 |     # Get the allowable min and max power cap value via Redfish. | 
 | 249 |     ${min_power_value}=  Set Variable  ${power_limit_watts['AllowableMin']} | 
 | 250 |     ${max_power_value}=  Set Variable  ${power_limit_watts['AllowableMax']} | 
 | 251 |  | 
 | 252 |     # Generate a random power cap value within the allowable range. | 
 | 253 |     ${random_power_cap}=  Evaluate  random.randint(${min_power_value}, ${max_power_value})  modules=random | 
 | 254 |  | 
 | 255 |     # Set power cap value via IPMI. | 
 | 256 |     Run Keyword  Run IPMI Standard Command  dcmi power set_limit limit ${random_power_cap} | 
 | 257 |  | 
 | 258 |     # Verify the power cap value with the Redfish value. | 
 | 259 |     ${updated_power_limits}=  Get System Power Cap Limit | 
 | 260 |     Should Be Equal  ${updated_power_limits['SetPoint']}  ${random_power_cap} | 
 | 261 |  | 
 | 262 |  | 
| Nandish-Matti | 43d80bc | 2023-11-01 23:35:44 -0500 | [diff] [blame] | 263 | Verify Power Cap Value Via IPMI | 
 | 264 |     [Documentation]  Verify the power cap value via IPMI, set to non-zero using Redfish | 
 | 265 |     ...              if initial power cap value is zero. | 
 | 266 |     [Tags]  Verify_Power_Cap_Value_Via_IPMI | 
 | 267 |     [Setup]  Redfish.Login | 
| Nandish-Matti | f76c740 | 2023-11-16 00:12:51 -0600 | [diff] [blame] | 268 |     [Teardown]  Run Keywords  Set Power Cap Value Via Redfish  ${redfish_power_value}  AND  Redfish.Logout | 
| Nandish-Matti | 43d80bc | 2023-11-01 23:35:44 -0500 | [diff] [blame] | 269 |  | 
 | 270 |     # Get power cap value via Redfish. | 
 | 271 |     ${power_cap_limit}=  Get System Power Cap Limit | 
 | 272 |  | 
| George Keishing | c55a899 | 2023-11-13 12:03:43 +0530 | [diff] [blame] | 273 |     # Get initial power cap value. | 
| Nandish-Matti | f76c740 | 2023-11-16 00:12:51 -0600 | [diff] [blame] | 274 |     ${redfish_power_value}=  Set Variable  ${power_cap_limit['SetPoint']} | 
| Nandish-Matti | 43d80bc | 2023-11-01 23:35:44 -0500 | [diff] [blame] | 275 |  | 
 | 276 |     # Update power cap value via Redfish if the initial power cap value is zero. | 
| Nandish-Matti | f76c740 | 2023-11-16 00:12:51 -0600 | [diff] [blame] | 277 |     IF  ${redfish_power_value} == 0 | 
| Nandish-Matti | 43d80bc | 2023-11-01 23:35:44 -0500 | [diff] [blame] | 278 |         # Get the allowable min and max power cap value via Redfish. | 
 | 279 |         ${min_power_value}=  Set Variable  ${power_cap_limit['AllowableMin']} | 
 | 280 |         ${max_power_value}=  Set Variable  ${power_cap_limit['AllowableMax']} | 
 | 281 |  | 
 | 282 |         # Generate a random power cap value within the allowable range. | 
 | 283 |         ${random_power_cap}=  Evaluate  random.randint(${min_power_value}, ${max_power_value})  modules=random | 
 | 284 |  | 
 | 285 |         # Set power value via Redfish. | 
 | 286 |         Set Power Cap Value Via Redfish  ${random_power_cap} | 
| Nandish-Matti | f76c740 | 2023-11-16 00:12:51 -0600 | [diff] [blame] | 287 |         ${redfish_power_value}=  Set Variable  ${random_power_cap} | 
| Nandish-Matti | 43d80bc | 2023-11-01 23:35:44 -0500 | [diff] [blame] | 288 |     END | 
 | 289 |  | 
 | 290 |     # Get power cap value via IPMI. | 
 | 291 |     ${cmd}=  Catenate  dcmi power get_limit | grep "Power Limit:" | 
 | 292 |     ${resp}=  Run IPMI Standard Command  ${cmd} | 
 | 293 |  | 
 | 294 |     # The output will be as below. | 
 | 295 |     # Power Limit:         1472 Watts | 
 | 296 |  | 
 | 297 |     # Truncate power limit: and watts from output. | 
 | 298 |     ${output_limit}=  Strip String  ${resp}  mode=left  characters=Power Limit: | 
 | 299 |     ${ipmi_power_cap_value}=  Strip String  ${output_limit}  mode=both  characters= Watts | 
 | 300 |  | 
 | 301 |     # Perform a comparison of power cap values obtained from both IPMI and Redfish. | 
| Nandish-Matti | f76c740 | 2023-11-16 00:12:51 -0600 | [diff] [blame] | 302 |     ${redfish_power_cap_value}=  Convert To String  ${redfish_power_value} | 
| Nandish-Matti | 43d80bc | 2023-11-01 23:35:44 -0500 | [diff] [blame] | 303 |     Should Be Equal  ${ipmi_power_cap_value}  ${redfish_power_cap_value} | 
 | 304 |  | 
 | 305 |  | 
| Tony Lee | 2d07182 | 2020-02-19 16:37:58 +0800 | [diff] [blame] | 306 | *** Keywords *** | 
 | 307 |  | 
| nagarjunb22 | 9845074 | 2022-04-19 12:00:02 +0530 | [diff] [blame] | 308 | IPMI General Test Suite Setup | 
 | 309 |     [Documentation]  Get active and inactive/invalid channels from channel_config.json file | 
 | 310 |     ...              in list type and set it as suite variable. | 
 | 311 |  | 
 | 312 |     # Get active channel list and set as suite variable. | 
 | 313 |     @{active_channel_list}=  Get Active Ethernet Channel List | 
 | 314 |     Set Suite Variable  @{active_channel_list} | 
 | 315 |  | 
 | 316 |     # Get Inactive/Invalid channel list and set as suite variable. | 
 | 317 |     @{inactive_channel_list}=  Get Invalid Channel Number List | 
 | 318 |     Set Suite Variable  @{inactive_channel_list} | 
 | 319 |  | 
 | 320 |  | 
| Tony Lee | 2d07182 | 2020-02-19 16:37:58 +0800 | [diff] [blame] | 321 | Set Session Privilege Level And Verify | 
| Sridevi Ramesh | 934d3b0 | 2025-04-25 04:59:43 -0500 | [diff] [blame] | 322 |     [Documentation]   Set session privilege with given privilege level and | 
 | 323 |     ...               verify the response with expected level. | 
| Tony Lee | 2d07182 | 2020-02-19 16:37:58 +0800 | [diff] [blame] | 324 |     [Arguments]  ${privilege_level}  ${expected_level} | 
| Sridevi Ramesh | 934d3b0 | 2025-04-25 04:59:43 -0500 | [diff] [blame] | 325 |  | 
| Tony Lee | 2d07182 | 2020-02-19 16:37:58 +0800 | [diff] [blame] | 326 |     # Description of argument(s): | 
 | 327 |     # privilege_level    Requested Privilege Level. | 
| Sridevi Ramesh | 934d3b0 | 2025-04-25 04:59:43 -0500 | [diff] [blame] | 328 |     # expected_level     New Privilege Level (or present level if | 
 | 329 |     #                    ‘return present privilege level’ was selected). | 
| Tony Lee | 2d07182 | 2020-02-19 16:37:58 +0800 | [diff] [blame] | 330 |  | 
| Tony Lee | b49853c | 2020-06-03 15:27:56 +0800 | [diff] [blame] | 331 |     ${resp}=  Run External IPMI Raw Command | 
| Tony Lee | 94f1a6c | 2020-03-25 10:37:46 +0800 | [diff] [blame] | 332 |     ...  0x06 0x3b ${privilege_level} | 
| Tony Lee | 2d07182 | 2020-02-19 16:37:58 +0800 | [diff] [blame] | 333 |     Should Contain  ${resp}  ${expected_level} | 
| Tony Lee | 94f1a6c | 2020-03-25 10:37:46 +0800 | [diff] [blame] | 334 |  | 
 | 335 |  | 
 | 336 | Set Invalid Session Privilege Level And Verify | 
 | 337 |     [Documentation]   Set invalid session privilege level and verify the response. | 
 | 338 |     [Arguments]  ${privilege_level} | 
| Sridevi Ramesh | 934d3b0 | 2025-04-25 04:59:43 -0500 | [diff] [blame] | 339 |  | 
| Tony Lee | 94f1a6c | 2020-03-25 10:37:46 +0800 | [diff] [blame] | 340 |     # Description of argument(s): | 
 | 341 |     # privilege_level    Requested Privilege Level. | 
 | 342 |  | 
 | 343 |     # Verify requested level exceeds Channel and/or User Privilege Limit. | 
| Tony Lee | b49853c | 2020-06-03 15:27:56 +0800 | [diff] [blame] | 344 |     ${msg}=  Run Keyword And Expect Error  *  Run External IPMI Raw Command | 
| Tony Lee | 94f1a6c | 2020-03-25 10:37:46 +0800 | [diff] [blame] | 345 |     ...  0x06 0x3b ${privilege_level} | 
| Nagarjun B | bb3365c | 2023-05-25 14:40:57 +0530 | [diff] [blame] | 346 |  | 
 | 347 |     # 0x05 is OEM proprietary level. | 
 | 348 |     IF  ${privilege_level} == 0x05 | 
 | 349 |         Should Contain  ${msg}  Unknown  rsp=0x81 | 
 | 350 |     ELSE | 
| George Keishing | c2b9504 | 2023-06-27 12:25:33 +0530 | [diff] [blame] | 351 |         # According to IPMI spec privilege level except 0x00-0x05, others are | 
 | 352 |         # reserved. So if we try to set those privilege we will get rsp as | 
 | 353 |         # 0xcc(Invalid data filed in request) | 
| Nagarjun B | bb3365c | 2023-05-25 14:40:57 +0530 | [diff] [blame] | 354 |         Should Contain  ${msg}  Invalid data field in request  rsp=0xcc | 
 | 355 |     END | 
| Ashwini Chandrappa | 4ec7085 | 2021-09-07 09:10:36 -0500 | [diff] [blame] | 356 |  | 
 | 357 |  | 
 | 358 | Verify Identify LED State Via Redfish | 
 | 359 |     [Documentation]  Verify that Redfish identify LED system with given state. | 
 | 360 |     [Arguments]  ${expected_state} | 
| Sridevi Ramesh | 934d3b0 | 2025-04-25 04:59:43 -0500 | [diff] [blame] | 361 |  | 
| Ashwini Chandrappa | 4ec7085 | 2021-09-07 09:10:36 -0500 | [diff] [blame] | 362 |     # Description of argument(s): | 
| Sridevi Ramesh | 934d3b0 | 2025-04-25 04:59:43 -0500 | [diff] [blame] | 363 |     # expected_state  Expected state of Identify LED. | 
| Ashwini Chandrappa | 4ec7085 | 2021-09-07 09:10:36 -0500 | [diff] [blame] | 364 |  | 
| George Keishing | b061455 | 2022-07-08 02:52:57 -0500 | [diff] [blame] | 365 |     # Get the following URI(s) and iterate to find the attribute IndicatorLED. | 
 | 366 |     # Example: | 
 | 367 |     # /redfish/v1/Systems/system | 
 | 368 |     # /redfish/v1/Systems/hypervisor | 
 | 369 |  | 
| George Keishing | 52eb7c2 | 2022-03-11 10:58:53 -0600 | [diff] [blame] | 370 |     # Python module:  get_member_list(resource_path) | 
 | 371 |     ${systems}=  Redfish_Utils.Get Member List  /redfish/v1/Systems | 
 | 372 |     FOR  ${system}  IN  @{systems} | 
| manimozhik | 1263acd | 2023-11-08 06:44:41 +0000 | [diff] [blame] | 373 |         ${led_value}=  Redfish.Get Attribute  ${system}  LocationIndicatorActive | 
| George Keishing | f6b4d53 | 2022-07-08 07:07:54 -0500 | [diff] [blame] | 374 |         # Get attribute return None if IndicatorLED does not exist in the URI. | 
| Sridevi Ramesh | ac15572 | 2025-05-02 05:09:40 -0500 | [diff] [blame] | 375 |         IF  '${led_value}' == 'None'  CONTINUE | 
| George Keishing | 52eb7c2 | 2022-03-11 10:58:53 -0600 | [diff] [blame] | 376 |         Should Be True  '${led_value}' == '${expected_state}' | 
 | 377 |     END | 
| nagarjunb22 | 9845074 | 2022-04-19 12:00:02 +0530 | [diff] [blame] | 378 |  | 
 | 379 |  | 
 | 380 | Verify Channel Auth Capabilities | 
 | 381 |     [Documentation]  Verify authentication capabilities for given channel and privilege. | 
 | 382 |     [Arguments]  ${channel}  ${privilege_level} | 
 | 383 |  | 
 | 384 |     # Description of argument(s): | 
 | 385 |     # channel           Interface channel number. | 
| George Keishing | 13b7afd | 2022-05-23 07:36:16 -0500 | [diff] [blame] | 386 |     # privilege_level   User Privilege level (e.g. 4-Administator, 3-Operator, 2-Readonly). | 
| nagarjunb22 | 9845074 | 2022-04-19 12:00:02 +0530 | [diff] [blame] | 387 |  | 
 | 388 |     # Python module:  get_channel_auth_capabilities(channel_number, privilege_level) | 
 | 389 |     ${channel_auth_cap}=  Get Channel Auth Capabilities  ${channel}  ${privilege_level} | 
 | 390 |     Rprint Vars  channel_auth_cap | 
 | 391 |  | 
 | 392 |     Valid Value  channel_auth_cap['channel_number']  ['${channel}'] | 
 | 393 |     Valid Value  channel_auth_cap['kg_status']  ['default (all zeroes)'] | 
 | 394 |     Valid Value  channel_auth_cap['per_message_authentication']  ['enabled'] | 
 | 395 |     Valid Value  channel_auth_cap['user_level_authentication']  ['enabled'] | 
 | 396 |     Valid Value  channel_auth_cap['non-null_user_names_exist']  ['yes'] | 
 | 397 |     Valid Value  channel_auth_cap['null_user_names_exist']  ['no'] | 
 | 398 |     Valid Value  channel_auth_cap['anonymous_login_enabled']  ['no'] | 
 | 399 |     Valid Value  channel_auth_cap['channel_supports_ipmi_v1.5']  ['no'] | 
 | 400 |     Valid Value  channel_auth_cap['channel_supports_ipmi_v2.0']  ['yes'] | 
 | 401 |  | 
 | 402 |  | 
| George Keishing | 13b7afd | 2022-05-23 07:36:16 -0500 | [diff] [blame] | 403 | Verify Channel Auth Capabilities For Invalid Channel | 
| nagarjunb22 | 9845074 | 2022-04-19 12:00:02 +0530 | [diff] [blame] | 404 |     [Documentation]  Verify authentication capabilities of invalid channels. | 
 | 405 |     [Arguments]  ${channel} | 
 | 406 |  | 
 | 407 |     # Description of argument(s): | 
 | 408 |     # channel   Interface channel number. | 
 | 409 |  | 
 | 410 |     ${channel_in_hex}=  Convert To Hex  ${channel}  prefix=0x | 
 | 411 |     ${cmd}=  Catenate  ${IPMI_RAW_CMD['Get Channel Auth Cap']['get'][0]} ${channel_in_hex} 0x04 | 
 | 412 |  | 
 | 413 |     Verify Invalid IPMI Command  ${cmd}  0xcc | 
 | 414 |  | 
 | 415 |  | 
 | 416 | Verify Channel Auth Command For Invalid Data Length | 
 | 417 |    [Documentation]  Verify channel authentication command for invalid data length. | 
 | 418 |    [Arguments]  ${byte_length} | 
 | 419 |  | 
 | 420 |    # Description of argument(s): | 
 | 421 |    # byte_length   high or low. | 
 | 422 |    #               e.g. high - add extra byte to request data like "0x06 0x38 0x01 0x04 0x01". | 
 | 423 |    #               low - reduce bytes in actual request data like "0x06 0x38". | 
 | 424 |  | 
 | 425 |    ${req_cmd}=  Run Keyword If  '${byte_length}' == 'low' | 
 | 426 |    ...  Catenate  ${IPMI_RAW_CMD['Get Channel Auth Cap']['get'][0]}  ${CHANNEL_NUMBER} | 
 | 427 |    ...  ELSE | 
 | 428 |    ...  Catenate  ${IPMI_RAW_CMD['Get Channel Auth Cap']['get'][0]}  ${CHANNEL_NUMBER} 0x04 0x01 | 
 | 429 |  | 
 | 430 |    Verify Invalid IPMI Command  ${req_cmd}  0xc7 | 
| Nandish-Matti | 18179e7 | 2023-10-26 10:29:55 -0500 | [diff] [blame] | 431 |  | 
 | 432 |  | 
 | 433 | Set Power Cap Value Via Redfish | 
 | 434 |     [Documentation]  Set power cap value via Redfish. | 
 | 435 |     [Arguments]   ${power_cap_value} | 
 | 436 |  | 
 | 437 |     # Description of argument(s): | 
 | 438 |     # power_cap_value    Power cap value which need to be set. | 
 | 439 |  | 
 | 440 |     # Set power cap value based on argument. | 
| Yi Hu | c32434a | 2024-01-11 17:33:10 -0800 | [diff] [blame] | 441 |     Redfish.Patch  /redfish/v1/Chassis/${CHASSIS_ID}/EnvironmentMetrics | 
| Nandish-Matti | 18179e7 | 2023-10-26 10:29:55 -0500 | [diff] [blame] | 442 |     ...  body={"PowerLimitWatts":{"SetPoint": ${power_cap_value}}} | 
 | 443 |     ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |