Brad Bishop | 870c3fc | 2017-05-22 23:23:13 -0400 | [diff] [blame] | 1 | # Example PDM configuration file. |
Brad Bishop | 0e7df13 | 2017-05-23 17:58:12 -0400 | [diff] [blame] | 2 | |
| 3 | - name: example path group |
| 4 | description: > |
| 5 | 'A path group is a named collection of DBus object |
| 6 | paths and associated metadata. These collections |
| 7 | serve only to be referenced by other configuration |
| 8 | directives. |
| 9 | |
| 10 | The metadata element has different uses depending |
| 11 | on the referencing directive. |
| 12 | |
| 13 | Within a single configuration file path group names |
| 14 | must be unique. The same name can appear in multiple |
| 15 | configuration files; however, the referencing directive |
| 16 | will only search for the group in the same configuration |
| 17 | file.' |
| 18 | class: group |
| 19 | group: path |
| 20 | members: |
Brad Bishop | babf3b7 | 2017-05-31 19:44:53 -0400 | [diff] [blame^] | 21 | - meta: PATH |
Brad Bishop | 0e7df13 | 2017-05-23 17:58:12 -0400 | [diff] [blame] | 22 | path: /xyz/openbmc_project/testing/inst1 |
Brad Bishop | babf3b7 | 2017-05-31 19:44:53 -0400 | [diff] [blame^] | 23 | - meta: PATH |
Brad Bishop | 0e7df13 | 2017-05-23 17:58:12 -0400 | [diff] [blame] | 24 | path: /xyz/openbmc_project/testing/inst2 |
Brad Bishop | babf3b7 | 2017-05-31 19:44:53 -0400 | [diff] [blame^] | 25 | - meta: PATH |
Brad Bishop | 0e7df13 | 2017-05-23 17:58:12 -0400 | [diff] [blame] | 26 | path: /xyz/openbmc_project/testing/inst3 |
Brad Bishop | babf3b7 | 2017-05-31 19:44:53 -0400 | [diff] [blame^] | 27 | - meta: PATH |
Brad Bishop | 0e7df13 | 2017-05-23 17:58:12 -0400 | [diff] [blame] | 28 | path: /xyz/openbmc_project/testing/inst4 |
Brad Bishop | e73b2c3 | 2017-05-23 18:01:54 -0400 | [diff] [blame] | 29 | |
| 30 | - name: example property group |
| 31 | description: > |
| 32 | 'Like path groups, a property group is a named collection |
| 33 | of DBus property names and associated metadata. |
| 34 | |
| 35 | Properties in a group must all have the same DBus type signature |
| 36 | and must be explicitly declared.' |
| 37 | class: group |
| 38 | group: property |
| 39 | type: uint32 |
| 40 | members: |
| 41 | - interface: xyz.openbmc_project.Sensor.Value |
Brad Bishop | babf3b7 | 2017-05-31 19:44:53 -0400 | [diff] [blame^] | 42 | meta: PROPERTY |
Brad Bishop | e73b2c3 | 2017-05-23 18:01:54 -0400 | [diff] [blame] | 43 | property: ValueA |
| 44 | - interface: xyz.openbmc_project.Sensor.Value |
Brad Bishop | babf3b7 | 2017-05-31 19:44:53 -0400 | [diff] [blame^] | 45 | meta: PROPERTY |
Brad Bishop | e73b2c3 | 2017-05-23 18:01:54 -0400 | [diff] [blame] | 46 | property: ValueB |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 47 | |
| 48 | - name: example property watch |
| 49 | description: > |
| 50 | 'A property watch instructs PDM to maintain a cache of the state |
Brad Bishop | fccdc39 | 2017-05-22 21:11:09 -0400 | [diff] [blame] | 51 | of the specified properties on the specified DBus objects. |
| 52 | |
| 53 | An optional callback can be triggered when property values change.' |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 54 | class: watch |
| 55 | watch: property |
| 56 | paths: example path group |
| 57 | properties: example property group |
Brad Bishop | fccdc39 | 2017-05-22 21:11:09 -0400 | [diff] [blame] | 58 | callback: example count condition |
Brad Bishop | c1283ae | 2017-05-20 21:42:38 -0400 | [diff] [blame] | 59 | |
| 60 | - name: example journal callback |
| 61 | description: > |
| 62 | 'Callbacks are actions PDM should take when instructed to do so. |
| 63 | |
| 64 | Some callback types refer to a group of paths and group of properties |
| 65 | in a similar fashion as the property watch directive. |
| 66 | |
| 67 | The journal callback logs the specified message to the systemd journal |
| 68 | with the specified severity. |
| 69 | |
| 70 | Additionally, the journal callback will add to the journal key value |
| 71 | pair metadata for each property in the specified property group with |
| 72 | the key being the property element metadata and the value being the |
| 73 | property value.' |
| 74 | class: callback |
| 75 | callback: journal |
| 76 | paths: example path group |
| 77 | properties: example property group |
| 78 | severity: INFO |
| 79 | message: Hello world from PDM! |
Brad Bishop | 49e6617 | 2017-05-23 19:16:21 -0400 | [diff] [blame] | 80 | |
Brad Bishop | 0df00be | 2017-05-25 23:38:37 -0400 | [diff] [blame] | 81 | - name: example method callback |
| 82 | description: > |
| 83 | 'The method callback invokes the specified DBus method.' |
| 84 | class: callback |
| 85 | callback: method |
| 86 | service: org.freedesktop.systemd1 |
| 87 | path: /org/freedesktop/systemd1 |
| 88 | interface: org.freedesktop.systemd1.Manager |
| 89 | method: StartUnit |
| 90 | args: |
| 91 | - value: foo.unit |
| 92 | type: string |
| 93 | - value: replace |
| 94 | type: string |
| 95 | |
Brad Bishop | 49e6617 | 2017-05-23 19:16:21 -0400 | [diff] [blame] | 96 | - name: example callback group |
| 97 | description: > |
| 98 | 'Callbacks groups are simply named collections of other callbacks. |
| 99 | Configuration file directives can only refer to a single callback. |
| 100 | Through use of a group, these configuration file directives can |
| 101 | refer to more than one callback. |
| 102 | |
| 103 | For example for a given event, one may wish to trace multiple |
| 104 | messages to the systemd journal. The journal callback does not |
| 105 | support tracing multiple messages. To do that, define a callback |
Brad Bishop | 3539db6 | 2017-05-30 14:21:12 -0400 | [diff] [blame] | 106 | group composed of multiple journal callbacks.' |
Brad Bishop | 49e6617 | 2017-05-23 19:16:21 -0400 | [diff] [blame] | 107 | |
Brad Bishop | 49e6617 | 2017-05-23 19:16:21 -0400 | [diff] [blame] | 108 | class: callback |
| 109 | callback: group |
| 110 | members: |
| 111 | - example journal callback |
Brad Bishop | 3539db6 | 2017-05-30 14:21:12 -0400 | [diff] [blame] | 112 | - example deferred condition |
Brad Bishop | 4041d72 | 2017-05-21 10:06:07 -0400 | [diff] [blame] | 113 | |
| 114 | - name: example count condition |
| 115 | description: > |
| 116 | 'Conditions or conditional callbacks apply a test prior to invoking |
| 117 | the callback function. |
| 118 | |
| 119 | All conditional callbacks must specify the callback to issue if |
| 120 | the condition evaulates. |
| 121 | |
| 122 | The count condition applies the op comparison operator to the value of each |
| 123 | property in the specified groups. It then counts the number of properties |
| 124 | that pass the comparison, and applies another comparison on the result |
| 125 | against the specified bound. |
| 126 | |
| 127 | For example, a callback that requires at least three temperature sensors |
| 128 | in the group to be higher than 115 degrees might use a count condition |
| 129 | with an op of >, a count op of >=, a bound of 115, and a countbound of 3.' |
| 130 | |
| 131 | class: condition |
| 132 | condition: count |
| 133 | paths: example path group |
| 134 | properties: example property group |
| 135 | callback: example callback group |
| 136 | countop: '>=' |
| 137 | countbound: 3 |
| 138 | op: '>=' |
| 139 | bound: 115 |
Brad Bishop | 3539db6 | 2017-05-30 14:21:12 -0400 | [diff] [blame] | 140 | |
| 141 | - name: example deferred condition |
| 142 | description: > |
| 143 | 'Deferred conditions operate in the same fashion as conditional callbacks |
| 144 | with the added behavior that when the condition is tested and is met, |
| 145 | invocation of the callback is deferred by the interval specified. |
| 146 | |
| 147 | When the configured time has elapsed, if the condition has not been reevaluated |
| 148 | the callback is invoked. |
| 149 | |
| 150 | Any condition type can be deferred in this way by setting the defer attribute.' |
| 151 | |
| 152 | class: condition |
| 153 | condition: count |
| 154 | paths: example path group |
| 155 | properties: example property group |
| 156 | defer: 1000us |
| 157 | callback: example callback group |
| 158 | countop: '>=' |
| 159 | countbound: 3 |
| 160 | op: '>=' |
| 161 | bound: 115 |