blob: 637dc30f0aa6d2e9d2a8ee95c29299531128f2ea [file] [log] [blame]
Zane Shelley90d12522021-07-20 13:20:10 -05001{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "title": "RAS Data schema for openpower-hw-diags",
4 "type": "object",
5 "additionalProperties": false,
6 "required": [ "model_ec", "version", "actions", "signatures" ],
7 "properties": {
8 "model_ec": {
9 "type": "string",
10 "pattern": "^[0-9A-Fa-f]{8}$"
11 },
12 "version": {
13 "type": "integer",
14 "minimum": 1
15 },
16 "units": {
17 "type": "object",
18 "additionalProperties": false,
19 "patternProperties": {
20 "^\\w+$": {
21 "type": "string",
22 "pattern": "^\\w+(\\/\\w+)*$"
23 }
24 }
25 },
26 "buses": {
27 "type": "object",
28 "additionalProperties": false,
29 "patternProperties": {
30 "^\\w+$": {
31 "type": "object",
32 "additionalProperties": false,
33 "required": [ "type" ],
34 "properties": {
35 "type": {
36 "type": "string",
37 "enum": [ "peer", "parent", "child" ]
38 },
39 "unit": {
40 "type": "string",
41 "pattern": "^\\w+$"
42 }
43 }
44 }
45 }
46 },
47 "actions": {
48 "type": "object",
49 "additionalProperties": false,
50 "patternProperties": {
51 "^\\w+$": {
52 "type": "array",
53 "items": {
54 "type": "object",
55 "required": [ "type" ],
56 "properties": {
57 "type": {
58 "type": "string",
59 "enum": [
60 "action",
61 "callout_self",
62 "callout_unit",
63 "callout_connected",
64 "callout_bus",
65 "callout_clock",
66 "callout_procedure",
67 "callout_part",
68 "plugin"
69 ]
70 },
71 "priority": {
72 "$id": "#priority",
73 "type": "string",
74 "enum": [
75 "HIGH",
76 "MED",
77 "MED_A",
78 "MED_B",
79 "MED_C",
80 "LOW"
81 ]
82 },
83 "guard": {
84 "type": "boolean"
85 },
86 "name": {
87 "type": "string",
88 "pattern": "^\\w+$"
89 }
90 },
91 "allOf": [
92 {
93 "if": {
94 "properties": {
95 "type": { "const": "action" }
96 }
97 },
98 "then": {
99 "required": [ "name" ],
100 "not": { "required": [ "priority", "guard" ] }
101 }
102 },
103 {
104 "if": {
105 "properties": {
106 "type": { "const": "callout_self" }
107 }
108 },
109 "then": {
110 "required": [ "priority", "guard" ],
111 "not": { "required": [ "name" ] }
112 }
113 },
114 {
115 "if": {
116 "properties": {
117 "type": { "const": "callout_unit" }
118 }
119 },
120 "then": {
121 "required": [ "name", "priority", "guard" ]
122 }
123 },
124 {
125 "if": {
126 "properties": {
127 "type": { "const": "callout_connected" }
128 }
129 },
130 "then": {
131 "required": [ "name", "priority", "guard" ]
132 }
133 },
134 {
135 "if": {
136 "properties": {
137 "type": { "const": "callout_bus" }
138 }
139 },
140 "then": {
141 "required": [ "name", "guard" ],
142 "not": { "required": [ "priority" ] },
143 "properties": {
144 "rx_priority": { "$ref": "#priority" },
145 "tx_priority": { "$ref": "#priority" }
146 }
147 }
148 },
149 {
150 "if": {
151 "properties": {
152 "type": { "const": "callout_clock" }
153 }
154 },
155 "then": {
156 "required": [ "priority", "guard", "position" ],
157 "not": { "required": [ "name" ] },
158 "properties": {
159 "position": {
160 "type": "integer",
161 "minimum": 0,
162 "maximum": 1
163 }
164 }
165 }
166 },
167 {
168 "if": {
169 "properties": {
170 "type": { "const": "callout_procedure" }
171 }
172 },
173 "then": {
174 "required": [ "name", "priority" ],
175 "not": { "required": [ "guard" ] },
176 "properties": {
177 "name": {
178 "enum": [
179 "LEVEL2"
180 ]
181 }
182 }
183 }
184 },
185 {
186 "if": {
187 "properties": {
188 "type": { "const": "callout_part" }
189 }
190 },
191 "then": {
192 "required": [ "name", "priority" ],
193 "not": { "required": [ "guard" ] },
194 "properties": {
195 "name": {
196 "enum": []
197 }
198 }
199 }
200 },
201 {
202 "if": {
203 "properties": {
204 "type": { "const": "plugin" }
205 }
206 },
207 "then": {
208 "required": [ "name" ],
209 "not": { "required": [ "priority", "guard" ] }
210 }
211 }
212 ]
213 }
214 }
215 }
216 },
217 "signatures": {
218 "type": "object",
219 "additionalProperties": false,
220 "patternProperties": {
221 "^[0-9A-Fa-f]{4}$": {
222 "type": "object",
223 "additionalProperties": false,
224 "patternProperties": {
225 "^[0-9A-Fa-f]{2}$": {
226 "type": "object",
227 "additionalProperties": false,
228 "patternProperties": {
229 "^[0-9A-Fa-f]{2}$": {
230 "type": "string",
231 "pattern": "^\\w+$"
232 }
233 }
234 }
235 }
236 }
237 }
238 }
239 }
240}