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