| Age | Commit message (Collapse) | Author | Files | Lines |
|
FunctionType and DeviceClass are Redfish enums, but the D-Bus
properties are free-form strings that were copied into the response
as-is. A value that is not a valid enum member produced a
non-compliant PCIeFunction resource.
Convert the D-Bus strings to the generated pcie_function enums and
only publish them when they match a known value. Unknown values are
omitted and logged. Producers such as peci-pcie already use the
Redfish enum names, so their output is unchanged.
Tested:
Unit tests added for valid, unknown, empty and "Invalid" values;
all pcie_test cases pass.
On romulus QEMU, created a PCIeDevice inventory object with three
functions and checked
GET /redfish/v1/Systems/system/PCIeDevices/pcie_card0/PCIeFunctions/N
Function 0 (Physical, MassStorageController):
Before and after: both properties published.
Function 1 (Logical, "Mass Storage Controller"):
Before: both invalid values published.
After: both properties omitted, HTTP 200.
Function 2 (empty strings):
Before and after: both properties omitted.
Redfish Service Validator passes on the PCIeDevices tree; without
this change it reports invalid enum values for PCIeFunction 1.
Change-Id: I368c16f6143cb38b68f67a76620a0e062c901e94
Signed-off-by: Shivraj Toravi <shivrajnt@ami.com>
|
|
getLocationType() handed the Redfish LocationType back as a bare string,
so a caller writing it into a response got no checking against the
schema and a wrong value would only show up at runtime. Return the
generated resource::LocationType enum instead. It serializes to the same
strings, so the compiler now rejects anything the schema does not
define.
Tested: Unit tests pass. The helper has no caller on master yet, so no
Redfish response changes, and the enum serializes to the same "Slot" and
"Embedded" values the function returned before.
Change-Id: I4e8e5f2bf6a8c4feebe4d25f627c25c6acc39cd1
Signed-off-by: Ender Hsieh <andhsieh@nvidia.com>
|
|
Most *InternalError tests check the 500 status but not the response
body. Add the expected InternalError body to
error_messages_test_utils.hpp so it is written in one place, and
compare the whole body in the *InternalError tests where the response
holds only that error.
Tested: unit-test CI passes.
Change-Id: I449b9dbbd352470a21b2ba2250d9be970c8dc2c2
Signed-off-by: Eric Liu <liuer@nvidia.com>
|
|
Cover storeInventoryItemData(): the Item, Item.PowerSupply,
Decorator.Asset and OperationalStatus interfaces, each supported
property, unknown interfaces and properties, and properties with the
wrong type.
Tested with:
meson test -C build sensors_test --print-errorlogs
18/18 cases pass.
Change-Id: Iec63ba144fcac91e730cefb12350303b0e8fecd4
Signed-off-by: Eric Liu <liuer@nvidia.com>
|
|
The NetworkAdapter Location handler in network_adapter.hpp has no unit
tests. Add tests to improve unit test coverage of this feature.
Tested: Unit tests pass.
Change-Id: I35c5d50a5cae2c130e66549ade57edf1d5088d36
Signed-off-by: JY Voon <jvoon@nvidia.com>
|
|
ReadingTime is published from a property a service may leave unset, and
only on a full sensor resource, so the cases worth holding still are the
ones where it must not appear at all: a zero time, an absent property,
and an excerpt.
Tested: Ran the unit tests.
Change-Id: I45cbac8b94945f7e5a422ef867f776f071cfe6d8
Signed-off-by: Ender Hsieh <andhsieh@nvidia.com>
|
|
The OperatingConfigs resources in processor_operating_config.hpp have no
unit tests. Add tests to improve unit test coverage of this implemented
feature, and move the OperatingConfig resource fields into
fillOperatingConfigResponse() so they can be tested without D-Bus.
Tested: Unit tests pass.
Change-Id: I0fdb953bdce136fdf66e27cdb7ccbf44e24d3d52
Signed-off-by: JY Voon <jvoon@nvidia.com>
|
|
The SubProcessors resources in processor_core.hpp have no unit tests.
Add tests to improve unit test coverage of this implemented feature.
Tested: Unit tests pass.
Change-Id: I04a4e43135cee4b4aae0d3431e179a37eeb9b107
Signed-off-by: JY Voon <jvoon@nvidia.com>
|
|
The PCIeSlots resources in pcie_slots.hpp have no unit tests. Add tests
to improve unit test coverage of this implemented feature.
Tested: Unit tests pass.
Change-Id: Ia7275b333eab424775ffd7004fabc70021825107
Signed-off-by: JY Voon <jvoon@nvidia.com>
|
|
The Cable resources in cable.hpp have no unit tests. Add tests to
improve unit test coverage of this implemented feature.
Tested: Unit tests pass.
Change-Id: I116db549c45723e875df2087b2e3646e0036d7b7
Signed-off-by: JY Voon <jvoon@nvidia.com>
|
|
Some unit test file names were not following the naming convention
ending with the suffix 'test'.
Rename all files to follow that convention.
In addition, fix bad formatting that does not pass CI any longer.
Tested: Code compiles. Unit tests pass.
Change-Id: Ic55eb45f03f0650ceecc9f54cf340677e80d64da
Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
|
|
Currently, bmcweb does not recognize the rotational_position sensor
type under /xyz/openbmc_project/sensors/rotational_position, which is
already defined and documented in phosphor-dbus-interfaces (PDI).
Consequently, sensors such as ABSOLUTE_ROTATIONALPOS_RAD exposed by
valves (e.g. Belimo valves) are filtered out from the Chassis Sensors
collection (/redfish/v1/Chassis/<ChassisId>/Sensors).
This commit adds support for rotational_position sensors:
1. Add /xyz/openbmc_project/sensors/rotational_position to
getSensorPaths() in sensors.hpp.
2. Map rotational_position to ReadingType::RotationalPosition and
ReadingUnits "rad" in sensor_utils.hpp.
3. Use "rotation" prefix for rotational_position in getSensorId()
and handle decoding back to "rotational_position" in
splitSensorNameAndType().
4. Add unit test coverage in sensor_utils_test.cpp.
Tested:
1. Verified on Ventura2 BMC with Belimo valve:
GET /redfish/v1/Chassis/SupplyValve2_1/Sensors
- Observed
rotation_SupplyValve2_1_ABSOLUTE_ROTATIONALPOS_RAD in Members.
2. Queried the specific sensor URI:
GET /redfish/v1/Chassis/SupplyValve2_1/Sensors/
rotation_SupplyValve2_1_ABSOLUTE_ROTATIONALPOS_RAD
- Verified the response contains:
"ReadingType": "RotationalPosition",
"ReadingUnits": "rad",
"Reading": <reading_in_radians>
3. Unit tests in sensor_utils_test pass.
4. Redfish Service Validator passes on
/redfish/v1/Chassis/SupplyValve2_1/Sensors:
- 246 Pass / 0 Warn / 0 Fail
Change-Id: I080305ef72dff484d1c70083a14f728e504f718f
Signed-off-by: Will Tsai <will.tsai@quantatw.com>
|
|
`passwordExpirationToJson` previously had no way to select a timezone,
so its unit test hardcoded a UTC string and failed on machines with a
non-UTC local timezone.
The time utils already support an explicit timezone string, with an
empty string meaning "local zone". Add an optional timezone parameter
to `passwordExpirationToJson` (defaulting to empty, preserving existing
local-zone behavior in production) and pass it through.
Update the corresponding unit test to check exact strings with explicit
"UTC" and "America/New_York" zones, plus verify the default still
matches results from `getDateTimeUint` directly.
Tested: Unit tests passes, including on a system with local timezone
America/New_York.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ie4bdb8a2b88447ee0db5f5758acc12ba021db0d2
|
|
An empty BuildDate string from the Asset interface now causes a 500 due
to the fix at "Add tests for production date report handling".[1] This
is causing bmcweb bumps to fail with[2]:
```
/redfish/v1/Systems/system/Memory/dimm0
...
Resource Error: Received HTTP 500 when accessing the URI.
FAIL
/redfish/v1/Systems/system/Memory/dimm1
...
Resource Error: Received HTTP 500 when accessing the URI.
FAIL
```
[1]: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/92867
[2]: https://gerrit.openbmc.org/c/openbmc/openbmc/+/96362
The Asset interface has properties such as PartNumber, SerialNumber,
Manufacturer, Model, etc., so it is reasonable to assume you might have
some of those properties filled out but not all. The default BuildDate
is "" and with 92867 that now causes a 500. This fix, to just leave off
if BuildDate is empty is what we do for SparePartNumber and matches the
behavior we had prior to 92867 for an empty string. Thought about just
ignoring all errors like we did prior to 92867 but figure if you fill
out BuildDate and the format isn't correct, reasonable to throw an
error.
Even if IBM populated these BuildDates for the Dimms, expect other
companies to hit so let's do check and not throw an error when it is the
default state.
On a P10bmc:
```
busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0 xyz.openbmc_project.Inventory.Decorator.Asset BuildDate
s ""
```
Tested: After recreating the error without this fix, the Redfish
Validator on a p10bmc system with Dimms with a BuildDate="" passes and
those endpoints no longer return a 500.
Change-Id: I120334bdfb7f3a81192212d33136b0a61d4ceb50
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
|
|
The redfish-allow-deprecated-indicatorled option was disabled by default
in 2025 [1] and scheduled for removal by March 2026. Remove the option
and the IndicatorLED code under it: Chassis and ComputerSystem GET and
PATCH, and the Thermal Fans and Power PowerSupplies entries. Redfish
deprecated IndicatorLED in favor of LocationIndicatorActive, which is
unchanged. Sensor inventory lookups no longer read inventory LEDs,
which only fed that property. A PATCH of IndicatorLED still returns
PropertyUnknown, as it did with the option disabled.
[1]: https://github.com/openbmc/bmcweb/commit/f664fd8abeba11c7aa06d5119423a27b9d40d045
Tested: Build an image for nvl32-obmc.
```
$ curl -sk -u <credentials> https://${bmc}/redfish/v1/Systems/system | grep -cE "IndicatorLED|LocationIndicatorActive"
0
$ curl -sk -u <credentials> https://${bmc}/redfish/v1/Chassis/Nvidia_Alon8_HPM | grep -cE "IndicatorLED|LocationIndicatorActive"
0
$ curl -sk -u <credentials> -w '\n%{http_code}\n' -X PATCH -H 'Content-Type: application/json' -d '{"IndicatorLED":"Lit"}' https://${bmc}/redfish/v1/Systems/system | grep -E '"code"|^[0-9]{3}$'
"code": "Base.1.19.PropertyUnknown",
400
$ curl -sk -u <credentials> -w '\n%{http_code}\n' -X PATCH -H 'Content-Type: application/json' -d '{"IndicatorLED":"Lit"}' https://${bmc}/redfish/v1/Chassis/Nvidia_Alon8_HPM | grep -E '"code"|^[0-9]{3}$'
"code": "Base.1.19.PropertyUnknown",
400
$ curl -sk -u <credentials> -o /dev/null -w '%{http_code}\n' -X PATCH -H 'Content-Type: application/json' -d '{"LocationIndicatorActive":true}' https://${bmc}/redfish/v1/Systems/system
200
$ curl -sk -u <credentials> https://${bmc}/redfish/v1/Systems/system | jq .LocationIndicatorActive
true
$ curl -sk -u <credentials> -o /dev/null -w '%{http_code}\n' -X PATCH -H 'Content-Type: application/json' -d '{"LocationIndicatorActive":true}' https://${bmc}/redfish/v1/Chassis/MockLedChassis
204
$ curl -sk -u <credentials> https://${bmc}/redfish/v1/Chassis/MockLedChassis | jq .LocationIndicatorActive
true
$ curl -sk -u <credentials> "https://${bmc}/redfish/v1/Chassis/Nvidia_RTX_PRO_6000_Blackwell_0/Sensors?\$expand=." | jq -c '.Members[] | {Id, ReadingType}'
{"Id":"voltage_GPU_0_Voltage_0","ReadingType":"Voltage"}
{"Id":"energy_GPU_0_Energy_0","ReadingType":"EnergyJoules"}
{"Id":"power_GPU_0_Power_0","ReadingType":"Power"}
{"Id":"temperature_GPU_0_TEMP_1","ReadingType":"Temperature"}
{"Id":"temperature_GPU_0_DRAM_0_TEMP_0","ReadingType":"Temperature"}
{"Id":"temperature_GPU_0_TEMP_0","ReadingType":"Temperature"}
Summary - PASS: 63, WARN: 0, FAIL: 0, NOT TESTED: 79
Summary - PASS: 27, WARN: 0, FAIL: 0, NOT TESTED: 55
```
1. Systems/system and Chassis/Nvidia_Alon8_HPM return no IndicatorLED.
2. A PATCH of IndicatorLED returns PropertyUnknown on both resources.
3. This machine has no LED groups, so a test D-Bus service stood in
for phosphor-led-manager. A PATCH of LocationIndicatorActive sets
the LED group on Systems/system and on a chassis with an identifying
LED group, a GET reads it back, and every response matches the build
before the change.
4. Redfish Service Validator over both resources reports no failures.
5. bmcweb unit tests pass, including FillPowerThermalIdentity.
6. Sensors $expand, which runs the sensor inventory lookup, returns the
same members and fields as before the change.
Change-Id: Id744b1d2092cf24faa4ee7ab25d8747c397e982d
Signed-off-by: Eric Liu <liuer@nvidia.com>
|
|
Prior to this patch the logic treated both InProgress and NotStarted
status as InProgress. Same for Failed and Aborted, which both are
treated as Failed.
To align with the pdi definition of xyz.openbmc_project.Common.Progress
Status property [1], add the NotStarted and Aborted status to the
DumpCreationProgress enum and adapt progress logic to account for these
statuses explicitly.
Tested: Manually tested on romulus running in qemu with ibm dump
extension enabled, to get access to /xyz/openbmc_project/dump/system.
Put machine state into Quiesced:
```
busctl set-property xyz.openbmc_project.State.Host0 \
/xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Host \
CurrentHostState \
s "xyz.openbmc_project.State.Host.HostState.Quiesced"
```
POST request
```
curl -v -k POST 'https://localhost:44443/redfish/v1/Systems/system/
LogServices/Dump/Actions/LogService.CollectDiagnosticData' \
-H 'X-Auth-Token: '"$BMCWEB_SESSION_TOKEN_ROML"'' \
-H "Content-Type: application/json" -d \
'{"DiagnosticDataType":"OEM", "OEMDiagnosticDataType":"System"}'
```
Dump manager tree
```
busctl tree xyz.openbmc_project.Dump.Manager
`- /xyz
`- /xyz/openbmc_project
`- /xyz/openbmc_project/dump
|- /xyz/openbmc_project/dump/bmc
| `- /xyz/openbmc_project/dump/bmc/entry
| `- /xyz/openbmc_project/dump/bmc/entry/1
|- /xyz/openbmc_project/dump/faultlog
|- /xyz/openbmc_project/dump/resource
`- /xyz/openbmc_project/dump/system
`- /xyz/openbmc_project/dump/system/entry
|- /xyz/openbmc_project/dump/system/entry/1
`- /xyz/openbmc_project/dump/system/entry/2
```
Set progress to NotStarted
```
busctl set-property xyz.openbmc_project.Dump.Manager \
/xyz/openbmc_project/dump/system/entry/2 \
xyz.openbmc_project.Common.Progress Status \
s "xyz.openbmc_project.Common.Progress.OperationStatus.NotStarted"
journalctl -u bmcweb
...
Sep 07 14:55:21 romulus bmcweb[200]: [dump_utils.hpp:655]
/xyz/openbmc_project/dump/system/entry/2: Dump creation task is in
progress
```
Set progress to Aborted
```
busctl set-property xyz.openbmc_project.Dump.Manager \
/xyz/openbmc_project/dump/system/entry/2 \
xyz.openbmc_project.Common.Progress Status \
s "xyz.openbmc_project.Common.Progress.OperationStatus.Aborted"
journalctl -u bmcweb
...
Sep 07 14:55:42 romulus bmcweb[200]: [dump_utils.hpp:646]
/xyz/openbmc_project/dump/system/entry/2: Aborted creating dump
```
Verified successful dump creation flow works the same as before,
following same testing as in previous patch.
[1] https://github.com/openbmc/phosphor-dbus-interfaces/blob/0be76aeee7e5c7d8235ea830049aa99fd9bf731c/yaml/xyz/openbmc_project/Common/Progress.interface.yaml#L32
Change-Id: I4911de4476156e043ef5e5eddaa950e40535754e
Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
|
|
The ThermalMetrics resources in thermal_metrics.hpp have no unit tests.
Add tests to improve unit test coverage of this implemented feature.
Tested: Unit tests pass.
Change-Id: I21a24470e704e7c0652b70df4ac5d19e5c1ba502
Signed-off-by: JY Voon <jvoon@nvidia.com>
|
|
Add a unit test verifying that handleStartUpdate returns HTTP 500
Internal Server Error when the D-Bus start update call fails with
an I/O error.
Tested:
Ran meson test -C builddir update_service_test --verbose.
All 7 tests passed, including StartUpdateErrorReturnsInternalError.
Change-Id: I3921d4ece62c910097053fbee1d9fe62dc381167
Signed-off-by: Shivraj Toravi <shivrajnt@ami.com>
|
|
Add test coverage for assignBootParameters() to verify correct boot
source and boot mode assignments for supported boot override values and
invalid input handling.
Tested: meson test -C build system_test --print-errorlogs passed.
Change-Id: I80f09aa94490e61898fa24d09649d03f561239d6
Signed-off-by: Shivraj Toravi <shivrajnt@ami.com>
|
|
Return computer_system::BootSource enum values instead of strings,
and update the caller to check for BootSource::Invalid.
Add unit tests covering all supported mappings and an unknown source.
Tested: ninja -C build test; 77/77 pass.
Tested: Cross-built and deployed on Romulus QEMU. All 15 functional
checks passed, covering GET mappings, boot-mode precedence, PATCH/GET
round trips, and invalid PATCH rejection.
Change-Id: I7c5efd138377eab37c80093d6a2286ee8dbba2fb
Signed-off-by: Shivraj Toravi <shivrajnt@ami.com>
|
|
Add positive and negative unit tests for production-date
handling in time_utils.
- Validate normalization of valid build-date strings.
- Verify invalid build-date values are rejected.
- Guard against regressions in date parsing and output
formatting behavior.
Change-Id: I2d9f6b0746a6a0abd4a8759c487739ed0744c40c
Signed-off-by: Shivraj Toravi <shivrajnt@ami.com>
|
|
Malformed UpdateParameters content previously returned HTTP 200 with an
empty response body, making invalid multipart input appear accepted.
Return HTTP 400 with a structured Redfish error instead. The response
contains `Base.1.19.MalformedJSON` as the top-level code and
`MessageId`, with an empty `MessageArgs` array.
Return UnrecognizedRequestBody when a multipart part is missing
Content-Disposition, so the handler does not fail silently.
Tested:
POST /redfish/v1/UpdateService/update-multipart/ with malformed JSON now
returns HTTP 400, `Content-Type: application/json`, and
`Base.1.19.MalformedJSON`
Change-Id: I6ba2d8ca58d202aad0f73302f512feda59b94ecf
Signed-off-by: Joel Pullokaran Jesin <joelpj@ami.com>
|
|
The BmcwebSaxParse JSON parser caps the total number of values in a
request body at 2000. This can be limiting for telemetry report
creation requests, which can contain hundreds of sensor metric
properties and may exceed this limit, causing MalformedJSON errors.
Increase maxValues from 2000 to 5000. The HTTP body size limit
(30 MiB by default) still guards against truly abusive payloads.
Change-Id: Id0c26b9a878c39dfa9e9f9b5546da0c53fbd3a83
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
|
|
Return Redfish HeaderMissing when the UpdateService HTTP push endpoint
receives no Content-Type header, and HeaderInvalid when the header value
is unsupported.
Previously, these requests returned only HTTP 400 without a Redfish
extended error. Both responses now include HTTP 400 with the appropriate
Base.1.19 header error and identify Content-Type.
Add unit tests for the same.
Tested:
POST /redfish/v1/UpdateService/update with Content-Type:
application/json returns HTTP 400 and Base.1.19.HeaderInvalid.
GET /redfish/v1/UpdateService returns HTTP 200.
Change-Id: I09300fc78a8a8002ea159621b84a1fa81e139230
Signed-off-by: Joel Pullokaran Jesin <joelpj@ami.com>
|
|
Cover D-Bus path building, trigger id parsing including escaping and
empty ids, and conversion between D-Bus operation types and the Redfish
calculation algorithm enum.
Tested: unit-test CI passes. 18 tests run.
Change-Id: Ie6d840f27c1fc4a3185c89439ed40bfa8cacb43a
Signed-off-by: Eric Liu <liuer@nvidia.com>
|
|
getRedfishSwState() and getRedfishSwHealth() decide the Status of every
software inventory entry bmcweb publishes, and
getFunctionalSoftwarePath() picks which D-Bus object the functional
version is read from, yet none of the three had a unit test. Both
activation mappers fall back silently, to Disabled and to Warning, so a
typo in one of the Activations strings would not fail a build or a test
and would only show as a wrong Status on a running BMC.
Add tests that pin the mapped values along with the two fallbacks, and
record that Ready maps to Health OK but State Disabled, which is easy to
read as a bug when only one of the two functions is in front of you.
Tested: Unit tests pass. Tests only, no functional change.
Change-Id: I0839fc18f69cfc257758f633a321fd5302e64a98
Signed-off-by: Ender Hsieh <andhsieh@nvidia.com>
|
|
extractAssetInfo() feeds the Asset properties into ten Redfish
responses, from Chassis and ComputerSystem to PowerSupply, Fan, Cable,
PCIeDevice, Storage and FabricAdapter, but it had no unit test at all.
Its behavior is not uniform across those callers: Manufacturer and
SparePartNumber are each gated on a bool parameter, and an empty
SparePartNumber is dropped while an empty Model is not. Those rules
could only be checked by reading the code or by hitting a real BMC.
Add tests for extractAssetInfo() and afterGetAssetInfo() so the opt-in
flags, the empty SparePartNumber rule, the JSON pointer placement, the
unpack failure path and the EBADR path are all pinned down.
Tested: Unit tests pass. Tests only, no functional change.
Change-Id: I89123f7cea973ebe5faee4cab1d29234cc1f495c
Signed-off-by: Ender Hsieh <andhsieh@nvidia.com>
|
|
Cover every branch of toRedfishProperty(): each mapped D-Bus property,
the unmapped fall-through and the empty input.
Tested: unit-test CI passes. 10 tests run.
Change-Id: Ia757a51d06ee610de6254ac07ace998799271297
Signed-off-by: Eric Liu <liuer@nvidia.com>
|
|
Cover every mapped value of translatePowerModeString(), plus the
unmapped OSControlled enumerator, case sensitivity, the empty string and
a Redfish value with no D-Bus prefix.
Tested: unit-test CI passes. 11 new tests in system_test.
Change-Id: Ie6d840f27e2ba22d4fb2c1f2e2f7a4a1e48d0c58
Signed-off-by: Eric Liu <liuer@nvidia.com>
|
|
Refactored lambda handling CurrentPowerState D-Bus property for the
chassis into a named function. No functional change.
Tested:
- Created unit tests for the refactored function.
- Built p10bmc and confirmed same response before and after change.
Change-Id: Ib108cdf3f781535742a236a5560af021db92d18e
Signed-off-by: Janet Adkins <janeta@us.ibm.com>
|
|
If a nefarious server signs "com", in our current implementation, we
allow it. Rewrite the upn parser to perform a split if the hostnames
and fail if the hostname is multiple sections (thus implying that it's
an fqdn) and the UPN is a single section. We previously had a unit test
verifying the opposite, but there's potential for abuse in this if a UPN
is less than 1 section long. Checking only one section is relatively
arbitrary, and doesn't cover the potential for multiple
Tested: Good unit test coverage here.
Change-Id: I1d271baf42d290bffaeaeb1199012f1975e6e50d
Signed-off-by: Ed Tanous <edtanous@nvidia.com>
|
|
Add unit coverage for processor helper paths that were previously
untested. These tests focus on the logic that maps D-Bus data into the
Redfish processor response and handles common error cases.
These helpers directly populate processor response fields for throttle
information and manufacturer-based architecture mapping.
Adding unit tests here improves coverage for those paths and their error
handling.
Tested:
- Built and verified, all tests passed.
Change-Id: I78a588d43fe4459c1f6197dcc58646632490c041
Signed-off-by: Joel Pullokaran Jesin <joelpj@ami.com>
|
|
Add test/redfish-core/lib/memory_test.cpp and register it in
test/meson.build. Cover translation of supported D-Bus DIMM device types
to MemoryDeviceType enum values.
Verify each supported device type maps to its corresponding Redfish
enum. Also verify unknown D-Bus values return MemoryDeviceType::Invalid.
Tested:
- meson test -C builddir memory_test --print-errorlogs
- memory_test passed
Change-Id: Iff4f05a3005e9f202e3c9c27c1b308b6490c3afa
Signed-off-by: Vinothkumar Shanmugavel <vinothkumars@ami.com>
|
|
Add coverage for dbusToRfBootProgress(), which translates D-Bus boot
progress values into Redfish BootProgressTypes enum values.
Verify all supported D-Bus progress stages map to their expected Redfish
enum values. Also verify that an unknown D-Bus value returns
BootProgressTypes::Invalid.
Tested:
- meson test -C builddir system_test -v
- All system_test tests passed, including new tests
Change-Id: Icd400128b210743ad276ffad1647fd3d2d6bf40c
Signed-off-by: Vinothkumar Shanmugavel <vinothkumars@ami.com>
|
|
Extend dump_utils unit testing.
Tested: Code compiles. Introduced unit tests run through.
Change-Id: I254e7b5f7318e847551055f352b70a87d07c5cda
Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
|
|
In order to increase api safety for the dump log service, make dumpType
an enum class.
This makes the current unit test for dump logservice obsolete. Further
unit tests will be added for the existing code in a follow-up patch.
Tested: Code compiles. Added unit tests pass.
Validator was run on romulus in qemu with phosphor-debug-collector ibm
extension enabled to get access to /xyz/openbmc_project/dump/system.
In order to create dumps for /xyz/openbmc_project/dump/system the
machine has to be in either "Running", "Quiesced" or
"TransitioningToOff" state
```
busctl set-property xyz.openbmc_project.State.Host \
/xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Host \
CurrentHostState \
s "xyz.openbmc_project.State.Host.HostState.Quiesced"
```
Via the 'CollectDiagnosticData' action dump entries were manually
created for:
/xyz/openbmc_project/dump/system
/xyz/openbmc_project/dump/bmc
```
curl -v -k POST 'https://'"${BMC}"':'"${BMC_WEBPORT}"'/redfish/v1/
Managers/bmc/LogServices/Dump/Actions/
LogService.CollectDiagnosticData
-H 'X-Auth-Token: '"$BMCWEB_SESSION_TOKEN_ROML"''
-H "Content-Type: application/json" -d
{"DiagnosticDataType":"Manager","OEMDiagnosticDataType":"Manager"}
curl -v -k POST 'https://'"${BMC}"':'"${BMC_WEBPORT}"'/redfish/v1/
Systems/system/LogServices/Dump/Actions/
LogService.CollectDiagnosticData
-H 'X-Auth-Token: '"$BMCWEB_SESSION_TOKEN_ROML"''
-H "Content-Type: application/json" -d
{"DiagnosticDataType":"OEM","OEMDiagnosticDataType":"System"}
```
Set system dump entries to Completed:
```
busctl set-property xyz.openbmc_project.Dump.Manager \
/xyz/openbmc_project/dump/system/entry/1 \
xyz.openbmc_project.Common.Progress Status \
s "xyz.openbmc_project.Common.Progress.OperationStatus.Completed"
```
For FaultLog via CreateDump dbus method:
```
busctl call xyz.openbmc_project.Dump.Manager \
/xyz/openbmc_project/dump/faultlog \
xyz.openbmc_project.Dump.Create \
CreateDump a{sv} 0
> o "/xyz/openbmc_project/dump/faultlog/entry/1"
busctl tree xyz.openbmc_project.Dump.Manager
`- /xyz
`- /xyz/openbmc_project
`- /xyz/openbmc_project/dump
|- /xyz/openbmc_project/dump/bmc
| `- /xyz/openbmc_project/dump/bmc/entry
| |- /xyz/openbmc_project/dump/bmc/entry/1
| |- /xyz/openbmc_project/dump/bmc/entry/2
| |- /xyz/openbmc_project/dump/bmc/entry/3
| `- /xyz/openbmc_project/dump/bmc/entry/4
|- /xyz/openbmc_project/dump/faultlog
| `- /xyz/openbmc_project/dump/faultlog/entry
| |- /xyz/openbmc_project/dump/faultlog/entry/1
| `- /xyz/openbmc_project/dump/faultlog/entry/2
|- /xyz/openbmc_project/dump/resource
`- /xyz/openbmc_project/dump/system
`- /xyz/openbmc_project/dump/system/entry
|- /xyz/openbmc_project/dump/system/entry/1
`- /xyz/openbmc_project/dump/system/entry/2
```
Validator runs for Manager/Dump, Manager/FaultLog and System/Dump
```
rf_service_validator --schema_directory \
/home/mox/ci/bmcweb/redfish-core/schema/dmtf/csdl \
-u root -p 0penBmc -r https://127.0.0.1:44443 \
--payload Tree /redfish/v1/Managers/bmc/LogServices/Dump
Validating /redfish/v1/Managers/bmc/LogServices/Dump...
- Pass: 14, Warn: 0, Fail: 0, Skip: 9
Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries...
- Pass: 50, Warn: 0, Fail: 0, Skip: 108
Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/1...
- Pass: 11, Warn: 0, Fail: 0, Skip: 25
Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/2...
- Pass: 11, Warn: 0, Fail: 0, Skip: 25
Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/3...
- Pass: 9, Warn: 0, Fail: 0, Skip: 27
Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/4...
- Pass: 9, Warn: 0, Fail: 0, Skip: 27
+--------------+--------------+--------------+--------------+
| PASS | WARN | FAIL | NOT TESTED |
+--------------+--------------+--------------+--------------+
| 104 | 0 | 0 | 221 |
+--------------+--------------+--------------+--------------+
Validating /redfish/v1/Managers/bmc/LogServices/FaultLog...
- Pass: 12, Warn: 0, Fail: 0, Skip: 9
Validating /redfish/v1/Managers/bmc/LogServices/FaultLog/Entries...
- Pass: 20, Warn: 0, Fail: 0, Skip: 64
Validating /redfish/v1/Managers/bmc/LogServices/FaultLog/Entries/1...
- Pass: 6, Warn: 0, Fail: 0, Skip: 30
Validating /redfish/v1/Managers/bmc/LogServices/FaultLog/Entries/2...
- Pass: 6, Warn: 0, Fail: 0, Skip: 30
+--------------+--------------+--------------+--------------+
| PASS | WARN | FAIL | NOT TESTED |
+--------------+--------------+--------------+--------------+
| 44 | 0 | 0 | 133 |
+--------------+--------------+--------------+--------------+
Validating /redfish/v1/Systems/system/LogServices/Dump...
- Pass: 14, Warn: 0, Fail: 0, Skip: 9
Validating /redfish/v1/Systems/system/LogServices/Dump/Entries...
- Pass: 32, Warn: 0, Fail: 0, Skip: 52
Validating /redfish/v1/Systems/system/LogServices/Dump/Entries/1...
- Pass: 12, Warn: 0, Fail: 0, Skip: 24
Validating /redfish/v1/Systems/system/LogServices/Dump/Entries/2...
- Pass: 12, Warn: 0, Fail: 0, Skip: 24
+--------------+--------------+--------------+--------------+
| PASS | WARN | FAIL | NOT TESTED |
+--------------+--------------+--------------+--------------+
| 70 | 0 | 0 | 109 |
+--------------+--------------+--------------+--------------+
```
Download Managers/Dump and Systems/Dump
```
curl -w "@curl-format.txt" -c cjar -b cjar -k -X GET
'https://'"${BMC}"':'"${BMC_WEBPORT}"'/redfish/v1/Managers/bmc/
LogServices/Dump/Entries/1/attachment'
-H 'X-Auth-Token: '"$BMCWEB_SESSION_TOKEN_ROML"'' --output $OUT
% Total % Received % Xferd Average Speed Time Time Time
Dload Upload Total Spent Left
100 81588 100 81588 0 0 633.5k 0
curl -w "@curl-format.txt" -c cjar -b cjar -k -X GET
'https://'"${BMC}"':'"${BMC_WEBPORT}"'/redfish/v1/Systems/system/
LogServices/Dump/Entries/1/attachment'
-H 'X-Auth-Token: '"$BMCWEB_SESSION_TOKEN_ROML"'' --output $OUT
% Total % Received % Xferd Average Speed Time Time Time
Dload Upload Total Spent Left
100 596 100 596 0 0 3307 0
```
ClearLog action Managers/Dump/, Managers/FaultLog and Systems/Dump
```
curl -v -k POST 'https://'"${BMC}"':'"${BMC_WEBPORT}"'/redfish/v1/
Managers/bmc/LogServices/Dump/Actions/
LogService.ClearLog
-H 'X-Auth-Token: '"$BMCWEB_SESSION_TOKEN_ROML"''
-H "Content-Type: application/json" -d {}
{
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The request completed successfully.",
"MessageArgs": [],
"MessageId": "Base.1.19.Success",
"MessageSeverity": "OK",
"Resolution": "None."
}
]
* Connection #1 to host localhost:44443 left intact
}
busctl tree xyz.openbmc_project.Dump.Manager
`- /xyz
`- /xyz/openbmc_project
`- /xyz/openbmc_project/dump
|- /xyz/openbmc_project/dump/bmc
|- /xyz/openbmc_project/dump/faultlog
|- /xyz/openbmc_project/dump/resource
`- /xyz/openbmc_project/dump/system
```
Change-Id: Ic85c61854624b525cc0b83d6fce393b0007f5b9a
Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
|
|
Create a reusable utility function getPrettyName() in
utils/name_utils.hpp that can retrieve the PrettyName property from the
D-Bus xyz.openbmc_project.Inventory.Item interface.
The function accepts a JSON pointer parameter, allowing it to set the
PrettyName at any location in the response (e.g. within arrays or nested
objects). This makes it reusable across multiple components (Drives,
Processors, Memory, Chassis, etc.).
Relates-to: https://github.com/openbmc/bmcweb/issues/204
Tested:
- Built bmcweb with meson/ninja successfully
- Tested with https://gerrit.openbmc.org/c/openbmc/bmcweb/+/90364 and
verified that PrettyName appears in the response
- Falls back to default name when PrettyName is empty
Change-Id: Iebd31b523797152b0e8e7ea8852f86b292fb5f55
Signed-off-by: Akash Arunkumar <mirrorghost007@gmail.com>
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
|
|
Add coverage for dbusToRfBootType() and dbusToRfBootMode(), which
translate D-Bus boot configuration values into Redfish enum values.
Verify the supported boot type values Legacy and EFI map to
BootSourceOverrideMode::Legacy and BootSourceOverrideMode::UEFI. Verify
the supported boot mode values Regular, Safe, and Setup map to
BootSource::None, BootSource::Diags, and BootSource::BiosSetup.
Also verify that unknown D-Bus values return the corresponding Invalid
enum value instead of being silently interpreted as a valid setting.
Tested:
- meson test -C builddir system_test -v
- All 6 system_test tests passed, including both new tests
Change-Id: I926187c3e87abc4baf2af22a6ca6f689c03dcd77
Signed-off-by: Vinothkumar Shanmugavel <vinothkumars@ami.com>
|
|
Similar to how other log services got broken out into own header files,
do the same for dump / faultlog.
A new dump utility header has been created, request handler and route
register function went into manager / systems log service header files
respectively.
Code logic stays untouched in this patch.
Tested: Code compiles. Unit test runs through.
Validator was run on romulus in qemu with phosphor-debug-collector ibm
extension enabled to get access to /xyz/openbmc_project/dump/system.
Via the 'CreateDump' method empty dump entries were manually created
for:
/xyz/openbmc_project/dump/system
/xyz/openbmc_project/dump/bmc
/xyz/openbmc_project/dump/faultlog
```
busctl call xyz.openbmc_project.Dump.Manager \
/xyz/openbmc_project/dump/bmc \
xyz.openbmc_project.Dump.Create \
CreateDump a{sv} 0
> o "/xyz/openbmc_project/dump/bmc/entry/1"
busctl tree xyz.openbmc_project.Dump.Manager
`- /xyz
`- /xyz/openbmc_project
`- /xyz/openbmc_project/dump
|- /xyz/openbmc_project/dump/bmc
| `- /xyz/openbmc_project/dump/bmc/entry
| |- /xyz/openbmc_project/dump/bmc/entry/1
| |- /xyz/openbmc_project/dump/bmc/entry/2
| |- /xyz/openbmc_project/dump/bmc/entry/3
| |- /xyz/openbmc_project/dump/bmc/entry/4
| |- /xyz/openbmc_project/dump/bmc/entry/5
| `- /xyz/openbmc_project/dump/bmc/entry/6
|- /xyz/openbmc_project/dump/faultlog
| `- /xyz/openbmc_project/dump/faultlog/entry
| `- /xyz/openbmc_project/dump/faultlog/entry/1
|- /xyz/openbmc_project/dump/resource
`- /xyz/openbmc_project/dump/system
`- /xyz/openbmc_project/dump/system/entry
`- /xyz/openbmc_project/dump/system/entry/1
```
Overwrite OperationStatus of /xyz/openbmc_project/dump/system/entry/1
for the entry to be added to the collection:
```
busctl set-property xyz.openbmc_project.Dump.Manager \
/xyz/openbmc_project/dump/system/entry/1 \
xyz.openbmc_project.Common.Progress Status \
s xyz.openbmc_project.Common.Progress.OperationStatus.Completed \
```
Systems/Dump
Validating /redfish/v1/Systems/system/LogServices/Dump...
- Pass: 14, Warn: 0, Fail: 0, Skip: 9
Validating /redfish/v1/Systems/system/LogServices/Dump/Entries...
- Pass: 17, Warn: 0, Fail: 0, Skip: 30
Validating /redfish/v1/Systems/system/LogServices/Dump/Entries/1...
- Pass: 10, Warn: 0, Fail: 0, Skip: 26
+--------------+--------------+--------------+--------------+
| PASS | WARN | FAIL | NOT TESTED |
+--------------+--------------+--------------+--------------+
| 41 | 0 | 0 | 65 |
+--------------+--------------+--------------+--------------+
Managers/Dump
Validating /redfish/v1/Managers/bmc/LogServices/Dump...
- Pass: 14, Warn: 0, Fail: 0, Skip: 9
Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries...
- Pass: 70, Warn: 0, Fail: 0, Skip: 162
Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/1...
- Pass: 11, Warn: 0, Fail: 0, Skip: 25
Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/2...
- Pass: 11, Warn: 0, Fail: 0, Skip: 25
Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/3...
- Pass: 9, Warn: 0, Fail: 0, Skip: 27
Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/4...
- Pass: 9, Warn: 0, Fail: 0, Skip: 27
Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/5...
- Pass: 9, Warn: 0, Fail: 0, Skip: 27
Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/6...
- Pass: 9, Warn: 0, Fail: 0, Skip: 27
+--------------+--------------+--------------+--------------+
| PASS | WARN | FAIL | NOT TESTED |
+--------------+--------------+--------------+--------------+
| 142 | 0 | 0 | 329 |
+--------------+--------------+--------------+--------------+
Managers/FaultLog
Validating /redfish/v1/Managers/bmc/LogServices/FaultLog...
- Pass: 12, Warn: 0, Fail: 0, Skip: 9
Validating /redfish/v1/Managers/bmc/LogServices/FaultLog/Entries...
- Pass: 13, Warn: 0, Fail: 0, Skip: 34
Validating /redfish/v1/Managers/bmc/LogServices/FaultLog/Entries/1...
- Pass: 6, Warn: 0, Fail: 0, Skip: 30
+--------------+--------------+--------------+--------------+
| PASS | WARN | FAIL | NOT TESTED |
+--------------+--------------+--------------+--------------+
| 31 | 0 | 0 | 73 |
+--------------+--------------+--------------+--------------+
Change-Id: I6379f877149c545b3b3bfcda8510c6ee1085dcf9
Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
|
|
Cover dbusToRfPowerState() and the callbacks introduced by the Fabric
Switch PowerState change: afterGetSwitchPowerState and
afterGetSwitchPowerStateService. The tests assert each branch's
externally visible behavior: known PowerState decorator values map to
the matching resource::PowerState and unmapped values yield nullopt; a
property read error or an unmapped value leaves PowerState omitted
without failing the request; EBADR, io_error and an empty mapper
object leave PowerState omitted; any other mapper error sets an
internal server error.
Change-Id: Id488f88b8d7784a4f195fcf7c832fbecfdb0b513
Signed-off-by: JY Voon <jvoon@nvidia.com>
|
|
Add optional support for UUID property for PCIeDevice.
Tested: Build an image for nvl32-obmc machine with the following patch
cherry picked.
```
1. Align with upstream u-boot dts tree:
https://gerrit.openbmc.org/c/openbmc/openbmc/+/89932
2. mctpd configuration:
https://gerrit.openbmc.org/c/openbmc/openbmc/+/87390
3. Enable nvidia-gpu sensor:
https://gerrit.openbmc.org/c/openbmc/openbmc/+/89933
```
PCIeDevice with Common.UUID published (GPU path):
$ busctl get-property xyz.openbmc_project.GpuSensor \
/xyz/openbmc_project/inventory/Nvidia_GPU_10 \
xyz.openbmc_project.Common.UUID UUID
s "68174e99-daf4-02d1-ba39-4ed2bf8a0f21"
$ curl -sk https://{BMC_IP}/redfish/v1/Systems/system/\
PCIeDevices/Nvidia_GPU_10
{
"@odata.id": "/redfish/v1/Systems/system/PCIeDevices/Nvidia_GPU_10",
"@odata.type": "#PCIeDevice.v1_19_0.PCIeDevice",
"Id": "Nvidia_GPU_10",
"Manufacturer": "NVIDIA",
"Model": "RTXPRO6000BlackwellDC",
"Name": "PCIe Device",
"PartNumber": "900-2G153-0000-000",
"SerialNumber": "1792425045093",
"Status": {
"Health": "OK",
"State": "Enabled"
},
"UUID": "68174e99-daf4-02d1-ba39-4ed2bf8a0f21"
}
PCIeDevice without Common.UUID published (ConnectX path):
$ busctl get-property xyz.openbmc_project.GpuSensor \
/xyz/openbmc_project/inventory/Nvidia_ConnectX_24_PCIe \
xyz.openbmc_project.Common.UUID UUID
Failed to get property UUID on interface
xyz.openbmc_project.Common.UUID: Unknown interface
xyz.openbmc_project.Common.UUID or property UUID.
$ curl -sk https://{BMC_IP}/redfish/v1/Systems/system/\
PCIeDevices/Nvidia_ConnectX_24_PCIe | jq 'has("UUID")'
false
Change-Id: I38cf972f03f0dd0299b708ea8203872c73c8e224
Signed-off-by: JY Voon <jvoon@nvidia.com>
|
|
Add unit tests for the security header helper.
Cover headers that are always added, preserve existing Cache-Control
values, and verify the HTML-only header path.
Also validate representative Content-Security-Policy and
Permissions-Policy values so future header regressions are caught by
unit test coverage.
Tested:
Passed local CI docker run for bmcweb unit tests
Change-Id: I069d203f6bc35155d17d8488ab5511aa38218f3a
Signed-off-by: Joel P J <joelpj@ami.com>
|
|
- State `Available` will be mapped to `UnavailableOffline` for
Status.State for resources that are present but unavailable
- Added a utility function to reduce code duplication for retrieving
resource's Status.State (`getResourceState`) and Status.Health
(`getResourceHealth`)
Tested:
- Compiles and builds
- Unit tests pass
Change-Id: I1164a9412cbd4e1ab8938366ffc7ea9c7fe58786
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
|
|
Recently, oss-fuzz added support for bmcweb, but did it by checking in
a number of code patches. This commit should get similar coverage by
hooking into the HTTP connection class, and using the unit test
code to inject bytes directly into a stream. This can be improved over
time, but this is a good start.
Change-Id: I20b5d536cff1588a8387f2770c022516e1cd62d0
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
IWYU is not a tool we have seen results from in some time. I very much
suspect that these few comments are not enough to get a clean build.
Clean them up. If we want to turn this tool back on in the future,
this patch can be reverted.
Tested: Comment only change. Review only.
Change-Id: I45ff737800f9d8b1b63db2f482e59f815d7126a2
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
The xyz.openbmc_project.Software.Version interface marks the Purpose
property as deprecated in favor of Compatible strings and inventory
associations, so a conforming object may publish only Version. The
FirmwareInventory handler treated a missing Purpose as an internal
error and returned HTTP 500 for every such object. Added this patch\
to skip the optional Description and RelatedItem links rather
than failing the resource. Objects that publish Purpose keep their
existing output.
Tested: Build an image for nvl32-obmc machine with the following
patches cherry-picked:
1. Align with upstream u-boot dts tree:
https://gerrit.openbmc.org/c/openbmc/openbmc/+/89932
2. mctpd configuration:
https://gerrit.openbmc.org/c/openbmc/openbmc/+/87390
3. Enable nvidia-gpu sensor:
https://gerrit.openbmc.org/c/openbmc/openbmc/+/89933
4. dbus-sensors expose GPU inventory interfaces:
https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/88990
$ curl -sk https://{BMC_IP}/redfish/v1/UpdateService/\
FirmwareInventory/Nvidia_GPU_10_Firmware
{
"@odata.id":
"/redfish/v1/UpdateService/FirmwareInventory/\
Nvidia_GPU_10_Firmware",
"@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
"Id": "Nvidia_GPU_10_Firmware",
"Name": "Software Inventory",
"Status": {
"HealthRollup": "OK",
"State": "Enabled"
},
"Updateable": false,
"Version": "98.02.AF.00.01"
}
Depends-On: Id0c09f4ced40dbe505ca7cbd99f6de0e847afe3b
Change-Id: I2a9562e461ffd39fcbdc176413a1bf2cb6fdbc22
Signed-off-by: JY Voon <jvoon@nvidia.com>
|
|
Cover the callbacks introduced by the GPU Processor FirmwareVersion
change. The tests assert each branch's externally visible behavior:
unexpected D-Bus errors, an ambiguous subtree, and a missing owning
service set an internal server error, while EBADR, an empty subtree,
and an empty version leave FirmwareVersion omitted.
Change-Id: Ic00549fe7513651a139ebb8a4e7b36c95b3f453c
Signed-off-by: JY Voon <jvoon@nvidia.com>
|
|
Add Response::headerCount() to return the total number of
stored header fields on a response. The implementation counts
the current header entries directly from the underlying Beast
header container.
Added unit coverage to verify the method reports the full
header count after headers are added through the normal
addHeader() path.
Tested with:
meson test -C build http_response_test --print-errorlogs
This helper is used by response unit tests to verify that only
the expected headers are present and that no unexpected headers
are added to the response. See also:
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/91848
Change-Id: I28432bb4fc982db44cee0688395d04ac513d6749
Signed-off-by: Joel Pullokaran Jesin <joelpj@ami.com>
|
|
Use http_helpers::getContentType() when deciding whether to add
HTML-only security headers.
Previously this logic checked the raw Content-Type header with a
text/html prefix match. That worked for the values we emit today,
but it open-coded Content-Type handling in this path instead of using
the existing parser.
Switch this logic to getContentType() so it stays consistent with
the rest of the code and correctly handles valid variations such as
case-insensitive HTML MIME types.
Add unit coverage for getContentType() to verify HTML MIME types
with charset parameters and case-insensitive input.
Tested: unit tests passed.
Change-Id: I1cff40453ab4851cc7b24615a20fb6abcfba864b
Signed-off-by: Joel Pullokaran Jesin <joelpj@ami.com>
|
|
parseStringAsJson() routes through BmcwebSaxParse, which hard-caps a
payload at 500 total JSON values to defend against malicious external
HTTP request bodies.
The most visible symptom is that bmcweb silently loses every persisted
session across a restart once ~50 sessions accumulate (each persisted
session is ~11 JSON values, so the file trips the cap and is treated
as malformed). Tntegration testing hit this 50 session limit and
failed. (Was failing our internal but also the
openbmc-test-automation robot suite)
I had originally implemented a solution as a "trusted reader"
with no limit
( https://gerrit.openbmc.org/c/openbmc/bmcweb/+/90138 ); however,
the security implications of "no limit" weren't attractive.
This area may be refactored in the near future to represent each
session as a distinct json file. This value bump gets us past
the immediate needs without introducing a lot of churn in code
that will be refactored.
Change-Id: Ifd3514bd8ee15c8bdf1b6c2119451a2965801671
Signed-off-by: Rick Yazwinski <rickyaz@meta.com>
|