blob: 16d163cee44e91e769b8a072e2eb06a516f5f8e9 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
2Documentation This suite is for testing System time in Open BMC.
3
George Keishing4d6c1da2016-07-15 05:51:22 -05004Resource ../lib/ipmi_client.robot
George Keishingd55a4be2016-08-26 03:28:17 -05005Resource ../lib/openbmc_ffdc.robot
Chris Austenb29d2e82016-06-07 12:25:35 -05006
George Keishing4d6c1da2016-07-15 05:51:22 -05007Library OperatingSystem
8Library DateTime
Chris Austenb29d2e82016-06-07 12:25:35 -05009
George Keishing4d6c1da2016-07-15 05:51:22 -050010Suite Setup Open Connection And Log In
11Suite Teardown Close All Connections
George Keishingd55a4be2016-08-26 03:28:17 -050012Test Teardown Log FFDC
Chris Austenb29d2e82016-06-07 12:25:35 -050013
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
21Get 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
33Set 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
45Set 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
53Set 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
63Get 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}