| #ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_REDFISH_DATA_STABLE_ID_H_ |
| #define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_REDFISH_DATA_STABLE_ID_H_ |
| |
| #include <array> |
| #include <string> |
| #include <string_view> |
| #include <utility> |
| |
| #include "topology_config.pb.h" |
| #include "stable_id.pb.h" |
| #include "resource.pb.h" |
| |
| namespace milotic_tlbmc { |
| |
| // Machine local devpaths always begin with "/phys". |
| // Any devpath that has a RootChassisLocationCode should be replaced with |
| // "/phys/" |
| std::string GetNodeLocalDevpath(const std::string& devpath, |
| const std::string& root_chassis_location_code); |
| |
| // Returns the stable id from LocationContext. |
| StableId GetStableId(const TopologyConfigNode& topology_config_node); |
| |
| constexpr auto kPartLocationTypeStrings = |
| std::to_array<std::pair<std::string_view, PartLocationType>>({ |
| // go/keep-sorted start |
| {"Backplane", PART_LOCATION_TYPE_BACKPLANE}, |
| {"Bay", PART_LOCATION_TYPE_BAY}, |
| {"Connector", PART_LOCATION_TYPE_CONNECTOR}, |
| {"Embedded", PART_LOCATION_TYPE_EMBEDDED}, |
| {"Slot", PART_LOCATION_TYPE_SLOT}, |
| {"Socket", PART_LOCATION_TYPE_SOCKET}, |
| // go/keep-sorted end |
| }); |
| |
| PartLocationType GetPartLocationTypeFromRedfishString( |
| const std::string& part_location_type); |
| |
| } // namespace milotic_tlbmc |
| |
| #endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_REDFISH_DATA_STABLE_ID_H_ |