blob: 0e651b7d1263ce66c73e44ae6cb525356ad3a4eb [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
George Keishing2e56ad92022-10-12 11:39:54 -050031 ${bmc_date}= Get Current Date from BMC
32 # Date format example: 2022-10-12 16:31:17
33 Log To Console BMC Date: ${bmc_date}
34 # Example : ['2022-10-12', '16:31:17']
35 @{current_time}= Split String ${bmc_date} ${EMPTY}
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060036
George Keishing2e56ad92022-10-12 11:39:54 -050037 # verify date matching pldmtool vs BMC current time.
38 Should Contain ${current_time} ${date_time[0]}
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060039
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050040
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060041Verify SetDateTime
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060042 [Documentation] Verify set date & time for the host.
43 [Tags] Verify_SetDateTime
44
45 # Example output:
Sridevi Ramesh961050b2020-11-12 11:04:30 -060046 # {
47 # "Response": "SUCCESS"
48 # }
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060049
50 ${current_date_time}= Get Current Date UTC exclude_millis=True
Sridevi Ramesh961050b2020-11-12 11:04:30 -060051 # Example output:
52 # 2020-11-25 07:34:30
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060053
54 ${date}= Add Time To Date ${current_date_time} 400 days exclude_millis=True
55 ${upgrade_date}= Evaluate re.sub(r'-* *:*', "", '${date}') modules=re
56
57 ${time}= Add Time To Date ${current_date_time} 01:01:00 exclude_millis=True
58 ${upgrade_time}= Evaluate re.sub(r'-* *:*', "", '${time}') modules=re
59
60 # Set date.
61 ${cmd_set_date}= Evaluate $CMD_SETDATETIME % '${upgrade_date}'
62 ${pldm_output}= Pldmtool ${cmd_set_date}
Sridevi Ramesh961050b2020-11-12 11:04:30 -060063 Valid Value pldm_output['Response'] ['SUCCESS']
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060064
65 # Set time.
66 ${cmd_set_time}= Evaluate $CMD_SETDATETIME % '${upgrade_time}'
67 ${pldm_output}= Pldmtool ${cmd_set_time}
Sridevi Rameshfe52e402020-02-05 00:15:24 -060068
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050069
Sridevi Rameshf60581b2020-04-07 05:11:12 -050070Verify GetBIOSTable For AttributeValueTable
71 [Documentation] Verify if attribute value table content exist for
72 ... GetBIOSTable with table type attribute value table.
73 [Tags] Verify_GetBIOSTable_For_AttributeValueTable
74
75 # Example pldm_output:
76 # [pldm_attributevaluetable]: True
77 # [attributehandle]: 0
78 # [ attributetype]: BIOSStringReadOnly
79 # [ currentstringlength]: 15
Sridevi Rameshf60581b2020-04-07 05:11:12 -050080
George Keishingf9248952021-05-28 07:52:37 -050081 ${count}= Get Length ${attr_table_data}
Sridevi Ramesh961050b2020-11-12 11:04:30 -060082 ${attr_val_list}= Create List
83 FOR ${i} IN RANGE ${count}
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050084 Append To List ${attr_val_list} ${attr_table_data}[${i}][AttributeType]
Sridevi Ramesh961050b2020-11-12 11:04:30 -060085 END
86 Valid List attr_val_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRVALTABLE}
Sridevi Rameshfe52e402020-02-05 00:15:24 -060087
Sridevi Ramesh57537452021-01-18 03:25:05 -060088
Sridevi Ramesh57537452021-01-18 03:25:05 -060089Verify GetBIOSAttributeCurrentValueByHandle
Sridevi Ramesh57537452021-01-18 03:25:05 -060090 [Documentation] Verify GetBIOSAttributeCurrentValueByHandle with the
91 ... various BIOS attribute handle and its values.
92 [Tags] Verify_GetBIOSAttributeCurrentValueByHandle
93
94 # Example output:
95 #
96 # pldmtool bios GetBIOSAttributeCurrentValueByHandle -a pvm_fw_boot_side
97 # {
98 # "CurrentValue": "Temp"
99 # }
100
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500101 ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data}
Sridevi Ramesh57537452021-01-18 03:25:05 -0600102 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
103 FOR ${i} IN @{attr_handles}
104 ${cur_attr}= Pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${i}
105 @{attr_val_list}= Set Variable ${attr_val_data}[${i}]
106 Run Keyword If '${cur_attr['CurrentValue']}' not in @{attr_val_list}
107 ... Fail Invalid GetBIOSAttributeCurrentValueByHandle value found.
108 END
109
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500110
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600111*** Keywords ***
112
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500113PLDM BIOS Suite Setup
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500114 [Documentation] Perform PLDM BIOS suite setup.
115
116 ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable
117 Set Global Variable ${attr_table_data} ${pldm_output}
118
George Keishing1d149702022-09-20 01:53:38 -0500119 Set Time To Manual Mode
120
121 Sleep 10s
122
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500123
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600124PLDM BIOS Suite Cleanup
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500125 [Documentation] Perform PLDM BIOS suite cleanup.
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600126
127 ${result}= Get Current Date UTC exclude_millis=True
128 ${current_date_time}= Evaluate re.sub(r'-* *:*', "", '${result}') modules=re
129 ${cmd_set_date_time}= Evaluate $CMD_SETDATETIME % '${current_date_time}'
130 ${pldm_output}= Pldmtool ${cmd_set_date_time}
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600131 Valid Value pldm_output['Response'] ['SUCCESS']
George Keishing1d149702022-09-20 01:53:38 -0500132
133
134Set Time To Manual Mode
135 [Documentation] Set date time to manual mode via Redfish.
136
George Keishinga92a2e12022-09-20 02:12:42 -0500137 Redfish.Login
George Keishing1d149702022-09-20 01:53:38 -0500138 Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body={'NTP':{'ProtocolEnabled': ${False}}}
139 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
George Keishing2e56ad92022-10-12 11:39:54 -0500140
141
142Get Current Date from BMC
143 [Documentation] Runs the date command from BMC and returns current date and time.
144
145 # Get Current Date from BMC.
146 ${date} ${stderr} ${rc}= BMC Execute Command date
147
148 # Split the string and remove first and 2nd last value from the list and
149 # join to form %d %b %H:%M:%S %Y date format
150 ${date}= Split String ${date}
151 Remove From List ${date} 0
152 Remove From List ${date} -2
153 ${date}= Evaluate " ".join(${date})
154
155 # Convert the date format to %Y/%m/%d %H:%M:%S
156 ${date}= Convert Date ${date} date_format=%b %d %H:%M:%S %Y
157 ... result_format=%Y-%m-%d %H:%M:%S exclude_millis=True
158
159 [Return] ${date}