simpleupdate: Basic support of SimpleUpdate
This is TFTP only since that is all the OpenBMC back end currently
supports
Design Doc Ref:
https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/20700
Tested:
1) Verified BMC image update via new SimpleUpdate interface worked
curl -k -H "X-Auth-Token: $TOKEN" -d '{"ImageURI":"XXX.XX.X.X/obmc-phosphor-image-witherspoon.ubi.mtd.tar","TransferProtocol":"TFTP"}' -X POST https://${BMC_IP}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate
{
"@Message.ExtendedInfo": [
{
"@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
"Message": "Successfully Completed Request",
"MessageArgs": [],
"MessageId": "Base.1.4.0.Success",
"Resolution": "None",
"Severity": "OK"
}
]
}
2) Verified encoding the protocol in ImageURI worked
curl -k -H "X-Auth-Token: $TOKEN" -X POST https://${BMC_IP}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate -d '{"ImageURI":"tftp://${TFTP_IP}/obmc-phosphor-image-witherspoon.ubi.mtd.tar"}'
{
"@Message.ExtendedInfo": [
{
"@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
"Message": "Successfully Completed Request",
"MessageArgs": [],
"MessageId": "Base.1.4.0.Success",
"Resolution": "None",
"Severity": "OK"
}
]
}
Jun 12 20:52:20 witherspoon bmcweb[2470]: (2019-06-12 20:52:20) [DEBUG ] Enter UpdateService.SimpleUpdate doPost
Jun 12 20:52:20 witherspoon bmcweb[2470]: (2019-06-12 20:52:20) [DEBUG ] Encoded transfer protocol tftp
Jun 12 20:52:20 witherspoon bmcweb[2470]: (2019-06-12 20:52:20) [DEBUG ] Adjusted imageUri ${BMC_IP}/obmc-phosphor-image-witherspoon.ubi.mtd.tar
Jun 12 20:52:20 witherspoon bmcweb[2470]: (2019-06-12 20:52:20) [DEBUG ] Server: ${TFTP_IP} File: obmc-phosphor-image-witherspoon.ubi.mtd.tar
Jun 12 20:52:20 witherspoon bmcweb[2470]: (2019-06-12 20:52:20) [DEBUG ] Exit UpdateService.SimpleUpdate doPost
3) Verified if no transfer protocol, error returned
curl -k -H "X-Auth-Token: $TOKEN" -X POST https://${BMC_IP}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate -d '{"ImageURI":”${TFTP_IP}/obmc-phosphor-image-witherspoon.ubi.mtd.tar"}'
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
"Message": "The value ${TFTP_IP}/obmc-phosphor-image-witherspoon.ubi.mtd.tar for the parameter ImageURI in the action UpdateService.SimpleUpdate is of a different type than the parameter can accept.",
"MessageArgs": [
“${TFTP_IP}/obmc-phosphor-image-witherspoon.ubi.mtd.tar",
"ImageURI",
"UpdateService.SimpleUpdate"
],
"MessageId": "Base.1.4.0.ActionParameterValueTypeError",
"Resolution": "Correct the value for the parameter in the request body and resubmit the request if the operation failed.",
"Severity": "Warning"
}
],
"code": "Base.1.4.0.ActionParameterValueTypeError",
"message": "The value ${TFTP_IP}/obmc-phosphor-image-witherspoon.ubi.mtd.tar for the parameter ImageURI in the action UpdateService.SimpleUpdate is of a different type than the parameter can accept."
}
}
4) Verified no new error in Redfish Validator
5) Verified error return when parameter missing:
curl -k -H "X-Auth-Token: $TOKEN" -d '{"TransferProtocol":"TFTP"}' -X POST https://${BMC_IP}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate
{
"ImageURI@Message.ExtendedInfo": [
{
"@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
"Message": "The property ImageURI is a required property and must be included in the request.",
"MessageArgs": [
"ImageURI"
],
"MessageId": "Base.1.4.0.PropertyMissing",
"Resolution": "Ensure that the property is in the request body and has a valid value and resubmit the request if the operation failed.",
"Severity": "Warning"
}
]
}
6) Verified that by default, the new Action is not available
Change-Id: I67ea91e181380e6da7ff63a37f02408a318602b7
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
index 9edffa9..36546c6 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
@@ -69,6 +69,10 @@
nodes.emplace_back(std::make_unique<ChassisCollection>(app));
nodes.emplace_back(std::make_unique<Chassis>(app));
nodes.emplace_back(std::make_unique<UpdateService>(app));
+#ifdef BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE
+ nodes.emplace_back(
+ std::make_unique<UpdateServiceActionsSimpleUpdate>(app));
+#endif
nodes.emplace_back(std::make_unique<SoftwareInventoryCollection>(app));
nodes.emplace_back(std::make_unique<SoftwareInventory>(app));
nodes.emplace_back(