SIGN IN SIGN UP

fix 'Chassis' property in oem schema

`redfish-core/schema/oem/openbmc/` oem schema defines 'Chassis' property
for fan zones but the implementation forms invalid chassis links.

Affected options: redfish-oem-manager-fan-data=enabled (default)

Using following configuration, plus a few fans and pid controller
(a typical single-host 2U server with 3 fans, Tyan S8030 board)

```
        {
            "FailSafePercent": 100,
            "MinThermalOutput": 10,
            "Name": "Zone0",
            "Type": "Pid.Zone"
        },
```

It is straightforward to get a response like below

```
...
"FanZones": {
  "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones",
  "@odata.type": "#OpenBMCManager.v1_0_0.Manager.FanZones",
  "Zone0": {
    "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0",
    "@odata.type": "#OpenBMCManager.v1_0_0.Manager.FanZone",
    "Chassis": {
      "@odata.id": "/redfish/v1/Chassis/Zone0"
    },
    "FailSafePercent": 100.0,
    "MinThermalOutput": 10.0
  }
},
...
```

when querying
```
curl --insecure --user root:root https://${bmc}/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan
```

For reference, the chassis collection
```
{
  "@odata.id": "/redfish/v1/Chassis",
  "@odata.type": "#ChassisCollection.ChassisCollection",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Chassis/MBX_1_57_Chassis"
    },
    {
      "@odata.id": "/redfish/v1/Chassis/Tyan_S8030_Baseboard"
    }
  ],
  "Members@odata.count": 2,
  "Name": "Chassis Collection"
}
```

Since that configuration is representative of various boards and the bug
has been seen by others before [1] (in terms of a fan zone and chassis
sharing the same name, suggesting ill-formed link), fix the
implementation to use the result of GetManagedObjects call and find
valid chassis path there.

This is to allow redfish validator to pass with default meson options
and a common system configuration. Since it's a config dependent failure
it would be great for others to test and share their result.

Inspection of the code causing validation failure:

```
auto pids = std::make_shared<GetPIDValues>(asyncResp);
pids->run();
then run(); returns and `~GetPIDValues()` is called
which calls processingComplete
which calls asyncPopulatePid
```

Inside `asyncPopulatePid` it does `dbus::utility::getManagedObjects`
and iterates over the results

```
   112             for (const auto& pathPair : managedObj)
   113             {
   114                 for (const auto& intfPair : pathPair.second)
```

then checks for an interface

```
   180                     if (intfPair.first == pidZoneConfigurationIface)
   181                     {
   182                         sdbusplus::message::object_path pidPath(
   183                             pathPair.first.str);
   184                         std::string chassis = pidPath.filename();
   185                         if (chassis.empty())
   186                         {
   187                             chassis = "#IllegalValue";
   188                         }
```

and simply uses the object path from PID Zone config interface to
extract the leaf and insert that as the chassis link.

It can only work in case the Board/Chassis interface is on the same
object path which is unlikely.

Tested: on Tyan S8030.

Result after the change, the optional property now contains the correct
chassis link.
```
...
"FanZones": {
  "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones",
  "@odata.type": "#OpenBMCManager.v1_0_0.Manager.FanZones",
  "Zone0": {
    "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0",
    "@odata.type": "#OpenBMCManager.v1_0_0.Manager.FanZone",
    "Chassis": {
      "@odata.id": "/redfish/v1/Chassis/MBX_1_57_Chassis"
    },
    "FailSafePercent": 100.0,
    "MinThermalOutput": 10.0
  }
},
...
```

```
/tmp/rsv-venv/bin/rf_service_validator \
 --auth Session -i https://${bmc}:443 \
 -u ${username} -p ${password} --payload 'Tree' /redfish/v1/Managers/bmc

...

Elapsed time: 0:00:32

Listing any warnings and errors:

Results Summary:
Pass: 766, Fail: 0, Warning: 0
Validation has succeeded.
```

RF validator Tree validation errors are reduced compared to previous.

References:

[1] https://discordapp.com/channels/775381525260664832/1449737223493910559/1450273124804333598

Change-Id: I2a2db456f42c5dafa451f69362b1d9c8a094e86e
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
Signed-off-by: Ed Tanous <etanous@nvidia.com>
A
Alexander Hansen committed
1bda4f7387d8373c6ece92311f3c28e13c724d8e
Parent: 8b09939