diff options
author | shangxdy <shang.xiaodong@zte.com.cn> | 2016-09-01 00:27:36 +0800 |
---|---|---|
committer | shangxdy <shang.xiaodong@zte.com.cn> | 2016-09-01 00:27:36 +0800 |
commit | 528ed804c77758d8e7270ec5a76cc5279330b086 (patch) | |
tree | 5081084439f78d6b3c9230ea2bb6d73e34c1bea6 | |
parent | 5298fb1f996ab547c518b085e8c39fc5e0665bd9 (diff) |
Fix network info output about compute node
In the template version of 2013-05-23, the intrinsic function of
get_attr doesn't support keys or indexes, it requires 2014-10-16 or
higher, the syntax is below:
get_attr:
<resource name>
<attribute name>
<key/index 1> (optional) not support in 2013-05-23
<key/index 2> (optional) not support in 2013-05-23
So the translation about compute node's ip address only uses two
parameters currently.
JIRA:PARSER-101
Change-Id: I51e5d7c04c329ede69ff3be61bbee2941b56ea93
Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
20 files changed, 6 insertions, 102 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..c02a547 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', 'networks']}}, 'mongodb_url': {'description': 'URL for the mongodb server.', 'value': {'get_attr': - ['mongo_server', 'networks', 'private', 0]}}} + ['mongo_server', 'networks']}}} 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 45637ec..9ceb049 100644 --- a/tosca2heat/heat-translator/translator/hot/tosca/tosca_compute.py +++ b/tosca2heat/heat-translator/translator/hot/tosca/tosca_compute.py @@ -332,7 +332,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, 'networks'] 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 a298745..1fbd44e 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,8 +52,6 @@ resources: get_attr: - mongo_server - networks - - private - - 0 server: get_resource: app_server depends_on: @@ -110,8 +108,6 @@ resources: get_attr: - mongo_server - networks - - private - - 0 server: get_resource: mongo_server depends_on: @@ -186,8 +182,6 @@ resources: get_attr: - logstash_server - networks - - private - - 0 server: get_resource: app_server depends_on: @@ -279,8 +273,6 @@ resources: get_attr: - logstash_server - networks - - private - - 0 server: get_resource: app_server depends_on: @@ -355,8 +347,6 @@ resources: get_attr: - elasticsearch_server - networks - - private - - 0 server: get_resource: logstash_server depends_on: @@ -430,14 +420,10 @@ resources: get_attr: - elasticsearch_server - networks - - private - - 0 kibana_ip: get_attr: - kibana_server - networks - - private - - 0 server: get_resource: kibana_server depends_on: @@ -510,8 +496,6 @@ outputs: get_attr: - app_server - networks - - private - - 0 mongodb_url: description: URL for the mongodb server. @@ -519,8 +503,6 @@ outputs: get_attr: - mongo_server - networks - - private - - 0 logstash_url: description: URL for the logstash server. @@ -528,8 +510,6 @@ outputs: get_attr: - logstash_server - networks - - private - - 0 elasticsearch_url: description: URL for the elasticsearch server. @@ -537,8 +517,6 @@ outputs: get_attr: - elasticsearch_server - networks - - private - - 0 kibana_url: description: URL for the kibana server. @@ -546,6 +524,3 @@ outputs: get_attr: - kibana_server - networks - - private - - 0 - 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 5eb1701..50491ef 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,8 +52,7 @@ resources: get_attr: - mongo_server - networks - - private - - 0 + server: get_resource: app_server depends_on: @@ -110,8 +109,7 @@ resources: get_attr: - mongo_server - networks - - private - - 0 + server: get_resource: mongo_server depends_on: @@ -186,8 +184,6 @@ resources: get_attr: - logstash_server - networks - - private - - 0 server: get_resource: app_server depends_on: @@ -279,8 +275,6 @@ resources: get_attr: - logstash_server - networks - - private - - 0 server: get_resource: app_server depends_on: @@ -355,8 +349,6 @@ resources: get_attr: - elasticsearch_server - networks - - private - - 0 server: get_resource: logstash_server depends_on: @@ -430,14 +422,11 @@ resources: get_attr: - elasticsearch_server - networks - - private - - 0 kibana_ip: get_attr: - kibana_server - networks - - private - - 0 + server: get_resource: kibana_server depends_on: @@ -510,8 +499,6 @@ outputs: get_attr: - app_server - networks - - private - - 0 mongodb_url: description: URL for the mongodb server. @@ -519,8 +506,6 @@ outputs: get_attr: - mongo_server - networks - - private - - 0 logstash_url: description: URL for the logstash server. @@ -528,8 +513,6 @@ outputs: get_attr: - logstash_server - networks - - private - - 0 elasticsearch_url: description: URL for the elasticsearch server. @@ -537,8 +520,6 @@ outputs: get_attr: - elasticsearch_server - networks - - private - - 0 kibana_url: description: URL for the kibana server. @@ -546,6 +527,4 @@ outputs: get_attr: - kibana_server - networks - - private - - 0 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 33f3059..29f12cc 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 @@ -59,8 +59,6 @@ resources: get_attr: - logstash_server - networks - - private - - 0 server: get_resource: app_server depends_on: 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 b95120b..3406b51 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,8 +46,6 @@ resources: get_attr: - mongo_server - networks - - private - - 0 server: get_resource: mongo_server depends_on: @@ -120,8 +118,6 @@ resources: get_attr: - mongo_server - networks - - private - - 0 server: get_resource: app_server depends_on: @@ -173,13 +169,9 @@ outputs: get_attr: - mongo_server - networks - - private - - 0 nodejs_url: description: URL for the nodejs server, http://<IP>:3000 value: get_attr: - app_server - networks - - private - - 0 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 8c10a93..fbbeab2 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 @@ -205,5 +205,3 @@ outputs: get_attr: - server - networks - - private - - 0 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 3598540..02c0543 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 @@ -203,5 +203,3 @@ outputs: get_attr: - server - networks - - private - - 0 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 5cffb43..e494791 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,5 +32,3 @@ outputs: get_attr: - my_server - networks - - private - - 0 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 1eb88a7..6211cad 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,5 +32,3 @@ outputs: get_attr: - my_server - networks - - private - - 0 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 4e7e6b5..22a0198 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,5 +32,3 @@ outputs: get_attr: - my_server - networks - - private - - 0 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 5ff5382..6803858 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,8 +63,6 @@ outputs: get_attr: - my_server - networks - - private - - 0 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 9ffaf23..0450b1f 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 @@ -76,16 +76,12 @@ outputs: get_attr: - my_web_app_tier_1 - networks - - private - - 0 private_ip_2: description: The private IP address of the applications second tier. value: get_attr: - my_web_app_tier_2 - networks - - private - - 0 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 9b5e71c..e65e789 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 @@ -76,16 +76,12 @@ outputs: get_attr: - my_web_app_tier_1 - networks - - private - - 0 private_ip_2: description: The private IP address of the applications second tier. value: get_attr: - my_web_app_tier_2 - networks - - private - - 0 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 1b4eb73..a8c114e 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 @@ -80,16 +80,12 @@ outputs: get_attr: - my_web_app_tier_1 - networks - - private - - 0 private_ip_2: description: The private IP address of the applications second tier. value: get_attr: - my_web_app_tier_2 - networks - - private - - 0 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 0311a55..59b46ae 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 @@ -80,16 +80,12 @@ outputs: get_attr: - my_web_app_tier_1 - networks - - private - - 0 private_ip_2: description: The private IP address of the applications second tier. value: get_attr: - my_web_app_tier_2 - networks - - private - - 0 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 bce4603..639832c 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,8 +64,6 @@ outputs: get_attr: - my_server - networks - - private - - 0 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 e17dff9..20b77c2 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,8 +57,6 @@ outputs: get_attr: - my_server - networks - - private - - 0 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 55ada08..cff83f9 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 @@ -89,16 +89,12 @@ outputs: get_attr: - my_server - networks - - private - - 0 server_ip_2: description: The private IP address of the applications second server. value: get_attr: - my_server2 - networks - - private - - 0 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 3386d79..0fdcb4b 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 @@ -89,16 +89,12 @@ outputs: get_attr: - my_server - networks - - private - - 0 server_ip_2: description: The private IP address of the applications second server. value: get_attr: - my_server2 - networks - - private - - 0 volume_id_1: description: The volume id of the first block storage instance. value: |