log_services: Add AdditionalDataURI to Post Code log entries

- Need to support the Additional Data URI on Post Code log service.
  IBM progress codes are typically 72 bytes including a primary code
  (8 bytes) and a secondary code that contains hex words that would
  provide additional details on the core problem during boot hangs.
  These secondary hex words would be in this Additional Data URI.

- Need to check for the secondary progress code(std::vector<uint8_t>)
  If it is empty, then do not generate the Additional Data URI.
  If it is not empty, then generate Additional Data URI for that
  particular post entry.

- This commit is not alone for IBM, it is a generic code that should
  work on every system.
  As per the recent PDI change that went into Progress code structure
  https://github.com/openbmc/phosphor-dbus-interfaces/commit/9a96970ebb93eb1f495c200801343a4d1c53977c#diff-0aad0ef8ed32e2652256f50357eede1aedd6ff1398df1bb1a121ad9125916c5f
  1. The primary code(uint64_t) is what we see in the BIOSPOSTCode
     Message registry.
  2. The secondary code(array[byte]) is the entire raw buffer which
     could be used to offload the information out of BMC.
  This should not impact any systems that does not have a secondary
  code, as if the secondary code is empty -> we will not populate the
  AdditionalDataURI at all.

Tested:
- Ran Redfish validator which instructed to bump the odata.type from
  v1_4_0 to v1_8_0 and passed.

- Verified the new AdditionalDataURI was correct for
  LogServices/PostCodes/Entries/<str>:
  $ curl -k
https://127.0.0.1:2443/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1
  {
	"@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries",
	"@odata.type": "#LogEntry.v1_8_0.LogEntry",
	"Description": "Collection of POST Code Log Entries",
	"Members": [
	  {
        "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1",
	    "@odata.type": "#LogEntry.v1_8_0.LogEntry",
	    "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1/attachment",
	    ... ...
      }
	],
	"Members@odata.count": 1,
	"Name": "BIOS POST Code Log Entries"
  }

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I897888a08db94e22b5a8098bc2a874b00bfb5361
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index e080634..8a68534 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -499,7 +499,7 @@
                     }
                 }
 
-                thisEntry["@odata.type"] = "#LogEntry.v1_7_0.LogEntry";
+                thisEntry["@odata.type"] = "#LogEntry.v1_8_0.LogEntry";
                 thisEntry["@odata.id"] = dumpPath + entryID;
                 thisEntry["Id"] = entryID;
                 thisEntry["EntryType"] = "Event";
@@ -621,7 +621,7 @@
                 }
 
                 asyncResp->res.jsonValue["@odata.type"] =
-                    "#LogEntry.v1_7_0.LogEntry";
+                    "#LogEntry.v1_8_0.LogEntry";
                 asyncResp->res.jsonValue["@odata.id"] = dumpPath + entryID;
                 asyncResp->res.jsonValue["Id"] = entryID;
                 asyncResp->res.jsonValue["EntryType"] = "Event";
@@ -1123,7 +1123,7 @@
 
     // Fill in the log entry with the gathered data
     logEntryJson = {
-        {"@odata.type", "#LogEntry.v1_4_0.LogEntry"},
+        {"@odata.type", "#LogEntry.v1_8_0.LogEntry"},
         {"@odata.id",
          "/redfish/v1/Systems/system/LogServices/EventLog/Entries/" +
              logEntryID},
@@ -1897,7 +1897,7 @@
 
     // Fill in the log entry with the gathered data
     bmcJournalLogEntryJson = {
-        {"@odata.type", "#LogEntry.v1_4_0.LogEntry"},
+        {"@odata.type", "#LogEntry.v1_8_0.LogEntry"},
         {"@odata.id", "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/" +
                           bmcJournalLogEntryID},
         {"Name", "BMC Journal Entry"},
@@ -2375,7 +2375,7 @@
             std::string crashdumpURI =
                 "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/" +
                 logID + "/" + filename;
-            logEntryJson = {{"@odata.type", "#LogEntry.v1_7_0.LogEntry"},
+            logEntryJson = {{"@odata.type", "#LogEntry.v1_8_0.LogEntry"},
                             {"@odata.id", "/redfish/v1/Systems/system/"
                                           "LogServices/Crashdump/Entries/" +
                                               logID},
@@ -2888,7 +2888,7 @@
         // add to AsyncResp
         logEntryArray.push_back({});
         nlohmann::json& bmcLogEntry = logEntryArray.back();
-        bmcLogEntry = {{"@odata.type", "#LogEntry.v1_4_0.LogEntry"},
+        bmcLogEntry = {{"@odata.type", "#LogEntry.v1_8_0.LogEntry"},
                        {"@odata.id", "/redfish/v1/Systems/system/LogServices/"
                                      "PostCodes/Entries/" +
                                          postcodeEntryID},
@@ -2900,6 +2900,13 @@
                        {"EntryType", "Event"},
                        {"Severity", std::move(severity)},
                        {"Created", entryTimeStr}};
+
+        if (std::get<std::vector<uint8_t>>(code.second).size())
+        {
+            bmcLogEntry["AdditionalDataURI"] =
+                "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/" +
+                postcodeEntryID + "/attachment";
+        }
     }
 }