The xyz.openbmc_project.ObjectMapper
service, commonly referred to as just the mapper, is an OpenBMC application that attempts to ease the pain of using D-Bus by providing APIs that help in discovering and associating other D-Bus objects.
The mapper has two major pieces of functionality:
The official YAML interface definition can be found here.
Use this method to find the services, with their interfaces, that implement a certain object path. The output is a map of service names to their implemented interfaces. An optional list of interfaces may also be passed in to constrain the output to services that implement those specific interfaces.
Inputs:
Output:
dbus-send --system --print-reply \ --dest=xyz.openbmc_project.ObjectMapper \ /xyz/openbmc_project/object_mapper \ xyz.openbmc_project.ObjectMapper.GetObject \ string:"/xyz/openbmc_project/sensors/voltage/ps1_input_voltage" array:string: array [ dict entry( string "xyz.openbmc_project.Hwmon-1025936882.Hwmon1" array [ string "xyz.openbmc_project.Sensor.Threshold.Critical" string "xyz.openbmc_project.Sensor.Threshold.Warning" string "xyz.openbmc_project.Sensor.Value" ] ) ]
Find the service name that has the desired object path so it can be passed into a get property call.
Use this method to find the objects, services, and interfaces in the specified subtree that implement a certain interface. If no interfaces are passed in, then all objects/services/interfaces in the subtree are returned. If interfaces are passed in, then only those interfaces are returned in the output.
Inputs:
Output:
dbus-send --system --print-reply \ --dest=xyz.openbmc_project.ObjectMapper \ /xyz/openbmc_project/object_mapper \ xyz.openbmc_project.ObjectMapper.GetSubTree \ string:"/" int32:0 array:string:"xyz.openbmc_project.Sensor.Threshold.Warning" array [ dict entry( string "/xyz/openbmc_project/sensors/current/ps0_output_current" array [ dict entry( string "xyz.openbmc_project.Hwmon-1040041051.Hwmon1" array [ string "xyz.openbmc_project.Sensor.Threshold.Critical" string "xyz.openbmc_project.Sensor.Threshold.Warning" string "xyz.openbmc_project.Sensor.Value" ] ) ] ) dict entry( string "/xyz/openbmc_project/sensors/current/ps1_output_current" array [ dict entry( string "xyz.openbmc_project.Hwmon-1025936882.Hwmon1" array [ string "xyz.openbmc_project.Sensor.Threshold.Critical" string "xyz.openbmc_project.Sensor.Threshold.Warning" string "xyz.openbmc_project.Sensor.Value" ] ) ] ) ...
Find all object paths and services that implement a specific interface.
Use this method to find the objects, services, and interfaces in the specified subtree that implement a certain interface and an endpoint of the input associationPath. If no interfaces are passed in, then all objects/services/interfaces in the subtree and associated endpoint are returned. If interfaces are passed in, then only those interfaces are returned in the output.
Inputs:
Output:
dbus-send --system --print-reply \ --dest=xyz.openbmc_project.ObjectMapper \ /xyz/openbmc_project/object_mapper \ xyz.openbmc_project.ObjectMapper.GetAssociatedSubTree \ objpath:"/${ASSOCIATED_PATH}" \ objpath:"/" int32:0 array:string:"xyz.openbmc_project.Sensor.Threshold.Warning" array [ dict entry( string "/xyz/openbmc_project/sensors/current/ps0_output_current" array [ dict entry( string "xyz.openbmc_project.Hwmon-1040041051.Hwmon1" array [ string "xyz.openbmc_project.Sensor.Threshold.Critical" string "xyz.openbmc_project.Sensor.Threshold.Warning" string "xyz.openbmc_project.Sensor.Value" ] ) ] ) dict entry( string "/xyz/openbmc_project/sensors/current/ps1_output_current" array [ dict entry( string "xyz.openbmc_project.Hwmon-1025936882.Hwmon1" array [ string "xyz.openbmc_project.Sensor.Threshold.Critical" string "xyz.openbmc_project.Sensor.Threshold.Warning" string "xyz.openbmc_project.Sensor.Value" ] ) ] ) ... # All output must be in the association endpoints busctl get-property xyz.openbmc_project.ObjectMapper \ /${ASSOCIATED_PATH} \ xyz.openbmc_project.Association endpoints as N "/xyz/openbmc_project/sensors/current/ps0_output_current" \ "/xyz/openbmc_project/sensors/current/ps1_output_current" \ ...
Find all object paths and services that implement a specific interface and endpoint of the input associationPath.
Use this method to find the objects, services, and interfaces in the specified subtree that implement certain interfaces and endpoints that end by input id
. If no interfaces are passed in, then all objects/services/interfaces in the subtree and associated endpoint are returned. If interfaces are passed in, then only those interfaces are returned in the output.
Inputs:
Output:
id
ID="chassis" ASSOCIATION="powered_by" dbus-send --system --print-reply \ --dest=xyz.openbmc_project.ObjectMapper \ /xyz/openbmc_project/object_mapper \ xyz.openbmc_project.ObjectMapper.GetAssociatedSubTreeById \ string:"${ID}" string:"/xyz/openbmc_project/inventory" \ array:string:"xyz.openbmc_project.Inventory.Item.Chassis" \ string:"${ASSOCIATION}" \ array:string:"xyz.openbmc_project.Inventory.Item.PowerSupply" array [ dict entry( string "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" array [ dict entry( string "xyz.openbmc_project.Inventory.Manager" array [ ... string "xyz.openbmc_project.Inventory.Item" string "xyz.openbmc_project.Inventory.Item.PowerSupply" ... ] ) ] ) dict entry( string "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1" array [ dict entry( string "xyz.openbmc_project.Inventory.Manager" array [ ... string "xyz.openbmc_project.Inventory.Item" string "xyz.openbmc_project.Inventory.Item.PowerSupply" ... ] ) ] ) .... ... # All output must be in the association endpoints that ends with the given `id` CHASSIS_PATH=/xyz/openbmc_project/inventory/system/chassis busctl get-property xyz.openbmc_project.ObjectMapper \ /xyz/openbmc_project/inventory/system/chassis/${ASSOCIATION} \ xyz.openbmc_project.Association endpoints as N "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" \ "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1" \ ...
Find all object paths and services that implement a specific interface and endpoint of the input associationPath.
This is the same as GetSubTree, but only returns object paths
Inputs:
Output:
dbus-send --system --print-reply \ --dest=xyz.openbmc_project.ObjectMapper \ /xyz/openbmc_project/object_mapper \ xyz.openbmc_project.ObjectMapper.GetSubTreePaths \ string:"/" int32:0 array:string:"xyz.openbmc_project.Sensor.Threshold.Warning" array [ string "/xyz/openbmc_project/sensors/current/ps0_output_current" string "/xyz/openbmc_project/sensors/current/ps1_output_current" string "/xyz/openbmc_project/sensors/power/ps0_input_power" ... ]
Find all object paths that implement a specific interface.
This is the same as GetAssociatedSubTreePaths, but only returns object paths
Inputs:
Output:
dbus-send --system --print-reply \ --dest=xyz.openbmc_project.ObjectMapper \ /xyz/openbmc_project/object_mapper \ xyz.openbmc_project.ObjectMapper.GetAssociatedSubTreePaths \ objpath:"/${ASSOCIATED_PATH}" objpath:"/" int32:0 array:string:"xyz.openbmc_project.Sensor.Threshold.Warning" array [ string "/xyz/openbmc_project/sensors/current/ps0_output_current" string "/xyz/openbmc_project/sensors/current/ps1_output_current" string "/xyz/openbmc_project/sensors/power/ps0_input_power" ... ] # All output must be in the association endpoints busctl get-property xyz.openbmc_project.ObjectMapper \ /${ASSOCIATED_PATH} \ xyz.openbmc_project.Association endpoints as N "/xyz/openbmc_project/sensors/current/ps0_output_current" \ "/xyz/openbmc_project/sensors/current/ps1_output_current" \ "/xyz/openbmc_project/sensors/power/ps0_input_power" \ ...
Find all object paths that implement a specific interface and endpoint of the input associationPath.
This is the same as GetAssociatedSubTreePathsById, but only returns object paths
Inputs:
Output:
id
ID="chassis" ASSOCIATION="powered_by" dbus-send --system --print-reply \ --dest=xyz.openbmc_project.ObjectMapper \ /xyz/openbmc_project/object_mapper \ xyz.openbmc_project.ObjectMapper.GetAssociatedSubTreePathsById \ string:"${ID}" string:"/xyz/openbmc_project/inventory" \ array:string:"xyz.openbmc_project.Inventory.Item.Chassis" \ string:"${ASSOCIATION}" \ array:string:"xyz.openbmc_project.Inventory.Item.PowerSupply" array [ string "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" string "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1" ... ] ... # All output must be in the association endpoints that ends with the given `id` CHASSIS_PATH=/xyz/openbmc_project/inventory/system/chassis busctl get-property xyz.openbmc_project.ObjectMapper \ /xyz/openbmc_project/inventory/system/chassis/${ASSOCIATION} \ xyz.openbmc_project.Association endpoints as N "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" \ "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1" \ ...
Find all object paths that implement a specific interface and endpoint of the input associationPath.
Use this method to find all ancestors of an object that implement a specific interface. If no interfaces are passed in, then all ancestor paths/services/interfaces are returned.
Inputs:
Output:
dbus-send --system --print-reply \ --dest=xyz.openbmc_project.ObjectMapper \ /xyz/openbmc_project/object_mapper \ xyz.openbmc_project.ObjectMapper.GetAncestors \ string:"/xyz/openbmc_project/inventory/system" array:string: array [ dict entry( string "/xyz/openbmc_project" array [ dict entry( string "xyz.openbmc_project.ObjectMapper" array [ string "org.freedesktop.DBus.ObjectManager" ] ) ] ) dict entry( string "/xyz/openbmc_project/inventory" array [ dict entry( string "xyz.openbmc_project.Inventory.Manager" array [ string "xyz.openbmc_project.Inventory.Manager" string "org.freedesktop.DBus.ObjectManager" ] ) ] ) dict entry( string "/" array [ dict entry( string "xyz.openbmc_project.Settings" array [ string "org.freedesktop.DBus.ObjectManager" ] ) ] ) ]
Find a parent object that implements a specific interface.
Associations are special D-Bus objects created by the mapper to associate two objects with each other. For this to occur, some application must implement the xyz.openbmc_project.Association.Definitions
interface, and then when an association is desired, the Associations
property on that interface needs to be written.
This Associations
property is an array of tuples of the form:
[forward, reverse, object path]
When an object with, for example, an object path of pathA
uses the following values:
["foo", "bar", "pathB"]
The mapper will create 2 new objects:
pathA/foo
pathB/bar
On each of these objects, the interface xyz.openbmc_project.Association
will be implemented, which has a single endpoints
property. This property is an array that holds the object paths to the other end of the association.
So, pathA/foo->endpoints
will contain pathB
, and pathB/bar->endpoints
will contain pathA
.
If another object, say pathC
, also has an association to pathB
, then a second entry, pathC
, will be added into pathB
's endpoints property.
These new objects will match the lifetime of the associated objects. For example, if pathA
is deleted, then pathA/foo
will also be deleted, and pathA
will be removed from the endpoints property of pathB/bar
. If that was the last entry in that property, then pathB/bar
will also be deleted. In addition, if the endpoint path is removed from D-Bus, in this case pathB
, then the mapper will remove the 2 association paths until pathB
shows back up again.
Note: The original name of the association definition interface was org.openbmc.Associations
. While the mapper still supports this interface as well for the time being, new code should use the xyz
version.
Associate an error log with the inventory item that caused it.
# Error log "/xyz/openbmc_project/logging/entry/3": { ... "associations": [ [ "callout", "fault", "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" ] ] } # Newly created forward association object "/xyz/openbmc_project/logging/entry/3/callout": { "endpoints": [ "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" ] } # Newly created reverse association object "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0/fault": { "endpoints": [ "/xyz/openbmc_project/logging/entry/3" ] }