1# Machine power supply policy for PDM. 2# 3# Create an error if a power supply is removed while the system is powered on 4 5- name: power supply0 6 class: group 7 group: path 8 members: 9 - meta: POWER SUPPLY 10 path: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0 11 12- name: power supply1 13 class: group 14 group: path 15 members: 16 - meta: POWER SUPPLY 17 path: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1 18 19- name: power supplies 20 description: > 21 'The machine has two power supplies to monitor.' 22 class: group 23 group: path 24 members: 25 - meta: POWER SUPPLY 26 path: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0 27 - meta: POWER SUPPLY 28 path: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1 29 30- name: chassis state 31 description: > 32 'The machine has a single chassis to monitor.' 33 class: group 34 group: path 35 members: 36 - meta: CHASSISSTATE 37 path: /xyz/openbmc_project/state/chassis0 38 39- name: power supply present 40 description: > 41 'Monitor the presence state of each power supply.' 42 class: group 43 group: property 44 type: boolean 45 members: 46 - interface: xyz.openbmc_project.Inventory.Item 47 meta: PRESENT 48 property: Present 49 50- name: chassis powered 51 description: > 52 'Monitor the chassis power state.' 53 class: group 54 group: property 55 type: string 56 members: 57 - interface: xyz.openbmc_project.State.Chassis 58 meta: CHASSIS_STATE 59 property: CurrentPowerState 60 61- name: watch power supply present 62 description: > 63 'Trigger logic on power supply presence state changes.' 64 class: watch 65 watch: property 66 paths: power supplies 67 properties: power supply present 68 callback: check power 69 70- name: watch chassis state 71 description: > 72 'Trigger logic on chassis power state changes.' 73 class: watch 74 watch: property 75 paths: chassis state 76 properties: chassis powered 77 callback: check power 78 79- name: check power 80 description: > 81 'If the chassis has power, check for power supplies.' 82 class: condition 83 condition: count 84 paths: chassis state 85 properties: chassis powered 86 callback: check power supplies 87 countop: '>' 88 countbound: 0 89 op: '==' 90 bound: xyz.openbmc_project.State.Chassis.PowerState.On 91 92- name: check power supplies 93 description: > 94 'Create an error if a power supply is not present.' 95 class: callback 96 callback: group 97 members: 98 - check power supply0 presence 99 - check power supply1 presence 100 101- name: check power supply0 presence 102 description: > 103 'If this condition passes power supply0 has been unplugged for more than 104 5 seconds. Count present power supplies rather than non-present 105 power supplies since the latter would pass if the power supply has not 106 been created for some reason. 107 108 For a more detailed definition of unplugged, consult the documentation 109 of xyz.openbmc_project.Inventory.Item and/or the documentation 110 of the power supply inventory object implementation.' 111 class: condition 112 condition: count 113 paths: power supply0 114 properties: power supply present 115 defer: 5000000us 116 callback: notpresent power supply0 error 117 countop: '<' 118 countbound: 1 119 op: '==' 120 bound: true 121 122- name: check power supply1 presence 123 description: > 124 'If this condition passes power supply1 has been unplugged for more than 125 5 seconds.' 126 class: condition 127 condition: count 128 paths: power supply1 129 properties: power supply present 130 defer: 5000000us 131 callback: notpresent power supply1 error 132 countop: '<' 133 countbound: 1 134 op: '==' 135 bound: true 136 137- name: notpresent power supply0 error 138 class: callback 139 callback: elog 140 paths: power supply0 141 properties: power supply present 142 error: xyz::openbmc_project::Inventory::Error::NotPresent 143 metadata: 144 - name: xyz::openbmc_project::Inventory::NotPresent::CALLOUT_INVENTORY_PATH 145 value: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0 146 type: string 147 148- name: notpresent power supply1 error 149 class: callback 150 callback: elog 151 paths: power supply1 152 properties: power supply present 153 error: xyz::openbmc_project::Inventory::Error::NotPresent 154 metadata: 155 - name: xyz::openbmc_project::Inventory::NotPresent::CALLOUT_INVENTORY_PATH 156 value: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1 157 type: string 158 159- name: resolve power supply0 errors if present 160 description: > 161 'If power supply0 is present, call the resolve ps0 errors callback.' 162 class: condition 163 condition: count 164 paths: power supply0 165 properties: power supply present 166 callback: resolve power supply0 errors 167 countop: '>' 168 countbound: 0 169 op: '==' 170 bound: true 171 172- name: resolve power supply1 errors if present 173 description: > 174 'If power supply1 is present, call the resolve ps1 errors callback.' 175 class: condition 176 condition: count 177 paths: power supply1 178 properties: power supply present 179 callback: resolve power supply1 errors 180 countop: '>' 181 countbound: 0 182 op: '==' 183 bound: true 184 185- name: resolve power supply0 errors 186 class: callback 187 callback: resolve callout 188 paths: power supply0 189 properties: power supply present 190 callout: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0 191 192- name: resolve power supply1 errors 193 class: callback 194 callback: resolve callout 195 paths: power supply1 196 properties: power supply present 197 callout: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1 198 199- name: watch power supply0 present for resolving error logs 200 description: > 201 'On supply present state changes, check if errors need to be resolved.' 202 class: watch 203 watch: property 204 paths: power supply0 205 properties: power supply present 206 callback: resolve power supply0 errors if present 207 208- name: watch power supply1 present for resolving error logs 209 description: > 210 'On supply present state changes, check if errors need to be resolved.' 211 class: watch 212 watch: property 213 paths: power supply1 214 properties: power supply present 215 callback: resolve power supply1 errors if present 216