|
18 | 18 | #include <sdbusplus/bus/match.hpp> |
19 | 19 | #include <sdbusplus/message.hpp> |
20 | 20 |
|
| 21 | +#include <typeindex> |
| 22 | + |
21 | 23 | namespace vpd |
22 | 24 | { |
23 | 25 | Manager::Manager( |
@@ -272,11 +274,18 @@ void Manager::SetTimerToDetectVpdCollectionStatus() |
272 | 274 | { |
273 | 275 | // cancel the timer |
274 | 276 | l_timer.cancel(); |
275 | | - m_interface->set_property("CollectionStatus", |
276 | | - std::string("Completed")); |
277 | 277 |
|
278 | 278 | const nlohmann::json& l_sysCfgJsonObj = |
279 | 279 | m_worker->getSysCfgJsonObj(); |
| 280 | + |
| 281 | + if (vpdSpecificUtility::isPowerVsConfiguration(l_sysCfgJsonObj)) |
| 282 | + { |
| 283 | + updatePowerVsVpd(); |
| 284 | + } |
| 285 | + |
| 286 | + m_interface->set_property("CollectionStatus", |
| 287 | + std::string("Completed")); |
| 288 | + |
280 | 289 | if (jsonUtility::isBackupAndRestoreRequired(l_sysCfgJsonObj)) |
281 | 290 | { |
282 | 291 | BackupAndRestore l_backupAndRestoreObj(l_sysCfgJsonObj); |
@@ -910,4 +919,61 @@ void Manager::performVpdRecollection() |
910 | 919 | std::string(l_ex.what())); |
911 | 920 | } |
912 | 921 | } |
| 922 | + |
| 923 | +void Manager::updatePowerVsVpd() |
| 924 | +{ |
| 925 | + try |
| 926 | + { |
| 927 | + nlohmann::json l_parsedPwrVsJson = |
| 928 | + jsonUtility::getParsedJson(POWER_VS_JSON_5000); |
| 929 | + |
| 930 | + for (const auto& [l_path, l_recJson] : l_parsedPwrVsJson.items()) |
| 931 | + { |
| 932 | + std::cout << "Path = " << l_path << std::endl; |
| 933 | + |
| 934 | + for (const auto& [l_recordName, l_kwdJson] : l_recJson.items()) |
| 935 | + { |
| 936 | + std::cout << "record name = " << l_recordName << std::endl; |
| 937 | + |
| 938 | + for (const auto& [l_kwdName, l_kwdValue] : l_kwdJson.items()) |
| 939 | + { |
| 940 | + std::cout << "kwd name = " << l_kwdName << std::endl; |
| 941 | + |
| 942 | + std::cout << "kwd value size = " << l_kwdValue.size() |
| 943 | + << std::endl; |
| 944 | + if (l_kwdValue.is_array()) |
| 945 | + { |
| 946 | + std::cout << "Is array"; |
| 947 | + types::BinaryVector l_binaryKwdValue = |
| 948 | + l_kwdValue.get<types::BinaryVector>(); |
| 949 | + |
| 950 | + for (auto item : l_binaryKwdValue) |
| 951 | + { |
| 952 | + std::cout << (int)item << " "; |
| 953 | + } |
| 954 | + std::cout << std::endl; |
| 955 | + } |
| 956 | + |
| 957 | + /* if (updateKeyword(l_path, |
| 958 | + std::make_tuple(l_recordName, l_kwdName, |
| 959 | + l_kwdValue)) == |
| 960 | + constants::FAILURE) |
| 961 | + { |
| 962 | + // TODO should we stop all updates or log this failure |
| 963 | + // and continue with rest of the updates. |
| 964 | + }*/ |
| 965 | + } |
| 966 | + } |
| 967 | + } |
| 968 | + } |
| 969 | + catch (const std::exception& l_ex) |
| 970 | + { |
| 971 | + /* types::ErrorType l_errTYype = types::ErrorType::InvalidSystem; |
| 972 | +
|
| 973 | + if (typeid(l_ex) == std::type_index(typeid(JsonException))) |
| 974 | + { |
| 975 | + l_errTYype = types::ErrorType::JsonFailure; |
| 976 | + }*/ |
| 977 | + } |
| 978 | +} |
913 | 979 | } // namespace vpd |
0 commit comments