dcf502069d0e10803cde3633f97bbeb08c88c8ef
[osm/LCM.git] / osm_lcm / tests / test_ns.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
19 import asynctest # pip3 install asynctest --user
20 import asyncio
21 import yaml
22 # import logging
23 from os import getenv
24 from osm_lcm.ns import NsLcm
25 from osm_common.dbmongo import DbMongo
26 from osm_common.msgkafka import MsgKafka
27 from osm_common.fslocal import FsLocal
28 from osm_lcm.lcm_utils import TaskRegistry
29 from n2vc.vnf import N2VC
30 from uuid import uuid4
31
32 __author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
33
34 """ Perform unittests using asynctest of osm_lcm.ns module
35 It allows, if some testing ENV are supplied, testing without mocking some external libraries for debugging:
36 OSMLCMTEST_NS_PUBKEY: public ssh-key returned by N2VC to inject to VMs
37 OSMLCMTEST_PACKAGES_PATH: path where the vnf-packages are stored (de-compressed), each one on a 'vnfd_id' folder
38 OSMLCMTEST_NS_IPADDRESS: IP address where emulated VMs are reached. Comma separate list
39 OSMLCMTEST_VCA_NOMOCK: Do no mock the VCA, N2VC library, for debugging it
40 OSMLCMTEST_RO_NOMOCK: Do no mock the ROClient library, for debugging it
41 OSMLCMTEST_DB_NOMOCK: Do no mock the database library, for debugging it
42 OSMLCMTEST_FS_NOMOCK: Do no mock the File Storage library, for debugging it
43 OSMLCMTEST_LOGGING_NOMOCK: Do no mock the logging
44 OSMLCM_VCA_XXX: configuration of N2VC
45 OSMLCM_RO_XXX: configuration of RO
46 """
47
48
49 vca_config = { # TODO replace with os.get_env to get other configurations
50 "host": getenv("OSMLCM_VCA_HOST", "vca"),
51 "port": getenv("OSMLCM_VCA_PORT", 17070),
52 "user": getenv("OSMLCM_VCA_USER", "admin"),
53 "secret": getenv("OSMLCM_VCA_SECRET", "vca"),
54 "pubkey": getenv("OSMLCM_VCA_PUBKEY", None),
55 'cacert': getenv("OSMLCM_VCA_CACERT", None)
56 }
57
58 ro_config = {
59 "endpoint_url": "http://{}:{}/openmano".format(getenv("OSMLCM_RO_HOST", "ro"), getenv("OSMLCM_RO_PORT", "9090")),
60 "tenant": getenv("OSMLCM_RO_TENANT", "osm"),
61 "logger_name": "lcm.ROclient",
62 "loglevel": "DEBUG",
63 }
64
65 db_vim_accounts_text = """
66 ---
67 - _admin:
68 created: 1566818150.3024442
69 current_operation: 0
70 deployed:
71 RO: dc51ce6c-c7f2-11e9-b9c0-02420aff0004
72 RO-account: dc5c67fa-c7f2-11e9-b9c0-02420aff0004
73 detailed-status: Done
74 modified: 1566818150.3024442
75 operationalState: ENABLED
76 operations:
77 - detailed-status: Done
78 lcmOperationType: create
79 operationParams: null
80 operationState: COMPLETED
81 startTime: 1566818150.3025382
82 statusEnteredTime: 1566818150.3025382
83 worker: 86434c2948e2
84 projects_read:
85 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
86 projects_write:
87 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
88 _id: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
89 description: Openstack site 2, based on Mirantis, also called DSS9000-1, with
90 tenant tid
91 name: ost2-mrt-tid
92 schema_version: '1.1'
93 vim_password: 5g0yGX86qIhprX86YTMcpg==
94 vim_tenant_name: osm
95 vim_type: openstack
96 vim_url: http://10.95.87.162:5000/v2.0
97 vim_user: osm
98 """
99
100 db_vnfds_text = """
101 ---
102 - _admin:
103 created: 1566823352.7154346
104 modified: 1566823353.9295402
105 onboardingState: ONBOARDED
106 operationalState: ENABLED
107 projects_read:
108 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
109 projects_write:
110 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
111 storage:
112 descriptor: hackfest_3charmed_vnfd/hackfest_3charmed_vnfd.yaml
113 folder: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
114 fs: local
115 path: /app/storage/
116 pkg-dir: hackfest_3charmed_vnfd
117 zipfile: package.tar.gz
118 type: vnfd
119 usageState: NOT_IN_USE
120 userDefinedData: {}
121 _id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
122 connection-point:
123 - id: vnf-mgmt
124 name: vnf-mgmt
125 short-name: vnf-mgmt
126 type: VPORT
127 - id: vnf-data
128 name: vnf-data
129 short-name: vnf-data
130 type: VPORT
131 description: A VNF consisting of 2 VDUs connected to an internal VL, and one VDU
132 with cloud-init
133 id: hackfest3charmed-vnf
134 internal-vld:
135 - id: internal
136 internal-connection-point:
137 - id-ref: mgmtVM-internal
138 - id-ref: dataVM-internal
139 name: internal
140 short-name: internal
141 type: ELAN
142 logo: osm.png
143 mgmt-interface:
144 cp: vnf-mgmt
145 monitoring-param:
146 - aggregation-type: AVERAGE
147 id: monitor1
148 name: monitor1
149 vdu-monitoring-param:
150 vdu-monitoring-param-ref: dataVM_cpu_util
151 vdu-ref: dataVM
152 name: hackfest3charmed-vnf
153 scaling-group-descriptor:
154 - max-instance-count: 10
155 name: scale_dataVM
156 scaling-config-action:
157 - trigger: post-scale-out
158 vnf-config-primitive-name-ref: touch
159 - trigger: pre-scale-in
160 vnf-config-primitive-name-ref: touch
161 scaling-policy:
162 - cooldown-time: 60
163 name: auto_cpu_util_above_threshold
164 scaling-criteria:
165 - name: cpu_util_above_threshold
166 scale-in-relational-operation: LE
167 scale-in-threshold: '15.0000000000'
168 scale-out-relational-operation: GE
169 scale-out-threshold: '60.0000000000'
170 vnf-monitoring-param-ref: monitor1
171 scaling-type: automatic
172 threshold-time: 0
173 vdu:
174 - count: 1
175 vdu-id-ref: dataVM
176 short-name: hackfest3charmed-vnf
177 vdu:
178 - count: '1'
179 cloud-init-file: cloud-config.txt
180 id: mgmtVM
181 image: hackfest3-mgmt
182 interface:
183 - external-connection-point-ref: vnf-mgmt
184 name: mgmtVM-eth0
185 position: 1
186 type: EXTERNAL
187 virtual-interface:
188 type: VIRTIO
189 - internal-connection-point-ref: mgmtVM-internal
190 name: mgmtVM-eth1
191 position: 2
192 type: INTERNAL
193 virtual-interface:
194 type: VIRTIO
195 internal-connection-point:
196 - id: mgmtVM-internal
197 name: mgmtVM-internal
198 short-name: mgmtVM-internal
199 type: VPORT
200 name: mgmtVM
201 vm-flavor:
202 memory-mb: '1024'
203 storage-gb: '10'
204 vcpu-count: 1
205 - count: '1'
206 id: dataVM
207 image: hackfest3-mgmt
208 interface:
209 - internal-connection-point-ref: dataVM-internal
210 name: dataVM-eth0
211 position: 1
212 type: INTERNAL
213 virtual-interface:
214 type: VIRTIO
215 - external-connection-point-ref: vnf-data
216 name: dataVM-xe0
217 position: 2
218 type: EXTERNAL
219 virtual-interface:
220 type: VIRTIO
221 internal-connection-point:
222 - id: dataVM-internal
223 name: dataVM-internal
224 short-name: dataVM-internal
225 type: VPORT
226 monitoring-param:
227 - id: dataVM_cpu_util
228 nfvi-metric: cpu_utilization
229 name: dataVM
230 vm-flavor:
231 memory-mb: '1024'
232 storage-gb: '10'
233 vcpu-count: 1
234 version: '1.0'
235 vnf-configuration:
236 config-primitive:
237 - name: touch
238 parameter:
239 - data-type: STRING
240 default-value: <touch_filename2>
241 name: filename
242 initial-config-primitive:
243 - name: config
244 parameter:
245 - name: ssh-hostname
246 value: <rw_mgmt_ip>
247 - name: ssh-username
248 value: ubuntu
249 - name: ssh-password
250 value: osm4u
251 seq: '1'
252 - name: touch
253 parameter:
254 - name: filename
255 value: <touch_filename>
256 seq: '2'
257 juju:
258 charm: simple
259 """
260
261 db_nsds_text = """
262 ---
263 - _admin:
264 created: 1566823353.971486
265 modified: 1566823353.971486
266 onboardingState: ONBOARDED
267 operationalState: ENABLED
268 projects_read:
269 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
270 projects_write:
271 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
272 storage:
273 descriptor: hackfest_3charmed_nsd/hackfest_3charmed_nsd.yaml
274 folder: 8c2f8b95-bb1b-47ee-8001-36dc090678da
275 fs: local
276 path: /app/storage/
277 pkg-dir: hackfest_3charmed_nsd
278 zipfile: package.tar.gz
279 usageState: NOT_IN_USE
280 userDefinedData: {}
281 _id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
282 constituent-vnfd:
283 - member-vnf-index: '1'
284 vnfd-id-ref: hackfest3charmed-vnf
285 - member-vnf-index: '2'
286 vnfd-id-ref: hackfest3charmed-vnf
287 description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and mgmtnet
288 VLs
289 id: hackfest3charmed-ns
290 logo: osm.png
291 name: hackfest3charmed-ns
292 short-name: hackfest3charmed-ns
293 version: '1.0'
294 vld:
295 - id: mgmt
296 mgmt-network: true
297 name: mgmt
298 short-name: mgmt
299 type: ELAN
300 vim-network-name: mgmt
301 vnfd-connection-point-ref:
302 - member-vnf-index-ref: '1'
303 vnfd-connection-point-ref: vnf-mgmt
304 vnfd-id-ref: hackfest3charmed-vnf
305 - member-vnf-index-ref: '2'
306 vnfd-connection-point-ref: vnf-mgmt
307 vnfd-id-ref: hackfest3charmed-vnf
308 - id: datanet
309 name: datanet
310 short-name: datanet
311 type: ELAN
312 vnfd-connection-point-ref:
313 - member-vnf-index-ref: '1'
314 vnfd-connection-point-ref: vnf-data
315 vnfd-id-ref: hackfest3charmed-vnf
316 - member-vnf-index-ref: '2'
317 vnfd-connection-point-ref: vnf-data
318 vnfd-id-ref: hackfest3charmed-vnf
319 """
320
321 db_nsrs_text = """
322 ---
323 - _admin:
324 created: 1566823354.3716335
325 deployed:
326 RO:
327 nsd_id: 876573b5-968d-40b9-b52b-91bf5c5844f7
328 nsr_id: c9fe9908-3180-430d-b633-fca2f68db008
329 nsr_status: ACTIVE
330 vnfd:
331 - id: 1ab2a418-9fe3-4358-bf17-411e5155535f
332 member-vnf-index: '1'
333 - id: 0de348e3-c201-4f6a-91cc-7f957e2d5504
334 member-vnf-index: '2'
335 VCA:
336 - application: alf-b-aa
337 detailed-status: Ready!
338 member-vnf-index: '1'
339 model: f48163a6-c807-47bc-9682-f72caef5af85
340 operational-status: active
341 primitive_id: null
342 ssh-public-key: ssh-rsa pub-key root@juju-145d3e-0
343 step: ssh-public-key-obtained
344 vdu_count_index: null
345 vdu_id: null
346 vdu_name: null
347 vnfd_id: hackfest3charmed-vnf
348 - application: alf-c-ab
349 detailed-status: Ready!
350 member-vnf-index: '2'
351 model: f48163a6-c807-47bc-9682-f72caef5af85
352 operational-status: active
353 primitive_id: null
354 ssh-public-key: ssh-rsa pub-key root@juju-145d3e-0
355 step: ssh-public-key-obtained
356 vdu_count_index: null
357 vdu_id: null
358 vdu_name: null
359 vnfd_id: hackfest3charmed-vnf
360 VCA-model-name: f48163a6-c807-47bc-9682-f72caef5af85
361 modified: 1566823354.3716335
362 nsState: INSTANTIATED
363 nslcmop: null
364 projects_read:
365 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
366 projects_write:
367 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
368 _id: f48163a6-c807-47bc-9682-f72caef5af85
369 additionalParamsForNs: null
370 admin-status: ENABLED
371 config-status: init
372 constituent-vnfr-ref:
373 - 88d90b0c-faff-4b9f-bccd-017f33985984
374 - 1ca3bb1a-b29b-49fe-bed6-5f3076d77434
375 create-time: 1566823354.36234
376 datacenter: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
377 description: default description
378 detailed-status: 'ERROR executing proxy charm initial primitives for member_vnf_index=1
379 vdu_id=None: charm error executing primitive verify-ssh-credentials for member_vnf_index=1
380 vdu_id=None: ''timeout after 600 seconds'''
381 id: f48163a6-c807-47bc-9682-f72caef5af85
382 instantiate_params:
383 nsDescription: default description
384 nsName: ALF
385 nsdId: 8c2f8b95-bb1b-47ee-8001-36dc090678da
386 vimAccountId: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
387 name: ALF
388 name-ref: ALF
389 ns-instance-config-ref: f48163a6-c807-47bc-9682-f72caef5af85
390 nsd:
391 _admin:
392 created: 1566823353.971486
393 modified: 1566823353.971486
394 onboardingState: ONBOARDED
395 operationalState: ENABLED
396 projects_read:
397 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
398 projects_write:
399 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
400 storage:
401 descriptor: hackfest_3charmed_nsd/hackfest_3charmed_nsd.yaml
402 folder: 8c2f8b95-bb1b-47ee-8001-36dc090678da
403 fs: local
404 path: /app/storage/
405 pkg-dir: hackfest_3charmed_nsd
406 zipfile: package.tar.gz
407 usageState: NOT_IN_USE
408 userDefinedData: {}
409 _id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
410 constituent-vnfd:
411 - member-vnf-index: '1'
412 vnfd-id-ref: hackfest3charmed-vnf
413 - member-vnf-index: '2'
414 vnfd-id-ref: hackfest3charmed-vnf
415 description: NS with 2 VNFs hackfest3charmed-vnf connected by datanet and
416 mgmtnet VLs
417 id: hackfest3charmed-ns
418 logo: osm.png
419 name: hackfest3charmed-ns
420 short-name: hackfest3charmed-ns
421 version: '1.0'
422 vld:
423 - id: mgmt
424 mgmt-network: true
425 name: mgmt
426 short-name: mgmt
427 type: ELAN
428 vim-network-name: mgmt
429 vnfd-connection-point-ref:
430 - member-vnf-index-ref: '1'
431 vnfd-connection-point-ref: vnf-mgmt
432 vnfd-id-ref: hackfest3charmed-vnf
433 - member-vnf-index-ref: '2'
434 vnfd-connection-point-ref: vnf-mgmt
435 vnfd-id-ref: hackfest3charmed-vnf
436 - id: datanet
437 name: datanet
438 short-name: datanet
439 type: ELAN
440 vnfd-connection-point-ref:
441 - member-vnf-index-ref: '1'
442 vnfd-connection-point-ref: vnf-data
443 vnfd-id-ref: hackfest3charmed-vnf
444 - member-vnf-index-ref: '2'
445 vnfd-connection-point-ref: vnf-data
446 vnfd-id-ref: hackfest3charmed-vnf
447 nsd-id: 8c2f8b95-bb1b-47ee-8001-36dc090678da
448 nsd-name-ref: hackfest3charmed-ns
449 nsd-ref: hackfest3charmed-ns
450 operational-events: []
451 operational-status: failed
452 orchestration-progress: {}
453 resource-orchestrator: osmopenmano
454 short-name: ALF
455 ssh-authorized-key: null
456 vld:
457 - id: mgmt
458 name: null
459 status: ACTIVE
460 status-detailed: null
461 vim-id: f99ae780-0e2f-4985-af41-574eae6919c0
462 vim-network-name: mgmt
463 - id: datanet
464 name: ALF-datanet
465 status: ACTIVE
466 status-detailed: null
467 vim-id: c31364ba-f573-4ab6-bf1a-fed30ede39a8
468 vnfd-id:
469 - 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
470 """
471
472 db_nslcmops_text = """
473 ---
474 - _admin:
475 created: 1566823354.4148262
476 modified: 1566823354.4148262
477 projects_read:
478 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
479 projects_write:
480 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
481 worker: 86434c2948e2
482 _id: a639fac7-e0bb-4225-8ecb-c1f8efcc125e
483 detailed-status: 'FAILED executing proxy charm initial primitives for member_vnf_index=1
484 vdu_id=None: charm error executing primitive verify-ssh-credentials for member_vnf_index=1
485 vdu_id=None: ''timeout after 600 seconds'''
486 id: a639fac7-e0bb-4225-8ecb-c1f8efcc125e
487 isAutomaticInvocation: false
488 isCancelPending: false
489 lcmOperationType: instantiate
490 links:
491 nsInstance: /osm/nslcm/v1/ns_instances/f48163a6-c807-47bc-9682-f72caef5af85
492 self: /osm/nslcm/v1/ns_lcm_op_occs/a639fac7-e0bb-4225-8ecb-c1f8efcc125e
493 nsInstanceId: f48163a6-c807-47bc-9682-f72caef5af85
494 operationParams:
495 additionalParamsForVnf:
496 - additionalParams:
497 touch_filename: /home/ubuntu/first-touch-1
498 touch_filename2: /home/ubuntu/second-touch-1
499 member-vnf-index: '1'
500 - additionalParams:
501 touch_filename: /home/ubuntu/first-touch-2
502 touch_filename2: /home/ubuntu/second-touch-2
503 member-vnf-index: '2'
504 lcmOperationType: instantiate
505 nsDescription: default description
506 nsInstanceId: f48163a6-c807-47bc-9682-f72caef5af85
507 nsName: ALF
508 nsdId: 8c2f8b95-bb1b-47ee-8001-36dc090678da
509 vimAccountId: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
510 operationState: FAILED
511 startTime: 1566823354.414689
512 statusEnteredTime: 1566824534.5112448
513 """
514
515 db_vnfrs_text = """
516 ---
517 - _admin:
518 created: 1566823354.3668208
519 modified: 1566823354.3668208
520 nsState: NOT_INSTANTIATED
521 projects_read:
522 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
523 projects_write:
524 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
525 _id: 88d90b0c-faff-4b9f-bccd-017f33985984
526 additionalParamsForVnf:
527 touch_filename: /home/ubuntu/first-touch-1
528 touch_filename2: /home/ubuntu/second-touch-1
529 connection-point:
530 - connection-point-id: vnf-mgmt
531 id: vnf-mgmt
532 name: vnf-mgmt
533 - connection-point-id: vnf-data
534 id: vnf-data
535 name: vnf-data
536 created-time: 1566823354.36234
537 id: 88d90b0c-faff-4b9f-bccd-017f33985984
538 ip-address: 10.205.1.46
539 member-vnf-index-ref: '1'
540 nsr-id-ref: f48163a6-c807-47bc-9682-f72caef5af85
541 vdur:
542 - _id: f0e7d7ce-2443-4dcb-ad0b-5ab9f3b13d37
543 count-index: 0
544 interfaces:
545 - ip-address: 10.205.1.46
546 mac-address: fa:16:3e:b4:3e:b1
547 mgmt-vnf: true
548 name: mgmtVM-eth0
549 ns-vld-id: mgmt
550 - ip-address: 192.168.54.2
551 mac-address: fa:16:3e:6e:7e:78
552 name: mgmtVM-eth1
553 vnf-vld-id: internal
554 internal-connection-point:
555 - connection-point-id: mgmtVM-internal
556 id: mgmtVM-internal
557 name: mgmtVM-internal
558 ip-address: 10.205.1.46
559 name: ALF-1-mgmtVM-1
560 status: ACTIVE
561 status-detailed: null
562 vdu-id-ref: mgmtVM
563 vim-id: c2538499-4c30-41c0-acd5-80cb92f48061
564 - _id: ab453219-2d9a-45c2-864d-2c0788385028
565 count-index: 0
566 interfaces:
567 - ip-address: 192.168.54.3
568 mac-address: fa:16:3e:d9:7a:5d
569 name: dataVM-eth0
570 vnf-vld-id: internal
571 - ip-address: 192.168.24.3
572 mac-address: fa:16:3e:d1:6c:0d
573 name: dataVM-xe0
574 ns-vld-id: datanet
575 internal-connection-point:
576 - connection-point-id: dataVM-internal
577 id: dataVM-internal
578 name: dataVM-internal
579 ip-address: null
580 name: ALF-1-dataVM-1
581 status: ACTIVE
582 status-detailed: null
583 vdu-id-ref: dataVM
584 vim-id: 87973c3f-365d-4227-95c2-7a8abc74349c
585 vim-account-id: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
586 vld:
587 - id: internal
588 name: ALF-internal
589 status: ACTIVE
590 status-detailed: null
591 vim-id: ff181e6d-2597-4244-b40b-bb0174bdfeb6
592 vnfd-id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
593 vnfd-ref: hackfest3charmed-vnf
594 - _admin:
595 created: 1566823354.3703845
596 modified: 1566823354.3703845
597 nsState: NOT_INSTANTIATED
598 projects_read:
599 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
600 projects_write:
601 - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
602 _id: 1ca3bb1a-b29b-49fe-bed6-5f3076d77434
603 additionalParamsForVnf:
604 touch_filename: /home/ubuntu/first-touch-2
605 touch_filename2: /home/ubuntu/second-touch-2
606 connection-point:
607 - connection-point-id: vnf-mgmt
608 id: vnf-mgmt
609 name: vnf-mgmt
610 - connection-point-id: vnf-data
611 id: vnf-data
612 name: vnf-data
613 created-time: 1566823354.36234
614 id: 1ca3bb1a-b29b-49fe-bed6-5f3076d77434
615 ip-address: 10.205.1.47
616 member-vnf-index-ref: '2'
617 nsr-id-ref: f48163a6-c807-47bc-9682-f72caef5af85
618 vdur:
619 - _id: 190b4a2c-4f85-4cfe-9406-4cef7ffb1e67
620 count-index: 0
621 interfaces:
622 - ip-address: 10.205.1.47
623 mac-address: fa:16:3e:cb:9f:c7
624 mgmt-vnf: true
625 name: mgmtVM-eth0
626 ns-vld-id: mgmt
627 - ip-address: 192.168.231.1
628 mac-address: fa:16:3e:1a:89:24
629 name: mgmtVM-eth1
630 vnf-vld-id: internal
631 internal-connection-point:
632 - connection-point-id: mgmtVM-internal
633 id: mgmtVM-internal
634 name: mgmtVM-internal
635 ip-address: 10.205.1.47
636 name: ALF-2-mgmtVM-1
637 status: ACTIVE
638 status-detailed: null
639 vdu-id-ref: mgmtVM
640 vim-id: 248077b2-e3b8-4a37-8b72-575abb8ed912
641 - _id: 889b874d-e1c3-4e75-aa45-53a9b0ddabd9
642 count-index: 0
643 interfaces:
644 - ip-address: 192.168.231.3
645 mac-address: fa:16:3e:7e:ba:8c
646 name: dataVM-eth0
647 vnf-vld-id: internal
648 - ip-address: 192.168.24.4
649 mac-address: fa:16:3e:d2:e1:f5
650 name: dataVM-xe0
651 ns-vld-id: datanet
652 internal-connection-point:
653 - connection-point-id: dataVM-internal
654 id: dataVM-internal
655 name: dataVM-internal
656 ip-address: null
657 name: ALF-2-dataVM-1
658 status: ACTIVE
659 status-detailed: null
660 vdu-id-ref: dataVM
661 vim-id: a4ce4372-e0ad-4ae3-8f9f-1c969f32e77b
662 vim-account-id: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
663 vld:
664 - id: internal
665 name: ALF-internal
666 status: ACTIVE
667 status-detailed: null
668 vim-id: ff181e6d-2597-4244-b40b-bb0174bdfeb6
669 vnfd-id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
670 vnfd-ref: hackfest3charmed-vnf
671 """
672
673 ro_ns_text = """
674 datacenter_tenant_id: dc5c67fa-c7f2-11e9-b9c0-02420aff0004
675 description: null
676 name: ALF
677 nets:
678 - created: false
679 datacenter_id: dc51ce6c-c7f2-11e9-b9c0-02420aff0004
680 datacenter_tenant_id: dc5c67fa-c7f2-11e9-b9c0-02420aff0004
681 error_msg: null
682 ns_net_osm_id: mgmt
683 related: c6bac394-fa27-4c43-bb34-42f621a9d343
684 sce_net_id: 8f215bab-c35e-41e6-a035-42bfaa07af9f
685 sdn_net_id: null
686 status: ACTIVE
687 uuid: c6bac394-fa27-4c43-bb34-42f621a9d343
688 vim_info: "{vim_info: null}"
689 vim_name: null
690 vim_net_id: f99ae780-0e2f-4985-af41-574eae6919c0
691 vnf_net_id: null
692 vnf_net_osm_id: null
693 - created: true
694 datacenter_id: dc51ce6c-c7f2-11e9-b9c0-02420aff0004
695 datacenter_tenant_id: dc5c67fa-c7f2-11e9-b9c0-02420aff0004
696 error_msg: null
697 ns_net_osm_id: datanet
698 related: 509d576c-120f-493a-99a1-5fea99dfe041
699 sce_net_id: 3d766bbc-33a8-41aa-a986-2f35e8d25c16
700 sdn_net_id: null
701 status: ACTIVE
702 uuid: 509d576c-120f-493a-99a1-5fea99dfe041
703 vim_info: "{vim_info: null}"
704 vim_name: ALF-datanet
705 vim_net_id: c31364ba-f573-4ab6-bf1a-fed30ede39a8
706 vnf_net_id: null
707 vnf_net_osm_id: null
708 - created: true
709 datacenter_id: dc51ce6c-c7f2-11e9-b9c0-02420aff0004
710 datacenter_tenant_id: dc5c67fa-c7f2-11e9-b9c0-02420aff0004
711 error_msg: null
712 ns_net_osm_id: null
713 related: 277fed09-3220-4bfd-9052-b96b21a32daf
714 sce_net_id: null
715 sdn_net_id: null
716 status: ACTIVE
717 uuid: 277fed09-3220-4bfd-9052-b96b21a32daf
718 vim_info: "{vim_info: null}"
719 vim_name: ALF-internal
720 vim_net_id: ff181e6d-2597-4244-b40b-bb0174bdfeb6
721 vnf_net_id: 62e62fae-c12b-4ebc-9a9b-30031c6c16fa
722 vnf_net_osm_id: internal
723 - created: true
724 datacenter_id: dc51ce6c-c7f2-11e9-b9c0-02420aff0004
725 datacenter_tenant_id: dc5c67fa-c7f2-11e9-b9c0-02420aff0004
726 error_msg: null
727 ns_net_osm_id: null
728 related: 92534d1a-e697-4372-a84d-aa0aa643b68a
729 sce_net_id: null
730 sdn_net_id: null
731 status: ACTIVE
732 uuid: 92534d1a-e697-4372-a84d-aa0aa643b68a
733 vim_info: "{vim_info: null}"
734 vim_name: ALF-internal
735 vim_net_id: 09655387-b639-421a-b5f6-72b26d685fb4
736 vnf_net_id: 13c6c77d-86a5-4914-832c-990d4ec7b54e
737 vnf_net_osm_id: internal
738 nsd_osm_id: f48163a6-c807-47bc-9682-f72caef5af85.2.hackfest3charmed-ns
739 scenario_id: 876573b5-968d-40b9-b52b-91bf5c5844f7
740 scenario_name: hackfest3charmed-ns
741 sfis: []
742 sfps: []
743 sfs: []
744 tenant_id: 0ea38bd0-2729-47a9-ae07-c6ce76115eb2
745 uuid: c9fe9908-3180-430d-b633-fca2f68db008
746 vnfs:
747 - datacenter_id: dc51ce6c-c7f2-11e9-b9c0-02420aff0004
748 datacenter_tenant_id: dc5c67fa-c7f2-11e9-b9c0-02420aff0004
749 ip_address: 10.205.1.46
750 member_vnf_index: '1'
751 mgmt_access: '{interface_id: 61549ee3-cd6c-4930-8b90-eaad97fe345b, required: ''False'',
752 vm_id: 6cf4a48f-3b6c-4395-8221-119fa37de24a}
753
754 '
755 sce_vnf_id: 83be04a8-c513-42ba-9908-22728f686d31
756 uuid: 94724042-7576-4fb0-82ec-6a7ab642741c
757 vms:
758 - created_at: '2019-08-26T12:50:38'
759 error_msg: null
760 interfaces:
761 - external_name: vnf-mgmt
762 instance_net_id: c6bac394-fa27-4c43-bb34-42f621a9d343
763 internal_name: mgmtVM-eth0
764 ip_address: 10.205.1.46
765 mac_address: fa:16:3e:b4:3e:b1
766 sdn_port_id: null
767 type: mgmt
768 vim_info: "{vim_info: null}"
769 vim_interface_id: 4d3cb8fd-7040-4169-a0ad-2486d2b006a1
770 - external_name: null
771 instance_net_id: 277fed09-3220-4bfd-9052-b96b21a32daf
772 internal_name: mgmtVM-eth1
773 ip_address: 192.168.54.2
774 mac_address: fa:16:3e:6e:7e:78
775 sdn_port_id: null
776 type: bridge
777 vim_info: "{vim_info: null}"
778 vim_interface_id: 54ed68e2-9802-4dfe-b68a-280b3fc6e02d
779 ip_address: 10.205.1.46
780 name: mgmtVM
781 related: d0b91293-a91d-4f08-b15f-0bf841216dfe
782 status: ACTIVE
783 uuid: d0b91293-a91d-4f08-b15f-0bf841216dfe
784 vdu_osm_id: mgmtVM
785 vim_info: "{vim_info: null}"
786 vim_name: ALF-1-mgmtVM-1
787 vim_vm_id: c2538499-4c30-41c0-acd5-80cb92f48061
788 - created_at: '2019-08-26T12:50:38'
789 error_msg: null
790 interfaces:
791 - external_name: null
792 instance_net_id: 277fed09-3220-4bfd-9052-b96b21a32daf
793 internal_name: dataVM-eth0
794 ip_address: 192.168.54.3
795 mac_address: fa:16:3e:d9:7a:5d
796 sdn_port_id: null
797 type: bridge
798 vim_info: "{vim_info: null}"
799 vim_interface_id: 1637f350-8840-4241-8ed0-4616bdcecfcf
800 - external_name: vnf-data
801 instance_net_id: 509d576c-120f-493a-99a1-5fea99dfe041
802 internal_name: dataVM-xe0
803 ip_address: 192.168.24.3
804 mac_address: fa:16:3e:d1:6c:0d
805 sdn_port_id: null
806 type: bridge
807 vim_info: "{vim_info: null}"
808 vim_interface_id: 54c73e83-7059-41fe-83a9-4c4ae997b481
809 name: dataVM
810 related: 5c08253d-8a35-474f-b0d3-c5297d174c13
811 status: ACTIVE
812 uuid: 5c08253d-8a35-474f-b0d3-c5297d174c13
813 vdu_osm_id: dataVM
814 vim_info: "{vim_info: null}"
815 vim_name: ALF-1-dataVM-1
816 vim_vm_id: 87973c3f-365d-4227-95c2-7a8abc74349c
817 - created_at: '2019-08-26T13:40:54'
818 error_msg: null
819 interfaces:
820 - external_name: null
821 instance_net_id: 277fed09-3220-4bfd-9052-b96b21a32daf
822 internal_name: dataVM-eth0
823 ip_address: 192.168.54.5
824 mac_address: fa:16:3e:e4:17:45
825 sdn_port_id: null
826 type: bridge
827 vim_info: "{vim_info: null}"
828 vim_interface_id: 7e246e40-8710-4c33-9c95-78fc3c02bc5b
829 - external_name: vnf-data
830 instance_net_id: 509d576c-120f-493a-99a1-5fea99dfe041
831 internal_name: dataVM-xe0
832 ip_address: 192.168.24.5
833 mac_address: fa:16:3e:29:6f:a6
834 sdn_port_id: null
835 type: bridge
836 vim_info: "{vim_info: null}"
837 vim_interface_id: ce81af7a-9adf-494b-950e-6581fd04ecc4
838 name: dataVM
839 related: 1ae5a0a2-c15a-49a4-a77c-2991d97f6dbe
840 status: ACTIVE
841 uuid: 1ae5a0a2-c15a-49a4-a77c-2991d97f6dbe
842 vdu_osm_id: dataVM
843 vim_info: "{vim_info: null}"
844 vim_name: ALF-1-dataVM-2
845 vim_vm_id: 4916533e-36c6-4861-9fe3-366a8fb0a5f8
846 vnf_id: 1ab2a418-9fe3-4358-bf17-411e5155535f
847 vnf_name: hackfest3charmed-vnf.1
848 vnfd_osm_id: f48163a6-c807-47bc-9682-f72caef5af85.0.1
849 - datacenter_id: dc51ce6c-c7f2-11e9-b9c0-02420aff0004
850 datacenter_tenant_id: dc5c67fa-c7f2-11e9-b9c0-02420aff0004
851 ip_address: 10.205.1.47
852 member_vnf_index: '2'
853 mgmt_access: '{interface_id: 538604c3-5c5e-41eb-8f84-c0239c7fabcd, required: ''False'',
854 vm_id: dd04d792-05c9-4ecc-bf28-f77384d00311}
855
856 '
857 sce_vnf_id: c4f3607a-08ff-4f75-893c-fce507e2f240
858 uuid: 00020403-e80f-4ef2-bb7e-b29669643035
859 vms:
860 - created_at: '2019-08-26T12:50:38'
861 error_msg: null
862 interfaces:
863 - external_name: vnf-mgmt
864 instance_net_id: c6bac394-fa27-4c43-bb34-42f621a9d343
865 internal_name: mgmtVM-eth0
866 ip_address: 10.205.1.47
867 mac_address: fa:16:3e:cb:9f:c7
868 sdn_port_id: null
869 type: mgmt
870 vim_info: "{vim_info: null}"
871 vim_interface_id: dcd6d2de-3c68-481c-883e-e9d38c671dc4
872 - external_name: null
873 instance_net_id: 92534d1a-e697-4372-a84d-aa0aa643b68a
874 internal_name: mgmtVM-eth1
875 ip_address: 192.168.231.1
876 mac_address: fa:16:3e:1a:89:24
877 sdn_port_id: null
878 type: bridge
879 vim_info: "{vim_info: null}"
880 vim_interface_id: 50e538e3-aba0-4652-93bb-20487f3f28e1
881 ip_address: 10.205.1.47
882 name: mgmtVM
883 related: 4543ab5d-578c-427c-9df2-affd17e21b66
884 status: ACTIVE
885 uuid: 4543ab5d-578c-427c-9df2-affd17e21b66
886 vdu_osm_id: mgmtVM
887 vim_info: "{vim_info: null}"
888 vim_name: ALF-2-mgmtVM-1
889 vim_vm_id: 248077b2-e3b8-4a37-8b72-575abb8ed912
890 - created_at: '2019-08-26T12:50:38'
891 error_msg: null
892 interfaces:
893 - external_name: null
894 instance_net_id: 92534d1a-e697-4372-a84d-aa0aa643b68a
895 internal_name: dataVM-eth0
896 ip_address: 192.168.231.3
897 mac_address: fa:16:3e:7e:ba:8c
898 sdn_port_id: null
899 type: bridge
900 vim_info: "{vim_info: null}"
901 vim_interface_id: 15274862-14ea-4527-b405-101cae8bc1a0
902 - external_name: vnf-data
903 instance_net_id: 509d576c-120f-493a-99a1-5fea99dfe041
904 internal_name: dataVM-xe0
905 ip_address: 192.168.24.4
906 mac_address: fa:16:3e:d2:e1:f5
907 sdn_port_id: null
908 type: bridge
909 vim_info: "{vim_info: null}"
910 vim_interface_id: 253ebe4e-38d5-46be-8777-dbb57510a2ec
911 name: dataVM
912 related: 6f03f16b-295a-47a1-9a69-2d069d574a33
913 status: ACTIVE
914 uuid: 6f03f16b-295a-47a1-9a69-2d069d574a33
915 vdu_osm_id: dataVM
916 vim_info: "{vim_info: null}"
917 vim_name: ALF-2-dataVM-1
918 vim_vm_id: a4ce4372-e0ad-4ae3-8f9f-1c969f32e77b
919 vnf_id: 0de348e3-c201-4f6a-91cc-7f957e2d5504
920 vnf_name: hackfest3charmed-vnf.2
921 vnfd_osm_id: f48163a6-c807-47bc-9682-f72caef5af85.1.2
922 """
923
924
925 class TestMyNS(asynctest.TestCase):
926
927 def _db_get_one(self, table, q_filter=None, fail_on_empty=True, fail_on_more=True):
928 if table not in self.db_content:
929 self.assertTrue(False, "db.get_one called with table={}".format(table))
930 for db_item in self.db_content[table]:
931 if db_item["_id"] == q_filter["_id"]:
932 return db_item
933 else:
934 self.assertTrue(False, "db.get_one, table={}, not found _id={}".format(table, q_filter["_id"]))
935
936 def _db_get_list(self, table, q_filter=None):
937 if table not in self.db_content:
938 self.assertTrue(False, "db.get_list called with table={} not found".format(table))
939 return self.db_content[table]
940
941 def _db_set_one(self, table, q_filter, update_dict, fail_on_empty=True, unset=None, pull=None, push=None):
942 db_item = self._db_get_one(table, q_filter, fail_on_empty=fail_on_empty)
943 for k, v in update_dict.items():
944 db_nested = db_item
945 k_list = k.split(".")
946 for k_nested in k_list[0:-1]:
947 if isinstance(db_nested, list):
948 db_nested = db_nested[int(k_nested)]
949 else:
950 if k_nested not in db_nested:
951 db_nested[k_nested] = {}
952 db_nested = db_nested[k_nested]
953 k_nested = k_list[-1]
954 if isinstance(db_nested, list):
955 if int(k_nested) < len(db_nested):
956 db_nested[int(k_nested)] = v
957 else:
958 db_nested.insert(int(k_nested), v)
959 else:
960 db_nested[k_nested] = v
961
962 async def _n2vc_DeployCharms(self, model_name, application_name, vnfd, charm_path, params={}, machine_spec={},
963 callback=None, *callback_args):
964 if callback:
965 for status, message in (("maintenance", "installing sofwware"), ("active", "Ready!")):
966 # call callback after some time
967 asyncio.sleep(5, loop=self.loop)
968 callback(model_name, application_name, status, message, *callback_args)
969
970 @staticmethod
971 def _n2vc_FormatApplicationName(*args):
972 num_calls = 0
973 while True:
974 yield "app_name-{}".format(num_calls)
975 num_calls += 1
976
977 def _n2vc_CreateExecutionEnvironment(self, namespace):
978 k_list = namespace.split(".")
979 ee_id = k_list[1] + "."
980 if len(k_list) >= 2:
981 for k in k_list[2:4]:
982 ee_id += k[:8]
983 else:
984 ee_id += "_NS_"
985 return ee_id
986
987 def _ro_show(self, *args, **kwargs):
988 ro_ns_desc = yaml.load(ro_ns_text)
989
990 # if ip address provided, replace descriptor
991 ip_addresses = getenv("OSMLCMTEST_NS_IPADDRESS", "")
992 if ip_addresses:
993 ip_addresses_list = ip_addresses.split(",")
994 for vnf in ro_ns_desc["vnfs"]:
995 if not ip_addresses_list:
996 break
997 vnf["ip_address"] = ip_addresses_list[0]
998 for vm in vnf["vms"]:
999 if not ip_addresses_list:
1000 break
1001 vm["ip_address"] = ip_addresses_list.pop(0)
1002
1003 while True:
1004 yield ro_ns_desc
1005 for net in ro_ns_desc["nets"]:
1006 if net["status"] != "ACTIVE":
1007 net["status"] = "ACTIVE"
1008 break
1009 else:
1010 for vnf in ro_ns_desc["vnfs"]:
1011 for vm in vnf["vms"]:
1012 if vm["status"] != "ACTIVE":
1013 vm["status"] = "ACTIVE"
1014 break
1015
1016 def _ro_create(self, *args, **kwargs):
1017 while True:
1018 yield {"uuid": str(uuid4())}
1019
1020 def _return_uuid(self, *args, **kwargs):
1021 return str(uuid4())
1022
1023 async def setUp(self):
1024 # Mock DB
1025 if not getenv("OSMLCMTEST_DB_NOMOCK"):
1026 self.db = asynctest.Mock(DbMongo())
1027 self.db.get_one.side_effect = self._db_get_one
1028 self.db.get_list.side_effect = self._db_get_list
1029 self.db.set_one.side_effect = self._db_set_one
1030 self.db_content = {
1031 "nsrs": yaml.load(db_nsrs_text),
1032 "nslcmops": yaml.load(db_nslcmops_text),
1033 "vnfrs": yaml.load(db_vnfrs_text),
1034 "vnfds": yaml.load(db_vnfds_text),
1035 "vim_accounts": yaml.load(db_vim_accounts_text),
1036 }
1037 self.db_vim_accounts = yaml.load(db_vim_accounts_text)
1038
1039 # Mock kafka
1040 self.msg = asynctest.Mock(MsgKafka())
1041
1042 # Mock filesystem
1043 if not getenv("OSMLCMTEST_FS_NOMOCK"):
1044 self.fs = asynctest.Mock(FsLocal())
1045 self.fs.get_params.return_value = {"path": getenv("OSMLCMTEST_PACKAGES_PATH", "./test/temp/packages")}
1046 self.fs.file_open = asynctest.mock_open()
1047 # self.fs.file_open.return_value.__enter__.return_value = asynctest.MagicMock() # called on a python "with"
1048 # self.fs.file_open.return_value.__enter__.return_value.read.return_value = "" # empty file
1049
1050 # Mock TaskRegistry
1051 self.lcm_tasks = asynctest.Mock(TaskRegistry())
1052 self.lcm_tasks.lock_HA.return_value = True
1053 self.lcm_tasks.waitfor_related_HA.return_value = None
1054 self.lcm_tasks.lookfor_related.return_value = ("", [])
1055
1056 # Create NsLCM class
1057 self.my_ns = NsLcm(self.db, self.msg, self.fs, self.lcm_tasks, ro_config, vca_config, self.loop)
1058
1059 # Mock logging
1060 if not getenv("OSMLCMTEST_LOGGING_NOMOCK"):
1061 self.my_ns.logger = asynctest.Mock(self.my_ns.logger)
1062
1063 # Mock VCA - N2VC
1064 if not getenv("OSMLCMTEST_VCA_NOMOCK"):
1065 pub_key = getenv("OSMLCMTEST_NS_PUBKEY", "ssh-rsa test-pub-key t@osm.com")
1066 self.my_ns.n2vc = asynctest.Mock(N2VC())
1067 self.my_ns.n2vc.GetPublicKey.return_value = getenv("OSMLCM_VCA_PUBKEY", "public_key")
1068 # allow several versions of n2vc
1069 self.my_ns.n2vc.FormatApplicationName = asynctest.Mock(side_effect=self._n2vc_FormatApplicationName())
1070 self.my_ns.n2vc.DeployCharms = asynctest.CoroutineMock(side_effect=self._n2vc_DeployCharms)
1071 self.my_ns.n2vc.CreateExecutionEnvironment = asynctest.CoroutineMock(
1072 side_effect=self._n2vc_CreateExecutionEnvironment)
1073 self.my_ns.n2vc.InstallConfigurationSW = asynctest.CoroutineMock(return_value=pub_key)
1074 self.my_ns.n2vc.ExecutePrimitive = asynctest.CoroutineMock(side_effect=self._return_uuid)
1075 self.my_ns.n2vc.GetPrimitiveStatus = asynctest.CoroutineMock(return_value="completed")
1076 self.my_ns.n2vc.GetPrimitiveOutput = asynctest.CoroutineMock(return_value={"result": "ok",
1077 "pubkey": pub_key})
1078
1079 # Mock RO
1080 if not getenv("OSMLCMTEST_RO_NOMOCK"):
1081 # self.my_ns.RO = asynctest.Mock(ROclient.ROClient(self.loop, **ro_config))
1082 # TODO first time should be empty list, following should return a dict
1083 self.my_ns.RO.get_list = asynctest.CoroutineMock(self.my_ns.RO.get_list, return_value=[])
1084 self.my_ns.RO.create = asynctest.CoroutineMock(self.my_ns.RO.create, side_effect=self._ro_create())
1085 self.my_ns.RO.show = asynctest.CoroutineMock(self.my_ns.RO.show, side_effect=self._ro_show())
1086
1087 @asynctest.fail_on(active_handles=True) # all async tasks must be completed
1088 async def test_instantiate(self):
1089 nsr_id = self.db_content["nsrs"][0]["_id"]
1090 nslcmop_id = self.db_content["nslcmops"][0]["_id"]
1091 print("Test instantiate started")
1092
1093 # delete deployed information of database
1094 if not getenv("OSMLCMTEST_DB_NOMOCK"):
1095 if self.db_content["nsrs"][0]["_admin"].get("deployed"):
1096 del self.db_content["nsrs"][0]["_admin"]["deployed"]
1097 for db_vnfr in self.db_content["vnfrs"]:
1098 db_vnfr.pop("ip_address", None)
1099 for db_vdur in db_vnfr["vdur"]:
1100 db_vdur.pop("ip_address", None)
1101 db_vdur.pop("mac_address", None)
1102
1103 await self.my_ns.instantiate(nsr_id, nslcmop_id)
1104
1105 print("instantiate_result: {}".format(self._db_get_one("nslcmops", {"_id": nslcmop_id}).get("detailed-status")))
1106
1107 self.msg.aiowrite.assert_called_once_with("ns", "instantiated",
1108 {"nsr_id": nsr_id, "nslcmop_id": nslcmop_id,
1109 "operationState": "COMPLETED"},
1110 loop=self.loop)
1111 self.lcm_tasks.lock_HA.assert_called_once_with('ns', 'nslcmops', nslcmop_id)
1112 if not getenv("OSMLCMTEST_LOGGING_NOMOCK"):
1113 self.assertTrue(self.my_ns.logger.debug.called, "Debug method not called")
1114 self.my_ns.logger.error.assert_not_called()
1115 self.my_ns.logger.exception().assert_not_called()
1116
1117 if not getenv("OSMLCMTEST_DB_NOMOCK"):
1118 self.assertTrue(self.db.set_one.called, "db.set_one not called")
1119
1120 # TODO add more checks of called methods
1121 # TODO add a terminate
1122
1123 @asynctest.fail_on(active_handles=True) # all async tasks must be completed
1124 async def test_scale(self):
1125 pass
1126
1127
1128 if __name__ == '__main__':
1129 asynctest.main()