1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
5 # http://www.apache.org/licenses/LICENSE-2.0
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
16 from toscaparser.common.exception import ExceptionCollector
17 from toscaparser.common.exception import URLException
18 from toscaparser.common.exception import ValidationError
19 from toscaparser.utils.gettextutils import _
20 from translator.common.utils import TranslationUtils
21 from translator.tests.base import TestCase
24 class ToscaHotTranslationTest(TestCase):
26 def test_hot_translate_single_server(self):
27 tosca_file = '../tests/data/tosca_single_server.yaml'
28 hot_file = '../tests/data/hot_output/hot_single_server.yaml'
30 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
33 self.assertEqual({}, diff, '<difference> : ' +
34 json.dumps(diff, indent=4, separators=(', ', ': ')))
36 def test_hot_translate_single_server_with_defaults(self):
38 '../tests/data/tosca_single_server_with_defaults.yaml'
39 hot_file_with_input = '../tests/data/hot_output/' \
40 'hot_single_server_with_defaults_with_input.yaml'
41 hot_file_without_input = '../tests/data/hot_output/' \
42 'hot_single_server_with_defaults_without_input.yaml'
44 params1 = {'cpus': '1'}
45 diff1 = TranslationUtils.compare_tosca_translation_with_hot(
46 tosca_file, hot_file_with_input, params1)
47 self.assertEqual({}, diff1, '<difference> : ' +
48 json.dumps(diff1, indent=4, separators=(', ', ': ')))
51 diff2 = TranslationUtils.compare_tosca_translation_with_hot(
52 tosca_file, hot_file_without_input, params2)
53 self.assertEqual({}, diff2, '<difference> : ' +
54 json.dumps(diff2, indent=4, separators=(', ', ': ')))
56 def test_hot_translate_wordpress_single_instance(self):
57 tosca_file = '../tests/data/tosca_single_instance_wordpress.yaml'
58 hot_file = '../tests/data/hot_output/' \
59 'hot_single_instance_wordpress.yaml'
60 params = {'db_name': 'wordpress',
63 'db_root_pwd': 'passw0rd',
66 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
69 self.assertEqual({}, diff, '<difference> : ' +
70 json.dumps(diff, indent=4, separators=(', ', ': ')))
72 def test_hot_translate_helloworld(self):
73 tosca_file = '../tests/data/tosca_helloworld.yaml'
74 hot_file = '../tests/data/hot_output/hot_hello_world.yaml'
75 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
78 self.assertEqual({}, diff, '<difference> : ' +
79 json.dumps(diff, indent=4, separators=(', ', ': ')))
81 def test_hot_translate_host_assignment(self):
82 tosca_file = '../tests/data/test_host_assignment.yaml'
83 hot_file = '../tests/data/hot_output/hot_host_assignment.yaml'
84 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
87 self.assertEqual({}, diff, '<difference> : ' +
88 json.dumps(diff, indent=4, separators=(', ', ': ')))
90 def test_hot_translate_elk(self):
91 tosca_file = '../tests/data/tosca_elk.yaml'
92 hot_file = '../tests/data/hot_output/hot_elk.yaml'
93 params = {'github_url':
94 'http://github.com/paypal/rest-api-sample-app-nodejs.git',
96 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
99 self.assertEqual({}, diff, '<difference> : ' +
100 json.dumps(diff, indent=4, separators=(', ', ': ')))
102 def test_hot_translate_nodejs_mongodb_two_instances(self):
103 tosca_file = '../tests/data/tosca_nodejs_mongodb_two_instances.yaml'
104 hot_file = '../tests/data/hot_output/' \
105 'hot_nodejs_mongodb_two_instances.yaml'
106 params = {'github_url':
107 'http://github.com/paypal/rest-api-sample-app-nodejs.git',
109 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
112 self.assertEqual({}, diff, '<difference> : ' +
113 json.dumps(diff, indent=4, separators=(', ', ': ')))
115 def test_hot_translate_blockstorage_with_attachment(self):
116 tosca_file = '../tests/data/storage/' \
117 'tosca_blockstorage_with_attachment.yaml'
118 hot_file = '../tests/data/hot_output/storage/' \
119 'hot_blockstorage_with_attachment.yaml'
121 'storage_location': '/dev/vdc',
122 'storage_size': '2000 MB',
123 'storage_snapshot_id': 'ssid'}
124 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
127 self.assertEqual({}, diff, '<difference> : ' +
128 json.dumps(diff, indent=4, separators=(', ', ': ')))
130 def test_hot_translate_blockstorage_with_custom_relationship_type(self):
131 tosca_file = '../tests/data/storage/' \
132 'tosca_blockstorage_with_custom_relationship_type.yaml'
133 hot_file = '../tests/data/hot_output/storage/' \
134 'hot_blockstorage_with_custom_relationship_type.yaml'
136 'storage_location': '/dev/vdc',
137 'storage_size': '1 GB',
138 'storage_snapshot_id': 'ssid'}
139 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
142 self.assertEqual({}, diff, '<difference> : ' +
143 json.dumps(diff, indent=4, separators=(', ', ': ')))
145 def test_hot_translate_blockstorage_with_relationship_template(self):
146 tosca_file = '../tests/data/storage/' \
147 'tosca_blockstorage_with_relationship_template.yaml'
148 hot_file = '../tests/data/hot_output/storage/' \
149 'hot_blockstorage_with_relationship_template.yaml'
151 'storage_location': '/dev/vdc',
152 'storage_size': '1 GB'}
153 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
156 self.assertEqual({}, diff, '<difference> : ' +
157 json.dumps(diff, indent=4, separators=(', ', ': ')))
159 def test_hot_translate_blockstorage_with_attachment_notation1(self):
160 tosca_file = '../tests/data/storage/' \
161 'tosca_blockstorage_with_attachment_notation1.yaml'
162 hot_file1 = '../tests/data/hot_output/storage/' \
163 'hot_blockstorage_with_attachment_notation1_alt1.yaml'
164 hot_file2 = '../tests/data/hot_output/storage/' \
165 'hot_blockstorage_with_attachment_notation1_alt2.yaml'
167 'storage_location': 'some_folder',
168 'storage_size': '1 GB',
169 'storage_snapshot_id': 'ssid'}
170 diff1 = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
174 self.assertEqual({}, diff1, '<difference> : ' +
175 json.dumps(diff1, indent=4,
176 separators=(', ', ': ')))
178 diff2 = TranslationUtils.compare_tosca_translation_with_hot(
179 tosca_file, hot_file2, params)
180 self.assertEqual({}, diff2, '<difference> : ' +
181 json.dumps(diff2, indent=4,
182 separators=(', ', ': ')))
184 def test_hot_translate_blockstorage_with_attachment_notation2(self):
185 tosca_file = '../tests/data/storage/' \
186 'tosca_blockstorage_with_attachment_notation2.yaml'
187 hot_file1 = '../tests/data/hot_output/storage/' \
188 'hot_blockstorage_with_attachment_notation2_alt1.yaml'
189 hot_file2 = '../tests/data/hot_output/storage/' \
190 'hot_blockstorage_with_attachment_notation2_alt2.yaml'
192 'storage_location': '/dev/vdc',
193 'storage_size': '1 GB',
194 'storage_snapshot_id': 'ssid'}
195 diff1 = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
199 self.assertEqual({}, diff1, '<difference> : ' +
200 json.dumps(diff1, indent=4,
201 separators=(', ', ': ')))
203 diff2 = TranslationUtils.compare_tosca_translation_with_hot(
204 tosca_file, hot_file2, params)
205 self.assertEqual({}, diff2, '<difference> : ' +
206 json.dumps(diff2, indent=4,
207 separators=(', ', ': ')))
209 def test_hot_translate_multiple_blockstorage_with_attachment(self):
210 tosca_file = '../tests/data/storage/' \
211 'tosca_multiple_blockstorage_with_attachment.yaml'
212 hot_file1 = '../tests/data/hot_output/storage/' \
213 'hot_multiple_blockstorage_with_attachment_alt1.yaml'
214 hot_file2 = '../tests/data/hot_output/storage/' \
215 'hot_multiple_blockstorage_with_attachment_alt2.yaml'
217 'storage_location': '/dev/vdc',
218 'storage_size': '1 GB',
219 'storage_snapshot_id': 'ssid'}
220 diff1 = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
224 self.assertEqual({}, diff1, '<difference> : ' +
225 json.dumps(diff1, indent=4,
226 separators=(', ', ': ')))
228 diff2 = TranslationUtils.compare_tosca_translation_with_hot(
229 tosca_file, hot_file2, params)
230 self.assertEqual({}, diff2, '<difference> : ' +
231 json.dumps(diff2, indent=4,
232 separators=(', ', ': ')))
234 def test_hot_translate_single_object_store(self):
235 tosca_file = '../tests/data/storage/tosca_single_object_store.yaml'
236 hot_file = '../tests/data/hot_output/hot_single_object_store.yaml'
237 params = {'objectstore_name': 'myobjstore'}
238 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
241 self.assertEqual({}, diff, '<difference> : ' +
242 json.dumps(diff, indent=4, separators=(', ', ': ')))
244 def test_hot_translate_one_server_one_network(self):
245 tosca_file = '../tests/data/network/tosca_one_server_one_network.yaml'
246 hot_file = '../tests/data/hot_output/network/' \
247 'hot_one_server_one_network.yaml'
248 params = {'network_name': 'private_net'}
249 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
252 self.assertEqual({}, diff, '<difference> : ' +
253 json.dumps(diff, indent=4, separators=(', ', ': ')))
255 def test_hot_translate_server_on_existing_network(self):
256 tosca_file = '../tests/data/network/' \
257 'tosca_server_on_existing_network.yaml'
258 hot_file = '../tests/data/hot_output/network/' \
259 'hot_server_on_existing_network.yaml'
260 params = {'network_name': 'private_net'}
261 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
264 self.assertEqual({}, diff, '<difference> : ' +
265 json.dumps(diff, indent=4, separators=(', ', ': ')))
267 def test_hot_translate_two_servers_one_network(self):
268 tosca_file = '../tests/data/network/tosca_two_servers_one_network.yaml'
269 hot_file = '../tests/data/hot_output/network/' \
270 'hot_two_servers_one_network.yaml'
271 params = {'network_name': 'my_private_net',
272 'network_cidr': '10.0.0.0/24',
273 'network_start_ip': '10.0.0.100',
274 'network_end_ip': '10.0.0.150'}
275 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
278 self.assertEqual({}, diff, '<difference> : ' +
279 json.dumps(diff, indent=4, separators=(', ', ': ')))
281 def test_hot_translate_one_server_three_networks(self):
282 tosca_file = '../tests/data/network/' \
283 'tosca_one_server_three_networks.yaml'
284 hot_file = '../tests/data/hot_output/network/' \
285 'hot_one_server_three_networks.yaml'
287 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
290 self.assertEqual({}, diff, '<difference> : ' +
291 json.dumps(diff, indent=4, separators=(', ', ': ')))
293 def test_hot_translate_software_component(self):
294 tosca_file = '../tests/data/tosca_software_component.yaml'
295 hot_file = '../tests/data/hot_output/hot_software_component.yaml'
296 params = {'cpus': '1',
297 'download_url': 'http://www.software.com/download'}
298 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
301 self.assertEqual({}, diff, '<difference> : ' +
302 json.dumps(diff, indent=4, separators=(', ', ': ')))
304 def test_hot_translate_web_application(self):
305 tosca_file = '../tests/data/tosca_web_application.yaml'
306 hot_file = '../tests/data/hot_output/hot_web_application.yaml'
307 params = {'cpus': '2', 'context_root': 'my_web_app'}
308 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
311 self.assertEqual({}, diff, '<difference> : ' +
312 json.dumps(diff, indent=4, separators=(', ', ': ')))
314 def test_hot_translate_template_with_url_import(self):
315 tosca_file = '../tests/data/' \
316 'tosca_single_instance_wordpress_with_url_import.yaml'
317 hot_file = '../tests/data/hot_output/' \
318 'hot_single_instance_wordpress.yaml'
319 params = {'db_name': 'wordpress',
320 'db_user': 'wp_user',
322 'db_root_pwd': 'passw0rd',
325 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
328 self.assertEqual({}, diff, '<difference> : ' +
329 json.dumps(diff, indent=4, separators=(', ', ': ')))
331 def test_hot_translate_template_by_url_with_local_import(self):
332 tosca_file = 'https://raw.githubusercontent.com/openstack/' \
333 'heat-translator/master/translator/tests/data/' \
334 'tosca_single_instance_wordpress.yaml'
335 hot_file = '../tests/data/hot_output/' \
336 'hot_single_instance_wordpress.yaml'
337 params = {'db_name': 'wordpress',
338 'db_user': 'wp_user',
340 'db_root_pwd': 'passw0rd',
343 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
346 self.assertEqual({}, diff, '<difference> : ' +
347 json.dumps(diff, indent=4, separators=(', ', ': ')))
349 def test_hot_translate_template_by_url_with_local_abspath_import(self):
350 tosca_file = 'https://raw.githubusercontent.com/openstack/' \
351 'heat-translator/master/translator/tests/data/' \
352 'tosca_single_instance_wordpress_with_local_abspath' \
354 hot_file = '../tests/data/hot_output/' \
355 'hot_single_instance_wordpress.yaml'
356 params = {'db_name': 'wordpress',
357 'db_user': 'wp_user',
359 'db_root_pwd': 'passw0rd',
365 TranslationUtils.compare_tosca_translation_with_hot,
366 tosca_file, hot_file, params)
367 expected_msg = _('Absolute file name "/tmp/wordpress.yaml" cannot be '
368 'used in a URL-based input template "https://raw.'
369 'githubusercontent.com/openstack/heat-translator/'
370 'master/translator/tests/data/tosca_single_instance_'
371 'wordpress_with_local_abspath_import.yaml".')
372 ExceptionCollector.assertExceptionMessage(ImportError, expected_msg)
374 def test_hot_translate_template_by_url_with_url_import(self):
375 tosca_url = 'https://raw.githubusercontent.com/openstack/' \
376 'heat-translator/master/translator/tests/data/' \
377 'tosca_single_instance_wordpress_with_url_import.yaml'
378 hot_file = '../tests/data/hot_output/' \
379 'hot_single_instance_wordpress.yaml'
380 params = {'db_name': 'wordpress',
381 'db_user': 'wp_user',
383 'db_root_pwd': 'passw0rd',
386 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_url,
389 self.assertEqual({}, diff, '<difference> : ' +
390 json.dumps(diff, indent=4, separators=(', ', ': ')))
392 def test_translate_hello_world_csar(self):
393 tosca_file = '../tests/data/csar_hello_world.zip'
394 hot_file = '../tests/data/hot_output/hot_hello_world.yaml'
395 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
398 self.assertEqual({}, diff, '<difference> : ' +
399 json.dumps(diff, indent=4, separators=(', ', ': ')))
401 def test_translate_single_instance_wordpress_csar(self):
402 tosca_file = '../tests/data/csar_single_instance_wordpress.zip'
403 hot_file = '../tests/data/hot_output/' \
404 'hot_single_instance_wordpress_from_csar.yaml'
405 params = {'db_name': 'wordpress',
406 'db_user': 'wp_user',
408 'db_root_pwd': 'passw0rd',
411 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
414 self.assertEqual({}, diff, '<difference> : ' +
415 json.dumps(diff, indent=4, separators=(', ', ': ')))
417 def test_translate_elk_csar_from_url(self):
418 tosca_file = 'https://github.com/openstack/heat-translator/raw/' \
419 'master/translator/tests/data/csar_elk.zip'
420 hot_file = '../tests/data/hot_output/hot_elk_from_csar.yaml'
421 params = {'github_url':
422 'http://github.com/paypal/rest-api-sample-app-nodejs.git',
424 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
427 self.assertEqual({}, diff, '<difference> : ' +
428 json.dumps(diff, indent=4, separators=(', ', ': ')))
430 def test_translate_csar_not_zip(self):
431 tosca_file = '../tests/data/csar_not_zip.zip'
437 TranslationUtils.compare_tosca_translation_with_hot,
438 tosca_file, hot_file, params)
439 path = os.path.normpath(os.path.join(
440 os.path.dirname(os.path.realpath(__file__)), tosca_file))
441 expected_msg = _('"%s" is not a valid zip file.') % path
442 ExceptionCollector.assertExceptionMessage(ValidationError,
445 def test_translate_csar_metadata_not_yaml(self):
446 tosca_file = '../tests/data/csar_metadata_not_yaml.zip'
452 TranslationUtils.compare_tosca_translation_with_hot,
453 tosca_file, hot_file, params)
454 path = os.path.normpath(os.path.join(
455 os.path.dirname(os.path.realpath(__file__)), tosca_file))
456 expected_msg = _('The file "TOSCA-Metadata/TOSCA.meta" in the CSAR '
457 '"%s" does not contain valid YAML content.') % path
458 ExceptionCollector.assertExceptionMessage(ValidationError,
461 def test_translate_csar_wrong_metadata_file(self):
462 tosca_file = '../tests/data/csar_wrong_metadata_file.zip'
468 TranslationUtils.compare_tosca_translation_with_hot,
469 tosca_file, hot_file, params)
470 path = os.path.normpath(os.path.join(
471 os.path.dirname(os.path.realpath(__file__)), tosca_file))
472 expected_msg = _('"%s" is not a valid CSAR as it does not contain the '
473 'required file "TOSCA.meta" in the folder '
474 '"TOSCA-Metadata".') % path
475 ExceptionCollector.assertExceptionMessage(ValidationError,
478 def test_translate_csar_wordpress_invalid_import_path(self):
479 tosca_file = '../tests/data/csar_wordpress_invalid_import_path.zip'
485 TranslationUtils.compare_tosca_translation_with_hot,
486 tosca_file, hot_file, params)
487 expected_msg = _('Import '
488 '"Invalid_import_path/wordpress.yaml" is not valid.')
489 ExceptionCollector.assertExceptionMessage(ImportError, expected_msg)
491 def test_translate_csar_wordpress_invalid_script_url(self):
492 tosca_file = '../tests/data/csar_wordpress_invalid_script_url.zip'
498 TranslationUtils.compare_tosca_translation_with_hot,
499 tosca_file, hot_file, params)
500 expected_msg = _('The resource at '
501 '"https://raw.githubusercontent.com/openstack/'
502 'heat-translator/master/translator/tests/data/'
503 'custom_types/wordpress1.yaml" cannot be accessed.')
504 ExceptionCollector.assertExceptionMessage(URLException, expected_msg)
506 def test_hot_translate_flavor_image(self):
507 tosca_file = '../tests/data/test_tosca_flavor_and_image.yaml'
508 hot_file = '../tests/data/hot_output/hot_flavor_and_image.yaml'
509 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
512 self.assertEqual({}, diff, '<difference> : ' +
513 json.dumps(diff, indent=4, separators=(', ', ': ')))
515 def test_hot_translate_flavor_image_params(self):
516 tosca_file = '../tests/data/test_tosca_flavor_and_image.yaml'
517 hot_file = '../tests/data/hot_output/hot_flavor_and_image_params.yaml'
518 params = {'key_name': 'paramkey'}
519 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
522 self.assertEqual({}, diff, '<difference> : ' +
523 json.dumps(diff, indent=4, separators=(', ', ': ')))
525 def test_hot_translate_custom_type(self):
526 tosca_file = '../tests/data/test_tosca_custom_type.yaml'
527 hot_file = '../tests/data/hot_output/' \
528 'hot_custom_type.yaml'
530 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
533 self.assertEqual({}, diff, '<difference> : ' +
534 json.dumps(diff, indent=4, separators=(', ', ': ')))
536 def test_hot_translate_custom_type_with_override(self):
537 tosca_file = '../tests/data/test_tosca_custom_type_with_override.yaml'
538 hot_file = '../tests/data/hot_output/' \
539 'hot_custom_type_with_override.yaml'
541 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
544 self.assertEqual({}, diff, '<difference> : ' +
545 json.dumps(diff, indent=4, separators=(', ', ': ')))
547 def test_hot_translate_custom_type_with_param_override(self):
548 tosca_file = '../tests/data/test_tosca_custom_type_with_override.yaml'
549 hot_file = '../tests/data/hot_output/' \
550 'hot_custom_type_with_param_override.yaml'
551 params = {'install_path': '/home/custom/from/cli'}
552 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
555 self.assertEqual({}, diff, '<difference> : ' +
556 json.dumps(diff, indent=4, separators=(', ', ': ')))
558 def test_hot_translate_artifact(self):
559 tosca_file = '../tests/data/test_tosca_artifact.yaml'
560 hot_file = '../tests/data/hot_output/' \
563 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
566 self.assertEqual({}, diff, '<difference> : ' +
567 json.dumps(diff, indent=4, separators=(', ', ': ')))
569 def test_hot_translate_without_tosca_os_version(self):
570 tosca_file = '../tests/data/' \
571 'test_single_server_without_optional_version_prop.yaml'
572 hot_file = '../tests/data/hot_output/' \
573 'hot_single_server_without_tosca_os_version.yaml'
575 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
578 self.assertEqual({}, diff, '<difference> : ' +
579 json.dumps(diff, indent=4, separators=(', ', ': ')))
581 def test_hot_translate_helloworld_with_userkey(self):
582 tosca_file = '../tests/data/tosca_helloworld.yaml'
583 hot_file = '../tests/data/hot_output/hot_hello_world_userkey.yaml'
584 params = {'key_name': 'userkey'}
585 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
588 self.assertEqual({}, diff, '<difference> : ' +
589 json.dumps(diff, indent=4, separators=(', ', ': ')))
591 def test_hot_translate_custom_networks_nodes_inline(self):
592 tosca_file = '../tests/data/network/' \
593 'test_tosca_custom_network_nodes_inline.yaml'
594 hot_file = '../tests/data/hot_output/network/' \
595 'hot_custom_network_nodes.yaml'
597 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
600 self.assertEqual({}, diff, '<difference> : ' +
601 json.dumps(diff, indent=4, separators=(', ', ': ')))
603 def test_hot_translate_custom_networks_nodes_imports(self):
604 tosca_file = '../tests/data/network/' \
605 'test_tosca_custom_network_nodes_imports.yaml'
606 hot_file = '../tests/data/hot_output/network/' \
607 'hot_custom_network_nodes.yaml'
609 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
612 self.assertEqual({}, diff, '<difference> : ' +
613 json.dumps(diff, indent=4, separators=(', ', ': ')))
615 def test_hot_translate_nfv_sample(self):
616 tosca_file = '../tests/data/test_tosca_nfv_sample.yaml'
617 hot_file = '../tests/data/hot_output/hot_nfv_sample.yaml'
619 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
622 self.assertEqual({}, diff, '<difference> : ' +
623 json.dumps(diff, indent=4, separators=(', ', ': ')))
625 def test_hot_translate_policy(self):
626 tosca_file = '../tests/data/tosca_policies.yaml'
627 hot_file = '../tests/data/hot_output/hot_policies.yaml'
629 diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
632 self.assertEqual({}, diff, '<difference> : ' +
633 json.dumps(diff, indent=4, separators=(', ', ': ')))