summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0011-bmcweb-Add-PhysicalContext-to-Thermal-resources.patch
blob: f41e6f9942691f6749660ba02de51cf953bd61ef (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
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
},
{
     @odata.id": "/redfish/v1/Chassis/F2U8X25_HSBP_2/Thermal#/Temperatures/0",
     @odata.type": "#Thermal.v1_3_0.Temperature",
     LowerThresholdCritical": 7.0,
     LowerThresholdNonCritical": 12.0,
     MaxReadingRangeTemp": 127.0,
     MemberId": "HSBP2_Temp",
     MinReadingRangeTemp": -128.0,
     Name": "HSBP2 Temp",
     PhysicalContext": "Backplane",
     ReadingCelsius": 21.437,
     Status": {
        "Health": "OK",
        "State": "Enabled"
     },
     UpperThresholdCritical": 57.0,
     UpperThresholdNonCritical": 52.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>
Signed-off-by: sunitakx <sunitax.kumari@linux.intel.com>
---
 redfish-core/lib/sensors.hpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 5d27577..d51d09f 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -973,6 +973,22 @@ 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 if (sensorName.find("HSBP") != std::string::npos)
+        {
+            sensorJson["PhysicalContext"] = "Backplane";
+        }
+        else
+        {
+            sensorJson["PhysicalContext"] = "SystemBoard";
+        }
         // TODO(ed) Documentation says that path should be type fan_tach,
         // implementation seems to implement fan
     }
-- 
2.17.1