blob: 68ea16f038d5accd839b834e750284f018e5a811 [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.
George Keishing845fb822016-11-01 13:23:19 -050026 [Tags] Get_System_Time
Chris Austenb29d2e82016-06-07 12:25:35 -050027
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
34Set 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 Keishing845fb822016-11-01 13:23:19 -050039 [Tags] Set_Valid_System_Time
Chris Austenb29d2e82016-06-07 12:25:35 -050040
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
47Set 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 Keishing845fb822016-11-01 13:23:19 -050051 [Tags] Set_Invalid_System_Time
Chris Austenb29d2e82016-06-07 12:25:35 -050052
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
56Set System Time with no time
George Keishing845fb822016-11-01 13:23:19 -050057 [Documentation] ***BAD PATH***
Chris Austenb29d2e82016-06-07 12:25:35 -050058 ... This test case tries to set system time with no time using IPMI.
59 ... Expectation is that it should return error.
George Keishing845fb822016-11-01 13:23:19 -050060 [Tags] Set_System_Time_with_no_time
Chris Austenb29d2e82016-06-07 12:25:35 -050061
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
67Get 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}