1b29d2e84SChris Austen*** Settings *** 20acb341bSSteven Sombar 3f60cbcfbSSteven SombarDocumentation Utilities for Robot keywords that use REST. 40acb341bSSteven Sombar 5839a0c27SSandhya SomashekarResource ../lib/resource.robot 6b29d2e84SChris AustenResource ../lib/rest_client.robot 75e870cd2SGeorge KeishingResource ../lib/connection_client.robot 8d1f45f23SRahul MaheshwariResource ../lib/boot_utils.robot 9f60cbcfbSSteven SombarResource ../lib/common_utils.robot 10c0701106SGeorge KeishingResource ../lib/bmc_redfish_utils.robot 11391ba9baSMichael WalshLibrary String 1230c12fffSGeorge KeishingLibrary DateTime 1330c12fffSGeorge KeishingLibrary Process 14b29d2e84SChris AustenLibrary OperatingSystem 15a6723f27SMichael WalshLibrary gen_print.py 16aaaab222SSteven SombarLibrary gen_misc.py 17a6723f27SMichael WalshLibrary gen_robot_print.py 185f3f4144SMichael WalshLibrary gen_cmd.py 19acd110aaSSunil MLibrary gen_robot_keyword.py 20e53e47a6SMichael WalshLibrary bmc_ssh_utils.py 21fdc5ced1SMichael WalshLibrary utils.py 223581615bSCharles Paul HoferLibrary var_funcs.py 230d88ab30SSridevi RameshLibrary SCPLibrary WITH NAME scp 2461364e57SGeorge KeishingLibrary gen_robot_valid.py 2583c737b2SGeorge KeishingLibrary pldm_utils.py 26b29d2e84SChris Austen 27f60cbcfbSSteven Sombar 28b29d2e84SChris Austen*** Variables *** 290acb341bSSteven Sombar 30b29d2e84SChris Austen${SYSTEM_SHUTDOWN_TIME} ${5} 310acb341bSSteven Sombar 32a6723f27SMichael Walsh# Assign default value to QUIET for programs which may not define it. 33a6723f27SMichael Walsh${QUIET} ${0} 340acb341bSSteven Sombar 351699d375SSridevi Ramesh${HOST_SETTING} ${SETTINGS_URI}host0 360acb341bSSteven Sombar 37c972d4d6SMichael Walsh${boot_prog_method} ${EMPTY} 38fdc5ced1SMichael Walsh${power_policy_setup} ${0} 39fdc5ced1SMichael Walsh${bmc_power_policy_method} ${EMPTY} 4013d84bf7SSridevi Ramesh@{BOOT_PROGRESS_STATES} SystemHardwareInitializationComplete OSBootStarted OSRunning 41fdc5ced1SMichael Walsh 42fd0f91b1SSushil Singh${REDFISH_SYS_STATE_WAIT_TIMEOUT} 120 Seconds 430d88ab30SSridevi Ramesh 44b29d2e84SChris Austen*** Keywords *** 451699d375SSridevi Ramesh 460acb341bSSteven Sombar 475e870cd2SGeorge KeishingVerify Ping and REST Authentication 48f4a807bfSJoy Onyerikwu [Documentation] Verify ping and rest authentication. 495e870cd2SGeorge Keishing ${l_ping}= Run Keyword And Return Status 505e870cd2SGeorge Keishing ... Ping Host ${OPENBMC_HOST} 51c4d3dc0bSGeorge Keishing Run Keyword If '${l_ping}' == '${False}' 52c4d3dc0bSGeorge Keishing ... Fail msg=Ping Failed 535e870cd2SGeorge Keishing 545e870cd2SGeorge Keishing ${l_rest}= Run Keyword And Return Status 555e870cd2SGeorge Keishing ... Initialize OpenBMC 56c4d3dc0bSGeorge Keishing Run Keyword If '${l_rest}' == '${False}' 57c4d3dc0bSGeorge Keishing ... Fail msg=REST Authentication Failed 585e870cd2SGeorge Keishing 595e870cd2SGeorge Keishing # Just to make sure the SSH is working for SCP 605e870cd2SGeorge Keishing Open Connection And Log In 615e870cd2SGeorge Keishing ${system} ${stderr}= Execute Command hostname return_stderr=True 625e870cd2SGeorge Keishing Should Be Empty ${stderr} 635e870cd2SGeorge Keishing 640acb341bSSteven Sombar 6590b555aaSGeorge KeishingVerify Ping SSH And Redfish Authentication 6690b555aaSGeorge Keishing [Documentation] Verify ping, SSH and redfish authentication. 6790b555aaSGeorge Keishing 6890b555aaSGeorge Keishing ${l_ping}= Run Keyword And Return Status Ping Host ${OPENBMC_HOST} 6990b555aaSGeorge Keishing Run Keyword If '${l_ping}' == '${False}' Fail msg=Ping Failed 7090b555aaSGeorge Keishing 7190b555aaSGeorge Keishing ${l_rest}= Run Keyword And Return Status Redfish.Login 7290b555aaSGeorge Keishing Run Keyword If '${l_rest}' == '${False}' Fail msg=REST Authentication Failed 7390b555aaSGeorge Keishing 7490b555aaSGeorge Keishing # Just to make sure the SSH is working. 7590b555aaSGeorge Keishing Open Connection And Log In 7690b555aaSGeorge Keishing ${system} ${stderr}= Execute Command hostname return_stderr=True 7790b555aaSGeorge Keishing Should Be Empty ${stderr} 7890b555aaSGeorge Keishing 7990b555aaSGeorge Keishing 80c4d3dc0bSGeorge KeishingCheck If BMC is Up 81c4d3dc0bSGeorge Keishing [Documentation] Wait for Host to be online. Checks every X seconds 82c4d3dc0bSGeorge Keishing ... interval for Y minutes and fails if timed out. 83c4d3dc0bSGeorge Keishing ... Default MAX timedout is 10 min, interval 10 seconds. 8438032805SGunnar Mills [Arguments] ${max_timeout}=${OPENBMC_REBOOT_TIMEOUT} min 85c4d3dc0bSGeorge Keishing ... ${interval}=10 sec 86c4d3dc0bSGeorge Keishing 870acb341bSSteven Sombar # Description of argument(s): 880acb341bSSteven Sombar # max_timeout Maximum time to wait. 890acb341bSSteven Sombar # This should be expressed in Robot Framework's time format 900acb341bSSteven Sombar # (e.g. "10 minutes"). 9116b3c7bfSGeorge Keishing # interval Interval to wait between status checks. 920acb341bSSteven Sombar # This should be expressed in Robot Framework's time format 930acb341bSSteven Sombar # (e.g. "5 seconds"). 940acb341bSSteven Sombar 95c4d3dc0bSGeorge Keishing Wait Until Keyword Succeeds 96c4d3dc0bSGeorge Keishing ... ${max_timeout} ${interval} Verify Ping and REST Authentication 97c4d3dc0bSGeorge Keishing 98b3700811SGeorge Keishing 9906ae4aabSGeorge KeishingFlush REST Sessions 10006ae4aabSGeorge Keishing [Documentation] Removes all the active session objects 10106ae4aabSGeorge Keishing Delete All Sessions 102b3700811SGeorge Keishing 1030acb341bSSteven Sombar 104e95622c8SRahul MaheshwariTrigger Host Watchdog Error 10537cfa6b0SGeorge Keishing [Documentation] Inject host watchdog timeout error via REST. 106e95622c8SRahul Maheshwari [Arguments] ${milliseconds}=1000 ${sleep_time}=5s 1070acb341bSSteven Sombar 108b5839d00SMichael Walsh # Description of argument(s): 109b5839d00SMichael Walsh # milliseconds The time watchdog timer value in milliseconds (e.g. 1000 = 110b5839d00SMichael Walsh # 1 second). 111e95622c8SRahul Maheshwari # sleep_time Time delay for host watchdog error to get injected. 112e95622c8SRahul Maheshwari # Default is 5 seconds. 113e95622c8SRahul Maheshwari 1144ffd1a10SMichael Walsh ${data}= Create Dictionary 1154ffd1a10SMichael Walsh ... data=xyz.openbmc_project.State.Watchdog.Action.PowerCycle 1164ffd1a10SMichael Walsh ${status} ${result}= Run Keyword And Ignore Error 1174ffd1a10SMichael Walsh ... Read Attribute ${HOST_WATCHDOG_URI} ExpireAction 1184ffd1a10SMichael Walsh Run Keyword If '${status}' == 'PASS' 1194ffd1a10SMichael Walsh ... Write Attribute ${HOST_WATCHDOG_URI} ExpireAction data=${data} 12037cfa6b0SGeorge Keishing 121eadeef0cSSridevi Ramesh ${int_milliseconds}= Convert To Integer ${milliseconds} 122eadeef0cSSridevi Ramesh ${data}= Create Dictionary data=${int_milliseconds} 1234ffd1a10SMichael Walsh Write Attribute ${HOST_WATCHDOG_URI} Interval data=${data} 1244ffd1a10SMichael Walsh 1254ffd1a10SMichael Walsh ${data}= Create Dictionary data=${True} 1264ffd1a10SMichael Walsh Write Attribute ${HOST_WATCHDOG_URI} Enabled data=${data} 12737cfa6b0SGeorge Keishing 128e95622c8SRahul Maheshwari Sleep ${sleep_time} 129ae7c2281SPrashanth Katti 1300acb341bSSteven Sombar 131ae7c2281SPrashanth KattiLogin To OS Host 1320acb341bSSteven Sombar [Documentation] Login to OS Host and return the Login response code. 133ae7c2281SPrashanth Katti [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} 134ae7c2281SPrashanth Katti ... ${os_password}=${OS_PASSWORD} 1350acb341bSSteven Sombar 13628e403b8SGunnar Mills # Description of arguments: 137ae7c2281SPrashanth Katti # ${os_host} IP address of the OS Host. 138ae7c2281SPrashanth Katti # ${os_username} OS Host Login user name. 139ae7c2281SPrashanth Katti # ${os_password} OS Host Login passwrd. 140ae7c2281SPrashanth Katti 1411856d33bSGeorge Keishing Redfish Power On stack_mode=skip quiet=1 142ae7c2281SPrashanth Katti 1433f223b8bSGeorge Keishing SSHLibrary.Open Connection ${os_host} 144e0030885SGeorge Keishing ${resp}= SSHLibrary.Login ${os_username} ${os_password} 145ea36b415SSridevi Ramesh [Return] ${resp} 146884ee064SPrashanth Katti 1470acb341bSSteven Sombar 148f60cbcfbSSteven SombarInitiate Auto Reboot 149f60cbcfbSSteven Sombar [Documentation] Initiate an auto reboot. 150f60cbcfbSSteven Sombar [Arguments] ${milliseconds}=5000 151e5a9fc73SSweta Potthuri 152e5a9fc73SSweta Potthuri # Description of argument(s): 153f60cbcfbSSteven Sombar # milliseconds The number of milliseconds for the watchdog timer. 154e5a9fc73SSweta Potthuri 155f60cbcfbSSteven Sombar # Set the auto reboot policy. 156f60cbcfbSSteven Sombar Set Auto Reboot ${1} 157f60cbcfbSSteven Sombar # Set the watchdog timer. 158f60cbcfbSSteven Sombar Trigger Host Watchdog Error ${milliseconds} 159f60cbcfbSSteven Sombar 160f60cbcfbSSteven Sombar 161f60cbcfbSSteven SombarInitiate OS Host Reboot 162f60cbcfbSSteven Sombar [Documentation] Initiate an OS reboot. 163f60cbcfbSSteven Sombar [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} 164f60cbcfbSSteven Sombar ... ${os_password}=${OS_PASSWORD} 165f60cbcfbSSteven Sombar 166f60cbcfbSSteven Sombar # Description of argument(s): 167f60cbcfbSSteven Sombar # os_host The host name or IP address of the OS. 168f60cbcfbSSteven Sombar # os_username The username to be used to sign in to the OS. 169f60cbcfbSSteven Sombar # os_password The password to be used to sign in to the OS. 170f60cbcfbSSteven Sombar 171f60cbcfbSSteven Sombar ${cmd_buf}= Run Keyword If '${os_username}' == 'root' 172f60cbcfbSSteven Sombar ... Set Variable reboot 173f60cbcfbSSteven Sombar ... ELSE 174f60cbcfbSSteven Sombar ... Set Variable echo ${os_password} | sudo -S reboot 175f60cbcfbSSteven Sombar 176f60cbcfbSSteven Sombar ${output} ${stderr} ${rc}= OS Execute Command 177f60cbcfbSSteven Sombar ... ${cmd_buf} fork=${1} 178f60cbcfbSSteven Sombar 179f60cbcfbSSteven Sombar 180f60cbcfbSSteven SombarInitiate OS Host Power Off 181f60cbcfbSSteven Sombar [Documentation] Initiate an OS reboot. 182f60cbcfbSSteven Sombar [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} 183f60cbcfbSSteven Sombar ... ${os_password}=${OS_PASSWORD} ${hard}=${0} 184f60cbcfbSSteven Sombar 185f60cbcfbSSteven Sombar # Description of argument(s): 186f60cbcfbSSteven Sombar # os_host The DNS name or IP of the OS. 187f60cbcfbSSteven Sombar # os_username The username to be used to sign in to the OS. 188f60cbcfbSSteven Sombar # os_password The password to be used to sign in to the OS. 189f60cbcfbSSteven Sombar # hard Indicates whether to do a hard vs. soft power off. 190f60cbcfbSSteven Sombar 191f60cbcfbSSteven Sombar ${time_string}= Run Keyword If ${hard} Set Variable ${SPACE}now 192f60cbcfbSSteven Sombar ... ELSE Set Variable ${EMPTY} 193f60cbcfbSSteven Sombar 194f60cbcfbSSteven Sombar ${cmd_buf}= Run Keyword If '${os_username}' == 'root' 195f60cbcfbSSteven Sombar ... Set Variable shutdown${time_string} 196f60cbcfbSSteven Sombar ... ELSE 197f60cbcfbSSteven Sombar ... Set Variable echo ${os_password} | sudo -S shutdown${time_string} 198f60cbcfbSSteven Sombar 199f60cbcfbSSteven Sombar ${output} ${stderr} ${rc}= OS Execute Command 200f60cbcfbSSteven Sombar ... ${cmd_buf} fork=${1} 201e5a9fc73SSweta Potthuri 2023987a1e0SGeorge Keishing 2035f3af44aSSteven SombarSet System LED State 2045f3af44aSSteven Sombar [Documentation] Set given system LED via REST. 2055f3af44aSSteven Sombar [Arguments] ${led_name} ${led_state} 2065f3af44aSSteven Sombar # Description of argument(s): 2075f3af44aSSteven Sombar # led_name System LED name (e.g. heartbeat, identify, beep). 2085f3af44aSSteven Sombar # led_state LED state to be set (e.g. On, Off). 2095f3af44aSSteven Sombar 2105f3af44aSSteven Sombar ${args}= Create Dictionary 2115f3af44aSSteven Sombar ... data=xyz.openbmc_project.Led.Physical.Action.${led_state} 2125f3af44aSSteven Sombar Write Attribute ${LED_PHYSICAL_URI}${led_name} State data=${args} 2135f3af44aSSteven Sombar 2145f3af44aSSteven Sombar Verify LED State ${led_name} ${led_state} 2155f3af44aSSteven Sombar 2165f3af44aSSteven Sombar 217aaf72c46SSteven SombarRead Turbo Setting Via REST 218aaf72c46SSteven Sombar [Documentation] Return turbo setting via REST. 219ea79a49aSSteven Sombar # Returns 1 if TurboAllowed, 0 if not. 220aaf72c46SSteven Sombar 221ea79a49aSSteven Sombar ${turbo_setting}= Read Attribute 222ea79a49aSSteven Sombar ... ${CONTROL_HOST_URI}turbo_allowed TurboAllowed 223ea79a49aSSteven Sombar [Return] ${turbo_setting} 224ea79a49aSSteven Sombar 225aaf72c46SSteven Sombar 226aaf72c46SSteven SombarSet Turbo Setting Via REST 227aaf72c46SSteven Sombar [Documentation] Set turbo setting via REST. 22880bc8590SSteven Sombar [Arguments] ${setting} ${verify}=${False} 2290acb341bSSteven Sombar 230aaf72c46SSteven Sombar # Description of argument(s): 23180bc8590SSteven Sombar # setting State to set TurboAllowed, 1=allowed, 0=not allowed. 23280bc8590SSteven Sombar # verify If True, read the TurboAllowed setting to confirm. 233aaf72c46SSteven Sombar 234ea79a49aSSteven Sombar ${data}= Create Dictionary data=${${setting}} 235ea79a49aSSteven Sombar Write Attribute ${CONTROL_HOST_URI}turbo_allowed TurboAllowed 23680bc8590SSteven Sombar ... verify=${verify} data=${data} 237ef74a8c8SGeorge Keishing 2380acb341bSSteven Sombar 239f60cbcfbSSteven SombarSet REST Logging Policy 240f60cbcfbSSteven Sombar [Documentation] Enable or disable REST logging setting. 241f60cbcfbSSteven Sombar [Arguments] ${policy_setting}=${True} 242ef74a8c8SGeorge Keishing 243ef74a8c8SGeorge Keishing # Description of argument(s): 244f60cbcfbSSteven Sombar # policy_setting The policy setting value which can be either 245f60cbcfbSSteven Sombar # True or False. 246ef74a8c8SGeorge Keishing 247f60cbcfbSSteven Sombar ${log_dict}= Create Dictionary data=${policy_setting} 248df3e65fbSGeorge Keishing Write Attribute ${BMC_LOGGING_URI}rest_api_logs Enabled 249f60cbcfbSSteven Sombar ... data=${log_dict} verify=${1} expected_value=${policy_setting} 2500d88ab30SSridevi Ramesh 2510acb341bSSteven Sombar 252f60cbcfbSSteven SombarOld Get Boot Progress 253f60cbcfbSSteven Sombar [Documentation] Get the boot progress the old way (via org location). 254f60cbcfbSSteven Sombar [Arguments] ${quiet}=${QUIET} 255034902d5SGeorge Keishing 256034902d5SGeorge Keishing # Description of argument(s): 257f60cbcfbSSteven Sombar # quiet Indicates whether this keyword should run without any output to 258f60cbcfbSSteven Sombar # the console. 259f60cbcfbSSteven Sombar 260f60cbcfbSSteven Sombar ${state}= Read Attribute ${OPENBMC_BASE_URI}sensors/host/BootProgress 261f60cbcfbSSteven Sombar ... value quiet=${quiet} 262f60cbcfbSSteven Sombar 263f60cbcfbSSteven Sombar [Return] ${state} 264f60cbcfbSSteven Sombar 265f60cbcfbSSteven Sombar 266f60cbcfbSSteven SombarSet Boot Progress Method 267f60cbcfbSSteven Sombar [Documentation] Set the boot_prog_method to either 'Old' or 'New'. 268f60cbcfbSSteven Sombar 269f60cbcfbSSteven Sombar # The boot progress data has moved from an 'org' location to an 'xyz' 270f60cbcfbSSteven Sombar # location. This keyword will determine whether the new method of getting 271f60cbcfbSSteven Sombar # the boot progress is valid and will set the global boot_prog_method 272f60cbcfbSSteven Sombar # variable accordingly. If boot_prog_method is already set (either by a 273f60cbcfbSSteven Sombar # prior call to this function or via a -v parm), this keyword will simply 274f60cbcfbSSteven Sombar # return. 275f60cbcfbSSteven Sombar 276f60cbcfbSSteven Sombar # Note: There are interim builds that contain boot_progress in both the 277f60cbcfbSSteven Sombar # old and the new location values. It is nearly impossible for this 278f60cbcfbSSteven Sombar # keyword to determine whether the old boot_progress or the new one is 279f60cbcfbSSteven Sombar # active. When using such builds where the old boot_progress is active, 280f60cbcfbSSteven Sombar # the only recourse users will have is that they may specify 281f60cbcfbSSteven Sombar # -v boot_prog_method:Old to force old behavior on such builds. 282f60cbcfbSSteven Sombar 283f60cbcfbSSteven Sombar Run Keyword If '${boot_prog_method}' != '${EMPTY}' Return From Keyword 284f60cbcfbSSteven Sombar 285f60cbcfbSSteven Sombar ${new_status} ${new_value}= Run Keyword And Ignore Error 286f60cbcfbSSteven Sombar ... New Get Boot Progress 287f60cbcfbSSteven Sombar # If the new style read fails, the method must necessarily be "Old". 288f60cbcfbSSteven Sombar Run Keyword If '${new_status}' == 'PASS' 289f60cbcfbSSteven Sombar ... Run Keywords 290f60cbcfbSSteven Sombar ... Set Global Variable ${boot_prog_method} New AND 291f60cbcfbSSteven Sombar ... Rqpvars boot_prog_method AND 292f60cbcfbSSteven Sombar ... Return From Keyword 293f60cbcfbSSteven Sombar 294f60cbcfbSSteven Sombar # Default method is "Old". 295f60cbcfbSSteven Sombar Set Global Variable ${boot_prog_method} Old 296f60cbcfbSSteven Sombar Rqpvars boot_prog_method 297f60cbcfbSSteven Sombar 298f60cbcfbSSteven Sombar 299f60cbcfbSSteven SombarInitiate Power On 300f60cbcfbSSteven Sombar [Documentation] Initiates the power on and waits until the Is Power On 301f60cbcfbSSteven Sombar ... keyword returns that the power state has switched to on. 302f60cbcfbSSteven Sombar [Arguments] ${wait}=${1} 303f60cbcfbSSteven Sombar 304f60cbcfbSSteven Sombar # Description of argument(s): 305f60cbcfbSSteven Sombar # wait Indicates whether to wait for a powered on state after issuing 306f60cbcfbSSteven Sombar # the power on command. 307f60cbcfbSSteven Sombar 308f60cbcfbSSteven Sombar @{arglist}= Create List 309f60cbcfbSSteven Sombar ${args}= Create Dictionary data=@{arglist} 310f60cbcfbSSteven Sombar ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ powerOn 311f60cbcfbSSteven Sombar ... data=${args} 312f60cbcfbSSteven Sombar should be equal as strings ${resp.status_code} ${HTTP_OK} 313f60cbcfbSSteven Sombar 314f60cbcfbSSteven Sombar # Does caller want to wait for power on status? 315f60cbcfbSSteven Sombar Run Keyword If '${wait}' == '${0}' Return From Keyword 316f60cbcfbSSteven Sombar Wait Until Keyword Succeeds 3 min 10 sec Is Power On 317f60cbcfbSSteven Sombar 318f60cbcfbSSteven Sombar 319f60cbcfbSSteven SombarInitiate Power Off 320f60cbcfbSSteven Sombar [Documentation] Initiates the power off and waits until the Is Power Off 321f60cbcfbSSteven Sombar ... keyword returns that the power state has switched to off. 322f60cbcfbSSteven Sombar 323f60cbcfbSSteven Sombar @{arglist}= Create List 324f60cbcfbSSteven Sombar ${args}= Create Dictionary data=@{arglist} 325f60cbcfbSSteven Sombar ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ powerOff 326f60cbcfbSSteven Sombar ... data=${args} 327f60cbcfbSSteven Sombar should be equal as strings ${resp.status_code} ${HTTP_OK} 328f60cbcfbSSteven Sombar Wait Until Keyword Succeeds 1 min 10 sec Is Power Off 329f60cbcfbSSteven Sombar 330f60cbcfbSSteven Sombar 331f60cbcfbSSteven SombarGet Boot Progress 332f60cbcfbSSteven Sombar [Documentation] Get the boot progress and return it. 333f60cbcfbSSteven Sombar [Arguments] ${quiet}=${QUIET} 334f60cbcfbSSteven Sombar 335f60cbcfbSSteven Sombar # Description of argument(s): 336f60cbcfbSSteven Sombar # quiet Indicates whether this keyword should run without any output to 337f60cbcfbSSteven Sombar # the console. 338f60cbcfbSSteven Sombar 339f60cbcfbSSteven Sombar Set Boot Progress Method 340f60cbcfbSSteven Sombar ${state}= Run Keyword If '${boot_prog_method}' == 'New' 341f60cbcfbSSteven Sombar ... New Get Boot Progress quiet=${quiet} 342f60cbcfbSSteven Sombar ... ELSE 343f60cbcfbSSteven Sombar ... Old Get Boot Progress quiet=${quiet} 344f60cbcfbSSteven Sombar 345f60cbcfbSSteven Sombar [Return] ${state} 346f60cbcfbSSteven Sombar 347f60cbcfbSSteven Sombar 348f60cbcfbSSteven SombarNew Get Boot Progress 349f60cbcfbSSteven Sombar [Documentation] Get the boot progress the new way (via xyz location). 350f60cbcfbSSteven Sombar [Arguments] ${quiet}=${QUIET} 351f60cbcfbSSteven Sombar 352f60cbcfbSSteven Sombar # Description of argument(s): 353f60cbcfbSSteven Sombar # quiet Indicates whether this keyword should run without any output to 354f60cbcfbSSteven Sombar # the console. 355f60cbcfbSSteven Sombar 356f60cbcfbSSteven Sombar ${state}= Read Attribute ${HOST_STATE_URI} BootProgress quiet=${quiet} 357f60cbcfbSSteven Sombar 358f60cbcfbSSteven Sombar [Return] ${state.rsplit('.', 1)[1]} 359f60cbcfbSSteven Sombar 360f60cbcfbSSteven Sombar 361f60cbcfbSSteven SombarNew Get Power Policy 362f60cbcfbSSteven Sombar [Documentation] Returns the BMC power policy (new method). 363f60cbcfbSSteven Sombar ${currentPolicy}= Read Attribute ${POWER_RESTORE_URI} PowerRestorePolicy 364f60cbcfbSSteven Sombar 365f60cbcfbSSteven Sombar [Return] ${currentPolicy} 366f60cbcfbSSteven Sombar 367f60cbcfbSSteven Sombar 368f60cbcfbSSteven SombarOld Get Power Policy 369f60cbcfbSSteven Sombar [Documentation] Returns the BMC power policy (old method). 370f60cbcfbSSteven Sombar ${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy 371f60cbcfbSSteven Sombar 372f60cbcfbSSteven Sombar [Return] ${currentPolicy} 373f60cbcfbSSteven Sombar 374f60cbcfbSSteven Sombar 375a54e06f5SGeorge KeishingRedfish Get Power Restore Policy 376a54e06f5SGeorge Keishing [Documentation] Returns the BMC power restore policy. 377a54e06f5SGeorge Keishing 378*c32434a3SYi Hu ${power_restore_policy}= Redfish.Get Attribute /redfish/v1/Systems/${SYSTEM_ID} PowerRestorePolicy 379a54e06f5SGeorge Keishing [Return] ${power_restore_policy} 380a54e06f5SGeorge Keishing 381f60cbcfbSSteven SombarGet Auto Reboot 382f60cbcfbSSteven Sombar [Documentation] Returns auto reboot setting. 383f60cbcfbSSteven Sombar ${setting}= Read Attribute ${CONTROL_HOST_URI}/auto_reboot AutoReboot 384f60cbcfbSSteven Sombar 385f60cbcfbSSteven Sombar [Return] ${setting} 386f60cbcfbSSteven Sombar 387f60cbcfbSSteven Sombar 388c8a6dd2aSGeorge KeishingRedfish Get Auto Reboot 389c8a6dd2aSGeorge Keishing [Documentation] Returns auto reboot setting. 390c8a6dd2aSGeorge Keishing 391*c32434a3SYi Hu ${resp}= Redfish.Get Attribute /redfish/v1/Systems/${SYSTEM_ID} Boot 392a8cb28d7SGeorge Keishing [Return] ${resp["AutomaticRetryConfig"]} 393c8a6dd2aSGeorge Keishing 394c8a6dd2aSGeorge Keishing 395f60cbcfbSSteven SombarTrigger Warm Reset 396f60cbcfbSSteven Sombar [Documentation] Initiate a warm reset. 397f60cbcfbSSteven Sombar 398f60cbcfbSSteven Sombar log to console "Triggering warm reset" 399f60cbcfbSSteven Sombar ${data}= create dictionary data=@{EMPTY} 400fbd67007SGeorge Keishing ${resp}= Openbmc Post Request 401f60cbcfbSSteven Sombar ... ${OPENBMC_BASE_URI}control/bmc0/action/warmReset data=${data} 402f60cbcfbSSteven Sombar Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} 403f60cbcfbSSteven Sombar ${session_active}= Check If warmReset is Initiated 404f60cbcfbSSteven Sombar Run Keyword If '${session_active}' == '${True}' 405f60cbcfbSSteven Sombar ... Fail msg=warm reset didn't occur 406f60cbcfbSSteven Sombar 407f60cbcfbSSteven Sombar Sleep ${SYSTEM_SHUTDOWN_TIME}min 408f60cbcfbSSteven Sombar Check If BMC Is Up 409f60cbcfbSSteven Sombar 410f60cbcfbSSteven Sombar 411f60cbcfbSSteven SombarGet Power State 412f60cbcfbSSteven Sombar [Documentation] Returns the power state as an integer. Either 0 or 1. 413f60cbcfbSSteven Sombar [Arguments] ${quiet}=${QUIET} 414f60cbcfbSSteven Sombar 415f60cbcfbSSteven Sombar # Description of argument(s): 416f60cbcfbSSteven Sombar # quiet Indicates whether this keyword should run without any output to 417f60cbcfbSSteven Sombar # the console. 418f60cbcfbSSteven Sombar 419f60cbcfbSSteven Sombar @{arglist}= Create List 420f60cbcfbSSteven Sombar ${args}= Create Dictionary data=@{arglist} 421f60cbcfbSSteven Sombar 422f60cbcfbSSteven Sombar ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ getPowerState 423f60cbcfbSSteven Sombar ... data=${args} quiet=${quiet} 424f60cbcfbSSteven Sombar Should be equal as strings ${resp.status_code} ${HTTP_OK} 425f60cbcfbSSteven Sombar 426fbd67007SGeorge Keishing [Return] ${resp.json()["data"]} 427f60cbcfbSSteven Sombar 428f60cbcfbSSteven Sombar 429f60cbcfbSSteven SombarClear BMC Gard Record 430f60cbcfbSSteven Sombar [Documentation] Clear gard records from the system. 431f60cbcfbSSteven Sombar 432f60cbcfbSSteven Sombar @{arglist}= Create List 433f60cbcfbSSteven Sombar ${args}= Create Dictionary data=@{arglist} 434f60cbcfbSSteven Sombar ${resp}= Call Method 435f60cbcfbSSteven Sombar ... ${OPENPOWER_CONTROL}gard Reset data=${args} 436f60cbcfbSSteven Sombar Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} 437f60cbcfbSSteven Sombar 438f60cbcfbSSteven Sombar 439f60cbcfbSSteven SombarFlash PNOR 440f60cbcfbSSteven Sombar [Documentation] Calls flash bios update method to flash PNOR image 441f60cbcfbSSteven Sombar [Arguments] ${pnor_image} 442f60cbcfbSSteven Sombar 443f60cbcfbSSteven Sombar # Description of argument(s): 444f60cbcfbSSteven Sombar # pnor_image The filename and path of the PNOR image 445f60cbcfbSSteven Sombar # (e.g. "/home/image/zaius.pnor"). 446f60cbcfbSSteven Sombar 447f60cbcfbSSteven Sombar @{arglist}= Create List ${pnor_image} 448f60cbcfbSSteven Sombar ${args}= Create Dictionary data=@{arglist} 449f60cbcfbSSteven Sombar ${resp}= Call Method /org/openbmc/control/flash/bios/ update 450f60cbcfbSSteven Sombar ... data=${args} 451f60cbcfbSSteven Sombar should be equal as strings ${resp.status_code} ${HTTP_OK} 452f60cbcfbSSteven Sombar Wait Until Keyword Succeeds 2 min 10 sec Is PNOR Flashing 453f60cbcfbSSteven Sombar 454f60cbcfbSSteven Sombar 455f60cbcfbSSteven SombarGet Flash BIOS Status 456f60cbcfbSSteven Sombar [Documentation] Returns the status of the flash BIOS API as a string. For 457f60cbcfbSSteven Sombar ... example 'Flashing', 'Flash Done', etc 458f60cbcfbSSteven Sombar ${data}= Read Properties /org/openbmc/control/flash/bios 459f60cbcfbSSteven Sombar [Return] ${data['status']} 460f60cbcfbSSteven Sombar 461f60cbcfbSSteven Sombar 462f60cbcfbSSteven SombarIs PNOR Flashing 463f60cbcfbSSteven Sombar [Documentation] Get BIOS 'Flashing' status. This indicates that PNOR 464f60cbcfbSSteven Sombar ... flashing has started. 465f60cbcfbSSteven Sombar ${status}= Get Flash BIOS Status 466f60cbcfbSSteven Sombar Should Contain ${status} Flashing 467f60cbcfbSSteven Sombar 468f60cbcfbSSteven Sombar 469f60cbcfbSSteven SombarIs PNOR Flash Done 470f60cbcfbSSteven Sombar [Documentation] Get BIOS 'Flash Done' status. This indicates that the 471f60cbcfbSSteven Sombar ... PNOR flashing has completed. 472f60cbcfbSSteven Sombar ${status}= Get Flash BIOS Status 473f60cbcfbSSteven Sombar should be equal as strings ${status} Flash Done 474f60cbcfbSSteven Sombar 475f60cbcfbSSteven Sombar 476f60cbcfbSSteven SombarCreate OS Console File Path 477f60cbcfbSSteven Sombar [Documentation] Create OS console file path name and return it. 478f60cbcfbSSteven Sombar [Arguments] ${log_file_path}=${EMPTY} 479f60cbcfbSSteven Sombar 480f60cbcfbSSteven Sombar # Description of arguments: 481f60cbcfbSSteven Sombar # file_path The caller's candidate value. If this value is ${EMPTY}, this 482f60cbcfbSSteven Sombar # keyword will compose a file path name. Otherwise, this 483f60cbcfbSSteven Sombar # keyword will use the caller's file_path value. In either 484f60cbcfbSSteven Sombar # case, the value will be returned. 485f60cbcfbSSteven Sombar 486f60cbcfbSSteven Sombar ${status}= Run Keyword And Return Status Variable Should Exist 487f60cbcfbSSteven Sombar ... ${TEST_NAME} 488f60cbcfbSSteven Sombar 489f60cbcfbSSteven Sombar ${default_file_path}= Set Variable If ${status} == ${TRUE} 4909161b101SGeorge Keishing ... ${EXECDIR}${/}tmp${/}${OPENBMC_HOST}_${TEST_NAME.replace(' ', '')}_os_console.txt 4919161b101SGeorge Keishing ... ${EXECDIR}${/}tmp${/}${OPENBMC_HOST}_os_console.txt 492f60cbcfbSSteven Sombar 493f60cbcfbSSteven Sombar ${log_file_path}= Set Variable If '${log_file_path}' == '${EMPTY}' 494f60cbcfbSSteven Sombar ... ${default_file_path} ${log_file_path} 495f60cbcfbSSteven Sombar 496f60cbcfbSSteven Sombar [Return] ${log_file_path} 497f60cbcfbSSteven Sombar 498f60cbcfbSSteven Sombar 499f60cbcfbSSteven SombarGet Endpoint Paths 500f60cbcfbSSteven Sombar [Documentation] Returns all url paths ending with given endpoint 501f60cbcfbSSteven Sombar ... Example: 502f60cbcfbSSteven Sombar ... Given the following endpoint: cpu 503f60cbcfbSSteven Sombar ... This keyword will return: list of all urls ending with 504f60cbcfbSSteven Sombar ... cpu - 505f60cbcfbSSteven Sombar ... /org/openbmc/inventory/system/chassis/motherboard/cpu0, 506f60cbcfbSSteven Sombar ... /org/openbmc/inventory/system/chassis/motherboard/cpu1 507f60cbcfbSSteven Sombar [Arguments] ${path} ${endpoint} 508f60cbcfbSSteven Sombar 509f60cbcfbSSteven Sombar # Description of arguments: 510f60cbcfbSSteven Sombar # path URL path for enumeration. 511f60cbcfbSSteven Sombar # endpoint Endpoint string (url path ending). 512f60cbcfbSSteven Sombar 513aaaab222SSteven Sombar # Make sure path ends with slash. 514aaaab222SSteven Sombar ${path}= Add Trailing Slash ${path} 515aaaab222SSteven Sombar 516aaaab222SSteven Sombar ${resp}= Read Properties ${path}enumerate timeout=30 517f60cbcfbSSteven Sombar Log Dictionary ${resp} 518f60cbcfbSSteven Sombar 519f60cbcfbSSteven Sombar ${list}= Get Dictionary Keys ${resp} 520f60cbcfbSSteven Sombar # For a given string, look for prefix and suffix for matching expression. 521f60cbcfbSSteven Sombar # Start of string followed by zero or more of any character followed by 522f60cbcfbSSteven Sombar # any digit or lower case character. 523585afa3bSGeorge Keishing ${resp}= Get Matches ${list} regexp=^.*[0-9a-z_].${endpoint}\[_0-9a-z]*$ case_insensitive=${True} 524f60cbcfbSSteven Sombar 525f60cbcfbSSteven Sombar [Return] ${resp} 526f60cbcfbSSteven Sombar 527f60cbcfbSSteven Sombar 528f60cbcfbSSteven SombarSet BMC Power Policy 529f60cbcfbSSteven Sombar [Documentation] Set the given BMC power policy. 530f60cbcfbSSteven Sombar [Arguments] ${policy} 531f60cbcfbSSteven Sombar 532f60cbcfbSSteven Sombar # Note that this function will translate the old style "RESTORE_LAST_STATE" 533f60cbcfbSSteven Sombar # policy to the new style "xyz.openbmc_project.Control.Power.RestorePolicy. 534f60cbcfbSSteven Sombar # Policy.Restore" for you. 535f60cbcfbSSteven Sombar 536f60cbcfbSSteven Sombar # Description of argument(s): 537f60cbcfbSSteven Sombar # policy Power restore policy (e.g "RESTORE_LAST_STATE", 538f60cbcfbSSteven Sombar # ${RESTORE_LAST_STATE}). 539f60cbcfbSSteven Sombar 540f60cbcfbSSteven Sombar # Set the bmc_power_policy_method to either 'Old' or 'New'. 541f60cbcfbSSteven Sombar Set Power Policy Method 542f60cbcfbSSteven Sombar # This translation helps bridge between old and new method for calling. 543f60cbcfbSSteven Sombar ${policy}= Translate Power Policy Value ${policy} 544f60cbcfbSSteven Sombar # Run the appropriate keyword. 545f60cbcfbSSteven Sombar Run Key ${bmc_power_policy_method} Set Power Policy \ ${policy} 546f60cbcfbSSteven Sombar ${currentPolicy}= Get System Power Policy 547f60cbcfbSSteven Sombar Should Be Equal ${currentPolicy} ${policy} 548f60cbcfbSSteven Sombar 549f60cbcfbSSteven Sombar 550f60cbcfbSSteven SombarDelete Error Logs 551f60cbcfbSSteven Sombar [Documentation] Delete error logs. 552cc490b41SMichael Shepos [Arguments] ${quiet}=${0} 553cc490b41SMichael Shepos # Description of argument(s): 554cc490b41SMichael Shepos # quiet If enabled, turns off logging to console. 555f60cbcfbSSteven Sombar 556f60cbcfbSSteven Sombar # Check if error logs entries exist, if not return. 557a8800da7SSteven Sombar ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}list quiet=${1} 558f60cbcfbSSteven Sombar Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND} 559f60cbcfbSSteven Sombar 560f60cbcfbSSteven Sombar # Get the list of error logs entries and delete them all. 561f60cbcfbSSteven Sombar ${elog_entries}= Get URL List ${BMC_LOGGING_ENTRY} 56279247e4fSDavid Shaw FOR ${entry} IN @{elog_entries} 563cc490b41SMichael Shepos Delete Error Log Entry ${entry} quiet=${quiet} 56479247e4fSDavid Shaw END 565f60cbcfbSSteven Sombar 566f60cbcfbSSteven Sombar 567f60cbcfbSSteven SombarDelete All Error Logs 568f60cbcfbSSteven Sombar [Documentation] Delete all error log entries using "DeleteAll" interface. 569f60cbcfbSSteven Sombar 570fbd67007SGeorge Keishing ${args}= Set Variable {"data": []} 571f60cbcfbSSteven Sombar ${resp}= Openbmc Post Request ${BMC_LOGGING_URI}action/DeleteAll 572fbd67007SGeorge Keishing ... data=${args} 573f60cbcfbSSteven Sombar Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} 574f60cbcfbSSteven Sombar 575f60cbcfbSSteven Sombar 576f60cbcfbSSteven SombarGet Elog URL List 577f60cbcfbSSteven Sombar [Documentation] Return error log entry list of URLs. 578f60cbcfbSSteven Sombar 579f60cbcfbSSteven Sombar ${url_list}= Read Properties /xyz/openbmc_project/logging/entry/ 580f60cbcfbSSteven Sombar Sort List ${url_list} 581f60cbcfbSSteven Sombar [Return] ${url_list} 582f60cbcfbSSteven Sombar 583f60cbcfbSSteven Sombar 584f60cbcfbSSteven SombarGet BMC Flash Chip Boot Side 585f60cbcfbSSteven Sombar [Documentation] Return the BMC flash chip boot side. 586034902d5SGeorge Keishing 587034902d5SGeorge Keishing # Example: 588f60cbcfbSSteven Sombar # 0 - indicates chip select is current side. 589f60cbcfbSSteven Sombar # 32 - indicates chip select is alternate side. 590034902d5SGeorge Keishing 591f60cbcfbSSteven Sombar ${boot_side} ${stderr} ${rc}= BMC Execute Command 592f60cbcfbSSteven Sombar ... cat /sys/class/watchdog/watchdog1/bootstatus 593f60cbcfbSSteven Sombar 594f60cbcfbSSteven Sombar [Return] ${boot_side} 595f60cbcfbSSteven Sombar 596f60cbcfbSSteven Sombar 5977d3af3c2SSweta PotthuriWatchdog Object Should Exist 5987d3af3c2SSweta Potthuri [Documentation] Check that watchdog object exists. 5997d3af3c2SSweta Potthuri 6007d3af3c2SSweta Potthuri ${resp}= OpenBMC Get Request ${WATCHDOG_URI}host0 6017d3af3c2SSweta Potthuri Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} 6027d3af3c2SSweta Potthuri ... msg=Expected watchdog object does not exist. 603f39022d8SSweta Potthuri 604f39022d8SSweta Potthuri 605f60cbcfbSSteven SombarGet System LED State 606f60cbcfbSSteven Sombar [Documentation] Return the state of given system LED. 607f60cbcfbSSteven Sombar [Arguments] ${led_name} 608f39022d8SSweta Potthuri 609f39022d8SSweta Potthuri # Description of argument(s): 610f60cbcfbSSteven Sombar # led_name System LED name (e.g. heartbeat, identify, beep). 611f39022d8SSweta Potthuri 612f60cbcfbSSteven Sombar ${state}= Read Attribute ${LED_PHYSICAL_URI}${led_name} State 613f60cbcfbSSteven Sombar [Return] ${state.rsplit('.', 1)[1]} 614b9f407b1SGeorge Keishing 615b9f407b1SGeorge Keishing 616f60cbcfbSSteven SombarVerify LED State 617f60cbcfbSSteven Sombar [Documentation] Checks if LED is in given state. 618f60cbcfbSSteven Sombar [Arguments] ${led_name} ${led_state} 619f60cbcfbSSteven Sombar # Description of argument(s): 620f60cbcfbSSteven Sombar # led_name System LED name (e.g. heartbeat, identify, beep). 621f60cbcfbSSteven Sombar # led_state LED state to be verified (e.g. On, Off). 622b9f407b1SGeorge Keishing 623f60cbcfbSSteven Sombar ${state}= Get System LED State ${led_name} 624f60cbcfbSSteven Sombar Should Be Equal ${state} ${led_state} 625b9f407b1SGeorge Keishing 626f60cbcfbSSteven Sombar 627f60cbcfbSSteven SombarGet LED State XYZ 628f60cbcfbSSteven Sombar [Documentation] Returns state of given LED. 629f60cbcfbSSteven Sombar [Arguments] ${led_name} 630f60cbcfbSSteven Sombar 631f60cbcfbSSteven Sombar # Description of argument(s): 632f60cbcfbSSteven Sombar # led_name Name of LED. 633f60cbcfbSSteven Sombar 634f60cbcfbSSteven Sombar ${state}= Read Attribute ${LED_GROUPS_URI}${led_name} Asserted 635f60cbcfbSSteven Sombar # Returns the state of the LED, either On or Off. 636f60cbcfbSSteven Sombar [Return] ${state} 637b9f407b1SGeorge Keishing 63878ce8dc1SGeorge Keishing 63978ce8dc1SGeorge KeishingVerify Identify LED State 64032f7b3d3SAlvin Wang [Documentation] Verify that the identify state of the LED group matches caller's expectations. 64178ce8dc1SGeorge Keishing [Arguments] ${expected_state} 64278ce8dc1SGeorge Keishing 64378ce8dc1SGeorge Keishing # Description of argument(s): 64432f7b3d3SAlvin Wang # expected_state The expected LED asserted state (1 = asserted, 0 = not asserted). 64578ce8dc1SGeorge Keishing 64632f7b3d3SAlvin Wang ${led_state}= Get LED State XYZ enclosure_identify 64732f7b3d3SAlvin Wang Should Be Equal ${led_state} ${expected_state} msg=Unexpected LED state. 6483925503fSSweta Potthuri 6493925503fSSweta PotthuriVerify The Attribute 650f4a807bfSJoy Onyerikwu [Documentation] Verify the given attribute. 6513925503fSSweta Potthuri [Arguments] ${uri} ${attribute_name} ${attribute_value} 6523925503fSSweta Potthuri 6533925503fSSweta Potthuri # Description of argument(s): 6543925503fSSweta Potthuri # uri URI path 6553925503fSSweta Potthuri # (e.g. "/xyz/openbmc_project/control/host0/TPMEnable"). 6563925503fSSweta Potthuri # attribute_name Name of attribute to be verified (e.g. "TPMEnable"). 6573925503fSSweta Potthuri # attribute_value The expected value of attribute (e.g. "1", "0", etc.) 6583925503fSSweta Potthuri 6593925503fSSweta Potthuri ${output}= Read Attribute ${uri} ${attribute_name} 6603925503fSSweta Potthuri Should Be Equal ${attribute_value} ${output} 6613925503fSSweta Potthuri ... msg=Attribute "${attribute_name} does not have the expected value. 662cf0d7772SGeorge Keishing 663cf0d7772SGeorge Keishing 664f60cbcfbSSteven SombarNew Set Power Policy 665f60cbcfbSSteven Sombar [Documentation] Set the given BMC power policy (new method). 666f60cbcfbSSteven Sombar [Arguments] ${policy} 667cf0d7772SGeorge Keishing 668f60cbcfbSSteven Sombar # Description of argument(s): 669f60cbcfbSSteven Sombar # policy Power restore policy (e.g. ${ALWAYS_POWER_OFF}). 670f60cbcfbSSteven Sombar 671f60cbcfbSSteven Sombar ${valueDict}= Create Dictionary data=${policy} 672f60cbcfbSSteven Sombar Write Attribute 673f60cbcfbSSteven Sombar ... ${POWER_RESTORE_URI} PowerRestorePolicy data=${valueDict} 674f60cbcfbSSteven Sombar 675f60cbcfbSSteven Sombar 676f60cbcfbSSteven SombarOld Set Power Policy 677f60cbcfbSSteven Sombar [Documentation] Set the given BMC power policy (old method). 678f60cbcfbSSteven Sombar [Arguments] ${policy} 679f60cbcfbSSteven Sombar 680f60cbcfbSSteven Sombar # Description of argument(s): 681f60cbcfbSSteven Sombar # policy Power restore policy (e.g. "ALWAYS_POWER_OFF"). 682f60cbcfbSSteven Sombar 683f60cbcfbSSteven Sombar ${valueDict}= create dictionary data=${policy} 684f60cbcfbSSteven Sombar Write Attribute ${HOST_SETTING} power_policy data=${valueDict} 685f60cbcfbSSteven Sombar 686f60cbcfbSSteven Sombar 687a54e06f5SGeorge KeishingRedfish Set Power Restore Policy 688a54e06f5SGeorge Keishing [Documentation] Set the BMC power restore policy. 689a54e06f5SGeorge Keishing [Arguments] ${power_restore_policy} 690a54e06f5SGeorge Keishing 691a54e06f5SGeorge Keishing # Description of argument(s): 692a54e06f5SGeorge Keishing # power_restore_policy Power restore policy (e.g. "AlwaysOff", "AlwaysOn", "LastState"). 693a54e06f5SGeorge Keishing 694*c32434a3SYi Hu Redfish.Patch /redfish/v1/Systems/${SYSTEM_ID} body={"PowerRestorePolicy": "${power_restore_policy}"} 695a54e06f5SGeorge Keishing ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 696a54e06f5SGeorge Keishing 697a54e06f5SGeorge Keishing 6989a28860aSGeorge KeishingIPMI Set Power Restore Policy 6999a28860aSGeorge Keishing [Documentation] Set the BMC power restore policy using IPMI. 7009a28860aSGeorge Keishing [Arguments] ${power_restore_policy}=always-off 7019a28860aSGeorge Keishing 7029a28860aSGeorge Keishing # Description of argument(s): 7039a28860aSGeorge Keishing # power_restore_policy Power restore policies 7049a28860aSGeorge Keishing # always-on : turn on when power is restored 7059a28860aSGeorge Keishing # previous : return to previous state when power is restored 7069a28860aSGeorge Keishing # always-off : stay off after power is restored 7079a28860aSGeorge Keishing 7089a28860aSGeorge Keishing ${resp}= Run IPMI Standard Command chassis policy ${power_restore_policy} 7099a28860aSGeorge Keishing # Example: Set chassis power restore policy to always-off 7109a28860aSGeorge Keishing Should Contain ${resp} ${power_restore_policy} 7119a28860aSGeorge Keishing 7129a28860aSGeorge Keishing 713a5cedb3eSGeorge KeishingSet Auto Reboot Setting 714a5cedb3eSGeorge Keishing [Documentation] Set the given auto reboot setting (REST or Redfish). 715a5cedb3eSGeorge Keishing [Arguments] ${value} 716a5cedb3eSGeorge Keishing 717a5cedb3eSGeorge Keishing # Description of argument(s): 718a5cedb3eSGeorge Keishing # value The reboot setting, 1 for enabling and 0 for disabling. 719a5cedb3eSGeorge Keishing 720a5cedb3eSGeorge Keishing # This is to cater to boot call points and plugin script which will always 721a5cedb3eSGeorge Keishing # send using value 0 or 1. This dictionary maps to redfish string values. 722a5cedb3eSGeorge Keishing ${rest_redfish_dict}= Create Dictionary 723a5cedb3eSGeorge Keishing ... 1=RetryAttempts 724a5cedb3eSGeorge Keishing ... 0=Disabled 725a5cedb3eSGeorge Keishing 726e187964aSGeorge Keishing Run Keyword If ${REDFISH_SUPPORT_TRANS_STATE} == ${1} 727a5cedb3eSGeorge Keishing ... Redfish Set Auto Reboot ${rest_redfish_dict["${value}"]} 728e187964aSGeorge Keishing ... ELSE 729e187964aSGeorge Keishing ... Set Auto Reboot ${value} 730a5cedb3eSGeorge Keishing 731f60cbcfbSSteven SombarSet Auto Reboot 732f60cbcfbSSteven Sombar [Documentation] Set the given auto reboot setting. 733f60cbcfbSSteven Sombar [Arguments] ${setting} 734f60cbcfbSSteven Sombar 735f60cbcfbSSteven Sombar # Description of argument(s): 736f60cbcfbSSteven Sombar # setting The reboot setting, 1 for enabling and 0 for disabling. 737f60cbcfbSSteven Sombar 73868d72ff1SSridevi Ramesh ${valueDict}= Convert To Integer ${setting} 739f60cbcfbSSteven Sombar ${data}= Create Dictionary data=${valueDict} 740f60cbcfbSSteven Sombar Write Attribute ${CONTROL_HOST_URI}/auto_reboot AutoReboot data=${data} 741f60cbcfbSSteven Sombar ${current_setting}= Get Auto Reboot 742f60cbcfbSSteven Sombar Should Be Equal As Integers ${current_setting} ${setting} 743f60cbcfbSSteven Sombar 744f60cbcfbSSteven Sombar 745c8a6dd2aSGeorge KeishingRedfish Set Auto Reboot 746c8a6dd2aSGeorge Keishing [Documentation] Set the given auto reboot setting. 747c8a6dd2aSGeorge Keishing [Arguments] ${setting} 748c8a6dd2aSGeorge Keishing 749c8a6dd2aSGeorge Keishing # Description of argument(s): 750c8a6dd2aSGeorge Keishing # setting The reboot setting, "RetryAttempts" and "Disabled". 751c8a6dd2aSGeorge Keishing 752*c32434a3SYi Hu Redfish.Patch /redfish/v1/Systems/${SYSTEM_ID} body={"Boot": {"AutomaticRetryConfig": "${setting}"}} 753a8cb28d7SGeorge Keishing ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 754a8cb28d7SGeorge Keishing 755c8a6dd2aSGeorge Keishing ${current_setting}= Redfish Get Auto Reboot 756c8a6dd2aSGeorge Keishing Should Be Equal As Strings ${current_setting} ${setting} 757c8a6dd2aSGeorge Keishing 758c8a6dd2aSGeorge Keishing 759f60cbcfbSSteven SombarSet Control Boot Mode 760f60cbcfbSSteven Sombar [Documentation] Set given boot mode on the boot object path attribute. 761f60cbcfbSSteven Sombar [Arguments] ${boot_path} ${boot_mode} 762f60cbcfbSSteven Sombar 763f60cbcfbSSteven Sombar # Description of argument(s): 764f60cbcfbSSteven Sombar # boot_path Boot object path. 765cf0d7772SGeorge Keishing # Example: 766f60cbcfbSSteven Sombar # /xyz/openbmc_project/control/host0/boot 767f60cbcfbSSteven Sombar # /xyz/openbmc_project/control/host0/boot/one_time 768f60cbcfbSSteven Sombar # boot_mode Boot mode which need to be set. 769f60cbcfbSSteven Sombar # Example: 770f60cbcfbSSteven Sombar # "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular" 771cf0d7772SGeorge Keishing 772f60cbcfbSSteven Sombar ${valueDict}= Create Dictionary data=${boot_mode} 773f60cbcfbSSteven Sombar Write Attribute ${boot_path} BootMode data=${valueDict} 774cf0d7772SGeorge Keishing 775c5fef586SGeorge Keishing 776f60cbcfbSSteven SombarIs Power On 777f60cbcfbSSteven Sombar [Documentation] Verify that the BMC chassis state is on. 778f60cbcfbSSteven Sombar ${state}= Get Power State 779f60cbcfbSSteven Sombar Should be equal ${state} ${1} 780216e5844SGeorge Keishing 781216e5844SGeorge Keishing 782f60cbcfbSSteven SombarIs Power Off 783f60cbcfbSSteven Sombar [Documentation] Verify that the BMC chassis state is off. 784f60cbcfbSSteven Sombar ${state}= Get Power State 785f60cbcfbSSteven Sombar Should be equal ${state} ${0} 7860e3bc6daSSivas SRR 7870e3bc6daSSivas SRR 7880e3bc6daSSivas SRRCLI Get BMC DateTime 7890e3bc6daSSivas SRR [Documentation] Returns BMC date time from date command. 7900e3bc6daSSivas SRR 7910e3bc6daSSivas SRR ${bmc_time_via_date} ${stderr} ${rc}= BMC Execute Command date +"%Y-%m-%d %H:%M:%S" print_err=1 7920e3bc6daSSivas SRR [Return] ${bmc_time_via_date} 79361364e57SGeorge Keishing 79461364e57SGeorge Keishing 79561364e57SGeorge KeishingUpdate Root Password 79661364e57SGeorge Keishing [Documentation] Update system "root" user password. 79761364e57SGeorge Keishing [Arguments] ${openbmc_password}=${OPENBMC_PASSWORD} 79861364e57SGeorge Keishing 79961364e57SGeorge Keishing # Description of argument(s): 80061364e57SGeorge Keishing # openbmc_password The root password for the open BMC system. 80161364e57SGeorge Keishing 80261364e57SGeorge Keishing @{password}= Create List ${openbmc_password} 80361364e57SGeorge Keishing ${data}= Create Dictionary data=@{password} 80461364e57SGeorge Keishing 80561364e57SGeorge Keishing ${headers}= Create Dictionary Content-Type=application/json X-Auth-Token=${XAUTH_TOKEN} 806fbd67007SGeorge Keishing ${resp}= POST On Session openbmc ${BMC_USER_URI}root/action/SetPassword 80761364e57SGeorge Keishing ... data=${data} headers=${headers} 80861364e57SGeorge Keishing Valid Value resp.status_code [${HTTP_OK}] 8096624ce5dSSushil Singh 8106624ce5dSSushil Singh 8116624ce5dSSushil SinghGet Post Boot Action 8126624ce5dSSushil Singh [Documentation] Get post boot action. 8136624ce5dSSushil Singh 814879f0842SGeorge Keishing # Post code update action dictionary. 8156624ce5dSSushil Singh # 8166624ce5dSSushil Singh # { 8176624ce5dSSushil Singh # BMC image: { 8186624ce5dSSushil Singh # OnReset: Redfish OBMC Reboot (off), 8196624ce5dSSushil Singh # Immediate: Wait For Reboot start_boot_seconds=${state['epoch_seconds']} 8206624ce5dSSushil Singh # }, 8216624ce5dSSushil Singh # Host image: { 822e523fc04SGeorge Keishing # OnReset: RF SYS GracefulRestart, 8236624ce5dSSushil Singh # Immediate: Wait State os_running_match_state 10 mins 8246624ce5dSSushil Singh # } 8256624ce5dSSushil Singh # } 8266624ce5dSSushil Singh 8276624ce5dSSushil Singh ${code_base_dir_path}= Get Code Base Dir Path 8286624ce5dSSushil Singh ${post_code_update_actions}= Evaluate 8296624ce5dSSushil Singh ... json.load(open('${code_base_dir_path}data/applytime_table.json')) modules=json 8306624ce5dSSushil Singh Rprint Vars post_code_update_actions 8316624ce5dSSushil Singh 8326624ce5dSSushil Singh [Return] ${post_code_update_actions} 8336624ce5dSSushil Singh 8341eeff9c1SGeorge Keishing 8351560e652SSushil SinghGet Task State From File 8361560e652SSushil Singh [Documentation] Get task states from pre-define data/task_state.json file. 8371560e652SSushil Singh 8381560e652SSushil Singh # Example: Task state JSON format. 8391560e652SSushil Singh # 8401560e652SSushil Singh # { 8411560e652SSushil Singh # "TaskRunning": { 8421560e652SSushil Singh # "TaskState": "Running", 8431560e652SSushil Singh # "TaskStatus": "OK" 8441560e652SSushil Singh # }, 8451560e652SSushil Singh # "TaskCompleted": { 8461560e652SSushil Singh # "TaskState": "Completed", 8471560e652SSushil Singh # "TaskStatus": "OK" 8481560e652SSushil Singh # }, 8491560e652SSushil Singh # "TaskException": { 8501560e652SSushil Singh # "TaskState": "Exception", 8511560e652SSushil Singh # "TaskStatus": "Warning" 8521560e652SSushil Singh # } 8531560e652SSushil Singh # } 8541560e652SSushil Singh 8551560e652SSushil Singh # Python module: get_code_base_dir_path() 8561560e652SSushil Singh ${code_base_dir_path}= Get Code Base Dir Path 8571560e652SSushil Singh ${task_state}= Evaluate 8581560e652SSushil Singh ... json.load(open('${code_base_dir_path}data/task_state.json')) modules=json 8591560e652SSushil Singh Rprint Vars task_state 8601560e652SSushil Singh 8611560e652SSushil Singh [Return] ${task_state} 8621560e652SSushil Singh 8631560e652SSushil Singh 8641eeff9c1SGeorge KeishingRedfish Set Boot Default 8650043fc59SKonstantin Aladyshev [Documentation] Set and Verify Boot source override 8660043fc59SKonstantin Aladyshev [Arguments] ${override_enabled} ${override_target} ${override_mode}=UEFI 8671eeff9c1SGeorge Keishing 8681eeff9c1SGeorge Keishing # Description of argument(s): 8690043fc59SKonstantin Aladyshev # override_enabled Boot source override enable type. 8701eeff9c1SGeorge Keishing # ('Once', 'Continuous', 'Disabled'). 8710043fc59SKonstantin Aladyshev # override_target Boot source override target. 8721eeff9c1SGeorge Keishing # ('Pxe', 'Cd', 'Hdd', 'Diags', 'BiosSetup', 'None'). 8730043fc59SKonstantin Aladyshev # override_mode Boot source override mode (relevant only for x86 arch). 8740043fc59SKonstantin Aladyshev # ('Legacy', 'UEFI'). 8751eeff9c1SGeorge Keishing 8761eeff9c1SGeorge Keishing ${data}= Create Dictionary BootSourceOverrideEnabled=${override_enabled} 8771eeff9c1SGeorge Keishing ... BootSourceOverrideTarget=${override_target} 8780043fc59SKonstantin Aladyshev 8790043fc59SKonstantin Aladyshev Run Keyword If '${PLATFORM_ARCH_TYPE}' == 'x86' 8800043fc59SKonstantin Aladyshev ... Set To Dictionary ${data} BootSourceOverrideMode ${override_mode} 8810043fc59SKonstantin Aladyshev 8821eeff9c1SGeorge Keishing ${payload}= Create Dictionary Boot=${data} 8831eeff9c1SGeorge Keishing 884*c32434a3SYi Hu Redfish.Patch /redfish/v1/Systems/${SYSTEM_ID} body=&{payload} 8851eeff9c1SGeorge Keishing ... valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}] 8861eeff9c1SGeorge Keishing 887*c32434a3SYi Hu ${resp}= Redfish.Get Attribute /redfish/v1/Systems/${SYSTEM_ID} Boot 8881eeff9c1SGeorge Keishing Should Be Equal As Strings ${resp["BootSourceOverrideEnabled"]} ${override_enabled} 8891eeff9c1SGeorge Keishing Should Be Equal As Strings ${resp["BootSourceOverrideTarget"]} ${override_target} 8900043fc59SKonstantin Aladyshev Run Keyword If '${PLATFORM_ARCH_TYPE}' == 'x86' 8910043fc59SKonstantin Aladyshev ... Should Be Equal As Strings ${resp["BootSourceOverrideMode"]} ${override_mode} 892e187964aSGeorge Keishing 893e187964aSGeorge Keishing 894e187964aSGeorge Keishing# Redfish state keywords. 895e187964aSGeorge Keishing 896e187964aSGeorge KeishingRedfish Get BMC State 897e187964aSGeorge Keishing [Documentation] Return BMC health state. 898e187964aSGeorge Keishing 899e187964aSGeorge Keishing # "Enabled" -> BMC Ready, "Starting" -> BMC NotReady 900e187964aSGeorge Keishing 901e187964aSGeorge Keishing # Example: 902e187964aSGeorge Keishing # "Status": { 903e187964aSGeorge Keishing # "Health": "OK", 904e187964aSGeorge Keishing # "HealthRollup": "OK", 905e187964aSGeorge Keishing # "State": "Enabled" 906e187964aSGeorge Keishing # }, 907e187964aSGeorge Keishing 9084d430283Sganesanb ${status}= Redfish.Get Attribute /redfish/v1/Managers/${MANAGER_ID} Status 909e187964aSGeorge Keishing [Return] ${status["State"]} 910e187964aSGeorge Keishing 911e187964aSGeorge Keishing 912472177b4SSushil SinghRedfish Verify BMC State 913472177b4SSushil Singh [Documentation] Verify BMC state is enabled. 914472177b4SSushil Singh [Arguments] ${match_state}=Enabled 915472177b4SSushil Singh 916472177b4SSushil Singh # Description of argument(s): 917472177b4SSushil Singh # match_state Expected match state (e.g. Enabled, Starting, Error) 918472177b4SSushil Singh 919*c32434a3SYi Hu ${Status}= Redfish.Get Attribute /redfish/v1/Managers/${MANAGER_ID} Status 920472177b4SSushil Singh 921472177b4SSushil Singh Should Be Equal As Strings ${match_state} ${Status['State']} 922472177b4SSushil Singh 923472177b4SSushil Singh 924e187964aSGeorge KeishingRedfish Get Host State 925e187964aSGeorge Keishing [Documentation] Return host power and health state. 926e187964aSGeorge Keishing 927e187964aSGeorge Keishing # Refer: http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Status 928e187964aSGeorge Keishing 929e187964aSGeorge Keishing # Example: 930e187964aSGeorge Keishing # "PowerState": "Off", 931e187964aSGeorge Keishing # "Status": { 932e187964aSGeorge Keishing # "Health": "OK", 933e187964aSGeorge Keishing # "HealthRollup": "OK", 934e187964aSGeorge Keishing # "State": "StandbyOffline" 935e187964aSGeorge Keishing # }, 936e187964aSGeorge Keishing 937b51d1505SGeorge Keishing ${chassis}= Redfish.Get Properties /redfish/v1/Chassis/${CHASSIS_ID} 938e187964aSGeorge Keishing [Return] ${chassis["PowerState"]} ${chassis["Status"]["State"]} 939e187964aSGeorge Keishing 940e187964aSGeorge Keishing 941e187964aSGeorge KeishingRedfish Get Boot Progress 942e187964aSGeorge Keishing [Documentation] Return boot progress state. 943e187964aSGeorge Keishing 944e187964aSGeorge Keishing # Example: /redfish/v1/Systems/system/ 945e187964aSGeorge Keishing # "BootProgress": { 946e187964aSGeorge Keishing # "LastState": "OSRunning" 947e187964aSGeorge Keishing # }, 948e187964aSGeorge Keishing 949*c32434a3SYi Hu ${boot_progress}= Redfish.Get Properties /redfish/v1/Systems/${SYSTEM_ID}/ 950b51d1505SGeorge Keishing 951b51d1505SGeorge Keishing Return From Keyword If "${PLATFORM_ARCH_TYPE}" == "x86" 952b51d1505SGeorge Keishing ... NA ${boot_progress["Status"]["State"]} 953b51d1505SGeorge Keishing 954e187964aSGeorge Keishing [Return] ${boot_progress["BootProgress"]["LastState"]} ${boot_progress["Status"]["State"]} 955e187964aSGeorge Keishing 956e187964aSGeorge Keishing 957e187964aSGeorge KeishingRedfish Get States 958e187964aSGeorge Keishing [Documentation] Return all the BMC and host states in dictionary. 959fd0f91b1SSushil Singh [Timeout] ${REDFISH_SYS_STATE_WAIT_TIMEOUT} 960e187964aSGeorge Keishing 961e187964aSGeorge Keishing # Refer: openbmc/docs/designs/boot-progress.md 962e187964aSGeorge Keishing 963205f95f8SGeorge Keishing Redfish.Login 964e187964aSGeorge Keishing 965e187964aSGeorge Keishing ${bmc_state}= Redfish Get BMC State 966e187964aSGeorge Keishing ${chassis_state} ${chassis_status}= Redfish Get Host State 967e187964aSGeorge Keishing ${boot_progress} ${host_state}= Redfish Get Boot Progress 968e187964aSGeorge Keishing 969e187964aSGeorge Keishing ${states}= Create Dictionary 970e187964aSGeorge Keishing ... bmc=${bmc_state} 971e187964aSGeorge Keishing ... chassis=${chassis_state} 972e187964aSGeorge Keishing ... host=${host_state} 973e187964aSGeorge Keishing ... boot_progress=${boot_progress} 974e187964aSGeorge Keishing 97564293c52SGeorge Keishing # Disable loggoing state to prevent huge log.html record when boot 97664293c52SGeorge Keishing # test is run in loops. 97764293c52SGeorge Keishing #Log ${states} 97895cf8659SGeorge Keishing 979e187964aSGeorge Keishing [Return] ${states} 98095cf8659SGeorge Keishing 98195cf8659SGeorge Keishing 98280029909SSushil SinghIs BMC Not Quiesced 98380029909SSushil Singh [Documentation] Verify BMC state is not quiesced. 98480029909SSushil Singh 98580029909SSushil Singh ${bmc_state}= Redfish Get States 98680029909SSushil Singh 98780029909SSushil Singh Log To Console BMC State : ${bmc_state} 98880029909SSushil Singh 98980029909SSushil Singh Should Not Be Equal As Strings Quiesced ${bmc_state['bmc']} 99080029909SSushil Singh 99180029909SSushil Singh 99295cf8659SGeorge KeishingIs BMC Standby 99395cf8659SGeorge Keishing [Documentation] Check if BMC is ready and host at standby. 99495cf8659SGeorge Keishing 99595cf8659SGeorge Keishing ${standby_states}= Create Dictionary 99695cf8659SGeorge Keishing ... bmc=Enabled 99795cf8659SGeorge Keishing ... chassis=Off 99895cf8659SGeorge Keishing ... host=Disabled 99995cf8659SGeorge Keishing ... boot_progress=None 100095cf8659SGeorge Keishing 1001de1863ddSaravinth0510 Run Keyword If '${PLATFORM_ARCH_TYPE}' == 'x86' 1002de1863ddSaravinth0510 ... Set To Dictionary ${standby_states} boot_progress=NA 1003de1863ddSaravinth0510 100495cf8659SGeorge Keishing Wait Until Keyword Succeeds 3 min 10 sec Redfish Get States 100595cf8659SGeorge Keishing 1006258d592eSRahul Maheshwari Wait Until Keyword Succeeds 5 min 10 sec Match State ${standby_states} 100795cf8659SGeorge Keishing 100895cf8659SGeorge Keishing 100995cf8659SGeorge KeishingMatch State 101095cf8659SGeorge Keishing [Documentation] Check if the expected and current states are matched. 101195cf8659SGeorge Keishing [Arguments] ${match_state} 101295cf8659SGeorge Keishing 101395cf8659SGeorge Keishing # Description of argument(s): 101495cf8659SGeorge Keishing # match_state Expected states in dictionary. 101595cf8659SGeorge Keishing 101695cf8659SGeorge Keishing ${current_state}= Redfish Get States 101795cf8659SGeorge Keishing Dictionaries Should Be Equal ${match_state} ${current_state} 101849739b20SPeter D Phan 101949739b20SPeter D Phan 102095589b31SpraphullasureshWait For Host Boot Progress To Reach Required State 102195589b31Spraphullasuresh [Documentation] Wait till host boot progress reaches required state. 1022eacfac9cSpraphullasuresh [Arguments] ${expected_boot_state}=OSRunning 102395589b31Spraphullasuresh 102495589b31Spraphullasuresh # Description of argument(s): 102595589b31Spraphullasuresh # expected_boot_state Expected boot state. E.g. OSRunning, SystemInitComplete etc. 102695589b31Spraphullasuresh 102795589b31Spraphullasuresh Wait Until Keyword Succeeds ${power_on_timeout} 20 sec 102895589b31Spraphullasuresh ... Is Boot Progress At Required State ${expected_boot_state} 102995589b31Spraphullasuresh 103095589b31Spraphullasuresh 103149739b20SPeter D PhanRedfish Initiate Auto Reboot 103249739b20SPeter D Phan [Documentation] Initiate an auto reboot. 103349739b20SPeter D Phan [Arguments] ${interval}=2000 103449739b20SPeter D Phan 103549739b20SPeter D Phan # Description of argument(s): 103649739b20SPeter D Phan # interval Value in milliseconds to set Watchdog interval 103749739b20SPeter D Phan 103849739b20SPeter D Phan # Set auto reboot policy 103949739b20SPeter D Phan Redfish Set Auto Reboot RetryAttempts 104049739b20SPeter D Phan 1041c0701106SGeorge Keishing Redfish Power Operation On 1042a4e13526SGeorge Keishing 1043a4e13526SGeorge Keishing Wait Until Keyword Succeeds 2 min 5 sec Is Boot Progress Changed 1044c0701106SGeorge Keishing 104549739b20SPeter D Phan # Set watchdog timer 104649739b20SPeter D Phan Set Watchdog Interval Using Busctl ${interval} 104749739b20SPeter D Phan 104849739b20SPeter D Phan 1049a4e13526SGeorge KeishingIs Boot Progress Changed 1050a4e13526SGeorge Keishing [Documentation] Get BootProgress state and expect boot state mismatch. 1051a4e13526SGeorge Keishing [Arguments] ${boot_state}=None 1052a4e13526SGeorge Keishing 1053a4e13526SGeorge Keishing # Description of argument(s): 1054a4e13526SGeorge Keishing # boot_state Value of the BootProgress state to match against. 1055a4e13526SGeorge Keishing 1056a4e13526SGeorge Keishing ${boot_progress} ${host_state}= Redfish Get Boot Progress 1057a4e13526SGeorge Keishing 1058a4e13526SGeorge Keishing Should Not Be Equal ${boot_progress} ${boot_state} 1059a4e13526SGeorge Keishing 106049739b20SPeter D Phan 106113d84bf7SSridevi RameshIs Boot Progress At Required State 106213d84bf7SSridevi Ramesh [Documentation] Get BootProgress state and expect boot state to match. 106313d84bf7SSridevi Ramesh [Arguments] ${boot_state}=None 106413d84bf7SSridevi Ramesh 106513d84bf7SSridevi Ramesh # Description of argument(s): 106613d84bf7SSridevi Ramesh # boot_state Value of the BootProgress state to match. 106713d84bf7SSridevi Ramesh 106813d84bf7SSridevi Ramesh ${boot_progress} ${host_state}= Redfish Get Boot Progress 106913d84bf7SSridevi Ramesh 107013d84bf7SSridevi Ramesh Should Be Equal ${boot_progress} ${boot_state} 107113d84bf7SSridevi Ramesh 107213d84bf7SSridevi Ramesh 107313d84bf7SSridevi RameshIs Boot Progress At Any State 107413d84bf7SSridevi Ramesh [Documentation] Get BootProgress state and expect boot state to match 107513d84bf7SSridevi Ramesh ... with any of the states mentioned in the list. 107613d84bf7SSridevi Ramesh [Arguments] ${boot_states}=@{BOOT_PROGRESS_STATES} 107713d84bf7SSridevi Ramesh 107813d84bf7SSridevi Ramesh # Description of argument(s): 107913d84bf7SSridevi Ramesh # boot_states List of the BootProgress states to match. 108013d84bf7SSridevi Ramesh 108113d84bf7SSridevi Ramesh ${boot_progress} ${host_state}= Redfish Get Boot Progress 108213d84bf7SSridevi Ramesh Should Contain Any ${boot_progress} @{boot_states} 108313d84bf7SSridevi Ramesh 108413d84bf7SSridevi Ramesh 10850e26266aSSagar AnandIs Host At State 10860e26266aSSagar Anand [Documentation] Get Host state and check if it matches 10870e26266aSSagar Anand ... user input expected state. 10880e26266aSSagar Anand [Arguments] ${expected_host_state} 10890e26266aSSagar Anand 10900e26266aSSagar Anand # Description of argument(s): 10910e26266aSSagar Anand # expected_host_state Expected Host State to check.(e.g. Quiesced). 10920e26266aSSagar Anand 10930e26266aSSagar Anand ${boot_progress} ${host_state}= Redfish Get Boot Progress 10940e26266aSSagar Anand 10950e26266aSSagar Anand Should Be Equal ${host_state} ${expected_host_state} 10960e26266aSSagar Anand 10970e26266aSSagar Anand 109849739b20SPeter D PhanSet Watchdog Interval Using Busctl 109949739b20SPeter D Phan [Documentation] Set Watchdog time interval. 110049739b20SPeter D Phan [Arguments] ${milliseconds}=1000 110149739b20SPeter D Phan 110249739b20SPeter D Phan # Description of argument(s): 11034b729499SGeorge Keishing # milliseconds Time interval for watchdog timer 110449739b20SPeter D Phan 1105c0701106SGeorge Keishing ${cmd}= Catenate busctl set-property xyz.openbmc_project.Watchdog 1106c0701106SGeorge Keishing ... /xyz/openbmc_project/watchdog/host0 110749739b20SPeter D Phan ... xyz.openbmc_project.State.Watchdog Interval t ${milliseconds} 110849739b20SPeter D Phan BMC Execute Command ${cmd} 110949739b20SPeter D Phan 1110f5fec0d2SGeorge Keishing 1111f5fec0d2SGeorge KeishingStop PLDM Service And Wait 1112f5fec0d2SGeorge Keishing [Documentation] Stop PLDM service and wait for Host to initiate reset. 1113f5fec0d2SGeorge Keishing 1114f5fec0d2SGeorge Keishing BMC Execute Command systemctl stop pldmd.service 1115f5fec0d2SGeorge Keishing 1116ca76e373SGeorge Keishing 1117ca76e373SGeorge KeishingGet BIOS Attribute 1118ca76e373SGeorge Keishing [Documentation] Get the BIOS attribute for /redfish/v1/Systems/system/Bios. 1119ca76e373SGeorge Keishing 1120ca76e373SGeorge Keishing # Python module: get_member_list(resource_path) 1121ca76e373SGeorge Keishing ${systems}= Redfish_Utils.Get Member List /redfish/v1/Systems 1122ca76e373SGeorge Keishing ${bios_attr_dict}= Redfish.Get Attribute ${systems[0]}/Bios Attributes 1123ca76e373SGeorge Keishing 1124ca76e373SGeorge Keishing [Return] ${bios_attr_dict} 1125cfb2c415Snagarjunb22 11268f610e76SGeorge Keishing 11278f610e76SGeorge KeishingSet BIOS Attribute 11288f610e76SGeorge Keishing [Documentation] PATCH the BIOS attribute for /redfish/v1/Systems/system/Bios. 11298f610e76SGeorge Keishing [Arguments] ${attribute_name} ${attribute_value} 11308f610e76SGeorge Keishing 11318f610e76SGeorge Keishing # Description of argument(s): 11328f610e76SGeorge Keishing # attribute_name Any valid BIOS attribute. 11338f610e76SGeorge Keishing # attribute_value Valid allowed attribute values. 11348f610e76SGeorge Keishing 11358f610e76SGeorge Keishing # Python module: get_member_list(resource_path) 11368f610e76SGeorge Keishing ${systems}= Redfish_Utils.Get Member List /redfish/v1/Systems 11378f610e76SGeorge Keishing Redfish.Patch ${systems[0]}/Bios/Settings body={"Attributes":{"${attribute_name}":"${attribute_value}"}} 11388f610e76SGeorge Keishing 11398f610e76SGeorge Keishing 1140cfb2c415Snagarjunb22Is BMC Operational 1141cfb2c415Snagarjunb22 [Documentation] Check if BMC is enabled. 114213fb3cf9Sganesanb [Teardown] Redfish.Logout 1143cfb2c415Snagarjunb22 114413fb3cf9Sganesanb Wait Until Keyword Succeeds 5 min 5 sec Ping Host ${OPENBMC_HOST} 114513fb3cf9Sganesanb # In some of bmc stack, network services will gets loaded before redfish/ipmi services gets loaded. 114613fb3cf9Sganesanb # Hence, 3mins sleep time is added to allow other service gets loaded. 114713fb3cf9Sganesanb Sleep 180s 114813fb3cf9Sganesanb Redfish.login 1149cfb2c415Snagarjunb22 ${bmc_status}= Redfish Get BMC State 1150cfb2c415Snagarjunb22 Should Be Equal ${bmc_status} Enabled 115183c737b2SGeorge Keishing 115283c737b2SGeorge Keishing 115383c737b2SGeorge KeishingPLDM Set BIOS Attribute 115483c737b2SGeorge Keishing [Documentation] Set the BIOS attribute via pldmtool and verify the attribute is set. 115583c737b2SGeorge Keishing ... Defaulted for fw_boot_side for boot test usage caller. 115683c737b2SGeorge Keishing [Arguments] ${attribute_name}=fw_boot_side ${attribute_value}=Temp 115783c737b2SGeorge Keishing 115883c737b2SGeorge Keishing # Description of argument(s): 115983c737b2SGeorge Keishing # attribute_name Valid BIOS attribute name e.g ("fw_boot_side") 116083c737b2SGeorge Keishing # attribute_value Valid BIOS attribute value for fw_boot_side. 116183c737b2SGeorge Keishing 116283c737b2SGeorge Keishing # PLDM response output example: 116383c737b2SGeorge Keishing # { 116483c737b2SGeorge Keishing # "Response": "SUCCESS" 116583c737b2SGeorge Keishing # } 116683c737b2SGeorge Keishing 116783c737b2SGeorge Keishing ${resp}= pldmtool bios SetBIOSAttributeCurrentValue -a ${attribute_name} -d ${attribute_value} 116883c737b2SGeorge Keishing Should Be Equal As Strings ${resp["Response"]} SUCCESS 116983c737b2SGeorge Keishing 117083c737b2SGeorge Keishing # PLDM GET output example: 117183c737b2SGeorge Keishing # { 117283c737b2SGeorge Keishing # "CurrentValue": "Temp" 117383c737b2SGeorge Keishing # } 117483c737b2SGeorge Keishing 117583c737b2SGeorge Keishing ${pldm_output}= PLDM Get BIOS Attribute ${attribute_name} 117683c737b2SGeorge Keishing Should Be Equal As Strings ${pldm_output["CurrentValue"]} ${attribute_value} 117783c737b2SGeorge Keishing ... msg=Expecting ${attribute_value} but got ${pldm_output["CurrentValue"]} 117883c737b2SGeorge Keishing 117983c737b2SGeorge Keishing 118083c737b2SGeorge KeishingPLDM Get BIOS Attribute 118183c737b2SGeorge Keishing [Documentation] Get the BIOS attribute via pldmtool for a given attribute and return value. 118283c737b2SGeorge Keishing [Arguments] ${attribute_name} 118383c737b2SGeorge Keishing 118483c737b2SGeorge Keishing # Description of argument(s): 118583c737b2SGeorge Keishing # attribute_name Valid BIOS attribute name e.g ("fw_boot_side") 118683c737b2SGeorge Keishing 118783c737b2SGeorge Keishing ${pldm_output}= pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${attribute_name} 118883c737b2SGeorge Keishing [Return] ${pldm_output} 118900108dccSnagarjunb22 119000108dccSnagarjunb22 119100108dccSnagarjunb22Verify Host Power State 119200108dccSnagarjunb22 [Documentation] Get the Host Power state and compare it with the expected state. 119300108dccSnagarjunb22 [Arguments] ${expected_power_state} 119400108dccSnagarjunb22 119500108dccSnagarjunb22 # Description of argument(s): 119600108dccSnagarjunb22 # expected_power_state State of Host e.g. Off or On. 119700108dccSnagarjunb22 119800108dccSnagarjunb22 ${power_state} ${health_status}= Redfish Get Host State 119900108dccSnagarjunb22 Should Be Equal ${power_state} ${expected_power_state} 120000108dccSnagarjunb22 120100108dccSnagarjunb22 120200108dccSnagarjunb22Verify Host Is Up 120300108dccSnagarjunb22 [Documentation] Verify Host is Up. 120400108dccSnagarjunb22 120500108dccSnagarjunb22 Wait Until Keyword Succeeds 3 min 30 sec Verify Host Power State On 120600108dccSnagarjunb22 # Python module: os_execute(cmd) 120700108dccSnagarjunb22 Wait Until Keyword Succeeds 10 min 30 sec OS Execute Command uptime 1208