Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
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
|
|
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 commits adds a dummy ProtocolFeaturesSupported object in the
service root. It indicates that none of the Query Parameter is
supported. Future commits will add supports for OnlyMemberQuery,
ExpandQuery, and so on.
Tested:
1. unit test
2. passed QEMU Redfish (which contains Redfish Validator) test
This commit is split from these changes:
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38952
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/47474
Credits to maxiaochao@inspur.com, ed@tanous.net, and
zhanghch05@inspur.com.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I81ff856514528f63a462558a8f18fefe4369edae
|
|
The Members property within resources is expected to allow create in the
same way the Collection resource does. From the spec:
Submitting a POST request to a resource collection is equivalent to
submitting the same request to the Members property of that resource
collection. Services that support the addition of Members to a resource
collection shall support both forms.
Related: #192
Tested:
Redfish protocol validator, REQ_POST_CREATE_TO_MEMBERS_PROP now passes.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I5c22325946eab9aec8c690450aa2ea24a6e4e485
|
|
OperatingMemoryModes and MemoryMedia properties of Memory should be of
array type, and removes the extra whitespace in OperatingMemoryModes.
Tested:
Redfish validator passed.
Change-Id: I1b697db93e87dc791ce90a61be41da913fe61a36
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
In line with other patchsets doing the same thing, move SessionService
to free methods.
Tested:
curl --insecure -X POST -d "{\"UserName\": \"root\", \"Password\": \"0penBmc\"}" https://192.168.7.2/redfish/v1/SessionService/Sessions
succeeds and returns a result.
redfishtool -S Always -A Session -u root -p 0penBmc -vvvvv -r 192.168.7.2 raw GET "/redfish/v1/SessionService/Sessions"
Succeeds and returns the sesion created previously, and deletes its own
session successfully.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I38aeeef2143898510e6c645719deaa7d56a418dc
|
|
This saves about 4k on the binary size
Tested: Redfish service validator passes.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I9546227a19c691b1aecb80e80307889548c0293f
|
|
Currently when Members array is initialized to an empty array, the
Members@odata.count is not present. Initialize it as 0.
The bug seems to have been introduced by:
https://gerrit.openbmc-project.xyz/50224
Tested: On QEMU -
Before change:
{
"@odata.id": "/redfish/v1/Systems/system/LogServices/Crashdump/Entries",
"@odata.type": "#LogEntryCollection.LogEntryCollection",
"Description": "Collection of Crashdump Entries",
"Members": [],
"Name": "Open BMC Crashdump Entries"
}
After change:
{
"@odata.id": "/redfish/v1/Systems/system/LogServices/Crashdump/Entries",
"@odata.type": "#LogEntryCollection.LogEntryCollection",
"Description": "Collection of Crashdump Entries",
"Members": [],
"Members@odata.count": 0,
"Name": "Open BMC Crashdump Entries"
}
{
"@odata.id": "/redfish/v1/Systems/system/LogServices/Crashdump/Entries",
"@odata.type": "#LogEntryCollection.LogEntryCollection",
"Description": "Collection of Crashdump Entries",
"Members": [
{
"@odata.id": "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/OnDemand",
"@odata.type": "#LogEntry.v1_7_0.LogEntry",
"AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/OnDemand/crashdump_ondemand_1970-01-01T00:05:23Z.json",
"Created": "1970-01-01T00:05:23Z",
"DiagnosticDataType": "OEM",
"EntryType": "Oem",
"Id": "OnDemand",
"Name": "CPU Crashdump",
"OEMDiagnosticDataType": "PECICrashdump"
}
],
"Members@odata.count": 1,
"Name": "Open BMC Crashdump Entries"
}
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I5d17a8a62db23ad0da1c97113a4c6521bdec02cb
|
|
getDimmDataByService(), the caller of getPersistentMemoryProperties(),
has already looped over the properties returned by DBus GetAll, but
this function loop these properties again, bringing extra overhead.
This patch removes this unwanted loop.
Tested:
Added a log in getPersistentMemoryProperties(), it only prints once
when GET /redfish/v1/Systems/system/Memory/{ID}.
Change-Id: Iac86770678e29ce5f530ceb23be5ce2013bc4658
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
There is an undefined property "Members@odata.count" in /redfish/v1/
UpdateService/FirmwareInventory/{BIOSImage}. This property should be
"RelatedItem@odata.count" according to Redfish spec.
Fixes 7e860f1550c8 ("Remove Redfish Node class")
Tested:
Redfish validator passed.
Change-Id: I915295a20a528c2febe244ed2b400ae460392512
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
|
|
On the Control.Power.RestorePolicy interface, a value of "None" is
allowed on the PowerRestorePolicy property and Redfish should handle
this value instead of throwing an internal error. Until support of
"None" as a one time parameter is included into the Redfish schema,
return "AlwaysOff" to align with the dbus interface.
Tested:
Set PowerRestorePolicy to "None" enum value
Verified `PowerRestorePolicy` value is "AlwaysOff" thru Redfish
Set PowerRestorePolicy to "AlwaysOff" enum value
Verified `PowerRestorePolicy` value is "AlwaysOff" thru Redfish
Ran Redfish validator:
Elapsed time: 0:02:47
invalidPropertyValue: 44
metadataNamespaces: 2390
pass: 4384
passAction: 10
passGet: 212
passRedfishUri: 170
repeat: 1
skipNoSchema: 3
skipOptional: 4530
warnDeprecated: 319
warningPresent: 64
Validation has succeeded.
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Change-Id: Idb5b16ae797527b9d35a58aa3c26f6527aa5436d
|
|
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
|
|
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
|