blob: 0a8d8448f107f07db916028e9554237d04e0cb99 [file] [log] [blame]
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -05001#include "backup_restore.hpp"
2
3#include "constants.hpp"
4#include "event_logger.hpp"
5#include "exceptions.hpp"
6#include "logger.hpp"
7#include "parser.hpp"
8#include "types.hpp"
9
10#include <utility/json_utility.hpp>
11#include <utility/vpd_specific_utility.hpp>
12
13namespace vpd
14{
15BackupAndRestoreStatus BackupAndRestore::m_backupAndRestoreStatus =
16 BackupAndRestoreStatus::NotStarted;
17
18BackupAndRestore::BackupAndRestore(const nlohmann::json& i_sysCfgJsonObj) :
19 m_sysCfgJsonObj(i_sysCfgJsonObj)
20{
21 std::string l_backupAndRestoreCfgFilePath =
22 i_sysCfgJsonObj.value("backupRestoreConfigPath", "");
RekhaAparna011ef21002025-02-18 23:47:36 -060023
Rekha Aparnaca9a0862025-08-29 04:08:33 -050024 uint16_t l_errCode = 0;
RekhaAparna011ef21002025-02-18 23:47:36 -060025 m_backupAndRestoreCfgJsonObj =
Rekha Aparnaca9a0862025-08-29 04:08:33 -050026 jsonUtility::getParsedJson(l_backupAndRestoreCfgFilePath, l_errCode);
RekhaAparna011ef21002025-02-18 23:47:36 -060027
Rekha Aparnaca9a0862025-08-29 04:08:33 -050028 if (l_errCode)
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -050029 {
Rekha Aparnaca9a0862025-08-29 04:08:33 -050030 throw JsonException(
31 "JSON parsing failed for file [" + l_backupAndRestoreCfgFilePath +
32 "], error : " + vpdSpecificUtility::getErrCodeMsg(l_errCode),
33 l_backupAndRestoreCfgFilePath);
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -050034 }
35}
36
37std::tuple<types::VPDMapVariant, types::VPDMapVariant>
38 BackupAndRestore::backupAndRestore()
39{
40 auto l_emptyVariantPair =
41 std::make_tuple(std::monostate{}, std::monostate{});
42
43 if (m_backupAndRestoreStatus >= BackupAndRestoreStatus::Invoked)
44 {
45 logging::logMessage("Backup and restore invoked already.");
46 return l_emptyVariantPair;
47 }
48
49 m_backupAndRestoreStatus = BackupAndRestoreStatus::Invoked;
50 try
51 {
52 if (m_backupAndRestoreCfgJsonObj.empty() ||
53 !m_backupAndRestoreCfgJsonObj.contains("source") ||
54 !m_backupAndRestoreCfgJsonObj.contains("destination") ||
55 !m_backupAndRestoreCfgJsonObj.contains("type") ||
56 !m_backupAndRestoreCfgJsonObj.contains("backupMap"))
57 {
58 logging::logMessage(
59 "Backup restore config JSON is missing necessary tag(s), can't initiate backup and restore.");
60 return l_emptyVariantPair;
61 }
62
63 std::string l_srcVpdPath;
64 types::VPDMapVariant l_srcVpdVariant;
65 if (l_srcVpdPath = m_backupAndRestoreCfgJsonObj["source"].value(
66 "hardwarePath", "");
67 !l_srcVpdPath.empty() && std::filesystem::exists(l_srcVpdPath))
68 {
69 std::shared_ptr<Parser> l_vpdParser =
70 std::make_shared<Parser>(l_srcVpdPath, m_sysCfgJsonObj);
71 l_srcVpdVariant = l_vpdParser->parse();
72 }
73 else if (l_srcVpdPath = m_backupAndRestoreCfgJsonObj["source"].value(
74 "inventoryPath", "");
75 l_srcVpdPath.empty())
76 {
77 logging::logMessage(
78 "Couldn't extract source path, can't initiate backup and restore.");
79 return l_emptyVariantPair;
80 }
81
82 std::string l_dstVpdPath;
83 types::VPDMapVariant l_dstVpdVariant;
84 if (l_dstVpdPath = m_backupAndRestoreCfgJsonObj["destination"].value(
85 "hardwarePath", "");
86 !l_dstVpdPath.empty() && std::filesystem::exists(l_dstVpdPath))
87 {
88 std::shared_ptr<Parser> l_vpdParser =
89 std::make_shared<Parser>(l_dstVpdPath, m_sysCfgJsonObj);
90 l_dstVpdVariant = l_vpdParser->parse();
91 }
92 else if (l_dstVpdPath = m_backupAndRestoreCfgJsonObj["destination"]
93 .value("inventoryPath", "");
94 l_dstVpdPath.empty())
95 {
96 logging::logMessage(
97 "Couldn't extract destination path, can't initiate backup and restore.");
98 return l_emptyVariantPair;
99 }
100
101 // Implement backup and restore for IPZ type VPD
102 auto l_backupAndRestoreType =
103 m_backupAndRestoreCfgJsonObj.value("type", "");
104 if (l_backupAndRestoreType.compare("IPZ") == constants::STR_CMP_SUCCESS)
105 {
106 types::IPZVpdMap l_srcVpdMap;
107 if (auto l_srcVpdPtr =
108 std::get_if<types::IPZVpdMap>(&l_srcVpdVariant))
109 {
110 l_srcVpdMap = *l_srcVpdPtr;
111 }
112 else if (!std::holds_alternative<std::monostate>(l_srcVpdVariant))
113 {
114 logging::logMessage("Source VPD is not of IPZ type.");
115 return l_emptyVariantPair;
116 }
117
118 types::IPZVpdMap l_dstVpdMap;
119 if (auto l_dstVpdPtr =
120 std::get_if<types::IPZVpdMap>(&l_dstVpdVariant))
121 {
122 l_dstVpdMap = *l_dstVpdPtr;
123 }
124 else if (!std::holds_alternative<std::monostate>(l_dstVpdVariant))
125 {
126 logging::logMessage("Destination VPD is not of IPZ type.");
127 return l_emptyVariantPair;
128 }
129
130 backupAndRestoreIpzVpd(l_srcVpdMap, l_dstVpdMap, l_srcVpdPath,
131 l_dstVpdPath);
132 m_backupAndRestoreStatus = BackupAndRestoreStatus::Completed;
133
134 return std::make_tuple(l_srcVpdMap, l_dstVpdMap);
135 }
136 // Note: add implementation here to support any other VPD type.
137 }
138 catch (const std::exception& ex)
139 {
140 logging::logMessage("Back up and restore failed with exception: " +
141 std::string(ex.what()));
142 }
143 return l_emptyVariantPair;
144}
145
146void BackupAndRestore::backupAndRestoreIpzVpd(
147 types::IPZVpdMap& io_srcVpdMap, types::IPZVpdMap& io_dstVpdMap,
148 const std::string& i_srcPath, const std::string& i_dstPath)
149{
150 if (!m_backupAndRestoreCfgJsonObj["backupMap"].is_array())
151 {
152 logging::logMessage(
153 "Invalid value found for tag backupMap, in backup and restore config JSON.");
154 return;
155 }
156
Rekha Aparna0578dd22025-09-02 08:20:21 -0500157 uint16_t l_errCode = 0;
158
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500159 const std::string l_srcFruPath =
Rekha Aparna0578dd22025-09-02 08:20:21 -0500160 jsonUtility::getFruPathFromJson(m_sysCfgJsonObj, i_srcPath, l_errCode);
161
162 if (l_errCode)
163 {
164 logging::logMessage(
165 "Failed to get source FRU path for [" + i_srcPath +
166 "], error : " + vpdSpecificUtility::getErrCodeMsg(l_errCode));
167 return;
168 }
169
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500170 const std::string l_dstFruPath =
Rekha Aparna0578dd22025-09-02 08:20:21 -0500171 jsonUtility::getFruPathFromJson(m_sysCfgJsonObj, i_dstPath, l_errCode);
172
173 if (l_errCode)
174 {
175 logging::logMessage(
176 "Failed to get destination FRU path for [" + i_dstPath +
177 "], error : " + vpdSpecificUtility::getErrCodeMsg(l_errCode));
178 return;
179 }
180
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500181 if (l_srcFruPath.empty() || l_dstFruPath.empty())
182 {
183 logging::logMessage(
184 "Couldn't find either source or destination FRU path.");
185 return;
186 }
187
Rekha Aparna017567a2025-08-13 02:07:06 -0500188 const std::string l_srcInvPath = jsonUtility::getInventoryObjPathFromJson(
189 m_sysCfgJsonObj, i_srcPath, l_errCode);
190
191 if (l_srcInvPath.empty())
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500192 {
Rekha Aparna017567a2025-08-13 02:07:06 -0500193 if (l_errCode)
194 {
195 logging::logMessage(
196 "Couldn't find source inventory path. Error : " +
197 vpdSpecificUtility::getErrCodeMsg(l_errCode));
198 return;
199 }
200
201 logging::logMessage("Couldn't find source inventory path.");
202 return;
203 }
204
205 const std::string l_dstInvPath = jsonUtility::getInventoryObjPathFromJson(
206 m_sysCfgJsonObj, i_dstPath, l_errCode);
207
208 if (l_dstInvPath.empty())
209 {
210 if (l_errCode)
211 {
212 logging::logMessage(
213 "Couldn't find destination inventory path. Error : " +
214 vpdSpecificUtility::getErrCodeMsg(l_errCode));
215 return;
216 }
217
218 logging::logMessage("Couldn't find destination inventory path.");
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500219 return;
220 }
221
222 const std::string l_srcServiceName =
223 jsonUtility::getServiceName(m_sysCfgJsonObj, l_srcInvPath);
224 const std::string l_dstServiceName =
225 jsonUtility::getServiceName(m_sysCfgJsonObj, l_dstInvPath);
226 if (l_srcServiceName.empty() || l_dstServiceName.empty())
227 {
228 logging::logMessage(
229 "Couldn't find either source or destination DBus service name.");
230 return;
231 }
232
233 for (const auto& l_aRecordKwInfo :
234 m_backupAndRestoreCfgJsonObj["backupMap"])
235 {
236 const std::string& l_srcRecordName =
237 l_aRecordKwInfo.value("sourceRecord", "");
238 const std::string& l_srcKeywordName =
239 l_aRecordKwInfo.value("sourceKeyword", "");
240 const std::string& l_dstRecordName =
241 l_aRecordKwInfo.value("destinationRecord", "");
242 const std::string& l_dstKeywordName =
243 l_aRecordKwInfo.value("destinationKeyword", "");
244
245 if (l_srcRecordName.empty() || l_dstRecordName.empty() ||
246 l_srcKeywordName.empty() || l_dstKeywordName.empty())
247 {
248 logging::logMessage(
249 "Record or keyword not found in the backup and restore config JSON.");
250 continue;
251 }
252
253 if (!io_srcVpdMap.empty() &&
254 io_srcVpdMap.find(l_srcRecordName) == io_srcVpdMap.end())
255 {
256 logging::logMessage(
257 "Record: " + l_srcRecordName +
258 ", is not found in the source path: " + i_srcPath);
259 continue;
260 }
261
262 if (!io_dstVpdMap.empty() &&
263 io_dstVpdMap.find(l_dstRecordName) == io_dstVpdMap.end())
264 {
265 logging::logMessage(
266 "Record: " + l_dstRecordName +
267 ", is not found in the destination path: " + i_dstPath);
268 continue;
269 }
270
271 types::BinaryVector l_defaultBinaryValue;
272 if (l_aRecordKwInfo.contains("defaultValue") &&
273 l_aRecordKwInfo["defaultValue"].is_array())
274 {
275 l_defaultBinaryValue =
276 l_aRecordKwInfo["defaultValue"].get<types::BinaryVector>();
277 }
278 else
279 {
280 logging::logMessage(
281 "Couldn't read default value for record name: " +
282 l_srcRecordName + ", keyword name: " + l_srcKeywordName +
283 " from backup and restore config JSON file.");
284 continue;
285 }
286
287 bool l_isPelRequired = l_aRecordKwInfo.value("isPelRequired", false);
288
289 types::BinaryVector l_srcBinaryValue;
290 std::string l_srcStrValue;
291 if (!io_srcVpdMap.empty())
292 {
Souvik Roya55fcca2025-02-19 01:33:58 -0600293 l_srcStrValue = vpdSpecificUtility::getKwVal(
294 io_srcVpdMap.at(l_srcRecordName), l_srcKeywordName);
295
296 if (l_srcStrValue.empty())
297 {
298 std::runtime_error(
299 std::string("Failed to get value for keyword [") +
300 l_srcKeywordName + std::string("]"));
301 }
302
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500303 l_srcBinaryValue =
304 types::BinaryVector(l_srcStrValue.begin(), l_srcStrValue.end());
305 }
306 else
307 {
308 // Read keyword value from DBus
309 const auto l_value = dbusUtility::readDbusProperty(
310 l_srcServiceName, l_srcInvPath,
311 constants::ipzVpdInf + l_srcRecordName, l_srcKeywordName);
312 if (const auto l_binaryValue =
313 std::get_if<types::BinaryVector>(&l_value))
314 {
315 l_srcBinaryValue = *l_binaryValue;
316 l_srcStrValue = std::string(l_srcBinaryValue.begin(),
317 l_srcBinaryValue.end());
318 }
319 }
320
321 types::BinaryVector l_dstBinaryValue;
322 std::string l_dstStrValue;
323 if (!io_dstVpdMap.empty())
324 {
Souvik Roya55fcca2025-02-19 01:33:58 -0600325 l_dstStrValue = vpdSpecificUtility::getKwVal(
326 io_dstVpdMap.at(l_dstRecordName), l_dstKeywordName);
327
328 if (l_dstStrValue.empty())
329 {
330 std::runtime_error(
331 std::string("Failed to get value for keyword [") +
332 l_dstKeywordName + std::string("]"));
333 }
334
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500335 l_dstBinaryValue =
336 types::BinaryVector(l_dstStrValue.begin(), l_dstStrValue.end());
337 }
338 else
339 {
340 // Read keyword value from DBus
341 const auto l_value = dbusUtility::readDbusProperty(
342 l_dstServiceName, l_dstInvPath,
343 constants::ipzVpdInf + l_dstRecordName, l_dstKeywordName);
344 if (const auto l_binaryValue =
345 std::get_if<types::BinaryVector>(&l_value))
346 {
347 l_dstBinaryValue = *l_binaryValue;
348 l_dstStrValue = std::string(l_dstBinaryValue.begin(),
349 l_dstBinaryValue.end());
350 }
351 }
352
353 if (l_srcBinaryValue != l_dstBinaryValue)
354 {
355 // ToDo: Handle if there is no valid default value in the backup and
356 // restore config JSON.
357 if (l_dstBinaryValue == l_defaultBinaryValue)
358 {
359 // Update keyword's value on hardware
360 auto l_vpdParser =
361 std::make_shared<Parser>(l_dstFruPath, m_sysCfgJsonObj);
362
363 auto l_bytesUpdatedOnHardware = l_vpdParser->updateVpdKeyword(
364 types::IpzData(l_dstRecordName, l_dstKeywordName,
365 l_srcBinaryValue));
366
367 /* To keep the data in sync between hardware and parsed map
368 updating the io_dstVpdMap. This should only be done if write
369 on hardware returns success.*/
370 if (!io_dstVpdMap.empty() && l_bytesUpdatedOnHardware > 0)
371 {
372 io_dstVpdMap[l_dstRecordName][l_dstKeywordName] =
373 l_srcStrValue;
374 }
375 continue;
376 }
377
378 if (l_srcBinaryValue == l_defaultBinaryValue)
379 {
380 // Update keyword's value on hardware
381 auto l_vpdParser =
382 std::make_shared<Parser>(l_srcFruPath, m_sysCfgJsonObj);
383
384 auto l_bytesUpdatedOnHardware = l_vpdParser->updateVpdKeyword(
385 types::IpzData(l_srcRecordName, l_srcKeywordName,
386 l_dstBinaryValue));
387
388 /* To keep the data in sync between hardware and parsed map
389 updating the io_srcVpdMap. This should only be done if write
390 on hardware returns success.*/
391 if (!io_srcVpdMap.empty() && l_bytesUpdatedOnHardware > 0)
392 {
393 io_srcVpdMap[l_srcRecordName][l_srcKeywordName] =
394 l_dstStrValue;
395 }
396 }
397 else
398 {
399 /**
400 * Update io_srcVpdMap to publish the same data on DBus, which
401 * is already present on the DBus. Because after calling
402 * backupAndRestore API the map value will get published to DBus
403 * in the worker flow.
404 */
405 if (!io_srcVpdMap.empty() && io_dstVpdMap.empty())
406 {
407 io_srcVpdMap[l_srcRecordName][l_srcKeywordName] =
408 l_dstStrValue;
409 }
410
411 std::string l_errorMsg(
412 "Mismatch found between source and destination VPD for record : " +
413 l_srcRecordName + " and keyword : " + l_srcKeywordName +
Anupama B R6f142832025-04-11 04:17:49 -0500414 " . Value read from source : " +
415 commonUtility::convertByteVectorToHex(l_srcBinaryValue) +
416 " . Value read from destination : " +
417 commonUtility::convertByteVectorToHex(l_dstBinaryValue));
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500418
419 EventLogger::createSyncPel(
420 types::ErrorType::VpdMismatch, types::SeverityType::Warning,
421 __FILE__, __FUNCTION__, 0, l_errorMsg, std::nullopt,
422 std::nullopt, std::nullopt, std::nullopt);
423 }
424 }
425 else if (l_srcBinaryValue == l_defaultBinaryValue &&
426 l_dstBinaryValue == l_defaultBinaryValue && l_isPelRequired)
427 {
428 std::string l_errorMsg(
429 "Default value found on both source and destination VPD, for record: " +
430 l_srcRecordName + " and keyword: " + l_srcKeywordName);
431
432 EventLogger::createSyncPel(
433 types::ErrorType::DefaultValue, types::SeverityType::Error,
434 __FILE__, __FUNCTION__, 0, l_errorMsg, std::nullopt,
435 std::nullopt, std::nullopt, std::nullopt);
436 }
437 }
438}
439
440void BackupAndRestore::setBackupAndRestoreStatus(
441 const BackupAndRestoreStatus& i_status)
442{
443 m_backupAndRestoreStatus = i_status;
444}
Anupama B R8dedd1e2025-03-24 07:43:47 -0500445
446int BackupAndRestore::updateKeywordOnPrimaryOrBackupPath(
447 const std::string& i_fruPath,
Anupama B R7b293cd2025-03-28 05:35:01 -0500448 const types::WriteVpdParams& i_paramsToWriteData) const noexcept
Anupama B R8dedd1e2025-03-24 07:43:47 -0500449{
450 if (i_fruPath.empty())
451 {
452 logging::logMessage("Given FRU path is empty.");
453 return constants::FAILURE;
454 }
455
Anupama B Rd966f272025-07-21 02:40:16 -0500456 bool l_inputPathIsSourcePath = false;
457 bool l_inputPathIsDestinationPath = false;
Anupama B R7b293cd2025-03-28 05:35:01 -0500458
Anupama B R8dedd1e2025-03-24 07:43:47 -0500459 if (m_backupAndRestoreCfgJsonObj.contains("source") &&
460 m_backupAndRestoreCfgJsonObj["source"].value("hardwarePath", "") ==
461 i_fruPath &&
462 m_backupAndRestoreCfgJsonObj.contains("destination") &&
463 !m_backupAndRestoreCfgJsonObj["destination"]
464 .value("hardwarePath", "")
465 .empty())
466 {
Anupama B Rd966f272025-07-21 02:40:16 -0500467 l_inputPathIsSourcePath = true;
Anupama B R8dedd1e2025-03-24 07:43:47 -0500468 }
469 else if (m_backupAndRestoreCfgJsonObj.contains("destination") &&
470 m_backupAndRestoreCfgJsonObj["destination"].value(
471 "hardwarePath", "") == i_fruPath &&
472 m_backupAndRestoreCfgJsonObj.contains("source") &&
473 !m_backupAndRestoreCfgJsonObj["source"]
474 .value("hardwarePath", "")
475 .empty())
476 {
Anupama B Rd966f272025-07-21 02:40:16 -0500477 l_inputPathIsDestinationPath = true;
Anupama B R7b293cd2025-03-28 05:35:01 -0500478 }
479 else
480 {
481 // Input path is neither source or destination path of the
Anupama B Rd966f272025-07-21 02:40:16 -0500482 // backup&restore JSON or source and destination paths are not hardware
483 // paths in the config JSON.
Anupama B R7b293cd2025-03-28 05:35:01 -0500484 return constants::SUCCESS;
Anupama B R8dedd1e2025-03-24 07:43:47 -0500485 }
486
Anupama B Rd966f272025-07-21 02:40:16 -0500487 if (m_backupAndRestoreCfgJsonObj["backupMap"].is_array())
Anupama B R7b293cd2025-03-28 05:35:01 -0500488 {
489 std::string l_inpRecordName;
490 std::string l_inpKeywordName;
Anupama B Rd966f272025-07-21 02:40:16 -0500491 types::BinaryVector l_inpKeywordValue;
Anupama B R7b293cd2025-03-28 05:35:01 -0500492
493 if (const types::IpzData* l_ipzData =
494 std::get_if<types::IpzData>(&i_paramsToWriteData))
495 {
496 l_inpRecordName = std::get<0>(*l_ipzData);
497 l_inpKeywordName = std::get<1>(*l_ipzData);
Anupama B Rd966f272025-07-21 02:40:16 -0500498 l_inpKeywordValue = std::get<2>(*l_ipzData);
Anupama B R7b293cd2025-03-28 05:35:01 -0500499
500 if (l_inpRecordName.empty() || l_inpKeywordName.empty() ||
Anupama B Rd966f272025-07-21 02:40:16 -0500501 l_inpKeywordValue.empty())
Anupama B R7b293cd2025-03-28 05:35:01 -0500502 {
503 logging::logMessage("Invalid input received");
504 return constants::FAILURE;
505 }
506 }
507 else
508 {
509 // only IPZ type VPD is supported now.
510 return constants::SUCCESS;
511 }
512
513 for (const auto& l_aRecordKwInfo :
514 m_backupAndRestoreCfgJsonObj["backupMap"])
515 {
516 if (l_aRecordKwInfo.value("sourceRecord", "").empty() ||
517 l_aRecordKwInfo.value("sourceKeyword", "").empty() ||
518 l_aRecordKwInfo.value("destinationRecord", "").empty() ||
519 l_aRecordKwInfo.value("destinationKeyword", "").empty())
520 {
521 // invalid backup map found
522 logging::logMessage(
523 "Invalid backup map found, one or more field(s) found empty or not present in the config JSON: sourceRecord: " +
524 l_aRecordKwInfo.value("sourceRecord", "") +
525 ", sourceKeyword: " +
526 l_aRecordKwInfo.value("sourceKeyword", "") +
527 ", destinationRecord: " +
528 l_aRecordKwInfo.value("destinationRecord", "") +
529 ", destinationKeyword: " +
530 l_aRecordKwInfo.value("destinationKeyword", ""));
531 continue;
532 }
533
Anupama B Rd966f272025-07-21 02:40:16 -0500534 if (l_inputPathIsSourcePath &&
Anupama B R7b293cd2025-03-28 05:35:01 -0500535 (l_aRecordKwInfo["sourceRecord"] == l_inpRecordName) &&
536 (l_aRecordKwInfo["sourceKeyword"] == l_inpKeywordName))
537 {
538 std::string l_fruPath(
539 m_backupAndRestoreCfgJsonObj["destination"]
540 ["hardwarePath"]);
541 Parser l_parserObj(l_fruPath, m_sysCfgJsonObj);
542
543 return l_parserObj.updateVpdKeyword(std::make_tuple(
544 l_aRecordKwInfo["destinationRecord"],
Anupama B Rd966f272025-07-21 02:40:16 -0500545 l_aRecordKwInfo["destinationKeyword"], l_inpKeywordValue));
Anupama B R7b293cd2025-03-28 05:35:01 -0500546 }
Anupama B Rd966f272025-07-21 02:40:16 -0500547 else if (l_inputPathIsDestinationPath &&
Anupama B R7b293cd2025-03-28 05:35:01 -0500548 (l_aRecordKwInfo["destinationRecord"] ==
549 l_inpRecordName) &&
550 (l_aRecordKwInfo["destinationKeyword"] ==
551 l_inpKeywordName))
552 {
553 std::string l_fruPath(
554 m_backupAndRestoreCfgJsonObj["source"]["hardwarePath"]);
555 Parser l_parserObj(l_fruPath, m_sysCfgJsonObj);
556
557 return l_parserObj.updateVpdKeyword(std::make_tuple(
558 l_aRecordKwInfo["sourceRecord"],
Anupama B Rd966f272025-07-21 02:40:16 -0500559 l_aRecordKwInfo["sourceKeyword"], l_inpKeywordValue));
Anupama B R7b293cd2025-03-28 05:35:01 -0500560 }
561 }
562 }
563
564 // Received property is not part of backup & restore JSON.
Anupama B R8dedd1e2025-03-24 07:43:47 -0500565 return constants::SUCCESS;
566}
567
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -0500568} // namespace vpd