summaryrefslogtreecommitdiff
path: root/redfish-core/lib/chassis.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-06-03Remove Redfish Node classJohn Edward Broadbent1-430/+383
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-04Fix chassis handler to use filename()Ed Tanous1-2/+2
A common anti pattern is using endswith or contains. This got compounded recently because of https://github.com/openbmc/sdbusplus/issues/60 where filename now contains decoding logic. This at least should fix the issue to make the Redfish tree walkable again. Tested: Loaded up a WFP_Baseboard on qemu, and verified that /redfish/v1/Chassis/WFP_Baseboard traversed correctly. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I55cc389a773e4b594668a4bca466efc33cc9cb7c
2021-04-08Using AsyncResp everywherezhanghch051-37/+36
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-08Chassis Location property on bmcwebSunnySrivastava19841-0/+35
This commit implements change to publish LocationCode property for Chassis on bmcweb. Location code of Motherboard FRU is published via chassis schema. LocationCode, a free form, implementation-defined string to provide the location. This is needed so an implementation can identify the FRU via system diagrams. Validator has been executed and no new error has been found. Sample output: { "@odata.id": "/redfish/v1/Chassis/chassis", "@odata.type": "#Chassis.v1_14_0.Chassis", "Actions": { "#Chassis.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Chassis/chassis/ResetActionInfo", "target": "/redfish/v1/Chassis/chassis/Actions/Chassis.Reset" } }, "ChassisType": "RackMount", "Id": "chassis", "Links": { "ComputerSystems": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "ManagedBy": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ] }, "Location": { "PartLocation": { "ServiceLabel": "U78DA.ND1.1234567" } }, "Manufacturer": "", "Model": "", "Name": "chassis", "PCIeDevices": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices" }, "PartNumber": "PN12345", "Power": { "@odata.id": "/redfish/v1/Chassis/chassis/Power" }, "PowerState": "Off", "Sensors": { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors" }, "SerialNumber": "BBBE2D010000", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "StandbyOffline" }, "Thermal": { "@odata.id": "/redfish/v1/Chassis/chassis/Thermal" } } Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com> Change-Id: Ib248b79156e8b04664e89e37bae49d4574e97086
2020-12-15IndicatorLED: Add a deprecated warning headerGunnar Mills1-0/+6
Added a warning header when IndicatorLED is patched telling the client it is deprecated and pointing to LocationIndicatorActive. Used the warning syntax from https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Warning Tested: curl -X PATCH -v -d '{ "IndicatorLED":"Off"}' \ -k https://$bmc/redfish/v1/Systems/system ... < HTTP/1.1 204 No Content < Warning: 299 - "IndicatorLED is deprecated. Use LocationIndicatorActive instead." < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload < X-Frame-Options: DENY Change-Id: Ic25a02508b0a1bcada1fa71ffa413c493fad00c4 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-11-10Add new Location Indicator propertyGunnar Mills1-20/+37
In ComputerSystem 1.13 and Chassis 1.14 as well as in many other schemas IndicatorLED is replaced with LocationIndicatorActive. LocationIndicatorActive is a bool while IndicatorLED had 3 states: Lit, Blink, and off. Map Lit and Blink both to LocationIndicatorActive true. led.hpp was calling both enclosure_identify_blink and enclosure_identify, continue this. Keep the deprecated IndicatorLED and implement the new LocationIndicatorActive property. Have both properties for the time being. This new property makes the same calls. This does add a new Redfish warning for the deprecated IndicatorLED. Other warning are there today. Tested: Validator passes Could use help testing on Chassis. Our systems don't have a IndicatorLED on chassis. See chassis bumped. curl -k https://$bmc/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_13_0.ComputerSystem", ... "IndicatorLED": "Off", "LastResetTime": "2020-10-29T09:01:03+00:00", "Links": { "Chassis": [ { "@odata.id": "/redfish/v1/Chassis/chassis" } ], "ManagedBy": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ] }, "LocationIndicatorActive": false, curl -X PATCH -d '{ "LocationIndicatorActive":true}' -k \ https://$bmc/redfish/v1/Systems/system curl -X PATCH -d '{ "IndicatorLED":"Off"}' -k \ https://$bmc/redfish/v1/Systems/system Change-Id: I105bed5794912c575aa9a00e0442461bfdee6180 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-10-23Turn on ALL perf checksEd Tanous1-2/+1
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-16Chassis Collection: Use getCollectionMembersGunnar Mills1-41/+5
Improves code reuse. Tested: Validator passes. curl -k https://$bmc/redfish/v1/Chassis/ { "@odata.id": "/redfish/v1/Chassis", "@odata.type": "#ChassisCollection.ChassisCollection", "Members": [ { "@odata.id": "/redfish/v1/Chassis/chassis" }, { "@odata.id": "/redfish/v1/Chassis/motherboard" } ], "Members@odata.count": 2, "Name": "Chassis Collection" Change-Id: Ie26f93faec9498124ab1d5747aed8300414b6d96 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-10-15Update Chassis power cycle supportVijay Khemka1-12/+46
Updated chassis power cycle support via redfish which will allow user to remove AC power of chassis and restore it back ungracefully if chassis_system0 interface is supported. Tested: verified with following command curl -g -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/TiogaPass_Baseboard/Actions/Chassis.Reset -d '{"ResetType": "PowerCycle"}' Signed-off-by: Vijay Khemka <vijaykhemka@fb.com> Change-Id: I5368dbcdf96e526009cb3904b04791430bfeb413
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-24Response with internal error on invalid Chassis pathWludzik, Jozef1-1/+8
Added verification of chassis path in case if received path is invalid. Response with internal error on wrong format of a path. Tested: - Verify if chassis collection is filled properly - Verify if internal error is returned on wrong path - RedfishServiceValidator.py passes Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Change-Id: Ibe2b9a12d0a5c2c05c9db502b65d2196851352b5
2020-08-19Fix minor regression in chassisEd Tanous1-6/+1
Despite error code checking generally being a good thing, this seems to cause a regression on systems that don't have an asset interface. See https://gerrit.openbmc-project.xyz/c/openbmc/meta-phosphor/+/35711 for more details Tested: Expecting CI to test, as it was the one that found the last corner case. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Iae013b1d240852908dd5b0107aad8a0089b5961e
2020-08-17Enable unused variable warnings and resolveEd Tanous1-5/+10
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-15/+16
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-5/+4
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-07-21Add ResetActionInfo for ResetTypeAppaRao Puli1-1/+55
OCP mandate the ResetActionInfo for convey the parameter requirements and allowable values on parameters for actions. So add ResetActionInfo uri for below URI's. /redfish/v1/Systems/system/ResetActionInfo /redfish/v1/Managers/bmc/ResetActionInfo /redfish/v1/Chassis/<id>/ResetActionInfo Tested: - All action uri's show correct @Redfish.ActionInfo "Actions": { "#ComputerSystem.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Systems/system/ResetActionInfo", "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset" } } - All /ResetActionInfo uri's show correct allowable values. { "@odata.id": "/redfish/v1/Systems/system/ResetActionInfo", "@odata.type": "#ActionInfo.v1_1_2.ActionInfo", "Id": "ResetActionInfo", "Name": "Reset Action Info", "Parameters": { "AllowableValues": [ "On", "ForceOff", "ForceOn", "ForceRestart", "GracefulRestart", "GracefulShutdown", "PowerCycle", "Nmi" ], "DataType": "String", "Name": "ResetType", "Required": true } } - Ran redfish validator and its successful. Change-Id: I656163dde300d97fe1923f1d58fa6d104c702d27 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-07-10Codespell redfish-core spelling fixesGunnar Mills1-2/+2
These spelling errors were found using https://github.com/codespell-project/codespell Tested: Top commit (along with this) was built and ran against validator. Change-Id: Ic9dce27b1de8567eedf7753164ef564d3aedf8ca Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-06-23Redfish: Add chassis resetP.K. Lee1-0/+75
Add chassis reset by using Redfish. Tested: Passed validator. Chassis reset worked. Usage: POST on /redfish/v1/Chassis/chassis/Actions/Chassis.Reset/ { "ResetType": "PowerCycle" } Change-Id: Ia8949e6695e60ee63776ac70e4f8cd85a4b186c3 Signed-off-by: P.K. Lee <p.k.lee@quantatw.com>
2020-06-11clang-format: update to latest from docs repoGunnar Mills1-53/+54
This is from openbmc/docs/style/cpp/.clang-format Other OpenBMC repos are doing the same. Tested: Built and validator passed. Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-02-15chassis: Remove odata.contextGunnar Mills1-4/+0
Redfish made odata.context optional (1.6.0 of DSP0266) and has removed odata.context from example payloads in the specification (1.7.0 of DSP0266), removed it from the mockups, and Redfish recommended not using. Change-Id: I96e8908f07d27696aaf2e2ba33f49411b8e51ec5 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-01-07Add IndicatorLed to Chassis SchemaJames Feist1-7/+122
This adds the indicator property to Chassis Schema, and moves the logic from systems.hpp to a common header to share the code. Tested: Passed the validator, was able to turn LED on Change-Id: I79458a2a4656d7ddf2939bb9f56845eb6d9a27ca Signed-off-by: James Feist <james.feist@linux.intel.com>
2019-12-03Fix No Total Memory Size IssueCheng C Yang1-1/+1
Total Memory in redfish is always 0, fix the problem. Tested: After DC cycle the system. TotalSystemMemoryGiB in Redfish system page should not be zero. "MemorySummary": { "Status": { "State": "Enabled" }, "TotalSystemMemoryGiB": 16 }, Signed-off-by: Cheng C Yang <cheng.c.yang@linux.intel.com> Change-Id: I89ad8ed1cf5f9ca9589db444740167645dab9a6e
2019-10-29Update to Chassis 1.10 and add PCIeDeviceCollection supportJason M. Bills1-2/+5
v1.10 of Chassis adds a PCIeDeviceCollection. This change adds support for the PCIeDeviceCollection and references it from Chassis. Tested: Passed the Redfish Service Validator. Change-Id: If3bb75f4fa90a9df4a2a94a7c7e0bcaf37673723 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2019-10-11Fix a bunch of warningsEd Tanous1-3/+3
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-09-24bmcweb: Implement SensorCollectionAnthony Wilson1-2/+6
Add collection of all power and current sensors. Testing: Verified SensorCollection and Sensor output on a Witherspoon system. Verified no errors from RedfishServiceValidator. Change-Id: Icfdc14d738bf037d5d599a3c6fc0be5ea0919929 Signed-off-by: Anthony Wilson <wilsonan@us.ibm.com>
2019-08-16Redfish: Move power supplies to Power schemaShawn McCarney1-6/+4
Made the following enhancements related to power supplies in Redfish: * Moved power supplies from Chassis schema to Power schema * Added support for multiple power supplies within one chassis * Added support for multiple sensors associated with one power supply * Set power supply Name and MemberId to inventory item name (like powersupply0) rather than sensor name (like ps0_input_power). * Set power supply VPD fields like Manufacturer and SerialNumber Also improved support for power sensors that are not related to power supplies, such as VRM sensors. These sensors are no longer treated as power supplies, and they will not be included in the Power schema output. They should instead be included in the SensorCollection output when that support is completed. Uses an ObjectMapper association named "inventory" to find the power supply inventory item associated with a power sensor. For example: /xyz/openbmc_project/sensors/power/ps0_input_power/inventory -> /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0 See https://github.com/openbmc/docs/blob/master/sensor-architecture.md for more information on associations between sensors and low-level hardware items. Test Plan: https://gist.github.com/smccarney/43b2fae304575302af61332a71280d74 Tested: Verified Power and Thermal output on a Witherspoon system. Tested with power sensors that were/were not associated with power supplies. Verified power supply properties in Power output. Verified that power supplies are no longer returned in Chassis collection output. Ran Redfish Service Validator. Change-Id: I50db389b5df011bfb561d31aafb33cc4bf7fcde6 Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
2019-06-27Health / Rollup SupportJames Feist1-1/+25
Look for associations for inventory and compare the inventory warning / critical and global warning / critical to get HealthRollup and Health respectively. Tested: Used sensor override to set BMC temp to Upper critical and saw: { "@odata.context": "/redfish/v1/$metadata#Chassis.Chassis", "@odata.id": "/redfish/v1/Chassis/WFP_Baseboard", "@odata.type": "#Chassis.v1_4_0.Chassis", "ChassisType": "RackMount", "Id": "WFP_Baseboard", "Links": { "ComputerSystems": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "ManagedBy": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ] }, "Manufacturer": "Intel Corporation", "Model": "S2600WFT", "Name": "WFP_Baseboard", "PartNumber": "123456789", "Power": { "@odata.id": "/redfish/v1/Chassis/WFP_Baseboard/Power" }, "PowerState": "Off", "SerialNumber": "123454321", "Status": { "Health": "Warning", "HealthRollup": "Critical", "State": "StandbyOffline" }, "Thermal": { "@odata.id": "/redfish/v1/Chassis/WFP_Baseboard/Thermal" } } Change-Id: Idd9e832db18bb4769f1452fe243d68339a6f844d Signed-off-by: James Feist <james.feist@linux.intel.com>
2019-05-09Redfish: Remove BMCWEB_ENABLE_REDFISH_ONE_CHASSISShawn McCarney1-21/+1
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-8/+11
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-18Redfish: Add Chassis PowerState callGunnar Mills1-1/+45
Make a call to /xyz/openbmc_project/state/chassis0 to get the chassis PowerState. Very similiar to how we get the System PowerState https://github.com/openbmc/bmcweb/blob/abf2add6a35aaf42ba60c4ae955a4d8925b13b19/redfish-core/lib/systems.hpp#L471 Resolves openbmc/bmcweb#27 Tested: Loaded this on a Witherspoon and power on/off. Saw correct PowerState. Signed-off-by: Gunnar Mills <gmills@us.ibm.com> Change-Id: I9dd008a902098f1872560d985249375a2d317f25
2019-03-13Add BMCWEB_ENABLE_REDFISH_ONE_CHASSIS build optionGunnar Mills1-4/+26
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-11redfish: chassis: add property of physical securityQiang XU1-0/+71
Get intrusion status from dbus and display property of physical security Related patches to run test: - meta-phosphor: dbus-sensors: Enable new service of intrusion sensor https://gerrit.openbmc-project.xyz/#/c/openbmc/meta-phosphor/+/17063/ - Add chassis intrusion sensor daemon https://gerrit.openbmc-project.xyz/#/c/openbmc/dbus-sensors/+/17064/ Tested-by: - Verified redfish/v1/Chassis/<ChassisId> when intrusion status is true "PhysicalSecurity": { "IntrusionSensor": "HardwareIntrusion", "IntrusionSensorNumber": 1 }, Change-Id: Ib231ccb847d48641eac363f578de9f930035db89 Signed-off-by: Qiang XU <qiang.xu@linux.intel.com>
2019-03-08Redfish Chassis: Fix @odata.id, remove BuildDateShawn McCarney1-7/+18
Fixed the following errors when obtaining the Redfish properties of a Chassis: * @odata.id URI did not contain the chassis name * Non-Redfish DBus properties like BuildDate were returned Tested: Verified the URL /redfish/v1/Chassis/<chassis>/ returns the correct properties on a Witherspoon system. Ran Redfish Service Validator. Change-Id: I73280990db0b468aea1b12b2b919dabb2e20ca89 Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
2019-02-19bmcweb: Implement single Redfish "system" endpointEd Tanous1-12/+10
This commit changes the redfish behavior to move to a single, known name under the /redfish/v1/Systems/system path. This is advantageous for a lot of reasons. 1. Lots fewer dbus calls to determine the system name for every path. This could be optimized in other ways, like checking the system name on startup, but because redfish paths are not intended to be informative, this patchset takes the opinion that less code is better. 2. Lots of lowered complexity, given that each endpoint underneath /system doesn't need an individual "does this system exist, and is the name right" check. 3. This makes it possible to correctly implement the "Links" property in Chassis, which is required for the OCP base server profile Tested By: Very minimal testing done, but it seems to pass the validator. Change-Id: Iea3cb5081b92a3843b6877decd009936de00561c Signed-off-by: Ed Tanous <ed.tanous@intel.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2019-02-09bmcweb: move variant usage to std namespaceEd Tanous1-3/+3
Change-Id: I9d7069668f91f2ac72d2f4a440f63e0e85dd5269 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2019-02-07Use Chassis interfaces to determine if chassisGunnar Mills1-4/+7
Use the same interfaces used to determine members of /redfish/v1/Chassis/ as to determine if a chassis exists, /redfish/v1/Chassis/<ChassisId>. Using something different, Inventory.Item.Asset, means a /redfish/v1/Chassis/<ChassisId> could return found when it does not belong to members of /redfish/v1/Chassis/ and vice versa. Changed the search depth of both commands to infinite. Tested: Verified /redfish/v1/Chassis/ and /redfish/v1/Chassis/<ChassisId> on a Witherspoon Change-Id: I45cfbadfb5199224039df2d894a599e1e237cf15 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2019-01-22Redfish: Chassis: Remove Inventory.Item.SystemGunnar Mills1-4/+2
To determine /redfish/v1/Chassis/<ChassisID> don't look for xyz.openbmc_project.Inventory.Item.System which is currently implemented at /xyz/openbmc_project/inventory/system. Inventory.Item.System (/xyz/openbmc_project/inventory/system) is not a Chassis. Inventory.Item.System is used to determine /redfish/v1/Systems/<SystemID>. https://gerrit.openbmc-project.xyz/#/c/openbmc/bmcweb/+/16528/ Change-Id: I6b7be374ea997d22598c0e7144a65428fba2fdbc Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2018-12-10Remove custom version of getPtrEd Tanous1-2/+2
Now that sdbusplus variant supports std::get_if, we can remove our custom, mapbox namespaced implementation that does the same thing. Change-Id: I854c473003e28e41dd45dba08ca683433f1c1774 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-11-26bmcweb: Redfish away from json cacheEd Tanous1-15/+14
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/+16
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-12/+5
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 PowerState in the chassis schemaEd Tanous1-0/+1
Because the bmc is always "On" simply hardcode the value to ON. This is done because some compliance profiles require it. Change-Id: I8833355ca2a12d3606d10e7f653fca59ae8cf56a Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-10-16Redfish- Clean up system schema implementationEd Tanous1-1/+1
Move the system schema awa from using single letter variable names. Change-Id: I41f9c00f6a227a43126ad47f60e26950f0cf89ec Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-09-27remove providers interface from chassis schemaEd Tanous1-115/+56
This commit removes the providers interface from the chassis schema, and cleans up quite a bit of code. Change-Id: I8984af67c9f15834ce59951c5e8f3b0d5c26697c Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-09-05Move to clang-format-6.0Ed Tanous1-191/+224
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-08-09Fix merge conflictEd Tanous1-1/+1
Got a couple patches that collided in air, and now builds are broken. This resolves the collision by moving the new patches forward to the latest #defines Change-Id: I1fe35d17a68c61ad90752ae73000e2579131bf5d Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-07-27Move over to upstream c++ styleEd Tanous1-40/+40
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-25Make SessionStore a proper singletonBorawski.Lukasz1-5/+0
- SessionStore class now has a proper singleton structure - session_storage_singleton.hpp is removed - from_json(..) function for SessionStore is changed to a specialized template - minor cosmetic fixes added - Move the template class usages of Crow App over to a non-template parameter Change-Id: Ic9effd5b7bac089a84c80a0caa97bd46d4984416 Signed-off-by: Borawski.Lukasz <lukasz.borawski@intel.com> Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-06-30Update sensors to reflect changes after switching to sdbusplusLewanczyk, Dawid1-0/+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-29Introduce ComputerSystem schemaLewanczyk, Dawid1-1/+1
Initial commit which adds: - ComputerSchemaCollection GET method - ComputerSchema GET, PATCH methods Tested on x86 and aspeed - RSV pass for ComputerSchema - bmcweb interface no regression - smbios interface tested with demo app Change-Id: Ib64084c5888bc511a24f954a6bc062ca920addbe Signed-off-by: Lewanczyk, Dawid <dawid.lewanczyk@intel.com>