summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-07-18Update the readmeEd Tanous1-47/+61
Many things in the readme were out of date, old, overly documented, or downright wrong. This commit attempts to update all the things that need updated. If any of them are controversial, I'm happy to break down this patch more, but I suspect most of these should be reasonably correct. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Icbe4be024d71aa596fccb53b91c6661964238b2c
2022-07-16Use more specific includeEd Tanous1-1/+1
Per the coding standard, we should be using the most specific version of the boost header we rely on. Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I76dd5a93c10c17d950b0dbac69183dd622363bce
2022-07-16Remove usages of boost::starts/ends_withEd Tanous19-90/+82
Per the coding standard, now that C++ supports std::string::starts_with and std::string::ends_with, we should be using them over the boost alternatives. This commit goes through and updates all usages. Arguably some of these are incorrect, and instances of common error 13, but because this is mostly a mechanical it intentionally doesn't try to handle it. Tested: Unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic4c6e5d0da90f7442693199dc691a47d2240fa4f
2022-07-15Use nlohmann::json::object_t for dump entriesJason M. Bills1-1/+1
This is a similar change that was recently made for other entry types, so also applying for dump entries. I don't have a system that uses this resource, so I'm not able to test this change. Change-Id: I74ba2f05658c6c53d7e397e03aad31a44c7c3280 Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
2022-07-15Use more specific includeEd Tanous1-1/+1
boost/urls/urls.hpp pulls in all of boost url, when in this context, we only want url_view.hpp. Per the coding standard (specifically in regards to boost) pull in the more specific header Tested: Code compiles. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I85bc45bdfcc7bc1d8e87be23fe4884b6ec8c4227
2022-07-15HTTP Client: Fix handling on connection timeoutCarson Labrado1-11/+12
If a destination is not reachable, then the connection will timeout in doConnect(). This causes issues later when the client attempts to resend the message. The error check in doClose() should not exit early since that will result in the connection's status not being marked as closed and thus it will never get reused. Similarly, doCloseAndRetry() should not exit early since that will cause the retry flow to hang and the connection's callback function will not get deleted. Tested: Used Redfish Aggregation patches in the chain through https://gerrit.openbmc.org/c/openbmc/bmcweb/+/54896 to verify that requests to collections such as /redfish/v1/Chassis no longer hang when the specified Satellite BMC does not exist Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: Ic8369b0de8efb00ff168bc1ed43f1d7fd6c7366a
2022-07-15Fix redundant storeEd Tanous1-2/+2
mtu = mtu has no effect. Fix it. Tested: Syntax only change. Code compiles. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8bae9ef83ae9809787f82dd27e95ebdb5e0a0e9c
2022-07-15Manager: add ManagerDiagnosticData handlerSui Chen3-7/+59
This change adds a link in the Manager for all BMCs to an empty ManagerDiagnosticData resource and a minimum ManagerDiagnosticData handler. This service is backed by phosphor-health-monitor (PHM), which is enabled by default through the "obmc-apps" package group. If PHM is disabled, the resource will be empty. $ curl http://${bmc}:10080/redfish/v1/Managers/bmc/ManagerDiagnosticData { "@odata.id": "/redfish/v1/Managers/bmc/ManagerDiagnosticData", "@odata.type": "#ManagerDiagnosticData.v1_0_0.ManagerDiagnosticData", "Id": "ManagerDiagnosticData", "Name": "Manager Diagnostic Data" } Also ran the Redfish Service Validator to make sure no new errors are introduced with the introduction of ManagerDiagnosticData. Signed-off-by: Sui Chen <suichen@google.com> Change-Id: Iba242bc3b6ebec851dbd26e149d5c92c19a7992e
2022-07-15lock test: remove unused functionNan Zhou1-5/+0
Tested: unit test passed. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I6f9c6b4648d98f4f035830d8a5da094ba76e7458
2022-07-14Move errant logging statementEd Tanous1-1/+1
Log statement was after the return, so therefore didn't do anything. cppcheck found. Tested: No way to test without a bug that causes an uncaught exception. Code review only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I5a4ae7d5ac83065040e3c4d9e390b5883fd0f1f9
2022-07-14Simplify logic in router matcherEd Tanous1-4/+6
cppcheck takes a little issue with this logic having some redundancies in it. Regardless of that, it's kind of hard to read; Rearrange the logic so it's easier to read and add comments. Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I0251ceb511e1bc62260b68c430b272d02b90fcb7
2022-07-12redfish-core tests: use matcher correctlyNan Zhou6-98/+112
This commit corrects the usage of ASSERT, EXPECT, and all the matchers. It also fixes cases where a cleaner matcher can be used. This commit increases readability (with correct and cleaner matcher) and corrects bugs (access iterator before checking validity). Typical incorrect usage is that when a function returns a boolean value to indicated whether the function succeeds or not, unless the function has clear behavior when it fails, we shouldn't continue the test that inspects the output parameters. A typical test codes look like this, ``` ASSERT_TRUE(fooBar(output)); EXPECT_EQ(output, 123); ``` Reference: https://testing.googleblog.com/2008/07/tott-expect-vs-assert.html https://github.com/google/googletest/blob/main/docs/reference/matchers.md Tested: unit test passed. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Ia2cf9922bd4cb2fe8b4b3912e9153e9ae4eab134
2022-07-12test treewide: apply test names best practicesNan Zhou7-62/+59
1. test suite names are usually related to the function under tests, not the whole source or header file 2. test case names should be verbose and describe the high level behavior This commits also splits test cases when they are for different functions, and merges test cases when they are very similar. Reference: 1. https://github.com/google/googletest/tree/main/googletest/samples 2. https://testing.googleblog.com/2007/02/tott-naming-unit-tests-responsibly.html Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I498cb2076bbaa9f0829f50bca45a2e38a6f4ab7d
2022-07-12test treewide: apply namespace best practiceNan Zhou9-44/+90
1. put sources into the namespace under test 2. put all test codes into anonymous namespace It can be proved that this can increase readability and save duplicate codes. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: If0685ca955c9ece5be5e2287ccbde1a302e4dacd
2022-07-12Fix const correctness issuesEd Tanous17-66/+66
cppcheck correctly notes that a lot of variables in the new code can be const. Make most of them const. Tested: WIP Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8f37b6353fd707923f533e1d61c5b5419282bf23
2022-07-12Fix const correctness on http Response objectEd Tanous1-4/+4
A number of methods in http::Response were not marked const when they should've been. This is generally not an issue, as most usages of Response are in a non-const context, but as we start using const Response objects more, we need to be more careful about const correctness. Tested: Unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8b31e71b6594d9328f106e1367084db42b783b6c
2022-07-11Google RoT: simplify subtree iterationNan Zhou1-9/+5
Use structured binding declaration to avoid verbose typing of subtree response. Tested: 1. code compiles 2. tested on hardware and RoT resources worked as expected. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I22758c196a097cce8e94208085fd59ce1363cefc
2022-07-11Google RoT: add unit tests for /google/v1Nan Zhou2-0/+40
Tested: unit test worked. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I4feb6c9cdf52930617a7011732a5837f06c1adda
2022-07-11Google RoT: remove global constant stringsNan Zhou1-13/+13
These variables are replaced by local string literals, which has better readability. Tested: tested on real hardware. GET: /google/v1/RootOfTrustCollection { "@odata.id": "/google/v1/RootOfTrustCollection", "@odata.type": "#RootOfTrustCollection.RootOfTrustCollection", "Members": [ { "@odata.id": "/google/v1/RootOfTrustCollection/Hoth" } ], "Members@odata.count": 1 } GET /google/v1/RootOfTrustCollection/Hoth { "@odata.id": "/google/v1/RootOfTrustCollection/Hoth", "@odata.type": "#RootOfTrust.v1_0_0.RootOfTrust", "Actions": { "#RootOfTrust.SendCommand": { "target": "/google/v1/RootOfTrustCollection/Hoth/Actions/RootOfTrust.SendCommand" } }, "Description": "Google Root Of Trust", "Id": "Hoth", "Location": { "PartLocation": { "LocationType": "Embedded", "ServiceLabel": "Hoth" } }, "Name": "Hoth", "Status": { "State": "Enabled" } } Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I4c21eeb6a521b657bd9a8eb7394e7748d000ad52
2022-07-11Google RoT: allign callback styleNan Zhou1-64/+85
The current convention: 1. route handler should be named as "handleAbcResouceMethod" 2. prefer inline functions instead of local lambdas Tested: 1. compiles 2. on Google hardware, the commands in https://gerrit.openbmc.org/c/openbmc/bmcweb/+/52222/32 worked GET: /google/v1/RootOfTrustCollection { "@odata.id": "/google/v1/RootOfTrustCollection", "@odata.type": "#RootOfTrustCollection.RootOfTrustCollection", "Members": [ { "@odata.id": "/google/v1/RootOfTrustCollection/Hoth" } ], "Members@odata.count": 1 } GET /google/v1/RootOfTrustCollection/Hoth { "@odata.id": "/google/v1/RootOfTrustCollection/Hoth", "@odata.type": "#RootOfTrust.v1_0_0.RootOfTrust", "Actions": { "#RootOfTrust.SendCommand": { "target": "/google/v1/RootOfTrustCollection/Hoth/Actions/RootOfTrust.SendCommand" } }, "Description": "Google Root Of Trust", "Id": "Hoth", "Location": { "PartLocation": { "LocationType": "Embedded", "ServiceLabel": "Hoth" } }, "Name": "Hoth", "Status": { "State": "Enabled" } } Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I0221b4b183579b33d0848d96a20398aee1a211d4
2022-07-09Remove clang-tidy documentationEd Tanous1-25/+2
clang-tidy is now integrated into CI; Documenting the "manual" process for running tidy doesn't provide value these days. Point to openbmc-build-scripts as the "recommended" mechanism to run static analysis. Tested: Documentation only Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Idac0d29e8976a168355bfa3b863b8600db916f14
2022-07-09Make virtual media use urlFromPiecesEd Tanous1-23/+12
urlFromPieces is the new way to construct "correct" urls. It also cleans up quite a bit of this code. Use it. Tested: Code compiles. No backend in upstream yet. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic43c257613061708e96a5449e0b3d57f288fbffa
2022-07-09Fix undefined behavior in timestamp parsingEd Tanous1-1/+1
If this algorithm ever processed a string where the + came before the ., then dot - plus would render a negative, and overflow, causing a crash. In practice, this doesn't happen. Tested: Inspection only at this time. Difficult to trigger error. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic7f5153d144ac551118c4f4b2d61f82626ac3779
2022-07-09Update host logger with recent JSON fixesJason M. Bills1-16/+16
Similar changes were recently made for other log entry types to improve handling of JSON objects. This applies the same fixes for host logger entries. I don't have a system that uses the host logger, so I'm not able to test this change. Change-Id: If5af976885a321e1077d89d92129f4b87a8e2943 Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
2022-07-08Remove magic numbersEd Tanous1-29/+54
There's lots of magic numbers in this file that we inherited from crow. This commit Adds a TypeCode enum class that can be used in place of the magic numbers. It keeps the same values as were present previously (0-6) in case there are places where this abstraction leaked out, but I believe this catches all of them. Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I063955adb8bf75d9bb6298e29e6e44c210ee9cc3
2022-07-08Set UnknownProperty message to be an errorEd Tanous1-1/+1
This normally wouldn't be so big of a deal, but the redfish-protocol validator tests this case in the REQ_PATCH_BAD_PROP test. From the specification: ''' If all properties in the update request are read-only, unknown, or unsupported, but the resource can be updated, the service shall return the HTTP 400 Bad Request status code and an error response with messages that show the non-updatable properties. ''' We wrote our code almost right for handling this case, but we put the response into the per-property responses instead of the error responses. In terms of backward compatibility, technically this is changing the behavior, but considering that it's behavior in an error case, most implementations only look at response code, and this is moving to be compliant with the specification, it doesn't seem like there would be any reason to provide both the old message and the new one, and this has a low to zero likelihood of any actual impact. To hit this condition, clients would have to be ignoring the error code response AND using a property that's unknown to the BMC. Clients that make both mistakes seems unlikely. Tested: Code now passes the REQ_PATCH_BAD_PROP test. 10 failing test cases down to 8. ''' curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/AccountService/ -X PATCH -d '{"foo": "bar"}' ''' Returns an object with an "error" key in it. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8a19ed2bcfc91765b63d4544877332038e171c02
2022-07-07Handle NTPServers list per the specificationEd Tanous2-25/+92
The Redfish specification for PATCH of arrays defines a number of requirements. - Setting a value to null, should remove it from the list. - Setting a value to empty object "{}" should leave the value unmodified - Values at indexes larger than whats included in the PATCH request shall be removed. This commit attempts to fix this behavior for NTPServers and make it correct. It does this by first getting the list of NTP servers, then walking the list in parallel with the list given in the patch, and either modifying or changing the list as the spec requires before setting the setting across the system. It also turns out that the current behavior of unpacking nlohmann::json objects requires an object to be an array, object, or null, which doesn't allow unpacking the strings required in this case, so that check is removed. A quick inspection shows that we don't unpack nlohmann objects very often, and this should have no impact. Tested: Redfish-protocol-validator tests for NTPServers now pass ''' curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/Managers/bmc/NetworkProtocol -X PATCH -d '{"NTP": {"NTPServers": []}}' ''' Used to patch values succeeds with various "good" values; ["time-a-b.nist.gov", "time-b-b.nist.gov"] [{}, {}] ["time-a-b.nist.gov", null] [] Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I23a8febde34817bb0b934e46e2b77ff391b52a57
2022-07-07Move duplicate reductionEd Tanous1-1/+1
getEthernetIfaceData callback should ideally be returning exactly the values the system has, minus duplicates. In every case this function is used, we don't want duplicates, so move where we check for duplicates. Tested: In conjunction with https://gerrit.openbmc.org/c/openbmc/bmcweb/+/54829 test cases pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib202db99f70e1a6fdddf18969e15b2382e287848
2022-07-07Add TermalSubsystem schemaXiaochao Ma5-0/+278
Adds the ThermalSubsystem schema to the list of the supported schemas. Tested: Code compiles. Script generated change. Signed-off-by: Xiaochao Ma <maxiaochao@inspur.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I4540fcaa57455ec95d4c8fff71429309c2eebce3
2022-07-07dbus_singleton: use stack variable and externNan Zhou4-4/+23
Currently, the |systemBus| connection is a static variable declared in headers. This has a problem that every translation unit will keep its own copy. It's not a problem today because there's only one translation unit "webserver_main.cpp.o". This issue was brounght up in https://gerrit.openbmc.org/c/openbmc/bmcweb/+/54758 Actually, the |systemBus| doesn't need to be a singleton. It can just be a stack variable, which is normally more efficient than heap variables. To keep minimum changes treeside, this commits keeps the existing |systemBus| variable as an external variable. It is defined in its own translation unit. It is initialized in the main translation unit. Reference: 1. Extern https://stackoverflow.com/questions/1433204/how-do-i-use-extern-to-share-variables-between-source-files Tested: 1. Romulus QEMU robot Redfish test passed; 2. Start and restart service on real hardware, no issues; 3. No new validator failures 4. Code compies Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I03b387bd5f218a86c9d1765415a46e3c2ad83ff9
2022-07-07Google RoT: avoid potential dangling pointerNan Zhou1-1/+1
The struct |ResolvedEntity| stores a pointer which might be dangling in the future when interface is not longer a string literal. Given that the interface string is small enough, this commits changes the data member to a string which is constructed (copied) from the string literal today. Tested: trivial change. Compiles. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I2759635f7fa296cc8aa141735efb3799a1503726
2022-07-07dbus_utility_test: fix test case namesNan Zhou1-6/+8
This commit applies the GTest test case naming convention: Camel case, use decriptive Test names. It also groups test cases according to the name. Reference: https://testing.googleblog.com/2014/10/testing-on-toilet-writing-descriptive.html http://google.github.io/googletest/primer.html#simple-tests Tested: unit test passes. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Ibd1bfcb4456b64e43f437cc2afa7464f03ee634c
2022-07-07ip utils test: revive the testNan Zhou1-0/+1
Tested: unit test passed. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I6ec2036c09eb73c2ff34779ed055dff7769c2f57
2022-07-06Remove redfish message from http clientEd Tanous1-1/+1
HttpClient these days is intended to be a generic feature. It should not be relying directly on Redfish messages. In this case, we only ever rely on the return code internally, so replace messages with a simple bad_gateway. Tested: Code compiles. Unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie4bd65dc0b90b75f61ab0e31ca535eefbf0f4ebb
2022-07-06system: don't fail when Boot service isn't thereNan Zhou1-0/+8
If the boot service isn't there, we shouldn't fail the response but omit the Boot property. Tested: 1. Service Validator passed on system without boot service 2. Service Validator passed on system with boot service Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Id3488f827736aa65d73e4a42082b279ca386ac3e
2022-07-05Replace CHAR_MAX with numeric_limitsEd Tanous1-1/+1
Clang analyzer complains on this one about loading an int (CHAR_MAX) into a char, and that it might overflow. Obviously it can't, but we might as well suppress the warning. Tested: Unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I9b8149504ab3c016fc75f0a84bb5c6d04f9c013f
2022-07-05Remove unused variablesEd Tanous3-4/+0
cppcheck finds a few variables that were unused in a few modules. Clean them up. Tested: Code compiles, unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7a95025891bb537b45b99b3cd649ad05533e78f4
2022-07-05IWYU redfish_sessions.hppEd Tanous1-0/+1
Fix the includes. Tested: Code compiles. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I589aa64c14847bb82087a5201959e2ca1271ae41
2022-07-05Make resHandler constEd Tanous1-2/+2
cppcheck correctly notes this parameter can be const. Unfortunately we've making a copy here, but looking at the ownership, that can't be avoided simply without a shared_ptr, and that's far more invasive. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib70c89a7a1bc7210219052ba2a44bc7a1c20c7f2
2022-07-02Remove unused variableEd Tanous1-1/+0
This variable was clearly for the print statement below, but then got abandoned at some point. Clean it up. cppcheck found this as well. Tested: Unused code Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I2d143f00dc6956c87ba77d5cbe1b96be631ca795
2022-07-02Fix unused branches in http_clientEd Tanous1-10/+6
cppcheck correctly finds that these branches will always be hit, so the branch is unneeded. Let's start by getting the code cleaned up. Tested: CI only, cpp check. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7b89337a81e676915243d5bc9d26c24a89c74aef
2022-07-01Make nbd-proxy header build in all casesEd Tanous2-7/+4
We very intentionally don't do this "only include header if option is enabled" thing to make sure that compile issues are seen across all builds. Tested: Code compiles. Header changes only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I749aed62ed6cd73690f3d89d75df65bec77562c2
2022-07-01Remove BLONSEd Tanous1-1412/+0
This file was used in unit tests a while ago. It's not really a good test list, and ideally would be replaced with coverage directed fuzzing if we ever needed something like this in the future. Tested: Delete only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I9a7d3c422226e0366399ab43abd92f762e3e4fc7
2022-07-01Fix #includes on http_client.hppEd Tanous1-0/+10
Include what you use. Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I23c89fee6f3e39d2f2a7dc1c3ba2db8819e8adc7
2022-06-30Require explicit decorator on one arg constructorsEd Tanous13-18/+26
We essentially follow this rule already, not relying on implicit operators, although there are a number of cases where in theory we could've implicitly constructed an object. This commit enables the clang-tidy check. Tested: Code compiles, passes clang-tidy. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia428463313b075c69614fdb326e8c5c094e7adde
2022-06-29Encode service object path with sdbusplusJiaqing Zhao1-8/+20
After service-config-manager switched to encode its object path with sdbusplus, bmcweb needs to encode them with sdbusplus as well. Tested: Verified PATCH ServiceEnabled property of SSH and IPMI works. Change-Id: I1d3317489617b609327847eaf1d40fbc5659e53c Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2022-06-28http_utility_test: fix test case namesNan Zhou1-4/+14
This commit applies the GTest test case naming convention: Camel case, use decriptive Test names. It also groups test cases according to the name. Reference: https://testing.googleblog.com/2014/10/testing-on-toilet-writing-descriptive.html http://google.github.io/googletest/primer.html#simple-tests Tested: unit test passes. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Ie008ceac9e027b518e660745722ac5cc0af502da
2022-06-28http_utility_test: add namespaceNan Zhou1-8/+14
To save duplicate codes. Tested: unit test passes. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Ibb641942b24a92f61793995337963be80d4a6151
2022-06-28Fix shadowed variable issuesEd Tanous21-152/+151
This patchset is the conclusion of a multi-year effort to try to fix shadowed variable names. Variables seem to be shadowed all over, and in most places they exist, there's a "code smell" of things that aren't doing what the author intended. This commit attempts to clean up these in several ways by: 1. Renaming variables where appropriate. 2. Preferring to refer to member variables directly when operating within a class 3. Rearranging code so that pass through variables are handled in the calling scope, rather than passing them through. These patterns are applied throughout the codebase, to the point where -Wshadow can be enabled in meson.build. Tested: Code compiles, unit tests pass. Still need to run redfish service validator. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: If703398c2282f9e096ca2694fd94515de36a098b
2022-06-28Fix fail on get PostCode entryTony Lee1-1/+1
Get url /redfish/v1/Systems/system/LogServices/PostCodes/Entries/<str> return error. Compare with sha dcf2ebc020257bc298d948fcb4da761c284e84d7 Condition checking is different from the original. Tested: Before fix: curl -X GET http://${bmc}/redfish/v1/Systems/system/LogServices/PostCodes/Entries ... { "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-605", "@odata.type": "#LogEntry.v1_8_0.LogEntry", "Created": "1970-01-01T00:11:17+00:00", "EntryType": "Event", "Id": "B1-605", "Message": "Boot Count: 1; Time Stamp Offset: 603.1745 seconds; POST Code: 0x84", "MessageArgs": [ "1", "603.1745", "0x84" ], "MessageId": "OpenBMC.0.2.BIOSPOSTCode", "Name": "POST Code Log Entry", "Severity": "OK" } ], curl -X GET http://${bmc}/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-605 { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The resource at the URI '/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-605' was not found.", "MessageArgs": [ "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-605" ], "MessageId": "Base.1.11.0.ResourceMissingAtURI", "MessageSeverity": "Critical", "Resolution": "Place a valid resource at the URI or correct the URI and resubmit the request." } ], "code": "Base.1.11.0.ResourceMissingAtURI", "message": "The resource at the URI '/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-605' was not found." } After fixed: curl -X GET http://${bmc}/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-605 { "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries", "@odata.type": "#LogEntry.v1_4_0.LogEntry", "Description": "Collection of POST Code Log Entries", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-605", "@odata.type": "#LogEntry.v1_8_0.LogEntry", "Created": "1970-01-01T00:11:17+00:00", "EntryType": "Event", "Id": "B1-605", "Message": "Boot Count: 1; Time Stamp Offset: 603.1745 seconds; POST Code: 0x84", "MessageArgs": [ "1", "603.1745", "0x84" ], "MessageId": "OpenBMC.0.2.BIOSPOSTCode", "Name": "POST Code Log Entry", "Severity": "OK" } ], Signed-off-by: Tony Lee <tony.lee@quantatw.com> Change-Id: Iada035214a9c1dc47be00c0ed3010562b80b0a3c