Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This suite is for testing System time in Open BMC. |
| 3 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 4 | Resource ../lib/ipmi_client.robot |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 5 | Resource ../lib/openbmc_ffdc.robot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 6 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 7 | Library OperatingSystem |
| 8 | Library DateTime |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 9 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 10 | Suite Setup Open Connection And Log In |
| 11 | Suite Teardown Close All Connections |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 12 | Test Teardown Log FFDC |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 13 | |
| 14 | *** Variables *** |
| 15 | ${SYSTEM_TIME_INVALID} 01/01/1969 00:00:00 |
| 16 | ${SYSTEM_TIME_VALID} 02/29/2016 09:10:00 |
| 17 | ${ALLOWED_TIME_DIFF} 2 |
| 18 | |
| 19 | *** Test Cases *** |
| 20 | |
| 21 | Get System Time |
| 22 | [Documentation] ***GOOD PATH*** |
| 23 | ... This test case tries to get system time using IPMI and |
| 24 | ... then tries to cross check with BMC date time. |
| 25 | ... Expectation is that BMC time and ipmi sel time should match. |
| 26 | |
| 27 | ${resp}= Run IPMI Standard Command sel time get |
| 28 | ${ipmidate}= Convert Date ${resp} date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes |
| 29 | ${bmcdate}= Get BMC Time And Date |
| 30 | ${diff}= Subtract Date From Date ${bmcdate} ${ipmidate} |
| 31 | Should Be True ${diff} < ${ALLOWED_TIME_DIFF} Open BMC time does not match with IPMI sel time |
| 32 | |
| 33 | Set Valid System Time |
| 34 | [Documentation] ***GOOD PATH*** |
| 35 | ... This test case tries to set system time using IPMI and |
| 36 | ... then tries to cross check if it is correctly set in BMC. |
| 37 | ... Expectation is that BMC time should match with new time. |
| 38 | |
| 39 | ${resp}= Run IPMI Standard Command sel time set "${SYSTEM_TIME_VALID}" |
| 40 | ${setdate}= Convert Date ${SYSTEM_TIME_VALID} date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes |
| 41 | ${bmcdate}= Get BMC Time And Date |
| 42 | ${diff}= Subtract Date From Date ${bmcdate} ${setdate} |
| 43 | Should Be True ${diff} < ${ALLOWED_TIME_DIFF} Open BMC time does not match with set time |
| 44 | |
| 45 | Set Invalid System Time |
| 46 | [Documentation] ***BAD PATH*** |
| 47 | ... This test case tries to set system time with invalid time using IPMI. |
| 48 | ... Expectation is that it should return error. |
| 49 | |
| 50 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command sel time set "${SYSTEM_TIME_INVALID}" |
| 51 | Should Start With ${msg} Specified time could not be parsed |
| 52 | |
| 53 | Set System Time with no time |
| 54 | [Documentation] ***BAD PATH*** |
| 55 | ... This test case tries to set system time with no time using IPMI. |
| 56 | ... Expectation is that it should return error. |
| 57 | |
| 58 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command sel time set "" |
| 59 | Should Start With ${msg} Specified time could not be parsed |
| 60 | |
| 61 | *** Keywords *** |
| 62 | |
| 63 | Get BMC Time And Date |
| 64 | ${stdout} ${stderr} ${output}= Execute Command date "+%m/%d/%Y %H:%M:%S" return_stdout=True return_stderr= True return_rc=True |
| 65 | Should Be Equal ${output} ${0} msg=${stderr} |
| 66 | ${resp}= Convert Date ${stdout} date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes |
| 67 | Should Not Be Empty ${resp} |
| 68 | [return] ${resp} |