diff --git a/translator/hot/tosca/tosca_compute.py b/translator/hot/tosca/tosca_compute.py index dde3ab63..77b67de7 100755 --- a/translator/hot/tosca/tosca_compute.py +++ b/translator/hot/tosca/tosca_compute.py @@ -17,7 +17,6 @@ import os import requests from toscaparser.utils.gettextutils import _ -from toscaparser.utils.validateutils import TOSCAVersionProperty import translator.common.utils from translator.hot.syntax.hot_resource import HotResource @@ -236,7 +235,6 @@ class ToscaCompute(HotResource): 'distribution', distribution) version = properties.get('version') - version = TOSCAVersionProperty(version).get_version() match_version = self._match_images(match_distribution, IMAGES, 'version', version) diff --git a/translator/tests/data/hot_output/hot_single_server_without_tosca_os_version.yaml b/translator/tests/data/hot_output/hot_single_server_without_tosca_os_version.yaml new file mode 100644 index 00000000..6be8377d --- /dev/null +++ b/translator/tests/data/hot_output/hot_single_server_without_tosca_os_version.yaml @@ -0,0 +1,18 @@ +heat_template_version: 2013-05-23 + +description: > + TOSCA simple profile that just defines a single compute instance and selects a + flavor and host Operating System for the Compute node. Note, this is just a test + template showing Compute without optional 'version' property of OS capability. + In general, you should have version to narrow down your image selection. + +parameters: {} +resources: + my_server: + type: OS::Nova::Server + properties: + flavor: m1.medium + image: rhel-6.5-test-image + key_name: userkey + user_data_format: SOFTWARE_CONFIG +outputs: {} diff --git a/translator/tests/data/test_single_server_without_optional_version_prop.yaml b/translator/tests/data/test_single_server_without_optional_version_prop.yaml new file mode 100644 index 00000000..8cf52554 --- /dev/null +++ b/translator/tests/data/test_single_server_without_optional_version_prop.yaml @@ -0,0 +1,24 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA simple profile that just defines a single compute instance and selects a + flavor and host Operating System for the Compute node. Note, this is just a test + template showing Compute without optional 'version' property of OS capability. In + general, you should have version to narrow down your image selection. + +topology_template: + + node_templates: + my_server: + type: Compute + capabilities: + host: + properties: + disk_size: 40 GB + num_cpus: 2 + mem_size: 4 MB + os: + properties: + architecture: x86_64 + type: Linux + distribution: RHEL diff --git a/translator/tests/test_tosca_hot_translation.py b/translator/tests/test_tosca_hot_translation.py index e70fe629..b3fa9bec 100644 --- a/translator/tests/test_tosca_hot_translation.py +++ b/translator/tests/test_tosca_hot_translation.py @@ -544,3 +544,15 @@ class ToscaHotTranslationTest(TestCase): params) self.assertEqual({}, diff, ' : ' + json.dumps(diff, indent=4, separators=(', ', ': '))) + + def test_hot_translate_without_tosca_os_version(self): + tosca_file = '../tests/data/' \ + 'test_single_server_without_optional_version_prop.yaml' + hot_file = '../tests/data/hot_output/' \ + 'hot_single_server_without_tosca_os_version.yaml' + params = {} + diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file, + hot_file, + params) + self.assertEqual({}, diff, ' : ' + + json.dumps(diff, indent=4, separators=(', ', ': ')))