blob: 9b939cb726cee54cd7de8c1da105a559bedcc641 [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
George Keishinge18030c2022-07-20 13:37:01 -050014Suite Teardown Run Keyword And Ignore Error PLDM BIOS Suite Cleanup
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060015
16*** Test Cases ***
17
18Verify GetDateTime
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060019 [Documentation] Verify host date & time.
20 [Tags] Verify_GetDateTime
21
22 # Example output:
Sridevi Ramesh961050b2020-11-12 11:04:30 -060023 # {
24 # "Response": "2020-11-07 07:10:10"
25 # }
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060026
27 ${pldm_output}= Pldmtool bios GetDateTime
Sridevi Ramesh961050b2020-11-12 11:04:30 -060028 @{date_time}= Split String ${pldm_output['Response']} ${SPACE}
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060029 @{time}= Split String ${date_time}[1] :
30
31 # verify date & time.
Sridevi Ramesh961050b2020-11-12 11:04:30 -060032 ${utc}= Get Current Date UTC exclude_millis=True
33 @{current_dmy}= Split String ${utc} ${SPACE}
34 @{current_time}= Split String ${current_dmy[1]} :
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060035
Sridevi Ramesh961050b2020-11-12 11:04:30 -060036 # Example output:
37 # 2020-11-25 07:34:30
38
39 Should Contain ${current_dmy[0]} ${date_time[0]}
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060040
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050041
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060042Verify SetDateTime
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060043 [Documentation] Verify set date & time for the host.
44 [Tags] Verify_SetDateTime
45
46 # Example output:
Sridevi Ramesh961050b2020-11-12 11:04:30 -060047 # {
48 # "Response": "SUCCESS"
49 # }
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060050
51 ${current_date_time}= Get Current Date UTC exclude_millis=True
Sridevi Ramesh961050b2020-11-12 11:04:30 -060052 # Example output:
53 # 2020-11-25 07:34:30
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060054
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 Ramesh961050b2020-11-12 11:04:30 -060064 Valid Value pldm_output['Response'] ['SUCCESS']
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060065
66 # Set time.
67 ${cmd_set_time}= Evaluate $CMD_SETDATETIME % '${upgrade_time}'
68 ${pldm_output}= Pldmtool ${cmd_set_time}
Sridevi Rameshfe52e402020-02-05 00:15:24 -060069
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050070
Sridevi Rameshf60581b2020-04-07 05:11:12 -050071Verify 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 Rameshf60581b2020-04-07 05:11:12 -050081
George Keishingf9248952021-05-28 07:52:37 -050082 ${count}= Get Length ${attr_table_data}
Sridevi Ramesh961050b2020-11-12 11:04:30 -060083 ${attr_val_list}= Create List
84 FOR ${i} IN RANGE ${count}
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050085 Append To List ${attr_val_list} ${attr_table_data}[${i}][AttributeType]
Sridevi Ramesh961050b2020-11-12 11:04:30 -060086 END
87 Valid List attr_val_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRVALTABLE}
Sridevi Rameshfe52e402020-02-05 00:15:24 -060088
Sridevi Ramesh57537452021-01-18 03:25:05 -060089
Sridevi Ramesh57537452021-01-18 03:25:05 -060090Verify GetBIOSAttributeCurrentValueByHandle
Sridevi Ramesh57537452021-01-18 03:25:05 -060091 [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 Ramesh2ab3d382021-03-29 04:16:01 -0500102 ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data}
Sridevi Ramesh57537452021-01-18 03:25:05 -0600103 @{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 Ramesh2ab3d382021-03-29 04:16:01 -0500111
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600112*** Keywords ***
113
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500114PLDM BIOS Suite Setup
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500115 [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
120
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600121PLDM BIOS Suite Cleanup
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500122 [Documentation] Perform PLDM BIOS suite cleanup.
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600123
124 ${result}= Get Current Date UTC exclude_millis=True
125 ${current_date_time}= Evaluate re.sub(r'-* *:*', "", '${result}') modules=re
126 ${cmd_set_date_time}= Evaluate $CMD_SETDATETIME % '${current_date_time}'
127 ${pldm_output}= Pldmtool ${cmd_set_date_time}
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600128 Valid Value pldm_output['Response'] ['SUCCESS']