IndicatorLED: Add compile option for deprecated property
The IndicatorLED property has been deprecated by Redfish since September
2020. The Redfish Service Validator reports a WARNING for this property:
```
WARNING - IndicatorLED: The given property is deprecated: This property has been deprecated in favor of the `LocationIndicatorActive` property.
```
The LocationIndicatorActive property is now implemented in bmcweb in
all places where IndicatorLED was implemented. So a new meson option
(redfish-allow-deprecated-indicatorled) is being added to control
whether this property is part of get or patch requests. The option is
disabled by default with plans to remove the option by March 2026.
Tested:
- Built with option enabled and confirmed IndicatorLED still part of
Redfish responses and can be patched.
- Built with option disabled and confirmed Redfish Service Validator no
longer reports the warning.
- Built with option disabled and confirmed IndicatorLED no longer part
of Redfish responses and patch fails appropriately.
```
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d '{"IndicatorLED":"Blinking"}' https://${bmc}/redfish/v1/Systems/system
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The property IndicatorLED is not in the list of valid properties for the resource.",
"MessageArgs": [
"IndicatorLED"
],
"MessageId": "Base.1.19.PropertyUnknown",
"MessageSeverity": "Warning",
"Resolution": "Remove the unknown property from the request body and resubmit the request if the operation failed."
}
],
"code": "Base.1.19.PropertyUnknown",
"message": "The property IndicatorLED is not in the list of valid properties for the resource."
}
}
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d '{"IndicatorLED":"Off"}' https://${bmc}/redfish/v1/Chassis/chassis
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The property IndicatorLED is not in the list of valid properties for the resource.",
"MessageArgs": [
"IndicatorLED"
],
"MessageId": "Base.1.19.PropertyUnknown",
"MessageSeverity": "Warning",
"Resolution": "Remove the unknown property from the request body and resubmit the request if the operation failed."
}
],
"code": "Base.1.19.PropertyUnknown",
"message": "The property IndicatorLED is not in the list of valid properties for the resource."
}
}
```
Change-Id: I2c0d415a7a54aa3122b18d2a1aa69bd9259d567e
Signed-off-by: Janet Adkins <janeta@us.ibm.com>
diff --git a/config/meson.build b/config/meson.build
index c363ad7..d4c4499 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -23,6 +23,7 @@
'mutual-tls-auth',
'redfish',
'redfish-aggregation',
+ 'redfish-allow-deprecated-indicatorled',
'redfish-allow-deprecated-power-thermal',
'redfish-allow-simple-update',
'redfish-bmc-journal',
diff --git a/meson.options b/meson.options
index 86a3713..aee691d 100644
--- a/meson.options
+++ b/meson.options
@@ -301,6 +301,16 @@
sensors in the SensorCollection.''',
)
+# BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED
+option(
+ 'redfish-allow-deprecated-indicatorled',
+ type: 'feature',
+ value: 'disabled',
+ description: '''Enable/disable the deprecated IndicatorLED property. The
+ default condition is disabled. The code to enable this
+ option will be removed by March 2026.''',
+)
+
# BMCWEB_REDFISH_ALLOW_DEPRECATED_POWER_THERMAL
option(
'redfish-allow-deprecated-power-thermal',
diff --git a/redfish-core/include/utils/sensor_utils.hpp b/redfish-core/include/utils/sensor_utils.hpp
index de1998d..41c14fc 100644
--- a/redfish-core/include/utils/sensor_utils.hpp
+++ b/redfish-core/include/utils/sensor_utils.hpp
@@ -515,7 +515,10 @@
unit = "/Reading"_json_pointer;
sensorJson["ReadingUnits"] = thermal::ReadingUnits::RPM;
sensorJson["@odata.type"] = "#Thermal.v1_3_0.Fan";
- setLedState(sensorJson, inventoryItem);
+ if constexpr (BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED)
+ {
+ setLedState(sensorJson, inventoryItem);
+ }
forceToInt = true;
}
else if (sensorType == "fan_pwm")
@@ -523,7 +526,10 @@
unit = "/Reading"_json_pointer;
sensorJson["ReadingUnits"] = thermal::ReadingUnits::Percent;
sensorJson["@odata.type"] = "#Thermal.v1_3_0.Fan";
- setLedState(sensorJson, inventoryItem);
+ if constexpr (BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED)
+ {
+ setLedState(sensorJson, inventoryItem);
+ }
forceToInt = true;
}
else if (sensorType == "voltage")
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index aab95bd..e2fadba 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -671,7 +671,10 @@
{
if (std::ranges::find(interfaces2, interface) != interfaces2.end())
{
- getIndicatorLedState(asyncResp);
+ if constexpr (BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED)
+ {
+ getIndicatorLedState(asyncResp);
+ }
getLocationIndicatorActive(asyncResp, objPath);
break;
}
@@ -764,16 +767,23 @@
return;
}
- // TODO (Gunnar): Remove IndicatorLED after enough time has passed
if (!locationIndicatorActive && !indicatorLed)
{
return; // delete this when we support more patch properties
}
if (indicatorLed)
{
- asyncResp->res.addHeader(
- boost::beast::http::field::warning,
- "299 - \"IndicatorLED is deprecated. Use LocationIndicatorActive instead.\"");
+ if constexpr (BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED)
+ {
+ asyncResp->res.addHeader(
+ boost::beast::http::field::warning,
+ "299 - \"IndicatorLED is deprecated. Use LocationIndicatorActive instead.\"");
+ }
+ else
+ {
+ messages::propertyUnknown(asyncResp->res, "IndicatorLED");
+ return;
+ }
}
const std::string& chassisId = param;
@@ -843,16 +853,19 @@
"LocationIndicatorActive");
}
}
- if (indicatorLed)
+ if constexpr (BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED)
{
- if (indicatorChassis)
+ if (indicatorLed)
{
- setIndicatorLedState(asyncResp, *indicatorLed);
- }
- else
- {
- messages::propertyUnknown(asyncResp->res,
- "IndicatorLED");
+ if (indicatorChassis)
+ {
+ setIndicatorLedState(asyncResp, *indicatorLed);
+ }
+ else
+ {
+ messages::propertyUnknown(asyncResp->res,
+ "IndicatorLED");
+ }
}
}
return;
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 7b22377..ed6c247 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -1832,7 +1832,10 @@
powerSupply["Model"] = inventoryItem.model;
powerSupply["PartNumber"] = inventoryItem.partNumber;
powerSupply["SerialNumber"] = inventoryItem.serialNumber;
- sensor_utils::setLedState(powerSupply, &inventoryItem);
+ if constexpr (BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED)
+ {
+ sensor_utils::setLedState(powerSupply, &inventoryItem);
+ }
if (inventoryItem.powerSupplyEfficiencyPercent >= 0)
{
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index e006b9a..31cf897 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -3124,8 +3124,11 @@
}
});
- // TODO (Gunnar): Remove IndicatorLED after enough time has passed
- getIndicatorLedState(asyncResp);
+ if constexpr (BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED)
+ {
+ getIndicatorLedState(asyncResp);
+ }
+
getComputerSystem(asyncResp);
getHostState(asyncResp);
getBootProperties(asyncResp);
@@ -3220,6 +3223,15 @@
return;
}
+ if constexpr (!BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED)
+ {
+ if (indicatorLed)
+ {
+ messages::propertyUnknown(asyncResp->res, "IndicatorLED");
+ return;
+ }
+ }
+
if (assetTag)
{
setAssetTag(asyncResp, *assetTag);
@@ -3273,14 +3285,15 @@
});
}
- // TODO (Gunnar): Remove IndicatorLED after enough time has
- // passed
- if (indicatorLed)
+ if constexpr (BMCWEB_REDFISH_ALLOW_DEPRECATED_INDICATORLED)
{
- setIndicatorLedState(asyncResp, *indicatorLed);
- asyncResp->res.addHeader(boost::beast::http::field::warning,
- "299 - \"IndicatorLED is deprecated. Use "
- "LocationIndicatorActive instead.\"");
+ if (indicatorLed)
+ {
+ setIndicatorLedState(asyncResp, *indicatorLed);
+ asyncResp->res.addHeader(boost::beast::http::field::warning,
+ "299 - \"IndicatorLED is deprecated. Use "
+ "LocationIndicatorActive instead.\"");
+ }
}
if (powerRestorePolicy)