Add MessageArgs for Redfish messages from the Base registry

Per the Redfish API Specification, the MessageArgs array of
strings is required when using a MessageId for a
parameterized message.

This change adds the MessageArgs array for the Redfish messages
that we use from the Base message registry.

Tested: Manually set various error types and confirmed that the
MessageArg array was properly displayed.

Change-Id: I2248128f8290305ba3466ef2ce57447ce970a57d
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
index 8676aaf..7c29507 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -119,6 +119,7 @@
             {"MessageId", "Base.1.4.0.ResourceInUse"},
             {"Message", "The change to the requested resource failed because "
                         "the resource is in use or in transition."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Warning"},
             {"Resolution", "Remove the condition and resubmit the request if "
                            "the operation failed."}});
@@ -141,6 +142,7 @@
             {"MessageId", "Base.1.4.0.MalformedJSON"},
             {"Message", "The request body submitted was malformed JSON and "
                         "could not be parsed by the receiving service."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Critical"},
             {"Resolution", "Ensure that the request body is valid JSON and "
                            "resubmit the request."}});
@@ -162,6 +164,7 @@
             {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"},
             {"MessageId", "Base.1.4.0.ResourceMissingAtURI"},
             {"Message", "The resource at the URI " + arg1 + " was not found."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Critical"},
             {"Resolution", "Place a valid resource at the URI or correct the "
                            "URI and resubmit the request."}});
@@ -189,6 +192,7 @@
              "The value " + arg1 + " for the parameter " + arg2 +
                  " in the action " + arg3 +
                  " is of a different format than the parameter can accept."},
+            {"MessageArgs", {arg1, arg2, arg3}},
             {"Severity", "Warning"},
             {"Resolution",
              "Correct the value for the parameter in the request body and "
@@ -212,6 +216,7 @@
             {"MessageId", "Base.1.4.0.InternalError"},
             {"Message", "The request failed due to an internal service error.  "
                         "The service is still operational."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Critical"},
             {"Resolution", "Resubmit the request.  If the problem persists, "
                            "consider resetting the service."}});
@@ -234,6 +239,7 @@
             {"MessageId", "Base.1.4.0.UnrecognizedRequestBody"},
             {"Message", "The service detected a malformed request body that it "
                         "was unable to interpret."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Warning"},
             {"Resolution", "Correct the request body and resubmit the request "
                            "if it failed."}});
@@ -258,6 +264,7 @@
             {"Message", "While accessing the resource at " + arg1 +
                             ", the service received an authorization error " +
                             arg2 + "."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Critical"},
             {"Resolution", "Ensure that the appropriate access is provided for "
                            "the service in order for it to access the URI."}});
@@ -282,6 +289,7 @@
             {"Message", "The action " + arg1 +
                             " was submitted with the invalid parameter " +
                             arg2 + "."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Warning"},
             {"Resolution", "Correct the invalid parameter and resubmit the "
                            "request if the operation failed."}});
@@ -304,6 +312,7 @@
             {"MessageId", "Base.1.4.0.ResourceCannotBeDeleted"},
             {"Message", "The delete request failed because the resource "
                         "requested cannot be deleted."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Critical"},
             {"Resolution",
              "Do not attempt to delete a non-deletable resource."}});
@@ -326,6 +335,7 @@
             {"MessageId", "Base.1.4.0.PropertyDuplicate"},
             {"Message",
              "The property " + arg1 + " was duplicated in the request."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Warning"},
             {"Resolution",
              "Remove the duplicate property from the request body and resubmit "
@@ -350,6 +360,7 @@
             {"MessageId", "Base.1.4.0.ServiceTemporarilyUnavailable"},
             {"Message", "The service is temporarily unavailable.  Retry in " +
                             arg1 + " seconds."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Critical"},
             {"Resolution", "Wait for the indicated retry duration and retry "
                            "the operation."}});
@@ -374,6 +385,7 @@
             {"Message", "The requested resource of type " + arg1 +
                             " with the property " + arg2 + " with the value " +
                             arg3 + " already exists."},
+            {"MessageArgs", {arg1, arg2, arg3}},
             {"Severity", "Critical"},
             {"Resolution", "Do not repeat the create operation as the resource "
                            "has already been created."}},
@@ -397,6 +409,7 @@
             {"MessageId", "Base.1.4.0.AccountForSessionNoLongerExists"},
             {"Message", "The account for the current session has been removed, "
                         "thus the current session has been removed as well."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "OK"},
             {"Resolution", "Attempt to connect with a valid account."}});
 }
@@ -420,6 +433,7 @@
             {"Message",
              "The create operation failed because the required property " +
                  arg1 + " was missing from the request."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Critical"},
             {"Resolution",
              "Correct the body to include the required property with a valid "
@@ -447,6 +461,7 @@
             {"Message",
              "The value " + arg1 + " for the property " + arg2 +
                  " is of a different format than the property can accept."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Warning"},
             {"Resolution",
              "Correct the value for the property in the request body and "
@@ -473,6 +488,7 @@
             {"MessageId", "Base.1.4.0.PropertyValueNotInList"},
             {"Message", "The value " + arg1 + " for the property " + arg2 +
                             " is not in the list of acceptable values."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Warning"},
             {"Resolution",
              "Choose a value from the enumeration list that the implementation "
@@ -497,6 +513,7 @@
             {"MessageId", "Base.1.4.0.ResourceAtUriInUnknownFormat"},
             {"Message", "The resource at " + arg1 +
                             " is in a format not recognized by the service."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Critical"},
             {"Resolution", "Place an image or resource or file that is "
                            "recognized by the service at the URI."}});
@@ -520,6 +537,7 @@
             {"Message",
              "The operation failed because the service is in an unknown state "
              "and can no longer take incoming requests."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Critical"},
             {"Resolution", "Restart the service and resubmit the request if "
                            "the operation failed."}});
@@ -543,6 +561,7 @@
             {"Message",
              "The event subscription failed due to the number of simultaneous "
              "subscriptions exceeding the limit of the implementation."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Critical"},
             {"Resolution",
              "Reduce the number of other subscriptions before trying to "
@@ -568,6 +587,7 @@
             {"MessageId", "Base.1.4.0.ActionParameterMissing"},
             {"Message", "The action " + arg1 + " requires the parameter " +
                             arg2 + " to be present in the request body."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Critical"},
             {"Resolution",
              "Supply the action with the required parameter in the request "
@@ -592,6 +612,7 @@
             {"MessageId", "Base.1.4.0.StringValueTooLong"},
             {"Message", "The string " + arg1 + " exceeds the length limit " +
                             std::to_string(arg2) + "."},
+            {"MessageArgs", {arg1, std::to_string(arg2)}},
             {"Severity", "Warning"},
             {"Resolution",
              "Resubmit the request with an appropriate string length."}});
@@ -613,6 +634,7 @@
             {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"},
             {"MessageId", "Base.1.4.0.SessionTerminated"},
             {"Message", "The session was successfully terminated."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "OK"},
             {"Resolution", "No resolution is required."}});
 }
@@ -637,6 +659,7 @@
                             " is incompatible with the @odata.type of the "
                             "resource which is " +
                             arg2 + "."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Critical"},
             {"Resolution", "Resubmit the request with a payload compatible "
                            "with the resource's schema."}});
@@ -662,6 +685,7 @@
             {"Message",
              "The value " + arg1 + " for the property " + arg2 +
                  " is of a different type than the property can accept."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Warning"},
             {"Resolution",
              "Correct the value for the property in the request body and "
@@ -687,6 +711,7 @@
             {"MessageId", "Base.1.4.0.ResourceNotFound"},
             {"Message", "The requested resource of type " + arg1 + " named " +
                             arg2 + " was not found."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Critical"},
             {"Resolution",
              "Provide a valid resource identifier and resubmit the request."}});
@@ -710,6 +735,7 @@
             {"Message",
              "The service failed to establish a Connection with the URI " +
                  arg1 + "."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Critical"},
             {"Resolution",
              "Ensure that the URI contains a valid and reachable node name, "
@@ -735,6 +761,7 @@
             {"Message",
              "The property " + arg1 +
                  " is a read only property and cannot be assigned a value."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Warning"},
             {"Resolution", "Remove the property from the request body and "
                            "resubmit the request if the operation failed."}},
@@ -760,6 +787,7 @@
             {"Message",
              "The value " + arg1 + " for the query parameter " + arg2 +
                  " is of a different type than the parameter can accept."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Warning"},
             {"Resolution",
              "Correct the value for the query parameter in the request and "
@@ -783,6 +811,7 @@
             {"MessageId", "Base.1.4.0.ServiceShuttingDown"},
             {"Message", "The operation failed because the service is shutting "
                         "down and can no longer take incoming requests."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Critical"},
             {"Resolution", "When the service becomes available, resubmit the "
                            "request if the operation failed."}});
@@ -808,6 +837,7 @@
              "The action " + arg1 +
                  " was submitted with more than one value for the parameter " +
                  arg2 + "."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Warning"},
             {"Resolution",
              "Resubmit the action with only one instance of the parameter in "
@@ -832,6 +862,7 @@
             {"MessageId", "Base.1.4.0.ActionParameterNotSupported"},
             {"Message", "The parameter " + arg1 + " for the action " + arg2 +
                             " is not supported on the target resource."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Warning"},
             {"Resolution", "Remove the parameter supplied and resubmit the "
                            "request if the operation failed."}});
@@ -856,6 +887,7 @@
             {"Message", "The other end of the Connection at " + arg1 +
                             " does not support the specified protocol " + arg2 +
                             "."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Critical"},
             {"Resolution", "Change protocols or URIs. "}});
 }
@@ -876,6 +908,7 @@
             {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"},
             {"MessageId", "Base.1.4.0.AccountRemoved"},
             {"Message", "The account was successfully removed."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "OK"},
             {"Resolution", "No resolution is required."}});
 }
@@ -897,6 +930,7 @@
             {"MessageId", "Base.1.4.0.AccessDenied"},
             {"Message", "While attempting to establish a Connection to " +
                             arg1 + ", the service denied access."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Critical"},
             {"Resolution", "Attempt to ensure that the URI is correct and that "
                            "the service has the appropriate credentials."}});
@@ -918,6 +952,7 @@
             {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"},
             {"MessageId", "Base.1.4.0.QueryNotSupported"},
             {"Message", "Querying is not supported by the implementation."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Warning"},
             {"Resolution", "Remove the query parameters and resubmit the "
                            "request if the operation failed."}});
@@ -940,6 +975,7 @@
             {"MessageId", "Base.1.4.0.CreateLimitReachedForResource"},
             {"Message", "The create operation failed because the resource has "
                         "reached the limit of possible resources."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Critical"},
             {"Resolution",
              "Either delete resources and resubmit the request if the "
@@ -963,6 +999,7 @@
             {"MessageId", "Base.1.4.0.GeneralError"},
             {"Message", "A general error has occurred. See Resolution for "
                         "information on how to resolve the error."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Critical"},
             {"Resolution", "None."}});
 }
@@ -983,6 +1020,7 @@
             {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"},
             {"MessageId", "Base.1.4.0.Success"},
             {"Message", "Successfully Completed Request"},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "OK"},
             {"Resolution", "None"}});
 }
