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 |
Gunnar Mills | eac1af2 | 2016-11-14 15:30:09 -0600 | [diff] [blame^] | 12 | Test Teardown FFDC On Test Case Fail |
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. |
George Keishing | 845fb82 | 2016-11-01 13:23:19 -0500 | [diff] [blame] | 26 | [Tags] Get_System_Time |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 27 | |
| 28 | ${resp}= Run IPMI Standard Command sel time get |
| 29 | ${ipmidate}= Convert Date ${resp} date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes |
| 30 | ${bmcdate}= Get BMC Time And Date |
| 31 | ${diff}= Subtract Date From Date ${bmcdate} ${ipmidate} |
| 32 | Should Be True ${diff} < ${ALLOWED_TIME_DIFF} Open BMC time does not match with IPMI sel time |
| 33 | |
| 34 | Set Valid System Time |
| 35 | [Documentation] ***GOOD PATH*** |
| 36 | ... This test case tries to set system time using IPMI and |
| 37 | ... then tries to cross check if it is correctly set in BMC. |
| 38 | ... Expectation is that BMC time should match with new time. |
George Keishing | 845fb82 | 2016-11-01 13:23:19 -0500 | [diff] [blame] | 39 | [Tags] Set_Valid_System_Time |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 40 | |
| 41 | ${resp}= Run IPMI Standard Command sel time set "${SYSTEM_TIME_VALID}" |
| 42 | ${setdate}= Convert Date ${SYSTEM_TIME_VALID} date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes |
| 43 | ${bmcdate}= Get BMC Time And Date |
| 44 | ${diff}= Subtract Date From Date ${bmcdate} ${setdate} |
| 45 | Should Be True ${diff} < ${ALLOWED_TIME_DIFF} Open BMC time does not match with set time |
| 46 | |
| 47 | Set Invalid System Time |
| 48 | [Documentation] ***BAD PATH*** |
| 49 | ... This test case tries to set system time with invalid time using IPMI. |
| 50 | ... Expectation is that it should return error. |
George Keishing | 845fb82 | 2016-11-01 13:23:19 -0500 | [diff] [blame] | 51 | [Tags] Set_Invalid_System_Time |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 52 | |
| 53 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command sel time set "${SYSTEM_TIME_INVALID}" |
| 54 | Should Start With ${msg} Specified time could not be parsed |
| 55 | |
| 56 | Set System Time with no time |
George Keishing | 845fb82 | 2016-11-01 13:23:19 -0500 | [diff] [blame] | 57 | [Documentation] ***BAD PATH*** |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 58 | ... This test case tries to set system time with no time using IPMI. |
| 59 | ... Expectation is that it should return error. |
George Keishing | 845fb82 | 2016-11-01 13:23:19 -0500 | [diff] [blame] | 60 | [Tags] Set_System_Time_with_no_time |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 61 | |
| 62 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command sel time set "" |
| 63 | Should Start With ${msg} Specified time could not be parsed |
| 64 | |
| 65 | *** Keywords *** |
| 66 | |
| 67 | Get BMC Time And Date |
| 68 | ${stdout} ${stderr} ${output}= Execute Command date "+%m/%d/%Y %H:%M:%S" return_stdout=True return_stderr= True return_rc=True |
| 69 | Should Be Equal ${output} ${0} msg=${stderr} |
| 70 | ${resp}= Convert Date ${stdout} date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes |
| 71 | Should Not Be Empty ${resp} |
| 72 | [return] ${resp} |