Skip to content

Commit

Permalink
Merge pull request #580 from branupama/vpd-tool_user_option
Browse files Browse the repository at this point in the history
vpd-tool: Show user option for fixSystemVpd
  • Loading branch information
SunnySrivastava1984 authored Jan 13, 2025
2 parents 70a1a3f + 6fce1d3 commit 8cc458c
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
12 changes: 12 additions & 0 deletions vpd-tool/include/tool_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,17 @@ using WriteVpdParams = std::variant<IpzData, KwData>;
// Return type of ObjectMapper GetObject API
using MapperGetObject = std::map<std::string,std::vector<std::string>>;

enum UserOption
{
Exit,
UseBackupDataForAll,
UseSystemBackplaneDataForAll,
MoreOptions,
UseBackupDataForCurrent,
UseSystemBackplaneDataForCurrent,
NewValueOnBoth,
SkipCurrent
};

} // namespace types
} // namespace vpd
8 changes: 8 additions & 0 deletions vpd-tool/include/vpd_tool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ class VpdTool
*/
nlohmann::json getBackupRestoreCfgJsonObj() const noexcept;

/**
* @brief Prints the user options for fix system VPD command.
*
* @param[in] i_option - Option to use.
*/
void printFixSystemVpdOption(
const types::UserOption& i_option) const noexcept;

public:
/**
* @brief Read keyword value.
Expand Down
52 changes: 52 additions & 0 deletions vpd-tool/src/vpd_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,14 @@ nlohmann::json VpdTool::getInventoryPropertyJson(
int VpdTool::fixSystemVpd() noexcept
{
int l_rc = constants::FAILURE;

printFixSystemVpdOption(types::UserOption::UseBackupDataForAll);
printFixSystemVpdOption(types::UserOption::UseSystemBackplaneDataForAll);
printFixSystemVpdOption(types::UserOption::MoreOptions);
printFixSystemVpdOption(types::UserOption::Exit);

// ToDo: Implementation needs to be added

return l_rc;
}

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

void VpdTool::printFixSystemVpdOption(
const types::UserOption& i_option) const noexcept
{
switch (i_option)
{
case types::UserOption::Exit:
std::cout << "Enter 0 => To exit successfully : ";
break;
case types::UserOption::UseBackupDataForAll:
std::cout << "Enter 1 => If you choose the data on backup for all "
"mismatching record-keyword pairs"
<< std::endl;
break;
case types::UserOption::UseSystemBackplaneDataForAll:
std::cout << "Enter 2 => If you choose the data on primary for all "
"mismatching record-keyword pairs"
<< std::endl;
break;
case types::UserOption::MoreOptions:
std::cout << "Enter 3 => If you wish to explore more options"
<< std::endl;
break;
case types::UserOption::UseBackupDataForCurrent:
std::cout << "Enter 4 => If you choose the data on backup as the "
"right value"
<< std::endl;
break;
case types::UserOption::UseSystemBackplaneDataForCurrent:
std::cout << "Enter 5 => If you choose the data on primary as the "
"right value"
<< std::endl;
break;
case types::UserOption::NewValueOnBoth:
std::cout
<< "Enter 6 => If you wish to enter a new value to update "
"both on backup and primary"
<< std::endl;
break;
case types::UserOption::SkipCurrent:
std::cout << "Enter 7 => If you wish to skip the above "
"record-keyword pair"
<< std::endl;
break;
}
}
} // namespace vpd

0 comments on commit 8cc458c

Please sign in to comment.