summaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)AuthorFilesLines
2024-04-18Initialize schemas array with explicit sizeMyung Bae1-1/+5
Currently `update_schemas.py` generates a schema list definition like redfish-core/include/schemas.hpp: ``` constexpr std::array schemas { "AccountService", "ActionInfo", ... "OpenBMCAccountService", }; ``` However, if the number of schemas is more than the clang's default max size, CI may fail. The default is `-fbracket-depth=256`. ``` In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/functional:65: [1m/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/array:288:52: [0m [0;1;31mfatal error: instantiating fold expression with 276 arguments exceeded expression nesting limit of 256 288 | -> array<enable_if_t<(is_same_v<_Tp, _Up> && ...), _Tp>, [0m | [0;1;32m ~~~~~~~~~~~~~~~~~~~~~~~~^~~~ [0m [1m../redfish-core/include/schemas.hpp:17:26: [0m [0;1;30mnote: while substituting deduced template arguments into function template '<deduction guide for array>' [with _Tp = const char *, _Up = <const char *, const char *, const char *, const char *, const char *, ... const char *>] [0m 17 | constexpr std::array schemas { [0m | [0;1;32m ^ [0m1 error generated. ``` To avoid the failure, we can set the size explicitly like ``` constexpr std::array<std::string_view,277> schemas { "AccountService", ... ``` Tested: 1) Remove `include_list` so that all possible schemas are to be used 2) Run with the fixed `scripts/update_schemas.py` 3) Compiles successfully Change-Id: Ib68db9fd3be1b6dbe0c4b5cc0e9a4324966d759e Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2024-04-16Update Privilege Registry from 1.3.0 to 1.5.0Gunnar Mills1-1/+1
Change 1 line in scripts/parse_registries.py and rerun the script. Long term OpenBMC/bmcweb need more direction here on the Privilege Registry, but for now continue with the current direction of using the Privilege Registry and taking it from the DMTF. There is new entries in 1.4/1.5 that are needed for future development. Tested: It builds. Change-Id: I4337dc44e794c58f00f7307ea0508b84f14e8c8f Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-04-11Pull in all registriesGunnar Mills1-22/+40
Before Redfish put all messages in Base, but as the Messages became more specific Redfish started creating new registries. Redfish might have went a little registry happy. HeartbeatEvent just has 1 message and all these new ones registries each just have a handful of messages. Add the remaining 15 registries: composition, environmental, ethernetfabric, fabric, heartbeat_event, job_event, license, logservice, networkdevice, platform, power, sensor_event, storage_device, telemetry, update. Some of these are wanted for both current development and future development but it is hard to decide which ones so just added them all. power, fabric, telemetry, update are all things we support today. Having a UpdateInProgress or UpdateSuccessful makes a lot of sense and this enables that. Put these alphabetically. Use a new for loop to do this. Make changes to scripts/parse_registries.py and run the tool. No difference in size. Before: 66928640 Apr 10 13:32 obmc-phosphor-image-p10bmc-20240410183051.ext4.mmc.tar After: 66928640 Apr 10 13:18 obmc-phosphor-image-p10bmc-20240410181439.ext4.mmc.tar Tested: bmcweb builds. "./scripts/parse_registries.py --registries license,update" works. Change-Id: I43b4d041531cf338e9e7e621714ca7d95f6b01a5 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-04-11Fix generate auth certsEd Tanous1-88/+196
bmcs might not have the correct time, so allow certificates for 100 years starting from epoch. As is, the script makes the certificate valid for now + 10 years. After changes make the script valid from epoch (1970) to 100 years later (2070). This makes the script run to completion against a qemu instance of the bmc. Additional changes include detecting if a CA key is already present, to not rewrite it. This allows installing a CA certificate on test machines once, and using it to authenticate forever. Additionally, add "alternative names" support, for pointing to a bmc at localhost, or on the default qemu port, which allows these things to work by default in those scenarios. Lastly, change the directory to use a path relative to the script path, instead of relative to current path when generating certificates. This ensures that certs are always generated in the same place, which helps when a CA is reused. Tested: Script runs to completion without errors. Change-Id: Ia5c31041dd5cb193b897bf1f7bae3cd9767656d0 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-05redfish-schema: add ProtocolPatrick Williams1-0/+1
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
2024-02-01Bump Redfish schemas to 2023.3Gunnar Mills1-1/+1
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>
2024-01-29Reformat scriptsEd Tanous1-3/+3
Change-Id: Ie8fb9f9733e75b887b14516cfa12f662aa5d3a82 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-01-09Fix spelling mistakesEd Tanous2-2/+2
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>
2023-10-23Update schemas to 2023.2Ed Tanous1-1/+1
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>
2023-10-11Fix update_schemas.py to add Oem JsonSchemasMyung Bae1-80/+61
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>
2023-09-21Generate OpenBMC registryEd Tanous1-1/+22
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>
2023-07-25scripts: Script to autogenerate TLS certsAlex Schendel1-0/+289
This script autogenerates: 1. Self-signed CA certificate/key pair 2. Server certificate/key pair 3. Client certificate/key pair 4. PKCS12 archive to store client certificate/key pair These files are all generated and then stored in a local ./certs directory. Following this, they are added to the BMC over Redfish. Then, the script attempts to use the client certificate/key pair to access a Redfish url with permissions while not providing username or password. If this succeeds, then it generates the PKCS12 archive file and directs the user to import it into a browser if they wish to test webui or would prefer to do any testing in browser rather than over curl or similar data tranfer tools for HTTP. Tested: Monitored output to ensure that each step succeeded and once the PKCS12 archive file was generated, imported it into a browser and accessed a redfish url with permissions while not being redirected to the login route. Change-Id: Ie8a393feb472281d1865e52bddbdb58edbf5b071 Signed-off-by: Alex Schendel <alex.schendel@intel.com>
2023-07-20Replace logging with std::formatEd Tanous1-0/+100
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
2023-06-08Remove usage of deprecated VLanNetworkInterfaceJiaqing Zhao1-2/+0
In Redfish Schema (DSP2046) 2022.3 introduces EthernetInterface 1.9.0 that allows creating VLAN interface by POST EthernetInterface [1] instead of using the deprecated VLanNetworkInterface. This patch removes all current usage of VLanNetworkInterface. This patchest (topic:redfish-ethernet-1.9) introduces breaking API changes to current VLAN management features. All deprecated VLAN APIs are removed, VLAN interfaces will be managed in the same way as the EthernetInterface Resource, except they can be created or deleted. Since webui-vue has not implemented anything related to VLAN yet, it is not impacted. Solves the issue mentioned in 188cb6294105 ("ethernet: Bump EthernetInterface schema 1.4.1 -> 1.6.0") [1] https://redfishforum.com/thread/619 Tested: Redfish validator passed on a board with VLAN interface. No VLAN interface is exposed in Redfish. Change-Id: I9b243a5bb0f07642aa60bc13a622e862f62ee871 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-06-01Update base registriesEd Tanous1-2/+2
Update Base registry to 1.16.0, and Resource Event registry to 1.3.0 Patch was generated automatically. Tested: Code builds. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie9c15a657459cf7ec7fa5b4bf89460049fbce554
2023-05-22Update schema packs to 2023.1Ed Tanous1-1/+1
Redfish just released 2023.1, pull it in and update the packs. This commit was generated automatically using update_schemas.py Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8faad8392af88aa7fc3a4fd73c8e0ec3bede56e5
2023-03-21Add component integrity schemasEd Tanous1-0/+2
Update the schema pack to include ComponentIntegrity resources. ComponentIntegrity is used for representing roots of trust, and conveying attestation parameters forward. Tested: Automated change Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1c62ddeeb9151bfe2852199a9ebb12a6636e6262
2023-03-18Implement AggregationSourceCarson Labrado1-0/+1
Adds an AggregationSource resource for each satellite config present on dbus. Adds the AggregationSource schema which we had previously ignored. Tested: Querying an AggregationSource returned the expected information. curl localhost/redfish/v1/AggregationService/AggregationSources/5B247A { "@odata.id": "/redfish/v1/AggregationService/AggregationSources/5B247A", "@odata.type": "#AggregationSource.v1_3_1.AggregationSource", "HostName": "http://122.111.11.1:80", "Id": "5B247A", "Name": "Aggregation source", "Password": null, } Service Validator passed. The Service Validator also passed after removing the satellite config from the system such that /redfish/v1/AggregationService/AggregationSources returns an empty Members array. Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I88b5fbc15f27cddd330ec22a25427fd8b18cf766
2023-03-14Implement AggregationSourceCollectionCarson Labrado1-0/+1
This is an intermediate step in setting up aggregation sources. A future patch will add aggregation sources based on the existence of satellite configs. For now the collection will always return as 0 members. Adds the AggregationSourceCollection schema which we previously ignored. Tested: Service Validator passes Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I65c9231289bf0a9b6392696d55bc3feb0023c694
2023-02-28Implement AggregationServiceEd Tanous1-0/+1
AggregationService is used to inform a client that some of the results might be aggregated, and to allow setting up aggregation sources. Today, this resource only contains the basic fields, as well as "Enabled", which informs the client of the fact that the service is aggregation enabled. AggregationService was one of the schemas we ignored, so this adds it to the supported list. Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ifb16a86ff81e387f01016a83f9e69240c8928614
2023-02-24Add Ports schemaGeorge Liu1-0/+2
Based on DSP8010_2022.3 and adds the Ports schema. The port is a child of the FabricAdapters schema, and the PortCollection schema will collect all Ports information, each Port contains Location, LocationIndicatorActive, etc., and these functions will be implemented in the next patch. Tested: built bmcweb successfully and validator passes. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I9adfa852c3b9c5deaace0c958e477a67d49f4939
2023-02-14Fix bad namespacesEd Tanous1-2/+2
This was missed by me; At the same time as we were resolving the redfish-service-validator failure[1], I was trying to fix this. So in the result I saw: ERROR - Validation has failed: 2 problems found Which I thought was the existing false-positive, but turns out was hiding the namespace issue. Mea Culpa. [1]: https://github.com/DMTF/Redfish-Service-Validator/issues/533 Tested: Redfish service validator actually passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I51de9d508539756394ead1bca437ca37b61f5e40
2023-02-13Fix casing on OpenBMCEd Tanous1-1/+1
f041387d5912db27e0317805e5c341c9c472887a didn't quite fix the issue due to testing problems, which luckily CI caught. This actually fixes it. Tested: redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ieac721477b3e78165559f857c0683d0520b7fcc2
2023-02-13Fix schema validator failure regressionEd Tanous1-1/+1
Fixes regression introduced at 5b5574ace856c7f787528ab8f5e5352a90f2a6cb Because of the order in which a few patches were merged, the static $metadata file never got updated. There are other patchsets still in review to completely remove the file, which is why the validator passed on previous commits. Tested: Metadata now resolves Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I402eb0bb83220f13293e9e7c86f34a257c2f981e
2023-02-08Fix OemAccountService schemaEd Tanous1-4/+4
This schema as-written broke a bunch of Redfish specification rules for schemas, naming and other things. This commit starts to fix them. It can be used as a starting point for fixing the existing schemas. This working through testing. Tested: OpenBMCAccountService_v1.xml now passes the redfish odata schema validator. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Id991794344b8b7d36af3c44bba7214bf025deec8
2023-02-06Fix CI; Run blackGunnar Mills1-4/+4
Seeing CI fails: ``` Running beautysh Running black reformatted scripts/websocket_test.py ``` ``` diff --git a/scripts/websocket_test.py b/scripts/websocket_test.py index 21c7f160..fce9cd7e 100755 --- a/scripts/websocket_test.py +++ b/scripts/websocket_test.py @@ -45,10 +45,10 @@ async def hello(): authbytes = "{}:{}".format(args.username, args.password).encode("ascii") auth = "Basic {}".format(base64.b64encode(authbytes).decode("ascii")) headers = {"Authorization": auth} - async with websockets.connect( - uri, ssl=ssl_context, extra_headers=headers - ) if args.ssl else websockets.connect( - uri, extra_headers=headers + async with ( + websockets.connect(uri, ssl=ssl_context, extra_headers=headers) + if args.ssl + else websockets.connect(uri, extra_headers=headers) ) as websocket: request = json.dumps( { Format: FAILED ``` Change-Id: I8020716f2f9b9f1745d817728d3fe1eccd0bf778 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-02-02Update schema pack to 2022.3Ed Tanous1-1/+1
Update scripts/update_schemas.py to point at 2022.3 and run. Schema pack 2022.3 is the latest Redfish release, released 01/23/2023. It contains several new schemas and support for Multi-factor Authentication and CXL support along other things. Update done by automation. Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I55a64d7cda26572e7b75135acc324cb44d316fe6
2023-01-19Remove OemSession from metadataEd Tanous1-9/+0
In d678d4fc59f131cf9820c1783f86a4a6ede32995 I forgot to remove OemSession from the metadata, and it now returns invalid. This was missed in testsing, because this was originally stacked with patches that remove the $metadata hardcoding entirely, so with that patch, this error wasn't present. Tested: CI can catch this just fine. Regression fix. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I56ad68846174d42004565dd3bc75f3008720d58a
2023-01-12Add FabricAdapter schemaLakshmi Yadlapati1-0/+2
Will be used in commit https://gerrit.openbmc.org/c/openbmc/bmcweb/+/41216 From the Redfish schema "A FabricAdapter represents the physical fabric adapter capable of connecting to an interconnect fabric. Examples include but are not limited to Ethernet, NVMe over Fabrics, Gen-Z, and SAS fabric adapters." Tested: built bmcweb successfully and validator passes Change-Id: I9f8fb3bfc5b68a86b078b1261445437bdd5c550a Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-01-12Aggregation: Improve prefix fixup matchingCarson Labrado1-3/+3
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
2023-01-08Aggregation: Generate collections from schemaCarson Labrado2-0/+284
In aggregation we need to account for when a satellite BMC supports a resource collection that the aggregating BMC does not. We need to add links in responses from upstream resources to indicate that these satellite only resources exist. These top level collections do not always have the location format of /redfish/v1/<collection_id>. We determine all of those from the schema rather than hardcoding a few choice exceptions that do not fit that format such as /redfish/v1/UpdateService/FirmwareInventory. This patch is the first step in accomplishing this. We parse all xml schema files in order to determine what are the top level collection URIs. For URIs that are upstream from top level collections we'll be able to derive what URIs could appear in the response which are also on the same path to a top level collection. The xml files for resources that aren't currently supported by bmcweb are ignored when creating the schema index and later deleted once the above parsing completes. Later patches will use this information to make sure that we are properly handling all schema defined top level collections. Tested: Compiles with aggregation enabled Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: Icff825f4e4e9d84c96254561350f82839abdc074
2022-12-28Generate includes for all schemasEd Tanous1-8/+24
Even for schemas we ignore, we should still generate the enums for them, just to keep changes like [1] smaller. Tested: Code compiles. No functional binary change. [1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/55215 Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I78adf1204a319bc14900152f94161afea21f2e07
2022-12-13black: re-formatPatrick Williams2-20/+12
black and isort are enabled in the openbmc-build-scripts on Python files to have a consistent formatting. Re-run the formatter on the whole repository. Change-Id: I00a6615fdb2b47ffee38e4bf649dd644eb636844 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
2022-12-12Fix python packaging problemEd Tanous1-34/+33
Python packaging seems to have changed to be much more stringent about what version strings is accepts. It's not clear why this was done, but we need a fix to unbreak CI. This commit adds more parsing code into the script to parse out version numbers from the form of LogEntry.v1_2_3 to split them up into a custom class, and sort manually. Despite dropping the dependency, this ends up dropping a net 7 lines of code compared to using the library, so it seems worth it, especially given the breaking API change. One seemingly unrelated change was that we were adding schema folders to the sort lists, which don't sort well because they have no version numbers or extensions. This fixes to only add individual files to the list of things to sort. Tested: Code no longer crashes. Running update_schemas.py generates the same result (with one minor same-prefix sort order change). Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1a792ffb4ad7bc71637ab1aa0648a245949aeeee
2022-12-08Generate Redfish enums from schemasEd Tanous2-0/+166
OpenBMC tends to have a significant problem in doing the appropriate lookups from the schema files, and many bugs have been injected by users picking a bad enum, or mistyping the casing of an enum value. At the same time, nlohmann::json has recently added first class support for enums, https://json.nlohmann.me/features/enum_conversion/ This commit attempts to build a set of redfish includes file with all the available Redfish enums in an easy to use enum class. This makes it very clear which enums are supported by the schemas we produce, and adds very little to no extra boilerplate on the human-written code we produced previously. Note, in the generated enum class, because of our use of the clang-tidy check for macros, the clang-tidy check needs an exception for these macros that don't technically follow the coding standard. This seems like a reasonable compromise, and in this case, given that nlohmann doesn't support a non-macro version of this. One question that arises is what this does to the binary size.... Under the current compiler optimizations, and with the current best practices, it leads to an overall increase in binary size of ~1200 bytes for the enum machinery, then approximately 200 bytes for every call site we switch over. We should decide if this nominal increase is reasonable. Tested: Redfish protocol validator runs with same number of failures as previously. Redfish Service Validator passes (one unrelated qemu-specific exception) Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7c7ee4db0823f7c57ecaa59620b280b53a46e2c1
2022-12-07format: reformat with latest openbmc-build-scriptsPatrick Williams4-138/+163
Reformat the repository using the latest from openbmc-build-scripts. Add the `static/redfish` directory to be ignored by prettier since these files come from elsewhere and having the ability to do a direct diff is handy. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I74464d6f97047b4888a591e0d8a4f5ca970ac69e
2022-12-05python: fix flake8 warningsPatrick Williams2-9/+7
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6bcc6c72e1855c7de7c8b1e88cbab01e92b4070d
2022-11-08Add ThermalMetrics schemaGeorge Liu1-0/+1
Based on DSP8010_2022.2 and adds the ThermalMetrics schema. ThermalMetrics is child of the ThermalSubsystem schema. It is part of the new Power/Thermal Schemas. ThermalMetrics contains temperature readings and the corresponding link to that sensor in the sensor collection. Temperatures such as Ambient, Exhaust, Intake, and Internal can be found in the schema. Tested: built bmcweb successfully and validator passes. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I16ad2f922acc963a0434f3d9ab5583d2242b0013
2022-10-18Add EnvironmentMetrics schemaGeorge Liu1-0/+1
Based on DSP8010_2022.2 and adds the EnvironmentMetrics schema. Tested: built bmcweb successfully and validator passes Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I994b48c544edc22a6bf99187b536f3e51e10b052
2022-10-05Add PowerSubsystem PowerSupply and PowerSupplyCollection schemaChicago Duan1-0/+3
Add schemas for PowerSubsystem PowerSupply and PowerSupplyCollection. Tested: built bmcweb successfully and validator passes. Signed-off-by: Chicago Duan <duanzhijia01@inspur.com> Change-Id: I913d690108e30c841d5dec5fa37c7b9cee43f7c1
2022-09-30Make the schemas.hpp generated file #include arrayEd Tanous1-0/+1
The script missed a #include. Add it. Tested: Code compiles. Header change only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib38a46d8e97e4aadb596b4ff68795cea06e62fde
2022-09-30Add Fan and FanCollection schemaGeorge Liu1-0/+2
Based on DSP8010_2022.2 and adds the schema of Fan and FanCollection. Tested: built bmcweb successfully and validator passes Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Id1867a6f19d47d0fb1d686d650f7d936c33b5284
2022-09-28Move to 2022.2Asmitha Karunanithi1-1/+1
Run the script update_schemas.py by pointing it to 2022.2 An overview of 2022.2 release can be found at: [1] https://www.dmtf.org/sites/default/files/Redfish_Release_2022.2_Overview.pdf Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic729af6848badd1c81121e61a22a7115e553358a
2022-09-28Update Redfish schema pack to 2022.1Ed Tanous1-1/+1
Update to an intermediate schema pack. This is not the newest, but is an incremental commit to allow us to differentiate different versions of the schema packs evolution. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I4e5905a3ed40ca41b095c39b4d29c074b6eaeb67
2022-09-28Sort schema list alphabeticallyEd Tanous1-83/+110
New versions of the DMTF schema pack seem to make this list parse in less-than-ideal order. Previously, the schema pack zip file had an order that was at least semi-alphabetical, but 2022.2 seems to cause that to change. This commit makes the update_schemas.py script explicitly alphabetize the list. This changes the order of two keys that have common prefixes, but leaves the rest of the order the same. Both are arguably correct. This commit also exposes that this script seemed to have lots of problems in its version number detection logic. To make all this work properly, a fairly invasive change is required. Tested: Running the script on 2021.4 produces the same result as previously. See later commits for 2022.2 where result is now correct. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia2365daee1d91de142652161bf752600f3109115
2022-09-28parse_registry: make the script more flexibleNan Zhou1-81/+104
Now it supports updating individual registry. Run parse_registries.py to see all the options. This speeds up development of the script itself: e.g., when developing privilege related generator, we don't want to regenerate other headers every time during development. ``` usage: parse_registries.py [-h] [--registries REGISTRIES] options: -h, --help show this help message and exit --registries REGISTRIES Comma delimited list of registries to update ``` ``` [hi on] nanzhou@nanzhou:~/Desktop/bmcweb$ time scripts/parse_registries.py real 0m1.493s user 0m0.401s sys 0m0.046s [hi on] nanzhou@nanzhou:~/Desktop/bmcweb$ time scripts/parse_registries.py --registries privilege real 0m0.667s user 0m0.213s sys 0m0.030s ``` This saves 50% of the time. Though the absolute time to generate a full list if small. By default, it generates all the registries. Tested: tested the script, it can update headers correctly. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: If13748a605a462f5dc7d83bad52360942b7dc6b7
2022-09-26Run black formatter on scripts/update_schemas.pyEd Tanous1-174/+195
https://black.readthedocs.io/en/stable/ Is a formatter that takes a more opinionated stance on pep8 compliance than others, and as such gives us more consistent python code, even if that's not currently enforced by ci. In addition, it allows patches to automate their pep8 compliance similar to how we've done clang-format for c++. We've done this transform other places throughout the codebase and gotten a decent result, so duplicate it in bmcweb.. Run the black tool on update_schemas.py. Tested: Reran update_schemas.py, and generated output is identical Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I83f47025ac61d0afd5df87ddb33f84269160191c
2022-09-21registries: iwyuNan Zhou1-2/+6
Made the auto-generated headers and the openbmc registry include what they use. Also alligned the include style. Tested: code compiles. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I6577d5e12bc02da3bd7bf5780f89a4860b314e19
2022-09-21privilege registry: simplify writing headersNan Zhou1-14/+15
This patch reused similar patterns in |REGISTRY_HEADER| so that the python code is more readable. It also moved the clang-format off macro and warning a bit in so they are all consistent with each other. Tested: code compiles. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: If18de0d9f89088f9b5732613ecf59520650bb11a
2022-08-09scripts: registry: remove unuesd importsNan Zhou1-11/+2
Suggested by https://peps.python.org/pep-0008/#imports. Tested: parse_registries runs without issues. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I380f8d64caf963ac799ba255b55e36101fb7a8e4