{"id":18368737,"url":"https://github.com/openbmc/phosphor-inventory-manager","last_synced_at":"2025-09-02T18:47:56.795Z","repository":{"id":49475047,"uuid":"71132420","full_name":"openbmc/phosphor-inventory-manager","owner":"openbmc","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-09T14:46:57.000Z","size":914,"stargazers_count":10,"open_issues_count":6,"forks_count":9,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-07-09T15:48:32.044Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openbmc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-10-17T11:45:36.000Z","updated_at":"2025-07-09T14:42:29.000Z","dependencies_parsed_at":"2023-02-16T17:45:56.327Z","dependency_job_id":"e1307852-da5b-4e3f-9445-00adad4a1f46","html_url":"https://github.com/openbmc/phosphor-inventory-manager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/openbmc/phosphor-inventory-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openbmc%2Fphosphor-inventory-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openbmc%2Fphosphor-inventory-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openbmc%2Fphosphor-inventory-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openbmc%2Fphosphor-inventory-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openbmc","download_url":"https://codeload.github.com/openbmc/phosphor-inventory-manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openbmc%2Fphosphor-inventory-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273333499,"owners_count":25086972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T23:27:11.916Z","updated_at":"2025-09-02T18:47:56.741Z","avatar_url":"https://github.com/openbmc.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phosphor Inventory Manager (PIM)\n\nPhosphor Inventory Manager (PIM) is an implementation of the\n`xyz.openbmc_project.Inventory.Manager` DBus interface, and supporting tools.\nPIM uses a combination of build-time YAML files, run-time calls to the Notify\nmethod of the Manager interface, and association definition JSON files to\nprovide a generalized inventory state management solution.\n\n## YAML\n\nPIM includes a YAML parser (pimgen.py). For PIM to do anything useful, a set of\nYAML files must be provided externally that tell it what to do. Examples can be\nfound in the examples directory.\n\nThe following top level YAML tags are supported:\n\n- description - An optional description of the file.\n- events - One or more events that PIM should monitor.\n\n### events\n\nSupported event tags are:\n\n- name - A globally unique event name.\n- description - An optional description of the event.\n- type - The event type. Supported types are: _match_ and _startup_.\n- actions - The responses to the event.\n\nSubsequent tags are defined by the event type.\n\n### match\n\nSupported match tags are:\n\n- signatures - A DBus match specification.\n- filters - Filters to apply when a match occurs.\n\n### startup\n\nSupported startup tags are:\n\n- filters - Filters to apply at startup.\n\n### filters\n\nSupported filter tags are:\n\n- name - The filter to use.\n\nSubsequent tags are defined by the filter type.\n\nThe available filters provided by PIM are:\n\n- propertyChangedTo - Only match events when the specified property has the\n  specified value.\n- propertyIs - Only match events when the specified property has the specified\n  value.\n\n### propertyChangedTo\n\nThe property under test is obtained from an sdbus message generated from an\norg.freedesktop.DBus.Properties.PropertiesChanged signal payload.\n\nSupported arguments for the propertyChangedTo filter are:\n\n- interface - The interface hosting the property to be checked.\n- property - The property to check.\n- value - The value to check.\n\n### propertyIs\n\nThe property under test is obtained by invoking org.freedesktop.Properties.Get\non the specified interface.\n\nSupported arguments for the propertyIs filter are:\n\n- path - The object hosting the property to be checked.\n- interface - The interface hosting the property to be checked.\n- property - The property to check.\n- value - The value to check.\n- service - An optional DBus service name.\n\nThe service argument is optional. If provided that service will be called\nexplicitly. If omitted, the service will be obtained with an\n`xyz.openbmc_project.ObjectMapper` lookup.\n\npropertyIs can be used in an action condition context when the action operates\non a dbus object path.\n\n### actions\n\nSupported action tags are:\n\n- name - The action to perform.\n\nSubsequent tags are defined by the action type.\n\nThe available actions provided by PIM are:\n\n- destroyObject - Destroy the specified DBus object.\n- setProperty - Set the specified property on the specified DBus object.\n\n### destroyObject\n\nSupported arguments for the destroyObject action are:\n\n- paths - The paths of the objects to remove from DBus.\n- conditions - An array of conditions.\n\nConditions are tested and logically ANDed. If the conditions do not pass, the\nobject is not destroyed. Any condition that accepts a path parameter is\nsupported.\n\n### setProperty\n\nSupported arguments for the setProperty action are:\n\n- interface - The interface hosting the property to be set.\n- property - The property to set.\n- paths - The objects hosting the property to be set.\n- value - The value to set.\n- conditions - An array of conditions.\n\nConditions are tested and logically ANDed. If the conditions do not pass, the\nproperty is not set. Any condition that accepts a path parameter is supported.\n\n### createObjects\n\nSupported arguments for the createObjects action are:\n\n- objs - A dictionary of objects to create.\n\n## Creating Associations\n\nPIM can create [associations][1] between inventory items and other D-Bus\nobjects.\n\nThis functionality is optional and is controlled with the\n`--enable-associations` configure option. It defaults to disabled.\n\nTo use this, the associations to create should be defined in a JSON file which\nis specified by the `ASSOCIATIONS_FILE_PATH` configure variable, which defaults\nto `/usr/share/phosphor-inventory-manager/associations.json`. This file is\nprocessed at runtime.\n\nAn example of this JSON is:\n\n```json\n[\n  {\n    \"path\": \"system/chassis/motherboard/cpu0/core1\",\n    \"endpoints\": [\n      {\n        \"types\": {\n          \"fType\": \"sensors\",\n          \"rType\": \"inventory\"\n        },\n        \"paths\": [\"/xyz/openbmc_project/sensors/temperature/p0_core0_temp\"]\n      }\n    ]\n  }\n]\n```\n\nThen, when/if PIM creates the\n`xyz/openbmc_project/system/chassis/motherboard/cpu0/core1` inventory object, it\nwill add an `xyz.openbmc_project.Association.Definitions` interface on it such\nthat the object mapper creates the 2 association objects:\n\n```text\n    /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core1/sensors\n       endpoints property:\n       ['/xyz/openbmc_project/sensors/temperature/p0_core0_temp']\n\n    /xyz/openbmc_project/sensors/temperature/p0_core0_temp/inventory\n       endpoints property:\n       ['/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core1']\n```\n\nThe JSON description is:\n\n```json\n[\n    {\n        \"path\": \"The relative path of the inventory object to create the\n                 xyz.openbmc_project.Association.Definitions interface on.\"\n        \"endpoints\":\n        [\n            {\n                \"types\":\n                {\n                    \"fType\": \"The forward association type.\"\n                    \"rType\": \"The reverse association type.\"\n                },\n                \"paths\":\n                [\n                    \"The list of association endpoints for this inventory path\n                     and association type.\"\n                ]\n            }\n        ]\n    }\n]\n```\n\nIn the case where different systems that require different associations reside\nin the same flash image, multiple JSON files must be used. These files must be\nin the same directory as the default associations file would go, but it does not\nmatter what they are named as long as the name ends in '.json'. Each file then\ncontains a 'condition' entry that specifies an inventory path, interface,\nproperty, and list of values. If the actual value of that property is in the\nlist of values, then the condition is met and those associations are activated.\n\nIf a file with a conditions section is found, then the default associations file\nis ignored. The end result is that associations are only ever loaded from one\nfile, either the default file if there aren't any files with conditions in them,\nor the first file that had a condition that matched.\n\nAn example is:\n\n```json\n{\n  \"condition\": {\n    \"path\": \"system/chassis/motherboard\",\n    \"interface\": \"xyz.openbmc_project.Inventory.Decorator.Asset\",\n    \"property\": \"Model\",\n    \"values\": [\"ModelA\", \"ModelB\"]\n  },\n  \"associations\": [\n    {\n      \"path\": \"system/chassis/motherboard/cpu0/core1\",\n      \"endpoints\": [\n        {\n          \"types\": { \"fType\": \"sensors\", \"rType\": \"inventory\" },\n          \"paths\": [\"/xyz/openbmc_project/sensors/temperature/p0_core0_temp\"]\n        }\n      ]\n    }\n  ]\n}\n```\n\nThis states that these associations are valid if the system/chassis/motherboard\ninventory object has a Model property with a value of either ModelA or ModelB.\n\nThe values field supports the same types as in the inventory, so either a `bool`\n(true/false), `int64_t`, `std::string`, or `std::vector\u003cuint8_t\u003e`([1, 2]).\n\n## Building\n\nAfter running pimgen.py, build PIM using the following steps:\n\n```sh\nmeson setup builddir\nninja -C builddir\n```\n\n[1]:\n  https://github.com/openbmc/docs/blob/master/architecture/object-mapper.md#associations\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenbmc%2Fphosphor-inventory-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenbmc%2Fphosphor-inventory-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenbmc%2Fphosphor-inventory-manager/lists"}