1c80ed05cSGunnar Mills# The ObjectMapper 2c80ed05cSGunnar Mills 3f4febd00SPatrick WilliamsThe `xyz.openbmc_project.ObjectMapper` service, commonly referred to as just the 4f4febd00SPatrick Williamsmapper, is an OpenBMC application that attempts to ease the pain of using D-Bus 5f4febd00SPatrick Williamsby providing APIs that help in discovering and associating other D-Bus objects. 6c80ed05cSGunnar Mills 7c80ed05cSGunnar MillsThe mapper has two major pieces of functionality: 8c80ed05cSGunnar Mills 9c80ed05cSGunnar Mills- [Methods](#methods) - Provides D-Bus discovery related functionality. 10f4febd00SPatrick Williams- [Associations](#associations) - Associates two different objects with each 11f4febd00SPatrick Williams other. 12c80ed05cSGunnar Mills 13c80ed05cSGunnar Mills## Methods 14c80ed05cSGunnar Mills 15c80ed05cSGunnar MillsThe official YAML interface definition can be found [here][1]. 16c80ed05cSGunnar Mills 17c80ed05cSGunnar Mills### GetObject 18c80ed05cSGunnar Mills 19f4febd00SPatrick WilliamsUse this method to find the services, with their interfaces, that implement a 20f4febd00SPatrick Williamscertain object path. The output is a map of service names to their implemented 21f4febd00SPatrick Williamsinterfaces. An optional list of interfaces may also be passed in to constrain 22f4febd00SPatrick Williamsthe output to services that implement those specific interfaces. 23c80ed05cSGunnar Mills 24c80ed05cSGunnar MillsInputs: 25f4febd00SPatrick Williams 26c80ed05cSGunnar Mills- path: object path 27c80ed05cSGunnar Mills- param: interfaces - an optional list of interfaces to constrain the search to 28c80ed05cSGunnar Mills 29c80ed05cSGunnar MillsOutput: 30f4febd00SPatrick Williams 31c80ed05cSGunnar Mills- Map of service names to their interfaces 32c80ed05cSGunnar Mills 33c80ed05cSGunnar Mills``` 34c80ed05cSGunnar Millsdbus-send --system --print-reply \ 35c80ed05cSGunnar Mills--dest=xyz.openbmc_project.ObjectMapper \ 36c80ed05cSGunnar Mills/xyz/openbmc_project/object_mapper \ 37c80ed05cSGunnar Millsxyz.openbmc_project.ObjectMapper.GetObject \ 38c80ed05cSGunnar Millsstring:"/xyz/openbmc_project/sensors/voltage/ps1_input_voltage" array:string: 39c80ed05cSGunnar Mills 40c80ed05cSGunnar Mills array [ 41c80ed05cSGunnar Mills dict entry( 42c80ed05cSGunnar Mills string "xyz.openbmc_project.Hwmon-1025936882.Hwmon1" 43c80ed05cSGunnar Mills array [ 44c80ed05cSGunnar Mills string "xyz.openbmc_project.Sensor.Threshold.Critical" 45c80ed05cSGunnar Mills string "xyz.openbmc_project.Sensor.Threshold.Warning" 46c80ed05cSGunnar Mills string "xyz.openbmc_project.Sensor.Value" 47c80ed05cSGunnar Mills ] 48c80ed05cSGunnar Mills ) 49c80ed05cSGunnar Mills ] 50c80ed05cSGunnar Mills``` 51c80ed05cSGunnar Mills 52c80ed05cSGunnar Mills#### Example Use Case 53f4febd00SPatrick Williams 54c80ed05cSGunnar MillsFind the service name that has the desired object path so it can be passed into 55c80ed05cSGunnar Millsa get property call. 56c80ed05cSGunnar Mills 57c80ed05cSGunnar Mills### GetSubTree 58c80ed05cSGunnar Mills 59c80ed05cSGunnar MillsUse this method to find the objects, services, and interfaces in the specified 60*3b90d1eeSJanet Adkinssubtree that implement a certain interface. An optional list of interfaces may 61*3b90d1eeSJanet Adkinsalso be passed in to constrain the output to services that implement those 62*3b90d1eeSJanet Adkinsspecific interfaces. If no interfaces are passed in, then all 63*3b90d1eeSJanet Adkinsobjects/services/interfaces in the subtree are returned. 64c80ed05cSGunnar Mills 65c80ed05cSGunnar MillsInputs: 66f4febd00SPatrick Williams 67c80ed05cSGunnar Mills- param: subtree - the root of the tree. Using "/" will search the whole tree 68f4febd00SPatrick Williams- param: depth - the maximum depth of the tree past the root to search. Use 0 to 69f4febd00SPatrick Williams search all 70c80ed05cSGunnar Mills- param: interfaces - an optional list of interfaces to constrain the search to 71c80ed05cSGunnar Mills 72c80ed05cSGunnar MillsOutput: 73f4febd00SPatrick Williams 74c80ed05cSGunnar Mills- Map of object paths to a map of service names to their interfaces 75c80ed05cSGunnar Mills 76c80ed05cSGunnar Mills``` 77c80ed05cSGunnar Millsdbus-send --system --print-reply \ 78c80ed05cSGunnar Mills--dest=xyz.openbmc_project.ObjectMapper \ 79c80ed05cSGunnar Mills/xyz/openbmc_project/object_mapper \ 80c80ed05cSGunnar Millsxyz.openbmc_project.ObjectMapper.GetSubTree \ 81c80ed05cSGunnar Millsstring:"/" int32:0 array:string:"xyz.openbmc_project.Sensor.Threshold.Warning" 82c80ed05cSGunnar Mills 83c80ed05cSGunnar Mills array [ 84c80ed05cSGunnar Mills dict entry( 85c80ed05cSGunnar Mills string "/xyz/openbmc_project/sensors/current/ps0_output_current" 86c80ed05cSGunnar Mills array [ 87c80ed05cSGunnar Mills dict entry( 88c80ed05cSGunnar Mills string "xyz.openbmc_project.Hwmon-1040041051.Hwmon1" 89c80ed05cSGunnar Mills array [ 90c80ed05cSGunnar Mills string "xyz.openbmc_project.Sensor.Threshold.Critical" 91c80ed05cSGunnar Mills string "xyz.openbmc_project.Sensor.Threshold.Warning" 92c80ed05cSGunnar Mills string "xyz.openbmc_project.Sensor.Value" 93c80ed05cSGunnar Mills ] 94c80ed05cSGunnar Mills ) 95c80ed05cSGunnar Mills ] 96c80ed05cSGunnar Mills ) 97c80ed05cSGunnar Mills dict entry( 98c80ed05cSGunnar Mills string "/xyz/openbmc_project/sensors/current/ps1_output_current" 99c80ed05cSGunnar Mills array [ 100c80ed05cSGunnar Mills dict entry( 101c80ed05cSGunnar Mills string "xyz.openbmc_project.Hwmon-1025936882.Hwmon1" 102c80ed05cSGunnar Mills array [ 103c80ed05cSGunnar Mills string "xyz.openbmc_project.Sensor.Threshold.Critical" 104c80ed05cSGunnar Mills string "xyz.openbmc_project.Sensor.Threshold.Warning" 105c80ed05cSGunnar Mills string "xyz.openbmc_project.Sensor.Value" 106c80ed05cSGunnar Mills ] 107c80ed05cSGunnar Mills ) 108c80ed05cSGunnar Mills ] 109c80ed05cSGunnar Mills ) 110c80ed05cSGunnar Mills... 111c80ed05cSGunnar Mills 112c80ed05cSGunnar Mills``` 113c80ed05cSGunnar Mills 114c80ed05cSGunnar Mills#### Example Use Case 115f4febd00SPatrick Williams 116c80ed05cSGunnar MillsFind all object paths and services that implement a specific interface. 117c80ed05cSGunnar Mills 118b11998fdSWilly Tu### GetAssociatedSubTree 119b11998fdSWilly Tu 120b11998fdSWilly TuUse this method to find the objects, services, and interfaces in the specified 121b11998fdSWilly Tusubtree that implement a certain interface and an endpoint of the input 122*3b90d1eeSJanet AdkinsassociationPath. An optional list of interfaces may also be passed in to 123*3b90d1eeSJanet Adkinsconstrain the output to services that implement those specific interfaces. If no 124*3b90d1eeSJanet Adkinsinterfaces are passed in, then all objects/services/interfaces in the subtree 125*3b90d1eeSJanet Adkinsand associated endpoint are returned. 126b11998fdSWilly Tu 127b11998fdSWilly TuInputs: 128b11998fdSWilly Tu 129b11998fdSWilly Tu- param: associationPath - the path to look for the association endpoints. 130b11998fdSWilly Tu- param: subtree - the root of the tree. Using "/" will search the whole tree 131b11998fdSWilly Tu- param: depth - the maximum depth of the tree past the root to search. Use 0 to 132b11998fdSWilly Tu search all 133b11998fdSWilly Tu- param: interfaces - an optional list of interfaces to constrain the search to 134b11998fdSWilly Tu 135b11998fdSWilly TuOutput: 136b11998fdSWilly Tu 137b11998fdSWilly Tu- Map of object paths to a map of service names to their interfaces that is in 138b11998fdSWilly Tu the associated endpoints 139b11998fdSWilly Tu 140b11998fdSWilly Tu``` 141b11998fdSWilly Tudbus-send --system --print-reply \ 142b11998fdSWilly Tu--dest=xyz.openbmc_project.ObjectMapper \ 143b11998fdSWilly Tu/xyz/openbmc_project/object_mapper \ 144b11998fdSWilly Tuxyz.openbmc_project.ObjectMapper.GetAssociatedSubTree \ 145b11998fdSWilly Tuobjpath:"/${ASSOCIATED_PATH}" \ 146b11998fdSWilly Tuobjpath:"/" int32:0 array:string:"xyz.openbmc_project.Sensor.Threshold.Warning" 147b11998fdSWilly Tu 148b11998fdSWilly Tu array [ 149b11998fdSWilly Tu dict entry( 150b11998fdSWilly Tu string "/xyz/openbmc_project/sensors/current/ps0_output_current" 151b11998fdSWilly Tu array [ 152b11998fdSWilly Tu dict entry( 153b11998fdSWilly Tu string "xyz.openbmc_project.Hwmon-1040041051.Hwmon1" 154b11998fdSWilly Tu array [ 155b11998fdSWilly Tu string "xyz.openbmc_project.Sensor.Threshold.Critical" 156b11998fdSWilly Tu string "xyz.openbmc_project.Sensor.Threshold.Warning" 157b11998fdSWilly Tu string "xyz.openbmc_project.Sensor.Value" 158b11998fdSWilly Tu ] 159b11998fdSWilly Tu ) 160b11998fdSWilly Tu ] 161b11998fdSWilly Tu ) 162b11998fdSWilly Tu dict entry( 163b11998fdSWilly Tu string "/xyz/openbmc_project/sensors/current/ps1_output_current" 164b11998fdSWilly Tu array [ 165b11998fdSWilly Tu dict entry( 166b11998fdSWilly Tu string "xyz.openbmc_project.Hwmon-1025936882.Hwmon1" 167b11998fdSWilly Tu array [ 168b11998fdSWilly Tu string "xyz.openbmc_project.Sensor.Threshold.Critical" 169b11998fdSWilly Tu string "xyz.openbmc_project.Sensor.Threshold.Warning" 170b11998fdSWilly Tu string "xyz.openbmc_project.Sensor.Value" 171b11998fdSWilly Tu ] 172b11998fdSWilly Tu ) 173b11998fdSWilly Tu ] 174b11998fdSWilly Tu ) 175b11998fdSWilly Tu... 176b11998fdSWilly Tu 177b11998fdSWilly Tu 178b11998fdSWilly Tu# All output must be in the association endpoints 179b11998fdSWilly Tubusctl get-property xyz.openbmc_project.ObjectMapper \ 180b11998fdSWilly Tu /${ASSOCIATED_PATH} \ 181b11998fdSWilly Tu xyz.openbmc_project.Association endpoints 182b11998fdSWilly Tuas N "/xyz/openbmc_project/sensors/current/ps0_output_current" \ 183b11998fdSWilly Tu "/xyz/openbmc_project/sensors/current/ps1_output_current" \ 184b11998fdSWilly Tu ... 185b11998fdSWilly Tu``` 186b11998fdSWilly Tu 187b11998fdSWilly Tu#### Example Use Case 188b11998fdSWilly Tu 189b11998fdSWilly TuFind all object paths and services that implement a specific interface and 190b11998fdSWilly Tuendpoint of the input associationPath. 191b11998fdSWilly Tu 19270bf3842SMyung Bae### GetAssociatedSubTreeById 19370bf3842SMyung Bae 19470bf3842SMyung BaeUse this method to find the objects, services, and interfaces in the specified 19570bf3842SMyung Baesubtree that implement certain interfaces and endpoints that end by input `id`. 196*3b90d1eeSJanet AdkinsAn optional list of interfaces may also be passed in to constrain the output to 197*3b90d1eeSJanet Adkinsservices that implement those specific interfaces. If no interfaces are passed 198*3b90d1eeSJanet Adkinsin, then all objects/services/interfaces in the subtree and associated endpoint 199*3b90d1eeSJanet Adkinsare returned. 20070bf3842SMyung Bae 20170bf3842SMyung BaeInputs: 20270bf3842SMyung Bae 20370bf3842SMyung Bae- param: id - The leaf name of the dbus path, uniquely identifying a specific 20470bf3842SMyung Bae component or entity within the system. 20570bf3842SMyung Bae- param: objectPath - The object path for which the result should be fetched. 20670bf3842SMyung Bae- param: subtreeInterfaces - a list of interfaces to constrain the search to 20770bf3842SMyung Bae- param: association - The endpoint association. 20870bf3842SMyung Bae- param: endpointInterfaces - An array of interfaces used to filter associated 20970bf3842SMyung Bae endpoint paths. 21070bf3842SMyung Bae 21170bf3842SMyung BaeOutput: 21270bf3842SMyung Bae 21370bf3842SMyung Bae- Map of object paths to a map of service names to their interfaces that are in 21470bf3842SMyung Bae the associated endpoints that end with `id` 21570bf3842SMyung Bae 21670bf3842SMyung Bae```text 21770bf3842SMyung BaeID="chassis" 21870bf3842SMyung BaeASSOCIATION="powered_by" 21970bf3842SMyung Baedbus-send --system --print-reply \ 22070bf3842SMyung Bae--dest=xyz.openbmc_project.ObjectMapper \ 22170bf3842SMyung Bae/xyz/openbmc_project/object_mapper \ 22270bf3842SMyung Baexyz.openbmc_project.ObjectMapper.GetAssociatedSubTreeById \ 22370bf3842SMyung Baestring:"${ID}" string:"/xyz/openbmc_project/inventory" \ 22470bf3842SMyung Baearray:string:"xyz.openbmc_project.Inventory.Item.Chassis" \ 22570bf3842SMyung Baestring:"${ASSOCIATION}" \ 22670bf3842SMyung Baearray:string:"xyz.openbmc_project.Inventory.Item.PowerSupply" 22770bf3842SMyung Bae 22870bf3842SMyung Bae array [ 22970bf3842SMyung Bae dict entry( 23070bf3842SMyung Bae string "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" 23170bf3842SMyung Bae array [ 23270bf3842SMyung Bae dict entry( 23370bf3842SMyung Bae string "xyz.openbmc_project.Inventory.Manager" 23470bf3842SMyung Bae array [ 23570bf3842SMyung Bae ... 23670bf3842SMyung Bae string "xyz.openbmc_project.Inventory.Item" 23770bf3842SMyung Bae string "xyz.openbmc_project.Inventory.Item.PowerSupply" 23870bf3842SMyung Bae ... 23970bf3842SMyung Bae ] 24070bf3842SMyung Bae ) 24170bf3842SMyung Bae ] 24270bf3842SMyung Bae ) 24370bf3842SMyung Bae dict entry( 24470bf3842SMyung Bae string "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1" 24570bf3842SMyung Bae array [ 24670bf3842SMyung Bae dict entry( 24770bf3842SMyung Bae string "xyz.openbmc_project.Inventory.Manager" 24870bf3842SMyung Bae array [ 24970bf3842SMyung Bae ... 25070bf3842SMyung Bae string "xyz.openbmc_project.Inventory.Item" 25170bf3842SMyung Bae string "xyz.openbmc_project.Inventory.Item.PowerSupply" 25270bf3842SMyung Bae ... 25370bf3842SMyung Bae ] 25470bf3842SMyung Bae ) 25570bf3842SMyung Bae ] 25670bf3842SMyung Bae ) 25770bf3842SMyung Bae .... 25870bf3842SMyung Bae... 25970bf3842SMyung Bae 26070bf3842SMyung Bae# All output must be in the association endpoints that ends with the given `id` 26170bf3842SMyung BaeCHASSIS_PATH=/xyz/openbmc_project/inventory/system/chassis 26270bf3842SMyung Baebusctl get-property xyz.openbmc_project.ObjectMapper \ 26370bf3842SMyung Bae /xyz/openbmc_project/inventory/system/chassis/${ASSOCIATION} \ 26470bf3842SMyung Bae xyz.openbmc_project.Association endpoints 26570bf3842SMyung Baeas N "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" \ 26670bf3842SMyung Bae"/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1" \ 26770bf3842SMyung Bae ... 26870bf3842SMyung Bae``` 26970bf3842SMyung Bae 27070bf3842SMyung Bae#### Example Use Case 27170bf3842SMyung Bae 27270bf3842SMyung BaeFind all object paths and services that implement a specific interface and 27370bf3842SMyung Baeendpoint of the input associationPath. 27470bf3842SMyung Bae 275c80ed05cSGunnar Mills### GetSubTreePaths 276f4febd00SPatrick Williams 277c80ed05cSGunnar MillsThis is the same as GetSubTree, but only returns object paths 278c80ed05cSGunnar Mills 279c80ed05cSGunnar MillsInputs: 280f4febd00SPatrick Williams 281c80ed05cSGunnar Mills- param: subtree - the root of the tree. Using "/" will search the whole tree 282f4febd00SPatrick Williams- param: depth - the maximum depth of the tree past the root to search. Use 0 to 283f4febd00SPatrick Williams search all 284c80ed05cSGunnar Mills- param: interfaces - an optional list of interfaces to constrain the search to 285c80ed05cSGunnar Mills 286c80ed05cSGunnar MillsOutput: 287f4febd00SPatrick Williams 288c80ed05cSGunnar Mills- array of object paths in that subtree 289c80ed05cSGunnar Mills 290c80ed05cSGunnar Mills``` 291c80ed05cSGunnar Millsdbus-send --system --print-reply \ 292c80ed05cSGunnar Mills--dest=xyz.openbmc_project.ObjectMapper \ 293c80ed05cSGunnar Mills/xyz/openbmc_project/object_mapper \ 294c80ed05cSGunnar Millsxyz.openbmc_project.ObjectMapper.GetSubTreePaths \ 295c80ed05cSGunnar Millsstring:"/" int32:0 array:string:"xyz.openbmc_project.Sensor.Threshold.Warning" 296c80ed05cSGunnar Mills 297c80ed05cSGunnar Mills array [ 298c80ed05cSGunnar Mills string "/xyz/openbmc_project/sensors/current/ps0_output_current" 299c80ed05cSGunnar Mills string "/xyz/openbmc_project/sensors/current/ps1_output_current" 300c80ed05cSGunnar Mills string "/xyz/openbmc_project/sensors/power/ps0_input_power" 301c80ed05cSGunnar Mills... 302c80ed05cSGunnar Mills ] 303c80ed05cSGunnar Mills``` 304c80ed05cSGunnar Mills 305c80ed05cSGunnar Mills#### Example Use Case 306f4febd00SPatrick Williams 307c80ed05cSGunnar MillsFind all object paths that implement a specific interface. 308c80ed05cSGunnar Mills 309b11998fdSWilly Tu### GetAssociatedSubTreePaths 310b11998fdSWilly Tu 311b11998fdSWilly TuThis is the same as GetAssociatedSubTreePaths, but only returns object paths 312b11998fdSWilly Tu 313b11998fdSWilly TuInputs: 314b11998fdSWilly Tu 315b11998fdSWilly Tu- param: associationPath - the path to look for the association endpoints. 316b11998fdSWilly Tu- param: subtree - the root of the tree. Using "/" will search the whole tree 317b11998fdSWilly Tu- param: depth - the maximum depth of the tree past the root to search. Use 0 to 318b11998fdSWilly Tu search all 319b11998fdSWilly Tu- param: interfaces - an optional list of interfaces to constrain the search to 320b11998fdSWilly Tu 321b11998fdSWilly TuOutput: 322b11998fdSWilly Tu 323b11998fdSWilly Tu- array of object paths in that subtree that is in the associated endpoints 324b11998fdSWilly Tu 325b11998fdSWilly Tu``` 326b11998fdSWilly Tudbus-send --system --print-reply \ 327b11998fdSWilly Tu--dest=xyz.openbmc_project.ObjectMapper \ 328b11998fdSWilly Tu/xyz/openbmc_project/object_mapper \ 329b11998fdSWilly Tuxyz.openbmc_project.ObjectMapper.GetAssociatedSubTreePaths \ 330b11998fdSWilly Tuobjpath:"/${ASSOCIATED_PATH}" objpath:"/" int32:0 array:string:"xyz.openbmc_project.Sensor.Threshold.Warning" 331b11998fdSWilly Tu 332b11998fdSWilly Tu array [ 333b11998fdSWilly Tu string "/xyz/openbmc_project/sensors/current/ps0_output_current" 334b11998fdSWilly Tu string "/xyz/openbmc_project/sensors/current/ps1_output_current" 335b11998fdSWilly Tu string "/xyz/openbmc_project/sensors/power/ps0_input_power" 336b11998fdSWilly Tu... 337b11998fdSWilly Tu ] 338b11998fdSWilly Tu 339b11998fdSWilly Tu# All output must be in the association endpoints 340b11998fdSWilly Tubusctl get-property xyz.openbmc_project.ObjectMapper \ 341b11998fdSWilly Tu /${ASSOCIATED_PATH} \ 342b11998fdSWilly Tu xyz.openbmc_project.Association endpoints 343b11998fdSWilly Tuas N "/xyz/openbmc_project/sensors/current/ps0_output_current" \ 344b11998fdSWilly Tu "/xyz/openbmc_project/sensors/current/ps1_output_current" \ 345b11998fdSWilly Tu "/xyz/openbmc_project/sensors/power/ps0_input_power" \ 346b11998fdSWilly Tu ... 347b11998fdSWilly Tu``` 348b11998fdSWilly Tu 349b11998fdSWilly Tu#### Example Use Case 350b11998fdSWilly Tu 351b11998fdSWilly TuFind all object paths that implement a specific interface and endpoint of the 352b11998fdSWilly Tuinput associationPath. 353b11998fdSWilly Tu 35470bf3842SMyung Bae### GetAssociatedSubTreePathsById 35570bf3842SMyung Bae 35670bf3842SMyung BaeThis is the same as GetAssociatedSubTreePathsById, but only returns object paths 35770bf3842SMyung Bae 35870bf3842SMyung BaeInputs: 35970bf3842SMyung Bae 36070bf3842SMyung Bae- param: id - The leaf name of the dbus path, uniquely identifying a specific 36170bf3842SMyung Bae component or entity within the system. 36270bf3842SMyung Bae- param: objectPath - The object path for which the result should be fetched. 36370bf3842SMyung Bae- param: subtreeInterfaces - a list of interfaces to constrain the search to 36470bf3842SMyung Bae- param: association - The endpoint association. 36570bf3842SMyung Bae- param: endpointInterfaces - An array of interfaces used to filter associated 36670bf3842SMyung Bae endpoint paths. 36770bf3842SMyung Bae 36870bf3842SMyung BaeOutput: 36970bf3842SMyung Bae 37070bf3842SMyung Bae- Map of object paths to a map of service names to their interfaces that are in 37170bf3842SMyung Bae the associated endpoints that ends with `id` 37270bf3842SMyung Bae 37370bf3842SMyung Bae```text 37470bf3842SMyung BaeID="chassis" 37570bf3842SMyung BaeASSOCIATION="powered_by" 37670bf3842SMyung Baedbus-send --system --print-reply \ 37770bf3842SMyung Bae--dest=xyz.openbmc_project.ObjectMapper \ 37870bf3842SMyung Bae/xyz/openbmc_project/object_mapper \ 37970bf3842SMyung Baexyz.openbmc_project.ObjectMapper.GetAssociatedSubTreePathsById \ 38070bf3842SMyung Baestring:"${ID}" string:"/xyz/openbmc_project/inventory" \ 38170bf3842SMyung Baearray:string:"xyz.openbmc_project.Inventory.Item.Chassis" \ 38270bf3842SMyung Baestring:"${ASSOCIATION}" \ 38370bf3842SMyung Baearray:string:"xyz.openbmc_project.Inventory.Item.PowerSupply" 38470bf3842SMyung Bae 38570bf3842SMyung Bae array [ 38670bf3842SMyung Bae string "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" 38770bf3842SMyung Bae string "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1" 38870bf3842SMyung Bae ... 38970bf3842SMyung Bae ] 39070bf3842SMyung Bae... 39170bf3842SMyung Bae 39270bf3842SMyung Bae# All output must be in the association endpoints that ends with the given `id` 39370bf3842SMyung BaeCHASSIS_PATH=/xyz/openbmc_project/inventory/system/chassis 39470bf3842SMyung Baebusctl get-property xyz.openbmc_project.ObjectMapper \ 39570bf3842SMyung Bae /xyz/openbmc_project/inventory/system/chassis/${ASSOCIATION} \ 39670bf3842SMyung Bae xyz.openbmc_project.Association endpoints 39770bf3842SMyung Baeas N "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" \ 39870bf3842SMyung Bae"/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1" \ 39970bf3842SMyung Bae ... 40070bf3842SMyung Bae``` 40170bf3842SMyung Bae 40270bf3842SMyung Bae#### Example Use Case 40370bf3842SMyung Bae 40470bf3842SMyung BaeFind all object paths that implement a specific interface and endpoint of the 40570bf3842SMyung Baeinput associationPath. 40670bf3842SMyung Bae 407c80ed05cSGunnar Mills### GetAncestors 408f4febd00SPatrick Williams 409c80ed05cSGunnar MillsUse this method to find all ancestors of an object that implement a specific 410c80ed05cSGunnar Millsinterface. If no interfaces are passed in, then all ancestor 411c80ed05cSGunnar Millspaths/services/interfaces are returned. 412c80ed05cSGunnar Mills 413c80ed05cSGunnar MillsInputs: 414f4febd00SPatrick Williams 415c80ed05cSGunnar Mills- param: path - the object path to find the ancestors of 416c80ed05cSGunnar Mills- param: interfaces - an optional list of interfaces to constrain the search to 417c80ed05cSGunnar Mills 418c80ed05cSGunnar MillsOutput: 419f4febd00SPatrick Williams 420c80ed05cSGunnar Mills- A map of object paths to a map of services names to their interfaces 421c80ed05cSGunnar Mills 422c80ed05cSGunnar Mills``` 423c80ed05cSGunnar Mills 424c80ed05cSGunnar Millsdbus-send --system --print-reply \ 425c80ed05cSGunnar Mills--dest=xyz.openbmc_project.ObjectMapper \ 426c80ed05cSGunnar Mills/xyz/openbmc_project/object_mapper \ 427c80ed05cSGunnar Millsxyz.openbmc_project.ObjectMapper.GetAncestors \ 428c80ed05cSGunnar Millsstring:"/xyz/openbmc_project/inventory/system" array:string: 429c80ed05cSGunnar Mills 430c80ed05cSGunnar Mills array [ 431c80ed05cSGunnar Mills dict entry( 432c80ed05cSGunnar Mills string "/xyz/openbmc_project" 433c80ed05cSGunnar Mills array [ 434c80ed05cSGunnar Mills dict entry( 435c80ed05cSGunnar Mills string "xyz.openbmc_project.ObjectMapper" 436c80ed05cSGunnar Mills array [ 437c80ed05cSGunnar Mills string "org.freedesktop.DBus.ObjectManager" 438c80ed05cSGunnar Mills ] 439c80ed05cSGunnar Mills ) 440c80ed05cSGunnar Mills ] 441c80ed05cSGunnar Mills ) 442c80ed05cSGunnar Mills dict entry( 443c80ed05cSGunnar Mills string "/xyz/openbmc_project/inventory" 444c80ed05cSGunnar Mills array [ 445c80ed05cSGunnar Mills dict entry( 446c80ed05cSGunnar Mills string "xyz.openbmc_project.Inventory.Manager" 447c80ed05cSGunnar Mills array [ 448c80ed05cSGunnar Mills string "xyz.openbmc_project.Inventory.Manager" 449c80ed05cSGunnar Mills string "org.freedesktop.DBus.ObjectManager" 450c80ed05cSGunnar Mills ] 451c80ed05cSGunnar Mills ) 452c80ed05cSGunnar Mills ] 453c80ed05cSGunnar Mills ) 454c80ed05cSGunnar Mills dict entry( 455c80ed05cSGunnar Mills string "/" 456c80ed05cSGunnar Mills array [ 457c80ed05cSGunnar Mills dict entry( 458c80ed05cSGunnar Mills string "xyz.openbmc_project.Settings" 459c80ed05cSGunnar Mills array [ 460c80ed05cSGunnar Mills string "org.freedesktop.DBus.ObjectManager" 461c80ed05cSGunnar Mills ] 462c80ed05cSGunnar Mills ) 463c80ed05cSGunnar Mills ] 464c80ed05cSGunnar Mills ) 465c80ed05cSGunnar Mills ] 466c80ed05cSGunnar Mills``` 467c80ed05cSGunnar Mills 468c80ed05cSGunnar Mills#### Example Use Case 469f4febd00SPatrick Williams 470c80ed05cSGunnar MillsFind a parent object that implements a specific interface. 471c80ed05cSGunnar Mills 472c80ed05cSGunnar Mills## Associations 473c80ed05cSGunnar Mills 474c80ed05cSGunnar MillsAssociations are special D-Bus objects created by the mapper to associate two 475f4febd00SPatrick Williamsobjects with each other. For this to occur, some application must implement the 476f4febd00SPatrick Williams`xyz.openbmc_project.Association.Definitions` interface, and then when an 477c80ed05cSGunnar Millsassociation is desired, the `Associations` property on that interface needs to 478c80ed05cSGunnar Millsbe written. 479c80ed05cSGunnar Mills 480c80ed05cSGunnar MillsThis `Associations` property is an array of tuples of the form: 481f4febd00SPatrick Williams 482c80ed05cSGunnar Mills``` 483c80ed05cSGunnar Mills[forward, reverse, object path] 484c80ed05cSGunnar Mills``` 485f4febd00SPatrick Williams 486c80ed05cSGunnar Mills- forward: this is the name of the forward association object 487c80ed05cSGunnar Mills- reverse: this is the name of the reverse association object 488c80ed05cSGunnar Mills- object path: this is the other object to associate with 489c80ed05cSGunnar Mills 490f4febd00SPatrick WilliamsWhen an object with, for example, an object path of `pathA` uses the following 491f4febd00SPatrick Williamsvalues: 492f4febd00SPatrick Williams 493c80ed05cSGunnar Mills``` 494c80ed05cSGunnar Mills["foo", "bar", "pathB"] 495c80ed05cSGunnar Mills``` 496f4febd00SPatrick Williams 497c80ed05cSGunnar MillsThe mapper will create 2 new objects: 498c80ed05cSGunnar Mills 499c80ed05cSGunnar Mills1. `pathA/foo` 500c80ed05cSGunnar Mills2. `pathB/bar` 501c80ed05cSGunnar Mills 502c80ed05cSGunnar MillsOn each of these objects, the interface `xyz.openbmc_project.Association` will 503f4febd00SPatrick Williamsbe implemented, which has a single `endpoints` property. This property is an 504f4febd00SPatrick Williamsarray that holds the object paths to the other end of the association. 505c80ed05cSGunnar Mills 506f4febd00SPatrick WilliamsSo, `pathA/foo->endpoints` will contain `pathB`, and `pathB/bar->endpoints` will 507f4febd00SPatrick Williamscontain `pathA`. 508c80ed05cSGunnar Mills 509c80ed05cSGunnar MillsIf another object, say `pathC`, also has an association to `pathB`, then a 510c80ed05cSGunnar Millssecond entry, `pathC`, will be added into `pathB`\'s endpoints property. 511c80ed05cSGunnar Mills 512f4febd00SPatrick WilliamsThese new objects will match the lifetime of the associated objects. For 513f4febd00SPatrick Williamsexample, if `pathA` is deleted, then `pathA/foo` will also be deleted, and 514f4febd00SPatrick Williams`pathA` will be removed from the endpoints property of `pathB/bar`. If that was 515f4febd00SPatrick Williamsthe last entry in that property, then `pathB/bar` will also be deleted. In 516f4febd00SPatrick Williamsaddition, if the endpoint path is removed from D-Bus, in this case `pathB`, then 517f4febd00SPatrick Williamsthe mapper will remove the 2 association paths until `pathB` shows back up 518f4febd00SPatrick Williamsagain. 519c80ed05cSGunnar Mills 520c80ed05cSGunnar MillsNote: The original name of the association definition interface was 521c80ed05cSGunnar Mills`org.openbmc.Associations`. While the mapper still supports this interface as 522c80ed05cSGunnar Millswell for the time being, new code should use the `xyz` version. 523c80ed05cSGunnar Mills 524c80ed05cSGunnar Mills#### Example Use Case 525c80ed05cSGunnar Mills 526c80ed05cSGunnar MillsAssociate an error log with the inventory item that caused it. 527c80ed05cSGunnar Mills 528c80ed05cSGunnar Mills``` 529c80ed05cSGunnar Mills# Error log 530c80ed05cSGunnar Mills"/xyz/openbmc_project/logging/entry/3": { 531c80ed05cSGunnar Mills... 532c80ed05cSGunnar Mills "associations": [ 533c80ed05cSGunnar Mills [ 534c80ed05cSGunnar Mills "callout", 535c80ed05cSGunnar Mills "fault", 536c80ed05cSGunnar Mills "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" 537c80ed05cSGunnar Mills ] 538c80ed05cSGunnar Mills ] 539c80ed05cSGunnar Mills} 540c80ed05cSGunnar Mills 541c80ed05cSGunnar Mills# Newly created forward association object 542c80ed05cSGunnar Mills"/xyz/openbmc_project/logging/entry/3/callout": { 543c80ed05cSGunnar Mills "endpoints": [ 544c80ed05cSGunnar Mills "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" 545c80ed05cSGunnar Mills ] 546c80ed05cSGunnar Mills} 547c80ed05cSGunnar Mills 548c80ed05cSGunnar Mills# Newly created reverse association object 549c80ed05cSGunnar Mills"/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0/fault": { 550c80ed05cSGunnar Mills "endpoints": [ 551c80ed05cSGunnar Mills "/xyz/openbmc_project/logging/entry/3" 552c80ed05cSGunnar Mills ] 553c80ed05cSGunnar Mills} 554c80ed05cSGunnar Mills 555c80ed05cSGunnar Mills``` 556f4febd00SPatrick Williams 557f4febd00SPatrick Williams[1]: 558f4febd00SPatrick Williams https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/ObjectMapper.interface.yaml 559