Support Microseconds unit in tlBMC Entity-Manager parser and HFT adapter Add UNIT_MICROSECONDS to SensorUnit enum in tlBMC sensor.proto, support 'Microseconds' string in Entity-Manager JSON configuration parsing, and map it to SENSOR_UNIT_MICROSECONDS / SENSOR_TYPE_TIME in the HFT adapter. Google-Bug-Id:555854611 PiperOrigin-RevId: 975414473 Change-Id: Ie38d5833f11ab3c5b07fb4d166e9631d654411f7
diff --git a/tlbmc/configs/entity_config_json_impl.cc b/tlbmc/configs/entity_config_json_impl.cc index 564f7e1..34d4a12 100644 --- a/tlbmc/configs/entity_config_json_impl.cc +++ b/tlbmc/configs/entity_config_json_impl.cc
@@ -144,7 +144,7 @@ constexpr absl::string_view kRedfishHiddenKeyword = "RedfishHidden"; // from google3/third_party/openbmc_entity_manager/schemas/legacy.json -constexpr std::array<std::pair<std::string_view, SensorUnit>, 10> +constexpr std::array<std::pair<std::string_view, SensorUnit>, 11> kSupportedSensorUnits = {{ // go/keep-sorted start {"Amperes", SensorUnit::UNIT_AMPERE}, @@ -152,6 +152,7 @@ {"Count", SensorUnit::UNIT_COUNT}, {"DegreesC", SensorUnit::UNIT_DEGREE_CELSIUS}, {"Joules", SensorUnit::UNIT_JOULES}, + {"Microseconds", SensorUnit::UNIT_MICROSECONDS}, {"Pascals", SensorUnit::UNIT_PASCAL}, {"Percent", SensorUnit::UNIT_PERCENT}, {"RPMS", SensorUnit::UNIT_REVOLUTION_PER_MINUTE},
diff --git a/tlbmc/sensor.proto b/tlbmc/sensor.proto index c79c6af..8d23800 100644 --- a/tlbmc/sensor.proto +++ b/tlbmc/sensor.proto
@@ -25,6 +25,7 @@ UNIT_PASCAL = 9; UNIT_GIGABITS_PER_SECOND = 10; UNIT_BINARY = 11; + UNIT_MICROSECONDS = 12; } message SensorValue {
diff --git a/tlbmc/sensor_identifier.proto b/tlbmc/sensor_identifier.proto index 646f0bb..1a9fe3b 100644 --- a/tlbmc/sensor_identifier.proto +++ b/tlbmc/sensor_identifier.proto
@@ -35,6 +35,7 @@ SENSOR_UNIT_PRESENCE = 12; SENSOR_UNIT_COUNT = 13; SENSOR_UNIT_PASCAL = 14; + SENSOR_UNIT_MICROSECONDS = 15; } enum SensorSource {
diff --git a/tlbmc/store/store_hft_adapter.cc b/tlbmc/store/store_hft_adapter.cc index e019031..c67fa96 100644 --- a/tlbmc/store/store_hft_adapter.cc +++ b/tlbmc/store/store_hft_adapter.cc
@@ -287,6 +287,8 @@ return milotic_hft::SENSOR_UNIT_JOULES; case UNIT_PASCAL: return milotic_hft::SENSOR_UNIT_PASCAL; + case UNIT_MICROSECONDS: + return milotic_hft::SENSOR_UNIT_MICROSECONDS; default: return milotic_hft::SENSOR_UNIT_UNSPECIFIED; } @@ -312,6 +314,8 @@ return milotic_hft::SENSOR_TYPE_ENERGY; case UNIT_PASCAL: return milotic_hft::SENSOR_TYPE_ALTITUDE; + case UNIT_MICROSECONDS: + return milotic_hft::SENSOR_TYPE_TIME; default: return milotic_hft::SENSOR_TYPE_UNSPECIFIED; }