blob: 81d20337abc0b71d1ea66d9eb063c46d5b0924b1 [file] [log] [blame]
Sridevi Ramesh1495bc42020-02-04 03:13:33 -06001*** Settings ***
2
3Documentation Module to test PLDM BIOS commands.
4
5Library Collections
6Library String
7Library ../lib/pldm_utils.py
8Variables ../data/pldm_variables.py
9Resource ../lib/openbmc_ffdc.robot
10
11Test Setup Printn
12Test Teardown FFDC On Test Case Fail
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050013Suite Setup PLDM BIOS Suite Setup
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060014Suite Teardown PLDM BIOS Suite Cleanup
15
16*** Test Cases ***
17
18Verify GetDateTime
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050019
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060020 [Documentation] Verify host date & time.
21 [Tags] Verify_GetDateTime
22
23 # Example output:
Sridevi Ramesh961050b2020-11-12 11:04:30 -060024 # {
25 # "Response": "2020-11-07 07:10:10"
26 # }
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060027
28 ${pldm_output}= Pldmtool bios GetDateTime
Sridevi Ramesh961050b2020-11-12 11:04:30 -060029 @{date_time}= Split String ${pldm_output['Response']} ${SPACE}
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060030 @{time}= Split String ${date_time}[1] :
31
32 # verify date & time.
Sridevi Ramesh961050b2020-11-12 11:04:30 -060033 ${utc}= Get Current Date UTC exclude_millis=True
34 @{current_dmy}= Split String ${utc} ${SPACE}
35 @{current_time}= Split String ${current_dmy[1]} :
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060036
Sridevi Ramesh961050b2020-11-12 11:04:30 -060037 # Example output:
38 # 2020-11-25 07:34:30
39
40 Should Contain ${current_dmy[0]} ${date_time[0]}
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060041
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050042
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060043Verify SetDateTime
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050044
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060045 [Documentation] Verify set date & time for the host.
46 [Tags] Verify_SetDateTime
47
48 # Example output:
Sridevi Ramesh961050b2020-11-12 11:04:30 -060049 # {
50 # "Response": "SUCCESS"
51 # }
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060052
53 ${current_date_time}= Get Current Date UTC exclude_millis=True
Sridevi Ramesh961050b2020-11-12 11:04:30 -060054 # Example output:
55 # 2020-11-25 07:34:30
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060056
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 Ramesh961050b2020-11-12 11:04:30 -060066 Valid Value pldm_output['Response'] ['SUCCESS']
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060067
68 # Set time.
69 ${cmd_set_time}= Evaluate $CMD_SETDATETIME % '${upgrade_time}'
70 ${pldm_output}= Pldmtool ${cmd_set_time}
Sridevi Rameshfe52e402020-02-05 00:15:24 -060071
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050072
Sridevi Rameshf60581b2020-04-07 05:11:12 -050073Verify GetBIOSTable For AttributeValueTable
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050074
Sridevi Rameshf60581b2020-04-07 05:11:12 -050075 [Documentation] Verify if attribute value table content exist for
76 ... GetBIOSTable with table type attribute value table.
77 [Tags] Verify_GetBIOSTable_For_AttributeValueTable
78
79 # Example pldm_output:
80 # [pldm_attributevaluetable]: True
81 # [attributehandle]: 0
82 # [ attributetype]: BIOSStringReadOnly
83 # [ currentstringlength]: 15
Sridevi Rameshf60581b2020-04-07 05:11:12 -050084
George Keishingf9248952021-05-28 07:52:37 -050085 ${count}= Get Length ${attr_table_data}
Sridevi Ramesh961050b2020-11-12 11:04:30 -060086 ${attr_val_list}= Create List
87 FOR ${i} IN RANGE ${count}
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050088 Append To List ${attr_val_list} ${attr_table_data}[${i}][AttributeType]
Sridevi Ramesh961050b2020-11-12 11:04:30 -060089 END
90 Valid List attr_val_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRVALTABLE}
Sridevi Rameshfe52e402020-02-05 00:15:24 -060091
Sridevi Ramesh57537452021-01-18 03:25:05 -060092
Sridevi Ramesh57537452021-01-18 03:25:05 -060093Verify GetBIOSAttributeCurrentValueByHandle
94
95 [Documentation] Verify GetBIOSAttributeCurrentValueByHandle with the
96 ... various BIOS attribute handle and its values.
97 [Tags] Verify_GetBIOSAttributeCurrentValueByHandle
98
99 # Example output:
100 #
101 # pldmtool bios GetBIOSAttributeCurrentValueByHandle -a pvm_fw_boot_side
102 # {
103 # "CurrentValue": "Temp"
104 # }
105
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500106 ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data}
Sridevi Ramesh57537452021-01-18 03:25:05 -0600107 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
108 FOR ${i} IN @{attr_handles}
109 ${cur_attr}= Pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${i}
110 @{attr_val_list}= Set Variable ${attr_val_data}[${i}]
111 Run Keyword If '${cur_attr['CurrentValue']}' not in @{attr_val_list}
112 ... Fail Invalid GetBIOSAttributeCurrentValueByHandle value found.
113 END
114
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500115
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600116*** Keywords ***
117
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500118PLDM BIOS Suite Setup
119
120 [Documentation] Perform PLDM BIOS suite setup.
121
122 ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable
123 Set Global Variable ${attr_table_data} ${pldm_output}
124
125
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600126PLDM BIOS Suite Cleanup
Sridevi Ramesh57537452021-01-18 03:25:05 -0600127
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500128 [Documentation] Perform PLDM BIOS suite cleanup.
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600129
130 ${result}= Get Current Date UTC exclude_millis=True
131 ${current_date_time}= Evaluate re.sub(r'-* *:*', "", '${result}') modules=re
132 ${cmd_set_date_time}= Evaluate $CMD_SETDATETIME % '${current_date_time}'
133 ${pldm_output}= Pldmtool ${cmd_set_date_time}
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600134 Valid Value pldm_output['Response'] ['SUCCESS']