Feature-9904: Enhancing NG-UI to enable Juju operational view dashboard
[osm/NBI.git] / osm_nbi / tests / test_db_descriptors.py
1 #
2 # Licensed under the Apache License, Version 2.0 (the "License"); you may
3 # not use this file except in compliance with the License. You may obtain
4 # a copy of the License at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 # License for the specific language governing permissions and limitations
12 # under the License.
13 #
14 # For those usages not covered by the Apache License, Version 2.0 please
15 # contact: esousa@whitestack.com or alfonso.tiernosepulveda@telefonica.com
16 ##
17
18 """Contains database content needed for tests"""
19
20
21 db_vim_accounts_text = """
22 ---
23 - _admin:
24 created: 1566818150.3024442
25 current_operation: 0
26 deployed:
27 RO: dc51ce6c-c7f2-11e9-b9c0-02420aff0004
28 RO-account: dc5c67fa-c7f2-11e9-b9c0-02420aff0004
29 detailed-status: Done
30 modified: 1566818150.3024442
31 operationalState: ENABLED
32 operations:
33 - detailed-status: Done
34 lcmOperationType: create
35 operationParams: null
36 operationState: COMPLETED
37 startTime: 1566818150.3025382
38 statusEnteredTime: 1566818150.3025382
39 worker: 86434c2948e2
40 projects_read:
41 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
42 projects_write:
43 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
44 _id: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
45 description: Openstack site 2, based on Mirantis, also called DSS9000-1, with
46 tenant tid
47 name: ost2-mrt-tid
48 schema_version: '1.1'
49 vim_password: 5g0yGX86qIhprX86YTMcpg==
50 vim_tenant_name: osm
51 vim_type: openstack
52 vim_url: http://10.95.87.162:5000/v2.0
53 vim_user: osm
54 """
55
56 db_vnfds_text = """
57 ---
58 - _admin:
59 created: 1566823352.7154346
60 modified: 1566823353.9295402
61 onboardingState: ONBOARDED
62 operationalState: ENABLED
63 projects_read:
64 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
65 projects_write:
66 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
67 storage:
68 descriptor: hackfest_3charmed_vnfd/hackfest_3charmed_vnfd.yaml
69 folder: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
70 fs: local
71 path: /app/storage/
72 pkg-dir: hackfest_3charmed_vnfd
73 zipfile: package.tar.gz
74 type: vnfd
75 usageState: NOT_IN_USE
76 userDefinedData: {}
77 _id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
78 id: hackfest3charmed-vnf
79 description: >-
80 A VNF consisting of 2 VDUs connected to an internal VL, and one VDU with
81 cloud-init
82 product-name: hackfest3charmed-vnf
83 version: '1.0'
84 mgmt-cp: vnf-mgmt-ext
85
86 virtual-compute-desc:
87 - id: mgmt-compute
88 virtual-cpu:
89 num-virtual-cpu: 1
90 virtual-memory:
91 size: 1
92 - id: data-compute
93 virtual-cpu:
94 num-virtual-cpu: 1
95 virtual-memory:
96 size: 1
97
98 virtual-storage-desc:
99 - id: mgmt-storage
100 size-of-storage: 10
101 - id: data-storage
102 size-of-storage: 10
103
104 sw-image-desc:
105 - id: hackfest3-mgmt
106 name: hackfest3-mgmt
107
108 vdu:
109 - id: mgmtVM
110 name: mgmtVM
111 cloud-init-file: cloud-config.txt
112 sw-image-desc: hackfest3-mgmt
113 virtual-compute-desc: mgmt-compute
114 virtual-storage-desc:
115 - mgmt-storage
116 int-cpd:
117 - id: vnf-mgmt
118 virtual-network-interface-requirement:
119 - name: mgmtVM-eth0
120 position: 1
121 virtual-interface:
122 type: VIRTIO
123 - id: mgmtVM-internal
124 int-virtual-link-desc: internal
125 virtual-network-interface-requirement:
126 - name: mgmtVM-eth1
127 position: 2
128 virtual-interface:
129 type: VIRTIO
130 - id: dataVM
131 name: dataVM
132 sw-image-desc: hackfest3-mgmt
133 virtual-compute-desc: data-compute
134 virtual-storage-desc:
135 - data-storage
136 int-cpd:
137 - id: dataVM-internal
138 int-virtual-link-desc: internal
139 virtual-network-interface-requirement:
140 - name: dataVM-eth1
141 position: 1
142 virtual-interface:
143 type: VIRTIO
144 - id: vnf-data
145 virtual-network-interface-requirement:
146 - name: dataVM-eth0
147 position: 2
148 virtual-interface:
149 type: VIRTIO
150 monitoring-parameter:
151 - id: dataVM_cpu_util
152 name: dataVM_cpu_util
153 performance-metric: cpu_utilization
154
155 int-virtual-link-desc:
156 - id: internal
157
158 ext-cpd:
159 - id: vnf-mgmt-ext
160 int-cpd: # Connection to int-cpd
161 vdu-id: mgmtVM
162 cpd: vnf-mgmt
163 - id: vnf-data-ext
164 int-cpd: # Connection to int-cpd
165 vdu-id: dataVM
166 cpd: vnf-data
167
168 df:
169 - id: hackfest_default
170 vdu-profile:
171 - id: mgmtVM
172 min-number-of-instances: 1
173 - id: dataVM
174 min-number-of-instances: 1
175 max-number-of-instances: 10
176 instantiation-level:
177 - id: default
178 vdu-level:
179 - vdu-id: mgmtVM
180 number-of-instances: 1
181 - vdu-id: dataVM
182 number-of-instances: 1
183 scaling-aspect:
184 - id: scale_dataVM
185 name: scale_dataVM
186 max-scale-level: 10
187 aspect-delta-details:
188 deltas:
189 - id: delta1
190 vdu-delta:
191 - id: vdudelta1
192 number-of-instances: 1
193 scaling-policy:
194 - name: auto_cpu_util_above_threshold
195 scaling-type: automatic
196 enabled: true
197 threshold-time: 0
198 cooldown-time: 60
199 scaling-criteria:
200 - name: cpu_util_above_threshold
201 scale-in-relational-operation: LE
202 scale-in-threshold: '15.0000000000'
203 scale-out-relational-operation: GE
204 scale-out-threshold: '60.0000000000'
205 vnf-monitoring-param-ref: dataVM_cpu_util
206 scaling-config-action:
207 - trigger: post-scale-out
208 vnf-config-primitive-name-ref: touch
209 - trigger: pre-scale-in
210 vnf-config-primitive-name-ref: touch
211 lcm-operations-configuration:
212 operate-vnf-op-config:
213 day1-2:
214 - id: hackfest3charmed-vnf
215 execution-environment-list:
216 - id: simple-ee
217 juju:
218 charm: simple
219 initial-config-primitive:
220 - seq: "1"
221 execution-environment-ref: simple-ee
222 name: config
223 parameter:
224 - name: ssh-hostname
225 value: <rw_mgmt_ip>
226 - name: ssh-username
227 value: ubuntu
228 - name: ssh-password
229 value: osm4u
230 - seq: "2"
231 execution-environment-ref: simple-ee
232 name: touch
233 parameter:
234 - name: filename
235 value: <touch_filename>
236 config-primitive:
237 - name: touch
238 execution-environment-ref: simple-ee
239 parameter:
240 - data-type: STRING
241 default-value: <touch_filename2>
242 name: filename
243 """
244
245 db_nsds_text = """
246 ---
247 - _admin:
248 created: 1566823353.971486
249 modified: 1566823353.971486
250 onboardingState: ONBOARDED
251 operationalState: ENABLED
252 projects_read:
253 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
254 projects_write:
255 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
256 storage:
257 descriptor: hackfest_3charmed_nsd/hackfest_3charmed_nsd.yaml
258 folder: 8c2f8b95-bb1b-47ee-8001-36dc090678da
259 fs: local
260 path: /app/storage/
261 pkg-dir: hackfest_3charmed_nsd
262 zipfile: package.tar.gz
263 usageState: NOT_IN_USE
264 userDefinedData: {}
265 _id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
266 id: hackfest3charmed-ns
267 name: hackfest3charmed-ns
268 description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and mgmtnet VLs
269 designer: OSM
270 version: '1.0'
271
272 vnfd-id:
273 - hackfest3charmed-vnf
274
275 virtual-link-desc:
276 - id: mgmt
277 mgmt-network: "true"
278 - id: datanet
279 mgmt-network: "false"
280
281 df:
282 - id: hackfest_charmed_DF
283 vnf-profile:
284 - id: hackfest_vnf1 # member-vnf-index-ref: 1
285 vnfd-id: hackfest3charmed-vnf
286 virtual-link-connectivity:
287 - virtual-link-profile-id: mgmt
288 constituent-cpd-id:
289 - constituent-base-element-id: hackfest_vnf1
290 constituent-cpd-id: vnf-mgmt-ext
291 - virtual-link-profile-id: datanet
292 constituent-cpd-id:
293 - constituent-base-element-id: hackfest_vnf1
294 constituent-cpd-id: vnf-data-ext
295 - id: hackfest_vnf2 # member-vnf-index-ref: 2
296 vnfd-id: hackfest3charmed-vnf
297 virtual-link-connectivity:
298 - virtual-link-profile-id: mgmt
299 constituent-cpd-id:
300 - constituent-base-element-id: hackfest_vnf2
301 constituent-cpd-id: vnf-mgmt-ext
302 - virtual-link-profile-id: datanet
303 constituent-cpd-id:
304 - constituent-base-element-id: hackfest_vnf2
305 constituent-cpd-id: vnf-data-ext
306 """
307
308 db_nsrs_text = """
309 ---
310 - _admin:
311 created: 1566823354.3716335
312 modified: 1566823354.3716335
313 nsState: NOT_INSTANTIATED
314 nslcmop: null
315 projects_read:
316 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
317 projects_write:
318 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
319 _id: f48163a6-c807-47bc-9682-f72caef5af85
320 additionalParamsForNs: null
321 admin-status: ENABLED
322 config-status: init
323 constituent-vnfr-ref:
324 - 88d90b0c-faff-4b9f-bccd-017f33985984
325 - 1ca3bb1a-b29b-49fe-bed6-5f3076d77434
326 create-time: 1566823354.36234
327 datacenter: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
328 description: default description
329 detailed-status: 'ERROR executing proxy charm initial primitives for member_vnf_index=1
330 vdu_id=None: charm error executing primitive verify-ssh-credentials for member_vnf_index=1
331 vdu_id=None: ''timeout after 600 seconds'''
332 id: f48163a6-c807-47bc-9682-f72caef5af85
333 instantiate_params:
334 nsDescription: default description
335 nsName: ALF
336 nsdId: 8c2f8b95-bb1b-47ee-8001-36dc090678da
337 vimAccountId: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
338 name: ALF
339 name-ref: ALF
340 ns-instance-config-ref: f48163a6-c807-47bc-9682-f72caef5af85
341 nsd:
342 _admin:
343 created: 1566823353.971486
344 modified: 1566823353.971486
345 onboardingState: ONBOARDED
346 operationalState: ENABLED
347 projects_read:
348 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
349 projects_write:
350 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
351 storage:
352 descriptor: hackfest_3charmed_nsd/hackfest_3charmed_nsd.yaml
353 folder: 8c2f8b95-bb1b-47ee-8001-36dc090678da
354 fs: local
355 path: /app/storage/
356 pkg-dir: hackfest_3charmed_nsd
357 zipfile: package.tar.gz
358 usageState: NOT_IN_USE
359 userDefinedData: {}
360 _id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
361 id: hackfest3charmed-ns
362 name: hackfest3charmed-ns
363 description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and mgmtnet VLs
364 designer: OSM
365 version: '1.0'
366
367 vnfd-id:
368 - hackfest3charmed-vnf
369
370 virtual-link-desc:
371 - id: mgmt
372 mgmt-network: "true"
373 - id: datanet
374 mgmt-network: "false"
375
376 df:
377 - id: hackfest_charmed_DF
378 vnf-profile:
379 - id: hackfest_vnf1 # member-vnf-index-ref: 1
380 vnfd-id: hackfest3charmed-vnf
381 virtual-link-connectivity:
382 - virtual-link-profile-id: mgmt
383 constituent-cpd-id:
384 - constituent-base-element-id: hackfest_vnf1
385 constituent-cpd-id: vnf-mgmt-ext
386 - virtual-link-profile-id: datanet
387 constituent-cpd-id:
388 - constituent-base-element-id: hackfest_vnf1
389 constituent-cpd-id: vnf-data-ext
390 - id: hackfest_vnf2 # member-vnf-index-ref: 2
391 vnfd-id: hackfest3charmed-vnf
392 virtual-link-connectivity:
393 - virtual-link-profile-id: mgmt
394 constituent-cpd-id:
395 - constituent-base-element-id: hackfest_vnf2
396 constituent-cpd-id: vnf-mgmt-ext
397 - virtual-link-profile-id: datanet
398 constituent-cpd-id:
399 - constituent-base-element-id: hackfest_vnf2
400 constituent-cpd-id: vnf-data-ext
401 nsd-id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
402 nsd-name-ref: hackfest3charmed-ns
403 nsd-ref: hackfest3charmed-ns
404 operational-events: []
405 operational-status: failed
406 orchestration-progress: {}
407 resource-orchestrator: osmopenmano
408 short-name: ALF
409 ssh-authorized-key: null
410 vld:
411 - id: mgmt
412 name: null
413 status: ACTIVE
414 status-detailed: null
415 vim-id: f99ae780-0e2f-4985-af41-574eae6919c0
416 vim-network-name: mgmt
417 - id: datanet
418 name: ALF-datanet
419 status: ACTIVE
420 status-detailed: null
421 vim-id: c31364ba-f573-4ab6-bf1a-fed30ede39a8
422 vnfd-id:
423 - 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
424 """
425
426 db_nslcmops_text = """
427 ---
428 - _admin:
429 created: 1566823354.4148262
430 modified: 1566823354.4148262
431 projects_read:
432 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
433 projects_write:
434 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
435 worker: 86434c2948e2
436 _id: a639fac7-e0bb-4225-8ecb-c1f8efcc125e
437 detailed-status: 'FAILED executing proxy charm initial primitives for member_vnf_index=1
438 vdu_id=None: charm error executing primitive verify-ssh-credentials for member_vnf_index=1
439 vdu_id=None: ''timeout after 600 seconds'''
440 id: a639fac7-e0bb-4225-8ecb-c1f8efcc125e
441 isAutomaticInvocation: false
442 isCancelPending: false
443 lcmOperationType: instantiate
444 links:
445 nsInstance: /osm/nslcm/v1/ns_instances/f48163a6-c807-47bc-9682-f72caef5af85
446 self: /osm/nslcm/v1/ns_lcm_op_occs/a639fac7-e0bb-4225-8ecb-c1f8efcc125e
447 nsInstanceId: f48163a6-c807-47bc-9682-f72caef5af85
448 operationParams:
449 additionalParamsForVnf:
450 - additionalParams:
451 touch_filename: /home/ubuntu/first-touch-1
452 touch_filename2: /home/ubuntu/second-touch-1
453 member-vnf-index: '1'
454 - additionalParams:
455 touch_filename: /home/ubuntu/first-touch-2
456 touch_filename2: /home/ubuntu/second-touch-2
457 member-vnf-index: '2'
458 lcmOperationType: instantiate
459 nsDescription: default description
460 nsInstanceId: f48163a6-c807-47bc-9682-f72caef5af85
461 nsName: ALF
462 nsdId: 8c2f8b95-bb1b-47ee-8001-36dc090678da
463 vimAccountId: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
464 operationState: FAILED
465 startTime: 1566823354.414689
466 statusEnteredTime: 1566824534.5112448
467 """
468
469 db_vnfrs_text = """
470 ---
471 - _admin:
472 created: 1566823354.3668208
473 modified: 1566823354.3668208
474 nsState: NOT_INSTANTIATED
475 projects_read:
476 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
477 projects_write:
478 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
479 _id: 88d90b0c-faff-4b9f-bccd-017f33985984
480 additionalParamsForVnf:
481 touch_filename: /home/ubuntu/first-touch-1
482 touch_filename2: /home/ubuntu/second-touch-1
483 connection-point:
484 - connection-point-id: vnf-mgmt
485 id: vnf-mgmt
486 name: vnf-mgmt
487 - connection-point-id: vnf-data
488 id: vnf-data
489 name: vnf-data
490 created-time: 1566823354.36234
491 id: 88d90b0c-faff-4b9f-bccd-017f33985984
492 ip-address: 10.205.1.46
493 member-vnf-index-ref: '1'
494 nsr-id-ref: f48163a6-c807-47bc-9682-f72caef5af85
495 vdur:
496 - _id: f0e7d7ce-2443-4dcb-ad0b-5ab9f3b13d37
497 count-index: 0
498 interfaces:
499 - ip-address: 10.205.1.46
500 mac-address: fa:16:3e:b4:3e:b1
501 mgmt-vnf: true
502 name: mgmtVM-eth0
503 ns-vld-id: mgmt
504 - ip-address: 192.168.54.2
505 mac-address: fa:16:3e:6e:7e:78
506 name: mgmtVM-eth1
507 vnf-vld-id: internal
508 internal-connection-point:
509 - connection-point-id: mgmtVM-internal
510 id: mgmtVM-internal
511 name: mgmtVM-internal
512 ip-address: 10.205.1.46
513 name: ALF-1-mgmtVM-1
514 status: ACTIVE
515 status-detailed: null
516 vdu-id-ref: mgmtVM
517 vim-id: c2538499-4c30-41c0-acd5-80cb92f48061
518 - _id: ab453219-2d9a-45c2-864d-2c0788385028
519 count-index: 0
520 interfaces:
521 - ip-address: 192.168.54.3
522 mac-address: fa:16:3e:d9:7a:5d
523 name: dataVM-eth0
524 vnf-vld-id: internal
525 - ip-address: 192.168.24.3
526 mac-address: fa:16:3e:d1:6c:0d
527 name: dataVM-xe0
528 ns-vld-id: datanet
529 internal-connection-point:
530 - connection-point-id: dataVM-internal
531 id: dataVM-internal
532 name: dataVM-internal
533 ip-address: null
534 name: ALF-1-dataVM-1
535 status: ACTIVE
536 status-detailed: null
537 vdu-id-ref: dataVM
538 vim-id: 87973c3f-365d-4227-95c2-7a8abc74349c
539 vim-account-id: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
540 vld:
541 - id: internal
542 name: ALF-internal
543 status: ACTIVE
544 status-detailed: null
545 vim-id: ff181e6d-2597-4244-b40b-bb0174bdfeb6
546 vnfd-id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
547 vnfd-ref: hackfest3charmed-vnf
548 - _admin:
549 created: 1566823354.3703845
550 modified: 1566823354.3703845
551 nsState: NOT_INSTANTIATED
552 projects_read:
553 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
554 projects_write:
555 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
556 _id: 1ca3bb1a-b29b-49fe-bed6-5f3076d77434
557 additionalParamsForVnf:
558 touch_filename: /home/ubuntu/first-touch-2
559 touch_filename2: /home/ubuntu/second-touch-2
560 connection-point:
561 - connection-point-id: vnf-mgmt
562 id: vnf-mgmt
563 name: vnf-mgmt
564 - connection-point-id: vnf-data
565 id: vnf-data
566 name: vnf-data
567 created-time: 1566823354.36234
568 id: 1ca3bb1a-b29b-49fe-bed6-5f3076d77434
569 ip-address: 10.205.1.47
570 member-vnf-index-ref: '2'
571 nsr-id-ref: f48163a6-c807-47bc-9682-f72caef5af85
572 vdur:
573 - _id: 190b4a2c-4f85-4cfe-9406-4cef7ffb1e67
574 count-index: 0
575 interfaces:
576 - ip-address: 10.205.1.47
577 mac-address: fa:16:3e:cb:9f:c7
578 mgmt-vnf: true
579 name: mgmtVM-eth0
580 ns-vld-id: mgmt
581 - ip-address: 192.168.231.1
582 mac-address: fa:16:3e:1a:89:24
583 name: mgmtVM-eth1
584 vnf-vld-id: internal
585 internal-connection-point:
586 - connection-point-id: mgmtVM-internal
587 id: mgmtVM-internal
588 name: mgmtVM-internal
589 ip-address: 10.205.1.47
590 name: ALF-2-mgmtVM-1
591 status: ACTIVE
592 status-detailed: null
593 vdu-id-ref: mgmtVM
594 vim-id: 248077b2-e3b8-4a37-8b72-575abb8ed912
595 - _id: 889b874d-e1c3-4e75-aa45-53a9b0ddabd9
596 count-index: 0
597 interfaces:
598 - ip-address: 192.168.231.3
599 mac-address: fa:16:3e:7e:ba:8c
600 name: dataVM-eth0
601 vnf-vld-id: internal
602 - ip-address: 192.168.24.4
603 mac-address: fa:16:3e:d2:e1:f5
604 name: dataVM-xe0
605 ns-vld-id: datanet
606 internal-connection-point:
607 - connection-point-id: dataVM-internal
608 id: dataVM-internal
609 name: dataVM-internal
610 ip-address: null
611 name: ALF-2-dataVM-1
612 status: ACTIVE
613 status-detailed: null
614 vdu-id-ref: dataVM
615 vim-id: a4ce4372-e0ad-4ae3-8f9f-1c969f32e77b
616 vim-account-id: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
617 vld:
618 - id: internal
619 name: ALF-internal
620 status: ACTIVE
621 status-detailed: null
622 vim-id: ff181e6d-2597-4244-b40b-bb0174bdfeb6
623 vnfd-id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
624 vnfd-ref: hackfest3charmed-vnf
625 """