Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Module to test PLDM BIOS commands. |
| 4 | |
| 5 | Library Collections |
| 6 | Library String |
| 7 | Library ../lib/pldm_utils.py |
| 8 | Variables ../data/pldm_variables.py |
| 9 | Resource ../lib/openbmc_ffdc.robot |
| 10 | |
| 11 | Test Setup Printn |
| 12 | Test Teardown FFDC On Test Case Fail |
| 13 | Suite Teardown PLDM BIOS Suite Cleanup |
| 14 | |
| 15 | *** Test Cases *** |
| 16 | |
| 17 | Verify GetDateTime |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 18 | [Documentation] Verify host date & time. |
| 19 | [Tags] Verify_GetDateTime |
| 20 | |
| 21 | # Example output: |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 22 | # { |
| 23 | # "Response": "2020-11-07 07:10:10" |
| 24 | # } |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 25 | |
| 26 | ${pldm_output}= Pldmtool bios GetDateTime |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 27 | @{date_time}= Split String ${pldm_output['Response']} ${SPACE} |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 28 | @{time}= Split String ${date_time}[1] : |
| 29 | |
| 30 | # verify date & time. |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 31 | ${utc}= Get Current Date UTC exclude_millis=True |
| 32 | @{current_dmy}= Split String ${utc} ${SPACE} |
| 33 | @{current_time}= Split String ${current_dmy[1]} : |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 34 | |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 35 | # Example output: |
| 36 | # 2020-11-25 07:34:30 |
| 37 | |
| 38 | Should Contain ${current_dmy[0]} ${date_time[0]} |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 39 | |
| 40 | Verify SetDateTime |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 41 | [Documentation] Verify set date & time for the host. |
| 42 | [Tags] Verify_SetDateTime |
| 43 | |
| 44 | # Example output: |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 45 | # { |
| 46 | # "Response": "SUCCESS" |
| 47 | # } |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 48 | |
| 49 | ${current_date_time}= Get Current Date UTC exclude_millis=True |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 50 | # Example output: |
| 51 | # 2020-11-25 07:34:30 |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 52 | |
| 53 | ${date}= Add Time To Date ${current_date_time} 400 days exclude_millis=True |
| 54 | ${upgrade_date}= Evaluate re.sub(r'-* *:*', "", '${date}') modules=re |
| 55 | |
| 56 | ${time}= Add Time To Date ${current_date_time} 01:01:00 exclude_millis=True |
| 57 | ${upgrade_time}= Evaluate re.sub(r'-* *:*', "", '${time}') modules=re |
| 58 | |
| 59 | # Set date. |
| 60 | ${cmd_set_date}= Evaluate $CMD_SETDATETIME % '${upgrade_date}' |
| 61 | ${pldm_output}= Pldmtool ${cmd_set_date} |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 62 | Valid Value pldm_output['Response'] ['SUCCESS'] |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 63 | |
| 64 | # Set time. |
| 65 | ${cmd_set_time}= Evaluate $CMD_SETDATETIME % '${upgrade_time}' |
| 66 | ${pldm_output}= Pldmtool ${cmd_set_time} |
Sridevi Ramesh | fe52e40 | 2020-02-05 00:15:24 -0600 | [diff] [blame] | 67 | |
| 68 | Verify GetBIOSTable For StringTable |
| 69 | [Documentation] Verify GetBIOSTable for table type string table. |
| 70 | [Tags] Verify_GetBIOSTable_For_StringTable |
| 71 | |
Sridevi Ramesh | f60581b | 2020-04-07 05:11:12 -0500 | [diff] [blame] | 72 | # Example pldm_output: |
Sridevi Ramesh | fe52e40 | 2020-02-05 00:15:24 -0600 | [diff] [blame] | 73 | # [biosstringhandle]: BIOSString |
| 74 | # [0]: Allowed |
| 75 | # [1]: Disabled |
| 76 | # [2]: Enabled |
| 77 | # [3]: Not Allowed |
| 78 | # [4]: Perm |
| 79 | # [5]: Temp |
Sridevi Ramesh | 297d41b | 2021-02-02 09:16:55 -0600 | [diff] [blame] | 80 | # [6]: pvm_fw_boot_side |
| 81 | # [7]: pvm_inband_code_update |
| 82 | # [8]: pvm_os_boot_side |
| 83 | # [9]: pvm_pcie_error_inject |
| 84 | # [10]: pvm_surveillance |
| 85 | # [11]: pvm_system_name |
| 86 | # [12]: vmi_if_count |
Sridevi Ramesh | fe52e40 | 2020-02-05 00:15:24 -0600 | [diff] [blame] | 87 | |
Sridevi Ramesh | f60581b | 2020-04-07 05:11:12 -0500 | [diff] [blame] | 88 | ${pldm_output}= Pldmtool bios GetBIOSTable --type StringTable |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 89 | @{keys}= Get Dictionary Keys ${pldm_output} |
| 90 | ${string_list}= Create List |
| 91 | FOR ${key} IN @{keys} |
| 92 | Append To List ${string_list} ${pldm_output['${key}']} |
| 93 | END |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 94 | Valid List string_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRTABLE} |
Sridevi Ramesh | f60581b | 2020-04-07 05:11:12 -0500 | [diff] [blame] | 95 | |
| 96 | |
| 97 | Verify GetBIOSTable For AttributeTable |
| 98 | [Documentation] Verify if attribute table content exist for |
| 99 | ... GetBIOSTable with table type attribute table. |
| 100 | [Tags] Verify_GetBIOSTable_For_AttributeTable |
| 101 | |
| 102 | # Example pldm_output: |
| 103 | # [pldm_attributetable]: True |
| 104 | # [attributehandle]: 0 |
| 105 | # [ AttributeNameHandle]: 20(vmi-if1-ipv4-method) |
| 106 | # [ attributetype]: BIOSStringReadOnly |
| 107 | # [ StringType]: 0x01 |
| 108 | # [ minimumstringlength]: 1 |
| 109 | # [ maximumstringlength]: 100 |
| 110 | # [ defaultstringlength]: 15 |
Sridevi Ramesh | f60581b | 2020-04-07 05:11:12 -0500 | [diff] [blame] | 111 | |
| 112 | ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 113 | ${count}= Get Length ${pldm_output} |
| 114 | ${attr_list}= Create List |
| 115 | FOR ${i} IN RANGE ${count} |
| 116 | ${data}= Set Variable ${pldm_output}[${i}][AttributeNameHandle] |
| 117 | ${sub_string}= Get Substring ${data} 3 -1 |
| 118 | Append To List ${attr_list} ${sub_string} |
| 119 | END |
| 120 | Valid List attr_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRTABLE} |
Sridevi Ramesh | f60581b | 2020-04-07 05:11:12 -0500 | [diff] [blame] | 121 | |
| 122 | Verify GetBIOSTable For AttributeValueTable |
| 123 | [Documentation] Verify if attribute value table content exist for |
| 124 | ... GetBIOSTable with table type attribute value table. |
| 125 | [Tags] Verify_GetBIOSTable_For_AttributeValueTable |
| 126 | |
| 127 | # Example pldm_output: |
| 128 | # [pldm_attributevaluetable]: True |
| 129 | # [attributehandle]: 0 |
| 130 | # [ attributetype]: BIOSStringReadOnly |
| 131 | # [ currentstringlength]: 15 |
Sridevi Ramesh | f60581b | 2020-04-07 05:11:12 -0500 | [diff] [blame] | 132 | |
| 133 | ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeValueTable |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 134 | ${count}= Get Length ${pldm_output} |
| 135 | ${attr_val_list}= Create List |
| 136 | FOR ${i} IN RANGE ${count} |
| 137 | Append To List ${attr_val_list} ${pldm_output}[${i}][AttributeType] |
| 138 | END |
| 139 | Valid List attr_val_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRVALTABLE} |
Sridevi Ramesh | fe52e40 | 2020-02-05 00:15:24 -0600 | [diff] [blame] | 140 | |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 141 | |
| 142 | Verify SetBIOSAttributeCurrentValue |
| 143 | |
| 144 | [Documentation] Verify SetBIOSAttributeCurrentValue with the |
| 145 | ... various BIOS attribute handle and its values. |
| 146 | [Tags] Verify_SetBIOSAttributeCurrentValue |
| 147 | |
| 148 | # Example output: |
| 149 | # |
| 150 | # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_hostname -d BMC |
| 151 | # { |
| 152 | # "Response": "SUCCESS" |
| 153 | # } |
| 154 | |
| 155 | ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable |
| 156 | Log ${pldm_output} |
| 157 | ${attr_val_data}= GenerateBIOSAttrHandleValueDict ${pldm_output} |
| 158 | Log ${attr_val_data} |
| 159 | @{attr_handles}= Get Dictionary Keys ${attr_val_data} |
| 160 | FOR ${i} IN @{attr_handles} |
| 161 | @{attr_val_list}= Set Variable ${attr_val_data}[${i}] |
| 162 | Validate SetBIOSAttributeCurrentValue ${i} @{attr_val_list} |
| 163 | END |
| 164 | |
| 165 | Verify GetBIOSAttributeCurrentValueByHandle |
| 166 | |
| 167 | [Documentation] Verify GetBIOSAttributeCurrentValueByHandle with the |
| 168 | ... various BIOS attribute handle and its values. |
| 169 | [Tags] Verify_GetBIOSAttributeCurrentValueByHandle |
| 170 | |
| 171 | # Example output: |
| 172 | # |
| 173 | # pldmtool bios GetBIOSAttributeCurrentValueByHandle -a pvm_fw_boot_side |
| 174 | # { |
| 175 | # "CurrentValue": "Temp" |
| 176 | # } |
| 177 | |
| 178 | ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable |
| 179 | ${attr_val_data}= GenerateBIOSAttrHandleValueDict ${pldm_output} |
| 180 | @{attr_handles}= Get Dictionary Keys ${attr_val_data} |
| 181 | FOR ${i} IN @{attr_handles} |
| 182 | ${cur_attr}= Pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${i} |
| 183 | @{attr_val_list}= Set Variable ${attr_val_data}[${i}] |
| 184 | Run Keyword If '${cur_attr['CurrentValue']}' not in @{attr_val_list} |
| 185 | ... Fail Invalid GetBIOSAttributeCurrentValueByHandle value found. |
| 186 | END |
| 187 | |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 188 | *** Keywords *** |
| 189 | |
| 190 | PLDM BIOS Suite Cleanup |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 191 | |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 192 | [Documentation] Perform pldm BIOS suite cleanup. |
| 193 | |
| 194 | ${result}= Get Current Date UTC exclude_millis=True |
| 195 | ${current_date_time}= Evaluate re.sub(r'-* *:*', "", '${result}') modules=re |
| 196 | ${cmd_set_date_time}= Evaluate $CMD_SETDATETIME % '${current_date_time}' |
| 197 | ${pldm_output}= Pldmtool ${cmd_set_date_time} |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 198 | Valid Value pldm_output['Response'] ['SUCCESS'] |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 199 | |
| 200 | Validate SetBIOSAttributeCurrentValue |
| 201 | |
| 202 | [Documentation] Set BIOS attribute with the available attribute handle |
| 203 | ... values and revert back to original attribute handle value. |
| 204 | [Arguments] ${attr_handle} @{attr_val_list} |
| 205 | |
| 206 | # Description of argument(s): |
| 207 | # attr_handle BIOS attribute handle (e.g. pvm_system_power_off_policy). |
| 208 | # attr_val_list List of the attribute values for the given attribute handle |
| 209 | # (e.g. ['"Power Off"', '"Stay On"', 'Automatic']). |
| 210 | |
| 211 | ${cur_attr}= Pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${attr_handle} |
| 212 | FOR ${j} IN @{attr_val_list} |
| 213 | ${pldm_resp}= pldmtool bios SetBIOSAttributeCurrentValue -a ${attr_handle} -d ${j} |
| 214 | Valid Value pldm_resp['Response'] ['SUCCESS'] |
| 215 | END |
| 216 | ${pldm_resp}= pldmtool bios SetBIOSAttributeCurrentValue -a ${attr_handle} -d ${cur_attr['CurrentValue']} |
| 217 | Valid Value pldm_resp['Response'] ['SUCCESS'] |