0a52b6ad43930ba31abfd07f5265c07087574d3d
[it/dev.git] / xapp_onboarder / tests / constants.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_file = {
18     "$schema": "http://json-schema.org/draft-07/schema#",
19     "$id": "http://example.com/root.json",
20     "type": "object",
21     "title": "The Root Schema",
22     "required": [
23         "local",
24         "logger",
25         "rmr",
26         "db",
27         "controls",
28         "metrics"
29     ],
30     "properties": {
31         "local": {
32             "$id": "#/properties/local",
33             "type": "object",
34             "title": "The Local Schema",
35             "required": [
36                 "host"
37             ],
38             "properties": {
39                 "host": {
40                     "$id": "#/properties/local/properties/host",
41                     "type": "string",
42                     "title": "The Host Schema",
43                     "default": "",
44                     "examples": [
45                         ":8080"
46                     ],
47                     "pattern": "^(.*)$"
48                 }
49             }
50         },
51         "logger": {
52             "$id": "#/properties/logger",
53             "type": "object",
54             "title": "The Logger Schema",
55             "required": [
56                 "level"
57             ],
58             "properties": {
59                 "level": {
60                     "$id": "#/properties/logger/properties/level",
61                     "type": "integer",
62                     "title": "The Level Schema",
63                     "default": 0,
64                     "examples": [
65                         3
66                     ]
67                 }
68             }
69         },
70         "rmr": {
71             "$id": "#/properties/rmr",
72             "type": "object",
73             "title": "The Rmr Schema",
74             "required": [
75                 "protPort",
76                 "maxSize",
77                 "numWorkers",
78                 "rxMessages",
79                 "txMessages"
80             ],
81             "properties": {
82                 "protPort": {
83                     "$id": "#/properties/rmr/properties/protPort",
84                     "type": "string",
85                     "title": "The Protport Schema",
86                     "default": "",
87                     "examples": [
88                         "tcp:4560"
89                     ],
90                     "pattern": "^(.*)$"
91                 },
92                 "maxSize": {
93                     "$id": "#/properties/rmr/properties/maxSize",
94                     "type": "integer",
95                     "title": "The Maxsize Schema",
96                     "default": 0,
97                     "examples": [
98                         2072
99                     ]
100                 },
101                 "numWorkers": {
102                     "$id": "#/properties/rmr/properties/numWorkers",
103                     "type": "integer",
104                     "title": "The Numworkers Schema",
105                     "default": 0,
106                     "examples": [
107                         1
108                     ]
109                 },
110                 "rxMessages": {
111                     "$id": "#/properties/rmr/properties/rxMessages",
112                     "type": "array",
113                     "title": "The Rxmessages Schema",
114                     "items": {
115                         "$id": "#/properties/rmr/properties/rxMessages/items",
116                         "type": "string",
117                         "title": "The Items Schema",
118                         "default": "",
119                         "examples": [
120                             "RIC_SUB_RESP",
121                             "RIC_SUB_FAILURE",
122                             "RIC_SUB_DEL_RESP",
123                             "RIC_SUB_DEL_FAILURE",
124                             "RIC_INDICATION"
125                         ],
126                         "pattern": "^(.*)$"
127                     }
128                 },
129                 "txMessages": {
130                     "$id": "#/properties/rmr/properties/txMessages",
131                     "type": "array",
132                     "title": "The Txmessages Schema",
133                     "items": {
134                         "$id": "#/properties/rmr/properties/txMessages/items",
135                         "type": "string",
136                         "title": "The Items Schema",
137                         "default": "",
138                         "examples": [
139                             "RIC_SUB_REQ",
140                             "RIC_SUB_DEL_REQ",
141                             "RIC_SGNB_ADDITION_REQ",
142                             "RIC_SGNB_ADDITION_ACK",
143                             "RIC_SGNB_ADDITION_REJECT",
144                             "RIC_SGNB_MOD_REQUEST",
145                             "RIC_SGNB_MOD_REQUEST_ACK",
146                             "RIC_SGNB_MOD_REQUEST_REJECT",
147                             "RIC_SGNB_MOD_REQUIRED",
148                             "RIC_SGNB_MOD_CONFIRM",
149                             "RIC_SGNB_MOD_REFUSE",
150                             "RIC_SGNB_RECONF_COMPLETE",
151                             "RIC_SGNB_RELEASE_REQUEST",
152                             "RIC_SGNB_RELEASE_CONFIRM",
153                             "RIC_SGNB_RELEASE_REQUIRED",
154                             "RIC_SGNB_RELEASE_REQUEST_ACK",
155                             "RIC_SECONDARY_RAT_DATA_USAGE_REPORT",
156                             "RIC_SN_STATUS_TRANSFER",
157                             "RIC_RRC_TRANSFER",
158                             "RIC_UE_CONTEXT_RELEASE"
159                         ],
160                         "pattern": "^(.*)$"
161                     }
162                 }
163             }
164         },
165         "db": {
166             "$id": "#/properties/db",
167             "type": "object",
168             "title": "The Db Schema",
169             "required": [
170                 "host",
171                 "port",
172                 "namespaces"
173             ],
174             "properties": {
175                 "host": {
176                     "$id": "#/properties/db/properties/host",
177                     "type": "string",
178                     "title": "The Host Schema",
179                     "default": "",
180                     "examples": [
181                         "localhost"
182                     ],
183                     "pattern": "^(.*)$"
184                 },
185                 "port": {
186                     "$id": "#/properties/db/properties/port",
187                     "type": "integer",
188                     "title": "The Port Schema",
189                     "default": 0,
190                     "examples": [
191                         6379
192                     ]
193                 },
194                 "namespaces": {
195                     "$id": "#/properties/db/properties/namespaces",
196                     "type": "array",
197                     "title": "The Namespaces Schema",
198                     "items": {
199                         "$id": "#/properties/db/properties/namespaces/items",
200                         "type": "string",
201                         "title": "The Items Schema",
202                         "default": "",
203                         "examples": [
204                             "sdl",
205                             "rnib"
206                         ],
207                         "pattern": "^(.*)$"
208                     }
209                 }
210             }
211         },
212         "controls": {
213             "$id": "#/properties/controls",
214             "type": "object",
215             "title": "The Controls Schema",
216             "required": [
217                 "active",
218                 "requestorId",
219                 "ranFunctionId",
220                 "ricActionId",
221                 "interfaceId"
222             ],
223             "properties": {
224                 "active": {
225                     "$id": "#/properties/controls/properties/active",
226                     "type": "boolean",
227                     "title": "The Active Schema",
228                     "default": False,
229                     "examples": [
230                         True
231                     ]
232                 },
233                 "requestorId": {
234                     "$id": "#/properties/controls/properties/requestorId",
235                     "type": "integer",
236                     "title": "The Requestorid Schema",
237                     "default": 0,
238                     "examples": [
239                         66
240                     ]
241                 },
242                 "ranFunctionId": {
243                     "$id": "#/properties/controls/properties/ranFunctionId",
244                     "type": "integer",
245                     "title": "The Ranfunctionid Schema",
246                     "default": 0,
247                     "examples": [
248                         1
249                     ]
250                 },
251                 "ricActionId": {
252                     "$id": "#/properties/controls/properties/ricActionId",
253                     "type": "integer",
254                     "title": "The Ricactionid Schema",
255                     "default": 0,
256                     "examples": [
257                         0
258                     ]
259                 },
260                 "interfaceId": {
261                     "$id": "#/properties/controls/properties/interfaceId",
262                     "type": "object",
263                     "title": "The Interfaceid Schema",
264                     "required": [
265                         "globalENBId"
266                     ],
267                     "properties": {
268                         "globalENBId": {
269                             "$id": "#/properties/controls/properties/interfaceId/properties/globalENBId",
270                             "type": "object",
271                             "title": "The Globalenbid Schema",
272                             "required": [
273                                 "plmnId",
274                                 "eNBId"
275                             ],
276                             "properties": {
277                                 "plmnId": {
278                                     "$id": "#/properties/controls/properties/interfaceId/properties/globalENBId/properties/plmnId",
279                                     "type": "string",
280                                     "title": "The Plmnid Schema",
281                                     "default": "",
282                                     "examples": [
283                                         "310150"
284                                     ],
285                                     "pattern": "^(.*)$"
286                                 },
287                                 "eNBId": {
288                                     "$id": "#/properties/controls/properties/interfaceId/properties/globalENBId/properties/eNBId",
289                                     "type": "integer",
290                                     "title": "The Enbid Schema",
291                                     "default": 0,
292                                     "examples": [
293                                         202251
294                                     ]
295                                 }
296                             }
297                         }
298                     }
299                 }
300             }
301         },
302         "metrics": {
303             "$id": "#/properties/metrics",
304             "type": "array",
305             "title": "The Metrics Schema",
306             "items": {
307                 "$id": "#/properties/metrics/items",
308                 "type": "object",
309                 "title": "The Items Schema",
310                 "required": [
311                     "objectName",
312                     "objectInstance",
313                     "name",
314                     "type",
315                     "description"
316                 ],
317                 "properties": {
318                     "objectName": {
319                         "$id": "#/properties/metrics/items/properties/objectName",
320                         "type": "string",
321                         "title": "The Objectname Schema",
322                         "default": "",
323                         "examples": [
324                             "UEEventStreamingCounters"
325                         ],
326                         "pattern": "^(.*)$"
327                     },
328                     "objectInstance": {
329                         "$id": "#/properties/metrics/items/properties/objectInstance",
330                         "type": "string",
331                         "title": "The Objectinstance Schema",
332                         "default": "",
333                         "examples": [
334                             "SgNBAdditionRequest"
335                         ],
336                         "pattern": "^(.*)$"
337                     },
338                     "name": {
339                         "$id": "#/properties/metrics/items/properties/name",
340                         "type": "string",
341                         "title": "The Name Schema",
342                         "default": "",
343                         "examples": [
344                             "SgNBAdditionRequest"
345                         ],
346                         "pattern": "^(.*)$"
347                     },
348                     "type": {
349                         "$id": "#/properties/metrics/items/properties/type",
350                         "type": "string",
351                         "title": "The Type Schema",
352                         "default": "",
353                         "examples": [
354                             "counter"
355                         ],
356                         "pattern": "^(.*)$"
357                     },
358                     "description": {
359                         "$id": "#/properties/metrics/items/properties/description",
360                         "type": "string",
361                         "title": "The Description Schema",
362                         "default": "",
363                         "examples": [
364                             "The total number of SG addition request events processed"
365                         ],
366                         "pattern": "^(.*)$"
367                     }
368                 }
369             }
370         }
371     }
372 }
373
374 config_file = {
375     "xapp_name": "test_xapp",
376     "version": "1.0.0",
377     "containers": [{
378         "name": "test1",
379         "image": {
380             "registry": "test_repo",
381             "name": "test_name",
382             "tag": "test_tag"
383         },
384         "command": "test command"
385     },
386         {
387             "name": "test2",
388             "image": {
389                 "registry": "test2_repo",
390                 "name": "test2_name",
391                 "tag": "test2:_tag"
392             },
393             "command": "test2 command"
394         }],
395     "local": {
396         "host": ":8080"
397     },
398     "logger": {
399         "level": 3
400     },
401     "db": {
402         "host": "localhost",
403         "port": 6379,
404         "namespaces": ["sdl", "rnib"]
405     },
406     "controls": {
407         "active": True,
408         "requestorId": 66,
409         "ranFunctionId": 1,
410         "ricActionId": 0,
411         "interfaceId": {
412             "globalENBId": {
413                 "plmnId": "310150",
414                 "eNBId": 202251
415             }
416         }
417     },
418     "rmr": {
419         "protPort": "tcp:4560",
420         "maxSize": 10000,
421         "numWorkers": 1,
422         "rxMessages": [
423             "RIC_SUB_RESP",
424             "RIC_SUB_FAILURE",
425             "RIC_SUB_DEL_RESP",
426             "RIC_SUB_DEL_FAILURE",
427             "RIC_INDICATION"
428         ],
429         "txMessages": [
430             "RIC_SUB_REQ",
431             "RIC_SUB_DEL_REQ",
432             "RIC_SGNB_ADDITION_REQ",
433             "RIC_SGNB_ADDITION_ACK",
434             "RIC_SGNB_ADDITION_REJECT",
435             "RIC_SGNB_MOD_REQUEST",
436             "RIC_SGNB_MOD_REQUEST_ACK",
437             "RIC_SGNB_MOD_REQUEST_REJECT",
438             "RIC_SGNB_MOD_REQUIRED",
439             "RIC_SGNB_MOD_CONFIRM",
440             "RIC_SGNB_MOD_REFUSE",
441             "RIC_SGNB_RELEASE_REQUEST",
442             "RIC_SGNB_RELEASE_CONFIRM",
443             "RIC_SGNB_RELEASE_REQUIRED",
444             "RIC_SGNB_RELEASE_REQUEST_ACK",
445             "RIC_SGNB_RECONF_COMPLETE",
446             "RIC_UE_CONTEXT_RELEASE",
447             "RIC_RRC_TRANSFER",
448             "RIC_SECONDARY_RAT_DATA_USAGE_REPORT",
449             "RIC_SN_STATUS_TRANSFER"
450         ]
451     },
452     "metrics": [
453         {
454             "objectName": "UEEventStreamingCounters",
455             "objectInstance": "SgNBAdditionRequest",
456             "name": "SgNBAdditionRequest",
457             "type": "counter",
458             "description": "The total number of SG addition request events processed"
459         },
460         {
461             "objectName": "UEEventStreamingCounters",
462             "objectInstance": "SgNBAdditionRequestAcknowledge",
463             "name": "SgNBAdditionRequestAcknowledge",
464             "type": "counter",
465             "description": "The total number of SG addition request acknowledge events processed"
466         },
467         {
468             "objectName": "UEEventStreamingCounters",
469             "objectInstance": "SgNBAdditionRequestReject",
470             "name": "SgNBAdditionRequestReject",
471             "type": "counter",
472             "description": "The total number of SG addition request reject events processed"
473         },
474         {
475             "objectName": "UEEventStreamingCounters",
476             "objectInstance": "SgNBModificationRequest",
477             "name": "SgNBModificationRequest",
478             "type": "counter",
479             "description": "The total number of SG modification request events processed"
480         },
481         {
482             "objectName": "UEEventStreamingCounters",
483             "objectInstance": "SgNBModificationRequestAcknowledge",
484             "name": "SgNBModificationRequestAcknowledge",
485             "type": "counter",
486             "description": "The total number of SG modification request acknowledge events processed"
487         },
488         {
489             "objectName": "UEEventStreamingCounters",
490             "objectInstance": "SgNBModificationRequestReject",
491             "name": "SgNBModificationRequestReject",
492             "type": "counter",
493             "description": "The total number of SG modification request reject events processed"
494         },
495         {
496             "objectName": "UEEventStreamingCounters",
497             "objectInstance": "SgNBModificationRequired",
498             "name": "SgNBModificationRequired",
499             "type": "counter",
500             "description": "The total number of SG modification required events processed"
501         },
502         {
503             "objectName": "UEEventStreamingCounters",
504             "objectInstance": "SgNBModificationConfirm",
505             "name": "SgNBModificationConfirm",
506             "type": "counter",
507             "description": "The total number of SG modification confirm events processed"
508         },
509         {
510             "objectName": "UEEventStreamingCounters",
511             "objectInstance": "SgNBModificationRefuse",
512             "name": "SgNBModificationRefuse",
513             "type": "counter",
514             "description": "The total number of SG modification refuse events processed"
515         },
516         {
517             "objectName": "UEEventStreamingCounters",
518             "objectInstance": "SgNBReleaseRequest",
519             "name": "SgNBReleaseRequest",
520             "type": "counter",
521             "description": "The total number of SG release request events processed"
522         },
523         {
524             "objectName": "UEEventStreamingCounters",
525             "objectInstance": "SgNBReleaseRequestAcknowledge",
526             "name": "SgNBReleaseRequestAcknowledge",
527             "type": "counter",
528             "description": "The total number of SG release request acknowledge events processed"
529         },
530         {
531             "objectName": "UEEventStreamingCounters",
532             "objectInstance": "SgNBReleaseRequestReject",
533             "name": "SgNBReleaseRequestReject",
534             "type": "counter",
535             "description": "The total number of SG release request reject events processed"
536         },
537         {
538             "objectName": "UEEventStreamingCounters",
539             "objectInstance": "SgNBReleaseRequired",
540             "name": "SgNBReleaseRequired",
541             "type": "counter",
542             "description": "The total number of SG release required events processed"
543         },
544         {
545             "objectName": "UEEventStreamingCounters",
546             "objectInstance": "SgNBReleasenConfirm",
547             "name": "SgNBReleasenConfirm",
548             "type": "counter",
549             "description": "The total number of SG release confirm events processed"
550         },
551         {
552             "objectName": "UEEventStreamingCounters",
553             "objectInstance": "SgNBReconfigurationComplete",
554             "name": "SgNBReconfigurationComplete",
555             "type": "counter",
556             "description": "The total number of SG reconfiguration complete events processed"
557         },
558         {
559             "objectName": "UEEventStreamingCounters",
560             "objectInstance": "UEContextRelease",
561             "name": "UEContextRelease",
562             "type": "counter",
563             "description": "The total number of SG UE context release events processed"
564         },
565         {
566             "objectName": "UEEventStreamingCounters",
567             "objectInstance": "RRCTransfer",
568             "name": "RRCTransfer",
569             "type": "counter",
570             "description": "The total number of SG RRC transfers events processed"
571         },
572         {
573             "objectName": "UEEventStreamingCounters",
574             "objectInstance": "SNStatusTransfer",
575             "name": "SNStatusTransfer",
576             "type": "counter",
577             "description": "The total number of SG SN status transfers events processed"
578         },
579         {
580             "objectName": "UEEventStreamingCounters",
581             "objectInstance": "SecondaryRATDataUsageReport",
582             "name": "SecondaryRATDataUsageReport",
583             "type": "counter",
584             "description": "The total number of SG secondary RAT data usage reports events processed"
585         },
586         {
587             "objectName": "RMRCounters",
588             "objectInstance": "Transmitted",
589             "name": "Transmitted",
590             "type": "counter",
591             "description": "The total number of RMR messages transmited"
592         },
593         {
594             "objectName": "RMRCounters",
595             "objectInstance": "Received",
596             "name": "Received",
597             "type": "counter",
598             "description": "The total number of RMR messages received"
599         },
600         {
601             "objectName": "RMRCounters",
602             "objectInstance": "TransmitError",
603             "name": "TransmitError",
604             "type": "counter",
605             "description": "The total number of RMR messages transmission errors"
606         },
607         {
608             "objectName": "RMRCounters",
609             "objectInstance": "ReceiveError",
610             "name": "ReceiveError",
611             "type": "counter",
612             "description": "The total number of RMR messages receive errors"
613         },
614         {
615             "objectName": "SDLounters",
616             "objectInstance": "Stored",
617             "name": "Stored",
618             "type": "counter",
619             "description": "The total number of stored SDL transactions"
620         },
621         {
622             "objectName": "SDLounters",
623             "objectInstance": "StoreError",
624             "name": "StoreError",
625             "type": "counter",
626             "description": "The total number of SDL store errors"
627         }
628     ]
629 }
630
631 mock_json_body_url = {
632     'config-file.json_url': 'http://0.0.0.0:8080/config-file.json',
633     'schema.json_url': 'http://0.0.0.0:8080/schema.json'
634 }
635
636 mock_json_body = {
637     "config-file.json": config_file,
638     "schema.json": schema_file
639 }
640
641 helm_repo_index_response={'apiVersion': 'v1',
642                 'entries':{
643                     'test_xapp':[{
644                         'apiVersion': 'v1',
645                         'appVersion': '1.0',
646                         'created': '2020-03-12T19:10:17.178396719Z',
647                         'description': 'test xApp Helm Chart',
648                         'digest': 'd77dfb3f008e5174e90d79bfe982ef85b5dc5930141f6a1bd9995b2fa35',
649                         'name': 'test_xapp',
650                         'urls':['charts/test-1.0.0.tgz'],
651                         'version': '1.0.0'
652                     }]
653                 },
654                 'generated': '2020-03-16T16:54:44Z',
655                 'serverInfo':{}
656                 }