Topics で読み物として読む
この HLD は実装詳細を含みます。機能の概念・設定・運用を読み物として読みたい場合は Topics 14 章: Platform / Port / Optics を参照。
裏取りステータス: code-verified
sonic-platform-common/sonic_platform_base/sonic_thermal_control/(thermal_action_base.py / thermal_condition_base.py / thermal_json_object.py / thermal_policy.py / thermal_manager_base.py)と sonic-platform-daemons/sonic-thermalctld/ を master で確認。テストプラン側の SONiC-mgmt サンプル JSON は本リポジトリ範囲外(mgmt キャッシュ未配備)。
Thermal Control テストプラン¶
概要¶
Thermal Control 機能(FAN status / thermal status / thermal policy)に対する functional テストプラン1。SONiC platform monitor (pmon) 配下で動く thermal control daemon を対象に、FAN/温度の表示と policy 一致時のアクション実行を検証する。テストは SONiC-mgmt の tests/platform/test_platform_info.py に追加される pytest として実装され、トポロジ非依存で全構成に適用可。
対象機能¶
| 機能 | 説明 |
|---|---|
| FAN status monitor | platform API を 60 秒周期で読み Redis に保存。show platform fanstatus で表示1 |
| Thermal status monitor | 60 秒周期。show platform temperature |
| Thermal policy management | JSON で記述した policy を pmon docker の daemon が読み、条件一致でアクション実行 |
テストケース¶
Show FAN Status Test¶
show platform fanstatus の出力フォーマットと presence/status 表示を検証1。
Show Thermal Status Test¶
show platform temperature 出力の整合性検証。
FAN Test¶
FAN 抜去 / FAN 復旧時の fanstatus 表示と policy のアクション動作。
PSU Absence Test¶
PSU 抜去で psu absence policy が発火し、全 FAN を 100% に上げ thermal control algorithm を停止 することを検証1。
Invalid Policy Format Load Test¶
JSON フォーマット異常(パース不能)な policy file をロードし、daemon がエラーで起動しないこと / 直前 policy で動作継続することを検証。
Invalid Policy Value Load Test¶
JSON 形式は正しいが意味的に誤った値(不明な condition / action type)を含む policy file をロードした場合の挙動検証。
サンプル valid policy¶
{
"thermal_control_algorithm": {
"run_at_boot_up": "false",
"fan_speed_when_suspend": "60"
},
"info_types": [
{"type": "fan_info"},
{"type": "psu_info"}
],
"policies": [
{
"name": "any PSU absence",
"conditions": [{"type": "fan.any.absence"}],
"actions": [
{"type": "thermal_control.control", "status": "false"},
{"type": "fan.all.set_speed", "speed": "100"}
]
}
]
}
(HLD には "any PSU absence" / "any FAN absence" / "all FAN and PSU presence" の 3 policy 例が示される1)
Policy DSL¶
| Field | 内容 |
|---|---|
thermal_control_algorithm.run_at_boot_up |
起動直後に algorithm を起動するか |
thermal_control_algorithm.fan_speed_when_suspend |
suspend 状態のデフォルト fan speed (%) |
info_types[] |
監視対象(fan_info / psu_info など) |
policies[].conditions[].type |
例: fan.any.absence, psu.any.absence |
policies[].actions[].type |
例: fan.all.set_speed (speed 引数), thermal_control.control (status) |
期待動作¶
flowchart LR
POL[valid_policy.json] --> TCD[thermal_control_daemon]
S1[PSU absent or FAN absent] --> COND[match conditions]
COND --> A1[thermal_control.control = false]
COND --> A2[fan.all.set_speed = 100]
S2[all present] --> COND2[match conditions]
COND2 --> A3[thermal_control.control = true]
📋 検証エビデンス: sonic-net/SONiC/doc/pmon/sonic_thermal_control_test_plan.md#L43-L75 (sha: 49bab5b5ff0e924f1ea52b3d9db0dfa4191a7c06)
出典:
sonic-net/SONiC/doc/pmon/sonic_thermal_control_test_plan.md#L43-L75 (sha: 49bab5b5ff0e924f1ea52b3d9db0dfa4191a7c06)
抜粋:
In the case of "any PSU absence", the expected behavior based on the design and implementation
is that FAN speed is set to 100% and thermal control algorithm is disabled.
判断根拠: PSU absent → FAN 100% / algorithm disable の根拠。
実装基盤¶
- SONiC-mgmt
tests/platformを流用 - 対象 file:
test_platform_info.py - 追加 file:
valid_policy.json,invalid_format_policy.json,invalid_value_policy.json
制限事項¶
- daemon の policy 動的 reload に関する仕様は test plan 内では明確でない(design.md 側を参照)
- 60 秒周期に依存するため、テストでは timeout 余裕 を取る必要がある
- 本 plan は機能テストでありストレス・電圧変動などの長時間試験は対象外
干渉する機能¶
- psud / pmon-enhancement: PSU 監視部分の依存
- thermal-control-design (リンク先): 上位設計
- xcvrd / sfp-refactor: optic 由来の温度はこの policy には含まれない
- show platform CLI:
fanstatus/temperature出力フォーマット契約
確認コマンド¶
show platform fanstatus/show platform temperature— fan speed と各温度センサの状況sonic-db-cli STATE_DB keys "FAN_INFO|*"/"TEMPERATURE_INFO|*"— daemon の publish 結果を直接確認docker exec pmon supervisorctl status thermalctld— thermal control daemon の状態docker logs pmon 2>&1 | grep -i thermal— policy reload / algorithm 切替のログを追う
コマンド例¶
冷却 / thermal センサーの状態を確認する。
# Thermal / cooling
show platform temperature
show platform fan
redis-cli -n 6 keys 'TEMPERATURE_INFO|*'
redis-cli -n 6 keys 'FAN_INFO|*'