History log of /openbmc/bmcweb/redfish-core/include/utils/collection.hpp (Results 1 – 23 of 23)
Revision Date Author Comments
# 1aa375b8 13-Apr-2024 Ed Tanous <ed@tanous.net>

Implement client certificate schemas

The Redfish standard seems to have caught up with some of the OEM
schemas and features we already have, namely MutualTLS and Basic Auth
disablement.

This commit

Implement client certificate schemas

The Redfish standard seems to have caught up with some of the OEM
schemas and features we already have, namely MutualTLS and Basic Auth
disablement.

This commit implements most of the GET parameters for which we already
have backends. ClientCertificate is pointed to the same resources as
TrustStore.

Tested: generate_auth_certificates.py succeeds, and shows a certificate
in ClientCertificate collection

Get AccountService, and ClientAuthentication/Certificates returns
expected values.

Redfish service validator passes.

Change-Id: If18e34e9dfa8f38293fceff288596811afd16d4a
Signed-off-by: Ed Tanous <ed@tanous.net>

show more ...


# c48377db 19-Dec-2023 Myung Bae <myungbae@us.ibm.com>

Fix typo in collection.hpp

Commit https://gerrit.openbmc.org/c/openbmc/bmcweb/+/64087 has a typo
in redfish-core/include/utils/collection.hpp

