openbmc / bmcweb

A do everything Redfish, KVM, GUI, and DBus webserver for OpenBMC
Apache License 2.0
156 stars 131 forks source link

how to update static files in bmcweb(redfish/v1) #160

Closed akky1605 closed 3 years ago

akky1605 commented 3 years ago

HI,

I am new to openbmc and need to understand the integration of the bmcweb static files(redfish/v1) with dbus. My requirement is to update the static files in bmcweb with my custom sensor.

For example, I have created a custom power sensor, which is reading through the hwmon entry. I can read the power metrics value using the "curl" command through the "/xyz/openbmc/" path but no value is updated in the path "/redfish/v1".

So I have basically two queries,

1) What exactly is difference between the two paths, "/xyz/openbmc" & "/redfish/v1"? 2) How can we update the custom sensor values to "/redfish/v1" path? Where exactly the integration is required?

It will be really helpful if you can provide any doc for reference.

Thank you.

gtmills commented 3 years ago

/redfish/v1/ is the Redfish service root. All redfish resources are linked from here (Redfish is a hypermedia API). Common Redfish collections are: /redfish/v1/Systems /redfish/v1/Managers /redfish/v1/Chassis.

Under these collections you will find the ComputerSystem resource (hardcoded in bmcweb at /redfish/v1/Systems/system, the manager resource hardcoded in bmcweb at /redfish/v1/Manager/bmc)

/xyz/openbmc_project/ is our D-Bus interfaces exposed as a lightweight REST API.

https://github.com/openbmc/bmcweb/blob/3fad0d59b94d951a752530d01db5451773f7d374/meson_options.txt#L7

More documentation on Redfish can be found at: https://www.dmtf.org/standards/redfish and https://redfish.dmtf.org/

More documentation on our D-Bus REST API can be found at https://github.com/openbmc/docs/blob/master/rest-api.md

You mentioned a sensor, depending on the sensor determines which of the 3 different Redfish resources (thermal, power, or sensors) the sensor is under (this is changing in the next Redfish release, all sensors will be under sensors). https://github.com/openbmc/bmcweb/blob/master/redfish-core/lib/sensors.hpp#L62

You must also create associations between the sensor and chassis, so bmcweb know which chassis this sensor belongs to:

https://github.com/openbmc/docs/blob/676554dbd8c7500c4aa417f7edca7a4d304d3c1a/architecture/sensor-architecture.md#association-type-1-linking-a-chassis-to-all-sensors-within-the-chassis

https://github.com/openbmc/openbmc/blob/ab714a26c3f883c68f08043cd7d8a0af4c84e2ba/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager/associations.json#L1452

edtanous commented 3 years ago

It appears your question got answered. Please reopen if this is still an issue for you.