summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLakshmi Yadlapati <lakshmiy@us.ibm.com>2023-05-02 23:09:08 +0300
committerLakshmi Yadlapati <lakshmiy@us.ibm.com>2023-05-12 23:00:50 +0300
commitbbf372a66453a103146e154386b3a97c41fd45d6 (patch)
treeb45e5e5d5504fb175e9d312902f1f2016ce733c4
parentc6bb328526ac56e16e6409198032effc39584a2a (diff)
downloadbmcweb-bbf372a66453a103146e154386b3a97c41fd45d6.tar.xz
Fix invalid PCIeType in pcie_slots
When the Generation field of a PCIeSlot object in D-Bus is set to "xyz.openbmc_project.Inventory.Item.PCIeSlot.Generations.Unknown", pcie_slots was returning an invalid PCIeType of "false". This caused the Redfish validator to fail. To resolve this, the code has been updated to not return the PCIeType if the Generation field is empty or unknown. Tested: Validator passed ''' busctl get-property -j xyz.openbmc_project.Inventory.Manager \ /xyz/openbmc_project/inventory/system/chassis/motherboard/disk_backplane0/nvme0 \ xyz.openbmc_project.Inventory.Item.PCIeSlot Generation { "type" : "s", "data" : "xyz.openbmc_project.Inventory.Item.PCIeSlot.Generations.Unknown" } curl -k https://$bmc/redfish/v1/Chassis/chassis/PCIeSlots { "@odata.id": "/redfish/v1/Chassis/chassis/PCIeSlots", "@odata.type": "#PCIeSlots.v1_4_1.PCIeSlots", "Id": "1", "Name": "PCIe Slot Information", "Slots": [ { "HotPluggable": false, "Lanes": 0, "SlotType": "U2" }, ..... } busctl set-property xyz.openbmc_project.Inventory.Manager \ /xyz/openbmc_project/inventory/system/chassis/motherboard/disk_backplane0/nvme0 \ xyz.openbmc_project.Inventory.Item.PCIeSlot Generation s \ xyz.openbmc_project.Inventory.Item.PCIeSlot.Generations.Gen1 curl -k https://$bmc/redfish/v1/Chassis/chassis/PCIeSlots { "@odata.id": "/redfish/v1/Chassis/chassis/PCIeSlots", "@odata.type": "#PCIeSlots.v1_4_1.PCIeSlots", "Id": "1", "Name": "PCIe Slot Information", "Slots": [ { "HotPluggable": false, "Lanes": 0, "PCIeType": "Gen1", "SlotType": "U2" }, .... } ''' Change-Id: I143ce7e90cf24447a667a09d946e42f00c091a64 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
-rw-r--r--redfish-core/lib/pcie_slots.hpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/redfish-core/lib/pcie_slots.hpp b/redfish-core/lib/pcie_slots.hpp
index b588ac0021..18301bfa3a 100644
--- a/redfish-core/lib/pcie_slots.hpp
+++ b/redfish-core/lib/pcie_slots.hpp
@@ -119,7 +119,10 @@ inline void
messages::internalError(asyncResp->res);
return;
}
- slot["PCIeType"] = !pcieType;
+ if (*pcieType != pcie_device::PCIeTypes::Invalid)
+ {
+ slot["PCIeType"] = *pcieType;
+ }
}
if (lanes != nullptr)