| #ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_CONFIG_ENTITY_CONFIG_H_ |
| #define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_CONFIG_ENTITY_CONFIG_H_ |
| |
| #include <string> |
| #include <vector> |
| |
| #include "absl/status/statusor.h" |
| #include "absl/strings/string_view.h" |
| #include "absl/types/span.h" |
| #include "nlohmann/json.hpp" |
| #include "fan_controller_config.pb.h" |
| #include "fan_pwm_config.pb.h" |
| #include "fan_tach_config.pb.h" |
| #include "hwmon_temp_sensor_config.pb.h" |
| #include "psu_sensor_config.pb.h" |
| #include "shared_mem_sensor_config.pb.h" |
| #include "topology_config.pb.h" |
| #include "fru.pb.h" |
| #include "router_interface.h" |
| |
| namespace milotic_tlbmc { |
| |
| // A config in `EntityConfig` is similar to a Entity Manager config. |
| // The class is responsible for parsing all the configs, calculate topologies, |
| // and generates reactor (e.g. sensors) configs. |
| class EntityConfig { |
| public: |
| // Returns all the hardware monitor temperature sensor configs found on the |
| // system. |
| virtual absl::StatusOr<absl::Span<const HwmonTempSensorConfig>> |
| GetAllHwmonTempSensorConfigs() const = 0; |
| // Returns all the power supply unit sensor configs found on the system. |
| virtual absl::StatusOr<absl::Span<const PsuSensorConfig>> |
| GetAllPsuSensorConfigs() const = 0; |
| virtual absl::StatusOr<absl::Span<const FanControllerConfig>> |
| GetAllFanControllerConfigs() const = 0; |
| virtual absl::StatusOr<absl::Span<const FanPwmConfig>> GetAllFanPwmConfigs() |
| const = 0; |
| virtual absl::StatusOr<absl::Span<const FanTachConfig>> GetAllFanTachConfigs() |
| const = 0; |
| virtual absl::StatusOr<absl::Span<const SharedMemSensorConfig>> |
| GetAllSharedMemSensorConfigs() const = 0; |
| // Returns the topology of the given FRU identified by the given FRU key. |
| virtual absl::StatusOr<const TopologyConfigNode*> GetFruTopology( |
| absl::string_view fru_key) const = 0; |
| // Returns the topology of the given config name. |
| virtual absl::StatusOr<const TopologyConfigNode*> GetFruTopologyByConfig( |
| absl::string_view config_name) const = 0; |
| // Returns the topology config of all configs. |
| virtual absl::StatusOr<const TopologyConfig*> GetTopologyConfig() const = 0; |
| // Returns all the config names. |
| virtual absl::StatusOr<std::vector<std::string>> GetAllConfigNames() |
| const = 0; |
| // Returns the config name of the given FRU key. |
| virtual absl::StatusOr<std::string> GetConfigNameByFruKey( |
| absl::string_view fru_key) const = 0; |
| // Returns the FRU key of the given config name. |
| virtual absl::StatusOr<std::string> GetFruKeyByConfigName( |
| absl::string_view config_name) const = 0; |
| // Returns the devpath of the given FRU key. |
| virtual absl::StatusOr<std::string> GetFruDevpath( |
| absl::string_view fru_key) const = 0; |
| virtual absl::StatusOr<const Fru*> GetFru(absl::string_view key) const = 0; |
| virtual absl::StatusOr<const FruTable*> GetAllFrus() const = 0; |
| virtual void UpdateFruAndTopology(const RawFruTable& fru_table) = 0; |
| virtual void SetSmartRouter(::crow::RouterInterface* smart_router) = 0; |
| virtual nlohmann::json ToJson() const = 0; |
| virtual ~EntityConfig() = default; |
| }; |
| |
| } // namespace milotic_tlbmc |
| |
| #endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_CONFIG_ENTITY_CONFIG_H_ |