summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0011-bmcweb-Add-PhysicalContext-to-Thermal-resources.patch
blob: e52dff3f4062425cd4ea1e4e4e1033b6a6a6c253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
From b9747ecfce682f15dce0bb6e41e0c894f29419f3 Mon Sep 17 00:00:00 2001
From: Snehalatha Venkatesh <snehalathax.v@intel.com>
Date: Thu, 8 Apr 2021 14:42:07 +0000
Subject: [PATCH] bmcweb: Add PhysicalContext to Thermal resources

Adding PhysicalContext to make redfish data compliance with OCP
Server Mgmt Interface v0.2.1.pdf and specific to Thermal resources.
https://github.com/opencomputeproject/OCP-Profiles/blob/master/
OCPServerHardwareManagement.v0_2_4.json

Tested:
1. Redfish validator - passed for this new change
2. GET - https://<bmc.ip>/redfish/v1/Chassis/<Board>/Thermal
Response:
{
    "@odata.id": "/redfish/v1/Chassis/<Board>/Thermal#/Temperatures/0",
    "@odata.type": "#Thermal.v1_3_0.Temperature",
    "LowerThresholdCritical": 0.0,
    "LowerThresholdNonCritical": 5.0,
    "MaxReadingRangeTemp": 127.0,
    "MemberId": "BMC_Temp",
    "MinReadingRangeTemp": -128.0,
    "Name": "BMC Temp",
    "PhysicalContext": "SystemBoard",
    "ReadingCelsius": 25.75,
    "Status": {
        "Health": "OK",
        "State": "Enabled"
    },
    "UpperThresholdCritical": 115.0,
    "UpperThresholdNonCritical": 110.0
},
{
    "@odata.id": "/redfish/v1/Chassis/<Board>/Thermal#/Temperatures/1",
    "@odata.type": "#Thermal.v1_3_0.Temperature",
    "LowerThresholdCritical": 0.0,
    "LowerThresholdNonCritical": 5.0,
    "MaxReadingRangeTemp": 255.0,
    "MemberId": "CPU1_P12V_PVCCIN_VR_Temp",
    "MinReadingRangeTemp": 0.0,
    "Name": "CPU1 P12V PVCCIN VR Temp",
    "PhysicalContext": "CPU",
    "ReadingCelsius": 41.0,
    "Status": {
        "Health": "OK",
        "State": "Enabled"
    },
    "UpperThresholdCritical": 115.0,
    "UpperThresholdNonCritical": 110.0
},
{
    "@odata.id": "/redfish/v1/Chassis/<Board>/Thermal#/Temperatures/28",
    "@odata.type": "#Thermal.v1_3_0.Temperature",
    "LowerThresholdCritical": 0.0,
    "LowerThresholdNonCritical": 5.0,
    "MaxReadingRangeTemp": 127.0,
    "MemberId": "Inlet_BRD_Temp",
    "MinReadingRangeTemp": -128.0,
    "Name": "Inlet BRD Temp",
    "PhysicalContext": "Intake",
    "ReadingCelsius": 23.187,
    "Status": {
        "Health": "OK",
        "State": "Enabled"
    },
    "UpperThresholdCritical": 115.0,
    "UpperThresholdNonCritical": 110.0
}
3. GET - https://<bmc.ip>/redfish/v1/Chassis/<Board>/Power
Response:
{
    "@odata.id": "/redfish/v1/Chassis/<Board>/Power#/Voltages/3",
    "@odata.type": "#Power.v1_0_0.Voltage",
    "LowerThresholdCritical": 1.648,
    "LowerThresholdNonCritical": 1.699,
    "MaxReadingRange": 2.3984009912875566,
    "MemberId": "P1V8_PCH",
    "MinReadingRange": 0.0,
    "Name": "P1V8 PCH",
    "ReadingVolts": 1.8055,
    "Status": {
        "Health": "OK",
        "State": "Enabled"
    },
    "UpperThresholdCritical": 1.961,
    "UpperThresholdNonCritical": 1.904
}
4. GET - https://<bmc.ip>/redfish/v1/Chassis/<Board>/Sensors/PSU1_Input_Current
Response:
{
    "@odata.id": "/redfish/v1/Chassis/<Board>/Sensors/PSU1_Input_Current",
    "@odata.type": "#Sensor.v1_0_0.Sensor",
    "Id": "PSU1_Input_Current",
    "Name": "PSU1 Input Current",
    "Reading": 0.947,
    "ReadingRangeMax": 12.0,
    "ReadingRangeMin": 0.0,
    "ReadingType": "Current",
    "ReadingUnits": "A",
    "Status": {
        "Health": "OK",
        "State": "Enabled"
    }
}
Signed-off-by: Snehalatha Venkatesh <snehalathax.v@intel.com>
---
 redfish-core/lib/sensors.hpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 9f06d2f..40fcdf8 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -964,6 +964,18 @@ inline void objectInterfacesToJson(
     {
         unit = "/ReadingCelsius"_json_pointer;
         sensorJson["@odata.type"] = "#Thermal.v1_3_0.Temperature";
+        if (sensorName.find("CPU") != std::string::npos)
+        {
+            sensorJson["PhysicalContext"] = "CPU";
+        }
+        else if (sensorName.find("Inlet") != std::string::npos)
+        {
+            sensorJson["PhysicalContext"] = "Intake";
+        }
+        else
+        {
+            sensorJson["PhysicalContext"] = "SystemBoard";
+        }
         // TODO(ed) Documentation says that path should be type fan_tach,
         // implementation seems to implement fan
     }
-- 
2.17.1