```
L33:
jsonCountKeyName /= back + "@data.count";
--

Fix typo in collection.hpp

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>

show more ...


# 70c4d545 08-Jun-2023 Lakshmi Yadlapati <lakshmiy@us.ibm.com>

Refactor PCIeDeviceList to use getCollectionMembers

This commit refactors the code in the PCIeDeviceList function to use the
getCollectionMembers function for retrieving collection members.
Addition

Refactor PCIeDeviceList to use getCollectionMembers

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>

show more ...


# 36b5f1ed 26-Sep-2023 Lakshmi Yadlapati <lakshmiy@us.ibm.com>

Refactor getCollectionMembers

This commit refactors the getCollectionMembers function into smaller
functions. Additionally, the 'subtree' parameter is no longer a
default parameter but is explicitl

Refactor getCollectionMembers

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>

show more ...


# 3544d2a7 06-Aug-2023 Ed Tanous <edtanous@google.com>

Use ranges

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])' 's

Use ranges

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>

show more ...


# 62598e31 17-Jul-2023 Ed Tanous <ed@tanous.net>

Replace logging with std::format

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

Replace logging with std::format

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

show more ...


# ac106bf6 07-Jun-2023 Ed Tanous <edtanous@google.com>

Consistently name AsyncResp variables

In about half of our code, AsyncResp objects take the name asyncResp,
and in the other half they take the name aResp. While the difference
between them is negl

Consistently name AsyncResp variables

In about half of our code, AsyncResp objects take the name asyncResp,
and in the other half they take the name aResp. While the difference
between them is negligeble and arbitrary, having two naming conventions
makes it more difficult to do automated changes over time via grep.

This commit was generated automtatically with the command:
git grep -l 'aResp' | xargs sed -i 's|aResp|asyncResp|g'

Tested: Code compiles.

Change-Id: Id363437b6a78f51e91cbf60aa0a0c2286f36a037
Signed-off-by: Ed Tanous <edtanous@google.com>

show more ...


# b2ba3072 12-May-2023 Patrick Williams <patrick@stwcx.xyz>

fix more push vs emplace calls

It seems like clang-tidy doesn't catch every place that an emplace could
be used instead of a push. Use a few grep/sed pairs to find and fix up
some common patterns.

fix more push vs emplace calls

It seems like clang-tidy doesn't catch every place that an emplace could
be used instead of a push. Use a few grep/sed pairs to find and fix up
some common patterns.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I93eaec26b8e3be240599e92b66cf54947073dc4c

show more ...


# 3ccb3adb 13-Jan-2023 Ed Tanous <edtanous@google.com>

Fix a boatload of #includes

Most of these missing includes were found by running clang-tidy on all
files, including headers. The existing scripts just run clang-tidy on
source files, which doesn't

Fix a boatload of #includes

Most of these missing includes were found by running clang-tidy on all
files, including headers. The existing scripts just run clang-tidy on
source files, which doesn't catch most of these.

Tested: Code compiles

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ic741fbb2cc9e5e92955fd5a1b778a482830e80e8

show more ...


# 7a1dbc48 07-Dec-2022 George Liu <liuxiwei@inspur.com>

Refactor GetSubTreePaths method

Since the GetSubTreePaths method has been implemented in dbus_utility
and this commit is to integrate all the places where the
GetSubTreePaths method is called, and u

Refactor GetSubTreePaths method

Since the GetSubTreePaths method has been implemented in dbus_utility
and this commit is to integrate all the places where the
GetSubTreePaths method is called, and use the method in dbus_utility
uniformly.

Requires https://gerrit.openbmc.org/c/openbmc/sdbusplus/+/60020 to
build.

Tested: Redfish Validator Passed

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ie4140d4484a7e4f4b943013f4371ffd2d44a22e9

show more ...


# 079360ae 29-Jun-2022 Ed Tanous <edtanous@google.com>

Prepare for boost::url upgrade

The new boost URL now interops properly with std::string_view, which is
great, and cleans up a bunch of mediocre code to convert one to another.
It has also been pulle

Prepare for boost::url upgrade

The new boost URL now interops properly with std::string_view, which is
great, and cleans up a bunch of mediocre code to convert one to another.
It has also been pulled into boost-proper, so we no longer need a
boost-url dependency that's separate.

Unfortunately, boost url makes these improvements by changing
boost::string_view for boost::urls::const_string, which causes us to
have some compile errors on the missing type.

The bulk of these changes fall into a couple categories, and have to be
executed in one commit.
string() is replaced with buffer() on the url and url_view types
boost::string_view is replaced by std::string_view for many times, in
many cases removing a temporary that we had in the code previously.

Tested: Code compiles with boost 1.81.0 beta.
Redfish service validator passes.
Pretty good unit test coverage for URL-specific use cases.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I8d3dc89b53d1cc390887fe53605d4867f75f76fd

show more ...


# ae9031f0 27-Sep-2022 Willy Tu <wltu@google.com>

Update CollectionMembers to use UrlFromPieces

Refactor getCollectionMembers to make sure all Url created with dbus
paths are generated via UrlFromPieces helper function. This allow us to
manage all

Update CollectionMembers to use UrlFromPieces

Refactor getCollectionMembers to make sure all Url created with dbus
paths are generated via UrlFromPieces helper function. This allow us to
manage all URL generated from dbus in one place and allow us to make
future changes to affect all resources.

We can make changes to all resources easier if they are all managed by
one function.

Tested:
Redfish Validator Passed. All Collections working as expected and match
previous implmentation.

Change-Id: I5d3b2b32f047ce4f20a2287a36a3e099efd6eace
Signed-off-by: Willy Tu <wltu@google.com>

show more ...


# 002d39b4 31-May-2022 Ed Tanous <edtanous@google.com>

Try to fix the lambda formatting issue

clang-tidy has a setting, LambdaBodyIndentation, which it says:
"For callback-heavy code, it may improve readability to have the
signature indented two levels

Try to fix the lambda formatting issue

clang-tidy has a setting, LambdaBodyIndentation, which it says:
"For callback-heavy code, it may improve readability to have the
signature indented two levels and to use OuterScope."

bmcweb is very callback heavy code. Try to enable it and see if that
improves things. There are many cases where the length of a lambda call
will change, and reindent the entire lambda function. This is really
bad for code reviews, as it's difficult to see the lines changed. This
commit should resolve it. This does have the downside of reindenting a
lot of functions, which is unfortunate, but probably worth it in the
long run.

All changes except for the .clang-format file were made by the robot.

Tested: Code compiles, whitespace changes only.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ib4aa2f1391fada981febd25b67dcdb9143827f43

show more ...


# 1476687d 15-Mar-2022 Ed Tanous <edtanous@google.com>

Remove brace initialization of json objects

Brace initialization of json objects, while quite interesting from an
academic sense, are very difficult for people to grok, and lead to
inconsistencies.

Remove brace initialization of json objects

Brace initialization of json objects, while quite interesting from an
academic sense, are very difficult for people to grok, and lead to
inconsistencies. This patchset aims to remove a majority of them in
lieu of operator[]. Interestingly, this saves about 1% of the binary
size of bmcweb.

This also has an added benefit that as a design pattern, we're never
constructing a new object, then moving it into place, we're always
adding to the existing object, which in the future _could_ make things
like OEM schemas or properties easier, as there's no case where we're
completely replacing the response object.

Tested:
Ran redfish service validator. No new failures.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iae409b0a40ddd3ae6112cb2d52c6f6ab388595fe

show more ...


# b9d36b47 26-Feb-2022 Ed Tanous <edtanous@google.com>

Consitently use dbus::utility types

This saves about 4k on the binary size

Tested: Redfish service validator passes.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I9546227a19c691b1aecb

Consitently use dbus::utility types

This saves about 4k on the binary size

Tested: Redfish service validator passes.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I9546227a19c691b1aecb80e80307889548c0293f

show more ...


# 92409d0e 29-Sep-2021 Ed Tanous <edtanous@google.com>

Sort collections by human sort

Today, collections of dimms have a weird issue where they sort by
lexicographical sort, not numeric sort, so systems with >10 dimms show up
in the orde

Sort collections by human sort

Today, collections of dimms have a weird issue where they sort by
lexicographical sort, not numeric sort, so systems with >10 dimms show up
in the order:
Dimm1
Dimm10
Dimm11
Dimm2

While these collections are supposed to be sets, and the order doesn't
matter in the spec, there are a number of humans that look at these, and
doing something obvious is good for people.

Tested:
Tested on a CI system with 16 dimms here:
https://gist.github.com/geissonator/53a94f124c3501691a7870fb80c60c80

Which responded with dimms 1 and 11 being in the correct order.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I0c8b28fd169c5a957fb4d36a7c6771473b06fc0c

show more ...


# 27ea7db1 01-Oct-2021 Ed Tanous <edtanous@google.com>

Collections should handle no members present

Upon booting a new system that doesn't have an inventory system working,
the mapper will return an error if no resources exist. This is

Collections should handle no members present

Upon booting a new system that doesn't have an inventory system working,
the mapper will return an error if no resources exist. This is
unfortunate, but an error we should handle properly. This commit
catches the "no paths found" return code from the mapper, and pushes
back an empty collection, instead of returning internal error (500).

Tested:
Resolved https://192.168.1.224:18080/redfish/v1/Chassis on a system with
no Chassis resources, and observed 200, and an empty collection
returned.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iedaed198840e88fb0f3dc62423b064edff70972c

show more ...


# 8d1b46d7 31-Mar-2021 zhanghch05 <zhanghch05@inspur.com>

Using AsyncResp everywhere

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

Using AsyncResp everywhere

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

show more ...


# 2dfd18ef 17-Dec-2020 Ed Tanous <ed@tanous.net>

Start using sdbusplus::message::filename()

Lots of code gets checked in that does this path checking incorrectly.
So much so, that we have it documented in COMMON_ERRORS.md, yet, we

Start using sdbusplus::message::filename()

Lots of code gets checked in that does this path checking incorrectly.
So much so, that we have it documented in COMMON_ERRORS.md, yet, we
persist. This patchset starts using the new object_path::filename()
method that was added recently to sdbusplus. Overall, it deletes code,
and makes for a much better developer experience.

Tested:
Pulled down several endpoints and verified that filename() method works
properly, and the collections are returned as expected.

curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/AccountService/Accounts

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ief1e0584394fb139678d3453265f7011bc931f3c

show more ...


# dea43dd4 02-Dec-2020 Jonathan Doman <jonathan.doman@intel.com>

Refactor getCollectionMembers

- Add subtree parameter so that search can be restricted to arbitrary
hierarchy.
- Use the simpler GetSubTreePaths instead of GetSubTree
- Fix obj

Refactor getCollectionMembers

- Add subtree parameter so that search can be restricted to arbitrary
hierarchy.
- Use the simpler GetSubTreePaths instead of GetSubTree
- Fix object path string search to ensure the substr is at least 1
character.

Tested: As part of child change Iab94b7fd49a9462cb0eca6f8ea0754f5fb241053

Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
Change-Id: I2db134738972926898c03b0340ef64ca7639e40e

show more ...


# f23b7296 15-Oct-2020 Ed Tanous <ed@tanous.net>

Turn on ALL perf checks

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

Turn on ALL perf checks

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

show more ...


# 05030b8e 14-Oct-2020 Gunnar Mills <gmills@us.ibm.com>

Fix up Function to Populate collection Members

Added Doxygen comments, renamed the funciton, renamed several
variables, and made more generic.

Tested: Top commit passes validato

Fix up Function to Populate collection Members

Added Doxygen comments, renamed the funciton, renamed several
variables, and made more generic.

Tested: Top commit passes validator and resources look good.
Change-Id: I9a13176b7f4c8611ae38c6563b0e119e0f66edf2
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>

show more ...


# 116bcc5c 14-Oct-2020 Gunnar Mills <gmills@us.ibm.com>

Move getResourceList to Util class

Allows a future commit to separate memory and process
functionality.

Tested: Top commit tested.
Change-Id: Icd3d26c054adf0477c938a7795a42b

Move getResourceList to Util class

Allows a future commit to separate memory and process
functionality.

Tested: Top commit tested.
Change-Id: Icd3d26c054adf0477c938a7795a42b102cc05098
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>

show more ...