@@ -1003,6 +1041,7 @@
             {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"},
             {"MessageId", "Base.1.4.0.Created"},
             {"Message", "The resource has been created successfully"},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "OK"},
             {"Resolution", "None"}});
 }
@@ -1024,6 +1063,7 @@
             {"MessageId", "Base.1.4.0.NoOperation"},
             {"Message", "The request body submitted contain no data to act "
                         "upon and no changes to the resource took place."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Warning"},
             {"Resolution",
              "Add properties in the JSON object and resubmit the request."}});
@@ -1047,6 +1087,7 @@
             {"Message",
              "The property " + arg1 +
                  " is not in the list of valid properties for the resource."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Warning"},
             {"Resolution",
              "Remove the unknown property from the request body and resubmit "
@@ -1071,6 +1112,7 @@
             {"MessageId", "Base.1.4.0.NoValidSession"},
             {"Message",
              "There is no valid session established with the implementation."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Critical"},
             {"Resolution",
              "Establish as session before attempting any operations."}});
@@ -1092,6 +1134,7 @@
             {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"},
             {"MessageId", "Base.1.4.0.InvalidObject"},
             {"Message", "The object at " + arg1 + " is invalid."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Critical"},
             {"Resolution",
              "Either the object is malformed or the URI is not correct.  "
@@ -1115,6 +1158,7 @@
             {"MessageId", "Base.1.4.0.ResourceInStandby"},
             {"Message", "The request could not be performed because the "
                         "resource is in standby."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Critical"},
             {"Resolution", "Ensure that the resource is in the correct power "
                            "state and resubmit the request."}});
@@ -1141,6 +1185,7 @@
              "The value " + arg1 + " for the parameter " + arg2 +
                  " in the action " + arg3 +
                  " is of a different type than the parameter can accept."},
+            {"MessageArgs", {arg1, arg2, arg3}},
             {"Severity", "Warning"},
             {"Resolution",
              "Correct the value for the parameter in the request body and "
@@ -1165,6 +1210,7 @@
             {"Message", "The session establishment failed due to the number of "
                         "simultaneous sessions exceeding the limit of the "
                         "implementation."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Critical"},
             {"Resolution", "Reduce the number of other sessions before trying "
                            "to establish the session or increase the limit of "
@@ -1188,6 +1234,7 @@
             {"MessageId", "Base.1.4.0.ActionNotSupported"},
             {"Message",
              "The action " + arg1 + " is not supported by the resource."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Critical"},
             {"Resolution",
              "The action supplied cannot be resubmitted to the implementation. "
@@ -1213,6 +1260,7 @@
             {"MessageId", "Base.1.4.0.InvalidIndex"},
             {"Message", "The index " + std::to_string(arg1) +
                             " is not a valid offset into the array."},
+            {"MessageArgs", {std::to_string(arg1)}},
             {"Severity", "Warning"},
             {"Resolution", "Verify the index value provided is within the "
                            "bounds of the array."}});
@@ -1235,6 +1283,7 @@
             {"MessageId", "Base.1.4.0.EmptyJSON"},
             {"Message", "The request body submitted contained an empty JSON "
                         "object and the service is unable to process it."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Warning"},
             {"Resolution",
              "Add properties in the JSON object and resubmit the request."}});
@@ -1256,6 +1305,7 @@
             {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"},
             {"MessageId", "Base.1.4.0.QueryNotSupportedOnResource"},
             {"Message", "Querying is not supported on the requested resource."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Warning"},
             {"Resolution", "Remove the query parameters and resubmit the "
                            "request if the operation failed."}});
@@ -1279,6 +1329,7 @@
             {"Message", "There are insufficient privileges for the account or "
                         "credentials associated with the current session to "
                         "perform the requested operation."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Critical"},
             {"Resolution",
              "Either abandon the operation or change the associated access "
@@ -1303,6 +1354,7 @@
             {"MessageId", "Base.1.4.0.PropertyValueModified"},
             {"Message", "The property " + arg1 + " was assigned the value " +
                             arg2 + " due to modification by the service."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Warning"},
             {"Resolution", "No resolution is required."}},
         arg1);
@@ -1324,6 +1376,7 @@
             {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"},
             {"MessageId", "Base.1.4.0.AccountNotModified"},
             {"Message", "The account modification request failed."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "Warning"},
             {"Resolution", "The modification may have failed due to permission "
                            "issues or issues with the request body."}});
@@ -1349,6 +1402,7 @@
             {"Message",
              "The value " + arg1 + " for the parameter " + arg2 +
                  " is of a different format than the parameter can accept."},
+            {"MessageArgs", {arg1, arg2}},
             {"Severity", "Warning"},
             {"Resolution",
              "Correct the value for the query parameter in the request and "
@@ -1373,6 +1427,7 @@
             {"Message", "The property " + arg1 +
                             " is a required property and must be included in "
                             "the request."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Warning"},
             {"Resolution",
              "Ensure that the property is in the request body and has a valid "
@@ -1398,6 +1453,7 @@
             {"Message", "The resource " + arg1 +
                             " was unable to satisfy the request due to "
                             "unavailability of resources."},
+            {"MessageArgs", {arg1}},
             {"Severity", "Critical"},
             {"Resolution", "Ensure that the resources are available and "
                            "resubmit the request."}});
@@ -1419,6 +1475,7 @@
             {"@odata.type", "/redfish/v1/$metadata#Message.v1_0_0.Message"},
             {"MessageId", "Base.1.4.0.AccountModified"},
             {"Message", "The account was successfully modified."},
+            {"MessageArgs", nlohmann::json::array()},
             {"Severity", "OK"},
             {"Resolution", "No resolution is required."}});
 }
@@ -1441,6 +1498,7 @@
             {"MessageId", "Base.1.4.0.QueryParameterOutOfRange"},
             {"Message", "The value " + arg1 + " for the query parameter " +
                             arg2 + " is out of range " + arg3 + "."},
+            {"MessageArgs", {arg1, arg2, arg3}},
             {"Severity", "Warning"},
             {"Resolution",
              "Reduce the value for the query parameter to a value that is "