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: > |
Gunnar Mills | 2df09e2 | 2017-07-31 13:30:22 -0500 | [diff] [blame] | 5 | 'A path group is a named collection of D-Bus object |
Brad Bishop | 0e7df13 | 2017-05-23 17:58:12 -0400 | [diff] [blame] | 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 |
Gunnar Mills | 2df09e2 | 2017-07-31 13:30:22 -0500 | [diff] [blame] | 33 | of D-Bus property names and associated metadata. |
Brad Bishop | e73b2c3 | 2017-05-23 18:01:54 -0400 | [diff] [blame] | 34 | |
Gunnar Mills | 2df09e2 | 2017-07-31 13:30:22 -0500 | [diff] [blame] | 35 | Properties in a group must all have the same D-Bus type signature |
Brad Bishop | e73b2c3 | 2017-05-23 18:01:54 -0400 | [diff] [blame] | 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 |
Gunnar Mills | 2df09e2 | 2017-07-31 13:30:22 -0500 | [diff] [blame] | 51 | of the specified properties on the specified D-Bus objects. |
Brad Bishop | fccdc39 | 2017-05-22 21:11:09 -0400 | [diff] [blame] | 52 | |
Matthew Barth | ae786ef | 2019-09-04 15:46:13 -0500 | [diff] [blame] | 53 | An optional set of filters can be applied to the specified properties, |
| 54 | where each property's cache is cleared when it fails to pass |
| 55 | any one filter. The property's cache is cleared so it will not have an |
| 56 | affect on any optional callback that may be triggered. |
| 57 | |
| 58 | An optional callback can be triggered when property values change and |
Lei YU | 98d6462 | 2022-05-24 19:11:23 +0800 | [diff] [blame] | 59 | those values pass all filters that may be defined. |
| 60 | |
| 61 | By default the callback is called when the monitor starts. |
| 62 | An optional `ignore_start_callback` can be set to true so that the |
| 63 | callback will not be called when the monitor starts.' |
| 64 | |
Brad Bishop | 4b916f1 | 2017-05-23 18:06:38 -0400 | [diff] [blame] | 65 | class: watch |
| 66 | watch: property |
| 67 | paths: example path group |
| 68 | properties: example property group |
Brad Bishop | fccdc39 | 2017-05-22 21:11:09 -0400 | [diff] [blame] | 69 | callback: example count condition |
Matthew Barth | ae786ef | 2019-09-04 15:46:13 -0500 | [diff] [blame] | 70 | filters: |
| 71 | - op: '>=' |
| 72 | bound: 0 |
| 73 | - op: '<=' |
| 74 | bound: 100 |
Lei YU | 98d6462 | 2022-05-24 19:11:23 +0800 | [diff] [blame] | 75 | ignore_start_callback: true |
Brad Bishop | c1283ae | 2017-05-20 21:42:38 -0400 | [diff] [blame] | 76 | |
| 77 | - name: example journal callback |
| 78 | description: > |
| 79 | 'Callbacks are actions PDM should take when instructed to do so. |
| 80 | |
| 81 | Some callback types refer to a group of paths and group of properties |
| 82 | in a similar fashion as the property watch directive. |
| 83 | |
| 84 | The journal callback logs the specified message to the systemd journal |
| 85 | with the specified severity. |
| 86 | |
| 87 | Additionally, the journal callback will add to the journal key value |
| 88 | pair metadata for each property in the specified property group with |
| 89 | the key being the property element metadata and the value being the |
| 90 | property value.' |
| 91 | class: callback |
| 92 | callback: journal |
| 93 | paths: example path group |
| 94 | properties: example property group |
| 95 | severity: INFO |
| 96 | message: Hello world from PDM! |
Brad Bishop | 49e6617 | 2017-05-23 19:16:21 -0400 | [diff] [blame] | 97 | |
Gunnar Mills | acac602 | 2017-08-14 16:24:55 -0500 | [diff] [blame] | 98 | - name: example elog callback |
| 99 | description: > |
| 100 | 'Callbacks are actions PDM should take when instructed to do so. |
| 101 | |
| 102 | Some callback types refer to a group of paths and group of properties |
| 103 | in a similar fashion as the property watch directive. |
| 104 | |
| 105 | The elog callback logs the elog and elog metadata.' |
| 106 | class: callback |
| 107 | callback: elog |
| 108 | paths: example path group |
| 109 | properties: example property group |
| 110 | error: xyz::openbmc_project::Common::Error::InvalidArgument |
| 111 | metadata: |
| 112 | - name: xyz::openbmc_project::Common::InvalidArgument::ARGUMENT_NAME |
| 113 | value: testing... |
| 114 | type: string |
| 115 | - name: xyz::openbmc_project::Common::InvalidArgument::ARGUMENT_VALUE |
| 116 | value: testing... |
| 117 | type: string |
| 118 | |
Matt Spinler | 3c5318d | 2018-02-19 14:03:05 -0600 | [diff] [blame] | 119 | - name: example elog with metadata capture callback |
| 120 | description: > |
| 121 | 'Callbacks are actions pdm should take when instructed to do so. |
| 122 | |
| 123 | This callback creates an elog, and it will capture the values of the |
| 124 | properties that passed its condition check in the metadata field |
| 125 | (that must be a string type) in the form: |
| 126 | |
| 127 | |path1:property1=value1|path2:property2=value2| |
| 128 | |
| 129 | Note that as this callback depends on the condition that called it to |
| 130 | fill in the result of its checks on each property, this callback should |
| 131 | use the same properties and paths keywords as the condition that calls it. |
| 132 | |
| 133 | Currently an error log with only 1 metadata entry of type string is |
| 134 | supported.' |
| 135 | |
| 136 | class: callback |
| 137 | callback: elog_with_metadata |
| 138 | paths: example path group |
| 139 | properties: example property group |
| 140 | error: xyz::openbmc_project::Common::Callout::Error::Inventory |
| 141 | metadata: xyz::openbmc_project::Common::Callout::Inventory::CALLOUT_INVENTORY_PATH |
| 142 | |
Ratan Gupta | 40e0db4 | 2017-10-13 20:20:43 +0530 | [diff] [blame] | 143 | - name: example event callback |
| 144 | description: > |
| 145 | 'Callbacks are actions PDM should take when instructed to do so. |
| 146 | |
| 147 | Some callback types refer to a group of paths and group of properties |
| 148 | in a similar fashion as the property watch directive. |
| 149 | |
| 150 | The event callback creates the event D-Bus object with the given name |
| 151 | and the event message. |
| 152 | eg /xyz/openbmc_project/events/test/<id>' |
| 153 | class: callback |
| 154 | callback: event |
| 155 | paths: example path group |
| 156 | properties: example property group |
| 157 | eventName: test |
| 158 | eventMessage: "Test configuration changed." |
| 159 | |
Brad Bishop | 0df00be | 2017-05-25 23:38:37 -0400 | [diff] [blame] | 160 | - name: example method callback |
| 161 | description: > |
Gunnar Mills | 2df09e2 | 2017-07-31 13:30:22 -0500 | [diff] [blame] | 162 | 'The method callback invokes the specified D-Bus method.' |
Brad Bishop | 0df00be | 2017-05-25 23:38:37 -0400 | [diff] [blame] | 163 | class: callback |
| 164 | callback: method |
| 165 | service: org.freedesktop.systemd1 |
| 166 | path: /org/freedesktop/systemd1 |
| 167 | interface: org.freedesktop.systemd1.Manager |
| 168 | method: StartUnit |
| 169 | args: |
| 170 | - value: foo.unit |
| 171 | type: string |
| 172 | - value: replace |
| 173 | type: string |
| 174 | |
Matt Spinler | f7a6a46 | 2017-11-01 10:51:19 -0500 | [diff] [blame] | 175 | - name: example resolve callouts callback |
| 176 | description: > |
| 177 | 'The resolve callout callback resolves all error log entries that |
| 178 | are associated with the inventory path specified by setting the |
| 179 | Resolved property in the entries to true. |
| 180 | |
| 181 | A use case could be to watch the Present property on the inventory |
| 182 | item and resolve all errors for it when a new one is plugged in and |
| 183 | the property changes to true.' |
| 184 | |
| 185 | class: callback |
| 186 | callback: resolve callout |
| 187 | paths: example path group |
| 188 | properties: example property group |
| 189 | callout: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0 |
| 190 | |
Brad Bishop | 49e6617 | 2017-05-23 19:16:21 -0400 | [diff] [blame] | 191 | - name: example callback group |
| 192 | description: > |
| 193 | 'Callbacks groups are simply named collections of other callbacks. |
| 194 | Configuration file directives can only refer to a single callback. |
| 195 | Through use of a group, these configuration file directives can |
| 196 | refer to more than one callback. |
| 197 | |
| 198 | For example for a given event, one may wish to trace multiple |
| 199 | messages to the systemd journal. The journal callback does not |
| 200 | support tracing multiple messages. To do that, define a callback |
Brad Bishop | 3539db6 | 2017-05-30 14:21:12 -0400 | [diff] [blame] | 201 | group composed of multiple journal callbacks.' |
Brad Bishop | 49e6617 | 2017-05-23 19:16:21 -0400 | [diff] [blame] | 202 | |
Brad Bishop | 49e6617 | 2017-05-23 19:16:21 -0400 | [diff] [blame] | 203 | class: callback |
| 204 | callback: group |
| 205 | members: |
| 206 | - example journal callback |
Brad Bishop | 3539db6 | 2017-05-30 14:21:12 -0400 | [diff] [blame] | 207 | - example deferred condition |
Gunnar Mills | acac602 | 2017-08-14 16:24:55 -0500 | [diff] [blame] | 208 | - example elog callback |
Brad Bishop | 4041d72 | 2017-05-21 10:06:07 -0400 | [diff] [blame] | 209 | |
| 210 | - name: example count condition |
| 211 | description: > |
| 212 | 'Conditions or conditional callbacks apply a test prior to invoking |
| 213 | the callback function. |
| 214 | |
| 215 | All conditional callbacks must specify the callback to issue if |
Gunnar Mills | 2df09e2 | 2017-07-31 13:30:22 -0500 | [diff] [blame] | 216 | the condition evaluates. |
Brad Bishop | 4041d72 | 2017-05-21 10:06:07 -0400 | [diff] [blame] | 217 | |
| 218 | The count condition applies the op comparison operator to the value of each |
| 219 | property in the specified groups. It then counts the number of properties |
| 220 | that pass the comparison, and applies another comparison on the result |
| 221 | against the specified bound. |
| 222 | |
| 223 | For example, a callback that requires at least three temperature sensors |
| 224 | in the group to be higher than 115 degrees might use a count condition |
Matt Spinler | c458dee | 2018-02-19 13:09:10 -0600 | [diff] [blame] | 225 | with an op of >, a count op of >=, a bound of 115, and a countbound of 3. |
| 226 | |
| 227 | The optional oneshot parameter defaults to false. If it is specified and |
| 228 | set to true, then the callback will only be called once for as long as the |
| 229 | condition is repeatedly passing. The condition needs to fail at least |
| 230 | once to rearm the callback.' |
Brad Bishop | 4041d72 | 2017-05-21 10:06:07 -0400 | [diff] [blame] | 231 | |
| 232 | class: condition |
| 233 | condition: count |
| 234 | paths: example path group |
| 235 | properties: example property group |
| 236 | callback: example callback group |
| 237 | countop: '>=' |
| 238 | countbound: 3 |
| 239 | op: '>=' |
| 240 | bound: 115 |
Matt Spinler | c458dee | 2018-02-19 13:09:10 -0600 | [diff] [blame] | 241 | oneshot: true |
Brad Bishop | 3539db6 | 2017-05-30 14:21:12 -0400 | [diff] [blame] | 242 | |
| 243 | - name: example deferred condition |
| 244 | description: > |
| 245 | 'Deferred conditions operate in the same fashion as conditional callbacks |
| 246 | with the added behavior that when the condition is tested and is met, |
| 247 | invocation of the callback is deferred by the interval specified. |
| 248 | |
| 249 | When the configured time has elapsed, if the condition has not been reevaluated |
| 250 | the callback is invoked. |
| 251 | |
| 252 | Any condition type can be deferred in this way by setting the defer attribute.' |
| 253 | |
| 254 | class: condition |
| 255 | condition: count |
| 256 | paths: example path group |
| 257 | properties: example property group |
| 258 | defer: 1000us |
| 259 | callback: example callback group |
| 260 | countop: '>=' |
| 261 | countbound: 3 |
| 262 | op: '>=' |
| 263 | bound: 115 |
Marri Devender Rao | 80c7061 | 2018-04-12 09:22:55 -0500 | [diff] [blame] | 264 | |
| 265 | - name: errorlog path group |
| 266 | class: group |
| 267 | group: path |
| 268 | members: |
| 269 | - meta: PATH |
| 270 | path: /xyz/openbmc_project/logging |
| 271 | |
| 272 | - name: pathwatch errorlog |
| 273 | description: > |
| 274 | 'A pathwatch watches on the specified object path goup. |
| 275 | pathcallback are actions PDM should take when instructed to do so.' |
| 276 | |
| 277 | class: pathwatch |
| 278 | pathwatch: path |
| 279 | paths: errorlog path group |
| 280 | pathcallback: create errorlog event |
| 281 | |
| 282 | - name: create errorlog event |
| 283 | description: > |
| 284 | 'eventType specifies the type of the SNMP notification.' |
| 285 | class: pathcallback |
| 286 | pathcallback: eventpath |
| 287 | paths: errorlog path group |
| 288 | eventType: ErrorTrap |