George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 1 | *** Settings *** |
Joy Onyerikwu | dbfe97d | 2019-03-11 19:44:56 -0500 | [diff] [blame] | 2 | Documentation Test BMC Manager functionality. |
George Keishing | 2db7bca | 2019-02-14 13:03:08 -0600 | [diff] [blame] | 3 | Resource ../../lib/resource.robot |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 4 | Resource ../../lib/bmc_redfish_resource.robot |
| 5 | Resource ../../lib/common_utils.robot |
George Keishing | 3298d5c | 2019-02-12 06:59:25 -0600 | [diff] [blame] | 6 | Resource ../../lib/openbmc_ffdc.robot |
George Keishing | ba0441c | 2019-03-09 22:22:57 -0600 | [diff] [blame] | 7 | Resource ../../lib/boot_utils.robot |
George Keishing | 44f890b | 2019-04-22 13:32:15 -0500 | [diff] [blame] | 8 | Resource ../../lib/open_power_utils.robot |
George Keishing | 224377b | 2019-07-15 14:15:09 -0500 | [diff] [blame] | 9 | Resource ../../lib/bmc_network_utils.robot |
| 10 | Library ../../lib/gen_robot_valid.py |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 11 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 12 | Test Setup Test Setup Execution |
George Keishing | 49f4633 | 2019-03-26 08:13:05 -0500 | [diff] [blame] | 13 | Test Teardown Test Teardown Execution |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 14 | |
George Keishing | 912094b | 2019-06-07 09:49:03 -0500 | [diff] [blame] | 15 | |
| 16 | *** Variables *** |
| 17 | |
| 18 | ${SYSTEM_SHUTDOWN_TIME} ${5} |
| 19 | |
| 20 | # Strings to check from journald. |
aravinth0510 | 9fae166 | 2022-06-29 16:42:27 +0000 | [diff] [blame] | 21 | ${REBOOT_REGEX} ^\-- Boot | Startup finished |
George Keishing | 912094b | 2019-06-07 09:49:03 -0500 | [diff] [blame] | 22 | |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 23 | *** Test Cases *** |
| 24 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 25 | Verify Redfish BMC Firmware Version |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 26 | [Documentation] Get firmware version from BMC manager. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 27 | [Tags] Verify_Redfish_BMC_Firmware_Version |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 28 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 29 | Redfish.Login |
| 30 | ${resp}= Redfish.Get /redfish/v1/Managers/bmc |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 31 | Should Be Equal As Strings ${resp.status} ${HTTP_OK} |
| 32 | ${bmc_version}= Get BMC Version |
| 33 | Should Be Equal As Strings |
| 34 | ... ${resp.dict["FirmwareVersion"]} ${bmc_version.strip('"')} |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 35 | |
| 36 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 37 | Verify Redfish BMC Manager Properties |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 38 | [Documentation] Verify BMC managers resource properties. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 39 | [Tags] Verify_Redfish_BMC_Manager_Properties |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 40 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 41 | Redfish.Login |
| 42 | ${resp}= Redfish.Get /redfish/v1/Managers/bmc |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 43 | Should Be Equal As Strings ${resp.status} ${HTTP_OK} |
| 44 | # Example: |
| 45 | # "Description": "Baseboard Management Controller" |
| 46 | # "Id": "bmc" |
| 47 | # "Model": "OpenBmc", |
| 48 | # "Name": "OpenBmc Manager", |
| 49 | # "UUID": "xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxx" |
| 50 | # "PowerState": "On" |
| 51 | |
| 52 | Should Be Equal As Strings |
| 53 | ... ${resp.dict["Description"]} Baseboard Management Controller |
| 54 | Should Be Equal As Strings ${resp.dict["Id"]} bmc |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 55 | Should Be Equal As Strings ${resp.dict["Name"]} OpenBmc Manager |
| 56 | Should Not Be Empty ${resp.dict["UUID"]} |
| 57 | Should Be Equal As Strings ${resp.dict["PowerState"]} On |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 58 | |
| 59 | |
George Keishing | 224377b | 2019-07-15 14:15:09 -0500 | [diff] [blame] | 60 | Verify MAC Address Property Is Populated |
| 61 | [Documentation] Verify BMC managers resource properties. |
| 62 | [Tags] Verify_MAC_Address_Property_Is_Populated |
| 63 | |
George Keishing | 11789a2 | 2020-07-17 14:38:00 -0500 | [diff] [blame] | 64 | # Get OrderedDict from the BMC which contains active ethernet channel. |
| 65 | # Example: ([('1', {'name': 'eth0', |
| 66 | # 'is_valid': True, |
| 67 | # 'active_sessions': 0, |
| 68 | # 'channel_info': {'medium_type': 'lan-802.3', |
| 69 | # 'protocol_type': 'ipmb-1.0', |
| 70 | # 'session_supported': 'multi-session', |
| 71 | # 'is_ipmi': True |
| 72 | # } |
| 73 | # } |
| 74 | # )]) |
| 75 | |
| 76 | ${active_channel_config}= Get Active Channel Config |
| 77 | |
| 78 | FOR ${channel_number} IN @{active_channel_config.keys()} |
| 79 | Log Dictionary ${active_channel_config["${channel_number}"]} |
| 80 | |
aravinth0510 | a3b203c | 2022-09-12 10:18:36 +0000 | [diff] [blame] | 81 | # Skip channel if is_valid is false for the channel number |
| 82 | Continue For Loop If |
| 83 | ... ${active_channel_config["${channel_number}"]["is_valid"]}==${FALSE} |
| 84 | |
George Keishing | 11789a2 | 2020-07-17 14:38:00 -0500 | [diff] [blame] | 85 | # Get ethernet valid paths in redfish. |
| 86 | # Example: ['/redfish/v1/Managers/bmc/EthernetInterfaces'] |
| 87 | ${eth_interface}= redfish_utils.Get Endpoint Path List |
| 88 | ... /redfish/v1/Managers/ EthernetInterfaces |
| 89 | |
| 90 | # Get the MACAddress attrivute value with the 'name': 'eth0'. |
| 91 | # Example: /redfish/v1/Managers/bmc/EthernetInterfaces/eth0 |
| 92 | ${redfish_mac_addr}= Redfish.Get Attribute |
| 93 | ... ${eth_interface[0]}/${active_channel_config["${channel_number}"]["name"]} |
| 94 | ... MACAddress |
| 95 | END |
| 96 | |
George Keishing | 224377b | 2019-07-15 14:15:09 -0500 | [diff] [blame] | 97 | Rprint Vars redfish_mac_addr fmt=terse |
Michael Walsh | e7edb22 | 2019-08-19 17:39:38 -0500 | [diff] [blame] | 98 | Valid Value redfish_mac_addr |
George Keishing | 224377b | 2019-07-15 14:15:09 -0500 | [diff] [blame] | 99 | |
| 100 | ${ipaddr_mac_addr}= Get BMC MAC Address List |
| 101 | Rprint Vars ipaddr_mac_addr fmt=terse |
| 102 | |
| 103 | List Should Contain Value ${ipaddr_mac_addr} ${redfish_mac_addr} |
| 104 | |
| 105 | |
George Keishing | ba0441c | 2019-03-09 22:22:57 -0600 | [diff] [blame] | 106 | Redfish BMC Manager GracefulRestart When Host Off |
| 107 | [Documentation] BMC graceful restart when host is powered off. |
| 108 | [Tags] Redfish_BMC_Manager_GracefulRestart_When_Host_Off |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 109 | |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 110 | # "Actions": { |
| 111 | # "#Manager.Reset": { |
| 112 | # "ResetType@Redfish.AllowableValues": [ |
Sushil Singh | b910d89 | 2021-11-17 05:34:29 -0600 | [diff] [blame] | 113 | # "GracefulRestart", |
| 114 | # "ForceRestart" |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 115 | # ], |
| 116 | # "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset" |
| 117 | # } |
| 118 | |
George Keishing | 912094b | 2019-06-07 09:49:03 -0500 | [diff] [blame] | 119 | ${test_file_path}= Set Variable /tmp/before_bmcreboot |
| 120 | BMC Execute Command touch ${test_file_path} |
| 121 | |
Sushil Singh | b910d89 | 2021-11-17 05:34:29 -0600 | [diff] [blame] | 122 | Redfish Power Off stack_mode=skip |
| 123 | |
| 124 | Redfish BMC Reset Operation reset_type=GracefulRestart |
| 125 | |
| 126 | Is BMC Standby |
| 127 | |
George Keishing | e9ebf91 | 2022-07-19 10:23:26 -0500 | [diff] [blame] | 128 | ${stdout} ${stderr} ${rc}= BMC Execute Command test ! -f ${test_file_path} print_out=1 |
Sushil Singh | b910d89 | 2021-11-17 05:34:29 -0600 | [diff] [blame] | 129 | Verify BMC RTC And UTC Time Drift |
| 130 | |
| 131 | # Check for journald persistency post reboot. |
aravinth0510 | 9fae166 | 2022-06-29 16:42:27 +0000 | [diff] [blame] | 132 | Wait Until Keyword Succeeds 3 min 10 sec |
| 133 | ... Check For Regex In Journald ${REBOOT_REGEX} error_check=${1} |
Sushil Singh | b910d89 | 2021-11-17 05:34:29 -0600 | [diff] [blame] | 134 | |
| 135 | |
| 136 | Redfish BMC Manager ForceRestart When Host Off |
| 137 | [Documentation] BMC force restart when host is powered off. |
| 138 | [Tags] Redfish_BMC_Manager_ForceRestart_When_Host_Off |
| 139 | |
| 140 | # "Actions": { |
| 141 | # "#Manager.Reset": { |
| 142 | # "ResetType@Redfish.AllowableValues": [ |
| 143 | # "GracefulRestart", |
| 144 | # "ForceRestart" |
| 145 | # ], |
| 146 | # "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset" |
| 147 | # } |
| 148 | |
| 149 | ${test_file_path}= Set Variable /tmp/before_bmcreboot |
| 150 | BMC Execute Command touch ${test_file_path} |
| 151 | |
| 152 | Redfish Power Off stack_mode=skip |
| 153 | |
| 154 | Redfish BMC Reset Operation reset_type=ForceRestart |
| 155 | |
| 156 | Is BMC Standby |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 157 | |
George Keishing | e9ebf91 | 2022-07-19 10:23:26 -0500 | [diff] [blame] | 158 | ${stdout} ${stderr} ${rc}= BMC Execute Command test ! -f ${test_file_path} print_out=1 |
George Keishing | 912094b | 2019-06-07 09:49:03 -0500 | [diff] [blame] | 159 | Verify BMC RTC And UTC Time Drift |
| 160 | |
| 161 | # Check for journald persistency post reboot. |
aravinth0510 | 9fae166 | 2022-06-29 16:42:27 +0000 | [diff] [blame] | 162 | Wait Until Keyword Succeeds 3 min 10 sec |
| 163 | ... Check For Regex In Journald ${REBOOT_REGEX} error_check=${1} |
George Keishing | 912094b | 2019-06-07 09:49:03 -0500 | [diff] [blame] | 164 | |
George Keishing | ba0441c | 2019-03-09 22:22:57 -0600 | [diff] [blame] | 165 | |
George Keishing | e210d59 | 2019-06-11 11:18:35 -0500 | [diff] [blame] | 166 | Verify Boot Count After BMC Reboot |
| 167 | [Documentation] Verify boot count increments on BMC reboot. |
| 168 | [Tags] Verify_Boot_Count_After_BMC_Reboot |
aravinth0510 | 83f3118 | 2022-09-30 12:32:57 +0000 | [diff] [blame] | 169 | [Setup] Run Keywords Update NTP Test Initial Status AND |
| 170 | ... Set NTP state ${TRUE} |
| 171 | [Teardown] Restore NTP Status |
George Keishing | e210d59 | 2019-06-11 11:18:35 -0500 | [diff] [blame] | 172 | |
| 173 | Set BMC Boot Count ${0} |
| 174 | Redfish OBMC Reboot (off) |
| 175 | ${boot_count}= Get BMC Boot Count |
| 176 | Should Be Equal ${boot_count} ${1} msg=Boot count is not incremented. |
| 177 | |
| 178 | |
George Keishing | ba0441c | 2019-03-09 22:22:57 -0600 | [diff] [blame] | 179 | Redfish BMC Manager GracefulRestart When Host Booted |
| 180 | [Documentation] BMC graceful restart when host is running. |
| 181 | [Tags] Redfish_BMC_Manager_GracefulRestart_When_Host_Booted |
| 182 | |
| 183 | Redfish OBMC Reboot (run) |
| 184 | |
George Keishing | 44f890b | 2019-04-22 13:32:15 -0500 | [diff] [blame] | 185 | # TODO: Replace OCC state check with redfish property when available. |
George Keishing | e9ebf91 | 2022-07-19 10:23:26 -0500 | [diff] [blame] | 186 | Wait Until Keyword Succeeds 10 min 30 sec Verify OCC State |
George Keishing | 44f890b | 2019-04-22 13:32:15 -0500 | [diff] [blame] | 187 | |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 188 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 189 | *** Keywords *** |
George Keishing | 22872e5 | 2019-01-30 22:44:04 -0600 | [diff] [blame] | 190 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 191 | Test Setup Execution |
| 192 | [Documentation] Do test case setup tasks. |
| 193 | |
| 194 | redfish.Login |
| 195 | |
| 196 | |
| 197 | Test Teardown Execution |
| 198 | [Documentation] Do the post test teardown. |
| 199 | |
| 200 | FFDC On Test Case Fail |
George Keishing | 780ee11 | 2021-02-02 23:27:22 -0600 | [diff] [blame] | 201 | Run Keyword And Ignore Error redfish.Logout |
aravinth0510 | 83f3118 | 2022-09-30 12:32:57 +0000 | [diff] [blame] | 202 | |
| 203 | |
| 204 | Update NTP Test Initial Status |
| 205 | [Documentation] Update the initial status of NTP. |
| 206 | |
| 207 | ${original_ntp}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} NTP |
| 208 | Set Suite Variable ${original_ntp} |
| 209 | |
| 210 | |
| 211 | Set NTP state |
| 212 | [Documentation] Set NTP service inactive. |
| 213 | [Arguments] ${state} |
| 214 | |
| 215 | Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body={'NTP':{'ProtocolEnabled': ${state}}} |
| 216 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 217 | |
| 218 | |
| 219 | Restore NTP Status |
| 220 | [Documentation] Restore NTP Status. |
| 221 | |
| 222 | Run Keyword If '${original_ntp["ProtocolEnabled"]}' == 'True' |
| 223 | ... Set NTP state ${TRUE} |
| 224 | ... ELSE Set NTP state ${FALSE} |