Age | Commit message (Collapse) | Author | Files | Lines |
|
This commit drops 8k from the binary size.
Tested: SensorCollection returns sensor values as expected, same as
previously
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ife1dc40ff6745585ac6bc3f99cd5e6c4811baa56
|
|
As stated in PDI humidity is a valid hierarchy.
https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Sensor/Value.interface.yaml
From https://redfish.dmtf.org/schemas/v1/Sensor.v1_5_0.json:
Humidity is a valid ReadingType and Humidity ReadingUnits shall be %.
This follows the following Redfish mockup:
https://redfish.dmtf.org/redfish/mockups/v1/1156
This is not under BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM due to not
being part of the old thermal or power resources.
Tested:
Validator passes.
See a Humidity sensor in the Sensor colleciton:
{
"@odata.id": "/redfish/v1/Chassis/chassis/Sensors/Relative_Humidity",
"@odata.type": "#Sensor.v1_0_0.Sensor",
"Id": "Relative_Humidity",
"Name": "Relative Humidity",
"Reading": 61.935424802658005,
"ReadingRangeMax": 100.0,
"ReadingRangeMin": 0.0,
"ReadingType": "Humidity",
"ReadingUnits": "%",
...
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Change-Id: Ib1f52b0b0e3d8c4bfec8c4389c811fdb8b9d887a
|
|
This change adds an efficient expand handler for $levels=1 expand at the
sensors collection.
Instead of Query one sensor at time, it reuses existing codes for
Thermal and Power (which has AutoExpand), and queries the whole sensor at
one query. It's more efficient than the default expand handler as well
since the default handler stills query all the sensors and filter other
sensors when querying a single sensor.
Performance improves dramatically on a real hardware with 220+ sensors:
Before this change,
time wget -qO-
'http://localhost/redfish/v1/Chassis/xxx/Sensors?$expand=.($levels=1)'
> /tmp/log_slow.json
real 0m33.786s
user 0m0.000s
sys 0m0.000s
After this change
time wget -qO-
'http://localhost/redfish/v1/Chassis/xxx/Sensors?$expand=.($levels=1)'
> /tmp/log_fast.json
real 0m0.769s
user 0m0.010s
sys 0m0.010s
TESTED::
1. QEMU Redfish/IPMI passed
2. Validator passed (though it doesn't support query paramters)
3. Tested on real hardware.
{
"@odata.id": "/redfish/v1/Chassis/xxx/Sensors",
"@odata.type": "#SensorCollection.SensorCollection",
"Description": "Collection of Sensors for this Chassis",
"Members": [
{
"@odata.id": "/redfish/v1/Chassis/xxx/Sensors/abc",
"@odata.type": "#Sensor.v1_0_0.Sensor",
"Id": "abc",
"Name": "abc",
"Reading": 3.133,
"ReadingRangeMax": 5.8500060148599005,
"ReadingRangeMin": 0.0,
"ReadingType": "Voltage",
"ReadingUnits": "V",
"Status": {
"Health": "OK",
"State": "Enabled"
},
"Thresholds": {
"LowerCritical": {
"Reading": 2.205
},
"UpperCritical": {
"Reading": 3.507
}
}
},
],
"Members@odata.count": 225,
"Name": "Sensors"
}
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I745a31d6fe8d0aac08d532ea976bfc1a4a40b19c
|
|
bind_front + function is more readable than local lambdas.
Tested:
Tested sensor collection, works as expected.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ib3bd6d4249df97c4be5afcd1393477ed424f5de8
|
|
For better or worse, the series ahead of this is making use of
setUpRedfishRoute to do the common "redfish specified" things that need
to be done for a connection, like header checking, filtering, and other
things. In the current model, where BMCWEB_ROUTE is a common function
for all HTTP routes, this means we need to propagate this injection call
into the whole tree ahead of the requests being handled.
In a perfect world, we would invent something like a REDFISH_ROUTE
macro, but because macros are discouraged, the routes take a variadic
template of parameters, and each call to the route has a .privileges()
call in the middle, there's no good way to effect this change in a less
costly manner. This was messaged both in the prior reviews, and on
discord sourcing improvements on this pattern, to which none arose.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Id29cc799e214edad41e48fc7ce6eed0521f90ecb
|
|
This saves about 4k on the binary size
Tested: Redfish service validator passes.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I9546227a19c691b1aecb80e80307889548c0293f
|
|
clang-tidy readability checks are overall a good thing, and help us to
write consistent and readable code, even if it doesn't change the
result.
All changes done by the robot.
Tested: Code compiles, inspection only (changes made by robot)
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iee4a0c74a11eef9f158f0044eae675ebc518b549
|
|
These modifications are from WIP:Redfish:Query parameters:Only
(https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/47474). It will
be used in future CLs for Query Parameters.
The code changed the completion handle to accept Res to be able to
recall handle with a new Response object.
AsyncResp owns a new res, so there is no need to pass in a res.
Also fixed a self-move assignment bug.
Context:
Originally submitted:
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/480020
Reveted here:
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/48880
Because of failures here:
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/48864
Tested:
1. Romulus QEMU + Robot tests; all passed
2. Use scripts/websocket_test.py to test websockets. It is still work correctly.
3. Tested in real hardware; no new validator errors; tested both
authless, session, and basic auth.
4. Hacked codes to return 500 errors on certain resource; response is
expected;
5. Tested Eventing, the push style one (not SSE which is still under
review), worked as expected.
6. Tested 404 errors; response is expected.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: I52adb174476e0f6656335baa6657456752a031be
|
|
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
|
|
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
|
|
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
|
|
This one is a little trivial, but it does help in readability.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I5366d4eec8af2f781b3bad804131ae2eb806e3aa
|
|
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
|
|
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
|
|
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
|
|
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
|
|
Some subsystems seem to have invented their own typedefs for this stuff,
move to using the one typedef in dbus::utility so we're consistent, and
we reduce our templates.
Tested: code compiles
This saves a negligible amount (104 bytes compressed) on our binary
size.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I952ea1f960aa703808d0ac80f35dc24cdd8d5027
|
|
It simplifies a lot of code and after changing sdbusplus implementation
slightly reduces binary size if used together with:
https://gerrit.openbmc-project.xyz/c/openbmc/sdbusplus/+/49467
* Uncompressed size: 3033148 -> 3012164, -20984 B
* gzip compressed size: 1220586 -> 1214625, -5961 B
Tested:
- Redfish validator output is the same before and after the change
Change-Id: Ibe3227d3f4230de2363ba3d9396e51130c8240a5
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
|
|
This saves approximately 34kB in the compressed binary size of bmcweb
due to reduced template instantiations. This amounts to a 2.5%
reduction in the overall size.
Note, there were a few places where we broke const-correctness in the
form of pulling a non-const reference out of a const variant. This
new variant now requires const correctness, so some consts are
added where required.
Tested: Code compiles.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I6a60c8881c1268627eedb4ffddf16689dc5f6ed2
|
|
Issue: If system is not in manufacturing mode, RedFish response is
success but sensor value is not updated
Fix: If the system is not in manufacturing mode, return proper error as
actionNotSupported.
Tested:
1. Redfish validator - passed for this new change
2. Verified RedFish response when system in not manufacturing mode.
Patch: https://<BMC-IP>/redfish/v1/Chassis/<Baseboard>/Thermal
Body:
{
"Temperatures": [
{
"MemberId": "BMC_Temp",
"ReadingCelsius": 34.313
}]
}
Response:
{
"@odata.id": "/redfish/v1/Chassis/<Baseboard>/Thermal",
"@odata.type": "#Thermal.v1_4_0.Thermal",
"Fans": [],
"Id": "Thermal",
"Name": "Thermal",
"Temperatures": [],
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "There are insufficient privileges for the
account or credentials associated with the current
session to perform the requested operation.",
"MessageArgs": [],
"MessageId": "Base.1.8.1.InsufficientPrivilege",
"MessageSeverity": "Critical",
"Resolution": "Either abandon the operation or change the
associated access rights and resubmit the request if the
operation failed."
}
],
"code": "Base.1.8.1.InsufficientPrivilege",
"message": "There are insufficient privileges for the account or
credentials associated with the current session to perform the
requested operation."
}
}
Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: I3c6bfc9d37e1e8648ad0ff713929ad3fd06f437b
|
|
refer: https://github.com/openbmc/docs/blob/master/style/cpp/.clang-format
`Don't break long string literals`
Tested: built bmcweb successfully and RedfishValidator Passed.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ib58f7c942fd3838592e043c57e0b6ffcdc3d963b
|
|
This reverts commit 91995f3272010875e1559397e98ca93354066a0e.
Seeing bumps fail.
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/48864
Please fix, test, and resubmit.
Change-Id: Id539fe66d5a093caf8f22a393f7af7b58ead5247
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
|
|
These modifications are from WIP:Redfish:Query parameters:Only
(https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/47474). And they
will be used in Redfish:Query Parameters:Only.
(https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38952)
The code changed the completion handle to accept Res to be able to
recall handle with a new Response object.
AsyncResp owns a new res, so there is no need to pass in a res.
Tested:
1.Basic and Token auth both still work.
2.Use scripts/websocket_test.py to test websockets. It is still work
correctly.
python3 websocket_test.py --host 127.0.0.1:2443
This modification is a public part, so you can use any URL to test
this function. The response is the same as before.
Signed-off-by: zhanghaicheng <zhanghch05@inspur.com>
Change-Id: I570e32fb47a9a90fe111fcd1f4054060cd21def3
|
|
It was noticed recently when enabling bmcweb error traces to assist
with some debug, the journal was filling with logs like this:
Nov 09 21:23:46 p10bmc bmcweb[249]: (2021-11-09 21:23:46) [ERROR "sensors.hpp":2584] fan3_1 not in sensor list
Nov 09 21:23:46 p10bmc bmcweb[249]: (2021-11-09 21:23:46) [ERROR "sensors.hpp":2584] fan3_0 not in sensor list
Nov 09 21:23:46 p10bmc bmcweb[249]: (2021-11-09 21:23:46) [ERROR "sensors.hpp":2584] fan4_0 not in sensor list
...
This was the result of a test case reading a single sensor:
curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fan4_1
This code logic is fairly complex but appears to get all sensors of the
type passed in, then iterates through them looking for the one(s) of
interest. This code path should not be an error.
Tested:
- Verified that after running the following command, the unwanted logs
were no longer in the journal:
curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fan4_1{
"@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fan4_1",
"@odata.type": "#Sensor.v1_0_0.Sensor",
"Id": "fan4_1",
"Name": "fan4 1",
"Reading": 7772.0,
"ReadingRangeMax": null,
"ReadingRangeMin": null,
"ReadingType": "Rotational",
"ReadingUnits": "RPM",
"Status": {
"Health": "OK",
"State": "Enabled"
}
}
Change-Id: Iaffd0243ddcd148b72486b3025673bb35d0dd7a3
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
|
|
This reverts commit 9d832618c74052bd445d6e8b3461946f3c431ca3.
Reason for revert: Power schema should not be returned as reposponse to
POST request
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I01806a8c24c67f264dab4e9972497323c1499017
|
|
Initially, when the change to use AsyncResp everywhere was made, the
retrieveUriToDbusMap was skipped. This commit address that issue, by
adding AsyncResp to retrieveUriToDbusMap.
Tested:
curl -k -H "X-Auth-Token: $token" -X POST
https://${bmc}/redfish/v1/TelemetryService/MetricReportDefinitions/
-d '{"Id": "lxw1", "Metrics": [{"MetricId": "123",
"MetricProperties": ["/redfish/v1/Chassis/chassis/Power#/Voltages/0
/ReadingVolts"]}], "MetricReportDefinitionType": "OnRequest",
"ReportActions": ["LogToMetricReportsCollection"], "Schedule":
{"RecurrenceInterval": "100"}}'
{
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The resource has been created successfully",
"MessageArgs": [],
"MessageId": "Base.1.8.1.Created",
"MessageSeverity": "OK",
"Resolution": "None"
}
],
"@odata.id": "/redfish/v1/Chassis/chassis/Power",
"@odata.type": "#Power.v1_5_2.Power",
"Id": "Power",
"Name": "Power",
"Redundancy": [],
"Voltages": [
{
"@odata.id": "/redfish/v1/Chassis/chassis/Power#/Voltages/0",
"@odata.type": "#Power.v1_0_0.Voltage",
"LowerThresholdCritical": 10.8,
"LowerThresholdNonCritical": 11.16,
"MaxReadingRange": 12600.0,
"MemberId": "P12V",
"MinReadingRange": 11400.0,
"Name": "P12V",
"ReadingVolts": 22.930140000000005,
"Status": {
"Health": "Critical",
"State": "Enabled"
},
"UpperThresholdCritical": 13.200000000000001,
"UpperThresholdNonCritical": 12.84
},
...
The response is too long, so I omitted the following content.
Signed-off-by: zhanghaicheng <zhanghch05@inspur.com>
Change-Id: I6f82bdb234ddade67f689d79d004d672593fba4f
|
|
Redfish's thinking on what sensors should be included in the sensor
collection has changed. Roughly two years ago their thinking was
"for sensors that are not covered elsewhere in the model-meaning do
not duplicate Power and Thermal" and that is what OpenBMC implemented.
Today, as described in the new thermalSubsystem and powerSubsystem doc
the sensor collection should contain all sensors that are associated
with that chassis.
Link with: https://redfishforum.com/thread/190/sensorcollection-contain-all-sensors-chassis
All things considered as "sensors" should be included in the Sensor
collection.
To make this transition as easy as possible for clients, create a new
meson option, new-powersubsystem-thermalsubsystem. This "all sensors in
the sensor collection" behavior as well as the new ThermalSubsystem,
PowerSubsystem, Fans, and Power Supplies schemas will be under this
option. This option is defaulted to disabled. At a later time, the
default will move to enabled.
Move Redfish SensorCollection to show all sensors from
/xyz/openbmc_project/sensors with the "all_sensors" association for that
chassis if this option is enabled.
The SensorCollection is found at /redfish/v1/Chassis/<Id>/Sensors.
Tested:
1. Enabled redfish-new-powersubsystem-thermalsubsystem and
validator passes.
2. Performance testing (average of 5 times):
a. Redfish validator time:
without this patch: 71.375s
with this patch: 71.763s
b. Number of sensors tested:
without this patch: 8
with this patch: 63
c. Run `https://${bmc}/redfish/v1/Chassis/chassis/Sensors`:
without this patch: 0.197s
with this patch: 0.228s
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I2bdddcf616dc72cf0683515c9ab8453bd35eee09
|
|
Added DBUS object path for Airflow sensor to get the system airflow
sensor. This fix requires following fix dbus-sensors
https://gerrit.openbmc-project.xyz/c/openbmc/dbus-sensors/+/45241
Tested: Checked redfish/v1/Chassis/<chassis_id>/Sensors/
System_Airflow displayed the correct values.
Signed-off-by: Basheer Ahmed Muddebihal <basheerx.muddebihal@intel.com>
Change-Id: I32134e659a9fa7a5357fe5928ecebc0fc121c2bc
|
|
This commit attempts to automate the creation of our privileges
structures from the redfish privilege registry. It accomplishes this by
updating parse_registries.py to also pull down the privilege registry
from DMTF.
The script then generates privilege_registry.hpp, which include const
defines for all the privilege registry entries in the same format that
the Privileges struct accepts. This allows new clients to simply
reference the variable to these privilege structures, instead of having
to manually (ie error pronely) put the privileges in themselves.
This commit updates all the routes.
For the moment, override and OEM schemas are not considered. Today we
don't have any OEM-specific Redfish routes, so the existing ones inherit
their parents schema. Overrides have other issues, and are already
incorrect as Redfish defines them.
Binary size remains unchanged after this patchset.
Tested:
Ran redfish service validator
Ran test case from f9a6708c4c6490257e2eb6a8c04458f500902476 to ensure
that the new privileges constructor didn't cause us to regress the brace
construction initializer.
Checked binary size with:
gzip -c
$BBPATH/tmp/work/s7106-openbmc-linux-gnueabi/obmc-phosphor-image/1.0-r0/rootfs/usr/bin/bmcweb
| wc -c
1244048
(tested on previous patchset)
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ideede3d5b39d50bffe7fe78a0848bdbc22ac387f
|
|
There are a number of endpoints that assume that a given routes
privileges are governed by a single set of privileges, instead of
multiple sets ORed together. To handle this, there were two overloads
of the privileges() method, one that took a vector of Privileges, and
one that took an initializer_list of const char*. Unfortunately, this
leads some code in AccountService to pick the wrong overload when it's
called like this
.privileges( {{"ConfigureUsers"}, {"ConfigureManager"},
{"ConfigureSelf"}})
This is supposed to be "User must have ConfigureUsers, or
ConfigureManager, or ConfigureSelf". Currently, because it selects the
wrong overload, it computes to "User must have ConfigureUsers AND
ConfigureManager AND ConfigureSelf.
The double braces are supposed to cause this to form a vector of
Privileges, but it appears that the initializer list gets consumed, and
the single invocation of initializer list is called. Interestingly,
trying to put in a privileges overload of
intializer_list<initializer_list<const char*>> causes the compilation to
fail with an ambiguous call error, which is what I would've expected to
see previously in this case, but alas, I'm only a novice when it comes
to how the C++ standard works in these edge cases. This is likely due
in part to the fact that they were templates of an unused template param
(seemingly copied from the previous method) and SFINAE rules around
templates.
This commit functionally removes one of the privileges overloads, and
adds a second set of braces to every privileges call that previously had
a single set of braces. Previous code will not compile now, which is
IMO a good thing.
This likely popped up in the Node class removal, because the Node class
explicitly constructs a vector of Privilege objects, ensuing it can hit
the right overload
Tested:
Ran Redfish service validator
Tested the specific use case outlined on discord with:
Creating a new user with operator privilege:
```
redfishtool -S Always -u root -p 0penBmc -vvvvvvvvv -r 192.168.7.2
AccountService adduser foo mysuperPass1 Operator
```
Then attempting to list accounts:
```
curl -vvvv --insecure --user foo:mysuperPass1
https://192.168.7.2/redfish/v1/AccountService/Accounts/foo
```
Which succeeded and returned the account in question.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I83e62b70e97f56dc57d43b9081f333a02fe85495
|
|
Remove checkAndDoSensorsOverride function, this will be handled via dbus-sensor when the user set-value from external.
This is unlikely to break any users because the Intel special mode function is no change, only move to dbus-sensor to handle, "busctl" command also belongs to the external setting, so move to dbus-sensor is more suitable, this will including users to set value use busctl command and Redfish from external.
Dbus-sensor needs to be merged at the same time.
Dbus-sensor changes are pushed to Gerrit:
https://gerrit.openbmc-project.xyz/c/openbmc/dbus-sensors/+/42453
The mailing list discussion links:
https://lists.ozlabs.org/pipermail/openbmc/2021-March/025597.html
Signed-off-by: Bruce Lee <Bruce_Lee@quantatw.com>
Change-Id: I74356f2b65e41cc0e9d8947c160f313334b78331
|
|
Reduces the total number of lines and will allow for easier testing of
the redfish responses.
A main purpose of the node class was to set app.routeDynamic(). However
now app.routeDynamic can handle the complexity that was once in critical
to node. The macro app.routeDynamic() provides a shorter cleaner
interface to the unerlying app.routeDyanic call. The old pattern set
permissions for 6 interfaces (get, head, patch, put, delete_, and post)
even if only one interface is created. That pattern creates unneeded
code that can be safely removed with no effect.
Unit test for the responses would have to mock the node the class in
order to fully test responses.
see https://github.com/openbmc/bmcweb/issues/181
The following files still need node to be extracted.
virtual_media.hpp
account_service.hpp
redfish_sessions.hpp
ethernet.hpp
The files above use a pattern that is not trivial to address. Often their
responses call an async lambda capturing the inherited class. ie
(https://github.com/openbmc/bmcweb/blob/ffed87b5ad1797ca966d030e7f979770
28d258fa/redfish-core/lib/account_service.hpp#L1393)
At a later point I plan to remove node from the files above.
Tested:
I ran the docker unit test with the following command.
WORKSPACE=$(pwd) UNIT_TEST_PKG=bmcweb
./openbmc-build-scripts/run-unit-test-docker.sh
I ran the validator and this change did not create any issues.
python3 RedfishServiceValidator.py -c config.ini
Signed-off-by: John Edward Broadbent <jebr@google.com>
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I147a0289c52cb4198345b1ad9bfe6fdddf57f3df
|
|
crow::Response was create on stack and passed to async function
which was called after crow::Response was deleted
Tested:
- mentioned issue doesn't produce errors anymore
- no additional errors detected
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I16b338e0f6a4102415b5dca5defc307495db0c8e
|
|
Get the core using AsyncResp everywhere, and not have each individual handler
creating its own object.We can call app.handle() without fear of the response
getting ended after the first tree is done populating.
Don't use res.end() anymore.
Tested:
1. Validator passed.
Signed-off-by: zhanghaicheng <zhanghch05@inspur.com>
Change-Id: I867367ce4a0caf8c4b3f4e07e06c11feed0782e8
|
|
Actual attribute "ReadingUnits" does not match with Redfish Sensor
Schema. This change match "ReadingUnits" with Redfish Sensor Scheme
1.0.0 and add missing "ReadingType" attribute. This change affect all
users that depends on old units that does not match with Redfish
standard. Added toReadingType and toReadingUnit function that uses
values taken from Redfish Sensor Scheme 1.0.0. Latest version 1.2.0 of
Sensor scheme defines same units.
Changed value stored in ReadingUnits for Sensor resource:
- "Watts" -> "W"
- "Amperes" -> "A"
- "Percent" -> "%"
Tested:
- RedfishServiceValidator pass
- Verified that Sensors contain proper ReadingUnits
- Webui-Vue displays ReadingUnits properly in Health tab
Change-Id: I0c8820eba7271022c427cd25dec321db36aa0176
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
|
|
Clang tidy 11 got some really neat checks that do a much better job.
Unfortunately, this, combined with the change in how std::executors has
defined how callbacks should work differently in the past, which we
picked up in 1.73, and now in theory we have recursion in a bunch of our
IO loops that we have to break manually. In practice, this is unlikely
to matter, as there's almost a 0% chance that we go through N thousand
requests without ever starving the IO buffer.
Other changes to make this build include:
1. Adding inline on the appropriate places where declared in a header.
2. Removing an Openssl call that did nothing, as the result was
immediately overwritten.
3. Declaring the subproject dependencies as system dependencies, which
silences the clang-tidy checks for those projects.
Tested:
Code builds again, clang-tidy passes
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ic11b1002408e8ac19a17a955e9477cac6e0d7504
|
|
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I0f662e2e6d594567cc10eee34e1df2ca89614870
|
|
Remove the rfind method and use the filename method of
sdbusplus::message::Object_path.
Tested: Built successfully and validator passes.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I762360474b18092987feb64b13f78371db144baa
|
|
camelLower is not a type, camelBack is.
Changes were made automatically with clang-tidy --fix-errors
To be able to apply changes automatically, the only way I've found that
works was to build the version of clang/clang-tidy that yocto has, and
run the fix script within bitbake -c devshell bmcweb. Unfortunately,
yocto has clang-tidy 11, which can apparently find a couple extra errors
in tests we already had enabled. As such, a couple of those are also
included.
Tested:
Ran clang-tidy-11 and got a clean result.
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I9d1080b67f0342229c2f267160849445c065ca51
|
|
1st, alphabetize the tidy-list for good housekeeping.
Next, enable all the clang-tidy performance checks, and resolve all the
issues. most of the issues boil down to:
1. Using std::move on const variables. This does nothing.
2. Passing big variables (like std::string) by value.
3. Using double quotes on a find call, which constructs an intermediate
string, rather than using the character overload.
Tested
Loaded on system, logged in successfully and pulled down webui-vue. No
new errors.
Walked the Redfish tree a bit, and observed no new problems.
Ran redfish service validator. Got no new failures (although there are
a lot of log service deprecation warnings that we should look at).
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I2238958c4b22c1e554e09a0a1787c744bdbca43e
|
|
(In the voice of the kid from sixth sense) I see string copies...
Apparently there are a lot of places we make unnecessary copies. This
fixes all of them.
Not sure how to split this up into smaller patches, or if it even needs
split up. It seems pretty easy to review to me, because basically every
diff is identical.
Change-Id: I22b4ae4f96f7e4082d2bc701098a04f7bed95369
Signed-off-by: Ed Tanous <ed@tanous.net>
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
|
|
Now that CI can handle clang-tidy, and a lot of the individual fixes
have landed for the various static analysis checks, lets see how close
we are.
This includes bringing a bunch of the code up to par with the checks
that require. Most of them fall into the category of extraneous else
statements, const correctness problems, or extra copies.
Tested:
CI only. Unit tests pass.
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I9fbd346560a75fdd3901fa40c57932486275e912
|
|
This commit enables the "unused variables" warning in clang. Throughout
this, it did point out several issues that would've been functional
bugs, so I think it was worthwhile. It also cleaned up several unused
variable from old constructs that no longer exist.
Tested:
Built with clang. Code no longer emits warnings.
Downloaded bmcweb to system and pulled up the webui, observed webui
loads and logs in properly.
Change-Id: I51505f4222cc147d6f2b87b14d7e2ac4a74cafa8
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
This commit enables clang warnings, and fixes all warnings that were
found. Most of these fall into a couple categories:
Variable shadow issues were fixed by renaming variables
unused parameter warnings were resolved by either checking error codes
that had been ignored, or removing the name of the variable from the
scope.
Other various warnings were fixed in the best way I was able to come up
with.
Note, the redfish Node class is especially insidious, as it causes all
imlementers to have variables for parameters, regardless of whether or
not they are used. Deprecating the Node class is on my list of things
to do, as it adds extra overhead, and in general isn't a useful
abstraction. For now, I have simply fixed all the handlers.
Tested:
Added the current meta-clang meta layer into bblayers.conf, and added
TOOLCHAIN_pn-bmcweb = "clang" to my local.conf
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
|
|
Middlewares, while kinda cool from an academic standpoint, make our
build times even worse than they already are. Given that we only really
use 1 real middleware today (token auth) and it needs to move into the
parser mode anyway (for security limiting buffer sizes), we might as well
use this as an opportunity to delete some code.
Some other things that happen:
1. Persistent data now moves out of the crow namespace
2. App is no longer a template
3. All request_routes implementations no longer become templates. This
should be a decent (unmeasured) win on compile times.
This commit was part of a commit previously called "various cleanups".
This separates ONLY the middleware deletion part of that.
Note, this also deletes about 400 lines of hard to understand code.
Change-Id: I4c19e25491a153a2aa2e4ef46fc797bcb5b3581a
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
When fan collection size is 0, the MinNumNeeded shown -1
(4294967295/0xffffffff) but not 0.
"Redundancy": [
{
"@odata.id": "/redfish/v1/Chassis/WC_Baseboard/Thermal#/Redundancy/0",
"@odata.type": "#Redundancy.v1_3_2.Redundancy",
"MemberId": "Tach",
"MinNumNeeded": 4294967295,
"Mode": "N+m",
"Name": "Tach",
"RedundancySet": [],
"Status": {
"Health": "OK",
"State": "Enabled"
}
}
Tested:
"MinNumNeeded" is 0 correctly.
https://bmc_ip/redfish/v1/Chassis/WC_Baseboard/Thermal
"Redundancy": [
{
"@odata.id": "/redfish/v1/Chassis/WC_Baseboard/Thermal#/Redundancy/0",
"@odata.type": "#Redundancy.v1_3_2.Redundancy",
"MemberId": "Tach",
"MinNumNeeded": 0,
"Mode": "N+m",
"Name": "Tach",
"RedundancySet": [],
"Status": {
"Health": "OK",
"State": "Enabled"
}
}
Change-Id: I8bf01dacd705e5309c161c5f04289d2df45ca583
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
|
|
Background:
Change is necessary to support TelemetryService implementation.
TelemetryService specifies its own resource type for data - MetricDefinition.
In principle - MetricDefinition might point to Redfish Sensor in the system.
Each MetricDefinition requires MetricProperty - URI to specific property in
resource wih the value. This change allows retrieving such data alongside
corresponding D-Bus sensor to be used as source of Metrics value.
This change:
Function was implemented to allow retrieving mapping of Redfish URI paths
to D-Bus sensors in the system. Some minor refactoring in regards to
SensorsAsyncResponse were also introduced to enhance code locality. Idea for the
changes was to be the least intrusive if possible, as retrieving sensors in the
system requires lots of processing.
Existing logic was used and left intact. Utilizing existing logic required to
'fake' a HTTP request to traverse the sensors in the system and build the
response. It's crucial to use exact logic of building Redfish nodes
representation, as goal of the function is to retrieve exact Redfish URI for
sensor value.
Extra parameter was introduced to SensorsAsyncResp - callback to be called when
sensor data will be fully determined. After processing is complete caller is
notified with the outcome (success or failure) and map<URI:D-Bus sensor>.
Testing:
- all positive cases (3 chassis, 3 subnodes) in the system,
one of obtained mappings looked like the following:
{ /redfish/v1/Chassis/WP_Baseboard/Power#/Voltages/3/ReadingVolts :
/xyz/openbmc_project/sensors/voltage/P1V8_PCH }
- negative cases (wrong chassis, wrong subnode) - callback with error status
was called
- RedfishServiceValidator passed
Signed-off-by: Adrian Ambrożewicz <adrian.ambrozewicz@linux.intel.com>
Change-Id: I4389eb3df275126974168d1bb9af33dbf5cdb5b7
|
|
This is from openbmc/docs/style/cpp/.clang-format
Other OpenBMC repos are doing the same.
Tested: Built and validator passed.
Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
|
|
Recent change to xyz.openbmc_project.Sensor.Value interface has
introduced new type of sensor - 'utilization'.
This change makes bmcweb able to expose this kind of sensors in Sensors
schema under /Chassis/{}/Sensors.
Testing:
- implemented simple mocked sensor and verified that:
-- sensor appears in /Chassis/{}/Sensors
-- sensor values are properly shown in /Chassis/{}/Sensors/{}
-- 'ReadingUnits' is shown in /Chassis/{}/Sensors/{}
- RedfishServiceValidator passed
Change-Id: I9e4dc0b9db049a9815e79a0a64df60f275eeb822
Signed-off-by: Adrian Ambrożewicz <adrian.ambrozewicz@linux.intel.com>
|
|
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ia5d0845741f1d8d4bc6fd227c6d2e6f3a8d42b2e
|