REST request to set BMC time fails with 403 Forbidden error #3459
Closed
Description
REST fails with 403 Forbidden error while setting BMC time. See below step to hit the issue. It is seen that if we give 20-30 seconds delay between each step below, then we will not hit the issue. Seem like some process is not getting complete if we don't give the delay.
Step to recreate:
- Set BMC as time owner
bash-4.1$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -d "{\"data\": \"xyz.openbmc_project.Time.Owner.Owners.BMC\"}" -X PUT https://$BMC_IP/xy/openbmc_project/time/owner/attr/TimeOwner
{
"data": null,
"message": "200 OK",
"status": "ok"
}
- Set NTP as Time synchronization method.
bash-4.1$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -d "{\"data\": \"xyz.openbmc_project.Time.Synchronization.Method.NTP\"}" -X PUT https://$BMC_IP/xyz/openbmc_project/time/sync_method/attr/TimeSyncMethod
{
"data": null,
"message": "200 OK",
"status": "ok"
}
- Now Set Manual as time synchronization method.
curl -c cjar -b cjar -k -H "Content-Type: application/json" -d "{\"data\": \"xyz.openbmc_project.Time.Synchronization.Method.Manual\"}" -X PUT https://$BMC_IP/xyz/openbmc_project/time/sync_method/attr/TimeSyncMethod
{
"data": null,
"message": "200 OK",
"status": "ok"
}
- Check BMC and HOST time.
bash-4.1$ curl -c cjar -b cjar -k -X GET https://$BMC_IP/xyz/openbmc_project/time/enumerate
{
"data": {
"/xyz/openbmc_project/time/bmc": {
"Elapsed": 1547191668895457
},
"/xyz/openbmc_project/time/host": {
"Elapsed": 1547191668931703
},
"/xyz/openbmc_project/time/owner": {
"TimeOwner": "xyz.openbmc_project.Time.Owner.Owners.BMC"
},
"/xyz/openbmc_project/time/sync_method": {
"TimeSyncMethod": "xyz.openbmc_project.Time.Synchronization.Method.Manual"
}
},
"message": "200 OK",
"status": "ok"
}
- Set BMC time to 1487304700000000(GMT - Wednesday, September 18, 1974 10:01:10 AM).
bash-4.1$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -d "{\"data\": 1487304700000000}" -X PUT https://$BMC_IP/xyz/openbmc_project/time/bmc/attr/Elapsed
{
"data": {
"description": "xyz.openbmc_project.Time.Error.Failed: The operation failed"
},
"message": "403 Forbidden",
"status": "error"
}
Journal log of the failure -
journal log time.txt
System Details
BMC : 2.6.0.rc1-23-g5a2b44f
PNOR : IBM-witherspoon-OP9-v2.0.10-2.22