Add support for non HMC sensors for tlbmc

This change has the following changes:
* Add support for sensors for all non HMC
* Add RelatedItem property for VirtualSensor for tlBMC

#tlbmc
#tlbmc-redfish-aggregation

Tested=unit test
PiperOrigin-RevId: 826208948
Change-Id: If4f80f48b07e94ce2480725c339f6664e5bc4f83
diff --git a/tlbmc/configs/entity_config_json_impl.cc b/tlbmc/configs/entity_config_json_impl.cc
index d8e05d3..d507c27 100644
--- a/tlbmc/configs/entity_config_json_impl.cc
+++ b/tlbmc/configs/entity_config_json_impl.cc
@@ -1044,6 +1044,30 @@
       SetDefaultRelatedItem(*config.mutable_entity_common_config());
     }
   }
+
+  for (auto& config : data.virtual_sensor_configs) {
+    auto node_it = topology_config.topology_config_nodes().find(
+        config.entity_common_config().board_config_key());
+
+    if (node_it != topology_config.topology_config_nodes().end()) {
+      auto fru_it =
+          fru_table.key_to_fru().find(node_it->second.fru_info().fru_key());
+
+      /// Propagate sensor config to parent board if the sensor is associated
+      // with an assembly.
+      if (fru_it != fru_table.key_to_fru().end() &&
+          fru_it->second.attributes().resource_type() ==
+              RESOURCE_TYPE_ASSEMBLY) {
+        *config.mutable_entity_common_config()->mutable_board_config_key() =
+            node_it->second.parent_resource_id();
+      }
+    }
+
+    // Always set default related item if not specified
+    if (!config.entity_common_config().has_related_item()) {
+      SetDefaultRelatedItem(*config.mutable_entity_common_config());
+    }
+  }
 }
 
 HwmonTempSensorType EntityConfigJsonImpl::IsHwmonTempSensor(