From 11987af6e58a2d341c97f752e90c929e0a1189e5 Mon Sep 17 00:00:00 2001 From: Carson Labrado Date: Wed, 23 Nov 2022 20:55:18 +0000 Subject: 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/. 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 Change-Id: I676983d3c77ae3126c04e9f57ad8698c51df2675 --- scripts/generate_schema_collections.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') 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 " "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") -- cgit v1.2.3