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