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