Age | Commit message (Collapse) | Author | Files | Lines |
|
This file has existed for a long time, and predates redfish-core, so it
was put in an inopportune place.
Move the code to where it should be, in lib.
Tested: Code compiles.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I422c27563a5e0f2a5debb2b1d4713aa8db0fe331
|
|
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
|
|
This reverts commit 867b2056d44300db9769e0d0b8883435a179834c.
Apparently we have broken the Redfish spec in a way that adding this
feature now allows the service validator to find.
@odata.id /redfish/v1/UpdateService
ERROR - Allow header should NOT contain POST for UpdateService.v1_5_0.UpdateService
Need to figure out what to do, but for now, revert to get the build
passing again.
Change-Id: Ieef20573b9caa03aba6fd2bbc999e517e4b7de3d
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
The Redfish specification calls out that the Allow header should be
returned for all resources to give a client an indication of what
actions are allowed on that resource. The router internally has all
this data, so this patchset allows the router to construct an allow
header value, as well as return early on a HEAD request.
Tested:
Called curl with various parameters and observed the Allow header
curl -vvvv --insecure -X <VERB> --user root:0penBmc https://<bmc>/url
HEAD /redfish/v1/SessionService/Sessions returned Allow: GET, POST
HEAD /redfish/v1 returned Allow: GET
HEAD /redfish/v1/SessionService returned Allow: GET, PATCH
POST /redfish/v1 returned Allow: GET (method not allowed)
GET /redfish/v1 returned Allow: GET
GET /redfish/v1/SessionService returned Allow: GET, PATCH
Redfish-Protocol-Validator now reports more tests passing.
Prior to this patch:
Pass: 255, Warning: 0, Fail: 27, Not tested: 45
After this patch:
Pass: 262, Warning: 0, Fail: 21, Not tested: 43
Diff: 7 more tests passing
All tests under RESP_HEADERS_ALLOW_METHOD_NOT_ALLOWED and
RESP_HEADERS_ALLOW_GET_OR_HEAD are now passing
Included unit tests passing.
Change-Id: Ib99835050b15eb4f419bfd21375b26e4db74fa2c
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
$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
|
|
This reduces readJson calls and makes the code more readable, and saves
~164 bytes of compressed image size.
Tested:
Verified PATCH /redfish/v1/Systems/system is handled as expected.
Change-Id: I90dd5e0d4b0b055ee370288ad159d26e5bb40281
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
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 is needed for this code to work on both 32 and 64 bits system.
According to the interface,
https://github.com/openbmc/phosphor-dbus-interfaces/blob/388b58f9a878f45b8ec243152cac5eb44ec90ced/yaml/xyz/openbmc_project/Inventory/Item/Dimm.interface.yaml#L9,
MemorySizeInKB is of type size_t.
Tested:
On real hardware, the memory resource is working as expected.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ie81d2610c245a08a22c3ea891495f34cc0bdc075
|
|
This commit implements a limited support for the production of etags on
json resources. It is intended to cause two things:
1. To get bmcweb to pass the PROTO_ETAG_ON_GET_ACCOUNT check, as well as
the redfish spec, which states: "Implementations shall support the
return of ETag headers for GET requests of ManagerAccount resources."
2. Begin discussions on what client-facing caching could look like in
the future, and to implement the fewest lines of code this author
could think of, with the hope of extending it later.
As written, it injects into the Response class a method that, for json
responses, uses std::hash<json> to generate an etag. This was chosen
under the assumption that it caused the least binary impact, and is
already a function provided by nlohmann, so required minimal
implementation effort to get something that functioned to the standard:
https://json.nlohmann.me/api/basic_json/std_hash/#version-history
I'm open to discussions if this should be improved in the future to
include more entropy, or to be a "weak" etag, but I think starting
with std::hash is a good first step.
This patchset intentionally does notimplement handling of the
If-None-Match, or If-Match headers that a caching client would likely
send that implements this. That is not explicitly required by the spec,
relatively complex, and probably has consequences that this author
doesn't want to write the test cases for (yet). This lack of support
makes this patchset largely only "useful" in passing the tests, and
implementing the spec to the letter, it does not generalize a caching
client feature that improves performance.
Tested:
curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1
Contains in the response:
ETag: "765E4548"
The redfish protocol validator now passes the PROTO_ETAG_ON_GET_ACCOUNT
test, which increases our passing test count by 4 compared to previously.
Current counts are 352 passing, 30 failing, 36 not tested.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I3389b2ba98bf1276e1cb2d9c5954437b924f2d94
|
|
This change is similiar as
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/49465
After insecure-disable-auth=enabled. it is not needed to do login and
establish session before request.
GET/PATCH /redfish/v1/AccountService/Accounts/<accountname>.
(no matter account exist or not)
It won't get any status code and cause the bmcweb service crashed.
Solutions:
Add #ifndef BMCWEB_INSECURE_DISABLE_AUTHENTICATION and
[[maybe_unused]] const crow::Request& req
Test:
GET / PATCH with authless
https://<bmcip>/redfish/v1/AccountService/Accounts/TestAccount
Return 200
{
"@odata.id": "/redfish/v1/AccountService/Accounts/TestAccount",
"@odata.type": "#ManagerAccount.v1_4_0.ManagerAccount",
"AccountTypes": [
"Redfish"
],
"Description": "User Account",
"Enabled": true,
"Id": "TestAccount",
"Links": {
"Role": {
"@odata.id": "/redfish/v1/AccountService/Roles/Administrator"
}
},
"Locked": false,
"Locked@Redfish.AllowableValues": [
"false"
],
"Name": "User Account",
"Password": null,
"PasswordChangeRequired": false,
"RoleId": "Administrator",
"UserName": "TestAccount"
}
GET nonexistent account
https://<bmcip>/redfish/v1/AccountService/Accounts/TestAccountsss
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The requested resource of type ManagerAccount named
TestAccountsss was not found.",
"MessageArgs": [
"ManagerAccount",
"TestAccountsss"
],
"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 ManagerAccount named
TestAccountsss was not found."
}
}
Signed-off-by: JunLin Chen <Jun-Lin.Chen@quantatw.com>
Change-Id: Ic00020ac07950347973b54d49dacd44c4d4571b7
Signed-off-by: Tony Lee <tony.lee@quantatw.com>
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
This commit tries to be more explicit about the expectations for commit
messages and testing within bmcweb, and give maintainers something to
point to instead of repeating the same statements over and over again.
This will likely need to evolve, but I think it's a good start, and
would help people put together commits that can be merged on the first
try, rather than requiring followup.
Tested: Documentation only, no testing.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ib60ac90eccdc4f2c3215a755bbb462fff4796dd4
|
|
The meson_options.txt file is difficult to read and maintain because it
has inconsistent whitespace, lines that are far longer than fit on a
single monitor, and inline strings that are inconsistent.
This commit fixes those, moving the syntax to use newlines for each
option method key value, no space on the key colon, and wraps
description strings using mesons multi-line syntax on 80 character
boundaries.
Doing this should make this file more maintainable in the future, and
helps people to review, and read it better than previously.
The intent is that this patchset has no functional changes, only
whitespace and non-enforcing string manipulation, with one exception.
Anywhere we noted a redfish path, we used escaped single quotes.
Multiline strings in meson don't support escaping, so in lieu of worse
alternatives, the quoting was removed, which inline with this patch,
continues to improve the readability of the file.
Tested:
Code builds. No functional changes.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I04f3e31e364bcd3d4b09a219afff21a8eaabc463
|
|
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
|
|
Avoid making the dbus call if the interface does not exist and is
expected to error out to reduce the number of dbus calls.
Tested:
Redfish Validator passed for Drives
```
$ wget -qO- \
http://localhost:80/redfish/v1/Systems/system/Storage/1/Drives/drive
{
"@odata.id": "/redfish/v1/Systems/system/Storage/1/Drives/drive",
"@odata.type": "#Drive.v1_7_0.Drive",
"Id": "warthog",
"Links": {
"Chassis": {
"@odata.id": "/redfish/v1/Chassis/chassis"
}
},
"Manufacturer": "XXX",
"MediaType": "SSD",
"Model": "XXX",
"Name": "drive",
"PartNumber": "xxxxxxxxxxxxx",
"Protocol": "SATA",
"SerialNumber": "123456",
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
}
}
```
Change-Id: Ic83c8ee5a49f75b71d443781faf8b65d8fab31b6
Signed-off-by: Willy Tu <wltu@google.com>
|
|
Sometimes Slot0 got higher key than Slot1 and erase function for Slot1
invalidates elements with keys not less than the erased element.
In that case invalid slot0 will be unmounted.
Change order of calling close() and erase() functions to
unmount correct device.
Change-Id: I7a40a4518982f697d3eed635cde6d06978149cf0
Signed-off-by: Alicja Rybak <alicja.rybak@intel.com>
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
|
|
Fixes compilation errors after introducing
* 7772638ea777820234e6004ee63dc558e629e35e Remove AsyncResp from
openHandler
* b9d36b4791d77a47e1f3c5c4564fcdf7cc68c115 Consistently use
dbus::utility types
Tested:
When nbd_proxy is enabled, code compiles.
Change-Id: I6422bbcb7086a8ebc6cc48c7c72636afd1e3ac21
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
|
|
The function_traits class was very clearly "borrowed" from
boost::function traits, then added to to support lambdas.
boost::function_traits has been superceeded by boost::callable_traits,
which fixes the same shortcomings that we have fixed here.
This commit replaces almost the entirety of the uses of function_traits
with callable traits, with one exception: arg<i>. In the callable
traits model, arg_t is a std::tuple, which, while better, doesn't unpack
easily into a variadic pack that our router code expects. Ideally, at
some point, we would rewrite the router core to not rely on
std::make_integer_sequence, but that's a much more invasive change.
Tested:
Called
curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/Managers/bmc/LogServices/Journal/Entries/1646953359619803
and verified callback return the correct result (not 404). That API has
several flexible router parameters, which is the only thing this commit
could break.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Icf3299b2d5c1a5ff111f68858bb46139735aaabe
|
|
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
|
|
Post method:
1) /redfish/v1/Managers/bmc/EthernetInterfaces/<str>/VLANs/
ConfigureComponents -> ConfigureManager
Patch method:
1) /redfish/v1/Managers/bmc/EthernetInterfaces/<str>/VLANs/<str>/
ConfigureComponents -> ConfigureManager
2) /redfish/v1/Managers/bmc/EthernetInterfaces/<str>/
ConfigureComponents -> ConfigureManager (SubordinateOverrides)
Delete method:
1) /redfish/v1/Managers/bmc/EthernetInterfaces/<str>/VLANs/<str>/
ConfigureComponents -> ConfigureManager
This change allows only Admin user to post, patch, and delete on VLAN
Network Interface Collection and restrict Operator user.
Same for the EthernetInterfaces patch method.
Tested: Ran curl test with admin and operator privileged user for
all methods (post, patch, and delete). one test failing.
Error: curl -k -H "X-Auth-Token: $bmc_token" -X PATCH -d
'{"VLANId" :30 , "VLANEnable" : true}'
https://${BMC_IP}/redfish/v1/Managers/bmc/EthernetInterfaces/
eth0/VLANs/eth0_50
This command is unable to update the VLANId value. instead, it
deletes VLAN
Email sent to openbmc list:
https://lists.ozlabs.org/pipermail/openbmc/2021-August/027232.html
Signed-off-by: Abhishek Patel <Abhishek.Patel@ibm.com>
Change-Id: I4101c429db6fa788909982b66445b191ccacaec7
|
|
Post method:
1) /redfish/v1/CertificateService/Actions/
CertificateService.GenerateCSR/
ConfigureComponents-> ConfigureManager
This change allows only Admin users to Generate CSR Certificate and
restrict Operator user.
Tested: Ran curl Post requests with Admin and Operator privileged users
Get output as expected.
Email sent to openbmc list:
https://lists.ozlabs.org/pipermail/openbmc/2021-August/027232.html
Signed-off-by: Abhishek Patel <Abhishek.Patel@ibm.com>
Change-Id: I46d505357cfc55a31911e75e8bd9948a0db90555
|
|
This commit drops 8k from the binary size.
Tested: SensorCollection returns sensor values as expected, same as
previously
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ife1dc40ff6745585ac6bc3f99cd5e6c4811baa56
|
|
Changes the incorrect WatchdogTimer property name to HostWatchdogTimer
in PATCH /redfish/v1/Systems/system handler to match the Redfish spec.
Tested:
Updating HostWatchdogTimer with PATCH request is handled properly.
Change-Id: Ic7c9c72e3fd43fb738f4fc21eb39e335aa8d1bcd
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
As stated in PDI humidity is a valid hierarchy.
https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Sensor/Value.interface.yaml
From https://redfish.dmtf.org/schemas/v1/Sensor.v1_5_0.json:
Humidity is a valid ReadingType and Humidity ReadingUnits shall be %.
This follows the following Redfish mockup:
https://redfish.dmtf.org/redfish/mockups/v1/1156
This is not under BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM due to not
being part of the old thermal or power resources.
Tested:
Validator passes.
See a Humidity sensor in the Sensor colleciton:
{
"@odata.id": "/redfish/v1/Chassis/chassis/Sensors/Relative_Humidity",
"@odata.type": "#Sensor.v1_0_0.Sensor",
"Id": "Relative_Humidity",
"Name": "Relative Humidity",
"Reading": 61.935424802658005,
"ReadingRangeMax": 100.0,
"ReadingRangeMin": 0.0,
"ReadingType": "Humidity",
"ReadingUnits": "%",
...
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Change-Id: Ib1f52b0b0e3d8c4bfec8c4389c811fdb8b9d887a
|
|
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
|
|
Some variable names in ethernet.hpp does not match naming conventions,
fix'em all.
Tested:
Only variable name changes, build pass.
Change-Id: If275a77364e5ed827a5088342f44548274b059e1
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
Remove EthernetInterfaceData.SendHostNameEnabled as it is defined but
never used excepting reading it from DBus.
Tested:
Build pass.
Change-Id: Ib64792b5842a1e8fb95e3a38d40f11797cfb5641
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
In ethernet.hpp, changeVlanId() is defined but never used, and VLAN ID
is not a writable property in phosphor-networkd. Remove it.
Tested:
Build pass.
Change-Id: I1770e777529cca9d9a56831f62e0833c3f7de9df
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
Current implementation of the ReplaceCertificate API always returns
ResourceNotFound if any error occurs when calling DBus, regardless of
whether the certificate to be replaced exists or not. This patch checks
the error code and only return ResourceNotFound when the object path
does not exist, otherwise returns InternalError.
Tested:
* Replace HTTPS certificate at /redfish/v1/Managers/bmc/NetworkProtocol
/HTTPS/Certificates/0 (Invalid URL) returns ResourceNotFound.
* Replace HTTPS certificate at /redfish/v1/Managers/bmc/NetworkProtocol
/HTTPS/Certificates/1 with CertificateString not containing private
key returns InternalError.
Change-Id: I67f6014c3856c192b4141e6a92f173a9a8c8189e
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
When reading PCIe device information from DBus, "DeviceType" is checked
twice, remove the duplicated code.
Tested:
Build pass. Get /redfish/v1/Systems/system/PCIeDevices/{Device} still
has "DeviceType" property.
Change-Id: I18e426f4cb22b8b751f6d7faf62d06f4966f1290
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
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>
|
|
Context:
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/50742 is a small
but important change that changes how http_connection works. Maintainers
recommends doing a more complete testing for this type of change. I
found that having some docs as reference when performing testing is
helpful for every contributor.
Add a document for different types of testing we want contributors to
perform and include results in their commit messages. This doc will
evolve.
Also moved relevant sections in existing docs into this doc.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ia0b35950540ec6efaa813516d0e545c4b8f7c609
|
|
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>
|
|
Redfish validator was failing and throwing below error:
*** /redfish/v1/AccountService
AccountService.v1_10_0.ExternalAccountProvider:OAuth2Service :
Could not get details on this property (argument of type 'NoneType' is not iterable)
Type (#AccountService.v1_5_0.AccountService), GET SUCCESS (time: 1.283549)
complex @odata.id: Expected @odata.id to match URI link
/redfish/v1/AccountService#/Oem/OpenBMC
FAIL...
"OAuth2Service" is added in v1_7_x+ versions of AccountService schema. Even though
schema's are updated to v1_10_x, Still source is pointing to v1_5_x which is causing
undefined type and failing Redfish validator.
So I updated odata.type to AccountService.v1_10_0.AccountService".
Tested:
*** /redfish/v1/AccountService
Type (#AccountService.v1_10_0.AccountService), GET SUCCESS (time: 1.306433)
complex @odata.id: Expected @odata.id to match URI link /redfish/v1/AccountService#/Oem/OpenBMC
PASS
After change OAuth2Service property error got disappeared - Redfish validator
does not show any such error.
But, Due to increased version number, there can be any new properties
(deprecated or new) error shown in redfish validator.
( Note: odata.id error exist before and after the fix, which can be fixed as separate commit)
All AccountService related URI's worked as expected and validation got succeeded.
Signed-off-by: Anjaliintel-21 <anjali.ray@intel.com>
Change-Id: Ic73319cd649ecebbf7108863b2a72bcd2768d477
|
|
Because logs populated by fillEventLogEntryJson are expected to be
found in the message registry log entries that get returned in this
function should have non-empty message and severity, because of the way
registries work.
Currently, for a log entry that is not present in the registry, the
function will use its log entry as-is and leave the message and severity
fields empty. This can cause the Redfish Service Validator to generate
an error.
This change fixes the fillEventLogEntryJson function so that when a log
message is not found in the registry, the message is not used for
populating the response, and is logged for further analysis.
TESTED:
First populate an offending entry.
echo "1970-01-01T00:00:47.991326+00:00 OpenBMC.1.0.ServiceStarted," > \
/var/log/redfish
Then run the Service Validator.
Before this change:
URL: /redfish/v1/Systems/system/LogServices/EventLog/Entries/60
*** /redfish/v1/Systems/system/LogServices/EventLog/Entries/60
Type (LogEntry.v1_8_0.LogEntry), GET SUCCESS (time: 0)
Severity: Empty string found - Services should omit properties if not
supported
Severity: Value Enum not found in ['OK', 'Warning', 'Critical']
Message: Empty string found - Services should omit properties if not
supported
FAIL...
After: the above response disappears from the response, the Validator
error disappears, and the following appears in the system journal:
(1970-01-01 13:01:47) [WARNING "log_services.hpp":1129] Log entry not
found in registry: 1970-01-01T00:00:47.991326+00:00
OpenBMC.1.0.ServiceStarted,
Signed-off-by: Sui Chen <suichen@google.com>
Change-Id: Ifa600d1de0e6e0cea33e9e8dfde621ee9d4e3325
|
|
This change adds an efficient expand handler for $levels=1 expand at the
sensors collection.
Instead of Query one sensor at time, it reuses existing codes for
Thermal and Power (which has AutoExpand), and queries the whole sensor at
one query. It's more efficient than the default expand handler as well
since the default handler stills query all the sensors and filter other
sensors when querying a single sensor.
Performance improves dramatically on a real hardware with 220+ sensors:
Before this change,
time wget -qO-
'http://localhost/redfish/v1/Chassis/xxx/Sensors?$expand=.($levels=1)'
> /tmp/log_slow.json
real 0m33.786s
user 0m0.000s
sys 0m0.000s
After this change
time wget -qO-
'http://localhost/redfish/v1/Chassis/xxx/Sensors?$expand=.($levels=1)'
> /tmp/log_fast.json
real 0m0.769s
user 0m0.010s
sys 0m0.010s
TESTED::
1. QEMU Redfish/IPMI passed
2. Validator passed (though it doesn't support query paramters)
3. Tested on real hardware.
{
"@odata.id": "/redfish/v1/Chassis/xxx/Sensors",
"@odata.type": "#SensorCollection.SensorCollection",
"Description": "Collection of Sensors for this Chassis",
"Members": [
{
"@odata.id": "/redfish/v1/Chassis/xxx/Sensors/abc",
"@odata.type": "#Sensor.v1_0_0.Sensor",
"Id": "abc",
"Name": "abc",
"Reading": 3.133,
"ReadingRangeMax": 5.8500060148599005,
"ReadingRangeMin": 0.0,
"ReadingType": "Voltage",
"ReadingUnits": "V",
"Status": {
"Health": "OK",
"State": "Enabled"
},
"Thresholds": {
"LowerCritical": {
"Reading": 2.205
},
"UpperCritical": {
"Reading": 3.507
}
}
},
],
"Members@odata.count": 225,
"Name": "Sensors"
}
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I745a31d6fe8d0aac08d532ea976bfc1a4a40b19c
|
|
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
|
|
bind_front + function is more readable than local lambdas.
Tested:
Tested sensor collection, works as expected.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ib3bd6d4249df97c4be5afcd1393477ed424f5de8
|
|
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
|
|
In systems.hpp:translatePowerMode(), modeString is defined but never
used. Compiler also doesn't give a warning. Remove it.
Tested:
Build pass.
Change-Id: Ic48c77f74a398bf74a2c874d6a6969efdd440a5f
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
The new multi-depth readJson simplifies the PATCH handler and removes
3 extra readJson calls.
Tested:
Verified PATCH /redfish/v1/Managers/bmc/NetworkProtocol works exactly
the same as before, all modifiable properties are handled properly.
Change-Id: I836010273b5150576d6bc33eae82acda2de70e67
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
For better or worse, the series ahead of this is making use of
setUpRedfishRoute to do the common "redfish specified" things that need
to be done for a connection, like header checking, filtering, and other
things. In the current model, where BMCWEB_ROUTE is a common function
for all HTTP routes, this means we need to propagate this injection call
into the whole tree ahead of the requests being handled.
In a perfect world, we would invent something like a REDFISH_ROUTE
macro, but because macros are discouraged, the routes take a variadic
template of parameters, and each call to the route has a .privileges()
call in the middle, there's no good way to effect this change in a less
costly manner. This was messaged both in the prior reviews, and on
discord sourcing improvements on this pattern, to which none arose.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Id29cc799e214edad41e48fc7ce6eed0521f90ecb
|
|
Everywhere else in this file, we return messages::success when a
property is patched, except for the password success case. This
normally wouldn't matter much, but redfish-protocol-validator seems to
want to use Password setting as its check for a number of protocol tests
(probably because all Redfish implementations have settable passwords).
This commit adds the appropriate message
Tested:
curl -vvvv --insecure --user root:0penBmc -X PATCH -d '{"Password":
"0penBmc1"}' https://192.168.7.2/redfish/v1/AccountService/Accounts/root
Now returns the Success message from the message registry.
Redfish-protocol-validator PROTO_JSON_ACCEPTED tests now succeed,
improving bmcwebs protocol score by 3 tests passing that were failing.
Counts are 356 passing, 27 failed, 36 not tested.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iff1096ca590f956b29b2a3dd6c9510d2fe4a0037
|
|
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
|
|
Query parameters in their initial incarnation will likely have security
consequences. For example, requesting ServiceRoot with expand depth 999
would likely run most BMCs out of memory. This isn't a good reason to
keep those features out of master, as there are a number of services
(webui-vue for example) that would like to test against them, and
identify the weaknesses.
The goal with this option is to allow users to test, so we can determine
things like the max depth we should support, which query params have
security consequences and how to mitigate them, and other testing. The
end goal would be for this option to be enabled by default. If it's
removed entirely would depend on the impacts of supporting query params
and is something we will have to discuss at a later date.
Tested:
Code compiles. Use of this option is added in next patchset in series.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I93ff31c938e4be2d92eb07b59a3288f8bacde2ac
|