Un-expanded to expanded location code conversion
This commit implements an api to get expanded location code
from a given un-expanded location code and node number.
In case invalid argument is passed or the location code is
not found, corresponding error is returned to the caller.
Tested on simics.
To build use following command.
meson -Dibm-parser=enabled -Dvpd-manager=enabled build
ninja -C build
Sample bus call.
busctl call com.ibm.VPD.Manager /com/ibm/VPD/Manager com.ibm.VPD.Manager
GetExpandedLocationCode sq <locationCode> <nodeNumber>.
Signed-off-by: SunnySrivastava1984 <sunnsr25@in.ibm.com>
Change-Id: I52654a1c34d25dc9b861159a2ae1d15379b44677
diff --git a/vpd-manager/manager.cpp b/vpd-manager/manager.cpp
index 61a392a..1ce1cd1 100644
--- a/vpd-manager/manager.cpp
+++ b/vpd-manager/manager.cpp
@@ -4,9 +4,11 @@
#include "editor_impl.hpp"
#include "parser.hpp"
+#include "reader_impl.hpp"
using namespace openpower::vpd::constants;
using namespace openpower::vpd::manager::editor;
+using namespace openpower::vpd::manager::reader;
namespace openpower
{
@@ -75,6 +77,12 @@
frus.emplace(itemEEPROM["inventoryPath"]
.get_ref<const nlohmann::json::string_t&>(),
std::make_pair(itemFRUS.key(), isMotherboard));
+
+ fruLocationCode.emplace(
+ itemEEPROM["extraInterfaces"][LOCATION_CODE_INF]["LocationCode"]
+ .get_ref<const nlohmann::json::string_t&>(),
+ itemEEPROM["inventoryPath"]
+ .get_ref<const nlohmann::json::string_t&>());
}
}
}
@@ -134,7 +142,9 @@
std::string Manager::getExpandedLocationCode(const std::string locationCode,
const uint16_t nodeNumber)
{
- // implement the interface
+ ReaderImpl read;
+ return read.getExpandedLocationCode(locationCode, nodeNumber,
+ fruLocationCode);
}
} // namespace manager