summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-03-16Update boost 1.83->1.84Ed Tanous2-5/+5
This is the same version yocto uses. Tested: Code compiles Change-Id: I3bf7be18ecd0e5863ab8afd57748f918837ba5a3 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-16Fix PID Zone interface namePavanKumarIntel1-1/+1
The interface name is being loaded incorrectly which causes the DBus call to fail resulting in Internal server error. This commit changes the interface to the correct name. This is a regression caused by ea2b670d306d85d6975b6174024985491af04a89 TESTED: - PATCH /redfish/v1/Managers/bmc with below body succeeded { "Oem": { "OpenBmc": { "Fan": { "FanZones": { "Left": { "MinThermalOutput": 30.0 } } } } } } Change-Id: I0bcf858cd541dc11e802431ad983954a57d8c790 Signed-off-by: PavanKumarIntel <pavanx.kumar.martha@intel.com>
2024-03-15Remove link from Chassis to PCIeDeviceSunny Srivastava2-4/+0
The commit removes current support that assumes 1:1 system:Chassis for Chassis/PCIeDevices. Current implementation populates the same collection of PCIeDevices with chassis and with system. Since the path is /redfish/v1/Systems/system/PCIeDevices and we already have a link from /redfish/v1/Systems/system/, removing the link here in Chassis. The link from Chassis to /redfish/v1/Systems/system/PCIeDevices is unexpected. For systems with multiple chassis the current assumption does not hold true. It breaks there, as it assumes all PCIeDevices are in all Chassis. This is just a link and since another link from system resource already exists. The case of walking the whole tree isn't broke. And so, this should not break clients. Validator has been executed with no new errors. Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com> Change-Id: Id3af01ec99708c36b5fff2a63f04ffd722f6c3a2 Signed-off-by: Alpana Kumari <alpankum@in.ibm.com>
2024-03-13Fix duplicated https:// in github linkEd Tanous1-1/+1
This link has been broken for a while. Fix it. Change-Id: I01bb10e5831f0128db0cd6d0be82ac610c2c1564 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-13Correct Actions/Manager.ResetToDefaults parameter nameKonstantin Aladyshev1-10/+21
According to the Redfish Data Model specification the correct parameter name for the '/Actions/Manager.ResetToDefaults' action is not 'ResetToDefaults' but 'ResetType'. The mistake was originally introduced in the commit "Redfish: Manager: ResetToDefault" (3e40fc742265c3ec1384e7e5994e62aed356331f). Change parameter name to match with the specification. Leave some support for the old parameter name to keep the compatibility with the old clients. Tested: The POST request /redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults with {"ResetType": "ResetAll"} body accepted successfully. Redfish validator passed. Change-Id: I6aab20314f85dbda16ad3758091de8822943b761 Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
2024-03-11fix usage of std::ranges::replace_copyAlexander Hansen1-0/+2
As hinted at in the usage example [1], the destination range must have sufficient size to contain the elements. If the destination range has size 0, then it will be empty after the function call. Then the "Name" property in powersupply json will be "" and there will only be one powersupply because of the deduplication code. Tested: Powersupplies appear as usual References: [1] https://en.cppreference.com/w/cpp/algorithm/ranges/replace_copy Change-Id: I81dd21a2dd6eb9b29a67007d6d6229d3a752690f Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
2024-03-08Fix behavior when service is missingEd Tanous1-2/+3
Fix regression as part of 33e1f122b740c5de679dc0350b5f41e8d975499f AllowedHostTransitions: look for on dbus I have no idea why checking against .value() matters here, but on systems that doesn't have this daemon present, checking against ec == instead of ec.value() == causes this to return 500. Loaded on qemu, without an implementation of AllowedValues. ``` curl -vvvv -k --user "root:0penBmc" -H "Content-Type: application/json" https://192.168.7.2/redfish/v1/Systems/system/ResetActionInfo ``` Now succeeds. Change-Id: I05758c3f9fd9d0f1c90830ba005c74bc6f874bd6 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-06Support PATCH on IPv6StaticDefaultGatewaysSunitha Harish1-14/+292
Currently there is no support to setting up the Static Default IPv6 gateway via redfish. This commit adds IPv6StaticDefaultGateways parameter to the ethernet interface, on which user can send PATCH request and setup the Static IPv6 gateway for the interface. Tested: GET https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<id> ``` "IPv6StaticDefaultGateways": [ { "Address": "2002:903:15F:325:9:3:29:1", "PrefixLength": 24 }, { "Address": "2002:90:15F:325:9:3:29:1", "PrefixLength": 24 } ], ``` PATCH https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<id> -d '{"IPv6StaticDefaultGateways": [{"Address": "2002:903:15F:325:9:3:29:1", "PrefixLength": 24}]}' PATCH https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<id> -d '{"IPv6StaticDefaultGateways": [{"Address": "2002:903:15F:325:9:3:29:1"}]}' PATCH https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<id> -d '{"IPv6StaticDefaultGateways": [{}, {"Address": "2002:903:15F:325:9:3:29:1","PrefixLength": 24}]}' PATCH https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<id> -d '{"IPv6StaticDefaultGateways": [null, {}]}' PATCH https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<id> -d '{"IPv6StaticDefaultGateways": [{"PrefixLength": 24}]}' --> this will return PropertyMissing error Redfish validator passed. Change-Id: If6aaa6981a9272a733594f0ee313873a09f67758 Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com> Signed-off-by: Ravi Teja <raviteja28031990@gmail.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-03-05redfish-schema: add ProtocolPatrick Williams5-0/+535
The Drive schema indirectly references Protocol, but it is missing from the schema list. Modify `update_schemas.py` to include it and run, checking in the results. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ic3adad00924d450d3b7062c94ec04fc26e4cc9b9
2024-03-05Sessions: Drop end / from odata.idGunnar Mills1-2/+2
Fix warnings around odata.id not matching. Was looking at old defects, and closed https://github.com/openbmc/bmcweb/issues/166 (closed since no longer see these warnings) but saw we have these warnings for sessions: ``` *** /redfish/v1/SessionService Attempt 1 of /redfish/v1/SessionService Response Time for GET to /redfish/v1/SessionService: 0.046112860552966595 seconds. /redfish/v1/SessionService @odata.id: Expected @odata.id to match URI link /redfish/v1/SessionService/ Type (SessionService.v1_0_2.SessionService), GET SUCCESS (time: 0:00:00.046476) Attempt 1 of /redfish/v1/SessionService/Sessions Response Time for GET to /redfish/v1/SessionService/Sessions: 0.005822769366204739 seconds. PASS *** /redfish/v1/SessionService/Sessions /redfish/v1/SessionService/Sessions @odata.id: Expected @odata.id to match URI link /redfish/v1/SessionService/Sessions/ Type (SessionCollection.SessionCollection), GET SUCCESS (time: 0:00:00.006165) ``` It looks like all other odata.ids don't end in a / https://github.com/search?q=repo%3Aopenbmc%2Fbmcweb%20odata.id&type=code Tested: NONE. Visual inspection only. Signed-off-by: Gunnar Mills <gmills@us.ibm.com> Change-Id: Ie1cde192a5774a86c96e6993c71e8b124c79739a
2024-03-05DHCP Conf: Fix UseDomainName configurationRavi Teja1-6/+26
This commit modifies to use DomainEnabled D-bus property Currently "UseDomainName" configuration is actually not controlling DomainName setting in the backend networkd and networkd. Networkd app does not have DomainName D-bus property implemented and wrong D-bus property is being used in the bmcweb. This fix make sure bmcweb uses DomainEnabled property and controls UseDomainName configuration. Here is backend networkd fix for DomainEnabled property https://gerrit.openbmc.org/c/openbmc/phosphor-networkd/+/69604 Tested by: Enabled DHCPv4 on one of the interface Enable/Disable UseDomainName Check if DHCP configured domain name configuration on BMC. Change-Id: I68b86d4107a17db921ec463f5660a58aaa1396e3 Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
2024-03-04AllowedHostTransitions: look for on dbusAndrew Geissler4-19/+245
Commit [1] introduced a new optional dbus property that OpenBMC developers can populate to define which redfish/v1/Systems/system/ResetActionInfo AllowableValues are. Look for that new property on dbus. If not found, hard code the previous values otherwise utilize the property to fill in the return value. Tested: - Put new property on dbus and confirmed Redfish API returned expected values: ``` curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Systems/system/ResetActionInfo { "@odata.id": "/redfish/v1/Systems/system/ResetActionInfo", "@odata.type": "#ActionInfo.v1_1_2.ActionInfo", "Id": "ResetActionInfo", "Name": "Reset Action Info", "Parameters": [ { "AllowableValues": [ "ForceOff", "PowerCycle", "Nmi", "On", "ForceOn", "ForceRestart", "GracefulRestart", "GracefulShutdown" ], "DataType": "String", "Name": "ResetType", "Required": true } ] } ``` - Did not run redfish validator as response was same as previous [1]: https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/68933 Change-Id: Iecece14e7ff55db98d96df71b106ecc9e3f0ac33 Signed-off-by: Andrew Geissler <geissonator@yahoo.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-03-01vscode: ignore directoryAndrew Geissler1-402/+18
Noticed that ".vscode" kept showing up on my "git status". We need to just put the dir without the * to have it ignore everything including the dir itself. Change-Id: I7260b5b3bbf680e74ba3234cd46c474338b0eed8 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2024-02-28Fix coredump on async method during validatePrivilegeMyung Bae1-1/+2
PATCH may cause bmcweb to coredump depending on timing of `validatePrivilege` execution. It is because `req' is captured as reference, and it may be cleared-up before async-call method completes. (This problem can be seen more frequently by enabling debug mode). This commit is to keep `req` during to async-method execution. Tested: - Create a ReadOnly user - here, called as `readonly` - Using `redfishtool`, run PATCH on `readonly` user role. ``` $ redfishtool -vvvvv raw -r ${bmc}:18080 -u ${user} -p ${password} -S Always PATCH /redfish/v1/AccountService/Accounts/readonly --data='{"RoleId":"Administrator"}' ... This sometimes fails because bmcweb coredump ``` After: ``` $ redfishtool raw -r ${bmc}:18080 -u ${user} -p ${password} -S Always PATCH /redfish/v1/AccountService/Accounts/readonly --data='{"RoleId":"Administrator"}' { "@odata.id": "/redfish/v1/AccountService/Accounts/readonly", "@odata.type": "#ManagerAccount.v1_7_0.ManagerAccount", ... } ``` Change-Id: I2a28d1743cfc0fbd9239f69dec5584b34c7ebe43 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2024-02-28Fix duplicated etag generationMyung Bae1-5/+0
bmcweb generates the duplicated etags on GET and it may cause the PATCH failure if etag is used - e.g. redfishtool.. This commit is to put only one Etag on http_response on GET. Tested: - Check the duplicated Etag on GET, and check it after fix Before: ``` $ curl -v -k -X GET https://admin:${password}@${bmc}:18080/redfish/v1/AccountService/Accounts/readonly ... < ETag: "D4B30BB4" < ETag: "D4B30BB4" ``` After: ``` $ curl -v -k -X GET https://admin:${password}@${bmc}:18080/redfish/v1/AccountService/Accounts/readonly ... < ETag: "D4B30BB4" ``` Change-Id: I5361919c5671b546181a26de792bc57de2c4f670 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2024-02-24Systems: Add support to read AllowedPowerModesChris Cain1-48/+85
Instead of hardcodeing the AllowedPowerModes property, the data will be read from dbus if it exists. If data is empty/not found, the property will be set to the default value: [ "MaximumPerformance", "PowerSaving", "Static" ] Tested on Rainier hardware and Validator passed When dbus property is empty, it will show default modes: ''' xyz.openbmc_project.Control.Power.Mode interface - - - .AllowedPowerModes property as 0 const .PowerMode property s "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance" emits-change writable "PowerMode": "MaximumPerformance", "PowerMode@Redfish.AllowableValues": [ "MaximumPerformance", "PowerSaving", "Static" ], "PowerRestorePolicy": "AlwaysOff", ''' When dbus property populated with 6 modes: ''' - xyz.openbmc_project.Control.Power.Mode interface - - - .AllowedPowerModes property as 6 "xyz.openbmc_project.Control.Power.Mode.PowerMode.BalancedPerformance" "xyz.openbmc_project.Control.Power.Mode.PowerMode.EfficiencyFavorPerformance" "xyz.openbmc_project.Control.Power.Mode.PowerMode.EfficiencyFavorPower" "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance" "xyz.openbmc_project.Control.Power.Mode.PowerMode.PowerSaving" "xyz.openbmc_project.Control.Power.Mode.PowerMode.Static" const .PowerMode property s "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance" emits-change writable "PowerMode": "MaximumPerformance", "PowerMode@Redfish.AllowableValues": [ "BalancedPerformance", "EfficiencyFavorPerformance", "EfficiencyFavorPower", "MaximumPerformance", "PowerSaving", "Static" ], "PowerRestorePolicy": "AlwaysOff", ''' When dbus property not defined it will show default modes: ''' xyz.openbmc_project.Control.Power.Mode interface - - - .PowerMode property s "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance" emits-change writable "PowerMode": "MaximumPerformance", "PowerMode@Redfish.AllowableValues": [ "MaximumPerformance", "PowerSaving", "Static" ], "PowerRestorePolicy": "AlwaysOff", ''' Signed-off-by: Chris Cain <cjcain@us.ibm.com> Change-Id: Ic9882d2760a39dd1a0ea353624eb3c8575f4c6a0
2024-02-23manager_diagnostic_data: add metric getJagpal Singh Gill4-0/+247
Add support to fetch MemoryStatistics, FreeStorageSpaceKiB and ProcessorStatistics for Manager Diagnostic Data. https://redfish.dmtf.org/schemas/v1/ManagerDiagnosticData.v1_2_1.json This change is in relation to following design and D-Bus interface - https://gerrit.openbmc.org/c/openbmc/docs/+/64917 https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/64914 Test: Redfish query output - { "@odata.id": "/redfish/v1/Managers/bmc/ManagerDiagnosticData", "@odata.type": "#ManagerDiagnosticData.v1_2_0.ManagerDiagnosticData", "FreeStorageSpaceKiB": 3772, "Id": "ManagerDiagnosticData", "MemoryStatistics": { "AvailableBytes": 354224066, "BuffersAndCacheBytes": 78984633, "SharedBytes": 11876066, "TotalBytes": 425516000 }, "Name": "Manager Diagnostic Data", "ProcessorStatistics": { "KernelPercent": 13.0234, "UserPercent": 5.7374 }, "ServiceRootUptimeSeconds": 2255.117 } Redfish service validator passing - Elapsed time: 0:03:12 metadataNamespaces: 3726 pass: 5133 passAction: 9 passGet: 205 passRedfishUri: 197 skipNoSchema: 3 skipOptional: 3492 warnDeprecated: 4 warningPresent: 7 Validation has succeeded. Change-Id: I43758a993eb7f342cb9ac5f5574498b37261c2cc Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
2024-02-23Refactor to pass dbus error code to callerMyung Bae1-59/+102
The aux function `getValidFabricAdapterPath()` currently handles the error uniformly for all callers. This commit is to make the function to pass the error conddition to the caller so that it can be handled appropriately in the caller's context. Tested: - Check `resourceNotFound` is generated by caller. ``` $ curl -k -X GET https://${bmc}:18080/redfish/v1/Systems/system/FabricAdapters/badAdapter [WARNING fabric_adapters.hpp:270] Adapter not found ``` - Validator passes Change-Id: I37a61a3a79138aa898ab18332f58e3007496e302 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2024-02-21Chassis: Add support for Version propertyCarson Labrado1-0/+19
Add support for the Version property of Chassis resources. That property was added in Chassis schema v1.21.0. This makes use of the "xyz.openbmc_project.Inventory.Decorator.Revision" interface that is already defined by phosphor-dbus-interfaces. Tested: Validator passed and Version property was correctly populated. No issues on other Chassis resources which do not have a Version property. I added this to an entity-manager json config: "xyz.openbmc_project.Inventory.Decorator.Revision": { "Version": "$PRODUCT_VERSION" } The PRODUCT_VERSION field from a given FRU eeprom was picked up by FruDevice and it was exposed under the associated Chassis resource: busctl get-property xyz.openbmc_project.FruDevice \ /xyz/openbmc_project/FruDevice/Test \ xyz.openbmc_project.FruDevice PRODUCT_VERSION s "V1.0" curl -s 'localhost/redfish/v1/Chassis/TestChassis' { "@odata.id": "/redfish/v1/Chassis/TestChassis", ... "Version": "V1.0" } Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: Ie1391d46e81fd8c503fe4b1e6d683dd4553a5419
2024-02-21multi-host: give some more timePatrick Williams1-1/+1
Extend the deletion deadline until 9/1/2024 as Meta intends to have someone work on this feature shortly. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I3683aa3f04905c20fa7bb406dde54e549fdd2d8c
2024-02-21OWNERS: Update Gunnar's email addressGunnar Mills1-1/+1
I have multiple email addresses in my Gerrit account but as https://gerrit.openbmc.org/c/openbmc/bmcweb/+/69506 shows my Preferred email has to match the OWNERS file, do that. More discussion in Discord at [1] https://discord.com/channels/775381525260664832/817151035197358081/1209585278025601094 Change-Id: I94ba5bd8d9c2a3c23314aae051b3a083562e43cb Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-02-16Write unit tests for http2 connectionEd Tanous3-0/+224
This unit test currently only tests a simple connect and settings frame transfer, but should form the basis for more complex testing in the future. Tested: Unit tests pass Change-Id: Ieb803dbe490129ec5fe99fb3d4505a06202e282e Signed-off-by: Ed Tanous <ed@tanous.net>
2024-02-16Simplify HTTP/2 bufferingEd Tanous2-72/+46
Using the mem_send methods of nghttp2 can reduce the amount of buffering we need to do. This is recommended by the nghttp2 docs. Tested: Enabled experimental-http. Curl succeeds on /redfish/v1, and shows: * using HTTP/2 * [HTTP/2] [1] OPENED stream for https://localhost:18080/redfish/v1 Change-Id: I287d8c956f064d244116fac853055a17fca915a2 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-02-16Add unit tests for file bodyEd Tanous4-24/+168
File body needs some unit tests for managing the move constructors. Tested: Unit tests pass. Change-Id: Ia640aec75a6f3f85640a50f5dd492638871f9eca Signed-off-by: Ed Tanous <ed@tanous.net>
2024-02-16Simplify bodyEd Tanous10-379/+350
Now that we have a custom boost http body class, we can use it in more cases. There's some significant overhead and code when switching to a file body, namely removing all the headers. Making the body class support strings would allow us to completely avoid that inefficiency. At the same time, it would mean that we can now use that class for all cases, including HttpClient, and http::Request. This leads to some code reduction overall, and means we're reliant on fewer beast structures. As an added benefit, we no longer have to take a dependency on boost::variant2. Tested: Redfish service validator passes, with the exception of badNamespaceInclude, which is showing warnings prior to this commit. Change-Id: I061883a73230d6085d951c15891465c2c8445969 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-02-16Configure DHCP4 and DHCP6 parameters independentlyJishnu CM1-75/+117
At present, DHCP parameters like DNSEnabled, NTPEnabled and HostNameEnabled are at the system level at the network backend. It is common across both IPv4 and IPv6 network types. Thus when a redfish command is sent to enable the DNSEnabled property for IPv4 on eth0 interface, it internally sets the DNSEnabled to true for both IPv4 and IPv6 on eth0 and eth1. Here the change in parameter value for a non-requested network type in the non-requested interface might be an unexpected behaviour for the user. Also, with the current implementation in bmcweb and networkd, the user has no option to configure DHCP parameters differently for different interfaces and network types though it is supported by the redfish. With this change, the Redfish query for updating DHCP parameters will only modify the requested parameter for the specified network type and interface. User must make separate requests to modify the DHCP parameters as per the DMTF schema Current behavior: Request: curl -k -H "X-Auth-Token: $bmc_token" -X PATCH -d '{"DHCPv4":{"UseDNSServers":false}}' https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/eth0 Result: UseDNSServers value is set to false for DHCPv4 and DHCPv6 for all interfaces. After this commit: Request: curl -k -H "X-Auth-Token: $bmc_token" -X PATCH -d '{"DHCPv4":{"UseDNSServers":false}}' https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/eth0 Result: UseDNSServers value is set to false only for DHCPv4 only in eth0 as mentioned in the redfish request. The DHCP configuration was in the network manager level earlier, it has been moved to interface level with https://gerrit.openbmc.org/c/openbmc/phosphor-networkd/+/63124. This bmcweb change is to separate out the values for IPv4 and IPv6 and to move the dbus object to the interface level. Tested by: Patching the DHCP parameters with redfish request: curl -k -H "X-Auth-Token: $bmc_token" -X PATCH -d '{"<network_type>":{"<DHCP_param>":<value>}}' https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<interface_id> Verify the value is updated in the network configuration. Retrieve the DHCP parametrer value with the Get Request: curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<interface_id> Change-Id: I5db29b6dfc8966ff5af51041da11e5b79da7d1dd Signed-off-by: Jishnu CM <jishnunambiarcm@duck.com>
2024-02-08Systems: Add support for new eco power modesChris Cain1-11/+49
Add support for the following new power modes: - Efficiency Favor Performance - Efficiency Favor Power - Balanced Performance New modes were added in ComputerSystem schema to v1.22 Tested on Rainier and passed Validator ''' GET /redfish/v1/Systems/system: "@odata.type": "#ComputerSystem.v1_22_0.ComputerSystem", ... "PowerMode": "EfficiencyFavorPerformance", "PowerMode@Redfish.AllowableValues": [ "Static", "MaximumPerformance", "PowerSaving" ], PATCH -d '{ "PowerMode":"BalancedPerformance"}' https://$bmc/redfish/v1/Systems/system "PowerMode": "BalancedPerformance", PATCH -d '{ "PowerMode":"EfficiencyFavorPerformance"}' https://$bmc/redfish/v1/Systems/system "PowerMode": "EfficiencyFavorPerformance", PATCH -d '{ "PowerMode":"EfficiencyFavorPower"}' https://$bmc/redfish/v1/Systems/system "PowerMode": "EfficiencyFavorPower", PATCH -d '{ "PowerMode":"MaximumPerformance"}' https://$bmc/redfish/v1/Systems/system "PowerMode": "MaximumPerformance", PATCH -d '{ "PowerMode":"NotARealMode"}' https://$bmc/redfish/v1/Systems/system { "PowerMode@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The value '\"NotARealMode\"' for the property PowerMode is not in the list of acceptable values.", "MessageArgs": [ "\"NotARealMode\"", "PowerMode" ], "MessageId": "Base.1.13.0.PropertyValueNotInList", "MessageSeverity": "Warning", "Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed." } ] ''' Validator Results: ''' Type (ComputerSystem.v1_22_0.ComputerSystem), GET SUCCESS (time: 0:00:00.107269) ... PASS ... Elapsed time: 0:15:07 invalidPropertyValue: 62 metadataNamespaces: 4324 pass: 14323 passAction: 20 passGet: 1051 passRedfishUri: 1002 skipNoSchema: 3 skipOptional: 25582 unverifiedAdditional.complex: 21 warnDeprecated: 8 warningPresent: 83 warnings: 67 Validation has succeeded. ''' Change-Id: I56296a524b01d64adccad2d3da1757056900b6db Signed-off-by: Chris Cain <cjcain@us.ibm.com>
2024-02-08Enable redfish-new-powersubsystem-thermalsubsystemGunnar Mills1-4/+4
This is just the default, but enable redfish-new-powersubsystem-thermalsubsystem. As discussed on discord 4 companies enabled it upstream and I see a few more downstream forks enabling it as well. This does enable all sensors in the sensor collection, this is following Redfish as described in the new thermalSubsystem and powerSubsystem doc the sensor collection should contain all sensors that are associated with that chassis. [1] [1] https://redfishforum.com/thread/190/sensorcollection-contain-all-sensors-chassis Redfish release 2020.4 was the new powersubsystem, thermalsubsystem schemas. Redfish has continued to add to them, deprecate the old, and stated this is the new schemas are the future direction. Leave the old redfish-allow-deprecated-power-thermal alone (enabled), this allows for an easier client transition. Also, it would be best if the few outstanding new powersubsystem, thermalsubsystem children resources could get in first. Added a warning about disabling redfish-allow-deprecated-power-thermal in June 2024. Tested: See these APIs, a validator run with both of these enabled (average (2 runs) 6:06) and a validator run with just redfish-new-powersubsystem-thermalsubsystm (average 2 runs 5:52). 3.8% increase. I think this increase is worth it for the client compatibility. Change-Id: Ideb0f1999289b11b80ee0b8288e7ce53de0a7433 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-02-07Add StandbyOffline to Redfish sensor getStateMatt Simmering1-5/+28
Currently in Redfish a sensor's state will only be "Absent" or "Enabled". In the case where a sensor is marked as not available on D-Bus it would be more accurate and informative to have the state as "StandbyOffline". A sensor's availability will be published on its xyz.openbmc_project.State.Decorator.Availability interface. Tested on Intel system. Put sensors into an unavailable state by putting CPU into S5 power state, and verified that Redfish state is "StandbyOffline". Then when sensors are back in an available state their Redfish state is back to "Enabled". Change-Id: I4b846b678a0f90f60d182ac38f1becd21265cdd2 Signed-off-by: Matt Simmering <matthew.simmering@intel.com>
2024-02-06Make tests not require body interactionEd Tanous2-197/+231
The muitipart test interacts with some significant details of the response class. This was largely only done because Request lacked an addHeader method that Request already had. Add addHeader() method to the Request class, and adapt multipart unit tests to use it. Tested: Unit tests pass. Unit test only changes. Change-Id: Icb3b92dce6d17011ae0063a962678173b1b01a87 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-02-06Update gtest to 1.14.0Ed Tanous1-8/+14
This file is directly downloaded from wrapdb. Tested: Code compiles, unit tests pass. Change-Id: I2fb3dc7f89b9d39d31cc494533519196cfc401d1 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-02-01Bump Redfish schemas to 2023.3Gunnar Mills139-1853/+6474
Redfish released 2023.3 1/25/2024. https://www.dmtf.org/content/redfish-release-20233-now-available It is several new schemas and added properties to a pile of schemas. One use case is: ComputerSystem v1.22.0 Added EfficiencyFavorPower and EfficiencyFavorPerformance to PowerMode https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/69122 This is a one line change to scripts/update_schemas.py and then ran the script. Tested: See the new schema versions (e.g. System 1.22.0). No new Validator errors on p10bmc. Change-Id: I5c10d78e891da71fd14187f63aa6ac682cf15598 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-01-29Reformat scriptsEd Tanous1-3/+3
Change-Id: Ie8fb9f9733e75b887b14516cfa12f662aa5d3a82 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-01-23Implements ThermalMetrics schemazhanghch054-0/+103
The ThermalMetrics schema is a resource in Redfish version 2022.2[1]. It contains an array of temperature readings. It is a child of ThermalSubsystem schema[2] and it represents the thermal metrics of a chassis. Reading the current value of each temperature sensor and the corresponding link enumeration will be implemented in the next patch. This commit implements the Get and Head methods of the Redfish ThermalMetrics schema and implemented the basic information of Get. [1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0268_2022.2.pdf [2] https://redfish.dmtf.org/schemas/v1/ThermalMetrics.v1_0_1.json Test: 1. Validator passed. 2. doGet method: """ curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics", "@odata.type": "#ThermalMetrics.v1_0_1.ThermalMetrics", "Id": "ThermalMetrics", "Name": "Thermal Metrics", } """ 3. A bad chassis ID: """ curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassisBAD/ThermalSubsystem/ThermalMetrics { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Chassis named 'chassisBAD' was not found.", "MessageArgs": [ "Chassis", "chassisBAD" ], "MessageId": "Base.1.13.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.13.0.ResourceNotFound", "message": "The requested resource of type Chassis named 'chassisBAD' was not found." } } """ Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: Ib4182e7dc6e204371636a33a391e8e2a58dad113
2024-01-22Make use of filebody for dump offloadAbhilash Raju4-53/+354
Logservice has been rewritten to use file_body to offload dump files from BMC. There are two kind of dump files, BMC dump and System dump.While BMC dump just requires default support from beast::file_body, System dump requires base64 encoding support from beast. But beast::file_body do not have ready-made support for base64 encoding. So a custom file_body has been written for the base64 encoding. The openFile apis in crow::Response do not have support for unix file descriptor. Since dump files are accesses via descriptors, added new openFile api that accepts descriptors. Tested: Functionality test have been executed to verify the bmc dump offload. Did sanity test by invoking bmcweb pages via browser. Change-Id: I24192657c03d8b2f0394d31e7424c6796ba3227a Signed-off-by: Abhilash Raju <abhilash.kollam@gmail.com>
2024-01-22Make base64 encoder incrementalEd Tanous2-33/+126
As part of https://gerrit.openbmc.org/c/openbmc/bmcweb/+/67667, it would be desirable if we could incrementally encode base64 in chunks. Given that base64 encoding requires encoding 3 characters to 4, there's a possibility that a chunk might not be mod 3 length. This commit moves the base64 encoder into a class that can run incrementally. Tested: Unit tests pass. More tests in next commit. Change-Id: Ic7da3fd4db865c99fcbd96ae06fdecb87628f94c Signed-off-by: Ed Tanous <ed@tanous.net>
2024-01-19Remove some boost includesEd Tanous21-104/+145
The less we rely on boost, and more on std algorithms, the less people have to look up, and the more likely that our code will deduplicate. Replace all uses of boost::algorithms with std alternatives. Tested: Redfish Service Validator passes. Change-Id: I8a26f39b5709adc444b4178e92f5f3c7b988b05b Signed-off-by: Ed Tanous <edtanous@google.com>
2024-01-19Clean up tftp update to use URLEd Tanous3-51/+125
Similar to transforms we've done elsewhere, we shouldn't be parsing urls using std::string::find, regex, or anything else, as they don't handle URL % encoding properly. Change-Id: I48bb30c0c737c4df2ae73f40fc49c63bac5b658f Signed-off-by: Ed Tanous <edtanous@google.com>
2024-01-17Pass correct Argument Types to propertyValueIncorrect Error MessageGinu George3-11/+11
Changed the code to pass the parameters according to their types. Tested: Code Compiles properly and tested. Change-Id: Ie0e13d39cd892afda36dfabec871f0fe8d8498e4 Signed-off-by: Ginu George <ginugeorge@ami.com>
2024-01-16DBus REST: Fix array and dict handlingMikhail Zhvakin1-3/+3
The bmcweb DBus REST API cannot currently handle array or dictionary data types correctly. This commit is meant to fix that. Tested: get/set DBus attributes (consisting of array and/or dictionary) via bmcweb DBus REST API. Change-Id: I9694cb888375c90d7a8fb1a10e53bdb5c0bce3bb Signed-off-by: Mikhail Zhvakin <striker_1993@mail.ru>
2024-01-15redfish: Fix the property name to get EncryptionStatusKonda Reddy Kachana1-2/+2
Update the property name to get the EncryptionStatus correctly Tested: curl localhost/redfish/v1/.../emmc { "@odata.type": "#Drive.v1_7_0.Drive", "EncryptionStatus": "Unlocked", } Change-Id: Ie7b84caba1d2566c372805330353e708ec1b3c3d Signed-off-by: Konda Reddy Kachana <kkachana@google.com>
2024-01-09Fix spelling mistakesEd Tanous34-69/+83
These were found with: codespell -w $(git ls-files | grep "\.[hc]\(pp\)\?$") At some point in the future, we might want to get this enabled in CI. Change-Id: Iccb57b2adfd06a2e177e99db2923fe4e8e329118 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-01-09http_client: fix for broken connectionAbhilash Raju1-11/+37
http_client is not handling connection termination by server due to keep alive timeout. At present client is not aware of connection termination from server. So whenever next redfish is event ready to be sent, the client will try send/receives data over broken connection. After failed operation the client will try to restart the connection by closing the current connection. Problems: 1) Restart is not attempted on all failure paths. Eg: stream_truncated error was ignored, which usually happens when try to read from broken connection, due to which retry is never performed. 2) Ssl shutdown over broken connection often fails to call the shutdown callback 3) ssl session was reused for new connection attempt. Which is wrong Solution: This patch will try to reattempt the connection in all failure cases. It uses new socket object and new ssl session for the retries Tested by: Test normal event flow between redfish-event clients and the BMC Test failure event flow between redfish-event clients and the BMC Tested the bad path by keeping the setup idle for 3 hours on the above two setups. Verified the events flow after this idle time Change-Id: I3d725b9d77bea22e2e8860e01ee0dfc971789008 Signed-off-by: Abhilash Raju <abhilash.kollam@gmail.com> Signed-off-by: Ed Tanous <ed@tanous.net>
2023-12-25bmcweb: Add nullptr check for weakptrzhaogang.01081-0/+5
When we call a null weakptr, it will cause a crash. Add nullptr check for weakptr can avoid this situation. Tested: bmcweb.service did not experience core-dump. Change-Id: I4490d68c70ea5d43681f4fb18b3859afb01ed70a Signed-off-by: Zhao Gang <zhaogang.0108@bytedance.com>
2023-12-21Fix typo in collection.hppMyung Bae1-1/+1
Commit https://gerrit.openbmc.org/c/openbmc/bmcweb/+/64087 has a typo in redfish-core/include/utils/collection.hpp ``` L33: jsonCountKeyName /= back + "@data.count"; --> jsonCountKeyName /= back + "@odata.count"; ``` Tested: - Validator passes Change-Id: Ied52944bd43ec5080c4eef141813674bab1cc0b4 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-12-18Refactor PCIeDeviceList to use getCollectionMembersLakshmi Yadlapati4-48/+41
This commit refactors the code in the PCIeDeviceList function to use the getCollectionMembers function for retrieving collection members. Additionally, a new function getCollectionToKey() is added to handle the retrieval of collection members with custom key name. Tested: Validator passed ''' Test1: Redfish query of PCI devices on a system that does not have any PCIe devices curl -k https://$bmc/redfish/v1/Systems/system/PCIeDevices { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices", "@odata.type": "#PCIeDeviceCollection.PCIeDeviceCollection", "Description": "Collection of PCIe Devices", "Members": [], "Members@odata.count": 0, "Name": "PCIe Device Collection" } Test2: Redfish query of PCIe devices on a system that has PCIe devices curl -k https://$bmc/redfish/v1/Systems/system/PCIeDevices { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices", "@odata.type": "#PCIeDeviceCollection.PCIeDeviceCollection", "Description": "Collection of PCIe Devices", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/drive0" }, ....... { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card1" }, { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card2" }, ....... { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card12" } ], "Members@odata.count": 22, "Name": "PCIe Device Collection" } Test3: Redfish query of system with PCIe devices curl -k https://$bmc/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem", "Actions": { "#ComputerSystem.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Systems/system/ResetActionInfo", "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset" } }, ...... "PCIeDevices": [ { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/drive0" }, ....... { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card1" }, .... ], "PCIeDevices@odata.count": 22, "PartNumber": "", .... "SubModel": "S0", "SystemType": "Physical" } ''' Change-Id: Icb38945a2c7bc5219ff3917fbbc8a9986c9c6155 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-12-12Use MonotonicTimeStamp for bmc log idMyung Bae3-17/+131
/redfish/v1/Managers/bmc/LogServices/Journal/Entries gives the system journal entries whose ID is based on the realtime timestmap. However, the system realtime may go backward if the system time is changed either manually or via NTP. If that happens, those entries may not found via redfish GET as `sd_journal_seek_realtime_usec()`[1] may not always work on the entries which are not sorted in time-order. This may cause the inconsistency between the content of `/redfish/v1/Managers/bmc/LogServices/Journal/Entries/` and /redfish/v1/Managers/bmc/LogServices/Journal/Entries/<bmc_journal_id>`. For example, ``` sudo journalctl --vacuum-time=1s <wait for a while to clear up journal> date -s "<backward-time>" date -s "<forward-time>" ``` Run redfish journal entries and get each entry id from the output ``` curl -k -X GET https://${bmc}/redfish/v1/Managers/bmc/LogServices/Journal/Entries > rj.out ``` Take some logEntry Id that its time going backward like ``` grep "@odata.id" rj.out ``` Run redfish query for each id, and some of them can't be successful. ``` % curl -k -X GET https://${bmc}/redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701604800002075 { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type LogEntry named '1701604800002075' was not found.", "MessageArgs": [ "LogEntry", "1701604800002075" ], "MessageId": "Base.1.13.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.13.0.ResourceNotFound", "message": "The requested resource of type LogEntry named '1701604800002075' was not found." } }% ``` This can also be verified by checking the failure of Redfish Validator run ``` python3 RedfishServiceValidator.py --auth Session -i https://${bmc} -u admin -p 0penBmc0 --payload Tree /redfish/v1/Managers/bmc/LogServices/Journal/Entries ``` For example, ``` ERROR - Members: GET of resource at URI /redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701604800002075 returned HTTP error. Check URI. ERROR - Members: GET of resource at URI /redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701604800065949 returned HTTP error. Check URI. ERROR - Members: GET of resource at URI /redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701607680003048 returned HTTP error. Check URI. ``` ``` --Time goes backwrd { "@odata.id": "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701604800002075", "@odata.type": "#LogEntry.v1_9_0.LogEntry", "Created": "2023-12-03T12:00:00+00:00", "EntryType": "Oem", "Id": "1701604800002075", "Message": "systemd-resolved: Clock change detected. Flushing caches.", "Name": "BMC Journal Entry", "OemRecordFormat": "BMC Journal Entry", "Severity": "OK" }, ... { "@odata.id": "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701607680003048", "@odata.type": "#LogEntry.v1_9_0.LogEntry", "Created": "2023-12-03T12:48:00+00:00", "EntryType": "Oem", "Id": "1701607680003048", "Message": "systemd-resolved: Clock change detected. Flushing caches.", "Name": "BMC Journal Entry", "OemRecordFormat": "BMC Journal Entry", "Severity": "OK" }, -- Time comes back to the previous moment ``` The solution is proposed to use <bootid> + <monototic timestamp> as the redfish journal entry id instead of realtime timestamp. Unlike realtime timestamp which may go backward, <monotonic timestamp> is monotonically increasing. Tested: - Redfish Validator passes - GET Journal Entry ID will be found even if its time goes backward. [1] https://github.com/openbmc/bmcweb/blob/7164bc62dd26ec92b01985aaae97ecc48276dea5/redfish-core/lib/log_services.hpp#L2690 Change-Id: I83bfb1ed88c9cf036f594757aa4a00d2709dd196 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-12-09mutual-tls: Add support for Meta certificatesMarco Kawajiri7-1/+155
Meta Inc's client certificates use an internal Subject CN format which AFAIK is specific to Meta and don't adhere to a known standard: Subject: CN = <type>:<entity>/<hostname> Commit adds the `mutual-tls-common-name-parsing=meta` option to, on Meta builds, parse the Subject CN field and map either the <entity> to a local user. The <type> field determines what kind of client identity the cert represents. Only type="user" is supported for now with <entity> being the unixname of a Meta employee. For example, the Subject CN string below maps to a local BMC user named "kawmarco": Subject CN = "user:kawmarco/dev123.facebook.com" Tested: Unit tests, built and tested on romulus using the script below: https://gist.github.com/kawmarco/87170a8250020023d913ed5f7ed5c01f Flags used in meta-ibm/meta-romulus/conf/layer.conf : ``` -Dbmcweb-logging='enabled' -Dmutual-tls-common-name-parsing='meta' ``` Change-Id: I35ee9b92d163ce56815a5bd9cce5296ba1a44eef Signed-off-by: Marco Kawajiri <kawajiri@meta.com>
2023-12-09Simplify mutual TLS checksEd Tanous2-116/+38
bmcweb should be using the openssl primitives for these checks. There are examples where we've known to have gotten the behavior incorrect, so given that OpenSSL clearly should know these things better than we do, use it. Tested: unit tests pass. Change-Id: I0bcd381a9e3c9a1e8e6dc39534e81fa698570689 Signed-off-by: Ed Tanous <ed@tanous.net>
2023-12-09Add mutual tls unit testEd Tanous3-3/+210
Mutual TLS paths were not tested. Add some unit tests. Because CI doesn't actually compile dependent libraries with ASAN enabled, and these tests call into openssl, we need to add a check for if we're compiling with asan enabled. Tested: unit tests pass. Change-Id: I02dcb69708619cc00fffd840738c608db3ae8bdf Signed-off-by: Ed Tanous <ed@tanous.net>