blob: a5ef65d5b1ef5d51c40241d840f98ec8c67ab7b6 [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
13Suite Teardown PLDM BIOS Suite Cleanup
14
15*** Test Cases ***
16
17Verify GetDateTime
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060018 [Documentation] Verify host date & time.
19 [Tags] Verify_GetDateTime
20
21 # Example output:
Sridevi Ramesh961050b2020-11-12 11:04:30 -060022 # {
23 # "Response": "2020-11-07 07:10:10"
24 # }
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060025
26 ${pldm_output}= Pldmtool bios GetDateTime
Sridevi Ramesh961050b2020-11-12 11:04:30 -060027 @{date_time}= Split String ${pldm_output['Response']} ${SPACE}
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060028 @{time}= Split String ${date_time}[1] :
29
30 # verify date & time.
Sridevi Ramesh961050b2020-11-12 11:04:30 -060031 ${utc}= Get Current Date UTC exclude_millis=True
32 @{current_dmy}= Split String ${utc} ${SPACE}
33 @{current_time}= Split String ${current_dmy[1]} :
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060034
Sridevi Ramesh961050b2020-11-12 11:04:30 -060035 # Example output:
36 # 2020-11-25 07:34:30
37
38 Should Contain ${current_dmy[0]} ${date_time[0]}
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060039
40Verify SetDateTime
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060041 [Documentation] Verify set date & time for the host.
42 [Tags] Verify_SetDateTime
43
44 # Example output:
Sridevi Ramesh961050b2020-11-12 11:04:30 -060045 # {
46 # "Response": "SUCCESS"
47 # }
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060048
49 ${current_date_time}= Get Current Date UTC exclude_millis=True
Sridevi Ramesh961050b2020-11-12 11:04:30 -060050 # Example output:
51 # 2020-11-25 07:34:30
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060052
53 ${date}= Add Time To Date ${current_date_time} 400 days exclude_millis=True
54 ${upgrade_date}= Evaluate re.sub(r'-* *:*', "", '${date}') modules=re
55
56 ${time}= Add Time To Date ${current_date_time} 01:01:00 exclude_millis=True
57 ${upgrade_time}= Evaluate re.sub(r'-* *:*', "", '${time}') modules=re
58
59 # Set date.
60 ${cmd_set_date}= Evaluate $CMD_SETDATETIME % '${upgrade_date}'
61 ${pldm_output}= Pldmtool ${cmd_set_date}
Sridevi Ramesh961050b2020-11-12 11:04:30 -060062 Valid Value pldm_output['Response'] ['SUCCESS']
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060063
64 # Set time.
65 ${cmd_set_time}= Evaluate $CMD_SETDATETIME % '${upgrade_time}'
66 ${pldm_output}= Pldmtool ${cmd_set_time}
Sridevi Rameshfe52e402020-02-05 00:15:24 -060067
68Verify GetBIOSTable For StringTable
69 [Documentation] Verify GetBIOSTable for table type string table.
70 [Tags] Verify_GetBIOSTable_For_StringTable
71
Sridevi Rameshf60581b2020-04-07 05:11:12 -050072 # Example pldm_output:
Sridevi Rameshfe52e402020-02-05 00:15:24 -060073 # [biosstringhandle]: BIOSString
74 # [0]: Allowed
75 # [1]: Disabled
76 # [2]: Enabled
77 # [3]: Not Allowed
78 # [4]: Perm
79 # [5]: Temp
Sridevi Ramesh297d41b2021-02-02 09:16:55 -060080 # [6]: pvm_fw_boot_side
81 # [7]: pvm_inband_code_update
82 # [8]: pvm_os_boot_side
83 # [9]: pvm_pcie_error_inject
84 # [10]: pvm_surveillance
85 # [11]: pvm_system_name
86 # [12]: vmi_if_count
Sridevi Rameshfe52e402020-02-05 00:15:24 -060087
Sridevi Rameshf60581b2020-04-07 05:11:12 -050088 ${pldm_output}= Pldmtool bios GetBIOSTable --type StringTable
Sridevi Ramesh961050b2020-11-12 11:04:30 -060089 @{keys}= Get Dictionary Keys ${pldm_output}
90 ${string_list}= Create List
91 FOR ${key} IN @{keys}
92 Append To List ${string_list} ${pldm_output['${key}']}
93 END
94 Log To Console ${string_list}
95 Valid List string_list required_values=${RESPONSE_LIST_GETBIOSTABLE_STRTABLE}
Sridevi Rameshf60581b2020-04-07 05:11:12 -050096
97
98Verify GetBIOSTable For AttributeTable
99 [Documentation] Verify if attribute table content exist for
100 ... GetBIOSTable with table type attribute table.
101 [Tags] Verify_GetBIOSTable_For_AttributeTable
102
103 # Example pldm_output:
104 # [pldm_attributetable]: True
105 # [attributehandle]: 0
106 # [ AttributeNameHandle]: 20(vmi-if1-ipv4-method)
107 # [ attributetype]: BIOSStringReadOnly
108 # [ StringType]: 0x01
109 # [ minimumstringlength]: 1
110 # [ maximumstringlength]: 100
111 # [ defaultstringlength]: 15
Sridevi Rameshf60581b2020-04-07 05:11:12 -0500112
113 ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600114 ${count}= Get Length ${pldm_output}
115 ${attr_list}= Create List
116 FOR ${i} IN RANGE ${count}
117 ${data}= Set Variable ${pldm_output}[${i}][AttributeNameHandle]
118 ${sub_string}= Get Substring ${data} 3 -1
119 Append To List ${attr_list} ${sub_string}
120 END
121 Valid List attr_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRTABLE}
Sridevi Rameshf60581b2020-04-07 05:11:12 -0500122
123Verify GetBIOSTable For AttributeValueTable
124 [Documentation] Verify if attribute value table content exist for
125 ... GetBIOSTable with table type attribute value table.
126 [Tags] Verify_GetBIOSTable_For_AttributeValueTable
127
128 # Example pldm_output:
129 # [pldm_attributevaluetable]: True
130 # [attributehandle]: 0
131 # [ attributetype]: BIOSStringReadOnly
132 # [ currentstringlength]: 15
Sridevi Rameshf60581b2020-04-07 05:11:12 -0500133
134 ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeValueTable
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600135 ${count}= Get Length ${pldm_output}
136 ${attr_val_list}= Create List
137 FOR ${i} IN RANGE ${count}
138 Append To List ${attr_val_list} ${pldm_output}[${i}][AttributeType]
139 END
140 Valid List attr_val_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRVALTABLE}
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600141
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600142*** Keywords ***
143
144PLDM BIOS Suite Cleanup
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600145 [Documentation] Perform pldm BIOS suite cleanup.
146
147 ${result}= Get Current Date UTC exclude_millis=True
148 ${current_date_time}= Evaluate re.sub(r'-* *:*', "", '${result}') modules=re
149 ${cmd_set_date_time}= Evaluate $CMD_SETDATETIME % '${current_date_time}'
150 ${pldm_output}= Pldmtool ${cmd_set_date_time}
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600151 Valid Value pldm_output['Response'] ['SUCCESS']