summaryrefslogtreecommitdiff
path: root/redfish-core/lib/thermal_subsystem.hpp
AgeCommit message (Collapse)AuthorFilesLines
2024-08-02Consistently use generated enumerationsEd Tanous1-2/+3
This commit causes all of Redfish to use generated enum values for enum types. Using generated code prevents problems, and makes it more clear what types are allowed. Doing this found two places where we had structs that didn't fulfill the schema. They have been commented, but will be fixed with a breaking change at some point in the future. Tested: WIP Change-Id: I5fdd2f2dfb6ec05606a522e1f4e331f982c8e476 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-01-23Implements ThermalMetrics schemazhanghch051-0/+5
The ThermalMetrics schema is a resource in Redfish version 2022.2[1]. It contains an array of temperature readings. It is a child of ThermalSubsystem schema[2] and it represents the thermal metrics of a chassis. Reading the current value of each temperature sensor and the corresponding link enumeration will be implemented in the next patch. This commit implements the Get and Head methods of the Redfish ThermalMetrics schema and implemented the basic information of Get. [1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0268_2022.2.pdf [2] https://redfish.dmtf.org/schemas/v1/ThermalMetrics.v1_0_1.json Test: 1. Validator passed. 2. doGet method: """ curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics", "@odata.type": "#ThermalMetrics.v1_0_1.ThermalMetrics", "Id": "ThermalMetrics", "Name": "Thermal Metrics", } """ 3. A bad chassis ID: """ curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassisBAD/ThermalSubsystem/ThermalMetrics { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Chassis named 'chassisBAD' was not found.", "MessageArgs": [ "Chassis", "chassisBAD" ], "MessageId": "Base.1.13.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.13.0.ResourceNotFound", "message": "The requested resource of type Chassis named 'chassisBAD' was not found." } } """ Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: Ib4182e7dc6e204371636a33a391e8e2a58dad113
2023-07-20Replace logging with std::formatEd Tanous1-1/+1
std::format is a much more modern logging solution, and gives us a lot more flexibility, and better compile times when doing logging. Unfortunately, given its level of compile time checks, it needs to be a method, instead of the stream style logging we had before. This requires a pretty substantial change. Fortunately, this change can be largely automated, via the script included in this commit under scripts/replace_logs.py. This is to aid people in moving their patchsets over to the new form in the short period where old patches will be based on the old logging. The intention is that this script eventually goes away. The old style logging (stream based) looked like. BMCWEB_LOG_DEBUG << "Foo " << foo; The new equivalent of the above would be: BMCWEB_LOG_DEBUG("Foo {}", foo); In the course of doing this, this also cleans up several ignored linter errors, including macro usage, and array to pointer deconstruction. Note, This patchset does remove the timestamp from the log message. In practice, this was duplicated between journald and bmcweb, and there's no need for both to exist. One design decision of note is the addition of logPtr. Because the compiler can't disambiguate between const char* and const MyThing*, it's necessary to add an explicit cast to void*. This is identical to how fmt handled it. Tested: compiled with logging meson_option enabled, and launched bmcweb Saw the usual logging, similar to what was present before: ``` [Error include/webassets.hpp:60] Unable to find or open /usr/share/www/ static file hosting disabled [Debug include/persistent_data.hpp:133] Restored Session Timeout: 1800 [Debug redfish-core/include/event_service_manager.hpp:671] Old eventService config not exist [Info src/webserver_main.cpp:59] Starting webserver on port 18080 [Error redfish-core/include/event_service_manager.hpp:1301] inotify_add_watch failed for redfish log file. [Info src/webserver_main.cpp:137] Start Hostname Monitor Service... ``` Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I86a46aa2454be7fe80df608cb7e5573ca4029ec8
2023-07-13Implements FanCollection schemaGeorge Liu1-0/+3
The FanCollection schema is a resource in Redifsh version 2022.2 [1] that represents the management properties for the monitoring and management of cooling fans implemented by Redfish [2]. This commit retrieves the fan collection by obtaining the endpoints of the `cooled_by` association. The `cooled_by` association represents the relationship between a chassis and the fans responsible for providing cooling to the chassis. ref: [1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0268_2022.2.pdf [2] http://redfish.dmtf.org/schemas/v1/Fan.v1_3_0.json Redfish validator is currently failing. In order for the validator to pass, it is necessary to merge this commit with https://gerrit.openbmc.org/c/openbmc/bmcweb/+/57559 Tested: 1. doGet method to get FanCollection ``` curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans", "@odata.type": "#FanCollection.FanCollection", "Description": "The collection of Fan resource instances chassis", "Members": [ { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan5" }, { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan4" }, { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan3" }, { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan2" }, { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan1" }, { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0" } ], "Members@odata.count": 6, "Name": "Fan Collection" } 2. Input the wrong chassisId with the doGet method curl -k https://${bmc}/redfish/v1/Chassis/chassis11/ThermalSubsystem/Fans { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Chassis named 'chassis11' was not found.", "MessageArgs": [ "Chassis", "chassis11" ], "MessageId": "Base.1.13.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.13.0.ResourceNotFound", "message": "The requested resource of type Chassis named 'chassis11' was not found." } } ``` Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: If5e9ff5655f444694c7ca1aea95d45e2c9222625 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-05-16Boost::urls::formatEd Tanous1-2/+4
Boost 1.82 dropped a lovely new toy, boost::urls::format, which is a lot like our urlFromPieces method, but better in that it makes the resulting uris more readable, and allows doing things like fragments in a single line instead of multiple. We should prefer it in some cases. Tested: Redfish service validator passes. Spot checks of URLs work as expected. Unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia7b38f0a95771c862507e7d5b4aa68aa1c98403c
2023-03-09Move logging level to WARNING for 404Gunnar Mills1-1/+1
These are 4xx errors, 404 not found. Move the logging to WARNING so they don't log unless WARNING level is enabled. This follows the guidance in the commit below. Tested: None. Change-Id: I38b2bec64507d75286f79d61acf7a96226598e0b Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2022-11-23Add Link header handling to ThermalSubsystemGeorge Liu1-2/+35
Along with adding Link header, this commit updates ThermalSubsystem to respond to HEAD requests. The link header is something required by the Redfish spec. Also, Removed redundant code[1] [1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/58731/2/redfish-core/lib/thermal_subsystem.hpp#b48 Tested: HEAD /redfish/v1/Chassis/<str>/ThermalSubsystem returns a correct looking Link header. Following that Link header resolves the schema file. Get /redfish/v1/Chassis/BadChassis/ThermalSubsystem returns 404. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ib93573808e4370ac45c2051517cd3f1c28e0f8bb
2022-11-11thermal subsystem: iwyuNan Zhou1-0/+4
Tested: unit tests; just added a few used headers Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I3299f0445aedadd1411f4d3a407e9543197e22e1
2022-08-01Add Redfish ThermalSubsystem schema in bmcwebXiaochao Ma1-0/+59
The ThermalSubsystem is a new resource in Redfish version 2020.4. It is a root for fans and temperatures. Fans are a new schema. Temperature sensors will be part of the new ThermalMetrics schema. ThermalSubsystem can co-exist with the current Thermal resource. You can also control compilation through flags. ThermalSubsystem is an improvement on the existing Thermal schema because 1. It includes the latest properties like LocationIndicatorActive 2. Fans and Temperatures were arrays in the old Thermal schema and this was cumbersome and could hit limits of JSON arrays 3. Large amount of static data mixed with sensor readings, which hurt performance 4. Inconsistent definitions of properties vs like Processor and Memory schemas In a future commits Fans and ThermalMetrics will be added soon. Reference: https://www.dmtf.org/sites/default/files/standards/documents/DSP0268_2020.4.pdf https://redfish.dmtf.org/schemas/v1/ThermalSubsystem.v1_0_0.json Test: 1. Validator passed. 2. doGet method: ~$ curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem", "@odata.type": "#ThermalSubsystem.v1_0_0.ThermalSubsystem", "Id": "chassis", "Name": "Thermal Subsystem for Chassis", "Status": { "Health": "OK", "State": "Enabled" } } 3. A bad chassis ID: ~$ curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassisSSBAD/ThermalSubsystem { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Chassis named chassisSSBAD was not found.", "MessageArgs": [ "Chassis", "chassisSSBAD" ], "MessageId": "Base.1.8.1.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.8.1.ResourceNotFound", "message": "The requested resource of type Chassis named chassisSSBAD was not found." } } Signed-off-by: Xiaochao Ma <maxiaochao@inspur.com> Change-Id: Ib19879f584304e5303f1a83d88bdd18c78a61633 Signed-off-by: Zhenwei Chen <zhenweichen0207@gmail.com>