Age | Commit message (Collapse) | Author | Files | Lines |
|
In the upcoming fmt patch, we remove the use of streams, and a number of
our logging statements are relying on them. This commit changes them to
no longer rely on operator>> or operator+ to build their strings. This
alone isn't very useful, but in the context of the next patch makes the
automation able to do a complete conversion of all log statements
automatically.
Tested: enabled logging on local and saw log statements print to console
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I0e5dc2cf015c6924037e38d547535eda8175a6a1
|
|
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
|
|
Populate the MediaType with DriveType to identify the Drive.
- https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/44971
Populate the Capacity as the size in bytes of the Drive.
- https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/46332
Populate the Protocol with DriveProtocol for the communication protocol
types
- https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/46333
Tested:
Passed Redfish Validator with no new error.
```
*** /redfish/v1/Systems/system/Storage/storage0/Drives/drive0
Type (#Drive.v1_7_0.Drive), GET SUCCESS (time: 0.307086)
PASS
```
```
{
"@odata.id": "/redfish/v1/Systems/system/Storage/storage0/Drives/drive0",
"@odata.type": "#Drive.v1_7_0.Drive",
"CapacityBytes": 250059350016,
"Id": "drive0",
"Manufacturer": "",
"MediaType": "SSD",
"Name": "drive0",
"PartNumber": "",
"Protocol": "SATA",
"SerialNumber": "0",
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
}
}
```
Change-Id: I533eade92ec461b957f0c13eb69d06fead8b10f3
Signed-off-by: Willy Tu <wltu@google.com>
|
|
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>
|
|
This type of testing can validate bmcwebs generated redfish. The ability
to validate the output of bmcweb is extremely useful because it will
guarantee correctness in certain cases.
This is an example of redfish unit testing. The long term goal is to
apply this type of testing to several other redfish responses.
To make this change many previous changes were needed
* Break serviceroot callback into the free function.
* Change ownership of the request and response objects.
* Change setCompleteRequestHandler logic
Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: I324daef0d80eb86f0f7383663727d64776f45279
|
|
These modifications are from WIP:Redfish:Query parameters:Only
(https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/47474). It will
be used in future CLs for Query Parameters.
The code changed the completion handle to accept Res to be able to
recall handle with a new Response object.
AsyncResp owns a new res, so there is no need to pass in a res.
Also fixed a self-move assignment bug.
Context:
Originally submitted:
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/480020
Reveted here:
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/48880
Because of failures here:
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/48864
Tested:
1. Romulus QEMU + Robot tests; all passed
2. Use scripts/websocket_test.py to test websockets. It is still work correctly.
3. Tested in real hardware; no new validator errors; tested both
authless, session, and basic auth.
4. Hacked codes to return 500 errors on certain resource; response is
expected;
5. Tested Eventing, the push style one (not SSE which is still under
review), worked as expected.
6. Tested 404 errors; response is expected.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: I52adb174476e0f6656335baa6657456752a031be
|
|
Instead of hardcoding the match string used for the task,
this allows the match string to be set depending on the
OEMDiagnosticDataType.
Tested:
Confirmed that the TaskMonitor still correctly updates
when the collection task completes.
Change-Id: Id079ae3f387e9a39f9e0ac74e36a7095b4999ea2
Signed-off-by: Jason M. Bills <jason.m.bills@intel.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
|
|
Internally to bmcweb, we actually store two copies of every string in
the base privilege registry. As history played out, the
error_messages.cpp was created first, then when logging was added, we
needed more fine grained programatic lookups into the message
registries, so we invented the constexpr array. Previously, it was
thought that xz basically deduplicated the duplicated strings. While
this is true to some extent, it using the actual processing code seems
to be a win on binary size.
This is also a -500 line diff, so it's reducing the amount of code we
have at the same time.
Note, the "InvalidUpload" message is incorrect per the standard, which
this patchset sort of teases out, as it's the only one that can't be
updated. This patchset leaves it as-written.
Tested:
xz compressed bmcweb went from 1174632 bytes, down to 1157040 bytes, or
a 1.4% (17592 bytes) reduction in compressed binary size.
curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/Chassis/foobar
{
"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.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 #Chassis.v1_16_0.Chassis named 'foobar' was not found."
}
}
Note, the MessageId property has changed its version from Base.1.8 to
Base.1.11. This is correct and matches the version of the registry we
use. Also, the second argument is now quoted, as the ResourceNotFound
schema requires.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ifd0bd71a26eebeba8ba89704a1eca425f0776aa8
|
|
To avoid passing references to bad memory locations, we had to
pre-build the array with empty entries so we could pass a
reference to the array index without it changing later.
This changes so the code that fills the log entry object checks
if it's filling a single entry or an array entry and expands
the array at that time.
This simplifies filling the "Members" array in the Crashdump
entry collection and avoids sending references to an array
index.
Tested:
Confirmed that Crashdump LogEntries are correctly filled in
the "Members" array of the collection and in the individual
LogEntry.
Change-Id: I4484e248b6d72fadbaedcbb27840cd46cfe3b323
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
|
|
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>
|
|
in the case where multiple network interfaces are present each
interface will return the same ntp server data
Tested: on the system that has multiple eth interfaces
Signed-off-by: Radivoje Jovanovic <radivoje.jovanovic@intel.com>
Change-Id: I642aae7a1c07f7629d696f177ddf326d25e36fb1
|
|
This unwraps the non-D-Bus strings in log_services.hpp.
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
Change-Id: Iaf5e435fa11909d1bf3c65e373d994d755371e2f
|
|
The name was never set properly and is empty. All of the information are
saved to the same location.
Tested:
Redfish Service Validator has issue from before
```
6 exceptionPropCheck errors in /redfish/v1/Managers/bmc
2 exceptionPropCheck errors in /redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone_2
*** /redfish/v1/Managers/bmc
ERROR - This complex object FanMode should be a dictionary or None, but it's of type <class 'str'>...
ERROR - This complex object ZoneIndex should be a dictionary or None, but it's of type <class 'float'>...
ERROR - This complex object FanMode should be a dictionary or None, but it's of type <class 'str'>...
ERROR - This complex object ZoneIndex should be a dictionary or None, but it's of type <class 'float'>...
ERROR - This complex object FanMode should be a dictionary or None, but it's of type <class 'str'>...
ERROR - This complex object ZoneIndex should be a dictionary or None, but it's of type <class 'float'>...
INFO - Type (Manager.v1_11_0.Manager), GET SUCCESS (time: 0:00:00.226048)
INFO - Attempt 1 of /redfish/v1/UpdateService/FirmwareInventory/3199f4dc
INFO - Response Time for GET to /redfish/v1/UpdateService/FirmwareInventory/3199f4dc: 0.01309930405113846 seconds.
INFO - Attempt 1 of /redfish/v1/Chassis/AgoraV2
INFO - Response Time for GET to /redfish/v1/Chassis/AgoraV2: 0.0709426780231297 seconds.
INFO - Attempt 1 of /redfish/v1/Managers/bmc/EthernetInterfaces
INFO - Response Time for GET to /redfish/v1/Managers/bmc/EthernetInterfaces: 0.02456553210504353 seconds.
INFO - Attempt 1 of /redfish/v1/Managers/bmc/NetworkProtocol
INFO - Response Time for GET to /redfish/v1/Managers/bmc/NetworkProtocol: 0.12236760894302279 seconds.
INFO - Attempt 1 of /redfish/v1/Managers/bmc/LogServices
INFO - Response Time for GET to /redfish/v1/Managers/bmc/LogServices: 0.0062645250000059605 seconds.
WARNING - SerialConsole: The given property is deprecated by revision: This property has been deprecated in favor of the SerialConsole property in the ComputerSystem resource.
ERROR - FanMode: Could not finish check on this property ('str' object has no attribute 'get')
ERROR - ZoneIndex: Could not finish check on this property ('float' object is not iterable)
ERROR - FanMode: Could not finish check on this property ('str' object has no attribute 'get')
ERROR - ZoneIndex: Could not finish check on this property ('float' object is not iterable)
ERROR - FanMode: Could not finish check on this property ('str' object has no attribute 'get')
ERROR - ZoneIndex: Could not finish check on this property ('float' object is not iterable)
INFO - FAIL...
INFO -
```
Before,
```
"FanControllers": {
"": {
"@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanControllers/",
"@odata.type": "#OemManager.FanController",
"FFGainCoefficient": 0.006,
"FFOffCoefficient": 0.0,
"ICoefficient": 0.0,
"ILimitMax": 0.0,
"ILimitMin": 0.0,
"Inputs": [
"fan0_tach",
"fan1_tach"
],
"OutLimitMax": 100.0,
"OutLimitMin": 25.0,
"Outputs": [
"fan0_pwm",
"fan1_pwm"
],
"PCoefficient": 0.0,
"SlewNeg": 0.0,
"SlewPos": 0.0,
"Zones": [
{
"@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone_0"
}
]
},
"@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanControllers",
"@odata.type": "#OemManager.FanControllers"
},
```
After,
```
"FanControllers": {
"@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanControllers",
"@odata.type": "#OemManager.FanControllers",
"pwm_1": {
"@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanControllers/pwm_1",
"@odata.type": "#OemManager.FanController",
"FFGainCoefficient": 0.006,
"FFOffCoefficient": 0.0,
"ICoefficient": 0.0,
"ILimitMax": 0.0,
"ILimitMin": 0.0,
"Inputs": [
"fan0_tach",
"fan1_tach"
],
"OutLimitMax": 100.0,
"OutLimitMin": 25.0,
"Outputs": [
"fan0_pwm",
"fan1_pwm"
],
"PCoefficient": 0.0,
"SlewNeg": 0.0,
"SlewPos": 0.0,
"Zones": [
{
"@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone_0"
}
]
},
...
```
Change-Id: Ia487feaaca060d53a173d1fe83a80472fe0f331d
Signed-off-by: Willy Tu <wltu@google.com>
|
|
This is similar to commit
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/50799
from Andrew Geissler. getChassisState() can fail if the state
information provided by xyz.openbmc_project.State.Chassis service is
unavailable. We want bmcweb to still return the other chassis
information regardless of if that service is running at the time.
Applying that change to chassis allows the majority of the redfish
chassis data to be returned and used by the client.
Tested:
- Verified that when xyz.openbmc_project.State.Chassis was unavailable,
a call to redfish/v1/Chassis/{ChassisId} returned the available
information rather than a 500 error
Signed-off-by: Carson Labrado <clabrado@google.com>
Change-Id: I0446fac5ef362174d5ae2d082e1dc15eaf1c5875
|
|
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
|
|
We access std::string::npos through member variables in a couple places.
Fix it.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I587f89e1580661aa311dfe4e06591ab38806e241
|
|
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
|
|
EventService has a routine for taking a message registry entry and
populate it with data. This ideally should be part of the message
registry namespace, not EventService, as it could be useful to later
patchsets. So break out the method, and write some unit tests to ensure
that it can be relied upon in the future.
Tested: Unit tests ran and passing.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I052d9492f306b63fb72cbf78286370ed0c477430
|
|
The redfish base registry does not include a definition of this
message, which generating type-safe models has teased out. Replace the
MutuallyExclusiveProperties message with two "PropertyValueConflict"
messages. This seems like the closest thing, but in lieu of the things
not being in the standard, this seems like the best compromise.
Tested:
curl --insecure -X POST --user root:0penBmc
https://192.168.7.2/redfish/v1/EventService/Subscriptions -d
'{"MessageIds":[""],"RegistryPrefixes":[""],"Destination":"","Protocol":""}'
Returns:
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The property 'MessageIds' could not be written because its value would conflict with the value of the 'RegistryPrefixes' property.",
"MessageArgs": [
"MessageIds",
"RegistryPrefixes"
],
"MessageId": "Base.1.8.1.PropertyValueConflict",
"MessageSeverity": "Warning",
"Resolution": "No resolution is required."
}
],
"code": "Base.1.8.1.PropertyValueConflict",
"message": "The property 'MessageIds' could not be written because its value would conflict with the value of the 'RegistryPrefixes' property."
}
}
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I1eaf4d06b6f5b85909392c48970e3f353af3a41e
|
|
DbusInterfaceType was replaced by dbus::utility::DBusInteracesMap.
A grep of the code shows that DbusInterfaceType is not used, so
we can safely remove it to avoid anyone using it in the future.
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
Change-Id: I58ab451157186a90d946985a65ba965b3c8fad7c
|
|
There's a number of redundancies in our code that clang can sanitize
out. Fix the existing problems, and enable the checks.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie63d7b7f0777b702fbf1b23a24e1bed7b4f5183b
|
|
In the patch:
https://github.com/openbmc/bmcweb/commit/62cd45af311e7741064c114581ba34186d6e508c
Mismatch of PCIeType from pcie.hpp to PCIeDevice_v1.xml.In function requestRoutesSystemPCIeDevice,
PCIeType mentioned for PCIeInterface details, was written as PcieType but in PCIeDevice_v1.xml,
property name is PCIeType which was giving error in the validator.
Tested using RedfishServiceValidator:
*** /redfish/v1/Systems/system/PCIeDevices
Type (#PCIeDeviceCollection.PCIeDeviceCollection), GET SUCCESS (time: 1.35205)
PASS
*** /redfish/v1/Systems/system/PCIeDevices/S0B1D0
Type (#PCIeDevice.v1_4_0.PCIeDevice), GET SUCCESS (time: 1.290409)
PASS
*** /redfish/v1/Systems/system/PCIeDevices/S0B1D0/PCIeFunctions
Type (#PCIeFunctionCollection.PCIeFunctionCollection), GET SUCCESS (time: 1.287055)
PASS
*** /redfish/v1/Systems/system/PCIeDevices/S0B1D0/PCIeFunctions/0
Type (#PCIeFunction.v1_2_0.PCIeFunction), GET SUCCESS (time: 1.336434)
PASS
*** /redfish/v1/Systems/system/PCIeDevices/S0B2D0
Type (#PCIeDevice.v1_4_0.PCIeDevice), GET SUCCESS (time: 1.282768)
PASS
*** /redfish/v1/Systems/system/PCIeDevices/S0B2D0/PCIeFunctions
Type (#PCIeFunctionCollection.PCIeFunctionCollection), GET SUCCESS (time: 1.401044)
PASS
*** /redfish/v1/Systems/system/PCIeDevices/S0B2D0/PCIeFunctions/0
Type (#PCIeFunction.v1_2_0.PCIeFunction), GET SUCCESS (time: 1.286989)
PASS
*** /redfish/v1/Systems/system/PCIeDevices/S0B3D0
Type (#PCIeDevice.v1_4_0.PCIeDevice), GET SUCCESS (time: 1.331661)
PASS
Elapsed time: 0:01:17
Counter({'metadataNamespaces': 2337, 'skipOptional': 67, 'pass': 51, 'passGet': 8, 'serviceNamespaces': 4})
Validation has succeeded.
Signed-off-by: Anjaliintel-21 <anjali.ray@intel.com>
Change-Id: I134988f29c9db3462b54362104922e922f5c5b04
|
|
While performing GET on /redfish/v1/EventService/Subscriptions/ results
in error 405 - Method not allowed.
This commit fixes the subscription URI while registering the ROUTE i.e.,
during BMCWEB_ROUTE.
TESTED :
- GET on /redfish/v1/EventService/Subscriptions/ successfully returned
all the list of subscribed events.
Signed-off-by: Gayathri Leburu <gayathri.leburu@intel.com>
Change-Id: I0edcfd8403e0178fe84d6b8328dabad71c4d5c98
|
|
This check involves explicitly declaring variables const when they're
declared auto, which helps in readability, and makes it more clear that
the variables are const.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I71198ea03850384a389a56ad26f2c4a48c75b148
|
|
The MinPasswordLength property is writable according to the Redfish
schema and phosphor-user-manager allows setting it, so implement the
corresponding call.
Tested:
$ curl -k 'https://root:0penBmc@[fe80::5054:ff:fe12:3402%tap0]/redfish/v1/AccountService' -X PATCH -d '{"MinPasswordLength": 12}'
{
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "Successfully Completed Request",
"MessageArgs": [],
"MessageId": "Base.1.8.1.Success",
"MessageSeverity": "OK",
"Resolution": "None"
}
]
}
$ curl -s -k 'https://root:0penBmc@[fe80::5054:ff:fe12:3402%tap0]/redfish/v1/AccountService' | jq .MinPasswordLength
12
root@qemuarm:~# grep cracklib /etc/pam.d/common-password
password [success=ok default=die] pam_cracklib.so debug enforce_for_root reject_username minlen=12 difok=0 lcredit=0 ocredit=0 dcredit=0 ucredit=0
$ curl -k 'https://root:0penBmc@[fe80::5054:ff:fe12:3402%tap0]/redfish/v1/AccountService' -X PATCH -d '{"MinPasswordLength": 8}'
{
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "Successfully Completed Request",
"MessageArgs": [],
"MessageId": "Base.1.8.1.Success",
"MessageSeverity": "OK",
"Resolution": "None"
}
]
}
$ curl -s -k 'https://root:0penBmc@[fe80::5054:ff:fe12:3402%tap0]/redfish/v1/AccountService' | jq .MinPasswordLength
8
root@qemuarm:~# grep cracklib /etc/pam.d/common-password
password [success=ok default=die] pam_cracklib.so debug enforce_for_root reject_username minlen=8 difok=0 lcredit=0 ocredit=0 dcredit=0 ucredit=0
With https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-user-manager/+/50589
applied this doesn't silently ignore the value that is less than the lower
limit and produces an error, the old value is preserved:
$ curl -k 'https://root:0penBmc@[fe80::5054:ff:fe12:3402%tap0]/redfish/v1/AccountService' -X PATCH -d '{"MinPasswordLength": 7}'
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The request failed due to an internal service error. The service is still operational.",
"MessageArgs": [],
"MessageId": "Base.1.8.1.InternalError",
"MessageSeverity": "Critical",
"Resolution": "Resubmit the request. If the problem persists, consider resetting the service."
}
],
"code": "Base.1.8.1.InternalError",
"message": "The request failed due to an internal service error. The service is still operational."
}
$ curl -s -k 'https://root:0penBmc@[fe80::5054:ff:fe12:3402%tap0]/redfish/v1/AccountService' | jq .MinPasswordLength
8
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: I17e5aa6ca7825fcffbec3939d572bc7ccc01405b
|
|
As per DMTF Redfish, if the event service is disabled, events are not
expected to be posted to the existing subscribers
This commit adds validation to check "ServiceEnabled" property while
sending events. An additional check is made not to attempt sending
events if there are no event subscribers at BMC
Tested by:
Using DMTF Redfish-Event-Listener script with some local modification
to support the latest event subscription specifications
1. With a Push-style event subscriber setup, set "ServiceEnabled" to
false
PATCH /redfish/v1/EventService -d '{"ServiceEnabled":false}'
2. Generate events and check no events are posted to subscriber
2. Set "ServiceEnabled" to true. BMC should resume sending further
events
3. Check if BMC attempts to send events by forming the eventRecords
when there are no subscriptions made - Verified with traces that
events are not sent out
4. With "ServiceEnabled" set to false, verified the SubmitTestEvent
fails
Signed-off-by: Sunitha Harish <sunharis@in.ibm.com>
Change-Id: Icbe7c25ba12bbfb73e59639c484fccdf384ebecf
|
|
Per the coding standard, we should be capturing this by int, not const
int&.
Tested: There are no uses of stringValueTooLong(), so noop change to
binary.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Idfcb05c962e0a0d489db263a6f845bb1789b5842
|
|
After the last string wrapping rule change, we never re-ran the script
to regenerate, which puts all of these strings on their own line. While
this is non-ideal for reading comprehension, it's the rule we have at
the moment, so we should be consistent.
12778e61c281b8f8c0f976dec225fb0c30edcb47 appears to have incorrectly
checked in a bad version of the privilege registry, which this commit
diffs out again. I have inspected
https://redfish.dmtf.org/registries/Redfish_1.2.0_PrivilegeRegistry.json
by hand, and verified that those overrides are not present.
Tested: Whitespace changes only
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I517a7cf13eba2dfd3211491c08ecce69ee68257f
|
|
These checks are a nice addition to our static analysis, as they
simplify code quite a bit, as can be seen by this diff being negative
lines.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I60ede4ad23d7e5337e811d70ddcab24bf8986891
|
|
We don't have too many violations here, probably because we don't have
many optional parameters. Fix the existing instances, and enable the
check.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I4d512f0ec90b060fb60a42fe3cd6ba72fb6c6bcb
|
|
Now that the subtree update is done, this define is no longer needed.
Tested: Code compiles. Noop.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Idc5d7ef69c009982a2476fadc1d95e3280bfff48
|
|
The aforementioned function is only used in the log services, and is
used incorrectly in that context. This commit replaces it with the
correct (and unit tested) getDateTimeUintMs, which is what we should be
using for dbus->time conversions in all cases, to avoid time_t
overflows when static casting.
Tested:
Before
"Created": "2022-01-31T19:39:58+00:00",
"Modified": "2022-01-31T19:39:58+00:00",
With change:
"Created": "2022-01-31T19:39:58.101000+00:00",
"Modified": "2022-01-31T19:39:58.101000+00:00",
The Redfish validator is okay with this
*** /redfish/v1/Systems/system/LogServices/EventLog/Entries/1000
Type (LogEntry.v1_8_0.LogEntry), GET SUCCESS (time: 0)
PASS
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie8a2243230ee080d9e8785ae918fad1b1b6ab145
|
|
Boost url has changed some APIs again. This commit updates our URIs to
handle it. As part of this work, it also removes some of the debug
prints that were put in early on. These aren't really needed these
days.
This commit invents a temporary #define of NEW_BOOST_URL, so we can get
through the subtree update without a hard dependency on this specific
version of bmcweb. Ideally boost-url would have some version field, but
unfortunately, it is thusfar unversioned, as the long term intent of the
author is to be included in boost, and would be versioned there.
All the code within the else of the NEW_BOOST_URL flag will be removed
once the subtree update is landed.
Tested:
Added CXXFLAGS:append = " -DNEW_BOOST_URL" to the recipe and checked out
on top of the subtree update, and build succeeded.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie2064e45efbc4331bdc5a5ddf44d877cde5e13cb
|
|
The host state information is provided by the
xyz.openbmc_project.State.Host service. There is no guarantee that this
service will be up and running by the time bmcweb needs it. Returning an
InternalError simply because a service is not yet running is
not very user friendly to our clients. In most situations, a client will
ignore all data returned when a 500 is returned.
Instead of putting systemd Wants/Before type relationships on everything
possibly needed by bmcweb, the design point is to simply return what
bmcweb can get at that instant in time. With this change, the majority
of the redfish system object data can be returned and used by the
client.
This scenario has been seen a few times on our p10bmc machine.
Tested:
- Verified that when xyz.openbmc_project.State.Host was unavailable, a
call to redfish/v1/Systems/system returned what was available without
error.
- Verified that redfish validator passed
- Verified that redfish validator passed when
xyz.openbmc_project.State.Host.service was unavailable
Change-Id: I22c6942d2c81083bf90fa4180e95b1fa19221374
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
|
|
This one is a little trivial, but it does help in readability.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I5366d4eec8af2f781b3bad804131ae2eb806e3aa
|
|
This commit implements Cable and Cable collection schema
on bmcweb.
Testing:
Validator:
@odata.id /redfish/v1/Cables odata Exists PASS
@odata.type #CableCollection.CableCollection odata Exists
PASS
Members@odata.count 2 odata Exists PASS
Members Array (size: 2) links: Cable Yes ...
Members[0] Link: /redfish/v1/Cables/dp0_cable0 link: Cable
Yes PASS
Members[1] Link: /redfish/v1/Cables/dp0_cable1 link: Cable
Yes PASS
Description Collection of Cable Entries none Yes PASS
Name Cable Collection none Yes PASS
Oem - Resource.Oem No Optional
Property Name Value Type Exists Result
@odata.id /redfish/v1/Cables/dp0_cable0 odata Exists PASS
@odata.type #Cable.v1_0_0.Cable odata Exists PASS
CableType string Yes PASS
LengthMeters - number No Optional
Id dp0_cable0 none Yes PASS
Name Cable none Yes PASS
Property Name Value Type Exists Result
@odata.id /redfish/v1/Cables/dp0_cable1 odata Exists PASS
@odata.type #Cable.v1_0_0.Cable odata Exists PASS
CableType string Yes PASS
LengthMeters - number No Optional
Id dp0_cable1 none Yes PASS
Name Cable none Yes PASS
Note: Removed some of the fields that are optional to reduce commit msg
Tesing with Curl commands:
$ curl -k -X GET https://{$bmc}/redfish/v1/Cables
{
"@odata.id": "/redfish/v1/Cables",
"@odata.type": "#CableCollection.CableCollection",
"Description": "Collection of Cable Entries",
"Members": [
{
"@odata.id": "/redfish/v1/Cables/dp0_cable0"
},
{
"@odata.id": "/redfish/v1/Cables/dp0_cable1"
}
],
"Members@odata.count": 2,
"Name": "Cable Collection"
}
$ curl -k -X GET https://{$bmc}/redfish/v1/Cables/dp0_cable0
{
"@odata.id": "/redfish/v1/Cables/dp0_cable0",
"@odata.type": "#Cable.v1_0_0.Cable",
"CableType": "",
"Id": "dp0_cable0",
"Name": "Cable"
}
$ curl -k -X GET https://{$bmc}/redfish/v1/Cables/dp0_cable1
{
"@odata.id": "/redfish/v1/Cables/dp0_cable1",
"@odata.type": "#Cable.v1_0_0.Cable",
"CableType": "",
"Id": "dp0_cable1",
"Name": "Cable"
}
Set Length property to 1.5 meters using busctl, and check the properties
busctl set-property xyz.openbmc_project.Inventory.Manager \
/xyz/openbmc_project/inventory/cables/dp0_cable0 \
xyz.openbmc_project.Inventory.Item.Cable Length d 1.5
$ curl -k -X GET https://{$bmc}/redfish/v1/Cables/dp0_cable0
{
"@odata.id": "/redfish/v1/Cables/dp0_cable0",
"@odata.type": "#Cable.v1_0_0.Cable",
"CableType": "",
"Id": "dp0_cable0",
"LengthMeters": 1.5,
"Name": "Cable"
}
Signed-off-by: Shantappa Teekappanavar <sbteeks@yahoo.com>
Change-Id: I832ff1c1053f4d8100d04a42cc8046a61e8c1613
|
|
This commit add support for MTUSize property with GET and PATCH methods
under Redfish URI "/redfish/v1/Managers/bmc/EthernetInterfaces/<id>".
This property shows the maximum size of the Protocol Data Uint (PDU) in
bytes, that can be passed in an Ethernet frame on the network interface.
User can GET and SET the MTU Size of any available network interface.
The backend implementation for this is committed to below link
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-networkd/+/455591
Testing:
- Redfish Validator Test Passed.
- curl -k -H "X-Auth-Token: $token" -X PATCH -d '{"MTUSize" : 1280}' https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/eth3
- curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/eth3
{
"@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth3",
"@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface",
"DHCPv4": {
"DHCPEnabled": true,
"UseDNSServers": true,
"UseDomainName": true,
"UseNTPServers": true
},
"DHCPv6": {
"OperatingMode": "Stateful",
"UseDNSServers": true,
"UseDomainName": true,
"UseNTPServers": true
},
"Description": "Management Network Interface",
"FQDN": "evb-ast2600",
"HostName": "evb-ast2600",
"IPv4Addresses": [
{
"Address": "10.0.126.64",
"AddressOrigin": "DHCP",
"Gateway": "10.0.120.1",
"SubnetMask": "255.255.248.0"
}
],
"IPv4StaticAddresses": [],
"IPv6AddressPolicyTable": [],
"IPv6Addresses": [
{
"Address": "4001:df24:df25:df26:a069:c2ff:fe62:1c52",
"AddressOrigin": "DHCPv6",
"AddressState": null,
"PrefixLength": 64
},
{
"Address": "fe80::a069:c2ff:fe62:1c52",
"AddressOrigin": "LinkLocal",
"AddressState": null,
"PrefixLength": 64
},
{
"Address": "1001:7:7:7:a069:c2ff:fe62:1c52",
"AddressOrigin": "DHCPv6",
"AddressState": null,
"PrefixLength": 64
}
],
"IPv6DefaultGateway": "0:0:0:0:0:0:0:0",
"IPv6StaticAddresses": [],
"Id": "eth3",
"InterfaceEnabled": true,
"LinkStatus": "LinkUp",
"MACAddress": "a2:69:c2:62:1c:52",
"MTUSize": 1280,
"Name": "Manager Ethernet Interface",
"NameServers": [
"10.0.0.31",
"10.0.0.32"
],
"SpeedMbps": 0,
"StaticNameServers": [],
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
},
"VLANs": {
"@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth3/VLANs"
}
}
Signed-off-by: Tejas Patil <tejaspp@ami.com>
Change-Id: I8f55b3b5016503baecb7b85784d1a8bece69a258
|
|
According to Redfish spec, current "PCIeFunctions@odata.count" in
PCIeFunctionCollection should be "Members@odata.count".
Tested:
Redfish validator passed.
Change-Id: Iaabcad0f19b619eea26e2902944d3262fe499a5b
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
The commit 711ac7a9 introduces a bug in redfish-core/lib/managers.hpp
that it uses the incorrect property name when getting "Class"'s value.
This results in HW CI error that is related to /redfish/v1/Managers/bmc,
and manually access this URI results in 500 InternalError.
Tested: Verify the /redfish/v1/Managers/bmc URI is OK and the HW CI
passes.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Ieb8f98b6cfee6aa22a0320d2410a9b96c536c080
|
|
Do a partial update from the include what you use tool.
While ideally we'd be able to do this as part of CI, there's still quite
a bit of noise in the output that requires manual intervention.
Tested:
Code compiles
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iaaeb7a9199f64b5d6913c3abab4779b252768ed8
|
|
The following typedefs that are commonly used by redfish services
to get dbus subtree objects:
MapperServiceMap =
std::vector<std::pair<std::string, std::vector<std::string>>>
MapperGetSubTreeResponse =
std::vector<std::pair<std::string, MapperServiceMap>>
This commit adds the above mentioned typedefs to dbus utility namespace
and removes locally defined typedefs in processor.hpp.
Testing:
Validator: No errors
Few sample outputs from curl command:
$ curl -k -X GET https://{$bmc}/redfish/v1/Systems/system/Processors
{
"@odata.id": "/redfish/v1/Systems/system/Processors",
"@odata.type": "#ProcessorCollection.ProcessorCollection",
"Members": [
{
"@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu0"
},
{
"@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu1"
},
{
"@odata.id": "/redfish/v1/Systems/system/Processors/dcm1-cpu0"
},
{
"@odata.id": "/redfish/v1/Systems/system/Processors/dcm1-cpu1"
}
],
"Members@odata.count": 4,
"Name": "Processor Collection"
}
$ curl -k -X GET
https://{$bmc}/redfish/v1/Systems/system/Processors/dcm0-cpu0
{
"@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu0",
"@odata.type": "#Processor.v1_12_0.Processor",
"Id": "dcm0-cpu0",
"Location": {
"PartLocation": {
"ServiceLabel": "U78DA.ND0.WZS004K-P0-C15"
}
},
"LocationIndicatorActive": false,
"Manufacturer": "",
"MaxSpeedMHz": 0,
"Model": "5C67",
"Name": "PROCESSOR MODULE",
"PartNumber": "03JM290",
"ProcessorId": {
"EffectiveFamily": ""
},
"ProcessorType": "CPU",
"SerialNumber": "YA3936061828",
"Socket": "",
"SparePartNumber": "F210110",
"Status": {
"Health": "OK",
"State": "Enabled"
},
"SubProcessors": {
"@odata.id":
"/redfish/v1/Systems/system/Processors/dcm0-cpu0/SubProcessors"
},
"TotalCores": 8,
"TotalThreads": 0
}
$ curl -k -X GET
https://{$bmc}/redfish/v1/Systems/system/Processors/dcm0-cpu0/SubProcessors
{
"@odata.id":
"/redfish/v1/Systems/system/Processors/dcm0-cpu0/SubProcessors",
"@odata.type": "#ProcessorCollection.ProcessorCollection",
"Members": [],
"Members@odata.count": 0,
"Name": "SubProcessor Collection"
}
Signed-off-by: Shantappa Teekappanavar <sbteeks@yahoo.com>
Change-Id: I297c763af38fa5b13ef297e911b338f406b7c6e6
|
|
This changes to a streambuf_iterator to read the file contents
into the response body. It may be slightly slower, but it's
easier to read and has less opportunity for errors.
Tested:
Confirmed that a Crashdump file can be successfully downloaded
through Redfish using a browser.
Change-Id: Ic143fe4274678e89330bf354d1b8098550e8b85b
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
|