1*** Settings *** 2Documentation Utilities for redfish BIOS attribute operations. 3 4Resource resource.robot 5Resource bmc_redfish_resource.robot 6Resource common_utils.robot 7Resource utils.robot 8Library tftp_update_utils.py 9 10 11*** Keywords *** 12 13Set BIOS Attribute Value And Verify 14 15 [Documentation] Set BIOS attribute handle with attribute value and verify. 16 [Arguments] ${attr_handle} ${attr_val} ${verify}=${True} 17 18 # Description of argument(s): 19 # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method'). 20 # @{attr_val} Attribute value for the given attribute handle. 21 # ${verify} Verify the new value. 22 23 24 ${type_int}= Evaluate isinstance($attr_val, int) 25 ${value}= Set Variable If '${type_int}' == '${True}' ${attr_val} '${attr_val}' 26 27 Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${attr_handle}": ${value}}} 28 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 29 30 Run Keyword If '${verify}' == '${True}' Verify BIOS Attribute ${attr_handle} ${attr_val} 31 32 33Set Optional BIOS Attribute Values And Verify 34 35 [Documentation] For the given BIOS attribute handle update with optional 36 ... attribute values and verify. 37 [Arguments] ${attr_handle} @{attr_val_list} 38 39 # Description of argument(s): 40 # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method'). 41 # @{attr_val_list} List of the attribute values for the given attribute handle. 42 # (e.g. ['IPv4Static', 'IPv4DHCP']). 43 44 FOR ${attr} IN @{attr_val_list} 45 ${new_attr}= Evaluate $attr.replace('"', '') 46 Set BIOS Attribute Value And Verify ${attr_handle} ${new_attr} 47 END 48 49 50Verify BIOS Attribute 51 52 [Documentation] Verify BIOS attribute value. 53 [Arguments] ${attr_handle} ${attr_val} 54 55 # Description of argument(s): 56 # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method'). 57 # ${attr_val} The expected value for the given attribute handle. 58 59 ${output}= Redfish.Get Attribute ${BIOS_ATTR_URI} Attributes 60 Should Be Equal ${output['${attr_handle}']} ${attr_val} 61 62 63Switch And Verify BIOS Attribute Firmware Boot Side 64 [Documentation] Switch BIOS attribute firmware boot side value to Perm/Temp 65 ... at host power off state and verify firmware boot side 66 ... value after BMC reboot. 67 [Arguments] ${set_fw_boot_side} 68 69 # Description of argument(s): 70 # set_fw_boot_side Firmware boot side optional value Perm/Temp. 71 72 # Do host power off. 73 Redfish Power Off stack_mode=skip quiet=1 74 75 # Get pre reboot state. 76 ${pre_reboot_state}= Get Pre Reboot State 77 78 # Get fw_boot_side value. 79 # fw_boot_side values are not same. 80 81 ${cur_boot_side}= Redfish.Get Attribute ${BIOS_ATTR_URI} Attributes 82 83 Log To Console Current firmware boot side :: ${cur_boot_side["fw_boot_side"]} 84 Log To Console Given firmware boot side :: ${set_fw_boot_side} 85 86 Return From Keyword If "${cur_boot_side["fw_boot_side_current"]}" == "${set_fw_boot_side}" 87 ... ${True} 88 89 # Set the given firmware boot side value. 90 Set BIOS Attribute Value And Verify fw_boot_side ${set_fw_boot_side} False 91 92 # Power on BMC and wait for BMC to take reboot. 93 Log To Console Perform power on operation & expect BMC to take reboot... 94 Redfish Power Operation On 95 96 Log To Console Wait for the BMC to take reboot and come back online... 97 Wait For Reboot start_boot_seconds=${pre_reboot_state['epoch_seconds']} 98 ... wait_state_check=0 99 100 # Post BMC reboot, host should auto power on back to runtime. 101 Log To Console BMC rebooted, wait for host to boot... 102 Wait Until Keyword Succeeds ${OS_RUNNING_TIMEOUT} min 20 sec 103 ... Is Boot Progress At Any State 104 105 # Verify firmware boot side values after BMC reboot. 106 Verify BIOS Attribute fw_boot_side ${set_fw_boot_side} 107 Verify BIOS Attribute fw_boot_side_current ${set_fw_boot_side} 108