Skip to content
Commit cddbf3df authored by Potin Lai's avatar Potin Lai Committed by Ed Tanous
Browse files

managers: fix bug of searching dbus object path



Notice a bug of patching existed object if the object name contains
space or underscore.

Normally dbus replace space with underscore for object path.
Replacing all spaces in input name with underscore to find the correct
dbus object path.

Tested results:

- Add new object
Input JSON
```
{
    "Oem": {
        "OpenBmc": {
            "Fan": {
                "StepwiseControllers": {
                    "Test_1": {
                        "Direction": "Floor",
                        "Inputs": [
                            "MB_U402_THERM_LOCAL"
                        ],
                        "NegativeHysteresis": 0.0,
                        "PositiveHysteresis": 0.0,
                        "Steps": [
                            {
                                "Output": 0.0,
                                "Target": 48.0
                            },
                            {
                                "Output": 40.0,
                                "Target": 52.0
                            }
                        ],
                        "Zones": [
                            {
                                "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0"
                            }
                        ]
                    }
                }
            }
        }
    }
}
```

Check result from /redfish/v1/Managers/bmc
```
"Test_1": {
    "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/StepwiseControllers/Test_1",
    "@odata.type": "#OemManager.StepwiseController",
    "Direction": "Floor",
    "Inputs": [
        "MB U402 THERM LOCAL"
    ],
    "NegativeHysteresis": 0.0,
    "PositiveHysteresis": 0.0,
    "Steps": [
        {
            "Output": 0.0,
            "Target": 48.0
        },
        {
            "Output": 40.0,
            "Target": 52.0
        }
    ],
    "Zones": [
        {
            "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0"
        }
    ]
}
```

- Patching existed object successful
Input JSON
```
{
    "Oem": {
        "OpenBmc": {
            "Fan": {
                "StepwiseControllers": {
                    "Test_1": {
                        "NegativeHysteresis": 0.0,
                        "PositiveHysteresis": 5.0,
                    }
                }
            }
        }
    }
}
```

Check result from /redfish/v1/Managers/bmc
```
"Test_1": {
    "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/StepwiseControllers/Test_1",
    "@odata.type": "#OemManager.StepwiseController",
    "Direction": "Floor",
    "Inputs": [
        "MB U402 THERM LOCAL"
    ],
    "NegativeHysteresis": 0.0,
    "PositiveHysteresis": 5.0,
    "Steps": [
        {
            "Output": 0.0,
            "Target": 48.0
        },
        {
            "Output": 40.0,
            "Target": 52.0
        }
    ],
    "Zones": [
        {
            "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0"
        }
    ]
}
```

Signed-off-by: default avatarPotin Lai <potin.lai@quantatw.com>
Change-Id: I12c78e52801bd0814ba2d928cf020e0a04214c39
parent 662aa6e3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment