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