From 99368c87bb2e4a93905759dcfc36046243062fd7 Mon Sep 17 00:00:00 2001 From: shangxdy Date: Mon, 27 Feb 2017 01:19:10 +0800 Subject: [PATCH] Add ip output in compute node After sync the latest heat-translator code from upstream, there is not ip output in compute node, it's necessary to add. JIRA:PARSER-121 Change-Id: Idb0126f9d2bcb6100be6083e2a661cc1cdbe0f27 Signed-off-by: shangxdy --- .../translator/hot/tests/test_translate_outputs.py | 4 +- .../translator/hot/tosca/tosca_compute.py | 2 +- .../translator/tests/data/hot_output/hot_elk.yaml | 48 ++++++---------------- .../tests/data/hot_output/hot_elk_from_csar.yaml | 48 ++++++---------------- .../tests/data/hot_output/hot_host_assignment.yaml | 4 +- .../hot_nodejs_mongodb_two_instances.yaml | 16 ++------ .../hot_output/hot_single_instance_wordpress.yaml | 4 +- .../hot_single_instance_wordpress_from_csar.yaml | 4 +- .../tests/data/hot_output/hot_single_server.yaml | 4 +- ...hot_single_server_with_defaults_with_input.yaml | 4 +- ..._single_server_with_defaults_without_input.yaml | 4 +- .../translator/tests/data/hot_output/hot_vRNC.yaml | 16 ++------ .../storage/hot_blockstorage_with_attachment.yaml | 4 +- ...lockstorage_with_attachment_notation1_alt1.yaml | 8 +--- ...lockstorage_with_attachment_notation1_alt2.yaml | 8 +--- ...lockstorage_with_attachment_notation2_alt1.yaml | 8 +--- ...lockstorage_with_attachment_notation2_alt2.yaml | 8 +--- ...blockstorage_with_custom_relationship_type.yaml | 4 +- ...ot_blockstorage_with_relationship_template.yaml | 4 +- ...multiple_blockstorage_with_attachment_alt1.yaml | 8 +--- ...multiple_blockstorage_with_attachment_alt2.yaml | 8 +--- 21 files changed, 56 insertions(+), 162 deletions(-) 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://: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://: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: -- 2.16.6