Refactored time test cases to use new xyz interface.
This also includes:
- Added two new test cases:
- Set BMC Time With Host And NTP
- Set Host Time With Host And NTP
- Removed time test cases from all skip lists.
Resolves openbmc/openbmc-test-automation#890
Change-Id: I39c588b9d276d3f9a5cb5a3fc231c7bba27d5bf0
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/data/variables.py b/data/variables.py
index f8dd91f..d498f84 100644
--- a/data/variables.py
+++ b/data/variables.py
@@ -105,6 +105,15 @@
BOOT_MODE_SETUP = 'xyz.openbmc_project.Control.Boot.Mode.Modes.Setup'
BOOT_MODE_REGULAR = 'xyz.openbmc_project.Control.Boot.Mode.Modes.Regular'
+# Time variables.
+TIME_DBUS_BASE = 'xyz.openbmc_project.Time.'
+BMC_OWNER = TIME_DBUS_BASE + 'Owner.Owners.BMC'
+HOST_OWNER = TIME_DBUS_BASE + 'Owner.Owners.Host'
+SPLIT_OWNER = TIME_DBUS_BASE + 'Owner.Owners.Split'
+BOTH_OWNER = TIME_DBUS_BASE + 'Owner.Owners.Both'
+NTP_MODE = TIME_DBUS_BASE + 'Synchronization.Method.NTP'
+MANUAL_MODE = TIME_DBUS_BASE + 'Synchronization.Method.Manual'
+
'''
QEMU HTTPS variable:
diff --git a/test_lists/skip_test_barreleye b/test_lists/skip_test_barreleye
index 18ed899..cbe1440 100644
--- a/test_lists/skip_test_barreleye
+++ b/test_lists/skip_test_barreleye
@@ -35,7 +35,5 @@
# Applicable only for witherspoon
-e Verify_Boxelder_Present_Property
-e Verify_Boxelder_MAC_Address_Property_Is_Populated
-# https://github.com/openbmc/openbmc-test-automation/issues/907
--e Clock_Time
# https://github.com/openbmc/openbmc-test-automation/issues/874
-e User_Management
diff --git a/test_lists/skip_test_palmetto b/test_lists/skip_test_palmetto
index bce9d7c..2ad97e1 100644
--- a/test_lists/skip_test_palmetto
+++ b/test_lists/skip_test_palmetto
@@ -46,7 +46,5 @@
# Applicable only for witherspoon
-e Verify_Boxelder_Present_Property
-e Verify_Boxelder_MAC_Address_Property_Is_Populated
-# https://github.com/openbmc/openbmc-test-automation/issues/907
--e Clock_Time
# https://github.com/openbmc/openbmc-test-automation/issues/874
-e User_Management
diff --git a/test_lists/skip_test_witherspoon b/test_lists/skip_test_witherspoon
index 976b74e..0c39dc4 100644
--- a/test_lists/skip_test_witherspoon
+++ b/test_lists/skip_test_witherspoon
@@ -8,8 +8,6 @@
-e Verify_Minimal_Memory_Buffer_Inventory
-e Verify_Minimal_Main_Planar_Inventory
-e Verify_Minimal_System_Inventory
-# https://github.com/openbmc/openbmc-test-automation/issues/907
--e Clock_Time
#https://github.com/openbmc/openbmc/issues/901
-e Set_BMC_Time_With_Split_And_Manual
# https://github.com/openbmc/openbmc-test-automation/issues/874
diff --git a/tests/test_time.robot b/tests/test_time.robot
index 8cb07d8..02144fe 100644
--- a/tests/test_time.robot
+++ b/tests/test_time.robot
@@ -18,9 +18,9 @@
*** Variables ***
${SYSTEM_TIME_INVALID} 01/01/1969 00:00:00
${SYSTEM_TIME_VALID} 02/29/2016 09:10:00
-${SYSTEM_TIME_VALID_EPOCH} 1456737000 #Equivalent epoch time for 02/29/2016 09:10:00
${ALLOWED_TIME_DIFF} 3
-${SETTING_HOST} ${SETTINGS_URI}host0
+# Equivalent epoch time for 02/17/2017 04:11:40
+${SYSTEM_TIME_VALID_EPOCH} ${1487304700000000}
*** Test Cases ***
@@ -43,8 +43,8 @@
... correctly set in BMC.
[Tags] Set_Valid_System_Time
- Set Time Owner HOST
- Set Time Mode MANUAL
+ Set Time Owner ${HOST_OWNER}
+ Set Time Mode ${MANUAL_MODE}
${resp}= Run IPMI Standard Command sel time set "${SYSTEM_TIME_VALID}"
${setdate}= Convert Date ${SYSTEM_TIME_VALID}
@@ -60,8 +60,8 @@
... that it should throw error.
[Tags] Set_Invalid_System_Time
- Set Time Owner HOST
- Set Time Mode MANUAL
+ Set Time Owner ${HOST_OWNER}
+ Set Time Mode ${MANUAL_MODE}
${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
... sel time set "${SYSTEM_TIME_INVALID}"
@@ -72,8 +72,8 @@
... that it should throw error.
[Tags] Set_System_Time_with_no_time
- Set Time Owner HOST
- Set Time Mode MANUAL
+ Set Time Owner ${HOST_OWNER}
+ Set Time Mode ${MANUAL_MODE}
${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
... sel time set ""
@@ -81,8 +81,8 @@
Set BMC Time With BMC And Manual
- #Operation Owner Mode Status BMC Time Host Time
- Set BMC Time BMC MANUAL ok Set Change
+ #Operation Owner Mode Status BMC Time Host Time
+ Set BMC Time ${BMC_OWNER} ${MANUAL_MODE} ok Set Change
[Documentation] Set BMC time when time owner is BMC and time mode is
... manual.
@@ -90,8 +90,8 @@
[Template] Set Time Using REST
Set BMC Time With Both And Manual
- #Operation Owner Mode Status BMC Time Host Time
- Set BMC Time BOTH MANUAL ok Set Change
+ #Operation Owner Mode Status BMC Time Host Time
+ Set BMC Time ${BOTH_OWNER} ${MANUAL_MODE} ok Set Change
[Documentation] Set BMC time when time owner is Both and time mode is
... manual.
@@ -100,8 +100,8 @@
Set BMC Time With Split And Manual
- #Operation Owner Mode Status BMC Time Host Time
- Set BMC Time SPLIT MANUAL ok Set No Change
+ #Operation Owner Mode Status BMC Time Host Time
+ Set BMC Time ${SPLIT_OWNER} ${MANUAL_MODE} ok Set No Change
[Documentation] Set BMC time when time owner is Split and time mode is
... manual.
@@ -109,8 +109,8 @@
[Template] Set Time Using REST
Set BMC Time With BMC And NTP
- #Operation Owner Mode Status BMC Time Host Time
- Set BMC Time BMC NTP error Not Set No Change
+ #Operation Owner Mode Status BMC Time Host Time
+ Set BMC Time ${BMC_OWNER} ${NTP_MODE} ok Not Set No Change
[Documentation] Set BMC time when time owner is BMC and time mode is
... NTP.
@@ -118,16 +118,16 @@
[Template] Set Time Using REST
Set BMC Time With Host And Manual
- #Operation Owner Mode Status BMC Time Host Time
- Set BMC Time HOST MANUAL error Not Set No Change
+ #Operation Owner Mode Status BMC Time Host Time
+ Set BMC Time ${HOST_OWNER} ${MANUAL_MODE} ok Not Set No Change
[Documentation] Set BMC time when time owner is Host and time mode is
... Manual.
[Tags] Set_BMC_Time_With_Host_And_Manual
[Template] Set Time Using REST
Set BMC Time With Both And NTP
- #Operation Owner Mode Status BMC Time Host Time
- Set BMC Time BOTH NTP error Not Set No Change
+ #Operation Owner Mode Status BMC Time Host Time
+ Set BMC Time ${BOTH_OWNER} ${NTP_MODE} ok Not Set No Change
[Documentation] Set BMC time when time owner is Both and time mode is
... NTP.
@@ -135,17 +135,27 @@
[Template] Set Time Using REST
Set BMC Time With Split And NTP
- #Operation Owner Mode Status BMC Time Host Time
- Set BMC Time SPLIT NTP error Not Set No Change
+ #Operation Owner Mode Status BMC Time Host Time
+ Set BMC Time ${SPLIT_OWNER} ${NTP_MODE} ok Not Set No Change
[Documentation] Set BMC time when time owner is Split and time mode is
... NTP.
[Tags] Set_BMC_Time_With_Split_And_NTP
[Template] Set Time Using REST
+Set BMC Time With Host And NTP
+ #Operation Owner Mode Status BMC Time Host Time
+ Set BMC Time ${HOST_OWNER} ${NTP_MODE} ok Not Set No Change
+
+ [Documentation] Set BMC time when time owner is Host and time mode is
+ ... NTP.
+ [Tags] Set_BMC_Time_With_Host_And_NTP
+ [Template] Set Time Using REST
+
+
Set Host Time With Host And Manual
- #Operation Owner Mode Status BMC Time Host Time
- Set Host Time HOST MANUAL ok Change Set
+ #Operation Owner Mode Status BMC Time Host Time
+ Set Host Time ${HOST_OWNER} ${MANUAL_MODE} ok Change Set
[Documentation] Set host time when time owner is host and time mode is
... manual.
@@ -153,8 +163,8 @@
[Template] Set Time Using REST
Set Host Time With Both And Manual
- #Operation Owner Mode Status BMC Time Host Time
- Set Host Time BOTH MANUAL ok Change Set
+ #Operation Owner Mode Status BMC Time Host Time
+ Set Host Time ${BOTH_OWNER} ${MANUAL_MODE} ok Change Set
[Documentation] Set host time when time owner is both and time mode is
... manual.
@@ -162,8 +172,8 @@
[Template] Set Time Using REST
Set Host Time With Both And NTP
- #Operation Owner Mode Status BMC Time Host Time
- Set Host Time BOTH NTP error No Change Not Set
+ #Operation Owner Mode Status BMC Time Host Time
+ Set Host Time ${BOTH_OWNER} ${NTP_MODE} ok No Change Not Set
[Documentation] Set host time when time owner is both and time mode is
... NTP.
@@ -171,8 +181,8 @@
[Template] Set Time Using REST
Set Host Time With Split And Manual
- #Operation Owner Mode Status BMC Time Host Time
- Set Host Time SPLIT MANUAL ok No Change Set
+ #Operation Owner Mode Status BMC Time Host Time
+ Set Host Time ${SPLIT_OWNER} ${MANUAL_MODE} ok No Change Set
[Documentation] Set host time when time owner is split and time mode is
... manual.
@@ -180,8 +190,8 @@
[Template] Set Time Using REST
Set Host Time With Split And NTP
- #Operation Owner Mode Status BMC Time HOST Time
- Set Host Time SPLIT NTP ok No Change Set
+ #Operation Owner Mode Status BMC Time HOST Time
+ Set Host Time ${SPLIT_OWNER} ${NTP_MODE} ok No Change Set
[Documentation] Set host time when time owner is split and time mode is
... NTP.
@@ -189,52 +199,63 @@
[Template] Set Time Using REST
Set Host Time With BMC And Manual
- #Operation Owner Mode Status BMC Time HOST Time
- Set Host Time BMC MANUAL error No Change Not Set
+ #Operation Owner Mode Status BMC Time HOST Time
+ Set Host Time ${BMC_OWNER} ${MANUAL_MODE} ok No Change Not Set
[Documentation] Set host time when time owner is BMC and time mode is
... Manual.
[Tags] Set_Host_Time_With_BMC_And_Manual
[Template] Set Time Using REST
Set Host Time With BMC Owner NTP
- #Operation Owner Mode Status BMC Time HOST Time
- Set Host Time BMC NTP error No Change Not Set
+ #Operation Owner Mode Status BMC Time HOST Time
+ Set Host Time ${BMC_OWNER} ${NTP_MODE} ok No Change Not Set
[Documentation] Set host time when time owner is BMC and time mode is
... NTP.
[Tags] Set_Host_Time_With_BMC_And_NTP
[Template] Set Time Using REST
+Set Host Time With Host And NTP
+ #Operation Owner Mode Status BMC Time Host Time
+ Set Host Time ${HOST_OWNER} ${NTP_MODE} ok Not Change No Set
+
+ [Documentation] Set host time when time owner is Host and time mode is
+ ... NTP.
+ [Tags] Set_Host_Time_With_Host_And_NTP
+ [Template] Set Time Using REST
+
Set Invalid Time Mode
[Documentation] Set time mode with invalid value using REST and verify
... that it should throw error.
[Tags] Set_Invalid_Time_Mode
- ${timemode}= Set Variable abc
+ ${timemode}=
+ ... Set Variable xyz.openbmc_project.Time.Synchronization.Method.abc
${valueDict}= Create Dictionary data=${timemode}
${resp}= OpenBMC Put Request
- ... ${SETTING_HOST}/attr/time_mode data=${valueDict}
+ ... ${TIME_MANAGER_URI}sync_method/attr/TimeSyncMethod data=${valueDict}
${jsondata}= to JSON ${resp.content}
Should Be Equal ${jsondata['status']} error
- ${mode}= Read Attribute ${SETTING_HOST} time_mode
- Should Not Be Equal ${mode} abc
+ ${mode}= Read Attribute ${TIME_MANAGER_URI}sync_method TimeSyncMethod
+ Should Not Be Equal ${mode}
+ ... xyz.openbmc_project.Time.Synchronization.Method.abc
Set Invalid Time Owner
[Documentation] Set time owner with invalid value using REST and verify
... that it should throw error.
[Tags] Set_Invalid_Time_Owner
- ${timeowner}= Set Variable xyz
+ ${timeowner}= Set Variable xyz.openbmc_project.Time.Owner.Owners.xyz
${valueDict}= Create Dictionary data=${timeowner}
${resp}= OpenBMC Put Request
- ... ${SETTING_HOST}/attr/time_owner data=${valueDict}
+ ... ${TIME_MANAGER_URI}owner/attr/TimeOwner data=${valueDict}
${jsondata}= to JSON ${resp.content}
Should Be Equal ${jsondata['status']} error
- ${owner}= Read Attribute ${SETTING_HOST} time_owner
- Should Not Be Equal ${owner} xyz
+ ${owner}= Read Attribute ${TIME_MANAGER_URI}owner TimeOwner
+ Should Not Be Equal ${owner} xyz.openbmc_project.Time.Owner.Owners.xyz
*** Keywords ***
@@ -260,7 +281,7 @@
${valueDict}= Create Dictionary data=${timeowner}
${resp}= OpenBMC Put Request
- ... ${SETTING_HOST}/attr/time_owner data=${valueDict}
+ ... ${TIME_MANAGER_URI}owner/attr/TimeOwner data=${valueDict}
${jsondata}= to JSON ${resp.content}
${host_state}= Get Host State
@@ -270,15 +291,12 @@
... ELSE Run keyword
... Initiate Host PowerOff
- ${owner}= Read Attribute ${SETTING_HOST} time_owner
+ ${owner}= Read Attribute ${TIME_MANAGER_URI}owner TimeOwner
Should Be Equal ${owner} ${args}
- ${current_mode}=
- ... Read Attribute ${TIME_MANAGER_URI.rstrip("/")} curr_time_owner
- Should Be Equal ${current_mode} ${args}
-
[Return] ${jsondata['status']}
+
Set Time Mode
[Arguments] ${args}
[Documentation] Set time mode of the system via REST
@@ -287,47 +305,32 @@
${valueDict}= Create Dictionary data=${timemode}
${resp}= OpenBMC Put Request
- ... ${SETTING_HOST}/attr/time_mode data=${valueDict}
+ ... ${TIME_MANAGER_URI}sync_method/attr/TimeSyncMethod data=${valueDict}
${jsondata}= to JSON ${resp.content}
Sleep 5s
- ${mode}= Read Attribute ${SETTING_HOST} time_mode
+ ${mode}= Read Attribute ${TIME_MANAGER_URI}sync_method TimeSyncMethod
Should Be Equal ${mode} ${args}
- ${current_mode}=
- ... Read Attribute ${TIME_MANAGER_URI.rstrip("/")} curr_time_mode
- Should Be Equal ${current_mode} ${args}
Get BMC Time Using REST
[Documentation] Returns BMC time of the system via REST
- ... Time Format : YYYY-MM-DD hh:mm:ss.mil
- ... eg. 2016-12-14 07:09:58.000
+ ... Time Format : epoch time in microseconds
+ ... e.g 1507809604687329
- @{time_owner}= Create List BMC
- ${data}= Create Dictionary data=@{time_owner}
- ${resp}= OpenBMC Post Request
- ... ${TIME_MANAGER_URI}action/GetTime data=${data}
- ${jsondata}= To JSON ${resp.content}
- ${time_epoch}= Get From List ${jsondata["data"]} 0
- ${resp}= Convert Date
- ... ${time_epoch} date_format=%a %b %d %H:%M:%S %Y %Z
+ ${resp}= Read Attribute ${TIME_MANAGER_URI}/bmc Elapsed
[Return] ${resp}
+
Get HOST Time Using REST
[Documentation] Returns HOST time of the system via REST
- ... Time Format : YYYY-MM-DD hh:mm:ss.mil
- ... eg. 2016-12-14 07:09:58.000
+ ... Time Format : epoch time in microseconds
+ ... e.g 1507809604687329
- @{time_owner}= Create List HOST
- ${data}= Create Dictionary data=@{time_owner}
- ${resp}= OpenBMC Post Request
- ... ${TIME_MANAGER_URI}action/GetTime data=${data}
- ${jsondata}= To JSON ${resp.content}
- ${time_epoch}= Get From List ${jsondata["data"]} 0
- ${resp}= Convert Date
- ... ${time_epoch} date_format=%a %b %d %H:%M:%S %Y %Z
+ ${resp}= Read Attribute ${TIME_MANAGER_URI}/host Elapsed
[Return] ${resp}
+
Set Time Using REST
[Arguments] ${operation} ${owner} ${mode} ${status} ${bmc_time}
... ${host_time}
@@ -347,25 +350,21 @@
Set Time Owner ${owner}
Set Time Mode ${mode}
- ${setdate}= Convert Date ${SYSTEM_TIME_VALID}
- ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes
+ ${setdate}= Set Variable ${SYSTEM_TIME_VALID_EPOCH}
- @{bmc_date_list}= Create List BMC ${setdate}
- @{host_date_list}= Create List HOST ${SYSTEM_TIME_VALID_EPOCH}
-
- ${time_owner_date}= Set Variable If
- ... '${operation}' == 'Set BMC Time' ${bmc_date_list}
- ... '${operation}' == 'Set Host Time' ${host_date_list}
+ ${time_owner_url}= Set Variable If
+ ... '${operation}' == 'Set BMC Time' ${TIME_MANAGER_URI}bmc
+ ... '${operation}' == 'Set Host Time' ${TIME_MANAGER_URI}host
${start_time}= Get Current Date
${old_bmc_time}= Get BMC Time Using REST
${old_host_time}= Get HOST Time Using REST
- ${data}= Create Dictionary data=${time_owner_date}
- ${resp}= OpenBMC Post Request
- ... ${TIME_MANAGER_URI}action/SetTime data=${data}
- ${jsondata}= To JSON ${resp.content}
+ ${valueDict}= Create Dictionary data=${SYSTEM_TIME_VALID_EPOCH}
+ ${resp}= OpenBMC Put Request
+ ... ${time_owner_url}/attr/Elapsed data=${valueDict}
+ ${jsondata}= to JSON ${resp.content}
Should Be Equal As Strings ${jsondata['status']} ${status}
${new_bmc_time}= Get BMC Time Using REST
@@ -375,6 +374,14 @@
${time_duration}= Subtract Date From Date ${start_time} ${end_time}
${time_duration} Evaluate abs(${time_duration})
+ # Convert epoch to date format: YYYY-MM-DD hh:mm:ss.mil
+ ${setdate}= Convert epoch to date ${setdate}
+ ${new_bmc_time}= Convert epoch to date ${new_bmc_time}
+ ${old_bmc_time}= Convert epoch to date ${old_bmc_time}
+ ${new_host_time}= Convert epoch to date ${new_host_time}
+ ${old_host_time}= Convert epoch to date ${old_host_time}
+
+
${bmc_diff_set_new}=
... Subtract Date From Date ${setdate} ${new_bmc_time}
${bmc_diff_set_new}= Evaluate abs(${bmc_diff_set_new})
@@ -407,6 +414,21 @@
... ELSE IF '${host_time}' == 'Set'
... Should Be True ${host_diff_set_new} <= ${time_duration}
+Convert epoch to date
+ [Documentation] Convert epoch time to date format.
+ [Arguments] ${epoch_time}
+ # Description of argument(s):
+ # epoch_time epoch time in miliseconds.
+ # (e.g. 1487304700000000)
+
+ # Convert epoch time from microseconds to seconds
+ ${epoch_time_sec}= Evaluate ${epoch_time}/1000000
+
+ # Convert epoch time to date format: YYYY-MM-DD hh:mm:ss.mil
+ # e.g. 2017-02-16 22:14:11.000
+ ${date}= Convert Date ${epoch_time_sec}
+
+ [Return] ${date}
Post Test Case Execution
[Documentation] Do the post test teardown.
@@ -415,6 +437,6 @@
... 3. Close all open SSH connections.
FFDC On Test Case Fail
- Set Time Owner BMC
- Set Time Mode NTP
+ Set Time Owner ${BMC_OWNER}
+ Set Time Mode ${NTP_MODE}
Close All Connections