summaryrefslogtreecommitdiff
path: root/redfish-core/lib/power.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-06-03Remove Redfish Node classJohn Edward Broadbent1-224/+209
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-04-08Using AsyncResp everywherezhanghch051-99/+105
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-10-23Turn on ALL perf checksEd Tanous1-2/+2
1st, alphabetize the tidy-list for good housekeeping. Next, enable all the clang-tidy performance checks, and resolve all the issues. most of the issues boil down to: 1. Using std::move on const variables. This does nothing. 2. Passing big variables (like std::string) by value. 3. Using double quotes on a find call, which constructs an intermediate string, rather than using the character overload. Tested Loaded on system, logged in successfully and pulled down webui-vue. No new errors. Walked the Redfish tree a bit, and observed no new problems. Ran redfish service validator. Got no new failures (although there are a lot of log service deprecation warnings that we should look at). Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I2238958c4b22c1e554e09a0a1787c744bdbca43e
2020-10-15Lots of performance improvementsEd Tanous1-1/+1
(In the voice of the kid from sixth sense) I see string copies... Apparently there are a lot of places we make unnecessary copies. This fixes all of them. Not sure how to split this up into smaller patches, or if it even needs split up. It seems pretty easy to review to me, because basically every diff is identical. Change-Id: I22b4ae4f96f7e4082d2bc701098a04f7bed95369 Signed-off-by: Ed Tanous <ed@tanous.net> Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
2020-09-29Fix naming conventionsEd Tanous1-2/+2
Lots of code has been checked in that doesn't match the naming conventions. Lets fix that. Tested: Code compiles. Variable/function renames only. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I6bd107811d0b724f1fad990016113cdf035b604b
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-17Enable clang warningsEd Tanous1-3/+3
This commit enables clang warnings, and fixes all warnings that were found. Most of these fall into a couple categories: Variable shadow issues were fixed by renaming variables unused parameter warnings were resolved by either checking error codes that had been ignored, or removing the name of the variable from the scope. Other various warnings were fixed in the best way I was able to come up with. Note, the redfish Node class is especially insidious, as it causes all imlementers to have variables for parameters, regardless of whether or not they are used. Deprecating the Node class is on my list of things to do, as it adds extra overhead, and in general isn't a useful abstraction. For now, I have simply fixed all the handlers. Tested: Added the current meta-clang meta layer into bblayers.conf, and added TOOLCHAIN_pn-bmcweb = "clang" to my local.conf Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
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-5/+5
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-05-14sdbusplus: replace message::variant with std::variantPatrick Williams1-1/+1
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ia5d0845741f1d8d4bc6fd227c6d2e6f3a8d42b2e
2020-05-14sdbusplus: remove deprecated variant_nsPatrick Williams1-14/+6
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I86e11299512704fa1df1e5f6517ea25cc6eced8f
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-19[Redfish] Making LimitException OCP CompliantJoshi-Mansi1-0/+5
Setting PowerLimit.LimitException Attribute value to "NoAction" in Power Schema as its default value to make it OCP compliant. Tested: 1. Tested using GET: - https://bmc-ip/redfish/v1/Chassis/Baseboard/Power "PowerLimit": { "LimitException": "NoAction" } 2. Ran the Redfish validator and no new issues found. Signed-off-by: Joshi-Mansi <mansi.joshi@linux.intel.com> Change-Id: Ie8768ba250d29d23b791fcd60d749ab6081238b2
2020-03-17Fix: Add Item.Board while querying the chassisAppaRao Puli1-1/+2
Links.Chassis section and Links.ManagerForChassis are missing in systems/system and Managers/bmc get responses. Also missing "PowerControl" node in /<chassisid>/power response. Some of the platforms exposes the chassis nodes with interface "xyz.openbmc_project.Inventory.Item.Board". So added that interface also, while querying the data chassis nodes. Tested: Get on /redfish/v1/Systems/system shows Chassis links. Get on /redfish/v1/Managers/bmc shows chassis links. Get on //redfish/v1/Chassis/<id>/power shows "PowerControl" node. Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Change-Id: I7ecd016faa2cdda97a9766f2ce94bdec2aa86d1b
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/+135
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-10-11Fix a bunch of warningsEd Tanous1-5/+5
using the list of warnings from here: https://github.com/lefticus/cppbestpractices/blob/e73393f25a85f83fed7399d8b65cb117d00b2231/02-Use_the_Tools_Available.md#L100 Seems like a good place to start, and would improve things a bit type-wise. This patchset attempts to correct all the issues in one shot. Tested: It builds. Will test various subsystems that have been touched Signed-off-by: Ed Tanous <ed.tanous@intel.com> Change-Id: I588c26440e5a97f718a0f0ea74cc84107d53aa1e
2019-07-08Move PowerLimit to correct locationGunnar Mills1-3/+14
See the following Redfish Validator errors and warning: /redfish/v1/Chassis/chassis/Power ERROR - PowerLimit not defined in schema Power.v1_5_2 (check version, spelling and casing) /redfish/v1/Chassis/chassis/Power#/PowerControl/ ERROR - Decoded object no longer a dictionary /redfish/v1/Chassis/chassis/Power ERROR - @odata.id of ReferenceableMember does not properly resolve: /redfish/v1/Chassis/chassis/Power#/PowerControl/ WARNING - No @odata.type present, assuming highest type Power.v1_0_0.PowerControl Power.v1_4_0.PowerControl If you look at the specification/mockups, PowerLimit is under PowerControl. From the https://redfish.dmtf.org/redfish/mockups/v1/893 mockup: PowerControl": [ { "@odata.id": "/redfish/v1/Chassis/1U/Power#/PowerControl/0", "MemberId": "0", ... "PowerAvailableWatts": 0, "PowerCapacityWatts": 800, ... "PowerLimit": { "LimitInWatts": 500, "LimitException": "LogEventOnly", "CorrectionInMs": 50 } , ... } ], Added an odata.type and fixed the odata.id for PowerControl. Put all power control sensors under the same PowerControl like we do for PowerSupplies. Tested: No longer see the errors. If no total_power (happens when a Open Power system is off): curl -k https://${bmc}/redfish/v1/Chassis/chassis/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 } } ], "Redundancy": [], ... curl -k https://${bmc}/redfish/v1/Chassis/chassis/Power/ { "PowerControl": [ { "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0", "@odata.type": "#Power.v1_0_0.PowerControl", "MemberId": "0", "Name": "Chassis Power Control", "PowerConsumedWatts": 232.0, "PowerLimit": { "LimitInWatts": null }, "Status": { "Health": "OK", "State": "Enabled" Change-Id: I8ca47bd6c7dedf5d0685886e2e45e6f964f69060 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2019-06-28Fix initialier_list issuesEd Tanous1-3/+2
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-06-14Redfish: Added OCP mandatory propertiesJennifer Lee1-0/+2
- Manager: Added SerialConsole, Links/ManagerForChassis and Links/ManagerForChassis@odata.count - System: Added Links/Chassis, Links/ManagedBy, Status, BiosVersion - Power: Added placeholder for PowerControl Tested: GET /redfish/v1/Systems/system HTTP/1.1 Response: { "@odata.context": "/redfish/v1/$metadata#ComputerSystem.ComputerSystem", "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_6_0.ComputerSystem", ...... "BiosVersion": "SE5C620.86B.01.00.0361.120520162351", ...... "Description": "Computer System", "Id": "system", "IndicatorLED": "Off", "Links": { "Chassis": [ { "@odata.id": "/redfish/v1/Chassis/R1000_Chassis" } ], "ManagedBy": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ] }, ...... "Processors": { "@odata.id": "/redfish/v1/Systems/system/Processors" }, "Status": { "Health": "OK", "State": "Enabled" }, "SystemType": "Physical", "UUID": "13876882-7708-4200-bcf2-2c5681218bc8" } GET /redfish/v1/Managers/bmc HTTP/1.1 Response: { "@odata.context": "/redfish/v1/$metadata#Manager.Manager", "@odata.id": "/redfish/v1/Managers/bmc", "@odata.type": "#Manager.v1_3_0.Manager", ...... "Description": "Baseboard Management Controller", "Linkn"fces": { "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces" }, "FirmwareVersion": "2.7.0-dev-266-g111d297-d14e857", "Id": "bmc", Links: { "ManagerForChassis": [ { "@odata.id": "/redfish/v1/Chassis/R1000_Chassis" } ], "ManagerForChassis@odata.count": 1, "ManagerForServers": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "ManagerForServers@odata.count": 1 }, ...... "SerialConsole": { "ConnectTypesSupported": [ "IPMI", "SSH" ], "ServiceEnabled": true }, "Status": { "Health": "OK", "State": "Enabled" }, "UUID": "067b4e8d-6c29-475c-92a1-6590d4e5818c" } GET /redfish/v1/Chassis/R1000_Chassis/Power HTTP/1.1 Response: { "@odata.context": "/redfish/v1/$metadata#Power.Power", "@odata.id": "/redfish/v1/Chassis/R1000_Chassis/Power", "@odata.type": "#Power.v1_2_1.Power", "Id": "Power", "Name": "Power", "PowerControl": [] } Signed-off-by: Jennifer Lee <jennifer1.lee@intel.com> Change-Id: I61d8ba493ad689d7062e1f8bfd26d9a0d80230da
2019-06-05Add basic PowerControl and PowerLimit propertiesEddie James1-1/+156
Add code in the power-specific response handler to fetch the Power Limit value for the chassis that implements the Chassis inventory item. Add a special case to the generic sensor handling code to place the total_power value into the PowerControl PowerConsumedWatts field. curl -k 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/", "MemberId": "total_power", "Name": "total power", "PowerConsumedWatts": 269.0, "Status": { "Health": "OK", "State": "Enabled" } } ], "PowerLimit": [ { "LimitInWatts": null } ], Signed-off-by: Eddie James <eajames@linux.ibm.com> Change-Id: I447de59fb44a4ecbe7b47610d915ac22aef90250
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-6/+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-2/+3
This reverts commit 6ea007a2faec52ad62680015d2a3f00371a1e351. Reason for revert: Reports of bmcweb seg faults. Change-Id: I408f1bb29c2f8e427a6621cdaac8c31b847ebf06
2019-03-23bmcweb: Fix a bunch of warningsEd Tanous1-3/+2
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/+0
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-0/+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-11Patch support for sensor overrrideRichard Marian Thomaiyar1-5/+9
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-7/+5
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-0/+71
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>