blob: f0c0fb390369f69aa5e78c6890a5c44353a6fef2 [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
Chris Austenb29d2e82016-06-07 12:25:35 -05005
George Keishing4d6c1da2016-07-15 05:51:22 -05006Library OperatingSystem
7Library DateTime
Chris Austenb29d2e82016-06-07 12:25:35 -05008
George Keishing4d6c1da2016-07-15 05:51:22 -05009Suite Setup Open Connection And Log In
10Suite Teardown Close All Connections
Chris Austenb29d2e82016-06-07 12:25:35 -050011
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
19Get 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
31Set 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
43Set 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
51Set 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
61Get 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}