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 |
George Keishing | e18030c | 2022-07-20 13:37:01 -0500 | [diff] [blame] | 14 | Suite Teardown Run Keyword And Ignore Error PLDM BIOS Suite Cleanup |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 15 | |
| 16 | *** Test Cases *** |
| 17 | |
| 18 | Verify GetDateTime |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 19 | [Documentation] Verify host date & time. |
| 20 | [Tags] Verify_GetDateTime |
| 21 | |
| 22 | # Example output: |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 23 | # { |
| 24 | # "Response": "2020-11-07 07:10:10" |
| 25 | # } |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 26 | |
| 27 | ${pldm_output}= Pldmtool bios GetDateTime |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 28 | @{date_time}= Split String ${pldm_output['Response']} ${SPACE} |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 29 | @{time}= Split String ${date_time}[1] : |
| 30 | |
| 31 | # verify date & time. |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 32 | ${utc}= Get Current Date UTC exclude_millis=True |
| 33 | @{current_dmy}= Split String ${utc} ${SPACE} |
| 34 | @{current_time}= Split String ${current_dmy[1]} : |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 35 | |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 36 | # Example output: |
| 37 | # 2020-11-25 07:34:30 |
| 38 | |
| 39 | Should Contain ${current_dmy[0]} ${date_time[0]} |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 40 | |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 41 | |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 42 | Verify SetDateTime |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 43 | [Documentation] Verify set date & time for the host. |
| 44 | [Tags] Verify_SetDateTime |
| 45 | |
| 46 | # Example output: |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 47 | # { |
| 48 | # "Response": "SUCCESS" |
| 49 | # } |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 50 | |
| 51 | ${current_date_time}= Get Current Date UTC exclude_millis=True |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 52 | # Example output: |
| 53 | # 2020-11-25 07:34:30 |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 54 | |
| 55 | ${date}= Add Time To Date ${current_date_time} 400 days exclude_millis=True |
| 56 | ${upgrade_date}= Evaluate re.sub(r'-* *:*', "", '${date}') modules=re |
| 57 | |
| 58 | ${time}= Add Time To Date ${current_date_time} 01:01:00 exclude_millis=True |
| 59 | ${upgrade_time}= Evaluate re.sub(r'-* *:*', "", '${time}') modules=re |
| 60 | |
| 61 | # Set date. |
| 62 | ${cmd_set_date}= Evaluate $CMD_SETDATETIME % '${upgrade_date}' |
| 63 | ${pldm_output}= Pldmtool ${cmd_set_date} |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 64 | Valid Value pldm_output['Response'] ['SUCCESS'] |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 65 | |
| 66 | # Set time. |
| 67 | ${cmd_set_time}= Evaluate $CMD_SETDATETIME % '${upgrade_time}' |
| 68 | ${pldm_output}= Pldmtool ${cmd_set_time} |
Sridevi Ramesh | fe52e40 | 2020-02-05 00:15:24 -0600 | [diff] [blame] | 69 | |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 70 | |
Sridevi Ramesh | f60581b | 2020-04-07 05:11:12 -0500 | [diff] [blame] | 71 | Verify GetBIOSTable For AttributeValueTable |
| 72 | [Documentation] Verify if attribute value table content exist for |
| 73 | ... GetBIOSTable with table type attribute value table. |
| 74 | [Tags] Verify_GetBIOSTable_For_AttributeValueTable |
| 75 | |
| 76 | # Example pldm_output: |
| 77 | # [pldm_attributevaluetable]: True |
| 78 | # [attributehandle]: 0 |
| 79 | # [ attributetype]: BIOSStringReadOnly |
| 80 | # [ currentstringlength]: 15 |
Sridevi Ramesh | f60581b | 2020-04-07 05:11:12 -0500 | [diff] [blame] | 81 | |
George Keishing | f924895 | 2021-05-28 07:52:37 -0500 | [diff] [blame] | 82 | ${count}= Get Length ${attr_table_data} |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 83 | ${attr_val_list}= Create List |
| 84 | FOR ${i} IN RANGE ${count} |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 85 | Append To List ${attr_val_list} ${attr_table_data}[${i}][AttributeType] |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 86 | END |
| 87 | Valid List attr_val_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRVALTABLE} |
Sridevi Ramesh | fe52e40 | 2020-02-05 00:15:24 -0600 | [diff] [blame] | 88 | |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 89 | |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 90 | Verify GetBIOSAttributeCurrentValueByHandle |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 91 | [Documentation] Verify GetBIOSAttributeCurrentValueByHandle with the |
| 92 | ... various BIOS attribute handle and its values. |
| 93 | [Tags] Verify_GetBIOSAttributeCurrentValueByHandle |
| 94 | |
| 95 | # Example output: |
| 96 | # |
| 97 | # pldmtool bios GetBIOSAttributeCurrentValueByHandle -a pvm_fw_boot_side |
| 98 | # { |
| 99 | # "CurrentValue": "Temp" |
| 100 | # } |
| 101 | |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 102 | ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data} |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 103 | @{attr_handles}= Get Dictionary Keys ${attr_val_data} |
| 104 | FOR ${i} IN @{attr_handles} |
| 105 | ${cur_attr}= Pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${i} |
| 106 | @{attr_val_list}= Set Variable ${attr_val_data}[${i}] |
| 107 | Run Keyword If '${cur_attr['CurrentValue']}' not in @{attr_val_list} |
| 108 | ... Fail Invalid GetBIOSAttributeCurrentValueByHandle value found. |
| 109 | END |
| 110 | |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 111 | |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 112 | *** Keywords *** |
| 113 | |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 114 | PLDM BIOS Suite Setup |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 115 | [Documentation] Perform PLDM BIOS suite setup. |
| 116 | |
| 117 | ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable |
| 118 | Set Global Variable ${attr_table_data} ${pldm_output} |
| 119 | |
George Keishing | 1d14970 | 2022-09-20 01:53:38 -0500 | [diff] [blame] | 120 | Set Time To Manual Mode |
| 121 | |
| 122 | Sleep 10s |
| 123 | |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 124 | |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 125 | PLDM BIOS Suite Cleanup |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 126 | [Documentation] Perform PLDM BIOS suite cleanup. |
Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 127 | |
| 128 | ${result}= Get Current Date UTC exclude_millis=True |
| 129 | ${current_date_time}= Evaluate re.sub(r'-* *:*', "", '${result}') modules=re |
| 130 | ${cmd_set_date_time}= Evaluate $CMD_SETDATETIME % '${current_date_time}' |
| 131 | ${pldm_output}= Pldmtool ${cmd_set_date_time} |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 132 | Valid Value pldm_output['Response'] ['SUCCESS'] |
George Keishing | 1d14970 | 2022-09-20 01:53:38 -0500 | [diff] [blame] | 133 | |
| 134 | |
| 135 | Set Time To Manual Mode |
| 136 | [Documentation] Set date time to manual mode via Redfish. |
| 137 | |
George Keishing | a92a2e1 | 2022-09-20 02:12:42 -0500 | [diff] [blame] | 138 | Redfish.Login |
George Keishing | 1d14970 | 2022-09-20 01:53:38 -0500 | [diff] [blame] | 139 | Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body={'NTP':{'ProtocolEnabled': ${False}}} |
| 140 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |