050f70b53d9417fb6172b7f0fbfd07599946b0a3
[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 initial-config-primitive:
216 - seq: "1"
217 name: config
218 parameter:
219 - name: ssh-hostname
220 value: <rw_mgmt_ip>
221 - name: ssh-username
222 value: ubuntu
223 - name: ssh-password
224 value: osm4u
225 - seq: "2"
226 name: touch
227 parameter:
228 - name: filename
229 value: <touch_filename>
230 config-primitive:
231 - name: touch
232 parameter:
233 - data-type: STRING
234 default-value: <touch_filename2>
235 name: filename
236 juju:
237 charm: simple
238 """
239
240 db_nsds_text = """
241 ---
242 - _admin:
243 created: 1566823353.971486
244 modified: 1566823353.971486
245 onboardingState: ONBOARDED
246 operationalState: ENABLED
247 projects_read:
248 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
249 projects_write:
250 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
251 storage:
252 descriptor: hackfest_3charmed_nsd/hackfest_3charmed_nsd.yaml
253 folder: 8c2f8b95-bb1b-47ee-8001-36dc090678da
254 fs: local
255 path: /app/storage/
256 pkg-dir: hackfest_3charmed_nsd
257 zipfile: package.tar.gz
258 usageState: NOT_IN_USE
259 userDefinedData: {}
260 _id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
261 id: hackfest3charmed-ns
262 name: hackfest3charmed-ns
263 description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and mgmtnet VLs
264 designer: OSM
265 version: '1.0'
266
267 vnfd-id:
268 - hackfest3charmed-vnf
269
270 virtual-link-desc:
271 - id: mgmt
272 mgmt-network: "true"
273 - id: datanet
274 mgmt-network: "false"
275
276 df:
277 - id: hackfest_charmed_DF
278 vnf-profile:
279 - id: hackfest_vnf1 # member-vnf-index-ref: 1
280 vnfd-id: hackfest3charmed-vnf
281 virtual-link-connectivity:
282 - virtual-link-profile-id: mgmt
283 constituent-cpd-id:
284 - constituent-base-element-id: hackfest_vnf1
285 constituent-cpd-id: vnf-mgmt-ext
286 - virtual-link-profile-id: datanet
287 constituent-cpd-id:
288 - constituent-base-element-id: hackfest_vnf1
289 constituent-cpd-id: vnf-data-ext
290 - id: hackfest_vnf2 # member-vnf-index-ref: 2
291 vnfd-id: hackfest3charmed-vnf
292 virtual-link-connectivity:
293 - virtual-link-profile-id: mgmt
294 constituent-cpd-id:
295 - constituent-base-element-id: hackfest_vnf2
296 constituent-cpd-id: vnf-mgmt-ext
297 - virtual-link-profile-id: datanet
298 constituent-cpd-id:
299 - constituent-base-element-id: hackfest_vnf2
300 constituent-cpd-id: vnf-data-ext
301 """
302
303 db_nsrs_text = """
304 ---
305 - _admin:
306 created: 1566823354.3716335
307 modified: 1566823354.3716335
308 nsState: NOT_INSTANTIATED
309 nslcmop: null
310 projects_read:
311 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
312 projects_write:
313 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
314 _id: f48163a6-c807-47bc-9682-f72caef5af85
315 additionalParamsForNs: null
316 admin-status: ENABLED
317 config-status: init
318 constituent-vnfr-ref:
319 - 88d90b0c-faff-4b9f-bccd-017f33985984
320 - 1ca3bb1a-b29b-49fe-bed6-5f3076d77434
321 create-time: 1566823354.36234
322 datacenter: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
323 description: default description
324 detailed-status: 'ERROR executing proxy charm initial primitives for member_vnf_index=1
325 vdu_id=None: charm error executing primitive verify-ssh-credentials for member_vnf_index=1
326 vdu_id=None: ''timeout after 600 seconds'''
327 id: f48163a6-c807-47bc-9682-f72caef5af85
328 instantiate_params:
329 nsDescription: default description
330 nsName: ALF
331 nsdId: 8c2f8b95-bb1b-47ee-8001-36dc090678da
332 vimAccountId: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
333 name: ALF
334 name-ref: ALF
335 ns-instance-config-ref: f48163a6-c807-47bc-9682-f72caef5af85
336 nsd:
337 _admin:
338 created: 1566823353.971486
339 modified: 1566823353.971486
340 onboardingState: ONBOARDED
341 operationalState: ENABLED
342 projects_read:
343 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
344 projects_write:
345 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
346 storage:
347 descriptor: hackfest_3charmed_nsd/hackfest_3charmed_nsd.yaml
348 folder: 8c2f8b95-bb1b-47ee-8001-36dc090678da
349 fs: local
350 path: /app/storage/
351 pkg-dir: hackfest_3charmed_nsd
352 zipfile: package.tar.gz
353 usageState: NOT_IN_USE
354 userDefinedData: {}
355 _id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
356 id: hackfest3charmed-ns
357 name: hackfest3charmed-ns
358 description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and mgmtnet VLs
359 designer: OSM
360 version: '1.0'
361
362 vnfd-id:
363 - hackfest3charmed-vnf
364
365 virtual-link-desc:
366 - id: mgmt
367 mgmt-network: "true"
368 - id: datanet
369 mgmt-network: "false"
370
371 df:
372 - id: hackfest_charmed_DF
373 vnf-profile:
374 - id: hackfest_vnf1 # member-vnf-index-ref: 1
375 vnfd-id: hackfest3charmed-vnf
376 virtual-link-connectivity:
377 - virtual-link-profile-id: mgmt
378 constituent-cpd-id:
379 - constituent-base-element-id: hackfest_vnf1
380 constituent-cpd-id: vnf-mgmt-ext
381 - virtual-link-profile-id: datanet
382 constituent-cpd-id:
383 - constituent-base-element-id: hackfest_vnf1
384 constituent-cpd-id: vnf-data-ext
385 - id: hackfest_vnf2 # member-vnf-index-ref: 2
386 vnfd-id: hackfest3charmed-vnf
387 virtual-link-connectivity:
388 - virtual-link-profile-id: mgmt
389 constituent-cpd-id:
390 - constituent-base-element-id: hackfest_vnf2
391 constituent-cpd-id: vnf-mgmt-ext
392 - virtual-link-profile-id: datanet
393 constituent-cpd-id:
394 - constituent-base-element-id: hackfest_vnf2
395 constituent-cpd-id: vnf-data-ext
396 nsd-id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
397 nsd-name-ref: hackfest3charmed-ns
398 nsd-ref: hackfest3charmed-ns
399 operational-events: []
400 operational-status: failed
401 orchestration-progress: {}
402 resource-orchestrator: osmopenmano
403 short-name: ALF
404 ssh-authorized-key: null
405 vld:
406 - id: mgmt
407 name: null
408 status: ACTIVE
409 status-detailed: null
410 vim-id: f99ae780-0e2f-4985-af41-574eae6919c0
411 vim-network-name: mgmt
412 - id: datanet
413 name: ALF-datanet
414 status: ACTIVE
415 status-detailed: null
416 vim-id: c31364ba-f573-4ab6-bf1a-fed30ede39a8
417 vnfd-id:
418 - 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
419 """
420
421 db_nslcmops_text = """
422 ---
423 - _admin:
424 created: 1566823354.4148262
425 modified: 1566823354.4148262
426 projects_read:
427 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
428 projects_write:
429 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
430 worker: 86434c2948e2
431 _id: a639fac7-e0bb-4225-8ecb-c1f8efcc125e
432 detailed-status: 'FAILED executing proxy charm initial primitives for member_vnf_index=1
433 vdu_id=None: charm error executing primitive verify-ssh-credentials for member_vnf_index=1
434 vdu_id=None: ''timeout after 600 seconds'''
435 id: a639fac7-e0bb-4225-8ecb-c1f8efcc125e
436 isAutomaticInvocation: false
437 isCancelPending: false
438 lcmOperationType: instantiate
439 links:
440 nsInstance: /osm/nslcm/v1/ns_instances/f48163a6-c807-47bc-9682-f72caef5af85
441 self: /osm/nslcm/v1/ns_lcm_op_occs/a639fac7-e0bb-4225-8ecb-c1f8efcc125e
442 nsInstanceId: f48163a6-c807-47bc-9682-f72caef5af85
443 operationParams:
444 additionalParamsForVnf:
445 - additionalParams:
446 touch_filename: /home/ubuntu/first-touch-1
447 touch_filename2: /home/ubuntu/second-touch-1
448 member-vnf-index: '1'
449 - additionalParams:
450 touch_filename: /home/ubuntu/first-touch-2
451 touch_filename2: /home/ubuntu/second-touch-2
452 member-vnf-index: '2'
453 lcmOperationType: instantiate
454 nsDescription: default description
455 nsInstanceId: f48163a6-c807-47bc-9682-f72caef5af85
456 nsName: ALF
457 nsdId: 8c2f8b95-bb1b-47ee-8001-36dc090678da
458 vimAccountId: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
459 operationState: FAILED
460 startTime: 1566823354.414689
461 statusEnteredTime: 1566824534.5112448
462 """
463
464 db_vnfrs_text = """
465 ---
466 - _admin:
467 created: 1566823354.3668208
468 modified: 1566823354.3668208
469 nsState: NOT_INSTANTIATED
470 projects_read:
471 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
472 projects_write:
473 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
474 _id: 88d90b0c-faff-4b9f-bccd-017f33985984
475 additionalParamsForVnf:
476 touch_filename: /home/ubuntu/first-touch-1
477 touch_filename2: /home/ubuntu/second-touch-1
478 connection-point:
479 - connection-point-id: vnf-mgmt
480 id: vnf-mgmt
481 name: vnf-mgmt
482 - connection-point-id: vnf-data
483 id: vnf-data
484 name: vnf-data
485 created-time: 1566823354.36234
486 id: 88d90b0c-faff-4b9f-bccd-017f33985984
487 ip-address: 10.205.1.46
488 member-vnf-index-ref: '1'
489 nsr-id-ref: f48163a6-c807-47bc-9682-f72caef5af85
490 vdur:
491 - _id: f0e7d7ce-2443-4dcb-ad0b-5ab9f3b13d37
492 count-index: 0
493 interfaces:
494 - ip-address: 10.205.1.46
495 mac-address: fa:16:3e:b4:3e:b1
496 mgmt-vnf: true
497 name: mgmtVM-eth0
498 ns-vld-id: mgmt
499 - ip-address: 192.168.54.2
500 mac-address: fa:16:3e:6e:7e:78
501 name: mgmtVM-eth1
502 vnf-vld-id: internal
503 internal-connection-point:
504 - connection-point-id: mgmtVM-internal
505 id: mgmtVM-internal
506 name: mgmtVM-internal
507 ip-address: 10.205.1.46
508 name: ALF-1-mgmtVM-1
509 status: ACTIVE
510 status-detailed: null
511 vdu-id-ref: mgmtVM
512 vim-id: c2538499-4c30-41c0-acd5-80cb92f48061
513 - _id: ab453219-2d9a-45c2-864d-2c0788385028
514 count-index: 0
515 interfaces:
516 - ip-address: 192.168.54.3
517 mac-address: fa:16:3e:d9:7a:5d
518 name: dataVM-eth0
519 vnf-vld-id: internal
520 - ip-address: 192.168.24.3
521 mac-address: fa:16:3e:d1:6c:0d
522 name: dataVM-xe0
523 ns-vld-id: datanet
524 internal-connection-point:
525 - connection-point-id: dataVM-internal
526 id: dataVM-internal
527 name: dataVM-internal
528 ip-address: null
529 name: ALF-1-dataVM-1
530 status: ACTIVE
531 status-detailed: null
532 vdu-id-ref: dataVM
533 vim-id: 87973c3f-365d-4227-95c2-7a8abc74349c
534 vim-account-id: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
535 vld:
536 - id: internal
537 name: ALF-internal
538 status: ACTIVE
539 status-detailed: null
540 vim-id: ff181e6d-2597-4244-b40b-bb0174bdfeb6
541 vnfd-id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
542 vnfd-ref: hackfest3charmed-vnf
543 - _admin:
544 created: 1566823354.3703845
545 modified: 1566823354.3703845
546 nsState: NOT_INSTANTIATED
547 projects_read:
548 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
549 projects_write:
550 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
551 _id: 1ca3bb1a-b29b-49fe-bed6-5f3076d77434
552 additionalParamsForVnf:
553 touch_filename: /home/ubuntu/first-touch-2
554 touch_filename2: /home/ubuntu/second-touch-2
555 connection-point:
556 - connection-point-id: vnf-mgmt
557 id: vnf-mgmt
558 name: vnf-mgmt
559 - connection-point-id: vnf-data
560 id: vnf-data
561 name: vnf-data
562 created-time: 1566823354.36234
563 id: 1ca3bb1a-b29b-49fe-bed6-5f3076d77434
564 ip-address: 10.205.1.47
565 member-vnf-index-ref: '2'
566 nsr-id-ref: f48163a6-c807-47bc-9682-f72caef5af85
567 vdur:
568 - _id: 190b4a2c-4f85-4cfe-9406-4cef7ffb1e67
569 count-index: 0
570 interfaces:
571 - ip-address: 10.205.1.47
572 mac-address: fa:16:3e:cb:9f:c7
573 mgmt-vnf: true
574 name: mgmtVM-eth0
575 ns-vld-id: mgmt
576 - ip-address: 192.168.231.1
577 mac-address: fa:16:3e:1a:89:24
578 name: mgmtVM-eth1
579 vnf-vld-id: internal
580 internal-connection-point:
581 - connection-point-id: mgmtVM-internal
582 id: mgmtVM-internal
583 name: mgmtVM-internal
584 ip-address: 10.205.1.47
585 name: ALF-2-mgmtVM-1
586 status: ACTIVE
587 status-detailed: null
588 vdu-id-ref: mgmtVM
589 vim-id: 248077b2-e3b8-4a37-8b72-575abb8ed912
590 - _id: 889b874d-e1c3-4e75-aa45-53a9b0ddabd9
591 count-index: 0
592 interfaces:
593 - ip-address: 192.168.231.3
594 mac-address: fa:16:3e:7e:ba:8c
595 name: dataVM-eth0
596 vnf-vld-id: internal
597 - ip-address: 192.168.24.4
598 mac-address: fa:16:3e:d2:e1:f5
599 name: dataVM-xe0
600 ns-vld-id: datanet
601 internal-connection-point:
602 - connection-point-id: dataVM-internal
603 id: dataVM-internal
604 name: dataVM-internal
605 ip-address: null
606 name: ALF-2-dataVM-1
607 status: ACTIVE
608 status-detailed: null
609 vdu-id-ref: dataVM
610 vim-id: a4ce4372-e0ad-4ae3-8f9f-1c969f32e77b
611 vim-account-id: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
612 vld:
613 - id: internal
614 name: ALF-internal
615 status: ACTIVE
616 status-detailed: null
617 vim-id: ff181e6d-2597-4244-b40b-bb0174bdfeb6
618 vnfd-id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
619 vnfd-ref: hackfest3charmed-vnf
620 """