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/CMakeLists.txt b/CMakeLists.txt
index 8361e90..943d956 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,6 +54,10 @@
 
 option (BMCWEB_INSECURE_DISABLE_XSS_PREVENTION "Disable XSS preventions" OFF)
 
+option (BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE "Enable TFTP based
+       firmware update transactions through Redfish
+       UpdateService.SimpleUpdate." OFF)
+
 project (bmc-webserver CXX)
 
 include (CTest)
@@ -272,6 +276,7 @@
     $<$<BOOL:${BMCWEB_ENABLE_REDFISH_CPU_LOG}>: -DBMCWEB_ENABLE_REDFISH_CPU_LOG>
     $<$<BOOL:${BMCWEB_ENABLE_REDFISH_BMC_JOURNAL}>: -DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL>
     $<$<BOOL:${BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES}>: -DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES>
+    $<$<BOOL:${BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE}>: -DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE>
 
 )