summaryrefslogtreecommitdiff
path: root/redfish-core/lib/memory.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-07-20[bmcweb] Add DDR5 support in bmcwebMansi Joshi1-0/+5
Memory Device Type support wasn't there for DDR5 type dimm. Added code for the same as per latest SMBIOS spec DSP0134 version 3.4.0. Tested: Get of https://BMC-IP/redfish/v1/Systems/system/Memory/dimm gives correct values. "MemoryDeviceType": "DDR5", "MemoryType": "DRAM" Signed-off-by: Mansi Joshi <mansi.joshi@linux.intel.com> Change-Id: I7c3590f3f0a1e17ea9f44736ced8a4f22d211411
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-03Remove Redfish Node classJohn Edward Broadbent1-70/+33
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-21bmcweb:Check for dimm presense for State AttributeJoshi-Mansi1-0/+15
The state attribute was showing Enabled even if dimm was not present. Added Present property under Inventory Item interface to read the dimm presence and accordingly populate jsonValue["Status"]["State"] to Enabled or Absent. Tested: -Get of redfish/v1/Systems/system/Memory/dimm shows correct State values in both the cases. -Redfish validator passed. Signed-off-by: Joshi-Mansi <mansi.joshi@linux.intel.com> Change-Id: I0629fffcc8ca5abf09dd645af6640341d37e446e
2021-04-21Redfish : Return after InternalError instead of ContinueChicago Duan1-33/+33
"After setting response to internal error you should stop adding more content to response. Try to return instead of continuing a loop" https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/39970/9/redfish-core/lib/pcie_slots.hpp#169 Signed-off-by: Chicago Duan <duanzhijia01@inspur.com> Change-Id: Iadd3062ba7fef31ba61eea1e79eb3a903716b9e9
2021-04-08Using AsyncResp everywherezhanghch051-19/+19
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-02-22Add additional Redfish Memory propertiesSunnySrivastava19841-1/+36
This commit adds the following properties to the memory schema on bmcweb. a) LocationCode, a free form, implementation-defined string to provide the location of the DIMM. This is needed so an implementation can identify the DIMM via system diagrams and such. b) Model, maps to a CCIN/Card ID for IBM's implementation, is a string for the manufacturer's part model. For IBM's implementation, it is a four-digit value assigned for each possible FRU. c) SparePartNumber, also field-replaceable unit (FRU) Part Number, is a part number that identifies the FRU for replacement specifically ordering of a new part. Redfish validator has been executed on this change and no new error was found. Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com> Change-Id: I419a9cd8e956de3fbf7093903129389ad5e0e577
2020-11-26Memory: Remove if (*memorySize == 0)Gunnar Mills1-9/+0
Sent to mailing list here: https://lists.ozlabs.org/pipermail/openbmc/2020-October/023744.html Remove the if MemorySizeInKB is 0 set the "Status""State" to Absent and return. More work needed here to make Present and Functional work correctly. Tested: Validator passes. curl -k https://$bmc/redfish/v1/Systems/system/Memory/dimm6 { "@odata.id": "/redfish/v1/Systems/system/Memory/dimm6", "@odata.type": "#Memory.v1_7_0.Memory", "AllowedSpeedsMHz": [], "BaseModuleType": "RDIMM", "BusWidthBits": 0, "CapacityMiB": 0, "DataWidthBits": 0, "ErrorCorrection": "NoECC", "FirmwareRevision": "0", "Id": "dimm6", "Manufacturer": "Micron Technology", "Name": "DIMM Slot", "OperatingSpeedMhz": 0, "PartNumber": "", "RankCount": 0, "SerialNumber": "0x156d5d4f", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" } Change-Id: I40ab44b1cb5db266d0766501a6f625168baaa2a6 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-10-30Memory: Fix potential validator errorGunnar Mills1-8/+111
"Other" and "Unknown" are not valid Redfish MemoryDeviceType values. Do correct converting D-Bus enum to redfish. Straight mapping (D-Bus and Redfish both contain the same name): DDR DDR2 DDR3 DDR4 DDR4E_SDRAM LPDDR4_SDRAM LPDDR3_SDRAM DDR2_SDRAM_FB_DIMM DDR2_SDRAM_FB_DIMM_PROBE (no E on the end of the d-bus name) DDR_SGRAM ROM SDRAM EDO FastPageMode PipelinedNibble Logical HBM HBM2 The following D-Bus values are not mapped: Other Unknown DRAM EDRAM VRAM SRAM RAM FLASH EEPROM FEPROM EPROM CDRAM ThreeDRM RDRAM FBD2 LPDDR_SDRAM LPDDR2_SDRAM The following Redfish values don't have a mapping to: "DDR4_SDRAM" "DDR3_SDRAM" "DDR_SDRAM" "DDR2_SDRAM" Saw this because not setting the MemoryType so defaulting to "Other" and had removed the logic to leave off all other memory properties when MemorySizeInKB is 0 (commit above). IBM systems are not setting MemorySizeInKB so it is defaulting to 0 hence why this validator error has not been seen in CI. The validator error was "ERROR - MemoryDeviceType: Invalid Enum value 'Other' found, expected ['DDR', 'DDR2', 'DDR3', 'DDR4', 'DDR4_SDRAM', 'DDR4E_SDRAM', 'LPDDR4_SDRAM', 'DDR3_SDRAM', 'LPDDR3_SDRAM', 'DDR2_SDRAM', 'DDR2_SDRAM_FB_DIMM', 'DDR2_SDRAM_FB_DIMM_PROBE', 'DDR_SGRAM', 'DDR_SDRAM', 'ROM', 'SDRAM', 'EDO', 'FastPageMode', 'PipelinedNibble', 'Logical', 'HBM', 'HBM2']" https://github.com/openbmc/phosphor-dbus-interfaces/blob/1e8c11bf2656ed4a5fb27baa2dec3a65763bb47e/xyz/openbmc_project/Inventory/Item/Dimm.interface.yaml#L120 Tested: Passes the validator. Sent this property on D-Bus to different values. Change-Id: I629a1acd81fa6648893b7f531dfaab413cc2dd8f Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-10-23Turn on ALL perf checksEd Tanous1-1/+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-16Fix up Function to Populate collection MembersGunnar Mills1-2/+3
Added Doxygen comments, renamed the funciton, renamed several variables, and made more generic. Tested: Top commit passes validator and resources look good. Change-Id: I9a13176b7f4c8611ae38c6563b0e119e0f66edf2 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-10-16cpudimm.hpp: Separate Memory and Processor functionalityGunnar Mills1-0/+817
To match other files move Redfish Memory classes and functions to a separate memory.hpp file. This naming "memory" (after the Redfish schemas) matches other filenames. Do the same with Processor classes and functions, moving to a separate processor.hpp. cpudimm.hpp had grown to 1300+ lines. Makes development and review easier. Tested: Validator passes. Resources look the same. Change-Id: I7e23ecaf9b4b69cc72aad6d94ad3a555ee76b28a Signed-off-by: Gunnar Mills <gmills@us.ibm.com>