summaryrefslogtreecommitdiffstats
path: root/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-power-supply-policy/power-supply-policy.yaml
blob: 20141c9c3029d8c158de5876663506fe0c6b7622 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Witherspoon power supply policy for PDM.
#
# Create an error if a power supply is removed while the system is powered on

- name: power supply0
  class: group
  group: path
  members:
    - meta: POWER SUPPLY
      path: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0

- name: power supply1
  class: group
  group: path
  members:
    - meta: POWER SUPPLY
      path: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1

- name: power supplies
  description: >
    'A Witherspoon has two power supplies to monitor.'
  class: group
  group: path
  members:
    - meta: POWER SUPPLY
      path: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0
    - meta: POWER SUPPLY
      path: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1

- name: chassis state
  description: >
    'A Witherspoon has a single chassis to monitor.'
  class: group
  group: path
  members:
    - meta: CHASSISSTATE
      path: /xyz/openbmc_project/state/chassis0

- name: power supply present
  description: >
    'Monitor the presence state of each power supply.'
  class: group
  group: property
  type: boolean
  members:
    - interface: xyz.openbmc_project.Inventory.Item
      meta: PRESENT
      property: Present

- name: chassis powered
  description: >
    'Monitor the chassis power state.'
  class: group
  group: property
  type: string
  members:
    - interface: xyz.openbmc_project.State.Chassis
      meta: CHASSIS_STATE
      property: CurrentPowerState

- name: watch power supply present
  description: >
    'Trigger logic on power supply presence state changes.'
  class: watch
  watch: property
  paths: power supplies
  properties: power supply present
  callback: check power

- name: watch chassis state
  description: >
    'Trigger logic on chassis power state changes.'
  class: watch
  watch: property
  paths: chassis state
  properties: chassis powered
  callback: check power

- name: check power
  description: >
    'If the chassis has power, check for power supplies.'
  class: condition
  condition: count
  paths: chassis state
  properties: chassis powered
  callback: check power supplies
  countop: '>'
  countbound: 0
  op: '=='
  bound: xyz.openbmc_project.State.Chassis.PowerState.On

- name: check power supplies
  description: >
    'Create an error if a power supply is not present.'
  class: callback
  callback: group
  members:
    - check power supply0 presence
    - check power supply1 presence

- name: check power supply0 presence
  description: >
    'If this condition passes power supply0 has been unplugged for more than
     5 seconds. Count present power supplies rather than non-present
     power supplies since the latter would pass if the power supply has not
     been created for some reason.

    For a more detailed definition of unplugged, consult the documentation
    of xyz.openbmc_project.Inventory.Item and/or the documentation
    of the power supply inventory object implementation.'
  class: condition
  condition: count
  paths: power supply0
  properties: power supply present
  defer: 5000000us
  callback: notpresent power supply0 error
  countop: '<'
  countbound: 1
  op: '=='
  bound: true

- name: check power supply1 presence
  description: >
    'If this condition passes power supply1 has been unplugged for more than
     5 seconds.'
  class: condition
  condition: count
  paths: power supply1
  properties: power supply present
  defer: 5000000us
  callback: notpresent power supply1 error
  countop: '<'
  countbound: 1
  op: '=='
  bound: true

- name: notpresent power supply0 error
  class: callback
  callback: elog
  paths: power supply0
  properties: power supply present
  error: xyz::openbmc_project::Inventory::Error::NotPresent
  metadata:
    - name: xyz::openbmc_project::Inventory::NotPresent::CALLOUT_INVENTORY_PATH
      value: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0
      type: string

- name: notpresent power supply1 error
  class: callback
  callback: elog
  paths: power supply1
  properties: power supply present
  error: xyz::openbmc_project::Inventory::Error::NotPresent
  metadata:
    - name: xyz::openbmc_project::Inventory::NotPresent::CALLOUT_INVENTORY_PATH
      value: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1
      type: string

- name: resolve power supply0 errors if present
  description: >
    'If power supply0 is present, call the resolve ps0 errors callback.'
  class: condition
  condition: count
  paths: power supply0
  properties: power supply present
  callback: resolve power supply0 errors
  countop: '>'
  countbound: 0
  op: '=='
  bound: true

- name: resolve power supply1 errors if present
  description: >
    'If power supply1 is present, call the resolve ps1 errors callback.'
  class: condition
  condition: count
  paths: power supply1
  properties: power supply present
  callback: resolve power supply1 errors
  countop: '>'
  countbound: 0
  op: '=='
  bound: true

- name: resolve power supply0 errors
  class: callback
  callback: resolve callout
  paths: power supply0
  properties: power supply present
  callout: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0

- name: resolve power supply1 errors
  class: callback
  callback: resolve callout
  paths: power supply1
  properties: power supply present
  callout: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1

- name: watch power supply0 present for resolving error logs
  description: >
    'On supply present state changes, check if errors need to be resolved.'
  class: watch
  watch: property
  paths: power supply0
  properties: power supply present
  callback: resolve power supply0 errors if present

- name: watch power supply1 present for resolving error logs
  description: >
    'On supply present state changes, check if errors need to be resolved.'
  class: watch
  watch: property
  paths: power supply1
  properties: power supply present
  callback: resolve power supply1 errors if present
OpenPOWER on IntegriCloud