SunnySrivastava1984 | c743d82 | 2020-04-27 05:49:22 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
SunnySrivastava1984 | bca5aaa | 2020-04-21 05:31:04 -0500 | [diff] [blame] | 3 | #include "types.hpp" |
| 4 | |
SunnySrivastava1984 | c743d82 | 2020-04-27 05:49:22 -0500 | [diff] [blame] | 5 | namespace openpower |
| 6 | { |
| 7 | namespace vpd |
| 8 | { |
| 9 | namespace manager |
| 10 | { |
| 11 | namespace reader |
| 12 | { |
| 13 | |
| 14 | /** @class ReaderImpl |
| 15 | * @brief Implements functionalities related to reading of VPD related data |
| 16 | * from the system. |
SunnySrivastava1984 | c743d82 | 2020-04-27 05:49:22 -0500 | [diff] [blame] | 17 | */ |
| 18 | class ReaderImpl |
| 19 | { |
| 20 | public: |
| 21 | ReaderImpl() = default; |
| 22 | ReaderImpl(const ReaderImpl&) = delete; |
| 23 | ReaderImpl& operator=(const ReaderImpl&) = delete; |
| 24 | ReaderImpl(ReaderImpl&&) = delete; |
| 25 | ReaderImpl& operator=(ReaderImpl&&) = delete; |
| 26 | ~ReaderImpl() = default; |
SunnySrivastava1984 | bca5aaa | 2020-04-21 05:31:04 -0500 | [diff] [blame] | 27 | |
| 28 | /** @brief An API to expand a given unexpanded location code. |
| 29 | * @param[in] locationCode - unexpanded location code. |
| 30 | * @param[in] nodeNumber - node on which we are looking for location code. |
| 31 | * @param[in] frusLocationCode - mapping of inventory path and location |
| 32 | * code. |
| 33 | * @return Expanded location code. |
| 34 | */ |
SunnySrivastava1984 | fb5815a | 2020-04-24 08:03:52 -0500 | [diff] [blame^] | 35 | inventory::LocationCode getExpandedLocationCode( |
| 36 | const inventory::LocationCode& locationCode, |
| 37 | const inventory::NodeNumber& nodeNumber, |
SunnySrivastava1984 | bca5aaa | 2020-04-21 05:31:04 -0500 | [diff] [blame] | 38 | const inventory::LocationCodeMap& frusLocationCode) const; |
| 39 | |
SunnySrivastava1984 | fb5815a | 2020-04-24 08:03:52 -0500 | [diff] [blame^] | 40 | /** @brief An API to get list of all the FRUs at the given location code |
SunnySrivastava1984 | 1356d7e | 2020-04-24 04:29:35 -0500 | [diff] [blame] | 41 | * @param[in] - location code in unexpanded format |
| 42 | * @param[in] - node number |
| 43 | * @param[in] - mapping of location code and Inventory path |
| 44 | * @return list of Inventory paths at the given location |
| 45 | */ |
| 46 | inventory::ListOfPaths getFrusAtLocation( |
SunnySrivastava1984 | fb5815a | 2020-04-24 08:03:52 -0500 | [diff] [blame^] | 47 | const inventory::LocationCode& locationCode, |
| 48 | const inventory::NodeNumber& nodeNumber, |
| 49 | const inventory::LocationCodeMap& frusLocationCode) const; |
| 50 | |
| 51 | /** @brief An API to get list of all the FRUs at the given location code |
| 52 | * @param[in] - location code in unexpanded format |
| 53 | * @param[in] - mapping of location code and Inventory path |
| 54 | * @return list of Inventory paths at the given location |
| 55 | */ |
| 56 | inventory::ListOfPaths getFRUsByExpandedLocationCode( |
| 57 | const inventory::LocationCode& locationCode, |
SunnySrivastava1984 | 1356d7e | 2020-04-24 04:29:35 -0500 | [diff] [blame] | 58 | const inventory::LocationCodeMap& frusLocationCode) const; |
| 59 | |
| 60 | private: |
| 61 | /** @brief An api to check validity of location code |
| 62 | * @param[in] - location code |
| 63 | * @return true/false based on validity check |
| 64 | */ |
SunnySrivastava1984 | fb5815a | 2020-04-24 08:03:52 -0500 | [diff] [blame^] | 65 | bool isValidLocationCode(const inventory::LocationCode& locationCode) const; |
| 66 | |
| 67 | /** @brief An API to split expanded location code to its un-expanded |
| 68 | * format as represented in VPD JSON and the node number. |
| 69 | * @param[in] Location code in expanded format. |
| 70 | * @return Location code in un-expanded format and its node number. |
| 71 | */ |
| 72 | std::tuple<inventory::LocationCode, inventory::NodeNumber> |
| 73 | getCollapsedLocationCode( |
| 74 | const inventory::LocationCode& locationCode) const; |
SunnySrivastava1984 | 1356d7e | 2020-04-24 04:29:35 -0500 | [diff] [blame] | 75 | |
SunnySrivastava1984 | c743d82 | 2020-04-27 05:49:22 -0500 | [diff] [blame] | 76 | }; // class ReaderImpl |
| 77 | |
| 78 | } // namespace reader |
| 79 | } // namespace manager |
| 80 | } // namespace vpd |
SunnySrivastava1984 | 1356d7e | 2020-04-24 04:29:35 -0500 | [diff] [blame] | 81 | } // namespace openpower |