summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-03-07Simplify parse_registries.pyEd Tanous1-54/+72
When formatting blocks of code, there's a lot of redundant registry.write calls that obfuscate a lot of the intent. When handling whitespace, this also makes the code a level harder to read. This commit tries to avoid large blocks of registry.write entries, to make the code easier to read. Tested: ran parse_registries.py, and verified via git that it generates the same files as it did previously. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I77a885fe3eb0738e4bfb53cf321b20f691572f5b
2022-03-07Make generated warning more prominent and helpfulEd Tanous5-11/+40
A number of reviews have been submitted that ignore this warning. While we now have 01caf624211197a993dbbd186149293f7053f9d8 which will catch these violations at CI time, that is arguably already too late, and developers will have wasted their time. This commit changes the warning to be multiple lines, with a caps header, such that it's less likely to be ignored. It also adds suggestions on how to proceed. As a note, this also standardizes privilege registry to use the same warning as the other files, which it didn't previously. Tested: Comment changes only, no functional changes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I3224130dbf581dc962187b2fde4dc98ae26de082
2022-03-07Make parse_registries do whitespace properlyEd Tanous5-1591/+1479
Previously, parse_registries was not very careful about generating readable files, and relied on clang-format to "fix" them after the fact. Given they're generated, this is unforunate, and leads to some inconsistencies in reading the generated code. This commit changes the script to no longer rely on clang-format, and wrap the whole file in a clang-format off bracket. This means that our message registry generation will be consistent. As an added bonus, different versions of clang-format like to format these structures differently, so this removes one possible barrier to people updating these. This was initiated by the next patch in the series, which made a seemingly minor change to a comment, which caused a significant change in this file because of clang-format versioning. Tested: ran parse_registries.py and saw build passing. Whitespace changes only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Id48bb43dd9d8ecc83de1840f2f1045a87e2ff796
2022-03-07Remove a component word from base messageHardik Panchal1-4/+4
Removed "component" from base message because actual component name is defined from redfish message argument. Tested: 1. Redfish validator - passed for this new addition 2. Verified in Redfish, ComponentOverTemperature event logged properly. GET: https:/<BMC-IP>/redfish/v1/Systems/system/LogServices/EventLog/Entries { "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/ Entries/1646193775", "@odata.type": "#LogEntry.v1_8_0.LogEntry", "Created": "2022-03-02T04:02:55+00:00", "EntryType": "Event", "Id": "1646193775", "Message": "CPU 1 memory over temperature and being throttled.", "MessageArgs": [ "CPU 1 memory" ], "MessageId": "OpenBMC.0.1.ComponentOverTemperature", "Name": "System Event Log Entry", "Severity": "Critical" } Signed-off-by: Hardik Panchal <hardikx.panchal@intel.com> Change-Id: I17aa3b98b6f4c126c2a2d99d703349dc6d82b228
2022-03-04Fix the build for time_tEd Tanous1-5/+7
Current code doesn't build because of an error injected into a patch (ironically attempting to fix the build). Tested: Code compiles within yocto 32 bit, and out of yocto 64 bit. unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ibc4ea4617853bf717c10d812eb5d8a9352177f24
2022-03-03Fix clang warnings related to OpenSSL 1.xSzymon Dompke1-2/+2
When CI tests are run locally on machine without OpenSSL 3.0, there are some warnings during clang-tidy scan. They are related to unsupported c-style code (implicit bool/int conversion, casting, and varagrs functions). This change is fixing all of them, without changing functionality. Testing done: - running docker image with UTs on local Ubuntu machine with SSL 1.1 is passing all tests, and no clang errors are reported. Signed-off-by: Szymon Dompke <szymon.dompke@intel.com> Change-Id: I5ec91db8f02f487786811afad77080137bab3c9a
2022-03-02Fix constexpr on clangEd Tanous1-2/+5
clang correctly notes that this branch is impossible to hit on 32 bit systems, so wrap it in an if contexpr check to check for 32 bit, and avoid the next branch entirely. Tested: code compiles further on clang. Unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iccaab8402d839faa7c3f7cea457ef6bcba832f67
2022-03-02Use std::variantEd Tanous1-3/+2
When first committed, I had a misunderstanding of what dedup variant does. In this case, because we unpack all variants of 64/32 bit and int vs uint, so in this case, dedup variant doesn't do anything, and just adds template complexity. In terms of developer readability, std::variant is a c++ concept that is infinitely googlable, and not having to look it up through sdbusplus should be better. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia73b642fd06b24187503196bcdfecb9c896d62c9
2022-03-02Drive: Add MediaType, Capacity, and Protocol Resource for DriveWilly Tu1-0/+127
Populate the MediaType with DriveType to identify the Drive. - https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/44971 Populate the Capacity as the size in bytes of the Drive. - https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/46332 Populate the Protocol with DriveProtocol for the communication protocol types - https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/46333 Tested: Passed Redfish Validator with no new error. ``` *** /redfish/v1/Systems/system/Storage/storage0/Drives/drive0 Type (#Drive.v1_7_0.Drive), GET SUCCESS (time: 0.307086) PASS ``` ``` { "@odata.id": "/redfish/v1/Systems/system/Storage/storage0/Drives/drive0", "@odata.type": "#Drive.v1_7_0.Drive", "CapacityBytes": 250059350016, "Id": "drive0", "Manufacturer": "", "MediaType": "SSD", "Name": "drive0", "PartNumber": "", "Protocol": "SATA", "SerialNumber": "0", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" } } ``` Change-Id: I533eade92ec461b957f0c13eb69d06fead8b10f3 Signed-off-by: Willy Tu <wltu@google.com>
2022-03-02Add ManagerDiagnosticData schemaSui Chen6-1/+874
This change adds the ManagerDiagnosticData schema files. Tested: ran Redfish Service Validator: + Manager Diagnostic 2021.4 Data metadataNamespaces: 2388 2390 pass: 3249 3274 passAction: 8 8 passGet: 121 123 passRedfishUri: 115 117 skipNoSchema: 3 3 skipOptional: 2184 2198 warnDeprecated: 315 315 warningPresent: 11 11 Validation has: succeeded succeeded curl -k https://$bmc/redfish/v1/JsonSchema/ManagerDiagnosticData/\ ManagerDiagnosticData.json ... "title": "#ManagerDiagnosticData.v1_0_0.ManagerDiagnosticData" } Signed-off-by: Sui Chen <suichen@google.com> Change-Id: I0d86b45350475771acdd492a98018156f8c819dd
2022-03-01Remove flat_maps from our dbus parsing typesEd Tanous1-2/+2
There's nowhere in the codebase where we actually use these as maps. 99% of the time, we just iterate and pull these into specific data structures anyway, so there's no reason for them to be maps. This saves a negligible amount (600 bytes) on our compressed binary size. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I91085cfa2cf8d70e0f0fa0f2f3927776667d834f
2022-03-01json_utils: Add support for multiple level json readWilly Tu3-106/+255
Added support for multiple level direct read. For example, we can now access `abc/xyz` directly instead of getting `abc` and then abc[`xyz`]. For extra element error, it will only be triggered if the element at the root level is not a parent of any of the requested elements. For example, { "abc": { "xyz": 12 } } Getting "abc/xyz" will satisfy the condition so it does not throw an error. This is accomplished in a reasonable way by moving the previously variadic templated code to a std::span<variant> that contains all possible types. This is a trick learned from the fmt library to reduce compile sizes, as the majority of the code doesn't get duplicated at template level, and is instead operating on the fixed variant type. This commit drops 7316 bytes (about half a percent of total) from the bmcweb binary size from the reduction in template usage. Later patches build on this patchset to simplify call sites even more and reduce the binary size further, but as is, this is still a win. Note: now that the UnpackVariant lists all possible unpack types, it was found that readJson would fail to compile for vector<bool>. This is a well known C++ deficiency in the std::vector<bool> type when compared to all other types, and will need special handling in the future. The two types for vector<bool> are left commented out in the typelist. Tested: Unit tests passing with reasonable coverage. Functional use in next commit in this series. Change-Id: Ifb247c9121c41ad8f1de26eb4bfc3d71484e6bd6 Signed-off-by: Willy Tu <wltu@google.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2022-03-01Adds new redfish unit testing for servicerootJohn Edward Broadbent2-0/+79
This type of testing can validate bmcwebs generated redfish. The ability to validate the output of bmcweb is extremely useful because it will guarantee correctness in certain cases. This is an example of redfish unit testing. The long term goal is to apply this type of testing to several other redfish responses. To make this change many previous changes were needed * Break serviceroot callback into the free function. * Change ownership of the request and response objects. * Change setCompleteRequestHandler logic Signed-off-by: John Edward Broadbent <jebr@google.com> Change-Id: I324daef0d80eb86f0f7383663727d64776f45279
2022-03-01Change the completionhandler to accept ResNan Zhou6-53/+65
These modifications are from WIP:Redfish:Query parameters:Only (https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/47474). It will be used in future CLs for Query Parameters. The code changed the completion handle to accept Res to be able to recall handle with a new Response object. AsyncResp owns a new res, so there is no need to pass in a res. Also fixed a self-move assignment bug. Context: Originally submitted: https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/480020 Reveted here: https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/48880 Because of failures here: https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/48864 Tested: 1. Romulus QEMU + Robot tests; all passed 2. Use scripts/websocket_test.py to test websockets. It is still work correctly. 3. Tested in real hardware; no new validator errors; tested both authless, session, and basic auth. 4. Hacked codes to return 500 errors on certain resource; response is expected; 5. Tested Eventing, the push style one (not SSE which is still under review), worked as expected. 6. Tested 404 errors; response is expected. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Signed-off-by: John Edward Broadbent <jebr@google.com> Change-Id: I52adb174476e0f6656335baa6657456752a031be
2022-03-01Make the router const correctEd Tanous1-9/+12
Subtly, the individual members of a const std::pair are not implicitly const. In most cases, this is solved by a compiler error, but it seems that flat_map allows implicitly pulling out by a non const reference, even when the underlying container is const. This is not how the maps should work. This commit changes the router to declare a "ChildMap" type, which can then use the value_type to make this const correctness stuff more reasonable to manage. Tested: Code compiles. No-op const change. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Id99079a86e392a03416a69506934dbfff7bc3b29
2022-02-28Make the task match string more flexibleJason M. Bills1-54/+90
Instead of hardcoding the match string used for the task, this allows the match string to be set depending on the OEMDiagnosticDataType. Tested: Confirmed that the TaskMonitor still correctly updates when the collection task completes. Change-Id: Id079ae3f387e9a39f9e0ac74e36a7095b4999ea2 Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
2022-02-28Move error messages to string_viewEd Tanous4-336/+303
using std::string_view on these lets us call them in more contexts, and allows us to inline some previously more complex code. In general, for APIs like this, std::string_view should be preferred as it gives more flexibility in calling conventions. Tested: curl --insecure "https://localhost:18080/redfish/v1/AccountService/Roles/foobar" ✔ { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Role named 'foobar' was not found.", "MessageArgs": [ "Role", "foobar" ], "MessageId": "Base.1.11.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.11.0.ResourceNotFound", "message": "The requested resource of type Role named 'foobar' was not found." } } This is the same response as previously. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8ee17120c42d2a13677648c3395aa4f9ec2bd51a
2022-02-28Simplify message registry to save binary sizeEd Tanous1-714/+251
Internally to bmcweb, we actually store two copies of every string in the base privilege registry. As history played out, the error_messages.cpp was created first, then when logging was added, we needed more fine grained programatic lookups into the message registries, so we invented the constexpr array. Previously, it was thought that xz basically deduplicated the duplicated strings. While this is true to some extent, it using the actual processing code seems to be a win on binary size. This is also a -500 line diff, so it's reducing the amount of code we have at the same time. Note, the "InvalidUpload" message is incorrect per the standard, which this patchset sort of teases out, as it's the only one that can't be updated. This patchset leaves it as-written. Tested: xz compressed bmcweb went from 1174632 bytes, down to 1157040 bytes, or a 1.4% (17592 bytes) reduction in compressed binary size. curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/Chassis/foobar { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type #Chassis.v1_16_0.Chassis named 'foobar' was not found.", "MessageArgs": [ "#Chassis.v1_16_0.Chassis", "foobar" ], "MessageId": "Base.1.11.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.11.0.ResourceNotFound", "message": "The requested resource of type #Chassis.v1_16_0.Chassis named 'foobar' was not found." } } Note, the MessageId property has changed its version from Base.1.8 to Base.1.11. This is correct and matches the version of the registry we use. Also, the second argument is now quoted, as the ResourceNotFound schema requires. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ifd0bd71a26eebeba8ba89704a1eca425f0776aa8
2022-02-28websocket: fix authlessNan Zhou2-1/+4
We should check if session is nullptr before referencing its data member. Tested: 1. build authless BMCWeb ``` meson -Drest=enabled -Dbmcweb-logging=enabled -Dinsecure-disable-auth=enabled build && ninja -C build && ./build/bmcweb ``` 2. start websocket client without problems ``` python scripts/websocket_test.py --host localhost:18080 ``` 3. bmcweb log ``` [DEBUG "websocket.hpp":221] Websocket accepted connection [DEBUG "dbus_monitor.hpp":114] Connection opened [DEBUG "dbus_monitor.hpp":115] Connection 0x55b22d618670 opened [DEBUG "http_response.hpp":134] 0x55b22d611040 calling completion handler [DEBUG "dbus_monitor.hpp":129] Connection 0x55b22d618670 received {"paths": ["/xyz/openbmc_project/sensors"], "interfaces": ["xyz.openbmc_project.Sensor.Value"]} [DEBUG "dbus_monitor.hpp":231] Creating match type='signal',interface='org.freedesktop.DBus.Properties', path_namespace='/xyz/openbmc_project/sensors',member='PropertiesChanged', arg0='xyz.openbmc_project.Sensor.Value' [DEBUG "dbus_monitor.hpp":246] Creating match type='signal',interface='org.freedesktop.DBus.ObjectManager', path_namespace='/xyz/openbmc_project/sensors',member='InterfacesAdded' ``` Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I56613a26c129736f0e6980bb24e83f22ef60eea0
2022-02-28Clean up Crashdump log entry creationJason M. Bills1-52/+50
To avoid passing references to bad memory locations, we had to pre-build the array with empty entries so we could pass a reference to the array index without it changing later. This changes so the code that fills the log entry object checks if it's filling a single entry or an array entry and expands the array at that time. This simplifies filling the "Members" array in the Crashdump entry collection and avoids sending references to an array index. Tested: Confirmed that Crashdump LogEntries are correctly filled in the "Members" array of the collection and in the individual LogEntry. Change-Id: I4484e248b6d72fadbaedcbb27840cd46cfe3b323 Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
2022-02-28Add url type safety to message registryEd Tanous8-110/+156
There are a number of places where we use message registry messages incorrectly. This patchset attempts to fix them, and invoke some type safety when they're used such that they're more obvious to use. Namely, it changes a number of the message registry methods to accept a boost::urls::url_view for its argument instead of a const std::string&. This forces the calling code to correctly encode a URL to use the method, which should make it obvious that it's not for an ID, a property name, or anything else. In the course of doing this, several places were found to be using the first argument incorrectly. Tested: curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/Chassis/foobar Returns: { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type #Chassis.v1_16_0.Chassis named foobar was not found.", "MessageArgs": [ "#Chassis.v1_16_0.Chassis", "foobar" ], "MessageId": "Base.1.8.1.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.8.1.ResourceNotFound", "message": "The requested resource of type #Chassis.v1_16_0.Chassis named foobar was not found." } Identically to previously. Also tested with IDs that contained % encoded characters, like foobar%10, which gave the same result. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Icbb3bce5d190a260610087c9ef35e7becc5a50c7
2022-02-28Generate indexes for message registriesEd Tanous4-5/+150
Being able to index into the message registry constexpr arrays will be useful in the future, so update the parse_registries script to generate an Index enum class, that allows directly indexing into the constexpr table when necessary. These indexes are used in the patchset here: https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/50950 to avoid a binary search lookup for each entry. Tested: No-op change, code inspection only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I345cc26a2b17b5bcd8cfb0055642f4ae443caad4
2022-02-25scripts: websocket: make ssl optionalNan Zhou1-1/+8
Tested: The following command worked. ``` python scripts/websocket_test.py --host localhost:18080 --no-ssl ``` Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Ib14bd8ecdb5f0cad4a8e0478d69abcdc3e46c3ec
2022-02-25json_utils: Add support jsonRead Patch/ActionWilly Tu22-94/+361
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>
2022-02-25subproject: boost-url & boost: update revisionNan Zhou3-7/+7
Update the revision of boost-url to d740a92d38e3a8f4d5b2153f53b82f1c98e312ab as per https://github.com/openbmc/openbmc/blob/595f63084d313c9708cb435470e6c6dcbbbbe646/meta-openembedded/meta-oe/recipes-devtools/boost-url/boost-url_git.bb Update the release version of boost to 1.78.0, as per https://github.com/openbmc/openbmc/blob/595f63084d313c9708cb435470e6c6dcbbbbe646/poky/meta/recipes-support/boost/boost_1.78.0.bb and https://github.com/openbmc/openbmc-build-scripts/blob/ca8c4a8b9728714c9a07f7940a4d31b89c3ecf9f/scripts/build-unit-test-docker#L94 This is neccessary since the current bmcweb HEAD doesn't compile with the specified boost-url. This failure can be verified by cloning the repo on an x86 unix desktop without boost-url and let meson clone subprojects. Tested: 1. it compiled on an x86 unix desktop without boost-url and boost 2. yocto build also worked with this patch in Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Ib8356667b3fb74ae87c8bf32d21cd834ef061a47
2022-02-24Do not send duplicate data for ntp serversRadivoje Jovanovic1-1/+2
in the case where multiple network interfaces are present each interface will return the same ntp server data Tested: on the system that has multiple eth interfaces Signed-off-by: Radivoje Jovanovic <radivoje.jovanovic@intel.com> Change-Id: I642aae7a1c07f7629d696f177ddf326d25e36fb1
2022-02-23log_services: Un-wrap some stringsJason M. Bills1-94/+92
This unwraps the non-D-Bus strings in log_services.hpp. Signed-off-by: Jason M. Bills <jason.m.bills@intel.com> Change-Id: Iaf5e435fa11909d1bf3c65e373d994d755371e2f
2022-02-23Fix clang-tidy issues in nbd proxyEd Tanous1-1/+7
All changes done by the robot, and are trivial. Tested: Code passes clang-tidy. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I04a19bcc5ec74eddf9f3490adbdf70ac5a8bc68f
2022-02-23Update nbd_proxy for new ManagedObjectTypeJason M. Bills1-82/+68
This used to rely on the boost::flat_map find() to find the interface and properties. After the ManagedObjectType changed to a std::vector of std::pair it needs to loop instead of using find() Signed-off-by: Jason M. Bills <jason.m.bills@intel.com> Change-Id: I08d3f09dbfb5ad449aaa058a44d86f4c3eb1a25c
2022-02-23managers: populate the name correctly for PIDWilly Tu1-1/+1
The name was never set properly and is empty. All of the information are saved to the same location. Tested: Redfish Service Validator has issue from before ``` 6 exceptionPropCheck errors in /redfish/v1/Managers/bmc 2 exceptionPropCheck errors in /redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone_2 *** /redfish/v1/Managers/bmc ERROR - This complex object FanMode should be a dictionary or None, but it's of type <class 'str'>... ERROR - This complex object ZoneIndex should be a dictionary or None, but it's of type <class 'float'>... ERROR - This complex object FanMode should be a dictionary or None, but it's of type <class 'str'>... ERROR - This complex object ZoneIndex should be a dictionary or None, but it's of type <class 'float'>... ERROR - This complex object FanMode should be a dictionary or None, but it's of type <class 'str'>... ERROR - This complex object ZoneIndex should be a dictionary or None, but it's of type <class 'float'>... INFO - Type (Manager.v1_11_0.Manager), GET SUCCESS (time: 0:00:00.226048) INFO - Attempt 1 of /redfish/v1/UpdateService/FirmwareInventory/3199f4dc INFO - Response Time for GET to /redfish/v1/UpdateService/FirmwareInventory/3199f4dc: 0.01309930405113846 seconds. INFO - Attempt 1 of /redfish/v1/Chassis/AgoraV2 INFO - Response Time for GET to /redfish/v1/Chassis/AgoraV2: 0.0709426780231297 seconds. INFO - Attempt 1 of /redfish/v1/Managers/bmc/EthernetInterfaces INFO - Response Time for GET to /redfish/v1/Managers/bmc/EthernetInterfaces: 0.02456553210504353 seconds. INFO - Attempt 1 of /redfish/v1/Managers/bmc/NetworkProtocol INFO - Response Time for GET to /redfish/v1/Managers/bmc/NetworkProtocol: 0.12236760894302279 seconds. INFO - Attempt 1 of /redfish/v1/Managers/bmc/LogServices INFO - Response Time for GET to /redfish/v1/Managers/bmc/LogServices: 0.0062645250000059605 seconds. WARNING - SerialConsole: The given property is deprecated by revision: This property has been deprecated in favor of the SerialConsole property in the ComputerSystem resource. ERROR - FanMode: Could not finish check on this property ('str' object has no attribute 'get') ERROR - ZoneIndex: Could not finish check on this property ('float' object is not iterable) ERROR - FanMode: Could not finish check on this property ('str' object has no attribute 'get') ERROR - ZoneIndex: Could not finish check on this property ('float' object is not iterable) ERROR - FanMode: Could not finish check on this property ('str' object has no attribute 'get') ERROR - ZoneIndex: Could not finish check on this property ('float' object is not iterable) INFO - FAIL... INFO - ``` Before, ``` "FanControllers": { "": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanControllers/", "@odata.type": "#OemManager.FanController", "FFGainCoefficient": 0.006, "FFOffCoefficient": 0.0, "ICoefficient": 0.0, "ILimitMax": 0.0, "ILimitMin": 0.0, "Inputs": [ "fan0_tach", "fan1_tach" ], "OutLimitMax": 100.0, "OutLimitMin": 25.0, "Outputs": [ "fan0_pwm", "fan1_pwm" ], "PCoefficient": 0.0, "SlewNeg": 0.0, "SlewPos": 0.0, "Zones": [ { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone_0" } ] }, "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanControllers", "@odata.type": "#OemManager.FanControllers" }, ``` After, ``` "FanControllers": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanControllers", "@odata.type": "#OemManager.FanControllers", "pwm_1": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanControllers/pwm_1", "@odata.type": "#OemManager.FanController", "FFGainCoefficient": 0.006, "FFOffCoefficient": 0.0, "ICoefficient": 0.0, "ILimitMax": 0.0, "ILimitMin": 0.0, "Inputs": [ "fan0_tach", "fan1_tach" ], "OutLimitMax": 100.0, "OutLimitMin": 25.0, "Outputs": [ "fan0_pwm", "fan1_pwm" ], "PCoefficient": 0.0, "SlewNeg": 0.0, "SlewPos": 0.0, "Zones": [ { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone_0" } ] }, ... ``` Change-Id: Ia487feaaca060d53a173d1fe83a80472fe0f331d Signed-off-by: Willy Tu <wltu@google.com>
2022-02-22Make run() staticEd Tanous1-1/+1
clang correctly notes that this should be static, as it's not used outside the compile unit. Tested: code compiles with clang. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7c540fe74b9fce1f3e498fb75089a143c7af4581
2022-02-18chassis-state: no error in chassis if unavailableCarson Labrado1-0/+7
This is similar to commit https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/50799 from Andrew Geissler. getChassisState() can fail if the state information provided by xyz.openbmc_project.State.Chassis service is unavailable. We want bmcweb to still return the other chassis information regardless of if that service is running at the time. Applying that change to chassis allows the majority of the redfish chassis data to be returned and used by the client. Tested: - Verified that when xyz.openbmc_project.State.Chassis was unavailable, a call to redfish/v1/Chassis/{ChassisId} returned the available information rather than a 500 error Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I0446fac5ef362174d5ae2d082e1dc15eaf1c5875
2022-02-17Prepare for clang-tidy-14Ed Tanous4-10/+10
clang-tidy 14 now detects some more stuff that it couldn't before. These are all pretty reasonable and things that we enforce today. All changes were made by the robot. Tested: Code compiles and unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I880d714c97adc38a190472766fb922fbfb30e82a
2022-02-17Add message registry entry for Memhot eventJayaprakash Mutyala1-3/+14
Add "ComponentOverTemperature" event message entry in RedFish for Memhot monitor to log based on the MEMHOT pins. Tested: 1. Redfish validator - passed for this new addition 2. Verified in Redfish, ComponentOverTemperature event logged properly. GET: https:/<BMC-IP>/redfish/v1/Systems/system/LogServices/EventLog/Entries { "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/ Entries/1644553991", "@odata.type": "#LogEntry.v1_8_0.LogEntry", "Created": "2022-02-11T04:33:11+00:00", "EntryType": "Event", "Id": "1644553991", "Message": "CPU 1 component over temperature and being throttled.", "MessageArgs": [ "CPU 1" ], "MessageId": "OpenBMC.0.1.ComponentOverTemperature", "Name": "System Event Log Entry", "Severity": "Critical" } Signed-off-by: Hardik Panchal <hardikx.panchal@intel.com> Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Change-Id: I6f5f42111ae7db39a4618b2b1ba8c864f9f55824
2022-02-17Use (size() == 0) check for multi_bufferJason M. Bills1-1/+1
multi_buffer doesn't support empty(), so need to check for (size() == 0) instead. Signed-off-by: Jason M. Bills <jason.m.bills@intel.com> Change-Id: I98abaebc68e11d769da57d8e2c1ef54c94f64521
2022-02-15Move validateAndSplitUri to common utility headerEd Tanous3-48/+89
This function in practice looks like it has another use where the code is essentially the same. Move it to a header so it can be used by other things. And add unit tests to ensure it stays reliable. Tested: Unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I3343ba1aa9c0dd542fbb98628b7628cb0704fb3b
2022-02-15Enable readability-uppercase-literal-suffixEd Tanous5-7/+8
We only had a few violations of this; Fix them and enable the check. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I159e774fd0169a91a092218ec8dc896ba9edebf4
2022-02-15readability-static-accessed-through-instanceEd Tanous3-3/+4
We access std::string::npos through member variables in a couple places. Fix it. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I587f89e1580661aa311dfe4e06591ab38806e241
2022-02-15Enable readability-implicit-bool-conversion checksEd Tanous26-99/+109
These checks ensure that we're not implicitly converting ints or pointers into bools, which makes the code easier to read. Tested: Ran series through redfish service validator. No changes observed. UUID failing in Qemu both before and after. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1ca0be980d136bd4e5474341f4fd62f2f6bbdbae
2022-02-15Abstract fillMessageArgs and unit test itEd Tanous4-16/+51
EventService has a routine for taking a message registry entry and populate it with data. This ideally should be part of the message registry namespace, not EventService, as it could be useful to later patchsets. So break out the method, and write some unit tests to ensure that it can be relied upon in the future. Tested: Unit tests ran and passing. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I052d9492f306b63fb72cbf78286370ed0c477430
2022-02-15Regenerate generated code as part of the buildEd Tanous2-1/+10
There are a number of cases where people don't realize that the schemas are owned by Redfish, and that some of the generated files (registries, indexes) are in fact generated, and shouldn't be modified by hand. This commit forces a regeneration of all those files within Jenkins, each time we do a local build, then does a git diff to compare if the upstream schema files and generated files are different than what is checked in, it will print the diff immediately in the Jenkins build. This should hopefully give much faster feedback to users that their change needs to modify the right files. As part of this commit, we also need to take the version string out of clang-format. CI/the system should own the clang-format version. Related commit: https://gerrit.openbmc-project.xyz/c/openbmc/openbmc-build-scripts/+/51041] Tested: Ran script, build passed. Removed the schema fixes from patch series, saw build failed. Did the same with running the openbmc-build-scripts unit test script. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I17eb0e106be267e8dbba7053b0b07ec617893c86
2022-02-14Remove invalid base log messageEd Tanous3-45/+2
The redfish base registry does not include a definition of this message, which generating type-safe models has teased out. Replace the MutuallyExclusiveProperties message with two "PropertyValueConflict" messages. This seems like the closest thing, but in lieu of the things not being in the standard, this seems like the best compromise. Tested: curl --insecure -X POST --user root:0penBmc https://192.168.7.2/redfish/v1/EventService/Subscriptions -d '{"MessageIds":[""],"RegistryPrefixes":[""],"Destination":"","Protocol":""}' Returns: { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The property 'MessageIds' could not be written because its value would conflict with the value of the 'RegistryPrefixes' property.", "MessageArgs": [ "MessageIds", "RegistryPrefixes" ], "MessageId": "Base.1.8.1.PropertyValueConflict", "MessageSeverity": "Warning", "Resolution": "No resolution is required." } ], "code": "Base.1.8.1.PropertyValueConflict", "message": "The property 'MessageIds' could not be written because its value would conflict with the value of the 'RegistryPrefixes' property." } } Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1eaf4d06b6f5b85909392c48970e3f353af3a41e
2022-02-12account_service: Remove unused DbusInterfaceTypeJason M. Bills1-4/+0
DbusInterfaceType was replaced by dbus::utility::DBusInteracesMap. A grep of the code shows that DbusInterfaceType is not used, so we can safely remove it to avoid anyone using it in the future. Signed-off-by: Jason M. Bills <jason.m.bills@intel.com> Change-Id: I58ab451157186a90d946985a65ba965b3c8fad7c
2022-02-11Enable performance-no-int-to-ptr checkEd Tanous1-0/+1
We have no violations of this. Just turn on the check. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie27f5b99fc96b4e61c063bf7979697f3d738744a
2022-02-11Add readability-redundant-* checksEd Tanous22-44/+48
There's a number of redundancies in our code that clang can sanitize out. Fix the existing problems, and enable the checks. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie63d7b7f0777b702fbf1b23a24e1bed7b4f5183b
2022-02-11Change PcieType to PCIeTypeAnjaliintel-211-1/+1
In the patch: https://github.com/openbmc/bmcweb/commit/62cd45af311e7741064c114581ba34186d6e508c Mismatch of PCIeType from pcie.hpp to PCIeDevice_v1.xml.In function requestRoutesSystemPCIeDevice, PCIeType mentioned for PCIeInterface details, was written as PcieType but in PCIeDevice_v1.xml, property name is PCIeType which was giving error in the validator. Tested using RedfishServiceValidator: *** /redfish/v1/Systems/system/PCIeDevices Type (#PCIeDeviceCollection.PCIeDeviceCollection), GET SUCCESS (time: 1.35205) PASS *** /redfish/v1/Systems/system/PCIeDevices/S0B1D0 Type (#PCIeDevice.v1_4_0.PCIeDevice), GET SUCCESS (time: 1.290409) PASS *** /redfish/v1/Systems/system/PCIeDevices/S0B1D0/PCIeFunctions Type (#PCIeFunctionCollection.PCIeFunctionCollection), GET SUCCESS (time: 1.287055) PASS *** /redfish/v1/Systems/system/PCIeDevices/S0B1D0/PCIeFunctions/0 Type (#PCIeFunction.v1_2_0.PCIeFunction), GET SUCCESS (time: 1.336434) PASS *** /redfish/v1/Systems/system/PCIeDevices/S0B2D0 Type (#PCIeDevice.v1_4_0.PCIeDevice), GET SUCCESS (time: 1.282768) PASS *** /redfish/v1/Systems/system/PCIeDevices/S0B2D0/PCIeFunctions Type (#PCIeFunctionCollection.PCIeFunctionCollection), GET SUCCESS (time: 1.401044) PASS *** /redfish/v1/Systems/system/PCIeDevices/S0B2D0/PCIeFunctions/0 Type (#PCIeFunction.v1_2_0.PCIeFunction), GET SUCCESS (time: 1.286989) PASS *** /redfish/v1/Systems/system/PCIeDevices/S0B3D0 Type (#PCIeDevice.v1_4_0.PCIeDevice), GET SUCCESS (time: 1.331661) PASS Elapsed time: 0:01:17 Counter({'metadataNamespaces': 2337, 'skipOptional': 67, 'pass': 51, 'passGet': 8, 'serviceNamespaces': 4}) Validation has succeeded. Signed-off-by: Anjaliintel-21 <anjali.ray@intel.com> Change-Id: I134988f29c9db3462b54362104922e922f5c5b04
2022-02-10Fix Event Subscription URIGayathri Leburu1-1/+1
While performing GET on /redfish/v1/EventService/Subscriptions/ results in error 405 - Method not allowed. This commit fixes the subscription URI while registering the ROUTE i.e., during BMCWEB_ROUTE. TESTED : - GET on /redfish/v1/EventService/Subscriptions/ successfully returned all the list of subscribed events. Signed-off-by: Gayathri Leburu <gayathri.leburu@intel.com> Change-Id: I0edcfd8403e0178fe84d6b8328dabad71c4d5c98
2022-02-10Update schema pack to 2021.4Sui Chen42-204/+1434
Update the script to point to 2021.4. Tested: built for evb-ast2500, ran Redfish Service Validator: BASE 2021.4 metadataNamespaces: 2330 2388 pass: 3239 3249 passAction: 8 8 passGet: 120 121 passRedfishUri: 114 115 skipNoSchema: 3 3 skipOptional: 2180 2184 unverifiedAdditional.complex: 2 0 warnDeprecated: 315 315 warningPresent: 12 11 Validation has: succeeded succeeded Saw new schemas: curl -k https://$bmc/redfish/v1/JsonSchemas/Manager/Manager.json ... "title": "#Manager.v1_14_0.Manager" } Signed-off-by: Sui Chen <suichen@google.com> Change-Id: I6560ec010362df28e264d80452059b534b3f89ba
2022-02-09Enable readability-avoid-const-params-in-declsEd Tanous24-64/+71
This check involves explicitly declaring variables const when they're declared auto, which helps in readability, and makes it more clear that the variables are const. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I71198ea03850384a389a56ad26f2c4a48c75b148
2022-02-09Run update-schemas.pyEd Tanous4-7/+60
Apparently these are being edited by hand in some cases, which we should avoid where possible. Based on the contents, it seems pretty likely that 71b861b64bde714410c4fe94f1628a70cb6b17aa is the offending commit that missed checking in these new index files, and was likely editing things by hand. Tested: Redfish service validator passing. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I86f6c46e61139a85ece900a665bce6ac7795800f