Skip to content

Adding thermal sensor controller changes#219

Open
jfreeda wants to merge 1 commit into
developfrom
feature/issue216_virtual_ThermalController
Open

Adding thermal sensor controller changes#219
jfreeda wants to merge 1 commit into
developfrom
feature/issue216_virtual_ThermalController

Conversation

@jfreeda

@jfreeda jfreeda commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 21, 2026 07:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ThermalSensorController factory + 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 (via powerControlClass).
  • 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants