VCD feature 7193-provider_nerwork
[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 connection-point:
79 - id: vnf-mgmt
80 name: vnf-mgmt
81 short-name: vnf-mgmt
82 type: VPORT
83 - id: vnf-data
84 name: vnf-data
85 short-name: vnf-data
86 type: VPORT
87 description: A VNF consisting of 2 VDUs connected to an internal VL, and one VDU
88 with cloud-init
89 id: hackfest3charmed-vnf
90 internal-vld:
91 - id: internal
92 internal-connection-point:
93 - id-ref: mgmtVM-internal
94 - id-ref: dataVM-internal
95 name: internal
96 short-name: internal
97 type: ELAN
98 logo: osm.png
99 mgmt-interface:
100 cp: vnf-mgmt
101 monitoring-param:
102 - aggregation-type: AVERAGE
103 id: monitor1
104 name: monitor1
105 vdu-monitoring-param:
106 vdu-monitoring-param-ref: dataVM_cpu_util
107 vdu-ref: dataVM
108 name: hackfest3charmed-vnf
109 scaling-group-descriptor:
110 - max-instance-count: 10
111 name: scale_dataVM
112 scaling-config-action:
113 - trigger: post-scale-out
114 vnf-config-primitive-name-ref: touch
115 - trigger: pre-scale-in
116 vnf-config-primitive-name-ref: touch
117 scaling-policy:
118 - cooldown-time: 60
119 name: auto_cpu_util_above_threshold
120 scaling-criteria:
121 - name: cpu_util_above_threshold
122 scale-in-relational-operation: LE
123 scale-in-threshold: '15.0000000000'
124 scale-out-relational-operation: GE
125 scale-out-threshold: '60.0000000000'
126 vnf-monitoring-param-ref: monitor1
127 scaling-type: automatic
128 threshold-time: 0
129 vdu:
130 - count: 1
131 vdu-id-ref: dataVM
132 short-name: hackfest3charmed-vnf
133 vdu:
134 - count: '1'
135 cloud-init-file: cloud-config.txt
136 id: mgmtVM
137 image: hackfest3-mgmt
138 interface:
139 - external-connection-point-ref: vnf-mgmt
140 name: mgmtVM-eth0
141 position: 1
142 type: EXTERNAL
143 virtual-interface:
144 type: VIRTIO
145 - internal-connection-point-ref: mgmtVM-internal
146 name: mgmtVM-eth1
147 position: 2
148 type: INTERNAL
149 virtual-interface:
150 type: VIRTIO
151 internal-connection-point:
152 - id: mgmtVM-internal
153 name: mgmtVM-internal
154 short-name: mgmtVM-internal
155 type: VPORT
156 name: mgmtVM
157 vm-flavor:
158 memory-mb: '1024'
159 storage-gb: '10'
160 vcpu-count: 1
161 - count: '1'
162 id: dataVM
163 image: hackfest3-mgmt
164 interface:
165 - internal-connection-point-ref: dataVM-internal
166 name: dataVM-eth0
167 position: 1
168 type: INTERNAL
169 virtual-interface:
170 type: VIRTIO
171 - external-connection-point-ref: vnf-data
172 name: dataVM-xe0
173 position: 2
174 type: EXTERNAL
175 virtual-interface:
176 type: VIRTIO
177 internal-connection-point:
178 - id: dataVM-internal
179 name: dataVM-internal
180 short-name: dataVM-internal
181 type: VPORT
182 monitoring-param:
183 - id: dataVM_cpu_util
184 nfvi-metric: cpu_utilization
185 name: dataVM
186 vm-flavor:
187 memory-mb: '1024'
188 storage-gb: '10'
189 vcpu-count: 1
190 version: '1.0'
191 vnf-configuration:
192 config-primitive:
193 - name: touch
194 parameter:
195 - data-type: STRING
196 default-value: <touch_filename2>
197 name: filename
198 initial-config-primitive:
199 - name: config
200 parameter:
201 - name: ssh-hostname
202 value: <rw_mgmt_ip>
203 - name: ssh-username
204 value: ubuntu
205 - name: ssh-password
206 value: osm4u
207 seq: '1'
208 - name: touch
209 parameter:
210 - name: filename
211 value: <touch_filename>
212 seq: '2'
213 juju:
214 charm: simple
215 """
216
217 db_nsds_text = """
218 ---
219 - _admin:
220 created: 1566823353.971486
221 modified: 1566823353.971486
222 onboardingState: ONBOARDED
223 operationalState: ENABLED
224 projects_read:
225 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
226 projects_write:
227 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
228 storage:
229 descriptor: hackfest_3charmed_nsd/hackfest_3charmed_nsd.yaml
230 folder: 8c2f8b95-bb1b-47ee-8001-36dc090678da
231 fs: local
232 path: /app/storage/
233 pkg-dir: hackfest_3charmed_nsd
234 zipfile: package.tar.gz
235 usageState: NOT_IN_USE
236 userDefinedData: {}
237 _id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
238 constituent-vnfd:
239 - member-vnf-index: '1'
240 vnfd-id-ref: hackfest3charmed-vnf
241 - member-vnf-index: '2'
242 vnfd-id-ref: hackfest3charmed-vnf
243 description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and mgmtnet
244 VLs
245 id: hackfest3charmed-ns
246 logo: osm.png
247 name: hackfest3charmed-ns
248 short-name: hackfest3charmed-ns
249 version: '1.0'
250 vld:
251 - id: mgmt
252 mgmt-network: true
253 name: mgmt
254 short-name: mgmt
255 type: ELAN
256 vim-network-name: mgmt
257 vnfd-connection-point-ref:
258 - member-vnf-index-ref: '1'
259 vnfd-connection-point-ref: vnf-mgmt
260 vnfd-id-ref: hackfest3charmed-vnf
261 - member-vnf-index-ref: '2'
262 vnfd-connection-point-ref: vnf-mgmt
263 vnfd-id-ref: hackfest3charmed-vnf
264 - id: datanet
265 name: datanet
266 short-name: datanet
267 type: ELAN
268 vnfd-connection-point-ref:
269 - member-vnf-index-ref: '1'
270 vnfd-connection-point-ref: vnf-data
271 vnfd-id-ref: hackfest3charmed-vnf
272 - member-vnf-index-ref: '2'
273 vnfd-connection-point-ref: vnf-data
274 vnfd-id-ref: hackfest3charmed-vnf
275 """
276
277 db_nsrs_text = """
278 ---
279 - _admin:
280 created: 1566823354.3716335
281 modified: 1566823354.3716335
282 nsState: NOT_INSTANTIATED
283 nslcmop: null
284 projects_read:
285 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
286 projects_write:
287 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
288 _id: f48163a6-c807-47bc-9682-f72caef5af85
289 additionalParamsForNs: null
290 admin-status: ENABLED
291 config-status: init
292 constituent-vnfr-ref:
293 - 88d90b0c-faff-4b9f-bccd-017f33985984
294 - 1ca3bb1a-b29b-49fe-bed6-5f3076d77434
295 create-time: 1566823354.36234
296 datacenter: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
297 description: default description
298 detailed-status: 'ERROR executing proxy charm initial primitives for member_vnf_index=1
299 vdu_id=None: charm error executing primitive verify-ssh-credentials for member_vnf_index=1
300 vdu_id=None: ''timeout after 600 seconds'''
301 id: f48163a6-c807-47bc-9682-f72caef5af85
302 instantiate_params:
303 nsDescription: default description
304 nsName: ALF
305 nsdId: 8c2f8b95-bb1b-47ee-8001-36dc090678da
306 vimAccountId: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
307 name: ALF
308 name-ref: ALF
309 ns-instance-config-ref: f48163a6-c807-47bc-9682-f72caef5af85
310 nsd:
311 _admin:
312 created: 1566823353.971486
313 modified: 1566823353.971486
314 onboardingState: ONBOARDED
315 operationalState: ENABLED
316 projects_read:
317 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
318 projects_write:
319 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
320 storage:
321 descriptor: hackfest_3charmed_nsd/hackfest_3charmed_nsd.yaml
322 folder: 8c2f8b95-bb1b-47ee-8001-36dc090678da
323 fs: local
324 path: /app/storage/
325 pkg-dir: hackfest_3charmed_nsd
326 zipfile: package.tar.gz
327 usageState: NOT_IN_USE
328 userDefinedData: {}
329 _id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
330 constituent-vnfd:
331 - member-vnf-index: '1'
332 vnfd-id-ref: hackfest3charmed-vnf
333 - member-vnf-index: '2'
334 vnfd-id-ref: hackfest3charmed-vnf
335 description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and
336 mgmtnet VLs
337 id: hackfest3charmed-ns
338 logo: osm.png
339 name: hackfest3charmed-ns
340 short-name: hackfest3charmed-ns
341 version: '1.0'
342 vld:
343 - id: mgmt
344 mgmt-network: true
345 name: mgmt
346 short-name: mgmt
347 type: ELAN
348 vim-network-name: mgmt
349 vnfd-connection-point-ref:
350 - member-vnf-index-ref: '1'
351 vnfd-connection-point-ref: vnf-mgmt
352 vnfd-id-ref: hackfest3charmed-vnf
353 - member-vnf-index-ref: '2'
354 vnfd-connection-point-ref: vnf-mgmt
355 vnfd-id-ref: hackfest3charmed-vnf
356 - id: datanet
357 name: datanet
358 short-name: datanet
359 type: ELAN
360 vnfd-connection-point-ref:
361 - member-vnf-index-ref: '1'
362 vnfd-connection-point-ref: vnf-data
363 vnfd-id-ref: hackfest3charmed-vnf
364 - member-vnf-index-ref: '2'
365 vnfd-connection-point-ref: vnf-data
366 vnfd-id-ref: hackfest3charmed-vnf
367 nsd-id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
368 nsd-name-ref: hackfest3charmed-ns
369 nsd-ref: hackfest3charmed-ns
370 operational-events: []
371 operational-status: failed
372 orchestration-progress: {}
373 resource-orchestrator: osmopenmano
374 short-name: ALF
375 ssh-authorized-key: null
376 vld:
377 - id: mgmt
378 name: null
379 status: ACTIVE
380 status-detailed: null
381 vim-id: f99ae780-0e2f-4985-af41-574eae6919c0
382 vim-network-name: mgmt
383 - id: datanet
384 name: ALF-datanet
385 status: ACTIVE
386 status-detailed: null
387 vim-id: c31364ba-f573-4ab6-bf1a-fed30ede39a8
388 vnfd-id:
389 - 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
390 """
391
392 db_nslcmops_text = """
393 ---
394 - _admin:
395 created: 1566823354.4148262
396 modified: 1566823354.4148262
397 projects_read:
398 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
399 projects_write:
400 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
401 worker: 86434c2948e2
402 _id: a639fac7-e0bb-4225-8ecb-c1f8efcc125e
403 detailed-status: 'FAILED executing proxy charm initial primitives for member_vnf_index=1
404 vdu_id=None: charm error executing primitive verify-ssh-credentials for member_vnf_index=1
405 vdu_id=None: ''timeout after 600 seconds'''
406 id: a639fac7-e0bb-4225-8ecb-c1f8efcc125e
407 isAutomaticInvocation: false
408 isCancelPending: false
409 lcmOperationType: instantiate
410 links:
411 nsInstance: /osm/nslcm/v1/ns_instances/f48163a6-c807-47bc-9682-f72caef5af85
412 self: /osm/nslcm/v1/ns_lcm_op_occs/a639fac7-e0bb-4225-8ecb-c1f8efcc125e
413 nsInstanceId: f48163a6-c807-47bc-9682-f72caef5af85
414 operationParams:
415 additionalParamsForVnf:
416 - additionalParams:
417 touch_filename: /home/ubuntu/first-touch-1
418 touch_filename2: /home/ubuntu/second-touch-1
419 member-vnf-index: '1'
420 - additionalParams:
421 touch_filename: /home/ubuntu/first-touch-2
422 touch_filename2: /home/ubuntu/second-touch-2
423 member-vnf-index: '2'
424 lcmOperationType: instantiate
425 nsDescription: default description
426 nsInstanceId: f48163a6-c807-47bc-9682-f72caef5af85
427 nsName: ALF
428 nsdId: 8c2f8b95-bb1b-47ee-8001-36dc090678da
429 vimAccountId: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
430 operationState: FAILED
431 startTime: 1566823354.414689
432 statusEnteredTime: 1566824534.5112448
433 """
434
435 db_vnfrs_text = """
436 ---
437 - _admin:
438 created: 1566823354.3668208
439 modified: 1566823354.3668208
440 nsState: NOT_INSTANTIATED
441 projects_read:
442 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
443 projects_write:
444 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
445 _id: 88d90b0c-faff-4b9f-bccd-017f33985984
446 additionalParamsForVnf:
447 touch_filename: /home/ubuntu/first-touch-1
448 touch_filename2: /home/ubuntu/second-touch-1
449 connection-point:
450 - connection-point-id: vnf-mgmt
451 id: vnf-mgmt
452 name: vnf-mgmt
453 - connection-point-id: vnf-data
454 id: vnf-data
455 name: vnf-data
456 created-time: 1566823354.36234
457 id: 88d90b0c-faff-4b9f-bccd-017f33985984
458 ip-address: 10.205.1.46
459 member-vnf-index-ref: '1'
460 nsr-id-ref: f48163a6-c807-47bc-9682-f72caef5af85
461 vdur:
462 - _id: f0e7d7ce-2443-4dcb-ad0b-5ab9f3b13d37
463 count-index: 0
464 interfaces:
465 - ip-address: 10.205.1.46
466 mac-address: fa:16:3e:b4:3e:b1
467 mgmt-vnf: true
468 name: mgmtVM-eth0
469 ns-vld-id: mgmt
470 - ip-address: 192.168.54.2
471 mac-address: fa:16:3e:6e:7e:78
472 name: mgmtVM-eth1
473 vnf-vld-id: internal
474 internal-connection-point:
475 - connection-point-id: mgmtVM-internal
476 id: mgmtVM-internal
477 name: mgmtVM-internal
478 ip-address: 10.205.1.46
479 name: ALF-1-mgmtVM-1
480 status: ACTIVE
481 status-detailed: null
482 vdu-id-ref: mgmtVM
483 vim-id: c2538499-4c30-41c0-acd5-80cb92f48061
484 - _id: ab453219-2d9a-45c2-864d-2c0788385028
485 count-index: 0
486 interfaces:
487 - ip-address: 192.168.54.3
488 mac-address: fa:16:3e:d9:7a:5d
489 name: dataVM-eth0
490 vnf-vld-id: internal
491 - ip-address: 192.168.24.3
492 mac-address: fa:16:3e:d1:6c:0d
493 name: dataVM-xe0
494 ns-vld-id: datanet
495 internal-connection-point:
496 - connection-point-id: dataVM-internal
497 id: dataVM-internal
498 name: dataVM-internal
499 ip-address: null
500 name: ALF-1-dataVM-1
501 status: ACTIVE
502 status-detailed: null
503 vdu-id-ref: dataVM
504 vim-id: 87973c3f-365d-4227-95c2-7a8abc74349c
505 vim-account-id: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
506 vld:
507 - id: internal
508 name: ALF-internal
509 status: ACTIVE
510 status-detailed: null
511 vim-id: ff181e6d-2597-4244-b40b-bb0174bdfeb6
512 vnfd-id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
513 vnfd-ref: hackfest3charmed-vnf
514 - _admin:
515 created: 1566823354.3703845
516 modified: 1566823354.3703845
517 nsState: NOT_INSTANTIATED
518 projects_read:
519 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
520 projects_write:
521 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
522 _id: 1ca3bb1a-b29b-49fe-bed6-5f3076d77434
523 additionalParamsForVnf:
524 touch_filename: /home/ubuntu/first-touch-2
525 touch_filename2: /home/ubuntu/second-touch-2
526 connection-point:
527 - connection-point-id: vnf-mgmt
528 id: vnf-mgmt
529 name: vnf-mgmt
530 - connection-point-id: vnf-data
531 id: vnf-data
532 name: vnf-data
533 created-time: 1566823354.36234
534 id: 1ca3bb1a-b29b-49fe-bed6-5f3076d77434
535 ip-address: 10.205.1.47
536 member-vnf-index-ref: '2'
537 nsr-id-ref: f48163a6-c807-47bc-9682-f72caef5af85
538 vdur:
539 - _id: 190b4a2c-4f85-4cfe-9406-4cef7ffb1e67
540 count-index: 0
541 interfaces:
542 - ip-address: 10.205.1.47
543 mac-address: fa:16:3e:cb:9f:c7
544 mgmt-vnf: true
545 name: mgmtVM-eth0
546 ns-vld-id: mgmt
547 - ip-address: 192.168.231.1
548 mac-address: fa:16:3e:1a:89:24
549 name: mgmtVM-eth1
550 vnf-vld-id: internal
551 internal-connection-point:
552 - connection-point-id: mgmtVM-internal
553 id: mgmtVM-internal
554 name: mgmtVM-internal
555 ip-address: 10.205.1.47
556 name: ALF-2-mgmtVM-1
557 status: ACTIVE
558 status-detailed: null
559 vdu-id-ref: mgmtVM
560 vim-id: 248077b2-e3b8-4a37-8b72-575abb8ed912
561 - _id: 889b874d-e1c3-4e75-aa45-53a9b0ddabd9
562 count-index: 0
563 interfaces:
564 - ip-address: 192.168.231.3
565 mac-address: fa:16:3e:7e:ba:8c
566 name: dataVM-eth0
567 vnf-vld-id: internal
568 - ip-address: 192.168.24.4
569 mac-address: fa:16:3e:d2:e1:f5
570 name: dataVM-xe0
571 ns-vld-id: datanet
572 internal-connection-point:
573 - connection-point-id: dataVM-internal
574 id: dataVM-internal
575 name: dataVM-internal
576 ip-address: null
577 name: ALF-2-dataVM-1
578 status: ACTIVE
579 status-detailed: null
580 vdu-id-ref: dataVM
581 vim-id: a4ce4372-e0ad-4ae3-8f9f-1c969f32e77b
582 vim-account-id: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
583 vld:
584 - id: internal
585 name: ALF-internal
586 status: ACTIVE
587 status-detailed: null
588 vim-id: ff181e6d-2597-4244-b40b-bb0174bdfeb6
589 vnfd-id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
590 vnfd-ref: hackfest3charmed-vnf
591 """