<html><body><p><img width="16" height="16" src="cid:1__=8FBB0FEDDFF607218f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for "David Wang (¤ý®¶¦t)" ---04-06-2020 13:50:19---Hi George, I¡¦m testing BMC by automation with tes"><font size="2" color="#424282">"David Wang (¤ý®¶¦t)" ---04-06-2020 13:50:19---Hi George, I¡¦m testing BMC by automation with test_redfish_bmc_code_update.robot.</font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">"David Wang (¤ý®¶¦t)" <DavidWang@quantatw.com></font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">George Keishing <gkeishin@in.ibm.com></font><br><font size="2" color="#5F5F5F">Cc:        </font><font size="2">"openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org></font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">04-06-2020 13:50</font><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">[EXTERNAL] bmc code update with automation/redfish</font><br><font size="2" color="#5F5F5F">Sent by:        </font><font size="2">"openbmc" <openbmc-bounces+gkeishin=in.ibm.com@lists.ozlabs.org></font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br><tt><font size="2">Hi George,<br><br>I¡¦m testing BMC by automation with test_redfish_bmc_code_update.robot.<br>It failed. However I can successfully update bmc manually so I try to find the reason of failure.<br><br>When I upload image by REST:<br>1. -X POST -T <tar_file> </font></tt><tt><font size="2"><a href="https://$%7Bbmc%7D/upload/image">https://$%7Bbmc%7D/upload/image</a></font></tt><tt><font size="2"> <br><br>2. ls -l /tmp/images<br>   drwx------                    2 root     root           280 Jun  4 06:45 c78e674a<br><br>3. -X PUT -d '{"data": "xyz.openbmc_project.Software.Activation.RequestedActivations.Active"}' \<br>   </font></tt><tt><font size="2"><a href="https://$%7Bbmc%7D/xyz/openbmc_project/software/c78e674a/attr/RequestedActivation">https://$%7Bbmc%7D/xyz/openbmc_project/software/c78e674a/attr/RequestedActivation</a></font></tt><tt><font size="2"> <br>¡@¡@<br>4. Then bmc untar the tar file to /run/initramfs/ and remove the tar file<br>                 ls -l /run/initramfs<br>                 -rw-r--r--    1 root     root       4229844 Jun  4 06:46 image-kernel<br>                 -rw-r--r--    1 root     root      23703552 Jun  4 06:46 image-rofs<br>                 -rw-r--r--    1 root     root        850304 Jun  4 06:46 image-rwfs<br>                 -rw-r--r--    1 root     root        433712 Jun  4 06:46 image-u-boot<br><br>When I upload image by Redfish (or automation): <br>1. -X POST -T <tar_file> </font></tt><tt><font size="2"><a href="https://$%7Bbmc%7D/redfish/v1/UpdateService">https://$%7Bbmc%7D/redfish/v1/UpdateService</a></font></tt><tt><font size="2"> <br><br>2. BMC immediately completes steps 2 to 4 above. So there¡¦s no folder named ¡§c78e674a¡¨ in /tmp/images. <br>                 ls -l /run/initramfs<br>¡@¡@-rw-r--r--    1 root     root       4229844 Jun  4 06:53 image-kernel<br>¡@¡@-rw-r--r--    1 root     root      23703552 Jun  4 06:53 image-rofs<br>¡@¡@-rw-r--r--    1 root     root        850304 Jun  4 06:53 image-rwfs<br>¡@¡@-rw-r--r--    1 root     root        433712 Jun  4 06:53 image-u-boot<br>                 <br>3. Then robot try to ¡§Get Latest Image ID¡¨ by command<br>¡@¡@cd /tmp/images/; stat -c '%Y %n' * | sort -k1,1nr | head -n 1<br>¡@¡@But the folder has been removed, so the robot finds nothing, and then fails.<br>                 <br>Here¡¦s the question:<br>It seems that the robot expects the folder "c78e674a" to exist. <br>However, when uploading an image through Redfish command, once the tar file is uploaded, bmc untar and remove it.<br>How can I fix it? Do you have any suggestion?<br>Please leave any comments, thank you.<br><br>Regards,<br>David<br><br></font></tt><br><font size="2">-----------------------------------------------------------------------------------------------</font><br><br><br><font size="2">Hi David,</font><br><br><b><font size="2">You can refer this one openbmc-test-automation/redfish/extended/redfish_bmc_code_update.robot</font></b><br><br><font size="2">Example:</font><ul><font size="2"> </font><i><font size="2">robot  -v OPENBMC_HOST:xx.xx.xx.xx  -v IMAGE_FILE_PATH=./obmc-phosphor-image-witherspoon-ubi.mtd.tar --include Redfish_BMC_Code_Update openbmc-test-automation/redfish/extended/redfish_bmc_code_update.robot</font></i></ul><br>
<ul><font size="2">#(UTC) 2020/05/14 07:25:52.259475 -    0.835874 - Executing: patch('/redfish/v1/UpdateService', body="{'HttpPushUriOptions' : {'HttpPushUriApplyTime' : {'ApplyT...</font><br><font size="2">#(UTC) 2020/05/14 07:25:52.315118 -    0.055644 - Executing: get('/redfish/v1/UpdateService')</font><br><font size="2">apply_time:                                       None</font><br><font size="2">#(UTC) 2020/05/14 07:26:13.643450 -   21.328331 - Issuing: cd /tmp/images/; stat -c '%Y %n' * | sort -k1,1nr | head -n 1</font><br><font size="2">#(UTC) 2020/05/14 07:26:18.806209 -    0.173404 - Issuing: ls -l /tmp/images/d2dea46d/MANIFEST</font><br><font size="2">image_id:                                         d2dea46d</font><br><font size="2">#(UTC) 2020/05/14 07:26:19.447311 -    0.112001 - Issuing: cat /tmp/images/d2dea46d/MANIFEST</font><br><font size="2">manifest:                                         purpose=xyz.openbmc_project.Software.Version.VersionPurpose.BMC</font><br><font size="2">version=2.8.0-dev-1823-gca64d2910</font><br><font size="2">KeyType=OpenBMC</font><br><font size="2">HashType=RSA-SHA256</font><br><font size="2">MachineName=witherspoon</font><br><font size="2">#(UTC) 2020/05/14 07:26:19.778033 -    0.017176 - Executing: get('/redfish/v1/UpdateService/FirmwareInventory/d2dea46d')</font><br><font size="2">status:</font><br><font size="2">  [Health]:                                       OK</font><br><font size="2">  [HealthRollup]:                                 OK</font><br><font size="2">  [State]:                                        Updating</font><br></ul><br><b><font size="2">If you wanted to do it manually, here are the steps for the above as well:</font></b><br><br><b><font size="2"> </font></b><br><font size="2">1. Get authorization token</font><ul><i><font size="2">$ curl -k -H "Content-Type: application/json" -X POST </font></i><a href="https://$/"><i><font size="2">https://$</font></i></a><i><font size="2">{bmc_ip}/login -d '{"username" :  "root", "password" :  "0penBmc"}'</font></i><br><i><font size="2">{</font></i><br><i><font size="2">  "token": "3bpggDPS58SiUmWOUUC5"</font></i><br><i><font size="2">}</font></i><br><i><font size="2">$ export bmc_token=3bpggDPS58SiUmWOUUC5</font></i><br></ul><br><font size="2">2. Set the ApplyTime policy ( either one of them , by default OnReset )</font><br>
<ul><font size="2">OnReset - updates the image when BMC takes reset</font><br><i><font size="2">curl -k -H "X-Auth-Token: $bmc_token" -H "Content-Type: application/octet-stream" -X PATCH -d '{ "HttpPushUriOptions": { "HttpPushUriApplyTime":{ "ApplyTime":"OnReset"}}}' </font></i><a href="https://$/"><i><font size="2">https://$</font></i></a><i><font size="2">{bmc_ip}/redfish/v1/UpdateService</font></i><br><br><font size="2">Immediate - Trigger reboots BMC automatically when Activation is completed</font><br><i><font size="2">curl -k -H "X-Auth-Token: $bmc_token" -H "Content-Type: application/octet-stream" -X PATCH -d '{ "HttpPushUriOptions": { "HttpPushUriApplyTime":{ "ApplyTime":"Immediate"}}}' </font></i><a href="https://$/"><i><font size="2">https://$</font></i></a><i><font size="2">{bmc_ip}/redfish/v1/UpdateService</font></i><br></ul><font size="2">3. Upload and Activate:</font><ul><i><font size="2">curl -k -H "X-Auth-Token: $bmc_token" -H "Content-Type: application/octet-stream" -X POST -T ./Imagepath/obmc_withspoon.ubi.mtd.tar </font></i><a href="https://$/"><i><font size="2">https://$</font></i></a><i><font size="2">{bmc_ip}/redfish/v1/UpdateService</font></i></ul><br><br><b><font size="2" color="#0000FF">Thanks and Regards,</font></b><br><font size="2" color="#0000FF">   George Keishing</font><br><br><br><BR>
</body></html>