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