Sridevi Ramesh | 1495bc4 | 2020-02-04 03:13:33 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Module to test PLDM BIOS commands. |
| 4 | |
| 5 | Library Collections |
| 6 | Library String |
| 7 | Library ../lib/pldm_utils.py |
| 8 | Variables ../data/pldm_variables.py |
| 9 | Resource ../lib/openbmc_ffdc.robot |
| 10 | |
| 11 | Test Setup Printn |
| 12 | Test Teardown FFDC On Test Case Fail |
| 13 | Suite Teardown PLDM BIOS Suite Cleanup |
| 14 | |
| 15 | *** Test Cases *** |
| 16 | |
| 17 | Verify GetDateTime |
| 18 | |
| 19 | [Documentation] Verify host date & time. |
| 20 | [Tags] Verify_GetDateTime |
| 21 | |
| 22 | # Example output: |
| 23 | # YYYY-MM-DD HH:MM:SS - 09-02-2020 16:51:23 |
| 24 | |
| 25 | ${pldm_output}= Pldmtool bios GetDateTime |
| 26 | @{date_time}= Split String ${pldm_output} ${SPACE} |
| 27 | @{time}= Split String ${date_time}[1] : |
| 28 | |
| 29 | # verify date & time. |
| 30 | ${current_date_time}= Get Current Date UTC exclude_millis=True |
| 31 | Should Contain ${current_date_time} ${date_time[0]} |
| 32 | Should Contain ${current_date_time} ${time[0]} |
| 33 | |
| 34 | |
| 35 | Verify SetDateTime |
| 36 | |
| 37 | [Documentation] Verify set date & time for the host. |
| 38 | [Tags] Verify_SetDateTime |
| 39 | |
| 40 | # Example output: |
| 41 | # SetDateTime: SUCCESS |
| 42 | |
| 43 | ${current_date_time}= Get Current Date UTC exclude_millis=True |
| 44 | |
| 45 | ${date}= Add Time To Date ${current_date_time} 400 days exclude_millis=True |
| 46 | ${upgrade_date}= Evaluate re.sub(r'-* *:*', "", '${date}') modules=re |
| 47 | |
| 48 | ${time}= Add Time To Date ${current_date_time} 01:01:00 exclude_millis=True |
| 49 | ${upgrade_time}= Evaluate re.sub(r'-* *:*', "", '${time}') modules=re |
| 50 | |
| 51 | # Set date. |
| 52 | ${cmd_set_date}= Evaluate $CMD_SETDATETIME % '${upgrade_date}' |
| 53 | ${pldm_output}= Pldmtool ${cmd_set_date} |
| 54 | Valid Value pldm_output['setdatetime'] 'SUCCESS' |
| 55 | |
| 56 | # Set time. |
| 57 | ${cmd_set_time}= Evaluate $CMD_SETDATETIME % '${upgrade_time}' |
| 58 | ${pldm_output}= Pldmtool ${cmd_set_time} |
| 59 | Valid Value pldm_output['setdatetime'] 'SUCCESS' |
| 60 | |
| 61 | *** Keywords *** |
| 62 | |
| 63 | PLDM BIOS Suite Cleanup |
| 64 | |
| 65 | [Documentation] Perform pldm BIOS suite cleanup. |
| 66 | |
| 67 | ${result}= Get Current Date UTC exclude_millis=True |
| 68 | ${current_date_time}= Evaluate re.sub(r'-* *:*', "", '${result}') modules=re |
| 69 | ${cmd_set_date_time}= Evaluate $CMD_SETDATETIME % '${current_date_time}' |
| 70 | ${pldm_output}= Pldmtool ${cmd_set_date_time} |
| 71 | Valid Value pldm_output['setdatetime'] 'SUCCESS' |