diff options
Diffstat (limited to 'tosca2heat')
23 files changed, 73 insertions, 175 deletions
diff --git a/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py b/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py index 6499333..80a62ff 100644 --- a/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py +++ b/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py @@ -28,7 +28,10 @@ SECTIONS = (TYPE, PROPERTIES, MEDADATA, DEPENDS_ON, UPDATE_POLICY, policy_type = ['tosca.policies.Placement', 'tosca.policies.Scaling', - 'tosca.policies.Scaling.Cluster'] + 'tosca.policies.Scaling.Cluster', + 'tosca.policies.Placement.Colocate', + 'tosca.policies.Placement.Antilocate'] + log = logging.getLogger('heat-translator') diff --git a/tosca2heat/heat-translator/translator/hot/tests/test_translate_outputs.py b/tosca2heat/heat-translator/translator/hot/tests/test_translate_outputs.py index 955150e..12ea355 100644 --- a/tosca2heat/heat-translator/translator/hot/tests/test_translate_outputs.py +++ b/tosca2heat/heat-translator/translator/hot/tests/test_translate_outputs.py @@ -33,12 +33,12 @@ class ToscaTemplateOutputTest(TestCase): 'server, http://<IP>:3000', 'value': {'get_attr': - ['app_server', 'networks', 'private', 0]}}, + ['app_server', 'first_address']}}, 'mongodb_url': {'description': 'URL for the mongodb server.', 'value': {'get_attr': - ['mongo_server', 'networks', 'private', 0]}}} + ['mongo_server', 'first_address']}}} hot_translation_dict = \ toscaparser.utils.yamlparser.simple_parse(hot_translation) diff --git a/tosca2heat/heat-translator/translator/hot/tosca/tosca_compute.py b/tosca2heat/heat-translator/translator/hot/tosca/tosca_compute.py index 85f312d..5f6b751 100644 --- a/tosca2heat/heat-translator/translator/hot/tosca/tosca_compute.py +++ b/tosca2heat/heat-translator/translator/hot/tosca/tosca_compute.py @@ -211,7 +211,7 @@ class ToscaCompute(HotResource): attriute.')) if attribute == 'private_address' or \ attribute == 'public_address': - attr['get_attr'] = [self.name, 'networks', 'private', 0] + attr['get_attr'] = [self.name, 'first_address'] return attr diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_elk.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_elk.yaml index 5dda261..c7bc9cd 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_elk.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_elk.yaml @@ -52,9 +52,7 @@ resources: mongodb_ip: get_attr: - mongo_server - - networks - - private - - 0 + - first_address server: get_resource: app_server signal_transport: HEAT_SIGNAL @@ -113,9 +111,7 @@ resources: mongodb_ip: get_attr: - mongo_server - - networks - - private - - 0 + - first_address server: get_resource: mongo_server signal_transport: HEAT_SIGNAL @@ -193,9 +189,7 @@ resources: logstash_ip: get_attr: - logstash_server - - networks - - private - - 0 + - first_address server: get_resource: app_server signal_transport: HEAT_SIGNAL @@ -291,9 +285,7 @@ resources: logstash_ip: get_attr: - logstash_server - - networks - - private - - 0 + - first_address server: get_resource: app_server signal_transport: HEAT_SIGNAL @@ -371,9 +363,7 @@ resources: elasticsearch_ip: get_attr: - elasticsearch_server - - networks - - private - - 0 + - first_address server: get_resource: logstash_server signal_transport: HEAT_SIGNAL @@ -450,15 +440,11 @@ resources: elasticsearch_ip: get_attr: - elasticsearch_server - - networks - - private - - 0 + - first_address kibana_ip: get_attr: - kibana_server - - networks - - private - - 0 + - first_address server: get_resource: kibana_server signal_transport: HEAT_SIGNAL @@ -537,43 +523,33 @@ outputs: value: get_attr: - app_server - - networks - - private - - 0 + - first_address mongodb_url: description: URL for the mongodb server. value: get_attr: - mongo_server - - networks - - private - - 0 + - first_address logstash_url: description: URL for the logstash server. value: get_attr: - logstash_server - - networks - - private - - 0 + - first_address elasticsearch_url: description: URL for the elasticsearch server. value: get_attr: - elasticsearch_server - - networks - - private - - 0 + - first_address kibana_url: description: URL for the kibana server. value: get_attr: - kibana_server - - networks - - private - - 0 + - first_address diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_elk_from_csar.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_elk_from_csar.yaml index d3ae8b1..2966391 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_elk_from_csar.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_elk_from_csar.yaml @@ -52,9 +52,7 @@ resources: mongodb_ip: get_attr: - mongo_server - - networks - - private - - 0 + - first_address server: get_resource: app_server signal_transport: HEAT_SIGNAL @@ -113,9 +111,7 @@ resources: mongodb_ip: get_attr: - mongo_server - - networks - - private - - 0 + - first_address server: get_resource: mongo_server signal_transport: HEAT_SIGNAL @@ -193,9 +189,7 @@ resources: logstash_ip: get_attr: - logstash_server - - networks - - private - - 0 + - first_address server: get_resource: app_server signal_transport: HEAT_SIGNAL @@ -291,9 +285,7 @@ resources: logstash_ip: get_attr: - logstash_server - - networks - - private - - 0 + - first_address server: get_resource: app_server signal_transport: HEAT_SIGNAL @@ -371,9 +363,7 @@ resources: elasticsearch_ip: get_attr: - elasticsearch_server - - networks - - private - - 0 + - first_address server: get_resource: logstash_server signal_transport: HEAT_SIGNAL @@ -450,15 +440,11 @@ resources: elasticsearch_ip: get_attr: - elasticsearch_server - - networks - - private - - 0 + - first_address kibana_ip: get_attr: - kibana_server - - networks - - private - - 0 + - first_address server: get_resource: kibana_server signal_transport: HEAT_SIGNAL @@ -537,43 +523,33 @@ outputs: value: get_attr: - app_server - - networks - - private - - 0 + - first_address mongodb_url: description: URL for the mongodb server. value: get_attr: - mongo_server - - networks - - private - - 0 + - first_address logstash_url: description: URL for the logstash server. value: get_attr: - logstash_server - - networks - - private - - 0 + - first_address elasticsearch_url: description: URL for the elasticsearch server. value: get_attr: - elasticsearch_server - - networks - - private - - 0 + - first_address kibana_url: description: URL for the kibana server. value: get_attr: - kibana_server - - networks - - private - - 0 + - first_address diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_host_assignment.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_host_assignment.yaml index ff657cb..8a031e2 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_host_assignment.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_host_assignment.yaml @@ -61,9 +61,7 @@ resources: logstash_ip: get_attr: - logstash_server - - networks - - private - - 0 + - first_address server: get_resource: app_server signal_transport: HEAT_SIGNAL diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_nodejs_mongodb_two_instances.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_nodejs_mongodb_two_instances.yaml index 4cdfcfb..df35a10 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_nodejs_mongodb_two_instances.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_nodejs_mongodb_two_instances.yaml @@ -46,9 +46,7 @@ resources: mongodb_ip: get_attr: - mongo_server - - networks - - private - - 0 + - first_address server: get_resource: mongo_server signal_transport: HEAT_SIGNAL @@ -124,9 +122,7 @@ resources: mongodb_ip: get_attr: - mongo_server - - networks - - private - - 0 + - first_address server: get_resource: app_server signal_transport: HEAT_SIGNAL @@ -181,14 +177,10 @@ outputs: value: get_attr: - mongo_server - - networks - - private - - 0 + - first_address nodejs_url: description: URL for the nodejs server, http://<IP>:3000 value: get_attr: - app_server - - networks - - private - - 0 + - first_address diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_instance_wordpress.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_instance_wordpress.yaml index a85a34b..22c5212 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_instance_wordpress.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_instance_wordpress.yaml @@ -213,6 +213,4 @@ outputs: value: get_attr: - server - - networks - - private - - 0 + - first_address diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml index b51710e..7d01352 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml @@ -211,6 +211,4 @@ outputs: value: get_attr: - server - - networks - - private - - 0 + - first_address diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_server.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_server.yaml index f1d5a17..44a53d0 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_server.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_server.yaml @@ -32,6 +32,4 @@ outputs: value: get_attr: - my_server - - networks - - private - - 0 + - first_address diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_server_with_defaults_with_input.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_server_with_defaults_with_input.yaml index 23835c2..8235ebf 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_server_with_defaults_with_input.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_server_with_defaults_with_input.yaml @@ -32,6 +32,4 @@ outputs: value: get_attr: - my_server - - networks - - private - - 0 + - first_address diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_server_with_defaults_without_input.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_server_with_defaults_without_input.yaml index d8a0c58..cb92d01 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_server_with_defaults_without_input.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_single_server_with_defaults_without_input.yaml @@ -32,6 +32,4 @@ outputs: value: get_attr: - my_server - - networks - - private - - 0 + - first_address diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_vRNC.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_vRNC.yaml index b6de70f..904189b 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_vRNC.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/hot_vRNC.yaml @@ -491,33 +491,25 @@ outputs: value: get_attr: - MM_Active_Host - - networks - - private - - 0 + - first_address private_ip_of_CM: description: The private IP address of the CM. value: get_attr: - CM_Active_Host - - networks - - private - - 0 + - first_address private_ip_of_DM: description: The private IP address of the DM. value: get_attr: - DM_Host - - networks - - private - - 0 + - first_address private_ip_of_LB: description: The private IP address of the LB. value: get_attr: - LB_Host - - networks - - private - - 0 + - first_address diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment.yaml index 60c81ae..e664124 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment.yaml @@ -63,9 +63,7 @@ outputs: value: get_attr: - my_server - - networks - - private - - 0 + - first_address volume_id: description: The volume id of the block storage instance. value: diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt1.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt1.yaml index 069e03d..5e1c3eb 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt1.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt1.yaml @@ -77,17 +77,13 @@ outputs: value: get_attr: - my_web_app_tier_1 - - networks - - private - - 0 + - first_address private_ip_2: description: The private IP address of the applications second tier. value: get_attr: - my_web_app_tier_2 - - networks - - private - - 0 + - first_address volume_id: description: The volume id of the block storage instance. value: diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt2.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt2.yaml index 9114e12..487501d 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt2.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt2.yaml @@ -77,17 +77,13 @@ outputs: value: get_attr: - my_web_app_tier_1 - - networks - - private - - 0 + - first_address private_ip_2: description: The private IP address of the applications second tier. value: get_attr: - my_web_app_tier_2 - - networks - - private - - 0 + - first_address volume_id: description: The volume id of the block storage instance. value: diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt1.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt1.yaml index cd7a330..d615a8d 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt1.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt1.yaml @@ -81,17 +81,13 @@ outputs: value: get_attr: - my_web_app_tier_1 - - networks - - private - - 0 + - first_address private_ip_2: description: The private IP address of the applications second tier. value: get_attr: - my_web_app_tier_2 - - networks - - private - - 0 + - first_address volume_id: description: The volume id of the block storage instance. value: diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt2.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt2.yaml index 322a1f4..73a574b 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt2.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt2.yaml @@ -81,17 +81,13 @@ outputs: value: get_attr: - my_web_app_tier_1 - - networks - - private - - 0 + - first_address private_ip_2: description: The private IP address of the applications second tier. value: get_attr: - my_web_app_tier_2 - - networks - - private - - 0 + - first_address volume_id: description: The volume id of the block storage instance. value: diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_custom_relationship_type.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_custom_relationship_type.yaml index 2b7ee4b..a520c83 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_custom_relationship_type.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_custom_relationship_type.yaml @@ -64,9 +64,7 @@ outputs: value: get_attr: - my_server - - networks - - private - - 0 + - first_address volume_id: description: The volume id of the block storage instance. value: diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_relationship_template.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_relationship_template.yaml index 3991bee..2dc574c 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_relationship_template.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_blockstorage_with_relationship_template.yaml @@ -57,9 +57,7 @@ outputs: value: get_attr: - my_server - - networks - - private - - 0 + - first_address volume_id: description: The volume id of the block storage instance. value: diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt1.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt1.yaml index a37bf92..dc5fad6 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt1.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt1.yaml @@ -90,17 +90,13 @@ outputs: value: get_attr: - my_server - - networks - - private - - 0 + - first_address server_ip_2: description: The private IP address of the applications second server. value: get_attr: - my_server2 - - networks - - private - - 0 + - first_address volume_id_1: description: The volume id of the first block storage instance. value: diff --git a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt2.yaml b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt2.yaml index 10b02a9..ec5c61f 100644 --- a/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt2.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt2.yaml @@ -90,17 +90,13 @@ outputs: value: get_attr: - my_server - - networks - - private - - 0 + - first_address server_ip_2: description: The private IP address of the applications second server. value: get_attr: - my_server2 - - networks - - private - - 0 + - first_address volume_id_1: description: The volume id of the first block storage instance. value: diff --git a/tosca2heat/heat-translator/translator/tests/data/vRNC/Definitions/vRNC.yaml b/tosca2heat/heat-translator/translator/tests/data/vRNC/Definitions/vRNC.yaml index 6c9b092..458271a 100644 --- a/tosca2heat/heat-translator/translator/tests/data/vRNC/Definitions/vRNC.yaml +++ b/tosca2heat/heat-translator/translator/tests/data/vRNC/Definitions/vRNC.yaml @@ -117,9 +117,9 @@ topology_template: - local_storage: node: MM_BlockStorage relationship: Storage_attachesto - artifacts: + #artifacts: #the VM image of MM - vm_image: mm.image + #vm_image: mm.image MM_Passive: type: tosca.nodes.SoftwareComponent @@ -146,9 +146,9 @@ topology_template: node: MM_BlockStorage relationship: Storage_attachesto - high_availability: MM_Active_Host - artifacts: + #artifacts: #the VM image of MM - vm_image: mm.image + #vm_image: mm.image MM_BlockStorage: type: rnc.nodes.BlockStorage @@ -184,9 +184,9 @@ topology_template: min_instances: 1 max_instances: 12 default_instances: 1 - artifacts: + #artifacts: #the VM image of CM - vm_image: cm.image + #vm_image: cm.image CM_Passive: type: tosca.nodes.SoftwareComponent @@ -215,9 +215,9 @@ topology_template: default_instances: 1 requirements: - high_availability: CM_Active_Host - artifacts: + #artifacts: #the VM image of CM - vm_image: mm.image + #vm_image: mm.image DM: type: tosca.nodes.SoftwareComponent @@ -244,8 +244,9 @@ topology_template: min_instances: 1 max_instances: 12 default_instances: 1 - artifacts: - vm_image: dm.image + #artifacts: + #the VM image of DM + #vm_image: dm.image LB: type: tosca.nodes.SoftwareComponent @@ -272,9 +273,9 @@ topology_template: min_instances: 1 max_instances: 2 default_instances: 1 - artifacts: + #artifacts: #the VM image of LB - vm_image: lb.image + #vm_image: lb.image CTRL_Net: type: rnc.nodes.VL |