167a8bef2SGeorge Keishing*** Settings *** 267a8bef2SGeorge KeishingDocumentation Utilities for redfish BIOS attribute operations. 367a8bef2SGeorge Keishing 40e0e67c2SAnusha DathatriResource resource.robot 50e0e67c2SAnusha DathatriResource bmc_redfish_resource.robot 60e0e67c2SAnusha DathatriResource common_utils.robot 713d84bf7SSridevi RameshResource utils.robot 813d84bf7SSridevi RameshLibrary tftp_update_utils.py 967a8bef2SGeorge Keishing 1067a8bef2SGeorge Keishing 11*a4ab9f33SSridevi Ramesh*** Variables *** 12*a4ab9f33SSridevi Ramesh${OS_RUNNING_TIMEOUT} 30 13*a4ab9f33SSridevi Ramesh 14*a4ab9f33SSridevi Ramesh 1567a8bef2SGeorge Keishing*** Keywords *** 1667a8bef2SGeorge Keishing 1767a8bef2SGeorge KeishingSet BIOS Attribute Value And Verify 1867a8bef2SGeorge Keishing 1967a8bef2SGeorge Keishing [Documentation] Set BIOS attribute handle with attribute value and verify. 2099d0892bSAnusha Dathatri [Arguments] ${attr_handle} ${attr_val} ${verify}=${True} 2199d0892bSAnusha Dathatri 2299d0892bSAnusha Dathatri # Description of argument(s): 2399d0892bSAnusha Dathatri # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method'). 2499d0892bSAnusha Dathatri # @{attr_val} Attribute value for the given attribute handle. 2599d0892bSAnusha Dathatri # ${verify} Verify the new value. 2699d0892bSAnusha Dathatri 27*a4ab9f33SSridevi Ramesh # Check if the BIOS attribute value type is string. 28*a4ab9f33SSridevi Ramesh ${type_str}= Evaluate isinstance($attr_val, str) 2967a8bef2SGeorge Keishing 30*a4ab9f33SSridevi Ramesh IF ${type_str} 31*a4ab9f33SSridevi Ramesh # Handling the case when the BIOS attribute value is an empty string. 32*a4ab9f33SSridevi Ramesh ${attr_value_length}= Evaluate len($attr_val.replace('"', '')) 33*a4ab9f33SSridevi Ramesh IF ${attr_value_length} 34*a4ab9f33SSridevi Ramesh ${value}= Set Variable "${attr_val}" 35*a4ab9f33SSridevi Ramesh ELSE 36*a4ab9f33SSridevi Ramesh ${value}= Set Variable ${attr_val} 37*a4ab9f33SSridevi Ramesh END 38*a4ab9f33SSridevi Ramesh ELSE 39*a4ab9f33SSridevi Ramesh ${value}= Set Variable ${attr_val} 40*a4ab9f33SSridevi Ramesh END 4167a8bef2SGeorge Keishing 42*a4ab9f33SSridevi Ramesh # BIOS attribute with _current are ReadOnly can not be updated. 43*a4ab9f33SSridevi Ramesh IF 'current' in '${attr_handle}' 44*a4ab9f33SSridevi Ramesh Log To Console BIOS attribute with _current are ReadOnly can not be updated !! 45*a4ab9f33SSridevi Ramesh ELSE 4667a8bef2SGeorge Keishing Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${attr_handle}": ${value}}} 4767a8bef2SGeorge Keishing ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 4867a8bef2SGeorge Keishing 4999d0892bSAnusha Dathatri Run Keyword If '${verify}' == '${True}' Verify BIOS Attribute ${attr_handle} ${attr_val} 50*a4ab9f33SSridevi Ramesh END 5167a8bef2SGeorge Keishing 5267a8bef2SGeorge Keishing 5367a8bef2SGeorge KeishingSet Optional BIOS Attribute Values And Verify 5467a8bef2SGeorge Keishing 5567a8bef2SGeorge Keishing [Documentation] For the given BIOS attribute handle update with optional 5667a8bef2SGeorge Keishing ... attribute values and verify. 5767a8bef2SGeorge Keishing [Arguments] ${attr_handle} @{attr_val_list} 5867a8bef2SGeorge Keishing 5967a8bef2SGeorge Keishing # Description of argument(s): 6067a8bef2SGeorge Keishing # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method'). 6167a8bef2SGeorge Keishing # @{attr_val_list} List of the attribute values for the given attribute handle. 6267a8bef2SGeorge Keishing # (e.g. ['IPv4Static', 'IPv4DHCP']). 6367a8bef2SGeorge Keishing 6467a8bef2SGeorge Keishing FOR ${attr} IN @{attr_val_list} 6567a8bef2SGeorge Keishing ${new_attr}= Evaluate $attr.replace('"', '') 6667a8bef2SGeorge Keishing Set BIOS Attribute Value And Verify ${attr_handle} ${new_attr} 6767a8bef2SGeorge Keishing END 6899d0892bSAnusha Dathatri 6999d0892bSAnusha Dathatri 7099d0892bSAnusha DathatriVerify BIOS Attribute 7199d0892bSAnusha Dathatri 7299d0892bSAnusha Dathatri [Documentation] Verify BIOS attribute value. 7399d0892bSAnusha Dathatri [Arguments] ${attr_handle} ${attr_val} 7499d0892bSAnusha Dathatri 7599d0892bSAnusha Dathatri # Description of argument(s): 7699d0892bSAnusha Dathatri # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method'). 7799d0892bSAnusha Dathatri # ${attr_val} The expected value for the given attribute handle. 7899d0892bSAnusha Dathatri 7999d0892bSAnusha Dathatri ${output}= Redfish.Get Attribute ${BIOS_ATTR_URI} Attributes 80*a4ab9f33SSridevi Ramesh ${cmd_rsp_status}= Run Keyword And Return Status Should Not Be Empty ${output['${attr_handle}']} 81*a4ab9f33SSridevi Ramesh IF ${cmd_rsp_status} 8299d0892bSAnusha Dathatri Should Be Equal ${output['${attr_handle}']} ${attr_val} 83*a4ab9f33SSridevi Ramesh END 8413d84bf7SSridevi Ramesh 8513d84bf7SSridevi Ramesh 8613d84bf7SSridevi RameshSwitch And Verify BIOS Attribute Firmware Boot Side 8713d84bf7SSridevi Ramesh [Documentation] Switch BIOS attribute firmware boot side value to Perm/Temp 8813d84bf7SSridevi Ramesh ... at host power off state and verify firmware boot side 8913d84bf7SSridevi Ramesh ... value after BMC reboot. 9013d84bf7SSridevi Ramesh [Arguments] ${set_fw_boot_side} 9113d84bf7SSridevi Ramesh 9213d84bf7SSridevi Ramesh # Description of argument(s): 9313d84bf7SSridevi Ramesh # set_fw_boot_side Firmware boot side optional value Perm/Temp. 9413d84bf7SSridevi Ramesh 9513d84bf7SSridevi Ramesh # Do host power off. 9613d84bf7SSridevi Ramesh Redfish Power Off stack_mode=skip quiet=1 9713d84bf7SSridevi Ramesh 9813d84bf7SSridevi Ramesh # Get pre reboot state. 9913d84bf7SSridevi Ramesh ${pre_reboot_state}= Get Pre Reboot State 10013d84bf7SSridevi Ramesh 10199b36fbcSGeorge Keishing # Get fw_boot_side value. 10213d84bf7SSridevi Ramesh # fw_boot_side values are not same. 10313d84bf7SSridevi Ramesh 10413d84bf7SSridevi Ramesh ${cur_boot_side}= Redfish.Get Attribute ${BIOS_ATTR_URI} Attributes 10513d84bf7SSridevi Ramesh 10613d84bf7SSridevi Ramesh Log To Console Current firmware boot side :: ${cur_boot_side["fw_boot_side"]} 10713d84bf7SSridevi Ramesh Log To Console Given firmware boot side :: ${set_fw_boot_side} 10813d84bf7SSridevi Ramesh 10999b36fbcSGeorge Keishing Return From Keyword If "${cur_boot_side["fw_boot_side_current"]}" == "${set_fw_boot_side}" 11099b36fbcSGeorge Keishing ... ${True} 11199b36fbcSGeorge Keishing 11213d84bf7SSridevi Ramesh # Set the given firmware boot side value. 11313d84bf7SSridevi Ramesh Set BIOS Attribute Value And Verify fw_boot_side ${set_fw_boot_side} False 11413d84bf7SSridevi Ramesh 11513d84bf7SSridevi Ramesh # Power on BMC and wait for BMC to take reboot. 11613d84bf7SSridevi Ramesh Log To Console Perform power on operation & expect BMC to take reboot... 11713d84bf7SSridevi Ramesh Redfish Power Operation On 11813d84bf7SSridevi Ramesh 11913d84bf7SSridevi Ramesh Log To Console Wait for the BMC to take reboot and come back online... 12013d84bf7SSridevi Ramesh Wait For Reboot start_boot_seconds=${pre_reboot_state['epoch_seconds']} 12113d84bf7SSridevi Ramesh ... wait_state_check=0 12213d84bf7SSridevi Ramesh 12313d84bf7SSridevi Ramesh # Post BMC reboot, host should auto power on back to runtime. 12413d84bf7SSridevi Ramesh Log To Console BMC rebooted, wait for host to boot... 12513d84bf7SSridevi Ramesh Wait Until Keyword Succeeds ${OS_RUNNING_TIMEOUT} min 20 sec 12613d84bf7SSridevi Ramesh ... Is Boot Progress At Any State 12713d84bf7SSridevi Ramesh 12813d84bf7SSridevi Ramesh # Verify firmware boot side values after BMC reboot. 12913d84bf7SSridevi Ramesh Verify BIOS Attribute fw_boot_side ${set_fw_boot_side} 13013d84bf7SSridevi Ramesh Verify BIOS Attribute fw_boot_side_current ${set_fw_boot_side} 131