diff options
| author | Gunnar Mills <gmills@us.ibm.com> | 2017-11-27 15:41:11 -0600 |
|---|---|---|
| committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-12-04 20:05:09 +0000 |
| commit | d54ca80810c87bcf2b9a8cdcba4149ecb42985ba (patch) | |
| tree | 0f40e4d54a0e36db3e90e0b67f4280f17be6e7db | |
| parent | 56d79455f15ef07be326e59fde4b47ca5866a30c (diff) | |
| download | openbmc-docs-d54ca80810c87bcf2b9a8cdcba4149ecb42985ba.tar.gz openbmc-docs-d54ca80810c87bcf2b9a8cdcba4149ecb42985ba.zip | |
Change //bmc/ to //${bmc}/ in examples
Changed the example calls from //bmc/ to //${bmc}/.
This is more obvious and users can set bmc to their bmc ip
and just copy/paste these example calls.
Change-Id: I5bb2794fc80121ca793acf2d8cdd2fa27f56596b
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
| -rw-r--r-- | code-update.md | 24 | ||||
| -rw-r--r-- | rest-api.md | 34 |
2 files changed, 29 insertions, 29 deletions
diff --git a/code-update.md b/code-update.md index 8b1e581..0976c42 100644 --- a/code-update.md +++ b/code-update.md @@ -114,7 +114,7 @@ Perform a POST to invoke the `PrepareForUpdate` method of the `/flash/bmc` objec curl -b cjar -k -H "Content-Type: application/json" -X POST \ -d '{"data": []}' \ - https://bmc/org/openbmc/control/flash/bmc/action/prepareForUpdate + https://${bmc}/org/openbmc/control/flash/bmc/action/prepareForUpdate This will setup the u-boot environment and reboot the BMC. If no other images were pending the BMC should return in about 2 minutes. @@ -138,7 +138,7 @@ To configure the update settings, perform a REST PUT to curl -b cjar -k -H "Content-Type: application/json" -X PUT \ -d '{"data": 1}' \ - https://bmc/org/openbmc/control/flash/bmc/attr/preserve_network_settings + https://${bmc}/org/openbmc/control/flash/bmc/attr/preserve_network_settings ### Initiate update @@ -146,7 +146,7 @@ Perform a POST to invoke the `updateViaTftp` method of the `/flash/bmc` object: curl -b cjar -k -H "Content-Type: application/json" -X POST \ -d '{"data": ["<TFTP server IP address>", "<filename>"]}' \ - https://bmc/org/openbmc/control/flash/bmc/action/updateViaTftp + https://${bmc}/org/openbmc/control/flash/bmc/action/updateViaTftp Note the `<filename>` shall be a tarball. @@ -155,13 +155,13 @@ Note the `<filename>` shall be a tarball. You can query the progress of the download and image verification with a simple GET request: - curl -b cjar -k https://bmc/org/openbmc/control/flash/bmc + curl -b cjar -k https://${bmc}/org/openbmc/control/flash/bmc Or perform a POST to invoke the `GetUpdateProgress` method of the `/flash/bmc` object: curl -b cjar -k -H "Content-Type: application/json" -X POST \ -d '{"data": []}' \ - https://bmc/org/openbmc/control/flash/bmc/action/GetUpdateProgress + https://${bmc}/org/openbmc/control/flash/bmc/action/GetUpdateProgress Note: @@ -175,7 +175,7 @@ flash: curl -b cjar -k -H "Content-Type: application/json" -X POST \ -d '{"data": []}' \ - https://bmc/org/openbmc/control/flash/bmc/action/Apply + https://${bmc}/org/openbmc/control/flash/bmc/action/Apply Now the image is being flashed, you can check the progress with above step’s command as well. @@ -189,7 +189,7 @@ of the BMC control object: curl -b cjar -k -H "Content-Type: application/json" -X POST \ -d '{"data": []}' \ - https://bmc/org/openbmc/control/bmc0/action/warmReset + https://${bmc}/org/openbmc/control/bmc0/action/warmReset Host code update @@ -218,7 +218,7 @@ methods: ``` curl -b cjar -k -H "Content-Type: application/json" -X POST \ -d '{"data": ["<filename>", "<TFTP server IP address"]}' \ - https://bmc/xyz/openbmc_project/software/action/DownloadViaTFTP + https://${bmc}/xyz/openbmc_project/software/action/DownloadViaTFTP ``` 3. Note the version id generated for that image file. The version id is a hash @@ -241,7 +241,7 @@ version id via one of the following methods: has its Activation property set to Ready, in this example it'd be `2a1022fe`: ``` - $ curl -b cjar -k https://bmc/xyz/openbmc_project/software/enumerate + $ curl -b cjar -k https://${bmc}/xyz/openbmc_project/software/enumerate { "data": { "/xyz/openbmc_project/software/2a1022fe": { @@ -275,7 +275,7 @@ via one of the following methods: curl -b cjar -k -H "Content-Type: application/json" -X PUT \ -d '{"data": "xyz.openbmc_project.Software.Activation.RequestedActivations.Active"}' \ - https://bmc/xyz/openbmc_project/software/<id>/attr/RequestedActivation + https://${bmc}/xyz/openbmc_project/software/<id>/attr/RequestedActivation ``` 5. (Optional) Check the flash progress. This interface is only available during @@ -293,7 +293,7 @@ via one of the following: * Method 2: Using the REST API: ``` - curl -b cjar -k https://bmc/xyz/openbmc_project/software/<id>/attr/Progress + curl -b cjar -k https://${bmc}/xyz/openbmc_project/software/<id>/attr/Progress ``` 6. Check the activation is complete by verifying the Activation property is set @@ -310,7 +310,7 @@ to Active via one of the following methods: * Method 2: Using the REST API: ``` - curl -b cjar -k https://bmc/xyz/openbmc_project/software/<id> + curl -b cjar -k https://${bmc}/xyz/openbmc_project/software/<id> ``` ### Patching the host firmware diff --git a/rest-api.md b/rest-api.md index 8795310..505c018 100644 --- a/rest-api.md +++ b/rest-api.md @@ -16,7 +16,7 @@ Before you can do anything you first need to log in: curl -c cjar -k -X POST -H "Content-Type: application/json" \ -d '{"data": [ "root", "0penBmc" ] }' \ - https://bmc/login + https://${bmc}/login This performs a login using the provided username and password, and stores the @@ -28,7 +28,7 @@ To log out: curl -c cjar -b cjar -k -X POST -H "Content-Type: application/json" \ -d '{"data": [ ] }' \ - https://bmc/logout + https://${bmc}/logout (or just delete your cookie jar file) @@ -40,7 +40,7 @@ They are: - To query the attributes of an object, perform a GET request on the object name, with no trailing slash. For example: - $ curl -b cjar -k https://bmc/xyz/openbmc_project/inventory/system + $ curl -b cjar -k https://${bmc}/xyz/openbmc_project/inventory/system { "data": { "AssetTag": "", @@ -61,7 +61,7 @@ They are: - To query a single attribute, use the `attr/<name>` path. Using the `system` object from above, we can query just the `Name` value: - $ curl -b cjar -k https://bmc/xyz/openbmc_project/inventory/system/attr/Model + $ curl -b cjar -k https://${bmc}/xyz/openbmc_project/inventory/system/attr/Model { "data": "0000000000000000", "message": "200 OK", @@ -72,7 +72,7 @@ They are: the URL. For example, using the same object path as above, but adding a slash: - $ curl -b cjar -k https://bmc/xyz/openbmc_project/ + $ curl -b cjar -k https://${bmc}/xyz/openbmc_project/ { "data": [ "/xyz/openbmc_project/dump", @@ -95,12 +95,12 @@ They are: This shows that there are 11 children of the `openbmc_project/` object: `dump`, `software`, `control`, `network`, `logging`, `sensors`, `inventory`, `user`, `time`, `led`, and `state`. This can be used with the base REST URL - (ie., `http://bmc/`), to discover all objects in the hierarchy. + (ie., `http://${bmc}/`), to discover all objects in the hierarchy. - Performing the same query with `/list` will list the child objects *recursively*. - $ curl -b cjar -k https://bmc/xyz/openbmc_project/network/list + $ curl -b cjar -k https://${bmc}/xyz/openbmc_project/network/list { "data": [ "/xyz/openbmc_project/network/config", @@ -118,7 +118,7 @@ They are: - Adding `/enumerate` instead of `/list` will also include the attributes of the listed objects. - $ curl -b cjar -k https://bmc/xyz/openbmc_project/time/enumerate + $ curl -b cjar -k https://${bmc}/xyz/openbmc_project/time/enumerate { "data": { "/xyz/openbmc_project/time/bmc": { @@ -146,7 +146,7 @@ These require a json formatted payload. To get an example of what that looks like: curl -b cjar -k \ - https://bmc/xyz/openbmc_project/state/host0 > host.json + https://${bmc}/xyz/openbmc_project/state/host0 > host.json $ cat host.json { @@ -164,7 +164,7 @@ like: or curl -b cjar -k \ - https://bmc/xyz/openbmc_project/state/host0/attr/RequestedHostTransition > requested_host.json + https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition > requested_host.json $ cat requested_host.json { @@ -192,13 +192,13 @@ For example, make changes to the requested_host.json file and do a PUT (upload): curl -b cjar -k -H "Content-Type: application/json" \ -X PUT -T requested_host.json \ - https://bmc/xyz/openbmc_project/state/host0/attr/RequestedHostTransition + https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition Alternatively specify the json inline with -d: curl -b cjar -k -H "Content-Type: application/json" -X PUT \ -d '{"data": "xyz.openbmc_project.State.Host.Transition.On"}' \ - https://bmc/xyz/openbmc_project/state/host0/attr/RequestedHostTransition + https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition When using '-d' just remember that json requires quoting. @@ -214,13 +214,13 @@ To invoke a method with parameters (Downloading a Tar image via TFTP): curl -b cjar -k -X POST -H "Content-Type: application/json" \ -d '{"data": ["<Image Tarball>", "<TFTP Server>"]}' \ - https://bmc/xyz/openbmc_project/software/action/DownloadViaTFTP + https://${bmc}/xyz/openbmc_project/software/action/DownloadViaTFTP To invoke a method without parameters (Factory Reset of BMC and Host): curl -b cjar -k -H 'Content-Type: application/json' -X POST \ -d '{"data":[]}' \ - https://bmc/xyz/openbmc_project/software/action/Reset + https://${bmc}/xyz/openbmc_project/software/action/Reset ## HTTP DELETE operations DELETE operations are for removing instances. Only D-Bus objects (instances) can @@ -232,7 +232,7 @@ return a HTTP 403 (Forbidden) error. For example, to delete the event record with ID 1: curl -b cjar -k -X DELETE \ - https://bmc/xyz/openbmc_project/logging/entry/1 + https://${bmc}/xyz/openbmc_project/logging/entry/1 ## Uploading images @@ -243,14 +243,14 @@ or host software) via REST. The content-type should be set to For example, to upload an image: curl -c cjar -b cjar -k -H "Content-Type: application/octet-stream" \ - -X POST -T <file_to_upload> https://bmc/upload/image + -X POST -T <file_to_upload> https://${bmc}/upload/image In above example, the filename on the BMC will be chosen by the REST server. It is possible for the user to choose the uploaded file's remote name: curl -c cjar -b cjar -k -H "Content-Type: application/octet-stream" \ - -X PUT -T foo https://bmc/upload/image/bar + -X PUT -T foo https://${bmc}/upload/image/bar In above example, the file foo will be saved with the name bar on the BMC. |

