diff options
author | Carson Labrado <clabrado@google.com> | 2022-11-23 23:55:18 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2023-01-12 02:50:43 +0300 |
commit | 11987af6e58a2d341c97f752e90c929e0a1189e5 (patch) | |
tree | 94edea150ce45146ab5867c05911e73b21a16af9 /scripts | |
parent | 7c8e064d33a1b9136b10f224d9ae9e9b066be012 (diff) | |
download | bmcweb-11987af6e58a2d341c97f752e90c929e0a1189e5.tar.xz |
Aggregation: Improve prefix fixup matching
Utilize the new array of top level collection URIs to determine if a
given URI in the response needs to have the aggregation prefix added.
This removes the need to check for specific collections like
/redfish/v1/UpdateService/FirmwareInventory which do not fit the
generic format of /redfish/v1/<collection>.
Future patches will use this same approach to improve the logic for
initially determining if and how a request should be aggregated.
This patch also adds a series of unit tests for the function
responsible for adding a prefix to a given URI. Cases covered include
valid URIs that involve a selection of aggregated resources, top level
collection URIs, other invalid URIs, and URIs with a trailing "/".
Tested:
Unit tests pass.
Signed-off-by: Carson Labrado <clabrado@google.com>
Change-Id: I676983d3c77ae3126c04e9f57ad8698c51df2675
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/generate_schema_collections.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/generate_schema_collections.py b/scripts/generate_schema_collections.py index c9f8b5956d..d6efa0efe2 100755 --- a/scripts/generate_schema_collections.py +++ b/scripts/generate_schema_collections.py @@ -266,17 +266,17 @@ def generate_top_collections(): "\n" "namespace redfish\n" "{{\n" - '// Note that each URI actually begins with "/redfish/v1/"\n' + '// Note that each URI actually begins with "/redfish/v1"\n' "// They've been omitted to save space and reduce search time\n" "constexpr std::array<std::string_view, {TOTAL}> " "topCollections{{\n".format(WARNING=WARNING, TOTAL=TOTAL) ) for collection in sorted(top_collections): - # All URIs start with "/redfish/v1/". We can omit that portion to + # All URIs start with "/redfish/v1". We can omit that portion to # save memory and reduce lookup time hpp_file.write( - ' "{}",\n'.format(collection.split("/redfish/v1/")[1]) + ' "{}",\n'.format(collection.split("/redfish/v1")[1]) ) hpp_file.write("};\n} // namespace redfish\n") |