summaryrefslogtreecommitdiff
path: root/redfish-core/lib/thermal.hpp
AgeCommit message (Collapse)AuthorFilesLines
2022-04-27Simplify sensor path lookupsEd Tanous1-18/+2
This commit drops 8k from the binary size. Tested: SensorCollection returns sensor values as expected, same as previously Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ife1dc40ff6745585ac6bc3f99cd5e6c4811baa56
2022-04-06Add setUpRedfishRoute to all nodes in redfishEd Tanous1-6/+17
For better or worse, the series ahead of this is making use of setUpRedfishRoute to do the common "redfish specified" things that need to be done for a connection, like header checking, filtering, and other things. In the current model, where BMCWEB_ROUTE is a common function for all HTTP routes, this means we need to propagate this injection call into the whole tree ahead of the requests being handled. In a perfect world, we would invent something like a REDFISH_ROUTE macro, but because macros are discouraged, the routes take a variadic template of parameters, and each call to the route has a .privileges() call in the middle, there's no good way to effect this change in a less costly manner. This was messaged both in the prior reviews, and on discord sourcing improvements on this pattern, to which none arose. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Id29cc799e214edad41e48fc7ce6eed0521f90ecb
2022-02-25json_utils: Add support jsonRead Patch/ActionWilly Tu1-3/+3
Added support for readJson for Patch and Action. The only difference is that Patch does not allow empty json input while Action does. Action with empty input will use the default value based on the implementation and return 200 OK response code. readJsonPatch will replace the existing readJson and be used for path requests. It will not allow empty json input and all requested keys are required in the json input. readJsonAction will be used for Action requests where it is possible for all of the properties to be optional and allow empty request. The optional properties are determined by the requested values type. All current Action readJson are replaced with readJsonAction. It does not change the existing behavior since it needs `std::optional`. This will have to be updated later as we define the default behavior. Tested: Added unit tests and readJsonAction allows empty empty json object. No Change to Redfish Tree. Change-Id: Ia5e1f81695c528a20f1dc985aee19c920d8adaea Signed-off-by: Willy Tu <wltu@google.com>
2021-07-08Automate PrivilegeRegistry to codeEd Tanous1-2/+3
This commit attempts to automate the creation of our privileges structures from the redfish privilege registry. It accomplishes this by updating parse_registries.py to also pull down the privilege registry from DMTF. The script then generates privilege_registry.hpp, which include const defines for all the privilege registry entries in the same format that the Privileges struct accepts. This allows new clients to simply reference the variable to these privilege structures, instead of having to manually (ie error pronely) put the privileges in themselves. This commit updates all the routes. For the moment, override and OEM schemas are not considered. Today we don't have any OEM-specific Redfish routes, so the existing ones inherit their parents schema. Overrides have other issues, and are already incorrect as Redfish defines them. Binary size remains unchanged after this patchset. Tested: Ran redfish service validator Ran test case from f9a6708c4c6490257e2eb6a8c04458f500902476 to ensure that the new privileges constructor didn't cause us to regress the brace construction initializer. Checked binary size with: gzip -c $BBPATH/tmp/work/s7106-openbmc-linux-gnueabi/obmc-phosphor-image/1.0-r0/rootfs/usr/bin/bmcweb | wc -c 1244048 (tested on previous patchset) Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ideede3d5b39d50bffe7fe78a0848bdbc22ac387f
2021-06-16Remove ambiguous privileges constructorEd Tanous1-2/+2
There are a number of endpoints that assume that a given routes privileges are governed by a single set of privileges, instead of multiple sets ORed together. To handle this, there were two overloads of the privileges() method, one that took a vector of Privileges, and one that took an initializer_list of const char*. Unfortunately, this leads some code in AccountService to pick the wrong overload when it's called like this .privileges( {{"ConfigureUsers"}, {"ConfigureManager"}, {"ConfigureSelf"}}) This is supposed to be "User must have ConfigureUsers, or ConfigureManager, or ConfigureSelf". Currently, because it selects the wrong overload, it computes to "User must have ConfigureUsers AND ConfigureManager AND ConfigureSelf. The double braces are supposed to cause this to form a vector of Privileges, but it appears that the initializer list gets consumed, and the single invocation of initializer list is called. Interestingly, trying to put in a privileges overload of intializer_list<initializer_list<const char*>> causes the compilation to fail with an ambiguous call error, which is what I would've expected to see previously in this case, but alas, I'm only a novice when it comes to how the C++ standard works in these edge cases. This is likely due in part to the fact that they were templates of an unused template param (seemingly copied from the previous method) and SFINAE rules around templates. This commit functionally removes one of the privileges overloads, and adds a second set of braces to every privileges call that previously had a single set of braces. Previous code will not compile now, which is IMO a good thing. This likely popped up in the Node class removal, because the Node class explicitly constructs a vector of Privilege objects, ensuing it can hit the right overload Tested: Ran Redfish service validator Tested the specific use case outlined on discord with: Creating a new user with operator privilege: ``` redfishtool -S Always -u root -p 0penBmc -vvvvvvvvv -r 192.168.7.2 AccountService adduser foo mysuperPass1 Operator ``` Then attempting to list accounts: ``` curl -vvvv --insecure --user foo:mysuperPass1 https://192.168.7.2/redfish/v1/AccountService/Accounts/foo ``` Which succeeded and returned the account in question. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I83e62b70e97f56dc57d43b9081f333a02fe85495
2021-06-04Remove checkAndDoSensorsOverride functionBruce Lee1-1/+1
Remove checkAndDoSensorsOverride function, this will be handled via dbus-sensor when the user set-value from external. This is unlikely to break any users because the Intel special mode function is no change, only move to dbus-sensor to handle, "busctl" command also belongs to the external setting, so move to dbus-sensor is more suitable, this will including users to set value use busctl command and Redfish from external. Dbus-sensor needs to be merged at the same time. Dbus-sensor changes are pushed to Gerrit: https://gerrit.openbmc-project.xyz/c/openbmc/dbus-sensors/+/42453 The mailing list discussion links: https://lists.ozlabs.org/pipermail/openbmc/2021-March/025597.html Signed-off-by: Bruce Lee <Bruce_Lee@quantatw.com> Change-Id: I74356f2b65e41cc0e9d8947c160f313334b78331
2021-06-03Remove Redfish Node classJohn Edward Broadbent1-89/+68
Reduces the total number of lines and will allow for easier testing of the redfish responses. A main purpose of the node class was to set app.routeDynamic(). However now app.routeDynamic can handle the complexity that was once in critical to node. The macro app.routeDynamic() provides a shorter cleaner interface to the unerlying app.routeDyanic call. The old pattern set permissions for 6 interfaces (get, head, patch, put, delete_, and post) even if only one interface is created. That pattern creates unneeded code that can be safely removed with no effect. Unit test for the responses would have to mock the node the class in order to fully test responses. see https://github.com/openbmc/bmcweb/issues/181 The following files still need node to be extracted. virtual_media.hpp account_service.hpp redfish_sessions.hpp ethernet.hpp The files above use a pattern that is not trivial to address. Often their responses call an async lambda capturing the inherited class. ie (https://github.com/openbmc/bmcweb/blob/ffed87b5ad1797ca966d030e7f979770 28d258fa/redfish-core/lib/account_service.hpp#L1393) At a later point I plan to remove node from the files above. Tested: I ran the docker unit test with the following command. WORKSPACE=$(pwd) UNIT_TEST_PKG=bmcweb ./openbmc-build-scripts/run-unit-test-docker.sh I ran the validator and this change did not create any issues. python3 RedfishServiceValidator.py -c config.ini Signed-off-by: John Edward Broadbent <jebr@google.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I147a0289c52cb4198345b1ad9bfe6fdddf57f3df
2021-05-07Replaced std::map::at with std::map::findKrzysztof Grobelny1-4/+17
Replaced std::map::at with std::map::find in lib/thermal.hpp, this doesn't uses exceptions and return value is properly checked before using it. Tested: - GET redfish/v1/Chassis/chassis/Thermal displays same content as before Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I9123a5081cb76dcbe3620a59b46408a6b8c9cda2
2021-04-08Using AsyncResp everywherezhanghch051-14/+18
Get the core using AsyncResp everywhere, and not have each individual handler creating its own object.We can call app.handle() without fear of the response getting ended after the first tree is done populating. Don't use res.end() anymore. Tested: 1. Validator passed. Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: I867367ce4a0caf8c4b3f4e07e06c11feed0782e8
2021-03-29Sync ReadingUnit with Redfish Sensor SchemaWludzik, Jozef1-2/+2
Actual attribute "ReadingUnits" does not match with Redfish Sensor Schema. This change match "ReadingUnits" with Redfish Sensor Scheme 1.0.0 and add missing "ReadingType" attribute. This change affect all users that depends on old units that does not match with Redfish standard. Added toReadingType and toReadingUnit function that uses values taken from Redfish Sensor Scheme 1.0.0. Latest version 1.2.0 of Sensor scheme defines same units. Changed value stored in ReadingUnits for Sensor resource: - "Watts" -> "W" - "Amperes" -> "A" - "Percent" -> "%" Tested: - RedfishServiceValidator pass - Verified that Sensors contain proper ReadingUnits - Webui-Vue displays ReadingUnits properly in Health tab Change-Id: I0c8820eba7271022c427cd25dec321db36aa0176 Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
2020-08-17Enable unused variable warnings and resolveEd Tanous1-1/+1
This commit enables the "unused variables" warning in clang. Throughout this, it did point out several issues that would've been functional bugs, so I think it was worthwhile. It also cleaned up several unused variable from old constructs that no longer exist. Tested: Built with clang. Code no longer emits warnings. Downloaded bmcweb to system and pulled up the webui, observed webui loads and logs in properly. Change-Id: I51505f4222cc147d6f2b87b14d7e2ac4a74cafa8 Signed-off-by: Ed Tanous <ed@tanous.net>
2020-08-17Remove middlewaresEd Tanous1-1/+1
Middlewares, while kinda cool from an academic standpoint, make our build times even worse than they already are. Given that we only really use 1 real middleware today (token auth) and it needs to move into the parser mode anyway (for security limiting buffer sizes), we might as well use this as an opportunity to delete some code. Some other things that happen: 1. Persistent data now moves out of the crow namespace 2. App is no longer a template 3. All request_routes implementations no longer become templates. This should be a decent (unmeasured) win on compile times. This commit was part of a commit previously called "various cleanups". This separates ONLY the middleware deletion part of that. Note, this also deletes about 400 lines of hard to understand code. Change-Id: I4c19e25491a153a2aa2e4ef46fc797bcb5b3581a Signed-off-by: Ed Tanous <ed@tanous.net>
2020-06-26Enable retrieving mapping of Redfish URI to D-Bus sensor pathAdrian Ambrożewicz1-6/+4
Background: Change is necessary to support TelemetryService implementation. TelemetryService specifies its own resource type for data - MetricDefinition. In principle - MetricDefinition might point to Redfish Sensor in the system. Each MetricDefinition requires MetricProperty - URI to specific property in resource wih the value. This change allows retrieving such data alongside corresponding D-Bus sensor to be used as source of Metrics value. This change: Function was implemented to allow retrieving mapping of Redfish URI paths to D-Bus sensors in the system. Some minor refactoring in regards to SensorsAsyncResponse were also introduced to enhance code locality. Idea for the changes was to be the least intrusive if possible, as retrieving sensors in the system requires lots of processing. Existing logic was used and left intact. Utilizing existing logic required to 'fake' a HTTP request to traverse the sensors in the system and build the response. It's crucial to use exact logic of building Redfish nodes representation, as goal of the function is to retrieve exact Redfish URI for sensor value. Extra parameter was introduced to SensorsAsyncResp - callback to be called when sensor data will be fully determined. After processing is complete caller is notified with the outcome (success or failure) and map<URI:D-Bus sensor>. Testing: - all positive cases (3 chassis, 3 subnodes) in the system, one of obtained mappings looked like the following: { /redfish/v1/Chassis/WP_Baseboard/Power#/Voltages/3/ReadingVolts : /xyz/openbmc_project/sensors/voltage/P1V8_PCH } - negative cases (wrong chassis, wrong subnode) - callback with error status was called - RedfishServiceValidator passed Signed-off-by: Adrian Ambrożewicz <adrian.ambrozewicz@linux.intel.com> Change-Id: I4389eb3df275126974168d1bb9af33dbf5cdb5b7
2020-03-29Sensor override allow only by Admin priv userjayaprakash Mutyala1-1/+1
Issue: As per https://redfish.dmtf.org/registries/ Redfish_1.0.4_PrivilegeRegistry.json patch method for Thermal & Power must be allowed for ConfigureManager only Fix: So restrict only Admin privilege user can override sensor values from Redfish. Tested: 1. Redfish validator - passed for this new change 2. Patch sensor values from Redfish for Thermal using Admin privilege user Redfish URI: PATCH https://<BMC-IP>/redfish/v1/Chassis/WC_Baseboard/Thermal Body: { "Temperatures": [ { "MemberId": "SSB_Temp", "ReadingCelsius":112 } ] } Response: { "@odata.id": "/redfish/v1/Chassis/WC_Baseboard/Thermal", "@odata.type": "#Thermal.v1_4_0.Thermal", "Fans": [], "Id": "Thermal", "Name": "Thermal", "Temperatures": [] } 3. Sensor value Overridden successfully when Authorized by admin privilege user 4. Verified by operator privilege user. Not successful. Response : Forbidden. 5. Verified for Power sensor values and allowed only by admin privilege user. 6. Verified for manufacturing mode, Validation unsecure mode and non-manufacturing mode. Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Change-Id: I9a089a9341d12beac9625f1877e1ab047f5d6f46
2020-03-09Remove unused variables for setSensorsOverridejayaprakash Mutyala1-2/+1
Remove unused variables for setSensorsOverride and checkAndDoSensorsOverride methods Tested: 1. Redfish validator - passed for this new change Case 1: 1. Enable manufacturing mode by pressing power button while bmc booting 2. Patch sensor values from Redfish. Redfish URI: PATCH https://<BMC-IP>/redfish/v1/Chassis/WC_Baseboard/Thermal Body: { "Temperatures": [ { "MemberId": "SSB_Temp", "ReadingCelsius":112 } ] } Response: { "@odata.id": "/redfish/v1/Chassis/WC_Baseboard/Thermal", "@odata.type": "#Thermal.v1_4_0.Thermal", "Fans": [], "Id": "Thermal", "Name": "Thermal", "Temperatures": [] } 3. Sensor value Overridden successfully Case 2: Varified for ValidationUnsecure mode. Case 3: Tested without SpecialMode mode 1. Stop the specialmodemgr.service service 2. Patch sensor values from Redfish. 3. Sensor value Overridden successfully Case 4: 1. Disable manufacturing mode Command: ipmitool raw 0x30 0xB4 3 0 Response: //Success 2. Patch sensor values from Redfish. Redfish URI: PATCH https://<BMC-IP>/redfish/v1/Chassis/WC_Baseboard/Thermal Body: { "Temperatures": [ { "MemberId": "SSB_Temp", "ReadingCelsius":112 } ] } 3. Returning proper error. Response : { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The action Overriding of Sensor Value for non manufacturing mode is not supported by the resource.", "MessageArgs": [ "Overriding of Sensor Value for non manufacturing mode" ], "MessageId": "Base.1.4.0.ActionNotSupported", "Resolution": "The action supplied cannot be resubmitted to the implementation. Perhaps the action was invalid, the wrong resource was the target or the implementation documentation may be of assistance.", "Severity": "Critical" } ], "code": "Base.1.4.0.ActionNotSupported", "message": "The action Overriding of Sensor Value for non manufacturing mode is not supported by the resource." } } Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Change-Id: I0598f1ff16a391864cd1371e514fb8da1797d8d5
2020-03-09Allow sensor value override in mfg mode onlyjayaprakash Mutyala1-1/+2
Issue: User is able to override sensor value even though system is not in manufacturing mode Fix: Code changes are done to patch sensor values when system is only in manufacturing Mode. Tested: 1. Redfish validator - passed for this new change Case 1: 1. Enable manufacturing mode by pressing power button while bmc booting 2. Patch sensor values from Redfish. Redfish URI: PATCH https://<BMC-IP>/redfish/v1/Chassis/WC_Baseboard/Thermal Body: { "Temperatures": [ { "MemberId": "SSB_Temp", "ReadingCelsius":112 } ] } Response: { "@odata.id": "/redfish/v1/Chassis/WC_Baseboard/Thermal", "@odata.type": "#Thermal.v1_4_0.Thermal", "Fans": [], "Id": "Thermal", "Name": "Thermal", "Temperatures": [] } 3. Sensor value Overridden successfully Case 2: Varified for ValidationUnsecure mode. Case 3: Tested without SpecialMode mode 1. Stop the specialmodemgr.service service 2. Patch sensor values from Redfish. 3. Sensor value Overridden successfully Case 4: 1. Disable manufacturing mode Command: ipmitool raw 0x30 0xB4 3 0 Response: //Success 2. Patch sensor values from Redfish. Redfish URI: PATCH https://<BMC-IP>/redfish/v1/Chassis/WC_Baseboard/Thermal Body: { "Temperatures": [ { "MemberId": "SSB_Temp", "ReadingCelsius":112 } ] } 3. Returning proper error. Response : { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The action Overriding of Sensor Value for non manufacturing mode is not supported by the resource.", "MessageArgs": [ "Overriding of Sensor Value for non manufacturing mode" ], "MessageId": "Base.1.4.0.ActionNotSupported", "Resolution": "The action supplied cannot be resubmitted to the implementation. Perhaps the action was invalid, the wrong resource was the target or the implementation documentation may be of assistance.", "Severity": "Critical" } ], "code": "Base.1.4.0.ActionNotSupported", "message": "The action Overriding of Sensor Value for non manufacturing mode is not supported by the resource." } } Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Change-Id: I34cd53fba939fb367310c531a050792ef749dd70
2019-11-19Redfish: Set the power capCarol Wang1-1/+39
Set the PowerCap with redfish patch. Tested: Case 1: PowerCapEnable is false $ curl -k -H "X-Auth-Token: $token" -X PUT -d '{"data":false}' https://$bmc/xyz/openbmc_project/control/host0/power_cap/attr/PowerCapEnable $ curl -k -H "X-Auth-Token: $token"https://${bmc}/redfish/v1/Chassis/chassis/Power { "@odata.context": "/redfish/v1/$metadata#Power.Power", "@odata.id": "/redfish/v1/Chassis/chassis/Power", "@odata.type": "#Power.v1_5_2.Power", "Id": "Power", "Name": "Power", "PowerControl": [ { "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0", "@odata.type": "#Power.v1_0_0.PowerControl", "MemberId": "0", "Name": "Chassis Power Control", "PowerLimit": { "LimitInWatts": null } } ], ... } $curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/Power -X PATCH -d '{"PowerControl":[{"PowerLimit":{"LimitInWatts":2004}}]}' { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "PowerCapEnable is false, can't set the PowerCap.", "MessageArgs": [], "MessageId": "Base.1.4.0.UnableToSetPowerCap", "Resolution": "Set PowerCapEnable to be true before setting PowerCap.", "Severity": "Warning" } ], "code": "Base.1.4.0.UnableToSetPowerCap", "message": "PowerCapEnable is false, can't set the PowerCap." } } Case 2: PowerCapEnable is true, PowerControl json only $ curl -k -H "X-Auth-Token: $token" -X PUT -d '{"data":true}' https://$bmc/xyz/openbmc_project/control/host0/power_cap/attr/PowerCapEnable $ curl -k -H "X-Auth-Token: $token"https://${bmc}/redfish/v1/Chassis/chassis/Power { "@odata.context": "/redfish/v1/$metadata#Power.Power", "@odata.id": "/redfish/v1/Chassis/chassis/Power", "@odata.type": "#Power.v1_5_2.Power", "Id": "Power", "Name": "Power", "PowerControl": [ { "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0", "@odata.type": "#Power.v1_0_0.PowerControl", "MemberId": "0", "Name": "Chassis Power Control", "PowerLimit": { "LimitInWatts": 2001.0 } } ], ... } $ curl -k -H "X-Auth-Token: $token"https://${bmc}/redfish/v1/Chassis/chassis/Power -X PATCH -d '{"PowerControl":[{"PowerLimit":{"LimitInWatts":2004}}]}' -v ... < HTTP/1.1 204 No Content ... $ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/Power { "@odata.context": "/redfish/v1/$metadata#Power.Power", "@odata.id": "/redfish/v1/Chassis/chassis/Power", "@odata.type": "#Power.v1_5_2.Power", "Id": "Power", "Name": "Power", "PowerControl": [ { "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0", "@odata.type": "#Power.v1_0_0.PowerControl", "MemberId": "0", "Name": "Chassis Power Control", "PowerLimit": { "LimitInWatts": 2004.0 } } ], ... } Case 3: PowerCapEnable is true, PowerControl and Voltages json $ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/Power -X PATCH -d '{"PowerControl":[{"PowerLimit"{"LimitInWatts":2001}}], "Voltages": [{"MemberId" : "p0_vcs_voltage", "ReadingVolts":8}]}' -v ... < HTTP/1.1 204 No Content ... Case 4: Wrong chassis path $ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassi/Power -X PATCH -d '{"PowerControl":[{"PowerLimit":{"LimitInWatts":2001}}]}' { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The requested resource of type Chassis named chassi was not found.", "MessageArgs": [ "Chassis", "chassi" ], "MessageId": "Base.1.4.0.ResourceNotFound", "Resolution": "Provide a valid resource identifier and resubmit the request.", "Severity": "Critical" } ], "code": "Base.1.4.0.ResourceNotFound", "message": "The requested resource of type Chassis named chassi was not found." } } Signed-off-by: Carol Wang <wangkair@cn.ibm.com> Change-Id: Ifabdf053005b31cf3e3539009a1ec20ce4d46d5b
2019-06-28Fix initialier_list issuesEd Tanous1-1/+1
This is a warning that the clang analyser seems to pop up with. For whatever reason, GCC is just fine with it. Tested: Not yet tested. Change-Id: I5d665e23011806f51d1ef4c5b1e8b887bdb456eb Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2019-05-23[Redfish] Add OCP required properties for ChassisJennifer Lee1-1/+0
- Thermal - Redundancy - Fans Tested: GET /redfish/v1/Chassis/<chassis id>/Thermal HTTP/1.1 Response: { "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal", "@odata.id": "/redfish/v1/Chassis/<chassis id>/Thermal", "@odata.type": "#Thermal.v1_4_0.Thermal", "Fans": [], "Id": "Thermal", "Name": "Thermal", "Redundancy": [], "Temperatures": [ { "@odata.id": "/redfish/v1/Chassis/<chassis id>/Thermal#/Temperatures/0", "@odata.type": "#Thermal.v1_3_0.Temperature", "LowerThresholdCritical": 0, "LowerThresholdNonCritical": 5, "MaxReadingRangeTemp": 127, "MemberId": "BMC_Temp", "MinReadingRangeTemp": -128, "Name": "BMC_Temp", "ReadingCelsius": 34.6870002746582, "Status": { "Health": "OK", "State": "Enabled" }, "UpperThresholdCritical": 115, "UpperThresholdNonCritical": 110 }, ... } Signed-off-by: Jennifer Lee <jennifer1.lee@intel.com> Change-Id: I8fe41e698ef55b02779b04468dee51ebe5561762
2019-05-09Redfish: Remove BMCWEB_ENABLE_REDFISH_ONE_CHASSISShawn McCarney1-10/+0
Removed the BMCWEB_ENABLE_REDFISH_ONE_CHASSIS #define. The new support for finding chassis sensors via associations is now used on all systems. Test Plan: https://gist.github.com/smccarney/f5b4783d8cf41a486ceff9b941b1ba9a Tested: Verified the Chassis, Power, and Thermal output was valid on a Witherspoon system. Verified sensor associations on Witherspoon work with bmcweb implementation. Ran Redfish Service Validator. Change-Id: I975f79da2c9de63e4ddd155d39ea872ca9fbffa9 Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
2019-05-09Acquire chassis sensors using the sensor association DBus itemJohnathan Mantey1-9/+0
Each entry in the Chassis Collection has, or will have, a sensors DBus item that lists the sensors that Chassis node contains. This change queries that DBus entry, and uses the information to collect the Thermal or Power sensor information. Tested: GET https://10.243.48.59/redfish/v1/Chassis/WP_Baseboard GET https://10.243.48.59/redfish/v1/Chassis/WP_Baseboard/Power GET https://10.243.48.59/redfish/v1/Chassis/WP_Baseboard/Thermal On 2 representative systems, one with a chassis, and one without. Observed correct behavior for both. Ran Redfish service validator. Observed no errors in Chassis, Thermal, Power, or ChassisCollection schemas. Change-Id: I01fcb3707396e2e33345bf125d8ae95170088a2a Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com> Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2019-03-25Revert "bmcweb: Fix a bunch of warnings"Ed Tanous1-1/+1
This reverts commit 6ea007a2faec52ad62680015d2a3f00371a1e351. Reason for revert: Reports of bmcweb seg faults. Change-Id: I408f1bb29c2f8e427a6621cdaac8c31b847ebf06
2019-03-23bmcweb: Fix a bunch of warningsEd Tanous1-1/+1
bmcweb classically has not taken a strong opinion on warnings. With this commit, that policy is changing, and bmcweb will invoke the best warnings we are able to enable, and turn on -Werror for all builds. This is intended to reduce the likelihood of hard-to-debug situations that the compiler coulve caught early on. Change-Id: I57474410821e82666b3a108cfd0db7d070e8900a Signed-off-by: Ed Tanous <ed@tanous.net>
2019-03-20Redfish: Enhance and fix power/thermal sensorsShawn McCarney1-4/+1
Made the following enhancements for Redfish power/thermal sensors: * Now dynamically obtains the DBus object path to pass to GetManagedObjects() when getting sensor values. Was previously hard-coded to "/" which didn't work on some systems. * Added "fan_tach" to list of DBus sensor types returned when thermal sensors are requested. * Added support for one-chassis systems. Made the following fixes: * Fixed @odata.id value when power sensors are requested. Previously returned "/redfish/v1/Chassis/chassis/Thermal". * Renamed "PowerSupply" to "PowerSupplies" to conform to schema. * Removed 6 properties that were being returned for PowerSupplies that were not in the schema. * Added check to make sure no sensors of the wrong type were being returned. Previously if the same connection (service) provided both power and thermal sensors, both types of sensors were always returned. Test Plan: https://gist.github.com/smccarney/79186e8510ba5479e846f2592d44d059 Tested: Verified the URLs /redfish/v1/Chassis/<chassis>/Power and /redfish/v1/Chassis/<chassis>/Thermal return the correct sensor names and values on a Witherspoon system. Verified fixes listed above worked. Ran Redfish Service Validator. Change-Id: I4bae615cb61fc436b3c0a9a5c4d6b4566a3ddaa6 Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
2019-03-13Add BMCWEB_ENABLE_REDFISH_ONE_CHASSIS build optionGunnar Mills1-1/+14
Define a new build option named BMCWEB_ENABLE_REDFISH_ONE_CHASSIS that is not set by default. When this build option is set, bmcweb will always return a single chassis named "chassis". Setting this option will also cause all sensors to be shown under this chassis. This is a short-term solution. Long term, inventory-manager needs to be enhanced to allow sensors to be under a chassis, or the rest of the project needs to move to EntityManager. Currently IBM does not use EntityManager, but EntityManager is called directly in sensors.hpp. This results in an HTTP 500 Internal Server Error. Tested: The URLs /redfish/v1/Chassis/ and /redfish/v1/Chassis/chassis show correct data on a Witherspoon. /redfish/v1/Managers/bmc/ now has a link to the single chassis. /redfish/v1/Chassis/chassis/Power and /redfish/v1/Chassis/chassis/Thermal no longer result in an HTTP 500 Internal Server Error. Ran Redfish Service Validator. Change-Id: Iec8f4da333946f19330f37ab084cd9787c52c8ea Signed-off-by: Gunnar Mills <gmills@us.ibm.com> Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
2019-03-12Fix: Power & Thermal patch method role updateRichard Marian Thomaiyar1-1/+1
Power & Thermal patch method role is updated to ConfigureComponents instead of ConfigureManager, as PATCH method can be executed by ConfigureComponents role. Tested-by: Verified the PATCH method works with ConfigureComponents role user itself. Change-Id: I4de06233dd3eebdeadf160d790ccac853a4972da Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
2019-03-11Fix typelist for fan in Thermal schemaRichard Marian Thomaiyar1-1/+1
should be fan_tach instad of fan Tested-by: Did a Get method on thermal profile, and made sure, fans are listed as expected. Change-Id: Ic5ac321b8f998136b646d6cfd3c7bb5946fe9194 Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
2019-03-11Patch support for sensor overrrideRichard Marian Thomaiyar1-6/+10
Support added for overriding sensor, which can be used for validation / ad-hoc debugging. This provides option to make PATCH call to redfish/v1/<chassisId>/Thermal or power id. Based on schema, will accept Temperatures / Voltages collection with properties MemberId and ReadingCelsius / ReadingVolts. TODO: 1. Need to make a dynamic way of enabling / disbaling this command. Unit-Test: 1. Verified sensor values are getting updated by doing PATCH method to a known sensor. Verified the value got updated using ipmitool sensor list. 2. Verified negative cases of making PATCH call on invalid chasisId, Invalid MemberId etc. Testedeby: Used Postman tool to issue the PATCH call to the 1. https://xx.xx.xx.xx/redfish/v1/Chassis/XXYYZZ/Thermal with content { "Temperatures": [ { "MemberId" : "SensorNameXX", "ReadingCelsius" : valueXX } ] } 2. https://xx.xx.xx.xx/redfish/v1/Chassis/XXYYZZ/Power with content { "Voltages": [ { "MemberId" : "SensorNameXX", "ReadingVolts" : valueXX } ] } Change-Id: Idf2d891ac0d10b5d20f78c386232cae8a6896f1a Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
2018-11-26bmcweb: Redfish away from json cacheEd Tanous1-8/+6
In the original incarnation of bmcweb, route registration was done automatically. This has proved to be a terrible idea, wraught with corner cases and issues. The route registration is currently the only user of the redfish::Node::json element. Unfortunately, as written, this structure consumes a lot of memory that's duplicated and not very useful. From a performance perspective, there is almost no difference between rebuilding the structure for each GET request, and having the "cache" that needs to be copied into the response and modified before it can be useful. In the programming tradeoffs for bmc, lower memory usage is more important than latency, especially at these levels. Change-Id: I785e8352123e5e886acf05cd59cb23648f93839d Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-10-29Chassis: Power: Support get PowerSupply and VoltagesEd Tanous1-3/+11
sensors information. cherry-picked from: https://github.com/ampere-openbmc/bmcweb/commit/a20f8b17c1efb92b9a8e95e8867d945bc6177804 Sensor module adds sensorType:"power" to retrieve power supply sensor information. This applicable to Power schema version 1.2.1 Limit: - Not retrieve PowerControl information yet. - Need to get UpperThresholdFatal and LowerThresholdFatal value. Tested: Browser and redfishtool Command test: redfishtool -A Basic -S Always --rhost=$bmc_ip -u $bmc_user -p $bmc_password Chassis -I 1 Power Redmine ID: #2145. Change-Id: Ifd4a7495c216f894f46610c02d3e8a8e3988dfaa Signed-off-by: Tung Vu <tung.vu@amperecomputing.com> Chassis: Thermal and Power: Correct @odata.id information cherry-picked from: https://github.com/ampere-openbmc/bmcweb/commit/ae95b0db60e5e680819c9f9b0c6d61caf66b14cf Allocate @odata.id of schema in correct way. Sensor module is general interface not used for specific schema. Tested: Browser and redfishtool Command test: - redfishtool -A Basic -S Always --rhost=$bmc_ip -u $bmc_user -p $bmc_password Chassis -I 1 Power - redfishtool -A Basic -S Always --rhost=$bmc_ip -u $bmc_user -p $bmc_password Chassis -I 1 Thermal Redmine ID: #2145 & #2146 Change-Id: I265bbb366c323f39fb6d4ac4f7cccfed4382e98d Signed-off-by: Tung Vu <tung.vu@amperecomputing.com> Chassis: Correct @odata.id for specific Chassis sub-node. cherry-picked from: https://github.com/ampere-openbmc/bmcweb/commit/3eaa53a395ad9275042893413cbefc78f52310e5 Currently there are Thermal and Power sub-nodes of Chassis node, correct @odata.id information for each sub-node in JSON payload. Tested: Browser and redfishtool Command test: - redfishtool -A Basic -S Always --rhost=$bmc_ip -u $bmc_user -p $bmc_password Chassis Thermal -I 1 - redfishtool -A Basic -S Always --rhost=$bmc_ip -u $bmc_user -p $bmc_password Chassis Power -I 1 Change-Id: I2f831ed40926e85c0b6d1cfa7d759eb0b9321daa Signed-off-by: Tung Vu <tung.vu@amperecomputing.com> Signed-off-by: Jennifer Lee <jennifer1.lee@intel.com>
2018-10-23Improve the Redfish error reporting interfaceJason M. Bills1-1/+1
Makes the Redfish error reporting interface automatically handle setting the http status and JSON content in the response object. When using an AsyncResp object, this allows for simply calling the Redfish error and returning. Change-Id: Icfdce2de763225f070e8dd61e591f296703f46bb Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2018-10-16Implement fan PWM reading through redfishEd Tanous1-1/+2
This patchset implements the ability to be able to read the PWM output values from redfish under the Thermal schema. to be able to map fan outputs to redfish. Change-Id: I858d81ef61183722390a073fa925416d17da5fec Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-09-05Move to clang-format-6.0Ed Tanous1-35/+40
This commit moves the codebase to the lastest clang-format file from upstream, as well as clang-format-6.0. Change-Id: Ice8313468097c0c42317fbb9e10ddf036e8cff4c Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-07-27Move over to upstream c++ styleEd Tanous1-4/+4
This patchset moves bmcweb over to the upstream style naming conventions for variables, classes, and functions, as well as imposes the latest clang-format file. This changeset was mostly built automatically by the included .clang-tidy file, which has the ability to autoformat and auto rename variables. At some point in the future I would like to see this in greater use, but for now, we will impose it on bmcweb, and see how it goes. Tested: Code still compiles, and appears to run, although other issues are possible and likely. Change-Id: If422a2e36df924e897736b3feffa89f411d9dac1 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-07-21Move Sensors path to sensorsJames Feist1-2/+2
Upstream uses lowercase paths, fix it. Change-Id: Ia8dc522fdd59cbbde015049ca772347fb9d2c991 Signed-off-by: James Feist <james.feist@linux.intel.com>
2018-06-30Update sensors to reflect changes after switching to sdbusplusLewanczyk, Dawid1-1/+1
- GetManagedObjects should be call only on service root path - additional fixes for RSV Change-Id: I4e345e57b081d7683fd8f3f4efa23fe4091ce41e Signed-off-by: Lewanczyk, Dawid <dawid.lewanczyk@intel.com>
2018-06-29Implemented PATCH for EthernetInterface VLAN and HostName fieldsKowalski, Kamil1-1/+1
Implemented PATCH request handling in EthernetInterface schema. Currently only VLAN and HostName patching is implemented - IP changes will be introduced in further patchsets. This code does not change existing functionality - only expands it. Tested on real hardware and x86 VM. Works fine, passes RedfishSchemaValidator. Change-Id: I8de4ee5e859218823b07cc11845f7ef6782d7171 Signed-off-by: Kowalski, Kamil <kamil.kowalski@intel.com>
2018-06-29Boost beastEd Tanous1-7/+8
This commit is the beginings of attempting to transition away from crow, and toward boost::beast. Unit tests are passing, and implementation appears to be slightly faster than crow. Change-Id: Ic8d946dc7a04f514c67b1098f181eee1ced69171
2018-05-18Introduce Thermal schemaLewanczyk, Dawid1-0/+60
Changes: -redfish.hpp add thermal node installation -thermal.hpp add thermal schema for chassis -sensor.hpp add support for retrieving: temperature, and fan Verification: -web server: no regression -RSV: pass -build on x86 and ASPEED This patchset builds on Dawids original. Change-Id: Ia8e40edff3c722fa02a161248bcdf602e36e3e62 Signed-off-by: Lewanczyk, Dawid <dawid.lewanczyk@intel.com> Signed-off-by: Ed Tanous <ed.tanous@intel.com>