Age | Commit message (Collapse) | Author | Files | Lines |
|
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
|
|
This likely has no performance implications in practice, but getting a
clean cppcheck run is good. Suggestion was implemented per cppcheck.
Tested: This is in the deprecated rest API. Not sure how much testing
we need to do.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I1658697730ac07c7cdefd2b73c80ee65fba4dedb
|
|
CBOR is a more efficient way to represent json, and something that, as
you can see from this patch, is relatively trivial to implement in our
current nlohmann json handlers. This allows users that specify an
accepts header of "application/cbor" to request the BMC produce a cbor
response.
This feature adds 1520 bytes (1.48KB) to the binary size of bmcweb.
For ServiceRoot
GET /redfish/v1 Accepts: application/json - returns json
GET /redfish/v1 Accepts: application/cbor - returns cbor
GET /redfish/v1 Accepts: */* - returns json
GET /redfish/v1 Accepts: text/html - returns html
GET /redfish/v1 no-accepts header - returns json
For service root, CBOR encoding drops the payload size from 1520 bytes
on my system, to 1021 byes, which is a significant improvement in the
number of bytes we need to compress.
Redfish-service-validator passes.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I847e678cf79dfd7d55e6d3b26960c419e47063af
|
|
cppcheck correctly notes that a lot of our variables can be declared at
more specific scopes, and in every case, it seems to be correct.
Tested: Redfish service validator passes. Unit test coverage on others.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ia4414410d0e8f74a3bd40fdc0e0232450d1a6416
|
|
GET function on the config files path now lists all the contents
including sub directories. Creation of subdirectories under config files
is not allowed from the UI, however its possible to create manually.
If we try to access a subfolder with GET command, bmcweb handle the
folder name as file name and crashes trying to open.
Hence we limit the use of subfolder under config files by not listing
them in the response of the GET command. And returning an error if the
user is trying to run a GET on subfolder created manually.
Tested:
Create subfolder under configfiles path
curl -k -H "X-Auth-Token: $bmc_token" -X GET -D patch1.txt
https://${bmc}/ibm/v1/Host/ConfigFiles
Without fix:
Lists all contents of the ConfigFiles folder
With Fix:
lists only the regular files
Run the command with subfolder
curl -k -H "X-Auth-Token: $bmc_token" -X GET -D patch1.txt
https://${bmc}/ibm/v1/Host/ConfigFiles/testfolder
Without fix:
bmcweb crashes
With the fix:
“Description”: “Resource Not Found”
Change-Id: I71ef5523c6bc425e880a28a6e1175c677ef0a102
Signed-off-by: Jishnu C M <jishnunambiarcm@duck.com>
|
|
There are a number of properties of Type "string (uri)" for which we
do not currently support adding prefixes. This patch adds support
for all existing URI properties which are missed by the existing
implementation.
This change will be needed by future patches which will expand
aggregation support to all top level collections defined by the
schema. Those collections that are not currently supported include
properties whose URIs should be fixed, but would be missed by the
existing implementation.
Tested:
New unit test passes.
URI properties are still handled correctly.
```shell
curl localhost/redfish/v1/Chassis/5B247A_<chassisID>
{
"@odata.id": "/redfish/v1/Chassis/5B247A_<chassisID>",
"@odata.type": "#Chassis.v1_16_0.Chassis",
"Actions": {
"#Chassis.Reset": {
"@Redfish.ActionInfo": "/redfish/v1/Chassis/5B247A_<chassisID>/ResetActionInfo",
"target": "/redfish/v1/Chassis/5B247A_<chassisID>/Actions/Chassis.Reset"
}
},
...
}
```
Signed-off-by: Carson Labrado <clabrado@google.com>
Change-Id: I3b3e06ee3191564d266598f7bc9f1641e6fcb333
|
|
There are currently many files that use the GetSubTree and
GetSubTreePaths methods. Since they are a general method, they are
defined in the dbus_utility.hpp file and will be further refactored
in subsequent patches.
Also, Updated the doPath method of NetworkProtocol synchronously.
Tested: Built bmcweb successfully and Validator passes
1. doGet NetworkProtocol
curl -k -H "X-Auth-Token: $token"
https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol
{
"@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol",
"IPMI": {
"Port": 623,
"ProtocolEnabled": true
},
...
}
2. change the ProtocolEnabled property to false
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json"
-X PATCH -d '{"IPMI": {"ProtocolEnabled" :false}}'
https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol
3. doGet NetworkProtocol again
curl -k -H "X-Auth-Token: $token"
https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol
{
"@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol",
"IPMI": {
"Port": null,
"ProtocolEnabled": false
},
...
}
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I9ed3de74417d2662a7f433ea4a589f68f514a369
|
|
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>
|
|
This commit fixed several places (but not all) where wrong include
directory is specified and prevent the clean up in the chidren changes.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ibbba62e2c0cfe3583a65f1befa1b233bd3eebf19
|
|
In 2022.2, Redfish added support for the Context parameter on the
Session Resource. This parameter has the same function that the
OemSession.ClientId field served. This commit moves all the existing
ClientId code to produce Context as well.
Functionally, this has one important difference, in that Context in
Redfish is optionally provided by the user, which means we need to omit
it if not given by the user. The old implementation left it set to
empty string ("").
Because of this, a few minor interfaces need to change to use
std::optional. Existing uses of clientId are moved to using
value_or("") to keep the same behavior as before.
Tested:
curl --insecure -X POST -d "{\"UserName\": \"root\", \"Password\":
\"0penBmc\"}" https://192.168.7.2/redfish/v1/SessionService/Sessions
Returns a Session object with no Context key present
curl --insecure -X POST -d "{\"UserName\": \"root\", \"Password\":
\"0penBmc\", \"Context\": \"Foobar\"}"
https://192.168.7.2/redfish/v1/SessionService/Sessions
Returns a Session object with:
"Context": "Foobar"
Subsequent Gets of /redfish/v1/SessionService/Sessions/<sid>
return the same session objects, both with and without Context.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I4df358623f93f3e6cb659e99970ad909cefebc62
|
|
std::string_view causes invalid memory access in multipart branch when
assigned local variable goes out of scope and string_view is passed to
ramAuthenticateUser. Moved MultipartParser to higher scope, to ensure
it is not deleted before std::string_view.
Tested:
- Executed post on /login, got response:
{
"data": "User 'root' logged in",
"message": "200 OK",
"status": "ok"
}
Change-Id: I0b02dddcb1a887d442525ffedb7a08a00087f2f2
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
|
|
- Index was not checked against size before dereference. Which cased to
override memory.
- Header without colon could put parser into invalid state. Now it will
return with error.
- Content after boundary was not correctly discarded.
- Parser did not check body for final boudary. Now missing final
boundary will return with error.
Tested:
- Tested that payload with header without colon doesn't cause memory
corruption anymore.
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I12f496ab5f53e6c088cdfdf2e96be636d66f7c7f
|
|
clang-tidy-15 is raising the following warning, which it automatically
fixed:
```
../include/sessions.hpp:262:38: error: unnecessary temporary object created while calling emplace [modernize-use-emplace,-warnings-as-errors]
auto it = authTokens.emplace(std::make_pair(sessionToken, session));
^~~~~~~~~~~~~~~ ~
```
Apply automatically generated fix.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I425efdcba4bf08b03d64f8fb913eab956f5a198d
|
|
An HTTP header of Accepts: */* throws a big wrench into our
implementation for a couple reasons. First, because it's the default in
a lot of commonly-used libraries, and second, because clients use it
when they certainly don't mean what the specification says it should
mean "ie, I accept ANY type".
This commit tries to address some of that, by making an explicit option
for content-type="ANY" and pushes it to the individual callers to handle
explicitly as if it were yet another type. In most protocols, there's a
"most common" representation, so protocols are free to use that, or to
explicitly handle it, and require that the user be explicit.
Tested:
Redfish Protocol Validator no longer locks up. (TBD, getting bugs filed
with protocol validator for this missing Accepts header).
For ServiceRoot
GET /redfish/v1 Accepts: application/json - returns json
GET /redfish/v1 Accepts: */* - returns json
GET /redfish/v1 Accepts: text/html - returns html
GET /redfish/v1 no-accepts header - returns json
Redfish-service-validator passes.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iae6711ae587115d3e159a48a6fc46a903ed6c403
|
|
Like other C++ projects, unit tests normally are in a separate repo and
respect the folder structure of the file under test.
This commit deleted all "ut" folder and move tests to a "test" folder.
The test folder also has similar structure as the main folder.
This commit also made neccessary include changes to make codes compile.
Unused tests are untouched.
Tested: unit test passed.
Reference:
[1] https://github.com/grpc/grpc/tree/master/test
[2] https://github.com/boostorg/core/tree/414dfb466878af427d33b36e6ccf84d21c0e081b/test
[3] Many other OpenBMC repos: https://github.com/openbmc/entity-manager/tree/master/test
[4] https://stackoverflow.com/questions/2360734/whats-a-good-directory-structure-for-larger-c-projects-using-makefile
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I4521c7ef5fa03c47cca5c146d322bbb51365ee96
|
|
We have a number of specialized content-type functions for varying
levels of degree, and most of them rely on quite a few strings. This
commit changes them to consolidate on two APIs.
isContentTypeSupported, which as the name implies, takes a single
content type, and returns a bool about whether or not that content type
is allowed.
getPreferedContentType, which takes an array of multiple options, and
fine the first one in the list that matches the clients expected string.
These two functions makes these functions more able to be reused in the
future, and don't require specialized entries for each possible type or
combination of types that we need to check for.
Tested: Unit tests passing. Pretty good coverage.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I8b976d0cefec5f24e62fbbfae33d12cc803cb373
|
|
The following error reports have started to be reported by clang-tidy:
* readability-qualified-auto - add 'const' to `auto&` iterators
* bugprone-use-after-move - add break in loop after element is found
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I5314559f62f58aa032d4c74946b8e3e4ce6be808
|
|
According to Redfish Base Message Registry definition [1], the first
argument of ResourceNotFound and ResourceAlreadyExists is the schema
name of the resource. This patch changes the first argument to non-
versioned schema name treewide.
Tested:
Verified the error message matches the definition, and Redfish Service
Validator passed.
[1] https://redfish.dmtf.org/registries/Base.1.13.0.json
Change-Id: Ib5cd853578ef0bffda1184d10827241e94faaf68
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
This commit optimizes the release lock code and adds some traces to give
more data for lock conflict scenarios
Tested by:
1. With dual client connected, verified the conflicts are returned
2. Tested releaseLock usecase
Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com>
Change-Id: I3cf99aaa5cc7c2967ae8dbc9c76c9f7378ecebdd
|
|
This commit fixes the below issues
1. Bump up the ConfigFile directory max limit
For large configurations on the system, the current directory size
upper limit of 10MB was exceeding and BMC was sending the error back
to the client. This fails the entire large config support.
This commit Increases this upper limit of the configFile dir to 25MB
2. Return 409 Error for a lock conflict
Tested by:
1. ConfigFile read
2. Single file upload
3. AcquireLock from the same client returns 409
Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com>
Change-Id: I9218e8263f31e519d76683822290dfe259c57192
|
|
used sdbusplus::unpackPropertiesNoThrow in openbmc_dbus_rest.hpp,
memory.hpp and sensors.hpp, also replaced all usages of "GetAll" with
sdbusplus::asio::getAllProperties
bmcweb size: 2697624 -> 2697624 (0)
compressed size: 1129645 -> 1130037 (+392)
Tested:
Performed get on:
- /redfish/v1/Systems/system/Memory/dimm0
Performed get one of the members of:
- /redfish/v1/Chassis/chassis/Sensors
Get result before and after the change was in same format.
Change-Id: I05efcedfd905ea2c8d1d663e909cb59ebc2cf2b7
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
|
|
This commit adds the initial SSL support for http_client which can be
used for sending asynchronous Events/MetricReports to subscribed Event
Listener servers over secure channel.
Current implementation of http client only works for http protocol.
With current implementation, http client can be configured to work
with secure http (HTTPS). As part of implementation it adds the SSL
handshake mechanism and enforces the peer ceritificate verification.
The http-client uses the cipher suites which are supported by mozilla
browser and as recommended by OWASP. For better security enforcement
its disables the SSLv2, SSLv3, TLSv1, TLSv1.1 as described in below
OWASP cheetsheet.
It is validated with RootCA certificate(PEM) for now. Adding support
for different certificates can be looked in future as need arises.
[1]: https://cheatsheetseries.owasp.org/cheatsheets/TLS_Cipher_String_Cheat_Sheet.html
Tested:
- Created new subscription with SSL destination(https) and confirmed
that events are seen on EventListener side.
URI: /redfish/v1/EventService/Subscriptions
Method: POST
Body:
{
"Context": "CustomText",
"Destination": "https://<IP>:4000/service/collector/event_logs",
"EventFormatType": "Event",
"DeliveryRetryPolicy": "RetryForever",
"Protocol": "Redfish"
}
- Unit tested the non-SSL connection by disabling the check in code
(Note: EventService blocks all Non-SSL destinations). Verified that
all events are properly shown on EventListener.
URI: /redfish/v1/EventService/Subscriptions
Method: POST
Body:
{
"Context": "CustomText",
"Destination": "http://<IP>:4001/service/collector/event_logs",
"EventFormatType": "Event",
"Protocol": "Redfish"
}
- Combined above two tests and verified both SSL & Non-SSL work fine in
congention.
- Created subscription with different URI paths on same IP, Port and
protocol and verified that events sent as expected.
Change-Id: I13b2fc942c9ce6c55cd7348aae1e088a3f3d7fd9
Signed-off-by: AppaRao Puli <apparao.puli@intel.com>
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
bmcweb does not do anything with the q-factor weighting (;q=) so just
remove it from the encoding.
This is needed because routes like
"/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/attachment"
have a check for isOctetAccepted. Even though */* is in the Accept
Header isOctetAccepted still fails due to the q-factor weighting.
On the system I tested, on firefox, Accept looks like:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
The GUI reported being unable to download a AdditionalDataURI (e.g.
...attachment/)
Here is the GUI code attempting to download the additional data:
https://github.com/openbmc/webui-vue/blob/9b79a6e7e3df3d3cbaf9a7750bbe343628022026/src/views/Logs/EventLogs/EventLogs.vue#L155
https://github.com/openbmc/webui-vue/blob/9b79a6e7e3df3d3cbaf9a7750bbe343628022026/src/locales/en-US.json#L251
Today this results in a 400 Bad Request due to isOctetAccepted.
See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept
Tested:
/redfish/v1/Systems/system/LogServices/PostCodes/Entries/<str>/attachment/
and .../EventLog/Entries/<str>/attachment now return correctly.
Change-Id: I969f5f2c32c4acccd4d80615f17c44d0c8fabd0d
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
|
|
Type alias ManagedItem is identical to ManagedObjectType::value_type,
remove it.
Tested:
Build pass. No significant change in compressed binary size.
Change-Id: I6d0f0498399ee639d8a5445fe908a7c311327e41
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
The isConflictRecord method was returning false by default which is
causing ignoring the same resourceId conflicts.
Same resourceId case will pass all the conditions and reach to the end
of the function. Returning true means that there is a conflict.
This commit fixes this by returning true by default
Tested by:
1. Send writeLock requests with same resourceId and segment length
Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com>
Change-Id: Ie65c6394988a357a8c811b621e113c14924bb8f6
|
|
There are two overloads of addHeader, one that takes a string, and one
that takes a boost enum. For most common headers, boost contains a
string table with all of those entries anyway, so there's no point in
duplicating the strings, and ensures that we don't make trivial
mistakes, like capitalization or - versus underscore that aren't caught
at compile time.
Tested:
This saves a trivial amount (572 bytes) of compressed binary size.
curl --insecure -vvv --user root:0penBmc https://192.168.7.2/redfish/v1
returns < Content-Type: application/json
curl --insecure -vvv -H "Accept: text/html" --user root:0penBmc https://192.168.7.2/redfish/v1
Returns
< Content-Type: text/html;charset=UTF-8
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I34c198b4f9e219247fcfe719f9b3616d35aea3dc
|
|
There is a bug where, when running an expand query, headers from the
response object get dropped. These headers include OData.type, and the
newly minted Link header, as well as possible others.
This was actually noted in a TODO, although the author of the TODO,
didn't fully understand the consequences at the time, and thought there
was no functional impact.
To resolve this, this commit resolves the TODO, and allows the Response
object to be moved out, instead of having to create a new one, which
preserves all the response state. To do this, it creates a move
constructor on the Response object for this use. The move constructor
is relatively benign, with one caveat, that we might be moving while in
a completion handler (as is the most common use). So both the existing
operator= and Response() move constructor are amended to handle this
case, and simply null out the response object in the copied object,
which would be correct behavior, given that each callback handler should
only be called once per Response object.
Tested:
curl --insecure --user root:0penBmc -vvvv
https://192.168.7.2/redfish/v1\?\$expand\=\*\(\$levels\=2\)
returns the same body as previously, now with the included:
OData-Version: 4.0
Allow: Get
headers in the response.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I221364dd4304903b37cacb1386f621b073a0a891
|
|
Today `basic-auth` (and other options) can be enabled even if
`insecure-disable-auth` is enabled, which doesn't make sense.
With this block this commit added in meson, If we disable authx with
`insecure-disable-auth`, then all these auth options will be ignored.
Tested:
1. code compiles with and without 'insecure-disable-auth'.
2. No new service validator errors when 'insecure-disable-auth' is
turned on.
3. No new service validator errors when 'insecure-disable-auth' is
turned off.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I2c634851f7aa7b9e57158770c5d40c12954c93a7
|
|
The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are for:
* bus_t
* exception_t
* manager_t
* match_t
* message_t
* object_t
* slot_t
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I46a5eec210002af84239af74a93c830b1d4a13f1
|
|
These changes are done by running iwyu manually under clang14.
Suppressed some obvious impl or details headers. Kept the recommended
public headers.
IWYU can increase readability, make maintenance easier, and avoid errors
in some cases. See details in
https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/WhyIWYU.md.
This commit also uses its best effort to correct obvious errors through
iwyu pragma.
See reference here:
https://github.com/include-what-you-use/include-what-you-use#how-to-correct-iwyu-mistakes
Tested: unit test passed.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I983b6f75601707cbb0f2f04546c3362ff4ba7fee
|
|
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
|
|
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
|
|
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
|
|
Tested: unit test worked.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I4feb6c9cdf52930617a7011732a5837f06c1adda
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
To save duplicate codes.
Tested: unit test passes.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ibb641942b24a92f61793995337963be80d4a6151
|
|
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
|
|
"gmock/gmock.h" should be replaced with "gtest/gtest.h" given that only
GTest macors are used.
"http_utility.hpp" is a local header and "gtest/gtest.h" is a header in
dependencies. The convention is to use <> for dependency headers.
Reference: https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
Tested: unit test passed
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I42b077090df59ee1c4fbfab3199d2ee9b4b242dc
|
|
Removed unused headers and include missing headers.
Tested: unit test passes.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ie04af6c00d849f268ededffb3d01bb79f0f895cd
|
|
This commit does nothing but add namespace to the test source. It can be
shown that it saves a lot of duplicate codes.
Tested: unit test compiles and passes.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I42a70c5c32c32c1cb09f7c3e36d6e5816aa3a53e
|
|
Add an anonymous namespace and use using declarations.
Tested: unit test passed.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I2d29aa7ec7923addc41b0af564542932a5abd9b4
|