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 15 16*** Variables *** 17 18${SYSTEM_SHUTDOWN_TIME} ${5} 19 20# Strings to check from journald. 21${REBOOT_REGEX} ^\-- Boot | Startup finished 22 23*** Test Cases *** 24 25Verify Redfish BMC Firmware Version 26 [Documentation] Get firmware version from BMC manager. 27 [Tags] Verify_Redfish_BMC_Firmware_Version 28 29 Redfish.Login 30 ${resp}= Redfish.Get /redfish/v1/Managers/bmc 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('"')} 35 36 37Verify Redfish BMC Manager Properties 38 [Documentation] Verify BMC managers resource properties. 39 [Tags] Verify_Redfish_BMC_Manager_Properties 40 41 Redfish.Login 42 ${resp}= Redfish.Get /redfish/v1/Managers/bmc 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 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 58 59 60Verify MAC Address Property Is Populated 61 [Documentation] Verify BMC managers resource properties. 62 [Tags] Verify_MAC_Address_Property_Is_Populated 63 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 81 # Get ethernet valid paths in redfish. 82 # Example: ['/redfish/v1/Managers/bmc/EthernetInterfaces'] 83 ${eth_interface}= redfish_utils.Get Endpoint Path List 84 ... /redfish/v1/Managers/ EthernetInterfaces 85 86 # Get the MACAddress attrivute value with the 'name': 'eth0'. 87 # Example: /redfish/v1/Managers/bmc/EthernetInterfaces/eth0 88 ${redfish_mac_addr}= Redfish.Get Attribute 89 ... ${eth_interface[0]}/${active_channel_config["${channel_number}"]["name"]} 90 ... MACAddress 91 END 92 93 Rprint Vars redfish_mac_addr fmt=terse 94 Valid Value redfish_mac_addr 95 96 ${ipaddr_mac_addr}= Get BMC MAC Address List 97 Rprint Vars ipaddr_mac_addr fmt=terse 98 99 List Should Contain Value ${ipaddr_mac_addr} ${redfish_mac_addr} 100 101 102Redfish BMC Manager GracefulRestart When Host Off 103 [Documentation] BMC graceful restart when host is powered off. 104 [Tags] Redfish_BMC_Manager_GracefulRestart_When_Host_Off 105 106 # "Actions": { 107 # "#Manager.Reset": { 108 # "ResetType@Redfish.AllowableValues": [ 109 # "GracefulRestart", 110 # "ForceRestart" 111 # ], 112 # "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset" 113 # } 114 115 ${test_file_path}= Set Variable /tmp/before_bmcreboot 116 BMC Execute Command touch ${test_file_path} 117 118 Redfish Power Off stack_mode=skip 119 120 Redfish BMC Reset Operation reset_type=GracefulRestart 121 122 Is BMC Standby 123 124 BMC Execute Command if [ -f ${test_file_path} ] ; then false ; fi 125 Verify BMC RTC And UTC Time Drift 126 127 # Check for journald persistency post reboot. 128 Wait Until Keyword Succeeds 3 min 10 sec 129 ... Check For Regex In Journald ${REBOOT_REGEX} error_check=${1} 130 131 132Redfish BMC Manager ForceRestart When Host Off 133 [Documentation] BMC force restart when host is powered off. 134 [Tags] Redfish_BMC_Manager_ForceRestart_When_Host_Off 135 136 # "Actions": { 137 # "#Manager.Reset": { 138 # "ResetType@Redfish.AllowableValues": [ 139 # "GracefulRestart", 140 # "ForceRestart" 141 # ], 142 # "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset" 143 # } 144 145 ${test_file_path}= Set Variable /tmp/before_bmcreboot 146 BMC Execute Command touch ${test_file_path} 147 148 Redfish Power Off stack_mode=skip 149 150 Redfish BMC Reset Operation reset_type=ForceRestart 151 152 Is BMC Standby 153 154 BMC Execute Command if [ -f ${test_file_path} ] ; then false ; fi 155 Verify BMC RTC And UTC Time Drift 156 157 # Check for journald persistency post reboot. 158 Wait Until Keyword Succeeds 3 min 10 sec 159 ... Check For Regex In Journald ${REBOOT_REGEX} error_check=${1} 160 161 162Verify Boot Count After BMC Reboot 163 [Documentation] Verify boot count increments on BMC reboot. 164 [Tags] Verify_Boot_Count_After_BMC_Reboot 165 166 Set BMC Boot Count ${0} 167 Redfish OBMC Reboot (off) 168 ${boot_count}= Get BMC Boot Count 169 Should Be Equal ${boot_count} ${1} msg=Boot count is not incremented. 170 171 172Redfish BMC Manager GracefulRestart When Host Booted 173 [Documentation] BMC graceful restart when host is running. 174 [Tags] Redfish_BMC_Manager_GracefulRestart_When_Host_Booted 175 176 Redfish OBMC Reboot (run) 177 178 # TODO: Replace OCC state check with redfish property when available. 179 Verify OCC State 180 181 182*** Keywords *** 183 184Test Setup Execution 185 [Documentation] Do test case setup tasks. 186 187 redfish.Login 188 189 190Test Teardown Execution 191 [Documentation] Do the post test teardown. 192 193 FFDC On Test Case Fail 194 Run Keyword And Ignore Error redfish.Logout 195