Skip to content

Commit

Permalink
Fix to handle "403 Forbidden error" while setting time
Browse files Browse the repository at this point in the history
This fix is to handle limitation of fw issue - openbmc/openbmc#3459

Change-Id: Ie692c295080b5ac6645690c318af0f92fe43209a
Signed-off-by: Rahul Maheshwari <[email protected]>
  • Loading branch information
rahulmah committed Jan 24, 2019
1 parent 11a1cc3 commit 52d9294
Showing 1 changed file with 39 additions and 19 deletions.
58 changes: 39 additions & 19 deletions tests/test_time.robot
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Get System Time
Should Be True ${diff} < ${ALLOWED_TIME_DIFF}
... Open BMC time does not match with IPMI sel time


Set Valid System Time
[Documentation] Set system time using IPMI and verify that it is
... correctly set in BMC.
Expand All @@ -58,6 +59,7 @@ Set Valid System Time
Should Be True ${diff} < ${ALLOWED_TIME_DIFF}
... Open BMC time does not match with set time


Set Invalid System Time
[Documentation] Set system time with invalid time using IPMI and verify
... that it should throw error.
Expand Down Expand Up @@ -173,16 +175,6 @@ Set Host Time With Host And Manual
Set Host Time ${HOST_OWNER} ${MANUAL_MODE} ok Change Set


Set Host Time With Both And Manual
[Documentation] Set host time when time owner is both and time mode is
... manual.
[Tags] Set_Host_Time_With_Both_And_Manual
[Template] Set Time Using REST

#Operation Owner Mode Status BMC Time Host Time
Set Host Time ${BOTH_OWNER} ${MANUAL_MODE} ok Change Set


Set Host Time With Both And NTP
[Documentation] Set host time when time owner is both and time mode is
... NTP.
Expand Down Expand Up @@ -243,6 +235,16 @@ Set Host Time With Host And NTP
Set Host Time ${HOST_OWNER} ${NTP_MODE} error Not Change No Set


Set Host Time With Both And Manual
[Documentation] Set host time when time owner is both and time mode is
... manual.
[Tags] Set_Host_Time_With_Both_And_Manual
[Template] Set Time Using REST

#Operation Owner Mode Status BMC Time Host Time
Set Host Time ${BOTH_OWNER} ${MANUAL_MODE} ok Change Set


Set Invalid Time Mode
[Documentation] Set time mode with invalid value using REST and verify
... that it should throw error.
Expand Down Expand Up @@ -293,6 +295,25 @@ Get BMC Time Using IPMI
Should Not Be Empty ${resp}
[Return] ${resp}


Verify Set Time Via REST
[Documentation] Verify set time via REST.
[Arguments] ${target} ${expected_status}
# Description of argument(s):
# target The target of the set time operation: "bmc" or "host".
# expected_status Expected status of set time operation

${time_owner_url}= Set Variable ${TIME_MANAGER_URI}${target}

${args}= Create Dictionary data=${SYSTEM_TIME_VALID_EPOCH}
${resp}= OpenBMC Put Request
... ${time_owner_url}/attr/Elapsed data=${args}
${jsondata}= to Json ${resp.content}
Run Keyword If "${expected_status}" == "ok"
... Should Not Be Equal As Strings ${jsondata['message']} 403 Forbidden
Should Be Equal As Strings ${jsondata['status']} ${expected_status}


Set Time Owner
[Arguments] ${args}
[Documentation] Set time owner of the system via REST
Expand Down Expand Up @@ -372,20 +393,18 @@ Set Time Using REST

${setdate}= Set Variable ${SYSTEM_TIME_VALID_EPOCH}

${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

${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}
Run Keyword If '${operation}' == 'Set BMC Time'
... Wait Until Keyword Succeeds 1 min 20 sec Verify Set Time Via REST
... bmc ${status}
... ELSE IF '${operation}' == 'Set Host Time'
... Wait Until Keyword Succeeds 1 min 20 sec Verify Set Time Via REST
... host ${status}


${new_bmc_time}= Get BMC Time Using REST
${new_host_time}= Get HOST Time Using REST
Expand Down Expand Up @@ -453,6 +472,7 @@ Convert epoch to date

[Return] ${date}


Post Test Case Execution
[Documentation] Do the post test teardown.
... 1. Capture FFDC on test failure.
Expand Down

0 comments on commit 52d9294

Please sign in to comment.