blob: adf6c84891054d1d63902e0c260d47644e5be45d [file] [log] [blame]
*** Settings ***
Documentation Module to test PLDM BIOS commands.
Library Collections
Library String
Library ../lib/pldm_utils.py
Variables ../data/pldm_variables.py
Resource ../lib/openbmc_ffdc.robot
Test Setup Printn
Test Teardown FFDC On Test Case Fail
Suite Teardown PLDM BIOS Suite Cleanup
*** Test Cases ***
Verify GetDateTime
[Documentation] Verify host date & time.
[Tags] Verify_GetDateTime
# Example output:
# {
# "Response": "2020-11-07 07:10:10"
# }
${pldm_output}= Pldmtool bios GetDateTime
@{date_time}= Split String ${pldm_output['Response']} ${SPACE}
@{time}= Split String ${date_time}[1] :
# verify date & time.
${utc}= Get Current Date UTC exclude_millis=True
@{current_dmy}= Split String ${utc} ${SPACE}
@{current_time}= Split String ${current_dmy[1]} :
# Example output:
# 2020-11-25 07:34:30
Should Contain ${current_dmy[0]} ${date_time[0]}
Should Contain ${current_time[0]} ${time[0]}
Verify SetDateTime
[Documentation] Verify set date & time for the host.
[Tags] Verify_SetDateTime
# Example output:
# {
# "Response": "SUCCESS"
# }
${current_date_time}= Get Current Date UTC exclude_millis=True
# Example output:
# 2020-11-25 07:34:30
${date}= Add Time To Date ${current_date_time} 400 days exclude_millis=True
${upgrade_date}= Evaluate re.sub(r'-* *:*', "", '${date}') modules=re
${time}= Add Time To Date ${current_date_time} 01:01:00 exclude_millis=True
${upgrade_time}= Evaluate re.sub(r'-* *:*', "", '${time}') modules=re
# Set date.
${cmd_set_date}= Evaluate $CMD_SETDATETIME % '${upgrade_date}'
${pldm_output}= Pldmtool ${cmd_set_date}
Valid Value pldm_output['Response'] ['SUCCESS']
# Set time.
${cmd_set_time}= Evaluate $CMD_SETDATETIME % '${upgrade_time}'
${pldm_output}= Pldmtool ${cmd_set_time}
Verify GetBIOSTable For StringTable
[Documentation] Verify GetBIOSTable for table type string table.
[Tags] Verify_GetBIOSTable_For_StringTable
# Example pldm_output:
# [biosstringhandle]: BIOSString
# [0]: Allowed
# [1]: Disabled
# [2]: Enabled
# [3]: Not Allowed
# [4]: Perm
# [5]: Temp
# [6]: pvm-fw-boot-side
# [7]: pvm-inband-code-update
# [8]: pvm-os-boot-side
# [9]: pvm-pcie-error-inject
# [10]: pvm-surveillance
# [11]: pvm-system-name
# [12]: vmi-if-count
${pldm_output}= Pldmtool bios GetBIOSTable --type StringTable
@{keys}= Get Dictionary Keys ${pldm_output}
${string_list}= Create List
FOR ${key} IN @{keys}
Append To List ${string_list} ${pldm_output['${key}']}
END
Log To Console ${string_list}
Valid List string_list required_values=${RESPONSE_LIST_GETBIOSTABLE_STRTABLE}
Verify GetBIOSTable For AttributeTable
[Documentation] Verify if attribute table content exist for
... GetBIOSTable with table type attribute table.
[Tags] Verify_GetBIOSTable_For_AttributeTable
# Example pldm_output:
# [pldm_attributetable]: True
# [attributehandle]: 0
# [ AttributeNameHandle]: 20(vmi-if1-ipv4-method)
# [ attributetype]: BIOSStringReadOnly
# [ StringType]: 0x01
# [ minimumstringlength]: 1
# [ maximumstringlength]: 100
# [ defaultstringlength]: 15
${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable
${count}= Get Length ${pldm_output}
${attr_list}= Create List
FOR ${i} IN RANGE ${count}
${data}= Set Variable ${pldm_output}[${i}][AttributeNameHandle]
${sub_string}= Get Substring ${data} 3 -1
Append To List ${attr_list} ${sub_string}
END
Valid List attr_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRTABLE}
Verify GetBIOSTable For AttributeValueTable
[Documentation] Verify if attribute value table content exist for
... GetBIOSTable with table type attribute value table.
[Tags] Verify_GetBIOSTable_For_AttributeValueTable
# Example pldm_output:
# [pldm_attributevaluetable]: True
# [attributehandle]: 0
# [ attributetype]: BIOSStringReadOnly
# [ currentstringlength]: 15
${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeValueTable
${count}= Get Length ${pldm_output}
${attr_val_list}= Create List
FOR ${i} IN RANGE ${count}
Append To List ${attr_val_list} ${pldm_output}[${i}][AttributeType]
END
Valid List attr_val_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRVALTABLE}
*** Keywords ***
PLDM BIOS Suite Cleanup
[Documentation] Perform pldm BIOS suite cleanup.
${result}= Get Current Date UTC exclude_millis=True
${current_date_time}= Evaluate re.sub(r'-* *:*', "", '${result}') modules=re
${cmd_set_date_time}= Evaluate $CMD_SETDATETIME % '${current_date_time}'
${pldm_output}= Pldmtool ${cmd_set_date_time}
Valid Value pldm_output['Response'] ['SUCCESS']