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