summaryrefslogtreecommitdiffstats
path: root/tosca2heat/heat-translator/translator/hot
diff options
context:
space:
mode:
Diffstat (limited to 'tosca2heat/heat-translator/translator/hot')
-rw-r--r--tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py18
-rw-r--r--tosca2heat/heat-translator/translator/hot/tests/test_translate_outputs.py4
-rw-r--r--tosca2heat/heat-translator/translator/hot/tosca/tosca_compute.py2
-rw-r--r--tosca2heat/heat-translator/translator/hot/tosca/tosca_network_network.py4
-rw-r--r--tosca2heat/heat-translator/translator/hot/translate_node_templates.py12
5 files changed, 24 insertions, 16 deletions
diff --git a/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py b/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py
index 261d8ee..8994c63 100644
--- a/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py
+++ b/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py
@@ -357,9 +357,10 @@ class HotResource(object):
node_type = node.type_definition
if isinstance(node_type, str) or \
- node_type.type == "tosca.policies.Placement" or \
- node_type.type == "tosca.policies.Colocate" or \
- node_type.type == "tosca.policies.Antilocate":
+ node_type.is_derived_from("tosca.policies.Root"):
+ # node_type.type == "tosca.policies.Placement" or \
+ # node_type.type == "tosca.policies.Placement.Colocate" or \
+ # node_type.type == "tosca.policies.Placement.Antilocate":
return operations
while True:
@@ -377,9 +378,10 @@ class HotResource(object):
def _get_interface_operations_from_type(node_type, node, lifecycle_name):
operations = {}
if isinstance(node_type, str) or \
- node_type.type == "tosca.policies.Placement" or \
- node_type.type == "tosca.policies.Colocate" or \
- node_type.type == "tosca.policies.Antilocate":
+ node_type.is_derived_from("tosca.policies.Root"):
+ # node_type.type == "tosca.policies.Placement" or \
+ # node_type.type == "tosca.policies.Placement.Colocate" or \
+ # node_type.type == "tosca.policies.Placement.Antilocate":
return operations
if node_type.interfaces and lifecycle_name in node_type.interfaces:
for name, elems in node_type.interfaces[lifecycle_name].items():
@@ -396,8 +398,8 @@ class HotResource(object):
def get_base_type(node_type):
if node_type.parent_type is not None:
if node_type.parent_type.type.endswith('.Root') or \
- node_type.type == "tosca.policies.Colocate" or \
- node_type.type == "tosca.policies.Antilocate":
+ node_type.type == "tosca.policies.Placement.Colocate" or \
+ node_type.type == "tosca.policies.Placement.Antilocate":
return node_type
else:
return HotResource.get_base_type(node_type.parent_type)
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/hot/tosca/tosca_network_network.py b/tosca2heat/heat-translator/translator/hot/tosca/tosca_network_network.py
index 2b80313..a4e565e 100644
--- a/tosca2heat/heat-translator/translator/hot/tosca/tosca_network_network.py
+++ b/tosca2heat/heat-translator/translator/hot/tosca/tosca_network_network.py
@@ -57,8 +57,8 @@ class ToscaNetwork(HotResource):
self.existing_resource_id = value
break
elif key == 'segmentation_id':
- net_props['segmentation_id'] = \
- tosca_props['segmentation_id']
+ # net_props['segmentation_id'] = \
+ # tosca_props['segmentation_id']
# Hardcode to vxlan for now until we add the network type
# and physical network to the spec.
net_props['value_specs'] = {'provider:segmentation_id':
diff --git a/tosca2heat/heat-translator/translator/hot/translate_node_templates.py b/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
index f32d42b..4dd9556 100644
--- a/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
+++ b/tosca2heat/heat-translator/translator/hot/translate_node_templates.py
@@ -533,14 +533,20 @@ class TranslateNodeTemplates(object):
def _get_attachment_node(self, node, suffix, volume_name):
attach = False
ntpl = self.nodetemplates
- for key, value in node.relationships.items():
- if key.is_derived_from('tosca.relationships.AttachesTo'):
- if value.is_derived_from('tosca.nodes.BlockStorage'):
+ for key_r, value_n in node.relationships.items():
+ if key_r.is_derived_from('tosca.relationships.AttachesTo'):
+ if value_n.is_derived_from('tosca.nodes.BlockStorage'):
attach = True
if attach:
relationship_tpl = None
for req in node.requirements:
for key, val in req.items():
+ if isinstance(val, dict):
+ if value_n.name != val.get('node'):
+ continue
+ else:
+ if value_n.name != val:
+ continue
attach = val
relship = val.get('relationship')
for rkey, rval in val.items():