1*** Settings *** 2Documentation Test BMC Manager functionality. 3Resource ../../lib/resource.robot 4Resource ../../lib/bmc_redfish_resource.robot 5Resource ../../lib/common_utils.robot 6Resource ../../lib/openbmc_ffdc.robot 7Resource ../../lib/boot_utils.robot 8Resource ../../lib/open_power_utils.robot 9Resource ../../lib/bmc_network_utils.robot 10Library ../../lib/gen_robot_valid.py 11 12Test Setup Test Setup Execution 13Test Teardown Test Teardown Execution 14 15Test Tags Managers_BMC 16 17*** Variables *** 18 19${SYSTEM_SHUTDOWN_TIME} ${5} 20 21# Strings to check from journald. 22${REBOOT_REGEX} ^\-- Boot | Startup finished 23 24*** Test Cases *** 25 26Verify Redfish BMC Firmware Version 27 [Documentation] Get firmware version from BMC manager. 28 [Tags] Verify_Redfish_BMC_Firmware_Version 29 30 Redfish.Login 31 ${resp}= Redfish.Get /redfish/v1/Managers/${MANAGER_ID} 32 Should Be Equal As Strings ${resp.status} ${HTTP_OK} 33 ${bmc_version}= Get BMC Version 34 Should Be Equal As Strings 35 ... ${resp.dict["FirmwareVersion"]} ${bmc_version.strip('"')} 36 37 38Verify Redfish BMC Manager Properties 39 [Documentation] Verify BMC managers resource properties. 40 [Tags] Verify_Redfish_BMC_Manager_Properties 41 42 Redfish.Login 43 ${resp}= Redfish.Get /redfish/v1/Managers/${MANAGER_ID} 44 Should Be Equal As Strings ${resp.status} ${HTTP_OK} 45 # Example: 46 # "Description": "Baseboard Management Controller" 47 # "Id": "bmc" 48 # "Model": "OpenBmc", 49 # "Name": "OpenBmc Manager", 50 # "UUID": "xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxx" 51 # "PowerState": "On" 52 53 Should Be Equal As Strings 54 ... ${resp.dict["Description"]} Baseboard Management Controller 55 Should Be Equal As Strings ${resp.dict["Id"]} bmc 56 Should Be Equal As Strings ${resp.dict["Name"]} OpenBmc Manager 57 Should Not Be Empty ${resp.dict["UUID"]} 58 Should Be Equal As Strings ${resp.dict["PowerState"]} On 59 60 61Verify MAC Address Property Is Populated 62 [Documentation] Verify BMC managers resource properties. 63 [Tags] Verify_MAC_Address_Property_Is_Populated 64 65 # Get OrderedDict from the BMC which contains active ethernet channel. 66 # Example: ([('1', {'name': 'eth0', 67 # 'is_valid': True, 68 # 'active_sessions': 0, 69 # 'channel_info': {'medium_type': 'lan-802.3', 70 # 'protocol_type': 'ipmb-1.0', 71 # 'session_supported': 'multi-session', 72 # 'is_ipmi': True 73 # } 74 # } 75 # )]) 76 77 ${active_channel_config}= Get Active Channel Config 78 79 FOR ${channel_number} IN @{active_channel_config.keys()} 80 Log Dictionary ${active_channel_config["${channel_number}"]} 81 82 # Skip channel if is_valid is false for the channel number 83 IF ${active_channel_config["${channel_number}"]["is_valid"]}==${FALSE} CONTINUE 84 85 # Get ethernet valid paths in redfish. 86 # Example: ['/redfish/v1/Managers/${MANAGER_ID}/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/${MANAGER_ID}/EthernetInterfaces/eth0 92 ${redfish_mac_addr}= Redfish.Get Attribute 93 ... ${eth_interface[0]}/${active_channel_config["${channel_number}"]["name"]} 94 ... MACAddress 95 END 96 97 Rprint Vars redfish_mac_addr fmt=terse 98 Valid Value redfish_mac_addr 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 106Redfish 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 109 110 # "Actions": { 111 # "#Manager.Reset": { 112 # "ResetType@Redfish.AllowableValues": [ 113 # "GracefulRestart", 114 # "ForceRestart" 115 # ], 116 # "target": "/redfish/v1/Managers/${MANAGER_ID}/Actions/Manager.Reset" 117 # } 118 119 ${test_file_path}= Set Variable /tmp/before_bmcreboot 120 BMC Execute Command touch ${test_file_path} 121 122 Redfish Power Off stack_mode=skip 123 124 Redfish BMC Reset Operation reset_type=GracefulRestart 125 126 Is BMC Standby 127 128 ${stdout} ${stderr} ${rc}= BMC Execute Command test ! -f ${test_file_path} print_out=1 129 Verify BMC RTC And UTC Time Drift 130 131 # Check for journald persistency post reboot. 132 Wait Until Keyword Succeeds 3 min 10 sec 133 ... Check For Regex In Journald ${REBOOT_REGEX} error_check=${1} 134 135 136Redfish 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/${MANAGER_ID}/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 157 158 ${stdout} ${stderr} ${rc}= BMC Execute Command test ! -f ${test_file_path} print_out=1 159 Verify BMC RTC And UTC Time Drift 160 161 # Check for journald persistency post reboot. 162 Wait Until Keyword Succeeds 3 min 10 sec 163 ... Check For Regex In Journald ${REBOOT_REGEX} error_check=${1} 164 165 166Verify Boot Count After BMC Reboot 167 [Documentation] Verify boot count increments on BMC reboot. 168 [Tags] Verify_Boot_Count_After_BMC_Reboot 169 [Setup] Run Keywords Update NTP Test Initial Status AND 170 ... Set NTP state ${TRUE} 171 [Teardown] Restore NTP Status 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 179Redfish 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 185 # TODO: Replace OCC state check with redfish property when available. 186 Wait Until Keyword Succeeds 10 min 30 sec Verify OCC State 187 188 189*** Keywords *** 190 191Test Setup Execution 192 [Documentation] Do test case setup tasks. 193 194 redfish.Login 195 196 197Test Teardown Execution 198 [Documentation] Do the post test teardown. 199 200 FFDC On Test Case Fail 201 Run Keyword And Ignore Error redfish.Logout 202 203 204Update NTP Test Initial Status 205 [Documentation] Update the initial status of NTP. 206 207 Redfish.Login 208 ${original_ntp}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} NTP 209 Set Suite Variable ${original_ntp} 210 211 212Set NTP state 213 [Documentation] Set NTP service inactive. 214 [Arguments] ${state} 215 216 # Description of argument(s): 217 # state NTP protocol enabled state (e.g. True, False). 218 219 Redfish.Login 220 Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body={'NTP':{'ProtocolEnabled': ${state}}} 221 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 222 223 224Restore NTP Status 225 [Documentation] Restore NTP Status. 226 227 IF '${original_ntp["ProtocolEnabled"]}' == 'True' 228 Set NTP state ${TRUE} 229 ELSE 230 Set NTP state ${FALSE} 231 END 232