Port suite from mkumatag personal repo w/o history
All these files came from https://github.com/mkumatag/openbmc-automation
The decision to remove the commit history was because most of the 122
commits did not follow commit comment AND content best practices.
The ability to remove the commit history was possible because all
contributors where from the same company (IBM) making the coordination /
notification/acceptence easy. See all the gory details about the
first try to commit with history here...
https://github.com/openbmc/openbmc-test-automation/pull/1
This suite of tests will run against an OpenBMC based server. It will
run good/bad path testing against the REST interface. There are tests
that will also run ipmitool on the victim BMC too.
If you want to support a new system in to the suite you should only
have to edit two files...
data/<system>.py
tox.ini
The README.md contains details on how to setup for the first time along
with how to execute the test suite
NOTE: some test cases require tools that do not exist on the system.
Currently the ipmitool is needed and if you do not manually copy / link
it in to the tools directory some suites will fail.
diff --git a/tests/test_time.robot b/tests/test_time.robot
new file mode 100755
index 0000000..f3a061b
--- /dev/null
+++ b/tests/test_time.robot
@@ -0,0 +1,67 @@
+*** Settings ***
+Documentation This suite is for testing System time in Open BMC.
+
+Resource ../lib/ipmi_client.robot
+
+Library OperatingSystem
+Library SSHLibrary
+Library DateTime
+
+Suite Setup Open Connection And Log In
+Suite Teardown Close All Connections
+
+*** Variables ***
+${SYSTEM_TIME_INVALID} 01/01/1969 00:00:00
+${SYSTEM_TIME_VALID} 02/29/2016 09:10:00
+${ALLOWED_TIME_DIFF} 2
+
+*** Test Cases ***
+
+Get System Time
+ [Documentation] ***GOOD PATH***
+ ... This test case tries to get system time using IPMI and
+ ... then tries to cross check with BMC date time.
+ ... Expectation is that BMC time and ipmi sel time should match.
+
+ ${resp}= Run IPMI Standard Command sel time get
+ ${ipmidate}= Convert Date ${resp} date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes
+ ${bmcdate}= Get BMC Time And Date
+ ${diff}= Subtract Date From Date ${bmcdate} ${ipmidate}
+ Should Be True ${diff} < ${ALLOWED_TIME_DIFF} Open BMC time does not match with IPMI sel time
+
+Set Valid System Time
+ [Documentation] ***GOOD PATH***
+ ... This test case tries to set system time using IPMI and
+ ... then tries to cross check if it is correctly set in BMC.
+ ... Expectation is that BMC time should match with new time.
+
+ ${resp}= Run IPMI Standard Command sel time set "${SYSTEM_TIME_VALID}"
+ ${setdate}= Convert Date ${SYSTEM_TIME_VALID} date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes
+ ${bmcdate}= Get BMC Time And Date
+ ${diff}= Subtract Date From Date ${bmcdate} ${setdate}
+ Should Be True ${diff} < ${ALLOWED_TIME_DIFF} Open BMC time does not match with set time
+
+Set Invalid System Time
+ [Documentation] ***BAD PATH***
+ ... This test case tries to set system time with invalid time using IPMI.
+ ... Expectation is that it should return error.
+
+ ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command sel time set "${SYSTEM_TIME_INVALID}"
+ Should Start With ${msg} Specified time could not be parsed
+
+Set System Time with no time
+ [Documentation] ***BAD PATH***
+ ... This test case tries to set system time with no time using IPMI.
+ ... Expectation is that it should return error.
+
+ ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command sel time set ""
+ Should Start With ${msg} Specified time could not be parsed
+
+*** Keywords ***
+
+Get BMC Time And Date
+ ${stdout} ${stderr} ${output}= Execute Command date "+%m/%d/%Y %H:%M:%S" return_stdout=True return_stderr= True return_rc=True
+ Should Be Equal ${output} ${0} msg=${stderr}
+ ${resp}= Convert Date ${stdout} date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes
+ Should Not Be Empty ${resp}
+ [return] ${resp}