Fail tlBMC store creation if TlbmcOwned sensor config is not supported

We need a sanity check here to make sure that a sensor marked as `TlbmcOwned` will create a valid sensor. This will prevent unsupported sensors from being marked as `TlbmcOwned` and help with debugging misconfiguration.

#tlbmc

PiperOrigin-RevId: 761708884
Change-Id: I80c0a4b0b258d39493d51c0e5060e264e93370b2
diff --git a/tlbmc/configs/entity_config_json_impl.cc b/tlbmc/configs/entity_config_json_impl.cc
index ce4ae46..c187523 100644
--- a/tlbmc/configs/entity_config_json_impl.cc
+++ b/tlbmc/configs/entity_config_json_impl.cc
@@ -472,9 +472,10 @@
     // Check if the probe is a true value.
     if (true_value) {
       if (probed_config_map.contains(name)) {
-        return absl::InvalidArgumentError(absl::StrCat(
-            "Invalid config: Multiple configs with TRUE probe have"
-            " the same name: ", name));
+        return absl::InvalidArgumentError(
+            absl::StrCat("Invalid config: Multiple configs with TRUE probe have"
+                         " the same name: ",
+                         name));
       }
       auto& probed_data = probed_config_map[name];
       probed_data.fru_keys.push_back(FruKey(name));
@@ -556,10 +557,10 @@
         // 3. Multiple configs cannot probe true with the same name
         if (probed_config_map.contains(name) &&
             !absl::StrContains(name, "$index")) {
-          return absl::InvalidArgumentError(absl::StrCat(
-              "Invalid config: Frus match the same config multiple"
-              " times but config name does not contain $index : ",
-              name));
+          return absl::InvalidArgumentError(
+              absl::StrCat("Invalid config: Frus match the same config multiple"
+                           " times but config name does not contain $index : ",
+                           name));
         }
         // If we reach here, the FRU matches the probe and is unique.
         auto& probed_data = probed_config_map[name];
@@ -750,6 +751,7 @@
   if (tlbmc_owned == nullptr || !*tlbmc_owned) {
     return absl::OkStatus();
   }
+  bool tlbmc_supported = false;
   const std::string* type = GetValueAsString(element, "Type");
   if (type == nullptr) {
     return absl::InvalidArgumentError(
@@ -758,6 +760,7 @@
   // HWMon temperature sensor.
   HwmonTempSensorType hwmon_temp_sensor_type = IsHwmonTempSensor(*type);
   if (hwmon_temp_sensor_type != HWMON_TEMP_SENSOR_TYPE0_UNKNOWN) {
+    tlbmc_supported = true;
     absl::StatusOr<HwmonTempSensorConfig> hwmon_temp_sensor_config =
         ParseHwmonTempSensorConfig(hwmon_temp_sensor_type, element);
     if (!hwmon_temp_sensor_config.ok()) {
@@ -781,6 +784,7 @@
   // PSU sensor.
   PsuSensorType psu_sensor_type = IsPsuSensor(*type);
   if (psu_sensor_type != PSU_SENSOR_TYPE0_UNKNOWN) {
+    tlbmc_supported = true;
     absl::StatusOr<PsuSensorConfig> psu_sensor_config =
         ParsePsuSensorConfig(psu_sensor_type, element);
     if (!psu_sensor_config.ok()) {
@@ -804,6 +808,7 @@
   // FAN controller
   FanControllerType fan_controller_type = IsFanController(*type);
   if (fan_controller_type != FAN_CONTROLLER_TYPE_UNKNOWN) {
+    tlbmc_supported = true;
     absl::StatusOr<FanControllerConfig> fan_controller_config =
         ParseFanControllerConfig(fan_controller_type, element);
     if (!fan_controller_config.ok()) {
@@ -814,6 +819,7 @@
 
   FanPwmType fan_pwm_type = IsFanPwm(*type);
   if (fan_pwm_type != PWM_SENSOR_TYPE_UNKNOWN) {
+    tlbmc_supported = true;
     absl::StatusOr<FanPwmConfig> fan_pwm_config =
         ParseFanPwmConfig(fan_pwm_type, element);
     if (!fan_pwm_config.ok()) {
@@ -826,6 +832,7 @@
 
   FanTachType fan_tach_type = IsFanTach(*type);
   if (fan_tach_type != TACH_SENSOR_TYPE_UNKNOWN) {
+    tlbmc_supported = true;
     absl::StatusOr<FanTachConfig> fan_tach_config =
         ParseFanTachConfig(fan_tach_type, element);
     if (!fan_tach_config.ok()) {
@@ -838,6 +845,7 @@
 
   SharedMemSensorType shared_mem_sensor_type = IsSharedMemSensor(*type);
   if (shared_mem_sensor_type != SHARED_MEM_SENSOR_TYPE_TYPE0_UNKNOWN) {
+    tlbmc_supported = true;
     absl::StatusOr<SharedMemSensorConfig> shared_mem_sensor_config =
         ParseSharedMemSensorConfig(shared_mem_sensor_type, element);
     if (!shared_mem_sensor_config.ok()) {
@@ -848,6 +856,13 @@
     data.shared_mem_sensor_configs.push_back(*shared_mem_sensor_config);
   }
 
+  if (!tlbmc_supported) {
+    return absl::InvalidArgumentError(absl::StrCat(
+        "Invalid config: Config is TlbmcOwned but does not match any supported "
+        "sensor type ",
+        *type));
+  }
+
   return absl::OkStatus();
 }
 
@@ -1119,8 +1134,8 @@
             .max_updates_to_mutable_data = ad_hoc_fru_count};
       }
 
-      absl::Status parse_asset_config_status = ParseAssetConfig(
-          config_data.config, fru);
+      absl::Status parse_asset_config_status =
+          ParseAssetConfig(config_data.config, fru);
       if (!parse_asset_config_status.ok()) {
         mutable_data.parsed_status = parse_asset_config_status;
         return EntityConfigJsonImplData{
@@ -1778,11 +1793,11 @@
     // configs. Stop the topology buildup with an error.
     if (!root_chassis_location_code.empty() &&
         topology_config_node.has_root_chassis_location_code()) {
-      return absl::InternalError(absl::StrFormat(
-          "Invalid config: Multiple root chassis location "
-          "codes found! Previous: %s. Current: %s",
-          root_chassis_location_code,
-          topology_config_node.root_chassis_location_code()));
+      return absl::InternalError(
+          absl::StrFormat("Invalid config: Multiple root chassis location "
+                          "codes found! Previous: %s. Current: %s",
+                          root_chassis_location_code,
+                          topology_config_node.root_chassis_location_code()));
     }
     if (topology_config_node.has_root_chassis_location_code()) {
       root_chassis_location_code =