blob: adf6c84891054d1d63902e0c260d47644e5be45d [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]}
39 Should Contain ${current_time[0]} ${time[0]}
Sridevi Ramesh1495bc42020-02-04 03:13:33 -060040
41Verify 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
69Verify GetBIOSTable For StringTable
70 [Documentation] Verify GetBIOSTable for table type string table.
71 [Tags] Verify_GetBIOSTable_For_StringTable
72
Sridevi Rameshf60581b2020-04-07 05:11:12 -050073 # Example pldm_output:
Sridevi Rameshfe52e402020-02-05 00:15:24 -060074 # [biosstringhandle]: BIOSString
75 # [0]: Allowed
76 # [1]: Disabled
77 # [2]: Enabled
78 # [3]: Not Allowed
79 # [4]: Perm
80 # [5]: Temp
81 # [6]: pvm-fw-boot-side
82 # [7]: pvm-inband-code-update
83 # [8]: pvm-os-boot-side
84 # [9]: pvm-pcie-error-inject
85 # [10]: pvm-surveillance
86 # [11]: pvm-system-name
87 # [12]: vmi-if-count
88
Sridevi Rameshf60581b2020-04-07 05:11:12 -050089 ${pldm_output}= Pldmtool bios GetBIOSTable --type StringTable
Sridevi Ramesh961050b2020-11-12 11:04:30 -060090 @{keys}= Get Dictionary Keys ${pldm_output}
91 ${string_list}= Create List
92 FOR ${key} IN @{keys}
93 Append To List ${string_list} ${pldm_output['${key}']}
94 END
95 Log To Console ${string_list}
96 Valid List string_list required_values=${RESPONSE_LIST_GETBIOSTABLE_STRTABLE}
Sridevi Rameshf60581b2020-04-07 05:11:12 -050097
98
99Verify GetBIOSTable For AttributeTable
100 [Documentation] Verify if attribute table content exist for
101 ... GetBIOSTable with table type attribute table.
102 [Tags] Verify_GetBIOSTable_For_AttributeTable
103
104 # Example pldm_output:
105 # [pldm_attributetable]: True
106 # [attributehandle]: 0
107 # [ AttributeNameHandle]: 20(vmi-if1-ipv4-method)
108 # [ attributetype]: BIOSStringReadOnly
109 # [ StringType]: 0x01
110 # [ minimumstringlength]: 1
111 # [ maximumstringlength]: 100
112 # [ defaultstringlength]: 15
Sridevi Rameshf60581b2020-04-07 05:11:12 -0500113
114 ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600115 ${count}= Get Length ${pldm_output}
116 ${attr_list}= Create List
117 FOR ${i} IN RANGE ${count}
118 ${data}= Set Variable ${pldm_output}[${i}][AttributeNameHandle]
119 ${sub_string}= Get Substring ${data} 3 -1
120 Append To List ${attr_list} ${sub_string}
121 END
122 Valid List attr_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRTABLE}
Sridevi Rameshf60581b2020-04-07 05:11:12 -0500123
124Verify GetBIOSTable For AttributeValueTable
125 [Documentation] Verify if attribute value table content exist for
126 ... GetBIOSTable with table type attribute value table.
127 [Tags] Verify_GetBIOSTable_For_AttributeValueTable
128
129 # Example pldm_output:
130 # [pldm_attributevaluetable]: True
131 # [attributehandle]: 0
132 # [ attributetype]: BIOSStringReadOnly
133 # [ currentstringlength]: 15
Sridevi Rameshf60581b2020-04-07 05:11:12 -0500134
135 ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeValueTable
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600136 ${count}= Get Length ${pldm_output}
137 ${attr_val_list}= Create List
138 FOR ${i} IN RANGE ${count}
139 Append To List ${attr_val_list} ${pldm_output}[${i}][AttributeType]
140 END
141 Valid List attr_val_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRVALTABLE}
Sridevi Rameshfe52e402020-02-05 00:15:24 -0600142
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600143*** Keywords ***
144
145PLDM BIOS Suite Cleanup
Sridevi Ramesh1495bc42020-02-04 03:13:33 -0600146 [Documentation] Perform pldm BIOS suite cleanup.
147
148 ${result}= Get Current Date UTC exclude_millis=True
149 ${current_date_time}= Evaluate re.sub(r'-* *:*', "", '${result}') modules=re
150 ${cmd_set_date_time}= Evaluate $CMD_SETDATETIME % '${current_date_time}'
151 ${pldm_output}= Pldmtool ${cmd_set_date_time}
Sridevi Ramesh961050b2020-11-12 11:04:30 -0600152 Valid Value pldm_output['Response'] ['SUCCESS']