diff options
author | Konstantin Aladyshev <aladyshev22@gmail.com> | 2023-07-10 15:00:38 +0300 |
---|---|---|
committer | Konstantin Aladyshev <aladyshev22@gmail.com> | 2023-07-11 18:17:55 +0300 |
commit | 82f80326afb1e1cfd6b682d4fa2f75319c83004f (patch) | |
tree | 99f7ef7e5d68205822abdc5bbfc1718062a46b45 /redfish-core/lib | |
parent | 9bb0a7fe3c5dd3c3c9056dec7a37896af347912b (diff) | |
download | bmcweb-82f80326afb1e1cfd6b682d4fa2f75319c83004f.tar.xz |
Omit Slot "Lanes" property if it is equal to 0
In the context of a PCIeSlot the 0 value for the 'Lanes' property
means undefined. According to the bmcweb guidelines, DBus properties
with "unknown"/"unspecified" values should be omitted from the Redfish
tree. Therefore don't populate 'Lanes' property if it is equal to 0.
Tested: validator passed
Change-Id: Ic3d142dd8b10da2367d73c370d5480208ba1510a
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Diffstat (limited to 'redfish-core/lib')
-rw-r--r-- | redfish-core/lib/pcie.hpp | 5 | ||||
-rw-r--r-- | redfish-core/lib/pcie_slots.hpp | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp index 40fcd412cb..f5c5303554 100644 --- a/redfish-core/lib/pcie.hpp +++ b/redfish-core/lib/pcie.hpp @@ -190,7 +190,10 @@ inline void addPCIeSlotProperties( res.jsonValue["Slot"]["PCIeType"] = *pcieType; } - res.jsonValue["Slot"]["Lanes"] = lanes; + if (lanes != 0) + { + res.jsonValue["Slot"]["Lanes"] = lanes; + } std::optional<pcie_slots::SlotTypes> redfishSlotType = pcie_util::dbusSlotTypeToRf(slotType); diff --git a/redfish-core/lib/pcie_slots.hpp b/redfish-core/lib/pcie_slots.hpp index 62fef3ea95..4412c41ed4 100644 --- a/redfish-core/lib/pcie_slots.hpp +++ b/redfish-core/lib/pcie_slots.hpp @@ -83,7 +83,7 @@ inline void } } - if (lanes != nullptr) + if (lanes != nullptr && *lanes != 0) { slot["Lanes"] = *lanes; } |