1{
2    "$schema": "https://json-schema.org/draft/2020-12/schema",
3    "title": "RAS Data schema for openpower-hw-diags",
4    "version": 2,
5    "type": "object",
6    "$defs": {
7        "priority": {
8            "type": "string",
9            "enum": ["HIGH", "MED", "MED_A", "MED_B", "MED_C", "LOW"]
10        },
11        "flags": {
12            "type": "string",
13            "enum": [
14                "sue_source",
15                "sue_seen",
16                "cs_possible",
17                "external_checkstop",
18                "recovered_error",
19                "informational_only",
20                "mnfg_informational_only",
21                "mask_but_dont_clear",
22                "crc_related_err",
23                "crc_root_cause",
24                "odp_data_corrupt_side_effect",
25                "odp_data_corrupt_root_cause"
26            ]
27        }
28    },
29    "additionalProperties": false,
30    "required": ["model_ec", "version", "actions", "signatures"],
31    "properties": {
32        "model_ec": {
33            "type": "string",
34            "pattern": "^[0-9A-Fa-f]{8}$"
35        },
36        "version": {
37            "type": "integer",
38            "minimum": 1
39        },
40        "units": {
41            "type": "object",
42            "additionalProperties": false,
43            "patternProperties": {
44                "^\\w+$": {
45                    "type": "string",
46                    "pattern": "^\\w+(\\/\\w+)*$"
47                }
48            }
49        },
50        "buses": {
51            "type": "object",
52            "additionalProperties": false,
53            "patternProperties": {
54                "^\\w+$": {
55                    "type": "object",
56                    "additionalProperties": false,
57                    "required": ["type"],
58                    "properties": {
59                        "type": {
60                            "type": "string",
61                            "enum": ["SMP_BUS", "OMI_BUS"]
62                        },
63                        "unit": {
64                            "type": "string",
65                            "pattern": "^\\w+$"
66                        }
67                    }
68                }
69            }
70        },
71        "actions": {
72            "type": "object",
73            "additionalProperties": false,
74            "patternProperties": {
75                "^\\w+$": {
76                    "type": "array",
77                    "items": {
78                        "type": "object",
79                        "required": ["type"],
80                        "properties": {
81                            "type": {
82                                "type": "string",
83                                "enum": [
84                                    "action",
85                                    "callout_self",
86                                    "callout_unit",
87                                    "callout_connected",
88                                    "callout_bus",
89                                    "callout_clock",
90                                    "callout_procedure",
91                                    "callout_part",
92                                    "plugin",
93                                    "flag"
94                                ]
95                            },
96                            "priority": {
97                                "$ref": "#/$defs/priority"
98                            },
99                            "guard": {
100                                "type": "boolean"
101                            },
102                            "name": {
103                                "type": "string",
104                                "pattern": "^\\w+$"
105                            }
106                        },
107                        "allOf": [
108                            {
109                                "if": {
110                                    "properties": {
111                                        "type": { "const": "action" }
112                                    }
113                                },
114                                "then": {
115                                    "required": ["name"],
116                                    "not": { "required": ["priority", "guard"] }
117                                }
118                            },
119                            {
120                                "if": {
121                                    "properties": {
122                                        "type": { "const": "callout_self" }
123                                    }
124                                },
125                                "then": {
126                                    "required": ["priority", "guard"],
127                                    "not": { "required": ["name"] }
128                                }
129                            },
130                            {
131                                "if": {
132                                    "properties": {
133                                        "type": { "const": "callout_unit" }
134                                    }
135                                },
136                                "then": {
137                                    "required": ["name", "priority", "guard"]
138                                }
139                            },
140                            {
141                                "if": {
142                                    "properties": {
143                                        "type": { "const": "callout_connected" }
144                                    }
145                                },
146                                "then": {
147                                    "required": ["name", "priority", "guard"]
148                                }
149                            },
150                            {
151                                "if": {
152                                    "properties": {
153                                        "type": { "const": "callout_bus" }
154                                    }
155                                },
156                                "then": {
157                                    "required": ["name", "priority", "guard"]
158                                }
159                            },
160                            {
161                                "if": {
162                                    "properties": {
163                                        "type": { "const": "callout_clock" }
164                                    }
165                                },
166                                "then": {
167                                    "required": ["name", "priority", "guard"],
168                                    "properties": {
169                                        "name": {
170                                            "enum": [
171                                                "OSC_REF_CLOCK_0",
172                                                "OSC_REF_CLOCK_1",
173                                                "TOD_CLOCK"
174                                            ]
175                                        }
176                                    }
177                                }
178                            },
179                            {
180                                "if": {
181                                    "properties": {
182                                        "type": { "const": "callout_procedure" }
183                                    }
184                                },
185                                "then": {
186                                    "required": ["name", "priority"],
187                                    "not": { "required": ["guard"] },
188                                    "properties": {
189                                        "name": {
190                                            "enum": ["LEVEL2", "SUE_SEEN"]
191                                        }
192                                    }
193                                }
194                            },
195                            {
196                                "if": {
197                                    "properties": {
198                                        "type": { "const": "callout_part" }
199                                    }
200                                },
201                                "then": {
202                                    "required": ["name", "priority"],
203                                    "not": { "required": ["guard"] },
204                                    "properties": {
205                                        "name": {
206                                            "enum": ["PNOR"]
207                                        }
208                                    }
209                                }
210                            },
211                            {
212                                "if": {
213                                    "properties": {
214                                        "type": { "const": "plugin" }
215                                    }
216                                },
217                                "then": {
218                                    "required": ["name", "instance"],
219                                    "not": {
220                                        "required": ["priority", "guard"]
221                                    },
222                                    "properties": {
223                                        "instance": {
224                                            "type": "integer"
225                                        }
226                                    }
227                                }
228                            },
229                            {
230                                "if": {
231                                    "properties": {
232                                        "type": { "const": "flag" }
233                                    }
234                                },
235                                "then": {
236                                    "required": ["name"],
237                                    "properties": {
238                                        "name": {
239                                            "$ref": "#/$defs/flags"
240                                        }
241                                    }
242                                }
243                            }
244                        ]
245                    }
246                }
247            }
248        },
249        "signatures": {
250            "type": "object",
251            "additionalProperties": false,
252            "patternProperties": {
253                "^[0-9A-Fa-f]{4}$": {
254                    "type": "object",
255                    "additionalProperties": false,
256                    "patternProperties": {
257                        "^[0-9A-Fa-f]{2}$": {
258                            "type": "object",
259                            "additionalProperties": false,
260                            "patternProperties": {
261                                "^[0-9A-Fa-f]{2}$": {
262                                    "type": "string",
263                                    "pattern": "^\\w+$"
264                                },
265                                "flags": {
266                                    "type": "array",
267                                    "minItems": 1,
268                                    "uniqueItems": true,
269                                    "items": {
270                                        "$ref": "#/$defs/flags"
271                                    }
272                                }
273                            }
274                        }
275                    }
276                }
277            }
278        }
279    }
280}
281