summaryrefslogtreecommitdiff
path: root/redfish-core
AgeCommit message (Collapse)AuthorFilesLines
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-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-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 Tanous2-6/+6
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-15Move validateAndSplitUri to common utility headerEd Tanous1-48/+2
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 Tanous2-2/+2
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 Tanous1-1/+1
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 Tanous15-58/+64
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 Tanous3-15/+49
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-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-11Add readability-redundant-* checksEd Tanous13-34/+30
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-09Enable readability-avoid-const-params-in-declsEd Tanous14-53/+58
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-09Allow setting MinPasswordLength in AccountServicePaul Fertser1-3/+16
The MinPasswordLength property is writable according to the Redfish schema and phosphor-user-manager allows setting it, so implement the corresponding call. Tested: $ curl -k 'https://root:0penBmc@[fe80::5054:ff:fe12:3402%tap0]/redfish/v1/AccountService' -X PATCH -d '{"MinPasswordLength": 12}' { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "Successfully Completed Request", "MessageArgs": [], "MessageId": "Base.1.8.1.Success", "MessageSeverity": "OK", "Resolution": "None" } ] } $ curl -s -k 'https://root:0penBmc@[fe80::5054:ff:fe12:3402%tap0]/redfish/v1/AccountService' | jq .MinPasswordLength 12 root@qemuarm:~# grep cracklib /etc/pam.d/common-password password [success=ok default=die] pam_cracklib.so debug enforce_for_root reject_username minlen=12 difok=0 lcredit=0 ocredit=0 dcredit=0 ucredit=0 $ curl -k 'https://root:0penBmc@[fe80::5054:ff:fe12:3402%tap0]/redfish/v1/AccountService' -X PATCH -d '{"MinPasswordLength": 8}' { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "Successfully Completed Request", "MessageArgs": [], "MessageId": "Base.1.8.1.Success", "MessageSeverity": "OK", "Resolution": "None" } ] } $ curl -s -k 'https://root:0penBmc@[fe80::5054:ff:fe12:3402%tap0]/redfish/v1/AccountService' | jq .MinPasswordLength 8 root@qemuarm:~# grep cracklib /etc/pam.d/common-password password [success=ok default=die] pam_cracklib.so debug enforce_for_root reject_username minlen=8 difok=0 lcredit=0 ocredit=0 dcredit=0 ucredit=0 With https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-user-manager/+/50589 applied this doesn't silently ignore the value that is less than the lower limit and produces an error, the old value is preserved: $ curl -k 'https://root:0penBmc@[fe80::5054:ff:fe12:3402%tap0]/redfish/v1/AccountService' -X PATCH -d '{"MinPasswordLength": 7}' { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The request failed due to an internal service error. The service is still operational.", "MessageArgs": [], "MessageId": "Base.1.8.1.InternalError", "MessageSeverity": "Critical", "Resolution": "Resubmit the request. If the problem persists, consider resetting the service." } ], "code": "Base.1.8.1.InternalError", "message": "The request failed due to an internal service error. The service is still operational." } $ curl -s -k 'https://root:0penBmc@[fe80::5054:ff:fe12:3402%tap0]/redfish/v1/AccountService' | jq .MinPasswordLength 8 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Change-Id: I17e5aa6ca7825fcffbec3939d572bc7ccc01405b
2022-02-09Send push-style event only if EventService enabledsunharis_in2-6/+29
As per DMTF Redfish, if the event service is disabled, events are not expected to be posted to the existing subscribers This commit adds validation to check "ServiceEnabled" property while sending events. An additional check is made not to attempt sending events if there are no event subscribers at BMC Tested by: Using DMTF Redfish-Event-Listener script with some local modification to support the latest event subscription specifications 1. With a Push-style event subscriber setup, set "ServiceEnabled" to false PATCH /redfish/v1/EventService -d '{"ServiceEnabled":false}' 2. Generate events and check no events are posted to subscriber 2. Set "ServiceEnabled" to true. BMC should resume sending further events 3. Check if BMC attempts to send events by forming the eventRecords when there are no subscriptions made - Verified with traces that events are not sent out 4. With "ServiceEnabled" set to false, verified the SubmitTestEvent fails Signed-off-by: Sunitha Harish <sunharis@in.ibm.com> Change-Id: Icbe7c25ba12bbfb73e59639c484fccdf384ebecf
2022-02-08Capture int by value in stringValueTooLongEd Tanous2-6/+4
Per the coding standard, we should be capturing this by int, not const int&. Tested: There are no uses of stringValueTooLong(), so noop change to binary. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Idfcb05c962e0a0d489db263a6f845bb1789b5842
2022-02-08Rerun parse_registries.pyEd Tanous4-1634/+1332
After the last string wrapping rule change, we never re-ran the script to regenerate, which puts all of these strings on their own line. While this is non-ideal for reading comprehension, it's the rule we have at the moment, so we should be consistent. 12778e61c281b8f8c0f976dec225fb0c30edcb47 appears to have incorrectly checked in a bad version of the privilege registry, which this commit diffs out again. I have inspected https://redfish.dmtf.org/registries/Redfish_1.2.0_PrivilegeRegistry.json by hand, and verified that those overrides are not present. Tested: Whitespace changes only Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I517a7cf13eba2dfd3211491c08ecce69ee68257f
2022-02-07Enable readability-redundant-control-flow checksEd Tanous7-23/+2
These checks are a nice addition to our static analysis, as they simplify code quite a bit, as can be seen by this diff being negative lines. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I60ede4ad23d7e5337e811d70ddcab24bf8986891
2022-02-07Enable readability-named-parameter checksEd Tanous6-32/+16
We don't have too many violations here, probably because we don't have many optional parameters. Fix the existing instances, and enable the check. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I4d512f0ec90b060fb60a42fe3cd6ba72fb6c6bcb
2022-02-04Remove NEW_BOOST_URL macroEd Tanous2-107/+1
Now that the subtree update is done, this define is no longer needed. Tested: Code compiles. Noop. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Idc5d7ef69c009982a2476fadc1d95e3280bfff48
2022-02-04Remove getTimestampEd Tanous1-41/+18
The aforementioned function is only used in the log services, and is used incorrectly in that context. This commit replaces it with the correct (and unit tested) getDateTimeUintMs, which is what we should be using for dbus->time conversions in all cases, to avoid time_t overflows when static casting. Tested: Before "Created": "2022-01-31T19:39:58+00:00", "Modified": "2022-01-31T19:39:58+00:00", With change: "Created": "2022-01-31T19:39:58.101000+00:00", "Modified": "2022-01-31T19:39:58.101000+00:00", The Redfish validator is okay with this *** /redfish/v1/Systems/system/LogServices/EventLog/Entries/1000 Type (LogEntry.v1_8_0.LogEntry), GET SUCCESS (time: 0) PASS Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie8a2243230ee080d9e8785ae918fad1b1b6ab145
2022-02-02Next round of boost-uri updatesEd Tanous2-0/+99
Boost url has changed some APIs again. This commit updates our URIs to handle it. As part of this work, it also removes some of the debug prints that were put in early on. These aren't really needed these days. This commit invents a temporary #define of NEW_BOOST_URL, so we can get through the subtree update without a hard dependency on this specific version of bmcweb. Ideally boost-url would have some version field, but unfortunately, it is thusfar unversioned, as the long term intent of the author is to be included in boost, and would be versioned there. All the code within the else of the NEW_BOOST_URL flag will be removed once the subtree update is landed. Tested: Added CXXFLAGS:append = " -DNEW_BOOST_URL" to the recipe and checked out on top of the subtree update, and build succeeded. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie2064e45efbc4331bdc5a5ddf44d877cde5e13cb
2022-02-01host-state: do not return anything if unavailableAndrew Geissler1-1/+8
The host state information is provided by the xyz.openbmc_project.State.Host service. There is no guarantee that this service will be up and running by the time bmcweb needs it. Returning an InternalError simply because a service is not yet running is not very user friendly to our clients. In most situations, a client will ignore all data returned when a 500 is returned. Instead of putting systemd Wants/Before type relationships on everything possibly needed by bmcweb, the design point is to simply return what bmcweb can get at that instant in time. With this change, the majority of the redfish system object data can be returned and used by the client. This scenario has been seen a few times on our p10bmc machine. Tested: - Verified that when xyz.openbmc_project.State.Host was unavailable, a call to redfish/v1/Systems/system returned what was available without error. - Verified that redfish validator passed - Verified that redfish validator passed when xyz.openbmc_project.State.Host.service was unavailable Change-Id: I22c6942d2c81083bf90fa4180e95b1fa19221374 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2022-01-28Enable readability-container-size-empty testsEd Tanous18-45/+45
This one is a little trivial, but it does help in readability. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I5366d4eec8af2f781b3bad804131ae2eb806e3aa
2022-01-26Implement Cable schemaShantappa Teekappanavar3-1/+190
This commit implements Cable and Cable collection schema on bmcweb. Testing: Validator: @odata.id /redfish/v1/Cables odata Exists PASS @odata.type #CableCollection.CableCollection odata Exists PASS Members@odata.count 2 odata Exists PASS Members Array (size: 2) links: Cable Yes ... Members[0] Link: /redfish/v1/Cables/dp0_cable0 link: Cable Yes PASS Members[1] Link: /redfish/v1/Cables/dp0_cable1 link: Cable Yes PASS Description Collection of Cable Entries none Yes PASS Name Cable Collection none Yes PASS Oem - Resource.Oem No Optional Property Name Value Type Exists Result @odata.id /redfish/v1/Cables/dp0_cable0 odata Exists PASS @odata.type #Cable.v1_0_0.Cable odata Exists PASS CableType string Yes PASS LengthMeters - number No Optional Id dp0_cable0 none Yes PASS Name Cable none Yes PASS Property Name Value Type Exists Result @odata.id /redfish/v1/Cables/dp0_cable1 odata Exists PASS @odata.type #Cable.v1_0_0.Cable odata Exists PASS CableType string Yes PASS LengthMeters - number No Optional Id dp0_cable1 none Yes PASS Name Cable none Yes PASS Note: Removed some of the fields that are optional to reduce commit msg Tesing with Curl commands: $ curl -k -X GET https://{$bmc}/redfish/v1/Cables { "@odata.id": "/redfish/v1/Cables", "@odata.type": "#CableCollection.CableCollection", "Description": "Collection of Cable Entries", "Members": [ { "@odata.id": "/redfish/v1/Cables/dp0_cable0" }, { "@odata.id": "/redfish/v1/Cables/dp0_cable1" } ], "Members@odata.count": 2, "Name": "Cable Collection" } $ curl -k -X GET https://{$bmc}/redfish/v1/Cables/dp0_cable0 { "@odata.id": "/redfish/v1/Cables/dp0_cable0", "@odata.type": "#Cable.v1_0_0.Cable", "CableType": "", "Id": "dp0_cable0", "Name": "Cable" } $ curl -k -X GET https://{$bmc}/redfish/v1/Cables/dp0_cable1 { "@odata.id": "/redfish/v1/Cables/dp0_cable1", "@odata.type": "#Cable.v1_0_0.Cable", "CableType": "", "Id": "dp0_cable1", "Name": "Cable" } Set Length property to 1.5 meters using busctl, and check the properties busctl set-property xyz.openbmc_project.Inventory.Manager \ /xyz/openbmc_project/inventory/cables/dp0_cable0 \ xyz.openbmc_project.Inventory.Item.Cable Length d 1.5 $ curl -k -X GET https://{$bmc}/redfish/v1/Cables/dp0_cable0 { "@odata.id": "/redfish/v1/Cables/dp0_cable0", "@odata.type": "#Cable.v1_0_0.Cable", "CableType": "", "Id": "dp0_cable0", "LengthMeters": 1.5, "Name": "Cable" } Signed-off-by: Shantappa Teekappanavar <sbteeks@yahoo.com> Change-Id: I832ff1c1053f4d8100d04a42cc8046a61e8c1613
2022-01-20EthernetInterfaces:GET & PATCH support for MTUSizeTejas Patil1-2/+39
This commit add support for MTUSize property with GET and PATCH methods under Redfish URI "/redfish/v1/Managers/bmc/EthernetInterfaces/<id>". This property shows the maximum size of the Protocol Data Uint (PDU) in bytes, that can be passed in an Ethernet frame on the network interface. User can GET and SET the MTU Size of any available network interface. The backend implementation for this is committed to below link https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-networkd/+/455591 Testing: - Redfish Validator Test Passed. - curl -k -H "X-Auth-Token: $token" -X PATCH -d '{"MTUSize" : 1280}' https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/eth3 - curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/eth3 { "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth3", "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface", "DHCPv4": { "DHCPEnabled": true, "UseDNSServers": true, "UseDomainName": true, "UseNTPServers": true }, "DHCPv6": { "OperatingMode": "Stateful", "UseDNSServers": true, "UseDomainName": true, "UseNTPServers": true }, "Description": "Management Network Interface", "FQDN": "evb-ast2600", "HostName": "evb-ast2600", "IPv4Addresses": [ { "Address": "10.0.126.64", "AddressOrigin": "DHCP", "Gateway": "10.0.120.1", "SubnetMask": "255.255.248.0" } ], "IPv4StaticAddresses": [], "IPv6AddressPolicyTable": [], "IPv6Addresses": [ { "Address": "4001:df24:df25:df26:a069:c2ff:fe62:1c52", "AddressOrigin": "DHCPv6", "AddressState": null, "PrefixLength": 64 }, { "Address": "fe80::a069:c2ff:fe62:1c52", "AddressOrigin": "LinkLocal", "AddressState": null, "PrefixLength": 64 }, { "Address": "1001:7:7:7:a069:c2ff:fe62:1c52", "AddressOrigin": "DHCPv6", "AddressState": null, "PrefixLength": 64 } ], "IPv6DefaultGateway": "0:0:0:0:0:0:0:0", "IPv6StaticAddresses": [], "Id": "eth3", "InterfaceEnabled": true, "LinkStatus": "LinkUp", "MACAddress": "a2:69:c2:62:1c:52", "MTUSize": 1280, "Name": "Manager Ethernet Interface", "NameServers": [ "10.0.0.31", "10.0.0.32" ], "SpeedMbps": 0, "StaticNameServers": [], "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "VLANs": { "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth3/VLANs" } } Signed-off-by: Tejas Patil <tejaspp@ami.com> Change-Id: I8f55b3b5016503baecb7b85784d1a8bece69a258
2022-01-20Fix undefined property in PCIeFunctionCollectionJiaqing Zhao1-1/+1
According to Redfish spec, current "PCIeFunctions@odata.count" in PCIeFunctionCollection should be "Members@odata.count". Tested: Redfish validator passed. Change-Id: Iaabcad0f19b619eea26e2902944d3262fe499a5b Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2022-01-20managers: Fix incorrect property name for "Class"Lei YU1-1/+1
The commit 711ac7a9 introduces a bug in redfish-core/lib/managers.hpp that it uses the incorrect property name when getting "Class"'s value. This results in HW CI error that is related to /redfish/v1/Managers/bmc, and manually access this URI results in 500 InternalError. Tested: Verify the /redfish/v1/Managers/bmc URI is OK and the HW CI passes. Signed-off-by: Lei YU <yulei.sh@bytedance.com> Change-Id: Ieb8f98b6cfee6aa22a0320d2410a9b96c536c080
2022-01-19Include what you useEd Tanous5-1/+13
Do a partial update from the include what you use tool. While ideally we'd be able to do this as part of CI, there's still quite a bit of noise in the output that requires manual intervention. Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iaaeb7a9199f64b5d6913c3abab4779b252768ed8
2022-01-18bmcweb: Add/Move common typedefs to dbus utilityShantappa Teekappanavar1-15/+8
The following typedefs that are commonly used by redfish services to get dbus subtree objects: MapperServiceMap = std::vector<std::pair<std::string, std::vector<std::string>>> MapperGetSubTreeResponse = std::vector<std::pair<std::string, MapperServiceMap>> This commit adds the above mentioned typedefs to dbus utility namespace and removes locally defined typedefs in processor.hpp. Testing: Validator: No errors Few sample outputs from curl command: $ curl -k -X GET https://{$bmc}/redfish/v1/Systems/system/Processors { "@odata.id": "/redfish/v1/Systems/system/Processors", "@odata.type": "#ProcessorCollection.ProcessorCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu0" }, { "@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu1" }, { "@odata.id": "/redfish/v1/Systems/system/Processors/dcm1-cpu0" }, { "@odata.id": "/redfish/v1/Systems/system/Processors/dcm1-cpu1" } ], "Members@odata.count": 4, "Name": "Processor Collection" } $ curl -k -X GET https://{$bmc}/redfish/v1/Systems/system/Processors/dcm0-cpu0 { "@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu0", "@odata.type": "#Processor.v1_12_0.Processor", "Id": "dcm0-cpu0", "Location": { "PartLocation": { "ServiceLabel": "U78DA.ND0.WZS004K-P0-C15" } }, "LocationIndicatorActive": false, "Manufacturer": "", "MaxSpeedMHz": 0, "Model": "5C67", "Name": "PROCESSOR MODULE", "PartNumber": "03JM290", "ProcessorId": { "EffectiveFamily": "" }, "ProcessorType": "CPU", "SerialNumber": "YA3936061828", "Socket": "", "SparePartNumber": "F210110", "Status": { "Health": "OK", "State": "Enabled" }, "SubProcessors": { "@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu0/SubProcessors" }, "TotalCores": 8, "TotalThreads": 0 } $ curl -k -X GET https://{$bmc}/redfish/v1/Systems/system/Processors/dcm0-cpu0/SubProcessors { "@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu0/SubProcessors", "@odata.type": "#ProcessorCollection.ProcessorCollection", "Members": [], "Members@odata.count": 0, "Name": "SubProcessor Collection" } Signed-off-by: Shantappa Teekappanavar <sbteeks@yahoo.com> Change-Id: I297c763af38fa5b13ef297e911b338f406b7c6e6
2022-01-13Simplify Crashdump file transferJason M. Bills1-15/+4
This changes to a streambuf_iterator to read the file contents into the response body. It may be slightly slower, but it's easier to read and has less opportunity for errors. Tested: Confirmed that a Crashdump file can be successfully downloaded through Redfish using a browser. Change-Id: Ic143fe4274678e89330bf354d1b8098550e8b85b Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
2022-01-13Fix 32/64 bit compile issueEd Tanous1-1/+3
It turns out std::string, std::fstream::read, and std::ifstream::tellg all use different integer types, which differ depending on 32 vs 64 bit. This is similar to the problem we already had, just now the compiler is warning us. Wrap in a static_cast to make sure it builds for all environments. Tested: Code compiles in 32 bit. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie8fd610812fd2271e6be599dacca583747b9217f
2022-01-12Fix regresssion in nameEd Tanous1-1/+1
It's unclear whether clang-format lost its mind, or if I did this unintentionally, but it's clearly wrong, and for systems that have sensors in warning, causes a ERROR - Health: Value wARNING Enum not found in ['OK', 'Warning', 'Critical'] error in the service validator. Fix this. Tested: Code compiles, revert. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: If79654fd7026080c89de0ece2c553e6edf97fd8f
2022-01-12Enable pro-type-static-cast-downcast checksEd Tanous1-10/+3
We only had one usage, and it was really bad and breaking const correctness, so fix it to read the crashdump in inline. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I234946fe09d73a9fa0191a15a89d0b2c26f32337
2022-01-12Enable const_cast checksEd Tanous1-0/+1
const_cast is an anti pattern. There are a few places we need to do it for interacting with C APIs, so enable the checks, and ignore the existing uses. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: If1748213992b97f5e3e04cf9b86a6fcafbb7cf06
2022-01-12Enable pointer devolution checksEd Tanous1-3/+8
Enable cpp core guidelines checks for pointer deevolution. For the moment, simply ignore the uses, although ideally these should be cleaned up at some point. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I9a8aae94cc7a59529eab89225a37e89628c17597
2022-01-12Enforce variable initEd Tanous3-6/+7
There were a few places we weren't initting our variables per cpp core guidelines. Fix all of them, and enable checks for this. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iba09924beb9fb26f597ff94d1cecbd6d6b1af912
2022-01-12Enable checks for pointer arithmeticEd Tanous1-2/+9
Quite a few places we've disobeyed this rule, so simply ignore them for now to avoid new issues popping up. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I3e518a8e8742279afb3ad1a9dad54006ed109fb1
2022-01-12Enable reinterpre_cast checksEd Tanous1-8/+9
We seem to use reinterpret cast in a few cases unfortunately. For the moment, simply ignore most of them, and make it so we don't get more. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic860cf922576b18cdc8d51d6132f5a9cbcc1d9dc
2022-01-12Enable cppcoreguidelines-special-member-functions checksEd Tanous9-0/+43
Part of enforcing cpp core guidelines involves explicitly including all constructors required on a non-trivial class. We were missing quite a few. In all cases, the copy/move/and operator= methods are simply deleted. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie8d6e8bf2bc311fa21a9ae48b0d61ee5c1940999
2022-01-12Enable init checkerEd Tanous6-13/+13
clang-tidy added cppcoreguidelines-init-variables as a check, which is something we already enforce to some extent, but getting CI to enforce it will help reviews move faster. Tested: Code compiles. Noop changes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7e10950de617b1d3262265572b1703f2e60b69d0
2022-01-12Enable bugprone widening checks in clangEd Tanous1-1/+2
Most of the errors we hit are simply places we need to explicitly increase the width of the integer. Luckily, these are few and far between. Tested: Code compiles, unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I617d87f3970ae773e0767bb2f20118fca2e71daa
2022-01-12enable bugprone exception escape checkEd Tanous1-1/+14
clang-13 includes new checks, and finds some issues. The first is that the boost::vector constructor can possibly throw, so replace the underlying flat_map container with std::vector instead. The others are places where we could possibly throw in destructors, which would be bad. Ideally we wouldn't use the destructor pattern, but that would be non-trivial to clean up at this point, so just catch the exception, and log it. At the same time, catch exceptions thrown to main and log them. Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I77b86eaa2fc79e43d1ca044c78ca3b0ce0a7c38c
2022-01-12Enable clang-tidy forward reference checksEd Tanous5-22/+33
Clang-13 adds new checks we can turn on, which find quite a few errors. Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I74b780760014c898cc440b37aea640b33e91c439
2022-01-12Fix seg fault in healthEd Tanous1-4/+4
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/49840 was recently checked in that made some changes here, and had issues that weren't caught on my system because of how my sensor setup is setup. This commit changes to only make a single copy, then filter the copy inplace, rather than make a copy, filter, then do the move. Tested: Ran redfish service validator in a similar setup to Romulus, and saw that it passed with the same failures as previously. Unit tested: curl --insecure -u root:0penBmc "https://192.168.7.2:443/redfish/v1/TaskService" now succeeds Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I5b59b7074e0a7aad4e95c5ddb625ff24170f3981
2022-01-11Fixed timestamp in telemetry serviceKrzysztof Grobelny1-2/+2
Telemetry service is using timestamp with milliseconds accuracy. Bmcweb code assumed that timestamp is in seconds which produced a bad result. This patchset updates the APIs, and adds a getDateTimeUintMs method, which can be used to convert a millisecond timestamp into a string. In the future, this can be used to get more precision out of the API. Reference: '9.4.3. Date-Time values' https://www.dmtf.org/sites/default/files/standards/documents/DSP0266_1.8.0.pdf Tested: - Telemetry service timestamp show correct timestamp with milliseconds precission. Example: 2022-01-11T13:06:58.648000+00:00 - Other timestamps in bmcweb did not change - All unit tests are passing Reference: Properties.Readings https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Telemetry/Report.interface.yaml Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I5b40ef6889b5af8c045ec0d35a758967e53dbed2
2022-01-10Enforce const correctnessEd Tanous8-33/+36
For all async calls, we should be consistently capturing non trivial objects by const reference. This corrects bmcweb to be consistent and capture errors by const value, and objects by const reference. Tested: Code compiles. Trivial changes. This saves about 300 bytes on our compressed binary size. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib3e0b6edef9803a1c480701556949488406305d4