Skip to content

Commit 8cc458c

Browse files
Merge pull request #580 from branupama/vpd-tool_user_option
vpd-tool: Show user option for fixSystemVpd
2 parents 70a1a3f + 6fce1d3 commit 8cc458c

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

vpd-tool/include/tool_types.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,17 @@ using WriteVpdParams = std::variant<IpzData, KwData>;
5858
// Return type of ObjectMapper GetObject API
5959
using MapperGetObject = std::map<std::string,std::vector<std::string>>;
6060

61+
enum UserOption
62+
{
63+
Exit,
64+
UseBackupDataForAll,
65+
UseSystemBackplaneDataForAll,
66+
MoreOptions,
67+
UseBackupDataForCurrent,
68+
UseSystemBackplaneDataForCurrent,
69+
NewValueOnBoth,
70+
SkipCurrent
71+
};
72+
6173
} // namespace types
6274
} // namespace vpd

vpd-tool/include/vpd_tool.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ class VpdTool
106106
*/
107107
nlohmann::json getBackupRestoreCfgJsonObj() const noexcept;
108108

109+
/**
110+
* @brief Prints the user options for fix system VPD command.
111+
*
112+
* @param[in] i_option - Option to use.
113+
*/
114+
void printFixSystemVpdOption(
115+
const types::UserOption& i_option) const noexcept;
116+
109117
public:
110118
/**
111119
* @brief Read keyword value.

vpd-tool/src/vpd_tool.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,14 @@ nlohmann::json VpdTool::getInventoryPropertyJson(
245245
int VpdTool::fixSystemVpd() noexcept
246246
{
247247
int l_rc = constants::FAILURE;
248+
249+
printFixSystemVpdOption(types::UserOption::UseBackupDataForAll);
250+
printFixSystemVpdOption(types::UserOption::UseSystemBackplaneDataForAll);
251+
printFixSystemVpdOption(types::UserOption::MoreOptions);
252+
printFixSystemVpdOption(types::UserOption::Exit);
253+
248254
// ToDo: Implementation needs to be added
255+
249256
return l_rc;
250257
}
251258

@@ -394,4 +401,49 @@ bool VpdTool::isFruPresent(const std::string& i_objectPath) const noexcept
394401
return l_returnValue;
395402
}
396403

404+
void VpdTool::printFixSystemVpdOption(
405+
const types::UserOption& i_option) const noexcept
406+
{
407+
switch (i_option)
408+
{
409+
case types::UserOption::Exit:
410+
std::cout << "Enter 0 => To exit successfully : ";
411+
break;
412+
case types::UserOption::UseBackupDataForAll:
413+
std::cout << "Enter 1 => If you choose the data on backup for all "
414+
"mismatching record-keyword pairs"
415+
<< std::endl;
416+
break;
417+
case types::UserOption::UseSystemBackplaneDataForAll:
418+
std::cout << "Enter 2 => If you choose the data on primary for all "
419+
"mismatching record-keyword pairs"
420+
<< std::endl;
421+
break;
422+
case types::UserOption::MoreOptions:
423+
std::cout << "Enter 3 => If you wish to explore more options"
424+
<< std::endl;
425+
break;
426+
case types::UserOption::UseBackupDataForCurrent:
427+
std::cout << "Enter 4 => If you choose the data on backup as the "
428+
"right value"
429+
<< std::endl;
430+
break;
431+
case types::UserOption::UseSystemBackplaneDataForCurrent:
432+
std::cout << "Enter 5 => If you choose the data on primary as the "
433+
"right value"
434+
<< std::endl;
435+
break;
436+
case types::UserOption::NewValueOnBoth:
437+
std::cout
438+
<< "Enter 6 => If you wish to enter a new value to update "
439+
"both on backup and primary"
440+
<< std::endl;
441+
break;
442+
case types::UserOption::SkipCurrent:
443+
std::cout << "Enter 7 => If you wish to skip the above "
444+
"record-keyword pair"
445+
<< std::endl;
446+
break;
447+
}
448+
}
397449
} // namespace vpd

0 commit comments

Comments
 (0)