Pages

Friday, February 23, 2018

[curl] OpenBMC Time

List Time Objects
[curl]
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/time/
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/time/list

For example
[curl in Linux]
$ curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/time/list
{
  "data": [
    "/xyz/openbmc_project/time/owner",
    "/xyz/openbmc_project/time/bmc",
    "/xyz/openbmc_project/time/host",
    "/xyz/openbmc_project/time/sync_method"
  ],
  "message": "200 OK",
  "status": "ok"
}


Enumerate Time Objects
[curl]
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/time/enumerate

For example
[curl in Linux]
$ curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/time/enumerate
{
  "data": {
    "/xyz/openbmc_project/time/bmc": {
      "Elapsed": 1519373997329371
    },
    "/xyz/openbmc_project/time/host": {
      "Elapsed": 1519373997349029
    },
    "/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.NTP"
    }
  },
  "message": "200 OK",
  "status": "ok"
}


BMC Time Epoch
[curl]
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/time/bmc
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/time/bmc/attr/Elapsed

For example
[curl in Linux]
curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/time/bmc
{
  "data": {
    "Elapsed": 1519377854457019
  },
  "message": "200 OK",
  "status": "ok"
}


Host Time Epoch
[curl]
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/time/host
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/time/host/attr/Elapsed

For example
[curl in Linux]
$ curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/time/host/attr/Elapsed
{
  "data": 1519378035021970,
  "message": "200 OK",
  "status": "ok"
}


Time Owner
[curl]
Get Time Owner
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/time/owner
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/time/owner/attr/TimeOwner
Set Time Owner to Both
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "xyz.openbmc_project.Time.Owner.Owners.Both"}' https://${bmc_ip}/xyz/openbmc_project/time/owner/attr/TimeOwner
Set Time Owner to BMC
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "xyz.openbmc_project.Time.Owner.Owners.BMC"}' https://${bmc_ip}/xyz/openbmc_project/time/owner/attr/TimeOwner
Set Time Owner to Host
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "xyz.openbmc_project.Time.Owner.Owners.Host"}' https://${bmc_ip}/xyz/openbmc_project/time/owner/attr/TimeOwner
Set Time Owner to Split
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "xyz.openbmc_project.Time.Owner.Owners.Split"}' https://${bmc_ip}/xyz/openbmc_project/time/owner/attr/TimeOwner

For example
[curl in Linux]
$ curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/time/owner
{
  "data": {
    "TimeOwner": "xyz.openbmc_project.Time.Owner.Owners.BMC"
  },
  "message": "200 OK",
  "status": "ok"
}
$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "xyz.openbmc_project.Tie.Owner.Owners.Host"}' https://192.168.88.38/xyz/openbmc_project/time/owner/attr/TimeOwner
{
  "data": null,
  "message": "200 OK",
  "status": "ok"
}
$ curl b cjar -k https://192.168.88.38/xyz/openbmc_project/time/owner
{
  "data": {
    "TimeOwner": "xyz.openbmc_project.Time.Owner.Owners.Host"
  },
  "message": "200 OK",
  "status": "ok"
}


Time Sync Method
[curl]
Get Time Sync Method
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/time/sync_method
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/time/sync_method/attr/TimeSyncMethod
Set NTP Time Sync Method
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "xyz.openbmc_project.Time.Synchronization.Method.NTP" }' https://${bmc_ip}/xyz/openbmc_project/time/sync_method/attr/TimeSyncMethod
Set Manual Time Sync Method
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "xyz.openbmc_project.Time.Synchronization.Method.Manual" }' https://${bmc_ip}/xyz/openbmc_project/time/sync_method/attr/TimeSyncMethod

For example
[curl in Linux]
$ curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/time/sync_method/attr/TimeSyncMethod
{
  "data": "xyz.openbmc_project.Time.Synchronization.Method.NTP",
  "message": "200 OK",
  "status": "ok"
}
$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "xyz.openbmc_project.Time.Synchronization.Method.Manual"}' https://192.168.88.38/xyz/openbmc_project/time/sync_method/attr/TimeSyncMethod
{
  "data": null,
  "message": "200 OK",
  "status": "ok"
}
$ curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/time/sync_method/attr/TimeSyncMethod
{
  "data": "xyz.openbmc_project.Time.Synchronization.Method.Manual",
  "message": "200 OK",
  "status": "ok"
}




Last Updated: 23-02-2018

No comments:

Post a Comment