Adding thermal sensor controller changes#219
Open
jfreeda wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new “thermal sensor controller” abstraction to RAFT, adding multiple backends (virtual vDevice control-plane, manual/hardware, programmable chamber, and smart-switch heater/blower control) plus documentation describing how to configure and use them.
Changes:
- Added
ThermalSensorControllerfactory + a common controller interface. - Added controller implementations: virtual (YAML over
/api/postKVP), manual/hardware (operator prompts), programmable chamber (command templates, optional SSH), and smart-switch heater control (viapowerControlClass). - Added docs describing supported YAML payloads and module usage/configuration.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| framework/core/thermalSensorController.py | Factory that selects a controller implementation based on config/type. |
| framework/core/thermalSensorControllerModules/ThermalSensorControllerInterface.py | Abstract interface defining the controller API surface. |
| framework/core/thermalSensorControllerModules/virtualThermalSensorController.py | Virtual controller that posts YAML payloads to the vcomponent control plane. |
| framework/core/thermalSensorControllerModules/actualThermalSensorController.py | Manual/hardware controller that prompts an operator to trigger conditions. |
| framework/core/thermalSensorControllerModules/programmableThermalChamber.py | Chamber controller that executes configured command templates (optionally over SSH). |
| framework/core/thermalSensorControllerModules/smartSwitchThermalController.py | Smart-switch-based heater/blower controller built on powerControlClass. |
| docs/modules/thermalSensorControllerModules/virtual_commands.md | Documentation for virtual controller YAML payloads. |
| docs/modules/thermal_sensor_controller_modules.md | High-level module overview and rack-config usage guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+14
to
+35
| import time | ||
|
|
||
| import yaml | ||
|
|
||
| from framework.core.thermalSensorControllerModules.ThermalSensorControllerInterface import ThermalSensorControllerInterface | ||
|
|
||
|
|
||
| class virtualThermalSensorController(ThermalSensorControllerInterface): | ||
| """ | ||
| Virtual ThermalSensor controller that sends YAML commands to the vcomponent | ||
| control-plane endpoint to simulate thermal events. | ||
| """ | ||
|
|
||
| def _sendCommand(self, payload: dict): | ||
| yaml_str = yaml.dump(payload) | ||
| yaml_str = yaml_str.replace('"', '\\"') | ||
| cmd = ( | ||
| f'curl -X POST -H "Content-Type: application/x-yaml" ' | ||
| f'--data-binary "{yaml_str}" ' | ||
| f'"http://localhost:{self.port}/api/postKVP"' | ||
| ) | ||
| self.session.write(cmd) |
| payload["IThermalSensor"]["sensorName"] = sensorName | ||
| payload["IThermalSensor"]["temperatureCelsius"] = temperatureCelsius | ||
|
|
||
| self._sendCommand(payload) |
| } | ||
| } | ||
|
|
||
| self._sendCommand(payload) |
Comment on lines
+16
to
+21
| from raft.framework.plugins.ut_raft.utUserResponse import utUserResponse | ||
|
|
||
| from framework.core.commandModules.sshConsole import sshConsole | ||
| from framework.core.logModule import logModule | ||
| from framework.core.thermalSensorControllerModules.ThermalSensorControllerInterface import ThermalSensorControllerInterface | ||
|
|
Comment on lines
+109
to
+112
| self.commandSession.write(command) | ||
| if self.stabilizationDelaySeconds > 0: | ||
| time.sleep(self.stabilizationDelaySeconds) | ||
| return True |
Comment on lines
+73
to
+78
| prompt = controllerSettings.get("prompt", prompt) | ||
| port = controllerSettings.get( | ||
| "control_port", | ||
| controllerSettings.get("port", port), | ||
| ) | ||
| return controllerType, controllerSettings, prompt, port |
|
|
||
| ### Purpose | ||
|
|
||
| This command injects a raw temperature reading. The vcomponent evaluates per-sensor thresholds and automatically emits thermal state transitions. This is the supported control-plane command for thermal event simulation. |
Comment on lines
+51
to
+55
| Thermal Sensor controller uses one YAML command payload: | ||
|
|
||
| - **Temperature Update (`temperature_update`)**: Threshold logic computes transitions automatically. | ||
|
|
||
| These definitions are used for thermal event simulation and validation in vDevice test flows. |
| control_port: 8081 | ||
| ``` | ||
|
|
||
| 2. **Initialization:** The helper class instantiates `ThermalSensorController` (factory in `thermalSensorController.py`), which resolves the correct implementation automatically. |
Comment on lines
+55
to
+59
| def __new__(cls, controllerConfig, session, prompt: str = "~#", port: int = 8080): | ||
| controllerType, controllerSettings, prompt, port = cls._normaliseControllerConfig( | ||
| controllerConfig, prompt, port) | ||
| if controllerType in cls.VIRTUAL_CONTROLLER_TYPES: | ||
| return virtualThermalSensorController(session, prompt, port) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.