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