Age | Commit message (Collapse) | Author | Files | Lines |
|
The usual updates to make code compile on clang again. Extra semicolons
that have snuck in, missing inline and static definitions.
Tested: Code compiles on clang.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Id7f889de98cafaa89471d75ed3e3bb97ab3855cd
|
|
For any expand query, the current implementation does all queries in a
single MultiAsyncResp, where the code sends a bunch of requests without
Query parameters. This makes it impossible to invoke efficient expand
handlers, since efficent handlers will only be invoked when a query has
$expand in its parameters. (Delegation only happens when the query
contains query parameters)
To solve it, in this commit, we proposed to send a bunch of requests
**WITH** Query parameters in MultiAsyncResp. This makes
"/redfish/v1/Chassis/chassis?expand=.($levels=2)" be able to invoke
efficient expand handlers that we developed for sensors, which existing
implementation can't do. This decreases latency by nearly 100 times (the
improvement that efficient sensor expand handler provides) on real
hardware which contains 5+ chassis and totally 220+ sensors.
This commit aligns with future $select support well, since the recursive
queries can add $select as part of the query parameters.
With this commit, though we create multiple MultiAsyncResp objects
memory doesn't increase significantly; part of the reason is that we are
not copying Query anymore in MultiAsyncResp.
No out-of-memory issues are found when 4 threads are querying
expand=levels=6 at the service root on a real large hardware which
contains 2+ sockets, 5+ chassis, 220+ sensors, 30+ DIMMs, etc.
Tested:
1. On real hardware, /redfish/v1/Chassis?$expand=.(level=3) is giving
the correct result and invokes efficient sensor Expand handler
2. stress test
```
for i in {1..4};
do
echo "thread $i"
wget -qO- 'http://localhost:18080/redfish/v1?$expand=*($levels=6)' > "/tmp/$i.log" &
done
for i in {1..1000};
do
top -b -n 1 | grep bmcweb >> /tmp/bmcweb_ori.log
sleep 1
done
```
Results
```
25878 2856 root R 194m 20% 1 38% /tmp/bmcweb_after
19005 2856 root R 215m 22% 1 36% /tmp/bmcweb_ori
```
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I0e661db0263f56dd0cab66047a0a5d4fff31b69a
|
|
Make /redfish/v1 get instantiated in the same place as the other redfish
routes, and not in main().
Tested:
curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish
returns the same value as previously.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Icb93954c00a4cf41708f1b323ddbd83e61146e5d
|
|
clang-tidy has a setting, LambdaBodyIndentation, which it says:
"For callback-heavy code, it may improve readability to have the
signature indented two levels and to use OuterScope."
bmcweb is very callback heavy code. Try to enable it and see if that
improves things. There are many cases where the length of a lambda call
will change, and reindent the entire lambda function. This is really
bad for code reviews, as it's difficult to see the lines changed. This
commit should resolve it. This does have the downside of reindenting a
lot of functions, which is unfortunate, but probably worth it in the
long run.
All changes except for the .clang-format file were made by the robot.
Tested: Code compiles, whitespace changes only.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ib4aa2f1391fada981febd25b67dcdb9143827f43
|
|
Modifies HttpClient so that the HTTP verb and headers can be set
for each individual message sent. Right now those fields are set
when a connection is first created and then reused by each
message sent using that connection.
Tested:
Launched two Event Listener servers that created 6 and 2
subscriptions. Sending a test event resulted in the servers
receiving 6 requests and 2 requests, respectively.
Change-Id: I8d7e2d54385bc2c403498293820adb584bff8b57
Signed-off-by: Carson Labrado <clabrado@google.com>
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
Adds a RedfishAggregator class which is able to pull configuration
information from D-Bus for Satellite BMCs. These BMCs will be
aggregated by Redfish Aggregation. Also added is a new compiler
option which will be used to enable Redfish Aggregation.
This patch only allows configurations with unencrypted and
unauthenticated satellite BMC communication. Support for encryption
and authentication willneed to be added in future patches.
Note that this patch does not actually use the config information
after it has been fetched. That functionality will be added in
future patches.
Tested:
I made this example config information available on D-Bus
busctl introspect xyz.openbmc_project.EntityManager \
/xyz/openbmc_project/inventory/system/board/SatelliteBMC/aggregated0 \
xyz.openbmc_project.Configuration.SatelliteController
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.AuthType property s "None" emits-change
.Hostname property s "127.0.0.1" emits-change
.Name property s "aggregated0" emits-change
.Port property t 443 emits-change
.Type property s "SatelliteController" emits-change
That information was picked up by the changes in this CL:
[DEBUG "redfish_aggregator.hpp":80] Found Satellite Controller at /xyz/openbmc_project/inventory/system/board/SatelliteBMC/aggregated0
[DEBUG "redfish_aggregator.hpp":209] Added satellite config aggregated0 at http://127.0.0.1:443
[DEBUG "redfish_aggregator.hpp":52] Redfish Aggregation enabled with 1 satellite BMCs
[DEBUG "redfish_aggregator.hpp":21] There were 1 satellite configs found at startup
Signed-off-by: Carson Labrado <clabrado@google.com>
Change-Id: Ib5eee2c93aeb209157191055975c127759d73627
|
|
These are Google only resources powered by Hoth DBus interface.
The ComponentsProtected links is hardcoded for now.
But it will be queried from DBus and interpreted accordingly in the
future.
TEST:
$curl -u root:0penBmc -X GET http://[::1]:$PORT/google/v1/RootOfTrustCollection
{
"@odata.id": "/google/v1/RootOfTrustCollection",
"@odata.type": "#RootOfTrustCollection.RootOfTrustCollection",
"Members": [
{
"@odata.id": "/google/v1/RootOfTrustCollection/Hoth"
}
],
"Members@odata.count": 1
}
$ curl -u root:0penBmc -X GET http://[::1]:$PORT/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"
}
},
"Id": "Hoth",
"Location": {
"PartLocation": {
"ServiceLabel": "Hoth",
"Locationtype": "Embedded"
}
},
"Name": "RootOfTrust-Hoth",
"Status": {
"State": "Enabled"
}
$ curl -u root:0penBmc -X POST -d @req.json -H "Content-Type: application/json" http://[::1]:$PORT/google/v1/RootOfTrustCollection/Hoth/Actions/RootOfTrust.SendCommand
{
"CommandResponse": "033B0000"
}
Signed-off-by: Vidya Satyamsetti <satyamsetti@google.com>
Change-Id: If64612468bb89e6d9251d848697608b7daf37339
|
|
The Redfish specification section 8.1 lists header values that should be
returned from responses. It lists OData.Version: 4.0 as required in
this same section.
Implement this to the specification.
Tested:
Redfish protocol validator RESP_HEADERS_ODATA_VERSION test now passes.
curl --vvv https://$bmc/redfish/v1 shows Odata.Version header set in
response.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Id02ec218299524905fbd91cb161bfe727a51fc65
|
|
Brace initialization of json objects, while quite interesting from an
academic sense, are very difficult for people to grok, and lead to
inconsistencies. This patchset aims to remove a majority of them in
lieu of operator[]. Interestingly, this saves about 1% of the binary
size of bmcweb.
This also has an added benefit that as a design pattern, we're never
constructing a new object, then moving it into place, we're always
adding to the existing object, which in the future _could_ make things
like OEM schemas or properties easier, as there's no case where we're
completely replacing the response object.
Tested:
Ran redfish service validator. No new failures.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iae409b0a40ddd3ae6112cb2d52c6f6ab388595fe
|
|
Refactors HttpClient with the following changes:
- Convert class to singleton
- Replace circular buffers with devectors
- Sending queued requests and closing connections handled
within their own callback
- Add connection pooling (max size 4)
- HttpClient supports multiple connections to multiple clients
- Retry policies can be set for specific use cases
Also modifies its use in the Subscription class to be compatible
with the refactored code.
It is assumed that a BMC will be able to handle 4 parallel
connections and thus the max pool size is set as 4. The max
number of queued messages was left unchanged at 50. Eventually
we may want to allow tuning of these limits to boost performance.
That would come in a future patch.
Tested:
Launched two Event Listener servers that created 6 and 2
subscriptions. Sending a test event created a connection pool
for each server. 4 and 2 connections were added to each pool,
respectively and were used to send the test request. For the first
pool the 2 extra requests were placed into a queue until
connections became available. After a request completed, its
associated connection was used to send the next request in
the queue. Resending the test event caused those prior connections
to be reused instead of new connections being added to the pools.
Signed-off-by: Carson Labrado <clabrado@google.com>
Change-Id: Iba72b3e342cdc05d1fb972e2e9856763a0a1b3c5
|
|
$top and $skip are parameters for controlling the responses of
collections, to limit their size, per the Redfish specification section
7.4.
$skip=integer "Applies to resource collections. Returns a subset of the
members in a resource collection, or an empty set of members if the
$skip value is greater than or equal to the member count. This paging
query parameter defines the number of members in the resource collection
to skip."
$top=<integer> "Applies to resource collections. Defines the number of
members to show in the response. Minimum value is 0 , though a value of
0 returns an empty set of members."
This commit implements them within the resource query.
Tested:
curl --insecure --user root:0penBmc https://localhost:18080/redfish/v1/Registries\?\$top\=1
Returns 1 value. Walking through values of 1-5 (there are 4 registries
currently) returns the appropriate sizes of collection (with 5 returning
4 entries).
curl --insecure --user root:0penBmc https://localhost:18080/redfish/v1/Registries\?\$skip\=0
Returns the collection. $skip values of 0-5 return descending number of
results.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ied8a8f8338f119173509fb4b7ba2bd4a6c49cae8
|
|
Old codes handle links incorrectly; when links appear before some
keys, old codes don't expand these keys.
Tested:
1. On real hardware, Expand with links are working correctly.
2. Unit tests.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I028b55579d833f23120987a24cef4442fdd5800d
|
|
This change adds OpenBMC.1.0.ServiceStarted to the registry, and adds a
test case for getMessage and getMessageFromRegistry. The
getMessageFromRegistry function is moved to a .cpp file so it can be
called from the test.
Unit test passes.
When tested in QEMU: With
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/52591 applied,
restarting a service generates a corresponding log entry.
bmc# systemctl restart rsyslogd
host$ wget -q -O - \
http://localhost:10080/redfish/v1/Systems/system/LogServices/EventLog/Entries/
...
{
"@odata.id":
/redfish/v1/Systems/system/LogServices/EventLog/Entries/47441_1",
"@odata.type": "#LogEntry.v1_8_0.LogEntry",
"Created": "1970-01-01T13:10:41+00:00",
"EntryType": "Event",
"Id": "47441_1",
"Message": "Service rsyslog.service has started successfully.",
"MessageArgs": [
"rsyslog.service"
],
"MessageId": "OpenBMC.1.0.ServiceStarted",
"Name": "System Event Log Entry",
"Severity": "OK"
},
Signed-off-by: Sui Chen <suichen@google.com>
Change-Id: Iea6fa6e3ea8591853169043c1c04f5a7cf00b2f6
|
|
The commit prior to this one added support for delegation of $expand and
$only query param types; This commit adds support for delegation of top
and skip (which we already have a few handlers for) and moves them to
the new style.
Note, this makes top and skip query params NOT below the
insecure-enable-redfish-query. top and skip have existed for a while,
and are unlikely to have security issues, as they're relatively simple
transforms.
Tested:
curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/Managers/bmc/LogServices/Journal/Entries\?\$top\=3\&\$skip\=0
With varying $top between 1-5 and $skip between 0-5 gave the expected
number of log results.
Unit tests pass.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ia213a5e929c40579825eaf251e4b9159bc84c802
|
|
insecure-enable-redfish-query is really only intended to protect the
user from things that might run the system out of resources, like
expand, or complex filter queries (ie queries that might pop the
stack). This commit message moves the location where the parameters are
enabled/disabled into the parser itself, such that some parameters (like
top and skip in the next commit) can be executed outside of this option
flag.
Because of moving the expand support deeper in the call stack, some unit
tests now need to be aware of whether or not expand is supported in the
configuration.
Tested:
Enabled query option through local.conf with
EXTRA_OEMESON:pn-bmcweb:append =
"-Dinsecure-enable-redfish-query='enabled'"
Then did:
curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1\?\$expand\=\*
Query expanded as expected;
set insecure-enable-redfish-query='disabled'
and observed that the same curl query returned
QueryParameterValueFormatError, which is expected.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I24fbc2c9f64628d6457dd117b61ff22b276b0682
|
|
As the patch at
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/50994 can attest,
parsing urls with a regex is error prone. We should avoid it where
possible, and we have boost::urls that implements a full, correct, and
unit tested parser.
Ideally, eventually this helper function would devolve into just the
parse_uri, and setting defaults portion, and we could rely on the
boost::urls::url class to pass into things like http_client.
As a side note, because boost url implements port as a proper type-safe
uint16, some interfaces that previously accepted port by std::string&
needed to be modified, and is included in this patch.
Also, once moved, the branch on the ifdef for HTTP push support was
failing a clang-tidy validation. This is a known limitation of using
ifdefs for our code, and something we've solved with the header file, so
move the http push enabler to the header file.
Also note that given this reorganization, two EXPECT statements are
added to the unit tests for user input behaviors that the old code
previously did not handle properly.
Tested: Unit tests passing
Ran Redfish-Event-Listener, saw subscription create properly:
Subcription is successful for https://192.168.7.2, /redfish/v1/EventService/Subscriptions/2197426973
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ia4127c6cbcde6002fe8a50348792024d1d615e8f
|
|
From the quoted section of the spec in the patchset, we should be
ignoring odata annotations on PATCH requests. This commit implements a
preliminary loop through the json object, and removes the odata items
before processing begins.
Tested:
curl -vvvv --insecure --user root:0penBmc -X PATCH -d '{"@odata.etag":
"my_etag"}' https://192.168.7.2/redfish/v1/AccountService/Accounts/root
returns: Base.1.11.0.NoOperation
Redfish protocol validator now passes the REQ_PATCH_ODATA_PROPS test.
Included unit tests passing.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I62be75342681d147b8536fd122bbc793eeaa3788
|
|
In kernel inotify, the inotify_event.name is padded to a mutiple of
sizeof(inotify_event) with '\0' and len is the size of char[] name,
not the actual size of name. So constructing the name string with
std::string(name, len) constructs a string with all the '\0's, which
is not equal to the filename. This patch uses std::string(name) so
that the string does not contain these '\0's.
Tested:
Manually create/delete /var/log/redfish, confirmed handler is entered
by log.
Change-Id: Ibaa96dd5c47b0205541a6ee155daa593b2e2114d
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
This change is adding helper template function, which can be used both
to validate and read segments from segments_view returned by boost_url
parser. Number of segments is also validated - in case when argument
count differs from them, false will be returned. In case when we want to
validate only existence of a segment, special argument can be passed in
its place: 'anySegment'.
Reasoning why url_view was chosen instead of strings:
- This way code generation is kept minimal.
- There are multiple parse functions in boost_url with different rules,
but all of them return url_view. This solution should accommodate
every use case.
Testing done:
- Unit tests are added, passing.
- Refactored part of telemetry to use this new approach, no regression
spotted during simple POST/GET tests.
Change-Id: I677a34e1ee570d33f2322a80dc1629f88273e0d5
Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
|
|
The generic query parameter handlers might not be performant, e.g.,
Expand in the sensor collections. This change adds a way to delegate
query parameter processsing to redfish-core codes:
1. introduced a separate struct in the setUpRedfishRoute function, with
which redfish-core codes can easily set delegation for each parameter;
for example, the children patch of this PR will implement an efficient
handler for sensor collection Expand, top, and skip.
2. introduced a separate Redfish route for delegation; this routes takes
the struct described above and changes the query object so that query
parameters are delegated.
3. in order to avoid copying Query objects and run delegation check
twice, the |setUpRedfishRouteWithDelegation| function sets |delegated|
so that callers can directly use it to determinte if delegation is
needed, and what delegated Queries are
Tested:
1. added unit tests
2. the default redfish route is still working correctly
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I77597ad7e8b40ac179d86dc9be1a35767cc61284
|
|
The latest C++ no longer requires the size of the array to be hardcoded.
This removes the hardcoded size to simplify changes to the message
arrays.
Tested:
Confirmed that event Messages are still correctly generated.
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
Change-Id: I29e6a4a02c247865c275cf4ff71587bc188d5957
|
|
When BIOS attributes are changed via OOB (using Redfish PATCH operation)
No Redfish event is logged.
Added a Message Registry entry to inform that a set of BIOS attributes
are changed via OOB. It will be logged after BIOS reset, during which
attributes are re-populated with patched values.
Changing the BIOS attributes via OOB is possible only through
Redfish PATCH operation currently and not supported through IPMI.
This event is implemented for the following review.
https://gerrit.openbmc-project.xyz/c/openbmc/intel-ipmi-oem/+/52320
Tested:
1. Redfish validator - passed for this new addition.
2. Enable "BMC Remote Setup" and Set BIOS admin password.
3. Do BIOS reset.
4. Check for the attributes in redfish uri
GET: /redfish/v1/Systems/system/Bios
Response: Success
5. Patch any attribute.
PATCH: /redfish/v1/Systems/system/Bios/Settings
Body:
{
"data": {
"serialDebugMsgLvl": "0x2"
}}
Response: Success
6. Do BIOS reset.
7. Verified in Redfish, Biosattribute change message populated.
GET: /redfish/v1/Systems/system/LogServices/EventLog/Entries
Response:
{
"@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/32635",
"@odata.type": "#LogEntry.v1_8_0.LogEntry",
"Created": "1970-01-01T09:03:55+00:00",
"EntryType": "Event",
"Id": "32635",
"Message": "Set of BIOS Attributes changed.",
"MessageArgs": [],
"MessageId": "OpenBMC.0.1.BIOSAttributesChanged",
"Name": "System Event Log Entry",
"Severity": "OK"
}
Signed-off-by: Snehalatha Venkatesh <snehalathax.v@intel.com>
Change-Id: Id5c41a40e996b36ab63c7b0cae7fb024f71914fe
|
|
Copying integerals is cheap, and generally is cheaper than copying
references.
Tested: compiles.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I5cb08445d6bc06ed1d0c86c27ca1db1bf4cce316
|
|
The redfish protocol validator is a cruel.... cruel test. In it, it
attempts to send odata-version headers that are not supported by the
spec. bmcweb has never had a use for those headers, and they are
optional to send, so bmcweb ignored them. This patchset fixes that.
The exact wording of the standard is in the patch.
Tested:
curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1
Returns service root
curl --insecure --user root:0penBmc -H "Odata-version: 4.0" https://192.168.7.2/redfish/v1
returns service root
curl --insecure --user root:0penBmc -H "Odata-version: 4.1" https://192.168.7.2/redfish/v1
returns precondition failed message from base registry, and 501 code.
Redfish protocol validator now shows REQ_HEADERS_ODATA_VERSION test
passing.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I7d2f4bd9f6b7f03655d7e169ee20f45f9aaa73e3
|
|
Section 7.3 of the Redfish specification lays out a feature called
"expand" that allows users to expand portions of the Redfish tree
automatically on the server side. This commit implements them to the
specification.
To accomplish this, a new class, MultiAsyncResp is created, that allows
RAII objects to handle lifetime properly. When an expand query is
generated, a MultiAsyncResp object is instantiated, which allows "new"
requests to attach themselves to the multi object, and keep the request
alive until they all complete. This also allows requests to be created,
while requests are in flight, which is required for queries above
depth=1.
Negatives:
Similar to the previous $only commit, this requires that all nodes
redfish nodes now capture App by reference. This is common, but does
interfere with some of our other patterns, and attempts to improve the
syntactic sugar for this proved unworkable.
This commit only adds the above to service root and Computer systems, in
hopes that we find a better syntax before this merges.
Left to future patches in series:
Merging the error json structures in responses.
The Redfish spec isn't very clear on how errors propagate for expanded
queries, and in a conforming we shouldn't ever hit them, but
nonetheless, I suspect the behavior we have is sub-optimal (attaching an
error node to every place in the tree that had an issue) and we should
attempt to do better in the future.
Tested (on previous patch):
curl --insecure --user root:0penBmc https://localhost:18080/redfish/v1\?\$expand\=.\(\$levels\=255\)
Returns the full tree
Setting $levels=1 query returns only a depth of 1 tree being returned.
Unit tests passing
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I874aabfaa9df5dbf832a80ec62ae65369284791d
|
|
Add the query parameter "only" for redfish.
The specification is based on DSP0266_1.8.0.
This commit is inspired by the commit that carries the same title, but
is largely unique, namely, in that it adds the core feature to be able
to recall handle with a new Response object, and make sure the result
gets to the connection. It does this by swapping the handlers and
implementing move semantics on the Response object. It definitely needs
broken up into a few smaller patches, but it does pass the below tests
without any apparent seg faults or ownership issues.
It implements a number of cleanups that deserve their own patches, and
will be split up accordingly, but for the moment, I think this is a good
start to getting filter and expand support in the future.
Tested:
Validator passes (on previous patchset)
~$ curl -i -k -H "X-Auth-Token: $token" -X GET "https://${bmc}/redfish/v1/Systems"
~$ curl -i -k -H "X-Auth-Token: $token" -X GET "https://${bmc}/redfish/v1/Systems?only"
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I123d8ab8bcd88a0b63ff131f6b98548951989755
|
|
This change refactor telemetry code to use bmcweb utility function for
uri construction, which is safe and preferred way, instead of string
operations.
Testing done:
- Some basic GET operations done on Telemetry, no regression.
Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: I6de5d79a078944d398357f27dc0c201c130c4302
|
|
- Added the PropertyValueExternalConflict message registry that
might used to send when the request is failed due to some other
resource state or configuration.
Signed-off-by: Ramesh Iyyar <rameshi1@in.ibm.com>
Change-Id: Ibdb8c21e285079dbaea54b99f207f45892b24ea9
|
|
- Added the PropertyValueResourceConflict message registry that
might used to send when the request is failed due to some other
resource state or configuration.
Signed-off-by: Ramesh Iyyar <rameshi1@in.ibm.com>
Change-Id: I2c03aee88442f6abe55f2a9f574211b8214aa30c
|
|
This saves about 4k on the binary size
Tested: Redfish service validator passes.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I9546227a19c691b1aecb80e80307889548c0293f
|
|
This class has been unused for a long time, ever since moving to the
common AsyncResp.
Tested: Code compiles.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ia74c5ff73e6eb991fac5a8b0292bf59910e9689b
|
|
The routine of intToHexString is mostly common between all the
various implementations, the only difference is in selecting a
reasonable default size for the type. This commit moves to a common
method, so the templates don't get created for each and every
instantiation of intToHexString, and simplifies our code.
This saves a trivial amount (428 bytes) of compressed binary size.
Tested: Unit tests passing, and have good coverage of this.
Memory resources return the values as were there previously.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I6945a81a5e03c7a64d6a2a0629b24db941271930
|
|
There are a couple places we missed inline/static on our headers, and a
couple unused message entry callbacks for which their parameters were
incorrect (which clang caught). Fix all of them.
Tested: Code compiles on clang. No-op changes.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I12c9c04d3b773c4991c6cd92d0cfd42b348762d6
|
|
clang-tidy readability checks are overall a good thing, and help us to
write consistent and readable code, even if it doesn't change the
result.
All changes done by the robot.
Tested: Code compiles, inspection only (changes made by robot)
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iee4a0c74a11eef9f158f0044eae675ebc518b549
|
|
The only changes were to make some functions static, which is
essentially no-op.
Changes were done by the robot.
Tested: Unit tests pass, changes no-op
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Id84ca2bee6f237877ba2900b2cbe4679b38a91dc
|
|
In the way we store the message registry, we store both Severity and
MessageSeverity. Severity as a field is deprecated, and in every case
in every registry both fields have the same value. We shouldn't
duplicate data in that way. This commit changes the parse_registries.py
script to stop producing the Severity field into the struct. The few
uses we have left are moved over to use MessageRegistry.
Tested:
Redfish service validator shows no errors on the
/redfish/v1/Registries tree. Other errors present that were there
previously and are unchanged.
This saves a trivial amount: about 1kB on our compressed binary size.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ibbaf533dc59eb08365d6ed309aba16b54bc40ca1
|
|
The message_registries namespace is overly wordy, and results in very
long defines. Doing this one minor change reduces the code by 50 lines.
This seems worthwhile.
Tested: Unit tests pass. Namespace change only.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ib1401580b3fa47596eb56cdc86e60eeeb1c2f952
|
|
A number of reviews have been submitted that ignore this warning. While
we now have 01caf624211197a993dbbd186149293f7053f9d8 which will catch
these violations at CI time, that is arguably already too late, and
developers will have wasted their time.
This commit changes the warning to be multiple lines, with a caps
header, such that it's less likely to be ignored. It also adds
suggestions on how to proceed.
As a note, this also standardizes privilege registry to use the same
warning as the other files, which it didn't previously.
Tested: Comment changes only, no functional changes.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I3224130dbf581dc962187b2fde4dc98ae26de082
|
|
Previously, parse_registries was not very careful about generating
readable files, and relied on clang-format to "fix" them after the fact.
Given they're generated, this is unforunate, and leads to some
inconsistencies in reading the generated code.
This commit changes the script to no longer rely on clang-format, and
wrap the whole file in a clang-format off bracket. This means that our
message registry generation will be consistent.
As an added bonus, different versions of clang-format like to format
these structures differently, so this removes one possible barrier to
people updating these.
This was initiated by the next patch in the series, which made a
seemingly minor change to a comment, which caused a significant change
in this file because of clang-format versioning.
Tested: ran parse_registries.py and saw build passing. Whitespace
changes only.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Id48bb43dd9d8ecc83de1840f2f1045a87e2ff796
|
|
Removed "component" from base message because actual component name is
defined from redfish message argument.
Tested:
1. Redfish validator - passed for this new addition
2. Verified in Redfish, ComponentOverTemperature event logged properly.
GET:
https:/<BMC-IP>/redfish/v1/Systems/system/LogServices/EventLog/Entries
{
"@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/
Entries/1646193775",
"@odata.type": "#LogEntry.v1_8_0.LogEntry",
"Created": "2022-03-02T04:02:55+00:00",
"EntryType": "Event",
"Id": "1646193775",
"Message": "CPU 1 memory over temperature and being throttled.",
"MessageArgs": [
"CPU 1 memory"
],
"MessageId": "OpenBMC.0.1.ComponentOverTemperature",
"Name": "System Event Log Entry",
"Severity": "Critical"
}
Signed-off-by: Hardik Panchal <hardikx.panchal@intel.com>
Change-Id: I17aa3b98b6f4c126c2a2d99d703349dc6d82b228
|
|
Added support for multiple level direct read. For example, we can now
access `abc/xyz` directly instead of getting `abc` and then abc[`xyz`].
For extra element error, it will only be triggered if the element at the
root level is not a parent of any of the requested elements.
For example,
{
"abc": {
"xyz": 12
}
}
Getting "abc/xyz" will satisfy the condition so it does not throw an
error.
This is accomplished in a reasonable way by moving the previously
variadic templated code to a std::span<variant> that contains all
possible types. This is a trick learned from the fmt library to reduce
compile sizes, as the majority of the code doesn't get duplicated at
template level, and is instead operating on the fixed variant type.
This commit drops 7316 bytes (about half a percent of total) from the
bmcweb binary size from the reduction in template usage. Later patches
build on this patchset to simplify call sites even more and reduce the
binary size further, but as is, this is still a win.
Note: now that the UnpackVariant lists all possible unpack types, it was
found that readJson would fail to compile for vector<bool>. This is a
well known C++ deficiency in the std::vector<bool> type when compared to
all other types, and will need special handling in the future. The two
types for vector<bool> are left commented out in the typelist.
Tested: Unit tests passing with reasonable coverage. Functional use in
next commit in this series.
Change-Id: Ifb247c9121c41ad8f1de26eb4bfc3d71484e6bd6
Signed-off-by: Willy Tu <wltu@google.com>
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
using std::string_view on these lets us call them in more contexts, and
allows us to inline some previously more complex code. In general, for
APIs like this, std::string_view should be preferred as it gives more
flexibility in calling conventions.
Tested:
curl --insecure "https://localhost:18080/redfish/v1/AccountService/Roles/foobar" ✔
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The requested resource of type Role named 'foobar' was not found.",
"MessageArgs": [
"Role",
"foobar"
],
"MessageId": "Base.1.11.0.ResourceNotFound",
"MessageSeverity": "Critical",
"Resolution": "Provide a valid resource identifier and resubmit the request."
}
],
"code": "Base.1.11.0.ResourceNotFound",
"message": "The requested resource of type Role named 'foobar' was not found."
}
}
This is the same response as previously.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I8ee17120c42d2a13677648c3395aa4f9ec2bd51a
|
|
There are a number of places where we use message registry messages
incorrectly. This patchset attempts to fix them, and invoke some type
safety when they're used such that they're more obvious to use.
Namely, it changes a number of the message registry methods to accept a
boost::urls::url_view for its argument instead of a const std::string&.
This forces the calling code to correctly encode a URL to use the
method, which should make it obvious that it's not for an ID, a property
name, or anything else. In the course of doing this, several places
were found to be using the first argument incorrectly.
Tested:
curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/Chassis/foobar
Returns:
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The requested resource of type #Chassis.v1_16_0.Chassis named foobar was not found.",
"MessageArgs": [
"#Chassis.v1_16_0.Chassis",
"foobar"
],
"MessageId": "Base.1.8.1.ResourceNotFound",
"MessageSeverity": "Critical",
"Resolution": "Provide a valid resource identifier and resubmit the request."
}
],
"code": "Base.1.8.1.ResourceNotFound",
"message": "The requested resource of type #Chassis.v1_16_0.Chassis named foobar was not found."
}
Identically to previously.
Also tested with IDs that contained % encoded characters, like
foobar%10, which gave the same result.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Icbb3bce5d190a260610087c9ef35e7becc5a50c7
|
|
Being able to index into the message registry constexpr arrays will be
useful in the future, so update the parse_registries script to generate
an Index enum class, that allows directly indexing into the constexpr
table when necessary.
These indexes are used in the patchset here:
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/50950
to avoid a binary search lookup for each entry.
Tested: No-op change, code inspection only.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I345cc26a2b17b5bcd8cfb0055642f4ae443caad4
|
|
Added support for readJson for Patch and Action. The only difference is
that Patch does not allow empty json input while Action does. Action with
empty input will use the default value based on the implementation and
return 200 OK response code.
readJsonPatch will replace the existing readJson and be used for path
requests. It will not allow empty json input and all requested
keys are required in the json input.
readJsonAction will be used for Action requests where it is possible for
all of the properties to be optional and allow empty request.
The optional properties are determined by the requested values type.
All current Action readJson are replaced with readJsonAction. It does
not change the existing behavior since it needs `std::optional`.
This will have to be updated later as we define the default behavior.
Tested:
Added unit tests and readJsonAction allows empty empty json object.
No Change to Redfish Tree.
Change-Id: Ia5e1f81695c528a20f1dc985aee19c920d8adaea
Signed-off-by: Willy Tu <wltu@google.com>
|
|
clang-tidy 14 now detects some more stuff that it couldn't before.
These are all pretty reasonable and things that we enforce today.
All changes were made by the robot.
Tested: Code compiles and unit tests pass.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I880d714c97adc38a190472766fb922fbfb30e82a
|
|
Add "ComponentOverTemperature" event message entry in RedFish for
Memhot monitor to log based on the MEMHOT pins.
Tested:
1. Redfish validator - passed for this new addition
2. Verified in Redfish, ComponentOverTemperature event logged properly.
GET:
https:/<BMC-IP>/redfish/v1/Systems/system/LogServices/EventLog/Entries
{
"@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/
Entries/1644553991",
"@odata.type": "#LogEntry.v1_8_0.LogEntry",
"Created": "2022-02-11T04:33:11+00:00",
"EntryType": "Event",
"Id": "1644553991",
"Message": "CPU 1 component over temperature and being throttled.",
"MessageArgs": [
"CPU 1"
],
"MessageId": "OpenBMC.0.1.ComponentOverTemperature",
"Name": "System Event Log Entry",
"Severity": "Critical"
}
Signed-off-by: Hardik Panchal <hardikx.panchal@intel.com>
Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: I6f5f42111ae7db39a4618b2b1ba8c864f9f55824
|
|
This function in practice looks like it has another use where the code
is essentially the same. Move it to a header so it can be used by other
things. And add unit tests to ensure it stays reliable.
Tested: Unit tests pass.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I3343ba1aa9c0dd542fbb98628b7628cb0704fb3b
|
|
We only had a few violations of this; Fix them and enable the check.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I159e774fd0169a91a092218ec8dc896ba9edebf4
|
|
These checks ensure that we're not implicitly converting ints or
pointers into bools, which makes the code easier to read.
Tested:
Ran series through redfish service validator. No changes observed.
UUID failing in Qemu both before and after.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I1ca0be980d136bd4e5474341f4fd62f2f6bbdbae
|