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