Age | Commit message (Collapse) | Author | Files | Lines |
|
Meson supports unity builds[1] natively. There's no reason to continue
with the pseudo unity build we've been using by putting implementations
in header files.
This commit is the first in a long series of starting to break this up
into smaller compile units, in the hopes of dropping incremental compile
times for developers, and reduce the total per-core memory usage that
gcc requires.
This commit breaks out the run() function from main() and the
constructor of RedfishService from redfish.hpp into their own compile
units. According to tracing, even after broken out, these are still by
far the two longest to compile units in the build.
Tested: Code compiles. Debug build on a 24 core build server results in
a decrease in compile time for compiling just bmcweb from 1m38s to
1m22s.
[1] https://mesonbuild.com/Unity-builds.html
Change-Id: Ibf352e8aba61d64c9a41a7a76e94ab3b5a0dde4b
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
This commit will migrate all the setProperty calls initiated by a
redfish"Action" to "setDbusProperty" method in Redfish namespace that
handles all DBuserrors in a consistent manner.
This method will determine if a setProperty is called during redfish
"Action" or just setting of a dbus property and internally call
appropriate methods that handles different set of errors.
All the Redfish action specific errors are defined in error_messages.hpp
file.
This specific change moves setProperty call in hypervisor_system.hpp and
covers errors in the mentioned file only.
Tested-By:
<Yet to test this usecase>
Change-Id: I3da48fbeabcdcf088c4481021232f08a44797c86
Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Clang has new checks for std::move/std::forward correctness, which
catches quite a few "wrong" things where we were making copies of
callback handlers.
Unfortunately, the lambda syntax of
callback{std::forward<Callback>(callback)}
in a capture confuses it, so change usages to
callback = std::forward<Callback>(callback)
to be consistent.
Tested: Redfish service validator passes.
Change-Id: I7a111ec00cf78ecb7d5f5b102c786c1c14d74384
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
In Redfish schema, just about all values can be a type (string,
EDM.Numeric, etc) or null. Most APIs don't allow explicitly setting
null, but there are a few cases where it is useful, namely in lists,
where an an empty object {} keeps the value the same, and null deletes
the value from the list.
Previously we handled this by unpacking as nlohmann::json, but this
allowed things like
[1.0, {}] to pass the check for an array of string values. We'd
ideally like to reject the 1.0 at the first stage, as well as reduce
the number of tiered readJson calls that we make.
This commit introducess support for unpacking std::variant types, that
allows unpacking a known type, or explicitly allowing null, by unpacking
std::nullptr_t.
Tested: Unit tests pass.
Change-Id: Ic7451877c824ac743faf1951cc2b5d9f8df8019c
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
Several places access the members of `req` indirectly like
`req.req.method()`. This can be simplified as `req.method()` .
This would also make the code clearer.
Tested:
- Compiles
- Redfish service validator passes
Change-Id: Ie129564ff907cdea7ac224b1e3d80cc0dedfbd7b
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
|
|
Clang-tidy-18 has new checks that can find more cases where we've
missed an opportunity to std::move.
Fix them.
Tested: Logging works, unit tests pass.
Change-Id: I0cf58204ce7265828693b787a7b3a16484c3d5e5
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
inline is not required on member methods. Clang-tidy has a check for
this. Enable the check and fix the two bad usages.
Tested: Code compiles.
Change-Id: I3115b7c0c4005e1082e0005b818fbe6569511f49
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
clang-18 improves this check so that we can actually use it. Enable it
and fix all violations.
Change-Id: Ibe4ce19c423d447a4cbe593d1abba948362426af
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Redfish protocol validatator has SSE tests that expose some bad coding
practies in SSE handlers, namely, that there are several cases where we
don't check for nullptr.
Fix them.
This appears to have been introduced in:
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/41319
Tested: Redfish service validator passes more tests.
Change-Id: Id980725f007d044b7d120dbe0f4b625865cab6ba
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
There are currently 78 sdbusplus::asio::setProperty calls in
redfish-core. The error handler for nearly all of them looks something
like:
```
if (ec)
{
const sd_bus_error* dbusError = msg.get_error();
if ((dbusError != nullptr) &&
(dbusError->name ==
std::string_view(
"xyz.openbmc_project.Common.Error.InvalidArgument")))
{
BMCWEB_LOG_WARNING("DBUS response error: {}", ec);
messages::propertyValueIncorrect(asyncResp->res, "<PropertyName>", <PropertyValue>);
return;
}
messages::internalError(asyncResp->res);
return;
}
messages::success(asyncResp->res);
```
In some cases there are more errors handled that translate to more error
messages, but the vast majority only handle InvalidArgument. Many of
these, like the ones in account_service.hpp, do the error handling in a
lambda, which causes readability problems. This commit starts to make
things more consistent, and easier for trivial property sets.
This commit invents a setDbusProperty method in the redfish namespace
that tries to handle all DBus errors in a consistent manner. Looking
for input on whether this will work before changing over the other 73
calls. Overall this is less code, fewer inline lambdas, and defaults
that should work for MOST use cases of calling an OpenBMC daemon, and
fall back to more generic errors when calling a "normal" dbus daemon.
As part of this, I've ported over several examples. Some things that
might be up in the air:
1. Do we always return 204 no_content on property sets? Today there's a
mix of 200, with a Base::Success message, and 204, with an empty body.
2. Do all DBus response codes map to the same error? A majority are
covered by xyz.openbmc_project.Common.Error.InvalidArgument, but there
are likely differences. If we allow any daemon to return any return
code, does that cause compatibility problems later?
Tested:
```
curl -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"HostName":"openbmc@#"}' https://192.168.7.2/redfish/v1/Managers/bmc/EthernetInterfaces/eth0
```
Returns the appropriate error in the response
Base.1.16.0.PropertyValueIncorrect
Change-Id: If033a1112ba516792c9386c997d090c8f9094f3a
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
clang-tidy-18 must've fixed their checking for these in headers.
Resolve as the robot commands.
Tested: Noop changes made by tidy. Code compiles.
Change-Id: I1de7686c597deffb0df91c30dae1a29f9ba7900e
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Redfish supports several type systems for json. This makes parsing into
proper types a challenge. Nlohmann supports 3 core data types,
nlohmann::json, which supports all json types (float, int, array,
object). Nlohmann::json::object_t, which is a specific typedef of
std::map, and nlohmann::json::array_t, which is a specific typedef of
std::map.
Redfish allows reading our arrays of complex objects, similar to
NtpServers: [null, {}, "string"]
Which makes it a challenge to support. This commit allows parsing out
objects as a nlohmann::object_t, which gives the ability to later use it
in a type safe manner, without having to call
get_ptr<nlohmann::json::object_t later>.
Tested:
Unit tests pass.
Change-Id: I4134338951ce27c2f56841a45b56bc64ad1753db
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Internally inside phosphor-time-manager, the elapsed(uint64) dbus call
just forwards the request directly to systemd after static casting to
int64_t (signed).
bmcweb should just call systemd directly, for several reasons.
phosphor-timesyncd might block on other calls, given it's a single
threaded blocking design, due to bugs like #264. Calling systemd
directly means that calls that don't require phosphor networkd won't be
blocked.
Calling systemd directly allows bmcweb to drop some code that parses a
date as int64_t, then converts it to uint64_t to fulfill the phosphor
datetime interface. We can now keep int64_t all the way through.
Calling systemd directly allows bmcweb to give a more specific error
code in the case there NTP is enabled, registering a
PropertyValueConflict error, instead of a 500 InternalError.
Tested:
Patching DateTime property with NTP enabled returns 400,
PropertyValueConflict
```
curl -vvvv -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"DateTime":"2020-12-15T15:40:52+00:00"}' https://192.168.7.2/redfish/v1/Managers/bmc
```
Disabling NTP using the following command:
```
curl -vvvv -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"NTP":{"ProtocolEnabled":false}}' https://192.168.7.2/redfish/v1/Managers/bmc/NetworkProtocol
```
Allows the prior command to succeed.
[1] https://github.com/openbmc/phosphor-time-manager/blob/5ce9ac0e56440312997b25771507585905e8b360/bmc_epoch.cpp#L126
Change-Id: I6fbb6f63e17de8ab847ca5ed4eadc2bd313586d2
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
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
|
|
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>
|
|
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>
|
|
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
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
This commit handles invalid SNMP destination error
Tested by:
Configure SNMP with invalid destination IP address
'{"Destination": "snmp://10.6.6.256:162",
"SubscriptionType": "SNMPTrap", "Protocol": "SNMPv2c"}'
Change-Id: I88f81a79a6665a7adc654e138b4f07ce321898a4
Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
|
|
Change-Id: I04864e8c47c8bb1763016b6ba1e5826450afdc72
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
As is, it reads the whole file into memory before sending it. While
fairly fast for the user, this wastes ram, and makes bmcweb less useful
on less capable systems.
This patch enables using the boost::beast::http::file_body type, which
has more efficient serialization semantics than using a std::string. To
do this, it adds a openFile() handler to http::Response, which can be
used to properly open a file. Once the file is opened, the existing
string body is ignored, and the file payload is sent instead.
openFile() also returns success or failure, to allow users to properly
handle 404s and other errors.
To prove that it works, I moved over every instance of direct use of the
body() method over to using this, including the webasset handler. The
webasset handler specifically should help with system load when doing an
initial page load of the webui.
Tested:
Redfish service validator passes.
Change-Id: Ic7ea9ffefdbc81eb985de7edc0fac114822994ad
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
```
../redfish-core/include/utils/extern/date.h:983:34: error: identifier '_d' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
983 | CONSTCD11 date::day operator "" _d(unsigned long long d) NOEXCEPT;
| ~~~~~~~~~~~~^~
| operator""_d
../redfish-core/include/utils/extern/date.h:984:34: error: identifier '_y' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
984 | CONSTCD11 date::year operator "" _y(unsigned long long y) NOEXCEPT;
| ~~~~~~~~~~~~^~
| operator""_y
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I2304818ddc498441f9ed2ede54c92b7f7c48b7c1
|
|
clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: I2f9540cf0d545a2da4d6289fc87b754f684bc9a7
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
|
|
To quote from The Redfish release [1]
2022.3 Redfish Schema Bundle – This .zip file contains the current
versions of all Redfish schemas. The bundle includes 40 schema updates
and developer resources.
Added Compute Express Link (CXL) support (NEW)
Extensions to Fabric, PCIeDevice, Processor, Memory, ComputerSystem,
and Chassis schemas Defined by DMTF alliance partner Compute Express
Link (CXL) Consortium
Extensions to Fabric, PCIeDevice, Processor, Memory, ComputerSystem,
and Chassis schemas New CXLLogicalDevice schema
Added MultiFactorAuth to AccountService to configure a service for
multi-factor authentication
HTTP Basic authentication is not available for accounts configured
for multi-factor authentication
For client certificate authentication, the client provides their
identity certificate during TLS handshaking
For RSA SecurID, Google Authenticator, and Microsoft Authenticator,
clients provide a new Token property in the session creation request
Added Heater and HeaterMetrics resources
[1] https://www.dmtf.org/content/redfish-release-20223-now-available
Change-Id: Iefe80866bfb83e65ab98b2cf4ee2eacce5238c5b
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Adds support for retrieving the dump file that's generated by
phosphor-debug-collector as a result of using the LogServices/Dump
Action LogService.CollectDiagnosticData from the bmc Manager resource.
Refactors the handling for
/redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>/attachment
to use one of the new functions and remove the large lambda.
Tested:
I began the dump generation process by sending a POST request to
/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData.
That spawned a Task to track the dump being generated by
phosphor-debug-collector. The dump was retrieved by querying the
/redfish/v1/Managers/bmc/LogServices/Dump/Entries/<str>/attachment URI
which is associated with the Task.
Verified that an event log returned by querying
/redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>/attachment
is the same as it was before this change.
Signed-off-by: Carson Labrado <clabrado@google.com>
Change-Id: I352b2628a9990bbde40f22e6134f02c89189c925
|
|
GET on redfish/v1/JsonSchema does not show OEM schemas but shows only
DMTF redfish schemas.
It is because Oem schemas are not included into `schemas.hpp`.
In addition, the explicit OEM JsonSchema gives the content of the file
rather than the valid Json output.
Tested:
- Query JsonSchemas
```
curl -k -H "X-Auth-Token: $token" -X GET "https://$bmc/redfish/v1/JsonSchemas"
curl -k -H "X-Auth-Token: $token" -X GET "https://$bmc/redfish/v1/JsonSchemas/<OemSchema>"
e.g.
curl -k -H "X-Auth-Token: $token" -X GET "https://$bmc/redfish/v1/JsonSchemas/OemManager"
```
- Redfish Service Validator passed
Change-Id: I0fc9c3d4a48fb9c6ddec9591af12fd2c849331e3
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
|
|
In boost 1.83.0, the boost::url maintainers deprecated the header only
usage of the library without warning. A discussion with the
maintainers[1] made it clear that they removed the abiliy on purpose,
and they're not going to add it back or add a deprecation strategy (they
did say they would update the documentation to actually match the
intent), and that from here on in we should be using the cmake boost
project to pull in the non-header-only boost libraries we use (which at
this point is ONLY boost url).
This commit updates to remove the usage of boost::urls::result typedef,
which was deprecated in this release (which causes a compile error) and
moves it to boost::system::result.
In addition, it updates our meson files to pull in the boost project as
a cmake dependency.
[1] https://cpplang.slack.com/archives/C01JR6C9C4U/p1696441238739129
Tested: Not yet.
Change-Id: Ia7adfc0348588915440687c3ab83a1de3e6b845a
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
This commit refactors the getCollectionMembers function into smaller
functions. Additionally, the 'subtree' parameter is no longer a
default parameter but is explicitly required in the function. All
calls to getCollectionMembers have been updated to pass the 'subtree'
parameter.
Tested: Validator passed
'''
curl -k https://$bmc/redfish/v1/Systems/system/Storage
{
"@odata.id": "/redfish/v1/Systems/system/Storage",
"@odata.type": "#StorageCollection.StorageCollection",
"Members": [
{
"@odata.id": "/redfish/v1/Systems/system/Storage/1"
}
],
"Members@odata.count": 1,
"Name": "Storage Collection"
}
curl -k 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"
},
{
"@odata.id": "/redfish/v1/Cables/dp0_cable2"
},
{
"@odata.id": "/redfish/v1/Cables/dp0_cable3"
}
],
"Members@odata.count": 4,
"Name": "Cable Collection"
}
curl -k https://$bmc/redfish/v1/Chassis
{
"@odata.id": "/redfish/v1/Chassis",
"@odata.type": "#ChassisCollection.ChassisCollection",
"Members": [
{
"@odata.id": "/redfish/v1/Chassis/chassis"
}
],
"Members@odata.count": 1,
"Name": "Chassis Collection"
}
curl -k https://$bmc/redfish/v1/Systems/system/Memory
{
"@odata.id": "/redfish/v1/Systems/system/Memory",
"@odata.type": "#MemoryCollection.MemoryCollection",
"Members": [
{
"@odata.id": "/redfish/v1/Systems/system/Memory/dimm0"
},
{
"@odata.id": "/redfish/v1/Systems/system/Memory/dimm1"
},
......
{
"@odata.id": "/redfish/v1/Systems/system/Memory/dimm31"
}
],
"Members@odata.count": 32,
"Name": "Memory Module Collection"
}
'''
Change-Id: If5091431b548f371bff03b2897fd0aaf8b0ef203
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
|
|
We haven't been very good about maintaining this file, so lets generate
it like we do everything else.
This commit takes the existing, manually built
openbmc_message_registry.hpp and copies the generated json from a
working system, then hooks it into the parse_registries script to
generate the hpp file. This results in a couple changes, and somewhat
proves how bad our ability to manage this file manually is..
Tested: Looking for input on if this is the right direction.
Change-Id: I5dc03021d194f0674e4a8f41421096b211462a0a
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
This code as it stands pulls in the full datetime library from boost,
including io, and a bunch of timezone code. The bmc doesn't make use of
any of this, so we can rely on a much simplified version.
Unfortunately for us, gcc still doesn't implement the c++20
std::chrono::parse[1]. There is a reference library available from [2]
that backports the parse function to compilers that don't yet support
it, and is the basis for the libc++ version. This commit opts to copy
in the header as-written, under the assumption that we will never need
to pull in new versions of this library, and will move to the std
ersion as soon as it's available in the next gcc version.
This commit simplifies things down to improve compile times and binary
size. It saves ~22KB of compressed binary size, or about 3%.
Tested: Unit tests pass. Pretty good coverage.
[1] https://en.cppreference.com/w/cpp/chrono/parse
[2] https://github.com/HowardHinnant/date/blob/master/include/date/date.h
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I706b91cc3d9df3f32068125bc47ff0c374eb8d87
|
|
Type safety is a good thing. In:
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/65606
It was found that splitting out the URI into encoded pieces in the early
phase removed some information we needed, namely whether or not a URI
was ipv6. This commit changes http client such that it passes all the
information through, with the correct type, rather than passing in
hostname, port, path, and ssl separately.
Opportunistically, because a number of log lines are changing, this uses
the opportunity to remove a number of calls to std::to_string, and rely
on std::format instead.
Now that we no longer use custom URI splitting code, the
ValidateAndSplitUrl() method can be removed, given that our validation
now happens in the URI class.
Tested: Aggregation works properly when satellite URIs are queried.
Change-Id: I9f605863179af54c5af2719bc5ce9d29cbfffab7
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
C++20 brought us std::ranges for a lot of algorithms. Most of these
conversions were done using comby, similar to:
```
comby -verbose 'std::lower_bound(:[a].begin(),:[b].end(),:[c])' 'std::ranges::lower_bound(:[a], :[c])' $(git ls-files | grep "\.[hc]\(pp\)\?$") -in-place
```
Change-Id: I0c99c04e9368312555c08147d474ca93a5959e8d
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
FanRemoved MessageArgs was mistakenly changed from 1 to 0. This changes
it back to 1 to fix getting Internal Server Error on events.
Tested:
Confirmed that FanRemoved events can be retrieved without getting a 500
error code.
Change-Id: I9a2a55a5ee3d2bea073d7d55ed9fe53dc2aaee9d
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
|
|
There are instances of ERROR logs that would work better as WARNING or
DEBUG since they do not actually result in bailing early and returning
an error response.
Signed-off-by: Carson Labrado <clabrado@google.com>
Change-Id: I1e7bca0bb38487b26a4642ab72ce475170bb53c6
|
|
Redfish event PowerSupplyPowerRestored has MessageArgs as 0 instead of
1. Due to this redfish events are not populated and getting Internal
Server Error.
So updated MessageArgs to 1.
Tested:
1. Redfish validator - passed for this new change
2. Verified GET /redfish/v1/Systems/system/LogServices/EventLog/Entries.
Able to populate Redfish event as expected.
Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: I9a2450cba5ff668ff495b7f2ba3b86b856581fff
|
|
Clang-tidy has the aforementioned check, which shows a few places in the
core where we ignored the required optional checks. Fix all uses.
Note, we cannot enable the check that this time because of some weird
code in health.hpp that crashes tidy[1]. That will need to be a future
improvement.
There are tests that call something like
ASSERT(optional)
EXPECT(optional->foo())
While this isn't an actual violation, clang-tidy doesn't seem to be
smart enough to deal with it, so add some explicit checks.
[1] https://github.com/llvm/llvm-project/issues/55530
Tested: Redfish service validator passes.
Change-Id: Ied579cd0b957efc81aff5d5d1091a740a7a2d7e3
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
Support for PATCH method is added to Metric Report Definition,
now selected read/write Report properties can be modified by PATCH method
Tested:
- Added Report via POST, overwrite editable properties via PATCH and
fetched Report via GET checking if received data is properly modified
Signed-off-by: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com>
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: If75110a92c55c9e4f2415f0ed4471baa802643ff
|
|
std::format is a much more modern logging solution, and gives us a lot
more flexibility, and better compile times when doing logging.
Unfortunately, given its level of compile time checks, it needs to be a
method, instead of the stream style logging we had before. This
requires a pretty substantial change. Fortunately, this change can be
largely automated, via the script included in this commit under
scripts/replace_logs.py. This is to aid people in moving their
patchsets over to the new form in the short period where old patches
will be based on the old logging. The intention is that this script
eventually goes away.
The old style logging (stream based) looked like.
BMCWEB_LOG_DEBUG << "Foo " << foo;
The new equivalent of the above would be:
BMCWEB_LOG_DEBUG("Foo {}", foo);
In the course of doing this, this also cleans up several ignored linter
errors, including macro usage, and array to pointer deconstruction.
Note, This patchset does remove the timestamp from the log message. In
practice, this was duplicated between journald and bmcweb, and there's
no need for both to exist.
One design decision of note is the addition of logPtr. Because the
compiler can't disambiguate between const char* and const MyThing*, it's
necessary to add an explicit cast to void*. This is identical to how
fmt handled it.
Tested: compiled with logging meson_option enabled, and launched bmcweb
Saw the usual logging, similar to what was present before:
```
[Error include/webassets.hpp:60] Unable to find or open /usr/share/www/ static file hosting disabled
[Debug include/persistent_data.hpp:133] Restored Session Timeout: 1800
[Debug redfish-core/include/event_service_manager.hpp:671] Old eventService config not exist
[Info src/webserver_main.cpp:59] Starting webserver on port 18080
[Error redfish-core/include/event_service_manager.hpp:1301] inotify_add_watch failed for redfish log file.
[Info src/webserver_main.cpp:137] Start Hostname Monitor Service...
```
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I86a46aa2454be7fe80df608cb7e5573ca4029ec8
|
|
This commit implements the Redfish Fan schema and fetches basic
information about each fan. The code first validates the chassis ID and
then validates the fan ID by obtaining a list of fans through the
endpoints of the cooled_by association. Additionally, common properties
are added.
Tested: Validator passes
1. doGet method to get Fan
'''
curl -k https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan2
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan2",
"@odata.type": "#Fan.v1_3_0.Fan",
"Id": "fan2",
"Name": "Fan"
}
2. Input the wrong chassisId with the doGet method to get Fan
curl -k https://${bmc}/redfish/v1/Chassis2/chassis/ThermalSubsystem/Fans/fan3
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The requested resource of type named 'fan3' was not found.",
"MessageArgs": [
"",
"fan3"
],
"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 named 'fan3' was not found."
}
}
3. Input the wrong fanId with the doGet method to get fan
curl -k https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan78
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan78",
"@odata.type": "#Fan.v1_3_0.Fan",
"Id": "fan78",
"Name": "Fan",
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The requested resource of type Fan named 'fan78' was not found.",
"MessageArgs": [
"Fan",
"fan78"
],
"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 Fan named 'fan78' was not found."
}
}
'''
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I44994a998fd9c497d794e2568cc0148120bfbc15
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
|
|
The FanCollection schema is a resource in Redifsh version 2022.2 [1]
that represents the management properties for the monitoring and
management of cooling fans implemented by Redfish [2].
This commit retrieves the fan collection by obtaining the endpoints of
the `cooled_by` association. The `cooled_by` association represents the
relationship between a chassis and the fans responsible for providing
cooling to the chassis.
ref:
[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0268_2022.2.pdf
[2] http://redfish.dmtf.org/schemas/v1/Fan.v1_3_0.json
Redfish validator is currently failing. In order for the validator to
pass, it is necessary to merge this commit with
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/57559
Tested:
1. doGet method to get FanCollection
```
curl -k -H "X-Auth-Token: $token" -X GET
https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans",
"@odata.type": "#FanCollection.FanCollection",
"Description": "The collection of Fan resource instances chassis",
"Members": [
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan5"
},
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan4"
},
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan3"
},
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan2"
},
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan1"
},
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0"
}
],
"Members@odata.count": 6,
"Name": "Fan Collection"
}
2. Input the wrong chassisId with the doGet method
curl -k https://${bmc}/redfish/v1/Chassis/chassis11/ThermalSubsystem/Fans
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The requested resource of type Chassis
named 'chassis11' was not found.",
"MessageArgs": [
"Chassis",
"chassis11"
],
"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
'chassis11' was not found."
}
}
```
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: If5e9ff5655f444694c7ca1aea95d45e2c9222625
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
|
|
We already have a generator class. We should use it. Wrap this into a
function that can be unit tested, and add unit tests.
Note, some files also needed to change name, because random.hpp
conflicts with the built in random, and causes circular build problems.
This commit changes it to ossl_random.
Tested: Unit tests pass. Now has coverage.
Redfish service validator passes.
Change-Id: I5f8eee1af5f4843a352c6fd0e26d67fd3320ef53
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
The code that was here was quite complex, and relied on a number of c++
features that were hard to track. It also implemented a parser that
would parse a given number multiple times.
This commit replaces fromDurationString with a single pass, simpler
parser, that doesn't rely on templates. It does this with a basic state
machine, like one would see in any number of places.
This allows the details section to be completely removed, as it can now
be simply inlined. This results in a decrease of 1.1KB of the binary
size of bmcweb.
Note, C++20 now has an implementation of std::chrono::days, which
obsoletes the need for redfish::time_utils::details::Days, so that
conversion is done opportunistically.
Tested: Unit tests pass. Pretty good coverage here.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I8eb9bee9807cc102f3680105b39f4eed3bd2e73c
|
|
The /ibm/v1 console is a different tree than Redfish, and as such,
should not be sending non-redfish resource events out. This is very
likely to break redfish clients on the other end. If the management
console wants an event-like entity, it needs to come up with its own
EventService-like resource, considering it is a separate tree.
Significant related discussion occurred here:
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/36368
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: Ic2a9e572099490f8810e03ab08336518f5672690
|
|
Allows the aggregator to insert links to top level collections which are
only supported by the satellite bmc.
Tested:
Links were added to responses for collections which are not currently
supported by BMCWeb. Also verified that top level collections and
satellite resources were still aggregated correctly.
curl localhost/redfish/v1
{
...
"Fabrics": {
"@odata.id": "/redfish/v1/Fabrics"
},
...
}
curl localhost/redfish/v1/UpdateService
{
...
"SoftwareInventory": {
"@odata.id": "/redfish/v1/UpdateService/SoftwareInventory"
}
}
The following $expand queries also returned as expected
curl -s 'localhost/redfish/v1?$expand=.($levels=1)'
curl -s 'localhost/redfish/v1/UpdateService?$expand=.($levels=1)'
Signed-off-by: Carson Labrado <clabrado@google.com>
Change-Id: Ie755f67bd28f81f6677670c09c9a210935ae0af9
|
|
This commit refactors the redfishPcieGenerationFromDbus and
redfishSlotType functions by changing their return types. The return
value std::nullopt indicates that there is no output, while the return
value pcie_device::PCIeTypes::Invalid indicates that the input was
invalid and returns an internal error. Additionally, the code that calls
these functions has been updated to accommodate the changes.
Tested: Validator passed
Change-Id: I3f7c1a3c8c6b53fd9a39928e3ad9a5fed9be97ff
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
|
|
We're not consistent here, which leads to people copying and pasting
code all over, which has lead to a bunch of different names for error
codes.
This commit changes to coerce them all to "ec", because that's what
boost uses for a naming convention.
Tested: Rename only, code compiles.
Change-Id: I7053cc738faa9f7a82f55fc46fc78618bdf702a5
Signed-off-by: Ed Tanous <edtanous@google.com>
|