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