Add xApp pod annotation suport
[it/dev.git] / xapp_onboarder / xapp_onboarder / helm_controller / xapp_schema.py
1 ################################################################################
2 #   Copyright (c) 2020 AT&T Intellectual Property.                             #
3 #                                                                              #
4 #   Licensed under the Apache License, Version 2.0 (the "License");            #
5 #   you may not use this file except in compliance with the License.           #
6 #   You may obtain a copy of the License at                                    #
7 #                                                                              #
8 #       http://www.apache.org/licenses/LICENSE-2.0                             #
9 #                                                                              #
10 #   Unless required by applicable law or agreed to in writing, software        #
11 #   distributed under the License is distributed on an "AS IS" BASIS,          #
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
13 #   See the License for the specific language governing permissions and        #
14 #   limitations under the License.                                             #
15 ################################################################################
16
17 schema = {
18     "$schema": "http://json-schema.org/draft-07/schema#",
19     "$id": "http://o-ran-sc.org/xapp_root.json",
20     "type": "object",
21     "title": "The xApp Root Schema",
22     "required": [
23         "xapp_name",
24         "version",
25         "containers"
26     ],
27     "properties": {
28         "xapp_name": {
29             "$id": "#/properties/xapp_name",
30             "type": "string",
31             "title": "The xApp Name",
32             "default": "xapp",
33             "examples": [
34                 "example_xapp"
35             ]
36         },
37         "version": {
38             "$id": "#/properties/version",
39             "type": "string",
40             "title": "The xApp version",
41             "default": "1.0.0",
42             "examples": [
43                 "1.0.0"
44             ],
45             "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
46         },
47         "annotations": {
48             "$id": "#/properties/annotation",
49             "type": "object",
50             "title": "The k8s pod annotation",
51             "additionalProperties": {
52                 "anyOf": [
53                     { "type": "string" },
54                     {
55                         "type": "array",
56                         "items": {
57                             "type": "object"
58                         }
59                     }
60                 ]
61             }
62         },
63         "containers": {
64             "$id": "#/properties/containers",
65             "type": "array",
66             "title": "The Container Schema",
67             "items": {
68                 "$id": "#/properties/containers/items",
69                 "type": "object",
70                 "title": "The Container Items Schema",
71                 "required": [
72                     "name",
73                     "image"
74                 ],
75                 "properties": {
76                     "name": {
77                         "$id": "#/properties/containers/items/properties/name",
78                         "type": "string",
79                         "title": "The xApp Container Name",
80                         "default": "xapp",
81                         "examples": [
82                             "xapp"
83                         ]
84                     },
85                     "image": {
86                         "$id": "#/properties/containers/items/properties/image",
87                         "type": "object",
88                         "title": "The Container Image",
89                         "required": [
90                             "registry",
91                             "name",
92                             "tag"
93                         ],
94                         "properties": {
95                             "registry": {
96                                 "$id": "#/properties/containers/items/properties/image/properties/registry",
97                                 "type": "string",
98                                 "title": "The xApp Image Registry",
99                                 "default": "nexus3.o-ran-sc.org:10002",
100                                 "examples": [
101                                     "nexus3.o-ran-sc.org:10002"
102                                 ],
103                                 "pattern": "^[A-Za-z0-9\\.-]{1,}\\.[A-Za-z]{1,}(?:\\:\\d+)?$"
104                             },
105                             "name": {
106                                 "$id": "#/properties/containers/items/properties/image/properties/name",
107                                 "type": "string",
108                                 "title": "The xApp Image Name",
109                                 "default": "xapp",
110                                 "examples": [
111                                     "xapp"
112                                 ]
113                             },
114                             "tag": {
115                                 "$id": "#/properties/containers/items/properties/image/properties/tag",
116                                 "type": "string",
117                                 "title": "The xApp Image Tag",
118                                 "default": "latest",
119                                 "examples": [
120                                     "latest"
121                                 ]
122                             }
123                         }
124                     },
125                     "command": {
126                         "$id": "#/properties/containers/items/properties/command",
127                         "type": "array",
128                         "items": [
129                             {
130                                 "$id": "#/properties/containers/items/properties/command/item",
131                                 "type": "string",
132                                 "title": "The Command Item",
133                                 "default": "/bin/sh",
134                                 "examples": [
135                                     "/bin/sh"
136                                 ]
137                             }
138                         ]
139                     },
140                     "args": {
141                         "$id": "#/properties/containers/items/properties/args",
142                         "type": "array",
143                         "items": [
144                             {
145                                 "$id": "#/properties/containers/items/properties/args/item",
146                                 "type": "string",
147                                 "title": "The Command Arguement Item",
148                                 "default": "-c",
149                                 "examples": [
150                                     "-c"
151                                 ]
152                             }
153                         ]
154                     }
155                 }
156             }
157         },
158         "livenessProbe": {
159             "$id": "#/properties/livenessprobe",
160             "type": "object",
161             "title": "The Liveness Probe Definition",
162             "properties": {
163                 "exec": {
164                     "$id": "#/properties/livenessprobe/exec",
165                     "type": "object",
166                     "title": "Script of Liveness Probe",
167                     "properties": {
168                         "command": {
169                             "$id": "#/properties/livenessprobe/exec/command",
170                             "type": "array",
171                             "items": [
172                                 {
173                                     "$id": "#/properties/livenessprobe/exec/command/item",
174                                     "type": "string",
175                                     "title": "The Command Item",
176                                     "default": "/bin/sh",
177                                     "examples": [
178                                         "/bin/sh"
179                                     ]
180                                 }
181                             ]
182                         }
183                     },
184                     "required": [
185                         "command"
186                     ]
187                 },
188                 "httpGet": {
189                     "$id": "#/properties/livenessprobe/httpget",
190                     "type": "object",
191                     "title": "Http of Liveness Probe",
192                     "properties": {
193                         "path": {
194                             "$id": "#/properties/livenessprobe/httpget/path",
195                             "type": "string",
196                             "title": "The Path of Http Liveness Probe",
197                             "default": "/health",
198                             "examples": [
199                                 "/health"
200                             ]
201                         },
202                         "port": {
203                             "$id": "#/properties/livenessprobe/httpget/port",
204                             "type": "integer",
205                             "title": "The Port of Http Liveness Probe",
206                             "default": 80,
207                             "examples": [
208                                 80
209                             ]
210                         }
211                     },
212                     "required": [
213                         "path",
214                         "port"
215                     ]
216                 },
217                 "initialDelaySeconds": {
218                     "$id": "#/properties/livenessprobe/initialdelayseconds",
219                     "type": "integer",
220                     "title": "Initial Delay of Liveness Probe",
221                     "default": 5,
222                     "examples": [
223                         5
224                     ]
225                 },
226                 "periodSeconds": {
227                     "$id": "#/properties/livenessprobe/periodseconds",
228                     "type": "integer",
229                     "title": "Period of Liveness Probe",
230                     "default": 15,
231                     "examples": [
232                         15
233                     ]
234                 }
235             },
236             "oneOf": [
237                 {
238                     "$id": "#/properties/livenessprobe/oneof/exec",
239                     "required": ["exec", "initialDelaySeconds", "periodSeconds"]
240                 },
241                 {
242                     "$id": "#/properties/livenessprobe/oneof/httpget",
243                     "required": ["httpGet", "initialDelaySeconds", "periodSeconds"]
244                 }
245             ]
246         },
247         "readinessProbe": {
248             "$id": "#/properties/readinessprobe",
249             "type": "object",
250             "title": "The Readiness Probe Definition",
251             "properties": {
252                 "exec": {
253                     "$id": "#/properties/readinessprobe/exec",
254                     "type": "object",
255                     "title": "Script of Readiness Probe",
256                     "properties": {
257                         "command": {
258                             "$id": "#/properties/readinessprobe/exec/command",
259                             "type": "array",
260                             "items": [
261                                 {
262                                     "type": "string"
263                                 }
264                             ]
265                         }
266                     },
267                     "required": [
268                         "command"
269                     ]
270                 },
271                 "httpGet": {
272                     "$id": "#/properties/readinessprobe/httpget",
273                     "type": "object",
274                     "title": "Http of Readiness Probe",
275                     "properties": {
276                         "path": {
277                             "$id": "#/properties/readinessprobe/httpget/path",
278                             "type": "string",
279                             "title": "The Path of Http Readiness Probe",
280                             "default": "/health",
281                             "examples": [
282                                 "/health"
283                             ]
284                         },
285                         "port": {
286                             "$id": "#/properties/readinessprobe/httpget/port",
287                             "type": "integer",
288                             "title": "The Port of Http Readiness Probe",
289                             "default": 80,
290                             "examples": [
291                                 80
292                             ]
293                         }
294                     },
295                     "required": [
296                         "path",
297                         "port"
298                     ]
299                 },
300                 "initialDelaySeconds": {
301                     "$id": "#/properties/readinessprobe/initialdelayseconds",
302                     "type": "integer",
303                     "title": "Initial Delay of Readiness Probe",
304                     "default": 5,
305                     "examples": [
306                         5
307                     ]
308                 },
309                 "periodSeconds": {
310                     "$id": "#/properties/readinessprobe/periodseconds",
311                     "type": "integer",
312                     "title": "Period of Readiness Probe",
313                     "default": 15,
314                     "examples": [
315                         15
316                     ]
317                 }
318             },
319             "oneOf": [
320                 {
321                     "$id": "#/properties/readinessprobe/oneof/exec",
322                     "required": ["exec", "initialDelaySeconds", "periodSeconds"]
323                 },
324                 {
325                     "$id": "#/properties/readinessprobe/oneof/httpget",
326                     "required": ["httpGet", "initialDelaySeconds", "periodSeconds"]
327                 }
328             ]
329         },
330         "messaging": {
331             "type": "object",
332             "$id": "#/properties/messaging",
333             "title": "The Messaging Schema",
334             "properties": {
335                 "ports": {
336                     "$id": "#/properties/messaging/ports",
337                     "type": "array",
338                     "title": "The Ports for Messaging",
339                     "items": {
340                         "$id": "#/properties/messaging/ports/items",
341                         "type": "object",
342                         "title": "The Item of Port",
343                         "required": ["name", "container", "port"],
344                         "dependencies": {
345                             "txMessages": ["rxMessages", "policies"],
346                             "rxMessages": ["txMessages", "policies"],
347                             "policies": ["rxMessages", "txMessages"]
348                         },
349                         "properties": {
350                             "name": {
351                                 "$id": "#/properties/messaging/ports/items/name",
352                                 "type": "string",
353                                 "title": "The Name of the Port",
354                                 "default": "App",
355                                 "examples": [
356                                     "App"
357                                 ]
358                             },
359                             "container": {
360                                 "$id": "#/properties/messaging/ports/items/container",
361                                 "type": "string",
362                                 "title": "The Container of the Port",
363                                 "default": "xapp",
364                                 "examples": [
365                                     "xapp"
366                                 ]
367                             },
368                             "port": {
369                                 "$id": "#/properties/messaging/ports/items/port",
370                                 "type": "integer",
371                                 "title": "The Port Number",
372                                 "default": 8080,
373                                 "examples": [
374                                     8080
375                                 ]
376                             },
377                             "description": {
378                                 "$id": "#/properties/messaging/ports/items/description",
379                                 "type": "string",
380                                 "title": "The description for the port",
381                                 "default": "port description",
382                                 "examples": [
383                                     "port description"
384                                 ]
385                             },
386                             "txMessages": {
387                                 "$id": "#/properties/messaging/ports/items/txmessages",
388                                 "type": "array",
389                                 "title": "The txMessage Types",
390                                 "items": {
391                                     "$id": "#/properties/messaging/ports/items//txmessages/item",
392                                     "type": "string",
393                                     "title": "The txMessage Types Item",
394                                     "default": "RIC_SUB",
395                                     "examples": [
396                                         "RIC_SUB"
397                                     ]
398                                 }
399                             },
400                             "rxMessages": {
401                                 "$id": "#/properties/messaging/ports/items/rxmessages",
402                                 "type": "array",
403                                 "title": "The rxMessage Types",
404                                 "items": {
405                                     "$id": "#/properties/messaging/ports/items/rxmessages/item",
406                                     "type": "string",
407                                     "title": "The rxMessage Types Item",
408                                     "default": "RIC_SUB",
409                                     "examples": [
410                                         "RIC_SUB"
411                                     ]
412                                 }
413                             },
414                             "policies": {
415                                 "$id": "#/properties/messaging/ports/items/policies",
416                                 "type": "array",
417                                 "title": "The Policies Types",
418                                 "items": {
419                                     "$id": "#/properties/messaging/ports/items/policies/item",
420                                     "type": "integer",
421                                     "title": "The Policy Types Item",
422                                     "default": 1,
423                                     "examples": [
424                                         1
425                                     ]
426                                 }
427                             }
428                         }
429                     }
430                 }
431             },
432             "required": [
433                 "ports"
434             ]
435
436         },
437         "metrics": {
438             "type": "array",
439             "$id": "#/properties/metrics",
440             "title": "The Metrics Schema",
441             "items": {
442                 "$id": "#/properties/metrics/items",
443                 "type": "object",
444                 "title": "The Metrics Items Schema",
445                 "required": [
446                     "objectName",
447                     "objectInstance",
448                     "name",
449                     "type",
450                     "description"
451                 ],
452                 "properties": {
453                     "objectName": {
454                         "$id": "#/properties/metrics/items/objectname",
455                         "type": "string",
456                         "title": "The Object Name"
457                     },
458                     "objectInstance": {
459                         "$id": "#/properties/metrics/items/objectinstance",
460                         "type": "string",
461                         "title": "The Object Instance"
462                     },
463                     "name": {
464                         "$id": "#/properties/metrics/items/name",
465                         "type": "string",
466                         "title": "The Object Name"
467                     },
468                     "type": {
469                         "$id": "#/properties/metrics/items/type",
470                         "type": "string",
471                         "title": "The Object Type"
472                     },
473                     "description": {
474                         "$id": "#/properties/metrics/items/description",
475                         "type": "string",
476                         "title": "The Object Description"
477                     }
478                 }
479             }
480         },
481         "controls": {
482             "required": [
483                 "__empty_control_section__"
484             ]
485         }
486
487     }
488 }