PEL: peltool: Add const strings for section header
Added "Section Version", "Sub-section type" and "Created by" constant strings.
Updated all getJSON() functions to use the new constants.
Signed-off-by: Harisuddin Mohamed Isa <harisuddin@gmail.com>
Change-Id: I434192afed929972845c3cfb8876cc5ef784eec2
diff --git a/extensions/openpower-pels/extended_user_header.cpp b/extensions/openpower-pels/extended_user_header.cpp
index 282bb41..7b381e8 100644
--- a/extensions/openpower-pels/extended_user_header.cpp
+++ b/extensions/openpower-pels/extended_user_header.cpp
@@ -17,6 +17,7 @@
#include "json_utils.hpp"
#include "pel_types.hpp"
+#include "pel_values.hpp"
#include <phosphor-logging/log.hpp>
@@ -25,6 +26,7 @@
namespace pels
{
+namespace pv = openpower::pels::pel_values;
using namespace phosphor::logging;
const size_t defaultSymptomIDWord = 3;
const size_t symptomIDMaxSize = 80;
@@ -179,12 +181,10 @@
std::optional<std::string> ExtendedUserHeader::getJSON() const
{
std::string json;
- jsonInsert(json, "Section Version", getNumberString("%d", _header.version),
- 1);
- jsonInsert(json, "Sub-section type", getNumberString("%d", _header.subType),
- 1);
- jsonInsert(json, "Created by", getNumberString("0x%X", _header.componentID),
- 1);
+ jsonInsert(json, pv::sectionVer, getNumberString("%d", _header.version), 1);
+ jsonInsert(json, pv::subSection, getNumberString("%d", _header.subType), 1);
+ jsonInsert(json, pv::createdBy,
+ getNumberString("0x%X", _header.componentID), 1);
jsonInsert(json, "Reporting Machine Type", machineTypeModel(), 1);
jsonInsert(json, "Reporting Serial Number", trimEnd(machineSerialNumber()),
1);